From 628cc891894e57cb2f546b2060ac5ae60fc0ad98 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 9 Jul 2019 16:23:58 +0300 Subject: [PATCH] absence page --- Mohem/src/app/absence/absence.module.ts | 14 +- .../src/app/absence/home/home.component.html | 4 +- Mohem/src/app/absence/home/home.component.ts | 30 +- .../absence/service/submit.absence.service.ts | 66 + .../submit-absence.component.html | 60 + .../submit-absence.component.scss | 5 + .../submit-absence.component.spec.ts | 27 + .../submit-absence.component.ts | 1406 ++++++++++++ .../authentication/login/login.component.html | 2 +- .../authentication/login/login.component.scss | 11 +- .../services/common/common.service.ts | 2040 +++++++++-------- .../src/app/my-team/home/home.component.html | 2 +- Mohem/src/app/uI-elements/date-time.input.ts | 2 +- Mohem/src/app/uI-elements/date.input.ts | 2 +- Mohem/src/app/uI-elements/select.input.ts | 24 +- Mohem/src/assets/localization/i18n.json | 77 + Mohem/src/theme/styles.scss | 8 +- 17 files changed, 2757 insertions(+), 1023 deletions(-) create mode 100644 Mohem/src/app/absence/service/submit.absence.service.ts create mode 100644 Mohem/src/app/absence/submit-absence/submit-absence.component.html create mode 100644 Mohem/src/app/absence/submit-absence/submit-absence.component.scss create mode 100644 Mohem/src/app/absence/submit-absence/submit-absence.component.spec.ts create mode 100644 Mohem/src/app/absence/submit-absence/submit-absence.component.ts diff --git a/Mohem/src/app/absence/absence.module.ts b/Mohem/src/app/absence/absence.module.ts index a9343dcf..b4e10326 100644 --- a/Mohem/src/app/absence/absence.module.ts +++ b/Mohem/src/app/absence/absence.module.ts @@ -4,11 +4,11 @@ import { FormsModule } from '@angular/forms'; import { Routes, RouterModule } from '@angular/router'; import { AbsenceListService } from "./service/service.service"; import { IonicModule } from '@ionic/angular'; - +import { SubmitAbsenceService } from './service/submit.absence.service'; import { AbsencePage } from './absence.page'; - +import { DatePicker } from '@ionic-native/date-picker/ngx'; import { HomeComponent } from './home/home.component'; - +import { SubmitAbsenceComponent } from './submit-absence/submit-absence.component'; const routes: Routes = [ { path: '', @@ -17,6 +17,10 @@ const routes: Routes = [ { path: 'home', component: HomeComponent + }, + { + path: 'submit-absence', + component: SubmitAbsenceComponent } ] } @@ -29,7 +33,7 @@ const routes: Routes = [ IonicModule, RouterModule.forChild(routes) ], - providers:[AbsenceListService], - declarations: [AbsencePage, HomeComponent] + providers:[AbsenceListService, SubmitAbsenceService, DatePicker], + declarations: [AbsencePage, HomeComponent, SubmitAbsenceComponent] }) export class AbsencePageModule {} diff --git a/Mohem/src/app/absence/home/home.component.html b/Mohem/src/app/absence/home/home.component.html index b2ffd85a..10dee901 100644 --- a/Mohem/src/app/absence/home/home.component.html +++ b/Mohem/src/app/absence/home/home.component.html @@ -2,7 +2,7 @@ {{ts.trPK('absenceList','absenceList')}} - + + + + + {{ts.trPK('submitAbsence','comments')}} + + +
+
+ + +
+ {{ts.trPK('general','next')}} +
+
diff --git a/Mohem/src/app/absence/submit-absence/submit-absence.component.scss b/Mohem/src/app/absence/submit-absence/submit-absence.component.scss new file mode 100644 index 00000000..8783b654 --- /dev/null +++ b/Mohem/src/app/absence/submit-absence/submit-absence.component.scss @@ -0,0 +1,5 @@ +.search-button{ + background: transparent; + font-size: 25px; + color: #7F8C8D; +} diff --git a/Mohem/src/app/absence/submit-absence/submit-absence.component.spec.ts b/Mohem/src/app/absence/submit-absence/submit-absence.component.spec.ts new file mode 100644 index 00000000..a6743f2e --- /dev/null +++ b/Mohem/src/app/absence/submit-absence/submit-absence.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SubmitAbsenceComponent } from './submit-absence.component'; + +describe('SubmitAbsenceComponent', () => { + let component: SubmitAbsenceComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SubmitAbsenceComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SubmitAbsenceComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/absence/submit-absence/submit-absence.component.ts b/Mohem/src/app/absence/submit-absence/submit-absence.component.ts new file mode 100644 index 00000000..a5dbad41 --- /dev/null +++ b/Mohem/src/app/absence/submit-absence/submit-absence.component.ts @@ -0,0 +1,1406 @@ +import { Component, OnInit, ElementRef } from "@angular/core"; +import { CommonService } from "src/app/hmg-common/services/common/common.service"; +import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service"; +import { MenuService } from "src/app/hmg-common/services/menu/menuservice.service"; +import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response"; +import { ModalController } from "@ionic/angular"; +import { SubmitAbsenceService } from "../service/submit.absence.service"; +import { AbsenceAttahcmentResponse } from "../models/abs.attach.response"; +import { AbsenceListService } from "../service/service.service"; +import { AbsenceDffResponse } from "../models/abs_dff_response"; +import { AbsenceTransaction } from "../models/absence.transaction"; +import { MenuEntry } from "../../hmg-common/services/menu/models/menu.entry"; +import { ButtonInput } from "../../uI-elements/button.input"; +import { HiddenInput } from "../../uI-elements/hidden.input"; +import { TextAreaInput } from "../../uI-elements/text-area.input"; +import { TextInput } from "../../uI-elements/text.input"; +import { NumberInput } from "../../uI-elements/number.input"; +import { SelectInput } from "../../uI-elements/select.input"; +import { DateInput } from "../../uI-elements/date.input"; +import { TimeInput } from "../../uI-elements/time.input"; +import { DateTimeInput } from "../../uI-elements/date-time.input"; +import { DatePicker } from "@ionic-native/date-picker/ngx"; +import { Request } from "../models/request"; +import * as moment from "moment"; +@Component({ + selector: "app-submit-absence", + templateUrl: "./submit-absence.component.html", + styleUrls: ["./submit-absence.component.scss"] +}) +export class SubmitAbsenceComponent implements OnInit { + private textArea: TextAreaInput; + private numberInput: NumberInput; + private textInput: TextInput; + private selectInput: SelectInput; + private dateInput: DateInput; + private timeInput: TimeInput; + private datetimeInput: DateTimeInput; + private buttonInput: ButtonInput; + private hiddenInput: HiddenInput; + private eitVALSettoCall: any = []; + private action: string = ""; + menuType: any; + employeeSel: any; + absenceType: any; + absenceTypeName: string = null; + absenceTypeList: any; + startDate: any; + startTime: string = null; + endTime: string = null; + endDate: any; + absComments: string = null; + type: any; + totalDays: any; + hoursOrDay: string = ""; + replacmentEmployeeInfo: any; + employeeName: string; + employeeID: string = null; + selEmp: string; + respID: number; + selMenu: MenuResponse; + getPassMnuEntryObj: MenuEntry; + notificationId: number; + itemKey: string = null; + //private ExtraObj:any={}; + private absenceDffresponse: AbsenceDffResponse[]; + private absenceRrequest: AbsenceTransaction; + /*****for resubmit******* */ + getPassNotificationDetails: any; + getPassdirfromNotifiPage: boolean = false; + functionName: string = ""; + private submitAbsObjList: any = []; + // private updatedValues:any=[]; + constructor( + public submitAbsService: SubmitAbsenceService, + public modalCtrl: ModalController, + // public ReplacmentList: WorklistReplacmentEmployeeService, + public common: CommonService, + public datePicker: DatePicker, + public ts: TranslatorService, + private elementRef: ElementRef + ) { + ////*new add*///// + /**********resubmit************ */ + //this.getPassNotificationDetails = this.common.sharedService.getSharedData(AbsenceNotificatonBodyResponse.NOT_WORKLIST, true); + // this.getPassdirfromNotifiPage = this.navParams.get('dirfromNotificationPage'); + if (this.getPassdirfromNotifiPage) { + this.functionName = this.getPassNotificationDetails.FUNCTION_NAME; //;this.getPassNotificationDetails.NOTIFICATION_NAME; + this.menuType = "E"; + this.itemKey = this.getPassNotificationDetails.ITEM_KEY; + this.notificationId = this.getPassNotificationDetails.NOTIFICATION_ID; + this.selEmp = this.getPassNotificationDetails.SELECTED_EMPLOYEE_NUMBER; + this.respID = -999; + //this.submitAbsObjList = this.navParams.get('submitAbsObjList'); + } else { + this.action = "CREATE"; + this.selEmp = this.common.sharedService.getSharedData( + MenuResponse.SHARED_SEL_EMP, + false + ); + this.respID = this.common.sharedService.getSharedData( + MenuResponse.SHARED_SEL_RESP_ID, + false + ); + this.selMenu = new MenuResponse(); + this.selMenu = this.common.sharedService.getSharedData( + MenuResponse.SHARED_DATA, + false + ); + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.getPassMnuEntryObj = this.selMenu.GetMenuEntriesList; + this.functionName = this.getPassMnuEntryObj.FUNCTION_NAME; + this.submitAbsObjList = []; + } + this.absenceDffresponse = []; + } + + ngOnInit() { + this.getAbsenceTypes(); + } + private getAbsenceDffStructure() { + const body = { + P_FUNCTION_NAME: this.functionName, + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, + P_DESC_FLEX_CONTEXT_CODE: this.absenceTypeName + }; + this.submitAbsService + .getAbsenceDffStructure(body) + .subscribe((result: any) => { + this.handleAbcenseDFFStructure(result); + }); + } + + handleAbcenseDFFStructure(result) { + if (result.GetAbsenceDffStructureList != null) { + this.absenceDffresponse = result.GetAbsenceDffStructureList; + this.drawAbcenseFields(result.GetAbsenceDffStructureList); + } + } + + getAbsenceTypes() { + let AbsenceType: Request = new Request(); + //let user = this.sharedData.getSharedData(LoginResponse.SHARED_DATA,true) + + const request = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp + }; + this.submitAbsService.getAbsenceType(request).subscribe((result: any) => { + this.handlegetAbsenceTypes(result); + }); + } + handlegetAbsenceTypes(result) { + if (this.common.validResponse(result)) { + if (this.common.hasData(result.GetAbsenceAttendanceTypesList)) { + this.absenceTypeList = result.GetAbsenceAttendanceTypesList; + this.hoursOrDay = this.absenceTypeList[0].HOURS_OR_DAYS; + if (this.submitAbsObjList && this.submitAbsObjList.length > 0) { + this.fillStaticStructure(); + } + } + } + } + calcDay() { + let msg: string = ""; + if ( + this.startDate == undefined || + this.startDate == "" || + this.startDate == null + ) { + // msg=this.translate.translate("submitAbsence.enterSDate"); + // this.common.showAlert(msg); + return; + } else if ( + this.endDate == undefined || + this.endDate == "" || + this.endDate == null + ) { + // msg=this.translate.translate("submitAbsence.enterEDate"); + // this.common.showAlert(msg); + return; + } else if (!this.absenceType) { + // msg=this.translate.translate("submitAbsence.selAbsType"); + // this.common.showAlert(msg); + return; + } else { + let numberOfType: number = parseInt(this.absenceType); + let Sdata = moment(this.startDate).format("DD-MMM-YYYY"); //(dd/mmm/yyyy) + let Edata = moment(this.endDate).format("DD-MMM-YYYY"); + const request = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_ABSENCE_ATTENDANCE_TYPE_ID: numberOfType, + P_DATE_START: Sdata, + P_DATE_END: Edata, + P_SELECTED_RESP_ID: this.respID, + P_MENU_TYPE: this.menuType, + P_TIME_START: null, + P_TIME_END: null + }; + this.submitAbsService.getCalc(request).subscribe((result: any) => { + this.handlecalcDay(result); + }); + } + } + + handlecalcDay(result) { + if (this.common.validResponse(result)) { + // console.log(result); + this.totalDays = result.CalculateAbsenceDuration.P_ABSENCE_DAYS; + } + } + + SearchReplacment() { + let pageClosed = retData => { + this.replacmentEmployeeInfo = retData; + // this.replacmentEmployeeInfo=this.sharedData.getSharedData(ReplacmentResponse.SHARED_DATA,true); + // console.log(this.replacmentEmployeeInfo) + if (this.replacmentEmployeeInfo) { + this.employeeName = this.replacmentEmployeeInfo.EMPLOYEE_DISPLAY_NAME; + this.employeeID = this.replacmentEmployeeInfo.USER_NAME; + this.employeeSel = this.employeeName + "," + this.employeeID; + } + //Do something + }; + // this.navCtrl.push(ServiceNewPage, {pageClosed: pageClosed}); + // this.navCtrl.push("ReplacmentListModelPage", { + // pageClosed: pageClosed + // }); + } + handleReplacment(result) { + if (this.common.validResponse(result)) { + console.log(result); + } + } + clearEmployee() { + this.employeeName = ""; + this.employeeID = ""; + } + + public onTypeAbsenceChange() { + if (this.absenceType) { + let obj: any = this.absenceTypeList.find( + s => s.ABSENCE_ATTENDANCE_TYPE_ID == this.absenceType + ); + if (obj) this.absenceTypeName = obj.DESC_FLEX_CONTEXT_CODE; + else this.absenceTypeName = null; + this.getAbsenceDffStructure(); + } else { + this.absenceTypeName = null; + } + } + + /***************draw Absence*******************/ + private drawAbcenseFields(feildsList) { + const containerId = "dynamic-abs-container"; + document.getElementById(containerId).innerHTML = ""; + this.eitVALSettoCall = []; + for (let i = 0; i < feildsList.length; i++) { + let defaultVal: string = ""; + let defaultValText: string = ""; + defaultVal = feildsList[i].E_SERVICES_DV.P_ID_COLUMN_NAME + ? feildsList[i].E_SERVICES_DV.P_ID_COLUMN_NAME + : ""; + defaultValText = feildsList[i].E_SERVICES_DV.P_VALUE_COLUMN_NAME + ? feildsList[i].E_SERVICES_DV.P_VALUE_COLUMN_NAME + : ""; + + if (feildsList[i].DISPLAY_FLAG != "N") { + //check if the field should be displayed + if (feildsList[i].VALIDATION_TYPE == "N") { + //text , date , time + if (feildsList[i].FORMAT_TYPE == "C") { + // character + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + defaultValText, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].FORMAT_TYPE == "N") { + // number + this.numberInput = new NumberInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else if (feildsList[i].FORMAT_TYPE == "X") { + // standard date + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + //constant + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + this.common.reverseFormatDate(defaultVal), + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else { + this.dateInput = new DateInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } + } else if (feildsList[i].FORMAT_TYPE == "Y") { + // standard date time + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + this.datetimeInput = new DateTimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + this.common.reverseFormatStandardDate(defaultVal), + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else { + this.datetimeInput = new DateTimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } + const elem = document.getElementById( + feildsList[i].APPLICATION_COLUMN_NAME + ); + elem.addEventListener("click", e => { + if (feildsList[i].MOBILE_ENABLED != "Y") return false; + this.showDateTimePicker( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i].MAXIMUM_SIZE + ); + e.stopImmediatePropagation(); + }); + } else if (feildsList[i].FORMAT_TYPE == "I") { + //time + if ( + feildsList[i].DEFAULT_TYPE == "C" || + feildsList[i].DEFAULT_TYPE == "D" || + feildsList[i].DEFAULT_TYPE == "P" || + feildsList[i].DEFAULT_TYPE == "S" + ) { + this.timeInput = new TimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else { + this.timeInput = new TimeInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } + const elem = document.getElementById( + feildsList[i].APPLICATION_COLUMN_NAME + ); + elem.addEventListener("click", e => { + if (feildsList[i].MOBILE_ENABLED != "Y") return false; + this.showTimePicker( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i].MAXIMUM_SIZE + ); + e.stopImmediatePropagation(); + }); + } + } else { + if (feildsList[i].READ_ONLY == "Y") { + this.textInput = new TextInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultValText, + containerId, + defaultVal, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + } else { + this.selectInput = new SelectInput( + feildsList[i].SEGMENT_PROMPT, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultVal, + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG + ); + + this.fillDropdownList( + feildsList[i].SEGMENT_NAME, + feildsList[i].E_SERVICES_VS, + feildsList[i].E_SERVICES_DV + ); + } + } + + this.bindHtmlElemEvents( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i] + ); + } else { + this.hiddenInput = new HiddenInput( + defaultVal, + feildsList[i].APPLICATION_COLUMN_NAME, + defaultValText, + containerId + ); + + this.bindHtmlElemEvents( + feildsList[i].APPLICATION_COLUMN_NAME, + feildsList[i] + ); + } + } + + if (this.submitAbsObjList && this.submitAbsObjList.length > 0) { + this.fillAbsStructure(); + } + } + bindHtmlElemEvents(id, obj) { + return false; + const elem = document.getElementById(id); + elem.addEventListener("change", e => { + elem.classList.remove("requiredClassElm"); + if ( + obj.CHILD_SEGMENTS_VS_Splited && + obj.CHILD_SEGMENTS_VS_Splited.length > 0 + ) { + let listArray: any = obj.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + //if(isEmpty) + this.emptyChildElement(element); + // else + this.getValueSet(element); + }); + } + if ( + obj.CHILD_SEGMENTS_DV_Splited && + obj.CHILD_SEGMENTS_DV_Splited.length > 0 + ) { + let listArray: any = obj.CHILD_SEGMENTS_DV_Splited; + listArray.forEach(element => { + // if(isEmpty){ + this.emptyChildElement(element); + // }else{ + for (let i = 0; i < this.absenceDffresponse.length; i++) { + if (this.absenceDffresponse[i].SEGMENT_NAME == element) { + this.getDefaultValue( + this.absenceDffresponse[i], + this.absenceDffresponse[i].DESC_FLEX_NAME, + this.absenceDffresponse[i].DESC_FLEX_CONTEXT_CODE, + this.absenceDffresponse[i].SEGMENT_NAME, + this.absenceDffresponse[i].PARENT_SEGMENTS_VS_SplitedVS, + this.absenceDffresponse[i].PARENT_SEGMENTS_DV_Splited + ); + } + } + // } + }); + } + return false; + // e.stopImmediatePropagation(); + }); + } + callValueSet() { + for (var i = 0; i < this.eitVALSettoCall.length; i++) { + this.getValueSet(this.eitVALSettoCall[i].SEGMENT_NAME); + } + } + public getValueSet(segmentName) { + let descFlexName: any = ""; + let descFlexContextCode: any = ""; + let parentValue: any = []; + let ParentsList: any = []; + let parentVal: any = null; + let dependenciesList: any = []; + let validationType: string = ""; + + for (let i = 0; i < this.absenceDffresponse.length; i++) { + if (this.absenceDffresponse[i].SEGMENT_NAME == segmentName) { + descFlexName = this.absenceDffresponse[i].DESC_FLEX_NAME; + descFlexContextCode = this.absenceDffresponse[i].DESC_FLEX_CONTEXT_CODE; + parentValue = this.absenceDffresponse[i].PARENT_SEGMENTS_VS_SplitedVS; + ParentsList = this.absenceDffresponse[i].PARENT_SEGMENTS_VS_SplitedVS; + validationType = this.absenceDffresponse[i].VALIDATION_TYPE; + break; + } + } + if (parentValue != "" && (validationType == "D" || validationType == "Y")) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { + return false; + } + } + if (ParentsList != "") { + dependenciesList = this.getDependenciesParams(ParentsList); + if (!dependenciesList) { + return false; + } + } + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, //-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList, + P_PAGE_NUM: 1, + P_PAGE_LIMIT: 1000 + }; + + this.submitAbsService.getSetValue(body).subscribe((result: any) => { + if (result.GetValueSetValuesList != null) { + this.fillDropdownList(segmentName, result.GetValueSetValuesList); + } + }); + let arr: any = []; + return arr; + } + + getParentValue(parentValue) { + if (parentValue.length == 0) { + for (let i = 0; i < this.absenceDffresponse.length; i++) { + if (this.absenceDffresponse[i].SEGMENT_NAME == parentValue[0].Name) { + if (this.absenceDffresponse[i].VALIDATION_TYPE == "N") { + let val = (document.getElementById( + this.absenceDffresponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + return val; + } else { + let x = document.getElementById( + this.absenceDffresponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + if (x.options.length > 0) { + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : null; + return val; + } else { + return ""; + } + } + } + } + } else { + return ""; + } + } + public showDateTimePicker(elemID, maxSize) { + let elem = document.getElementById(elemID) as HTMLDivElement; + let date: any; + let value = elem.innerHTML; + if (value) date = moment(value, "YYYY/MM/DD HH:mm:ss").toDate(); + else date = new Date(); + this.datePicker + .show({ + date: date, + is24Hour: true, + mode: "datetime" + }) + .then( + date => { + let dateString: string = moment(date).format("YYYY/MM/DD HH:mm:ss"); + //remove seconds if the maximum size is 17 + if (maxSize == 17) { + elem.innerHTML = dateString.substring(0, 16); + elem.dataset.dtvalue = dateString.substring(0, 16); + } else { + elem.innerHTML = dateString; + elem.dataset.dtvalue = dateString; + } + }, + err => console.log("Error occurred while getting date: ", err) + ); + } + public showTimePicker(elemID, maxSize) { + let elem = document.getElementById(elemID) as HTMLDivElement; + let date: any; + let value = elem.innerHTML; + if (value) { + let nowDate = moment().format("YYYY/MM/DD") + " " + value; + date = moment(nowDate, "YYYY/MM/DD HH:mm:ss").toDate(); + } else { + date = new Date(); + } + this.datePicker + .show({ + date: date, + is24Hour: true, + mode: "time" + }) + .then( + date => { + let dateString: string = moment(date).format("HH:mm:ss"); + //remove seconds if the maximum size is 5 + if (maxSize == 5) { + elem.innerHTML = dateString.substring(0, 5); + elem.dataset.dtvalue = dateString.substring(0, 5); + } else { + elem.innerHTML = dateString; + elem.dataset.dtvalue = dateString; + } + }, + err => console.log("Error occurred while getting date: ", err) + ); + } + getDependenciesParams(parentsList) { + let parentArr: any = []; + for (let i = 0; i < parentsList.length; i++) { + for (let j = 0; j < this.absenceDffresponse.length; j++) { + if (this.absenceDffresponse[j].SEGMENT_NAME == parentsList[i].Name) { + if (this.absenceDffresponse[j].DISPLAY_FLAG != "N") { + if (this.absenceDffresponse[j].VALIDATION_TYPE == "N") { + let idColName: string; + let val: any; + if ( + this.absenceDffresponse[j].FORMAT_TYPE == "Y" || + this.absenceDffresponse[j].FORMAT_TYPE == "I" + ) { + //standard date time or //time + let elem = document.getElementById( + this.absenceDffresponse[j].APPLICATION_COLUMN_NAME + ) as HTMLDivElement; + val = elem.dataset.dtvalue; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } + idColName = val; + if (this.absenceDffresponse[j].FORMAT_TYPE == "Y") + idColName = this.common.formatStandardDate(val); + } else { + val = (document.getElementById( + this.absenceDffresponse[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } + idColName = val; + if (this.absenceDffresponse[j].FORMAT_TYPE == "X") { + //date + idColName = this.common.formatDate(val); + } + } + parentArr.push({ + SEGMENT_NAME: this.absenceDffresponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: val, + DESCRIPTION: "", + ID_COLUMN_NAME: idColName, + FLEX_VALUE_SET_NAME: this.absenceDffresponse[j] + .FLEX_VALUE_SET_NAME + }); + break; + } else { + if (this.absenceDffresponse[j].READ_ONLY != "Y") { + let x = document.getElementById( + this.absenceDffresponse[j].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + let text = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].text + : ""; + let val = x.options[x.selectedIndex] + ? x.options[x.selectedIndex].value + : undefined; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.absenceDffresponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.absenceDffresponse[j] + .FLEX_VALUE_SET_NAME + }); + break; + } else { + let x = document.getElementById( + this.absenceDffresponse[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let text = x.value; + let val = x.dataset.colmText; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + // alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.absenceDffresponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.absenceDffresponse[j] + .FLEX_VALUE_SET_NAME + }); + break; + } + } + } else { + let x = document.getElementById( + this.absenceDffresponse[j].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let text = x.value; + let val = x.dataset.colmText; + if ( + (val == undefined || val == "") && + parentsList[i].IsRequired == "REQUIRED" + ) { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { + } + if (text == undefined) { + text = ""; + } + parentArr.push({ + SEGMENT_NAME: this.absenceDffresponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.absenceDffresponse[j] + .FLEX_VALUE_SET_NAME + }); + break; + } + } + } + } + return parentArr; + } + emptyChildElement(segmentName) { + let elem = this.getElementByName(segmentName); + elem.value = null; + elem.innerHTML = ""; + if ("dtvalue" in elem.dataset) { + elem.dataset.dtvalue = ""; + } + if ("colmText" in elem.dataset) { + elem.dataset.colmText = ""; + } + var event = new Event("change"); + elem.dispatchEvent(event); + elem.classList.remove("requiredClassElm"); + } + fillDropdownList(segmentName, optionList: any = [], DV: any = "") { + let elemID: any = ""; + let absenceObj: any; + if (optionList.length > 0) { + for (let i = 0; i < this.absenceDffresponse.length; i++) { + if (this.absenceDffresponse[i].SEGMENT_NAME == segmentName) { + if ( + this.absenceDffresponse[i].READ_ONLY == "Y" || + this.absenceDffresponse[i].DISPLAY_FLAG == "N" + ) { + return false; + } + elemID = this.absenceDffresponse[i].APPLICATION_COLUMN_NAME; + absenceObj = this.absenceDffresponse[i]; + break; + } + } + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + + // for(let i = select.options.length - 1 ; i >= 0 ; i--) + // { + // select.remove(i); + // } + if (absenceObj.IsEmptyOption && absenceObj.REQUIRED_FLAG == "N") { + var firstoption = document.createElement("option"); + //firstoption.text = this.translate.translate("general.choose"); + firstoption.value = ""; + select.add(firstoption); + } + for (let i = 0; i < optionList.length; i++) { + var option = document.createElement("option"); + option.text = optionList[i].VALUE_COLUMN_NAME; + option.value = optionList[i].ID_COLUMN_NAME; + select.add(option); + } + if (select.dataset.hiddenval) select.value = select.dataset.hiddenval; + else select.value = DV.P_VALUE_COLUMN_NAME; + select.disabled = false; + } + } + + public getDefaultValue( + obj, + descFlexName, + descFlexContextCode, + segmentName, + parentValue, + ParentsList + ) { + let dependenciesList: any = []; + let parentVal: any = null; + let isStandardDate: boolean = false; + let isStandardTimeDate: boolean = false; + let isStandardTime: boolean = false; + let isHidden: boolean = false; + let isReadOnlyList: boolean = false; + isStandardDate = this.isStandardDate(obj); + isStandardTimeDate = this.isStandardDateTime(obj); + isStandardTime = this.isStandardTime(obj); + if (obj.DISPLAY_FLAG == "N") isHidden = true; + if (obj.VALIDATION_TYPE != "N" && obj.READ_ONLY == "Y") { + isReadOnlyList = true; + } + //if(parentValue!=""){ parentVal= this.getDependenciesParams(parentValue)[0].ID_COLUMN_NAME;} + //if(ParentsList!=""){dependenciesList =this.getDependenciesParams(ParentsList); } + + if ( + parentValue != "" && + (obj.VALIDATION_TYPE == "D" || obj.VALIDATION_TYPE == "Y") + ) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { + return false; + } + } + if (ParentsList != "") { + if (parentValue) ParentsList.concat(parentValue); + dependenciesList = this.getDependenciesParams(ParentsList); + if (!dependenciesList) { + return false; + } + } + + //if (dependenciesList==false){return false}; + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, //-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList + }; + + this.submitAbsService.getDefaultValue(body).subscribe((result: any) => { + let elem = this.getElementByName(segmentName); + let obj = this.handleDefaultValueResult(result); + let val = obj.value; + let text = obj.text; + if (isStandardDate) { + // elem.value = this.common.reverseFormatDate(val); + } else if (isStandardTimeDate) { + if (val) { + // elem.dataset.dtvalue = this.common.reverseFormatStandardDate(val); + // elem.innerHTML = this.common.reverseFormatStandardDate(val); + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else if (isStandardTime) { + if (val) { + elem.dataset.dtvalue = val; + elem.innerHTML = val; + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else { + elem.value = val; + } + if (isHidden || isReadOnlyList) { + if (val) elem.dataset.colmText = val; + else elem.dataset.colmText = ""; + elem.value = text; + } + var event = new Event("change"); + elem.dispatchEvent(event); + }); + } + handleDefaultValueResult(result) { + let data = { + text: result.GetDefaultValueList.P_VALUE_COLUMN_NAME, + value: result.GetDefaultValueList.P_ID_COLUMN_NAME + }; + return data; + } + + // getElementsValues(){ + // let valuseArr:any=[]; + // for(let i=0;i + x.APPLICATION_COLUMN_NAME == + this.submitAbsObjList[i].APPLICATION_COLUMN_NAME + ); + if (feldDetails) { + let isStandardDate = this.isStandardDateVal(feldDetails); + let isStandardDateTime = this.isStandardDateTimeVal(feldDetails); + let isStandardTime = this.isStandardTimeVal(feldDetails); + if (isStandardDate) { + //elem.value = this.common.reverseFormatDate(val); + } else if (isStandardDateTime) { + // elem.innerHTML = this.common.reverseFormatStandardDate(val); + // elem.dataset.dtvalue = this.common.reverseFormatStandardDate(val); + } else if (isStandardTime) { + elem.innerHTML = val; + elem.dataset.dtvalue = val; + } else { + elem.value = val; + elem.setAttribute("value", elem.value); + } + if ( + feldDetails.DISPLAY_FLAG == "N" || + (feldDetails.VALIDATION_TYPE != "N" && + feldDetails.READ_ONLY == "Y") + ) { + elem.dataset.colmText = val; + elem.value = this.submitAbsObjList[i].SEGMENT_VALUE_DSP; + elem.setAttribute("value", elem.value); + } + } + elem.dataset.hiddenval = val; //hide the value to set it after calling get value set + if ( + feldDetails.CHILD_SEGMENTS_VS_Splited && + feldDetails.CHILD_SEGMENTS_VS_Splited.length > 0 + ) { + let listArray: any = feldDetails.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + this.getValueSet(element); + }); + } + //var event = new Event('change'); + //elem.dispatchEvent(event); + } + } else { + } + } + //this.ExtraObj=obj; + } + isStandardDate(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "X") { + // standard date + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + isStandardDateTime(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") { + // standard date time + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + isStandardTime(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") { + // standard date time + if ( + obj.DEFAULT_TYPE == "C" || + obj.DEFAULT_TYPE == "D" || + obj.DEFAULT_TYPE == "P" || + obj.DEFAULT_TYPE == "S" + ) { + //constant + isSt = true; + } + } + return isSt; + } + + isStandardDateVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "X") { + // standard date + + isSt = true; + // } + } + return isSt; + } + isStandardDateTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") { + // standard date time + + isSt = true; + //} + } + return isSt; + } + isStandardTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") { + // standard time + + isSt = true; + //} + } + return isSt; + } + validateAbcenseTransaction() { + (this.elementRef.nativeElement.querySelectorAll( + "ion-item" + ) as HTMLElement[]).forEach(x => { + x.classList.add("ng-touched"); + x.classList.remove("ng-untouched"); + }); + + let arrValues = this.getElementsValues(); + + if (arrValues) { + if (!this.startDate || !this.endDate || !this.absenceType) { + //this.common.showRequiredMsg(); + return false; + } + let Sdata = moment(this.startDate).format("MM/DD/YYYY"); + let Edata = moment(this.endDate).format("MM/DD/YYYY"); + this.absenceRrequest = new AbsenceTransaction(); + this.absenceRrequest.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; + this.absenceRrequest.P_MENU_TYPE = this.menuType; + this.absenceRrequest.P_SELECTED_RESP_ID = this.respID; + this.absenceRrequest.P_FUNCTION_NAME = this.functionName; + this.absenceRrequest.P_ABSENCE_ACTION = this.action; + this.absenceRrequest.P_ABSENCE_ATTENDANCE_ID = parseInt(this.absenceType); // later on when we activate the update and delete; + this.absenceRrequest.P_ABSENCE_ATTENDANCE_TYPE_ID = parseInt( + this.absenceType + ); + this.absenceRrequest.P_DATE_START = Sdata; + this.absenceRrequest.P_DATE_END = Edata; + this.absenceRrequest.P_TIME_START = this.startTime; + this.absenceRrequest.P_TIME_END = this.endTime; + this.absenceRrequest.P_REPLACEMENT_USER_NAME = this.employeeID; + this.absenceRrequest.P_DESC_FLEX_CONTEXT_CODE = this.absenceTypeName; + this.absenceRrequest.P_ATTRIBUTE1 = arrValues[0].P_ATTRIBUTE1 + ? arrValues[0].P_ATTRIBUTE1 + : null; + this.absenceRrequest.P_ATTRIBUTE2 = arrValues[0].P_ATTRIBUTE2 + ? arrValues[0].P_ATTRIBUTE2 + : null; + this.absenceRrequest.P_ATTRIBUTE3 = arrValues[0].P_ATTRIBUTE3 + ? arrValues[0].P_ATTRIBUTE3 + : null; + this.absenceRrequest.P_ATTRIBUTE4 = arrValues[0].P_ATTRIBUTE4 + ? arrValues[0].P_ATTRIBUTE4 + : null; + this.absenceRrequest.P_ATTRIBUTE5 = arrValues[0].P_ATTRIBUTE5 + ? arrValues[0].P_ATTRIBUTE5 + : null; + this.absenceRrequest.P_ATTRIBUTE6 = arrValues[0].P_ATTRIBUTE6 + ? arrValues[0].P_ATTRIBUTE6 + : null; + this.absenceRrequest.P_ATTRIBUTE7 = arrValues[0].P_ATTRIBUTE7 + ? arrValues[0].P_ATTRIBUTE7 + : null; + this.absenceRrequest.P_ATTRIBUTE8 = arrValues[0].P_ATTRIBUTE8 + ? arrValues[0].P_ATTRIBUTE8 + : null; + this.absenceRrequest.P_ATTRIBUTE9 = arrValues[0].P_ATTRIBUTE9 + ? arrValues[0].P_ATTRIBUTE9 + : null; + this.absenceRrequest.P_ATTRIBUTE10 = arrValues[0].P_ATTRIBUTE10 + ? arrValues[0].P_ATTRIBUTE10 + : null; + this.absenceRrequest.P_ATTRIBUTE11 = arrValues[0].P_ATTRIBUTE11 + ? arrValues[0].P_ATTRIBUTE11 + : null; + this.absenceRrequest.P_ATTRIBUTE12 = arrValues[0].P_ATTRIBUTE12 + ? arrValues[0].P_ATTRIBUTE12 + : null; + this.absenceRrequest.P_ATTRIBUTE13 = arrValues[0].P_ATTRIBUTE13 + ? arrValues[0].P_ATTRIBUTE13 + : null; + this.absenceRrequest.P_ATTRIBUTE14 = arrValues[0].P_ATTRIBUTE14 + ? arrValues[0].P_ATTRIBUTE14 + : null; + this.absenceRrequest.P_ATTRIBUTE15 = arrValues[0].P_ATTRIBUTE15 + ? arrValues[0].P_ATTRIBUTE15 + : null; + this.absenceRrequest.P_ATTRIBUTE16 = arrValues[0].P_ATTRIBUTE16 + ? arrValues[0].P_ATTRIBUTE16 + : null; + this.absenceRrequest.P_ATTRIBUTE17 = arrValues[0].P_ATTRIBUTE17 + ? arrValues[0].P_ATTRIBUTE17 + : null; + this.absenceRrequest.P_ATTRIBUTE18 = arrValues[0].P_ATTRIBUTE18 + ? arrValues[0].P_ATTRIBUTE18 + : null; + this.absenceRrequest.P_ATTRIBUTE19 = arrValues[0].P_ATTRIBUTE19 + ? arrValues[0].P_ATTRIBUTE19 + : null; + this.absenceRrequest.P_ATTRIBUTE20 = arrValues[0].P_ATTRIBUTE20 + ? arrValues[0].P_ATTRIBUTE20 + : null; + this.absenceRrequest.P_ABSENCE_COMMENTS = this.absComments; + this.submitAbsService + .validateAbsenceTransaction(this.absenceRrequest) + .subscribe((result: any) => { + this.handleAbsenceValidateTr(result); + }); + } + } + private handleAbsenceValidateTr(result) { + if (this.common.validResponse(result)) { + if (this.getPassdirfromNotifiPage) { + this.absenceRrequest.P_NOTIFICATION_ID = this.notificationId; + this.absenceRrequest.P_ITEM_KEY = this.itemKey; + this.submitAbsService + .resubmitAbsence(this.absenceRrequest) + .subscribe((result: any) => { + this.handleSubmitAbsence(result); + }); + } else { + this.submitAbsService + .submitAbsence(this.absenceRrequest) + .subscribe((result: any) => { + this.handleSubmitAbsence(result); + }); + } + } + } + + private handleSubmitAbsence(result) { + if (this.common.validResponse(result)) { + if (this.getPassdirfromNotifiPage) { + // this.common.sharedService.setSharedData(result.ResubmitAbsenceTransactionList.P_TRANSACTION_ID, AbsenceResponse.SHARED_DATA); + // this.navCtrl.push("SubmitAbsenceConfirmPage", { isResubmit: true }); + } else { + // this.sharedData.setSharedData(result.SumbitAbsenceTransactionList.P_TRANSACTION_ID, AbsenceResponse.SHARED_DATA); + // this.navCtrl.push("SubmitAbsenceConfirmPage", { isResubmit: false }); + } + } + } +} diff --git a/Mohem/src/app/authentication/login/login.component.html b/Mohem/src/app/authentication/login/login.component.html index ae7a3c56..fe9e7b18 100644 --- a/Mohem/src/app/authentication/login/login.component.html +++ b/Mohem/src/app/authentication/login/login.component.html @@ -3,7 +3,7 @@ - + diff --git a/Mohem/src/app/authentication/login/login.component.scss b/Mohem/src/app/authentication/login/login.component.scss index 08f6520a..87c1751c 100644 --- a/Mohem/src/app/authentication/login/login.component.scss +++ b/Mohem/src/app/authentication/login/login.component.scss @@ -35,9 +35,14 @@ ion-col.colPad.col { padding-top: 20px; } -ion-img { - width: 170px; - height: 170px; +img.centerDiv { + width: 180px; + height: 140px; + contain: strict; + min-width: 20px; + min-height: 20px; + display: block; + margin-top: 30px; background: var(--light); } diff --git a/Mohem/src/app/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index dad0721e..236c232e 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1,10 +1,10 @@ import { Injectable } from "@angular/core"; import { - NavController, - ToastController, - LoadingController, - AlertController, - Platform + NavController, + ToastController, + LoadingController, + AlertController, + Platform } from "@ionic/angular"; import { Router } from "@angular/router"; import { TranslatorService } from "../translator/translator.service"; @@ -14,8 +14,8 @@ import { Location, DatePipe } from "@angular/common"; import { ThemeableBrowser } from "@ionic-native/themeable-browser/ngx"; import { BrowserConfig } from "./models/browser-config"; import { - LaunchNavigator, - LaunchNavigatorOptions + LaunchNavigator, + LaunchNavigatorOptions } from "@ionic-native/launch-navigator/ngx"; import { Device } from "@ionic-native/device/ngx"; import { ProgressLoadingService } from "../../ui/progressLoading/progress-loading.service"; @@ -23,475 +23,483 @@ import { Observable, throwError } from "rxjs"; import { SharedDataService } from "../shared-data-service/shared-data.service"; import { Badge } from "@ionic-native/badge/ngx"; import { LifeCycleService } from "../life-cycle/life-cycle.service"; -import { Diagnostic } from '@ionic-native/diagnostic/ngx'; -import { CallNumber } from '@ionic-native/call-number/ngx'; -import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; - - +import { Diagnostic } from "@ionic-native/diagnostic/ngx"; +import { CallNumber } from "@ionic-native/call-number/ngx"; +import { InAppBrowser } from "@ionic-native/in-app-browser/ngx"; @Injectable({ - providedIn: "root" + providedIn: "root" }) export class CommonService { - - public static months_en_long = [ - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December" - ]; - public static months_en = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" - ]; - public static months_ar = [ - "يناير", - "فبراير", - "مارس", - "أبريل", - "مايو", - "يونيو", - "يوليو", - "أغسطس", - "سبتمبر", - "أكتوبر", - "نوفمبر", - "ديسمبر" - ]; - - private progressLoaders: any[] = []; - private loadingProgress: any; - constructor( - public nav: NavController, - public router: Router, - public location: Location, - public ts: TranslatorService, - public loadingController: LoadingController, - public progressLoadingService: ProgressLoadingService, - public toastController: ToastController, - public alertController: AlertControllerService, - public alertControllerIonic: AlertController, - public themeableBrowser: ThemeableBrowser, - public launchNavigation: LaunchNavigator, - public platform: Platform, - public device: Device, - public sharedService: SharedDataService, - public badge: Badge, - public lifeCycle: LifeCycleService, - public diagnostic: Diagnostic, - public callNumber: CallNumber, - public iab: InAppBrowser - ) { } - - public back() { - // this.nav.pop(); - this.nav.back({ - animated: true, - animationDirection: "back" - }); - } - - public round(value: number, decimal: number): string { - const valueStr = value.toString(); - const dotIndex = valueStr.indexOf("."); - - if (dotIndex >= 0) { - return valueStr.toString().substr(0, dotIndex + decimal); - } else { - return value.toString(); - } - } - - - getSecondsAsDigitalClock(inputSeconds: number) { - var sec_num = parseInt(inputSeconds.toString(), 10); // don't forget the second param - var hours = Math.floor(sec_num / 3600); - var minutes = Math.floor((sec_num - (hours * 3600)) / 60); - var seconds = sec_num - (hours * 3600) - (minutes * 60); - var hoursString = ''; - var minutesString = ''; - var secondsString = ''; - hoursString = (hours < 10) ? "0" + hours : hours.toString(); - minutesString = (minutes < 10) ? "0" + minutes : minutes.toString(); - secondsString = (seconds < 10) ? "0" + seconds : seconds.toString(); - return minutesString + ':' + secondsString; - } - - public toastPK(page: string, key: string) { - this.toast(this.ts.trPK(page, key)); - } - async toast(message: string) { - const toast = await this.toastController.create({ - message: message, - showCloseButton: true, - position: "middle", - duration: 2000, - closeButtonText: this.ts.trPK("general", "close") - }); - toast.present(); - } - - private loaderIsActive = false; - async startLoadingOld() { - this.stopLoading(); - const loader = await this.loadingController.create({ - spinner: "bubbles", - duration: 30000, - message: this.ts.trPK("error", "wait"), - translucent: true - }); - this.progressLoaders.push(loader); - return await loader.present(); - } - - public startLoading() { - /*this.stopLoading(small); + public static months_en_long = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ]; + public static months_en = [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + ]; + public static months_ar = [ + "يناير", + "فبراير", + "مارس", + "أبريل", + "مايو", + "يونيو", + "يوليو", + "أغسطس", + "سبتمبر", + "أكتوبر", + "نوفمبر", + "ديسمبر" + ]; + + private progressLoaders: any[] = []; + private loadingProgress: any; + constructor( + public nav: NavController, + public router: Router, + public location: Location, + public ts: TranslatorService, + public loadingController: LoadingController, + public progressLoadingService: ProgressLoadingService, + public toastController: ToastController, + public alertController: AlertControllerService, + public alertControllerIonic: AlertController, + public themeableBrowser: ThemeableBrowser, + public launchNavigation: LaunchNavigator, + public platform: Platform, + public device: Device, + public sharedService: SharedDataService, + public badge: Badge, + public lifeCycle: LifeCycleService, + public diagnostic: Diagnostic, + public callNumber: CallNumber, + public iab: InAppBrowser + ) {} + + public back() { + // this.nav.pop(); + this.nav.back({ + animated: true, + animationDirection: "back" + }); + } + + public round(value: number, decimal: number): string { + const valueStr = value.toString(); + const dotIndex = valueStr.indexOf("."); + + if (dotIndex >= 0) { + return valueStr.toString().substr(0, dotIndex + decimal); + } else { + return value.toString(); + } + } + + getSecondsAsDigitalClock(inputSeconds: number) { + var sec_num = parseInt(inputSeconds.toString(), 10); // don't forget the second param + var hours = Math.floor(sec_num / 3600); + var minutes = Math.floor((sec_num - hours * 3600) / 60); + var seconds = sec_num - hours * 3600 - minutes * 60; + var hoursString = ""; + var minutesString = ""; + var secondsString = ""; + hoursString = hours < 10 ? "0" + hours : hours.toString(); + minutesString = minutes < 10 ? "0" + minutes : minutes.toString(); + secondsString = seconds < 10 ? "0" + seconds : seconds.toString(); + return minutesString + ":" + secondsString; + } + + public toastPK(page: string, key: string) { + this.toast(this.ts.trPK(page, key)); + } + async toast(message: string) { + const toast = await this.toastController.create({ + message: message, + showCloseButton: true, + position: "middle", + duration: 2000, + closeButtonText: this.ts.trPK("general", "close") + }); + toast.present(); + } + + private loaderIsActive = false; + async startLoadingOld() { + this.stopLoading(); + const loader = await this.loadingController.create({ + spinner: "bubbles", + duration: 30000, + message: this.ts.trPK("error", "wait"), + translucent: true + }); + this.progressLoaders.push(loader); + return await loader.present(); + } + + public startLoading() { + /*this.stopLoading(small); this.progressLoadingService.presentLoading( this.ts.trPK("general", "loading") , small ); */ - this.stopLoading(); - this.progressLoadingService.presentLoading(this.ts.trPK("general", "loading")); - } - - public mobileNumber(number: string) { - return number.substr(1, number.length - 1); - } - public testFunction() { } - - public stopLoading() { - this.progressLoadingService.dismiss(); - } - - public presentAlert(message: string, onAccept?: any) { - this.alertDialog( - () => { - if (onAccept) { - onAccept(); - } - }, - this.ts.trPK("general", "ok"), - this.ts.trPK("general", "alert"), - message - ); - } - - public presentConfirmDialog(message: string, onAccept: any, onCancel?: any) { - this.confirmAlertDialog( - onAccept, - this.ts.trPK("general", "ok"), - onCancel, - this.ts.trPK("general", "cancel"), - this.ts.trPK("general", "confirm"), - message - ); - } - - public presentAcceptDialog(message: string, onAccept: any) { - this.alertDialog( - onAccept, - this.ts.trPK("general", "ok"), - this.ts.trPK("general", "confirm"), - message - ); - } - - public confirmBackDialog(message: string) { - this.alertDialog( - () => { - this.back(); - }, - this.ts.trPK("general", "ok"), - this.ts.trPK("general", "info"), - message - ); - } - public confirmNotAllowedDialog() { - this.openHome(); - this.alertDialog( - () => { - }, - this.ts.trPK("general", "ok"), - this.ts.trPK("general", "info"), - this.ts.trPK("general", "not-allowed") - ); - } - - public showErrorMessageDialog( - onClick: any, - okLabel: string, - message: string - ) { - this.alertDialog( - onClick, - okLabel, - this.ts.trPK("general", "alert"), - message - ); - } - - public userNeedToReLogin() { - this.presentConfirmDialog(this.ts.trPK("general", "relogin"), () => { - this.openLogin(); - }); - } - - public showConnectionErrorDialog(onClick: any, okLabel: string) { - this.alertDialog( - onClick, - okLabel, - this.ts.trPK("general", "alert"), - this.ts.trPK("error", "conn") - ); - } - - public showConnectionTimeout(onClick: any, okLabel: string) { - this.alertDialog( - onClick, - okLabel, - this.ts.trPK("general", "alert"), - this.ts.trPK("error", "timeout") - ); - } - - async JustAlertDialog(acceptLabel: string, - message: string) { - this.clearAllAlerts(); - const alert = await this.alertControllerIonic.create({ - header: this.ts.trPK("general", "info"), - message: message, - buttons: [ - { - text: acceptLabel, - handler: () => { - this.alertControllerIonic.dismiss(); - } - } - ] - }); - // this.alerts.push(alert); - await alert.present(); - } - - async confirmAlertDialog( - onAccept: any, - acceptLabel: string, - onCancel: any, - cancelLabel: string, - title: string, - message: string - ) { - this.clearAllAlerts(); - const alert = await this.alertControllerIonic.create({ - header: this.ts.trPK("general", "confirm"), - message: message, - buttons: [ - { - text: cancelLabel, - role: "cancel", - cssClass: 'cancel-button', - handler: () => { - if (onCancel) { - onCancel(); - } - this.alertControllerIonic.dismiss(); - } - }, - { - text: acceptLabel, - handler: () => { - if (onAccept) { - onAccept(); - } - this.alertControllerIonic.dismiss(); - } - } - ] - }); - // this.alerts.push(alert); - await alert.present(); - } - - async confirmAlertDialogPrimarySecondary( - onPrimary: any, - primaryLabel: string, - onSecondary: any, - secondaryLabel: string, - title: string, - message: string - ) { - this.clearAllAlerts(); - const alert = await this.alertControllerIonic.create({ - header: this.ts.trPK("general", "confirm"), - message: message, - buttons: [ - { - text: primaryLabel, - handler: () => { - onPrimary(); - this.alertControllerIonic.dismiss(); - } - }, - { - text: secondaryLabel, - handler: () => { - onSecondary(); - this.alertControllerIonic.dismiss(); - } - } - ] - }); - await alert.present(); - } - - async alertDialog( - onAccept: any, - acceptLabel: string, - title: string, - message: string - ) { - this.clearAllAlerts(); - const alert = await this.alertControllerIonic.create({ - header: title, - message: message, - buttons: [ - { - text: acceptLabel, - handler: () => { - if (onAccept) { - onAccept(); - } - this.alertControllerIonic.dismiss(); - } - } - ] - }); - // this.alerts.push(alert); - await alert.present(); - } - - async loginAlertDialog(acceptLabel: string, title: string, message: string) { - this.clearAllAlerts(); - const alert = await this.alertControllerIonic.create({ - header: title, - message: message, - backdropDismiss: false, - buttons: [ - { - text: acceptLabel, - handler: () => { - // this.openUserLogin(); - this.alertControllerIonic.dismiss(); - } - } - ] - }); - // this.alerts.push(alert); - await alert.present(); - } - - public clearAllAlerts() { - // custom solutions because of async issue - const alerts = document.getElementsByTagName("ion-alert"); - for (let i = 0; i < alerts.length; i++) { - const alert = alerts[i]; - alert.parentNode.removeChild(alert); + this.stopLoading(); + this.progressLoadingService.presentLoading( + this.ts.trPK("general", "loading") + ); + } + + public mobileNumber(number: string) { + return number.substr(1, number.length - 1); + } + public testFunction() {} + + public stopLoading() { + this.progressLoadingService.dismiss(); + } + + public presentAlert(message: string, onAccept?: any) { + this.alertDialog( + () => { + if (onAccept) { + onAccept(); } - } - - public getDeviceInfo(): string { - if (this.platform.is("mobile")) { - const os = this.platform.is("ios") ? "Iphone" : "android"; - return ( - os + - " - " + - this.device.platform + - " - " + - this.device.version + - " , " + - this.device.manufacturer - ); - } else { - return navigator.userAgent; - } - } - - public getDeviceType(): string { - if (this.platform.is("mobile")) { - return "Mobile " + (this.platform.is("ios") ? "Iphone" : "android"); - } else { - return "Desktop"; + }, + this.ts.trPK("general", "ok"), + this.ts.trPK("general", "alert"), + message + ); + } + + public presentConfirmDialog(message: string, onAccept: any, onCancel?: any) { + this.confirmAlertDialog( + onAccept, + this.ts.trPK("general", "ok"), + onCancel, + this.ts.trPK("general", "cancel"), + this.ts.trPK("general", "confirm"), + message + ); + } + + public presentAcceptDialog(message: string, onAccept: any) { + this.alertDialog( + onAccept, + this.ts.trPK("general", "ok"), + this.ts.trPK("general", "confirm"), + message + ); + } + + public confirmBackDialog(message: string) { + this.alertDialog( + () => { + this.back(); + }, + this.ts.trPK("general", "ok"), + this.ts.trPK("general", "info"), + message + ); + } + public confirmNotAllowedDialog() { + this.openHome(); + this.alertDialog( + () => {}, + this.ts.trPK("general", "ok"), + this.ts.trPK("general", "info"), + this.ts.trPK("general", "not-allowed") + ); + } + + public showErrorMessageDialog( + onClick: any, + okLabel: string, + message: string + ) { + this.alertDialog( + onClick, + okLabel, + this.ts.trPK("general", "alert"), + message + ); + } + + public userNeedToReLogin() { + this.presentConfirmDialog(this.ts.trPK("general", "relogin"), () => { + this.openLogin(); + }); + } + + public showConnectionErrorDialog(onClick: any, okLabel: string) { + this.alertDialog( + onClick, + okLabel, + this.ts.trPK("general", "alert"), + this.ts.trPK("error", "conn") + ); + } + + public showConnectionTimeout(onClick: any, okLabel: string) { + this.alertDialog( + onClick, + okLabel, + this.ts.trPK("general", "alert"), + this.ts.trPK("error", "timeout") + ); + } + + async JustAlertDialog(acceptLabel: string, message: string) { + this.clearAllAlerts(); + const alert = await this.alertControllerIonic.create({ + header: this.ts.trPK("general", "info"), + message: message, + buttons: [ + { + text: acceptLabel, + handler: () => { + this.alertControllerIonic.dismiss(); + } } - } - public validResponse(result: Response): boolean { - if (result.MessageStatus === 1) { - return true; - } else if (result.MessageStatus === 2) { - return this.hasData(result["SameClinicApptList"]); + ] + }); + // this.alerts.push(alert); + await alert.present(); + } + + async confirmAlertDialog( + onAccept: any, + acceptLabel: string, + onCancel: any, + cancelLabel: string, + title: string, + message: string + ) { + this.clearAllAlerts(); + const alert = await this.alertControllerIonic.create({ + header: this.ts.trPK("general", "confirm"), + message: message, + buttons: [ + { + text: cancelLabel, + role: "cancel", + cssClass: "cancel-button", + handler: () => { + if (onCancel) { + onCancel(); + } + this.alertControllerIonic.dismiss(); + } + }, + { + text: acceptLabel, + handler: () => { + if (onAccept) { + onAccept(); + } + this.alertControllerIonic.dismiss(); + } } - return false; - } - - public openBrowser(url: string, onExit?, onFaild?, onSuccess?, successURLS?: string[]) { - console.log(url); - if (this.isCordova()) { - this.openBrowserInApp(url, onExit, onFaild, onSuccess, successURLS); - } else { - this.openBrowserHtml(url, onExit, onFaild, onSuccess); + ] + }); + // this.alerts.push(alert); + await alert.present(); + } + + async confirmAlertDialogPrimarySecondary( + onPrimary: any, + primaryLabel: string, + onSecondary: any, + secondaryLabel: string, + title: string, + message: string + ) { + this.clearAllAlerts(); + const alert = await this.alertControllerIonic.create({ + header: this.ts.trPK("general", "confirm"), + message: message, + buttons: [ + { + text: primaryLabel, + handler: () => { + onPrimary(); + this.alertControllerIonic.dismiss(); + } + }, + { + text: secondaryLabel, + handler: () => { + onSecondary(); + this.alertControllerIonic.dismiss(); + } } - } - - private openBrowserHtml(url, onExit?, onFaild?, onSuccess?) { - - const browser = window.open(url, '_blank', 'location=no'); - browser.addEventListener('loadstart', () => { - }); - - browser.addEventListener('loaderror', () => { - if (onFaild) { - onFaild(); + ] + }); + await alert.present(); + } + + async alertDialog( + onAccept: any, + acceptLabel: string, + title: string, + message: string + ) { + this.clearAllAlerts(); + const alert = await this.alertControllerIonic.create({ + header: title, + message: message, + buttons: [ + { + text: acceptLabel, + handler: () => { + if (onAccept) { + onAccept(); } - }); - browser.addEventListener('loadstop', () => { - if (onSuccess) { - onSuccess(); - } - }); - - } - - private openBrowserInApp(url: string, onExit?, onFaild?, onSuccess?, successURLS?: string[]) { - this.platform.ready().then(() => { - const browser = this.iab.create(url, '_blank', 'closebuttoncolor=#60686b,hidenavigationbuttons=yes,hideurlbar=yes,zoom=no'); - - // browser.executeScript(...); - - // browser.insertCSS(...); - browser.on('loaderror').subscribe(event => { - if (onFaild) { - onFaild(); - } - browser.close(); - }); - + this.alertControllerIonic.dismiss(); + } + } + ] + }); + // this.alerts.push(alert); + await alert.present(); + } + + async loginAlertDialog(acceptLabel: string, title: string, message: string) { + this.clearAllAlerts(); + const alert = await this.alertControllerIonic.create({ + header: title, + message: message, + backdropDismiss: false, + buttons: [ + { + text: acceptLabel, + handler: () => { + // this.openUserLogin(); + this.alertControllerIonic.dismiss(); + } + } + ] + }); + // this.alerts.push(alert); + await alert.present(); + } + + public clearAllAlerts() { + // custom solutions because of async issue + const alerts = document.getElementsByTagName("ion-alert"); + for (let i = 0; i < alerts.length; i++) { + const alert = alerts[i]; + alert.parentNode.removeChild(alert); + } + } + + public getDeviceInfo(): string { + if (this.platform.is("mobile")) { + const os = this.platform.is("ios") ? "Iphone" : "android"; + return ( + os + + " - " + + this.device.platform + + " - " + + this.device.version + + " , " + + this.device.manufacturer + ); + } else { + return navigator.userAgent; + } + } + + public getDeviceType(): string { + if (this.platform.is("mobile")) { + return "Mobile " + (this.platform.is("ios") ? "Iphone" : "android"); + } else { + return "Desktop"; + } + } + public validResponse(result: Response): boolean { + if (result.MessageStatus === 1) { + return true; + } else if (result.MessageStatus === 2) { + return this.hasData(result["SameClinicApptList"]); + } + return false; + } + + public openBrowser( + url: string, + onExit?, + onFaild?, + onSuccess?, + successURLS?: string[] + ) { + console.log(url); + if (this.isCordova()) { + this.openBrowserInApp(url, onExit, onFaild, onSuccess, successURLS); + } else { + this.openBrowserHtml(url, onExit, onFaild, onSuccess); + } + } + + private openBrowserHtml(url, onExit?, onFaild?, onSuccess?) { + const browser = window.open(url, "_blank", "location=no"); + browser.addEventListener("loadstart", () => {}); + + browser.addEventListener("loaderror", () => { + if (onFaild) { + onFaild(); + } + }); + browser.addEventListener("loadstop", () => { + if (onSuccess) { + onSuccess(); + } + }); + } + + private openBrowserInApp( + url: string, + onExit?, + onFaild?, + onSuccess?, + successURLS?: string[] + ) { + this.platform.ready().then(() => { + const browser = this.iab.create( + url, + "_blank", + "closebuttoncolor=#60686b,hidenavigationbuttons=yes,hideurlbar=yes,zoom=no" + ); + + // browser.executeScript(...); + + // browser.insertCSS(...); + browser.on("loaderror").subscribe(event => { + if (onFaild) { + onFaild(); + } + browser.close(); + }); - /* + /* browser.on('loadstop').subscribe(event => { // browser.insertCSS({ code: 'body{color: white;}' }); if (onSuccess) { @@ -500,539 +508,607 @@ export class CommonService { }); */ - browser.on('exit').subscribe(event => { - if (onExit) { - onExit(); - } - }); - - browser.on('loadstart').subscribe(event => { - - if (successURLS) { - successURLS.forEach((successURL, index) => { - if (event.url && (event.url.indexOf(successURL) >= 0)) { - // alert('load start found success url'); - browser.close(); - if (onSuccess) { - onSuccess(); - } - } - }); - } - }); - - }); - } - - - - - public imageFromBase64(base64: string) { - return "data:image/jpeg;base64," + base64; - } - - public openLocation(lat: number, lng: number) { - this.platform.ready().then(() => { - this.launchNavigation.navigate([lat, lng]).then( - () => { }, - err => { - // this.failedToOpenMap(); - window.open('https://maps.google.com/?q=' + lat + ',' + lng); - } - ); - }); - } - private failedToOpenMap() { - this.presentAlert(this.ts.trPK("error", "map")); - - } - - public localizeTime(date: Date) { - if (!(date.getHours() == 0 && date.getMinutes() == 0)) { - let h = date.getHours() % 12 || 12; - let hStr = h < 10 ? "0" + h : h; // leading 0 at the left for 1 digit hours - const m = date.getMinutes(); - let mStr = m < 10 ? "0" + m : m; - return hStr + ":" + mStr + (date.getHours() < 12 ? " AM" : " PM"); - } - return ""; - } - - public localizeDate(date: Date, time = false) { - const lng = TranslatorService.getCurrentLanguageName(); - let dateStr; - if (lng === TranslatorService.AR) { - dateStr = CommonService.months_ar[date.getMonth()] + ' ' + date.getDate() + ' ' + date.getFullYear(); - } else { - dateStr = CommonService.months_en[date.getMonth()] + ' ' + date.getDate() + ',' + date.getFullYear(); - } - - return time ? dateStr + ' ' + this.localizeTime(date) : dateStr; - } - - public localizeMonth(monthIndex) { - const lng = TranslatorService.getCurrentLanguageName(); - if (lng === TranslatorService.AR) { - return CommonService.months_ar[monthIndex]; - } else { - return CommonService.months_en[monthIndex]; + browser.on("exit").subscribe(event => { + if (onExit) { + onExit(); } - } - - public evaluteDate(dateStr: string, time = false): string { - if (dateStr) { - const utc = parseInt(dateStr.substring(6, dateStr.length - 2), 10); - if (utc) { - const date = new Date(utc); - if (date instanceof Date && !isNaN(date.getTime())) { - // return this.datePipe.transform( appoDate, 'dd-MM-yyyy'); - return this.localizeDate(date, time); - } + }); + + browser.on("loadstart").subscribe(event => { + if (successURLS) { + successURLS.forEach((successURL, index) => { + if (event.url && event.url.indexOf(successURL) >= 0) { + // alert('load start found success url'); + browser.close(); + if (onSuccess) { + onSuccess(); + } } + }); } - return dateStr; - } - - public evaluateDateShort(dateStr: string): string { - const date = this.evaluteDateAsObject(dateStr); - if (date) { - return date.getMonth() + 1 + "/" + date.getFullYear().toString().substr(2); - } else { - return '--'; + }); + }); + } + + public imageFromBase64(base64: string) { + return "data:image/jpeg;base64," + base64; + } + + public openLocation(lat: number, lng: number) { + this.platform.ready().then(() => { + this.launchNavigation.navigate([lat, lng]).then( + () => {}, + err => { + // this.failedToOpenMap(); + window.open("https://maps.google.com/?q=" + lat + "," + lng); } - } - public convertISODateToJsonDate(isoDate: string): string { - return "/Date(" + Date.parse(isoDate) + ")/"; - } - public convertDateToJsonDate(date: Date): string { - return "/Date(" + date.getTime() + ")/"; - } - - /* + ); + }); + } + private failedToOpenMap() { + this.presentAlert(this.ts.trPK("error", "map")); + } + + public localizeTime(date: Date) { + if (!(date.getHours() == 0 && date.getMinutes() == 0)) { + let h = date.getHours() % 12 || 12; + let hStr = h < 10 ? "0" + h : h; // leading 0 at the left for 1 digit hours + const m = date.getMinutes(); + let mStr = m < 10 ? "0" + m : m; + return hStr + ":" + mStr + (date.getHours() < 12 ? " AM" : " PM"); + } + return ""; + } + + public localizeDate(date: Date, time = false) { + const lng = TranslatorService.getCurrentLanguageName(); + let dateStr; + if (lng === TranslatorService.AR) { + dateStr = + CommonService.months_ar[date.getMonth()] + + " " + + date.getDate() + + " " + + date.getFullYear(); + } else { + dateStr = + CommonService.months_en[date.getMonth()] + + " " + + date.getDate() + + "," + + date.getFullYear(); + } + + return time ? dateStr + " " + this.localizeTime(date) : dateStr; + } + + public localizeMonth(monthIndex) { + const lng = TranslatorService.getCurrentLanguageName(); + if (lng === TranslatorService.AR) { + return CommonService.months_ar[monthIndex]; + } else { + return CommonService.months_en[monthIndex]; + } + } + + public evaluteDate(dateStr: string, time = false): string { + if (dateStr) { + const utc = parseInt(dateStr.substring(6, dateStr.length - 2), 10); + if (utc) { + const date = new Date(utc); + if (date instanceof Date && !isNaN(date.getTime())) { + // return this.datePipe.transform( appoDate, 'dd-MM-yyyy'); + return this.localizeDate(date, time); + } + } + } + return dateStr; + } + + public evaluateDateShort(dateStr: string): string { + const date = this.evaluteDateAsObject(dateStr); + if (date) { + return ( + date.getMonth() + + 1 + + "/" + + date + .getFullYear() + .toString() + .substr(2) + ); + } else { + return "--"; + } + } + public convertISODateToJsonDate(isoDate: string): string { + return "/Date(" + Date.parse(isoDate) + ")/"; + } + public convertDateToJsonDate(date: Date): string { + return "/Date(" + date.getTime() + ")/"; + } + + /* date iso format and time is 24 format hh:mm:ss */ - public convertIsoDateToObject(isoDate: string, isoTime: string): Date { - const date = new Date(isoDate); - const parts = isoTime.split(':'); - if (this.hasData(parts)) { - // remove if numbers start with 0 - let hrsStr = parts[0]; - let msStr = parts[1]; - hrsStr = hrsStr[0] == '0' ? hrsStr.substr(1) : hrsStr; - msStr = msStr[0] == '0' ? msStr.substr(1) : msStr; - date.setHours(Number(hrsStr)); - date.setMinutes(Number(msStr)); - } - return date; - } - public evaluateDateWithTimeZoneOffset(dateStr: string): Date { - if (dateStr) { - const utc = parseInt(dateStr.substring(6, dateStr.length - 2), 10); - let date = new Date(utc); - let timezoneOffset: number = date.getTimezoneOffset() * 60000; - date.setTime(date.getTime() + timezoneOffset); - return date; - } - return null - } - - public evaluteDateAsObject(dateStr: string): Date { - if (dateStr) { - const utc = parseInt(dateStr.substring(6, dateStr.length - 2), 10); - return new Date(utc); + public convertIsoDateToObject(isoDate: string, isoTime: string): Date { + const date = new Date(isoDate); + const parts = isoTime.split(":"); + if (this.hasData(parts)) { + // remove if numbers start with 0 + let hrsStr = parts[0]; + let msStr = parts[1]; + hrsStr = hrsStr[0] == "0" ? hrsStr.substr(1) : hrsStr; + msStr = msStr[0] == "0" ? msStr.substr(1) : msStr; + date.setHours(Number(hrsStr)); + date.setMinutes(Number(msStr)); + } + return date; + } + public evaluateDateWithTimeZoneOffset(dateStr: string): Date { + if (dateStr) { + const utc = parseInt(dateStr.substring(6, dateStr.length - 2), 10); + let date = new Date(utc); + let timezoneOffset: number = date.getTimezoneOffset() * 60000; + date.setTime(date.getTime() + timezoneOffset); + return date; + } + return null; + } + + public evaluteDateAsObject(dateStr: string): Date { + if (dateStr) { + const utc = parseInt(dateStr.substring(6, dateStr.length - 2), 10); + return new Date(utc); + } + return null; + } + + public getDateISO(date: Date): string { + return ( + date.getFullYear().toString() + + "-" + + this.trailerZero(date.getMonth() + 1) + + "-" + + this.trailerZero(date.getDate()) + ); + } + + public getTodayISO(): string { + return this.getDateISO(new Date()); + } + + public getTimeISO(date: Date): string { + return ( + this.trailerZero(date.getHours()) + + ":" + + this.trailerZero(date.getMinutes()) + + ":00" + ); + } + + public getDateTimeISO(date: Date): string { + return this.getDateISO(date) + " " + this.getTimeISO(date); + } + + public getDateTimeISOFromString(dateStr: string): string { + const date = this.evaluteDateAsObject(dateStr); + return this.getDateTimeISO(date) + " " + this.getTimeISO(date); + } + + public getCurrentTimeISO(): string { + return this.getTimeISO(new Date()); + } + + private trailerZero(value: number): string { + const str = value.toString(); + return str.length > 1 ? str : "0" + str; + } + + public hasData(array: any[]): boolean { + return array != null && array.length > 0; + } + + public extractNumber(message: string): string { + if (message != null && message.length > 0) { + let startIndex = null; + let endIndex = message.length - 1; + for (let i = 0; i < message.length; i++) { + const code = message.charCodeAt(i); + if (this.inNumberRange(code)) { + if (!startIndex) { + startIndex = i; + } + } else { + if (startIndex) { + endIndex = i; + break; + } } - return null; - } - - public getDateISO(date: Date): string { - return ( - date.getFullYear().toString() + - "-" + - this.trailerZero(date.getMonth() + 1) + - "-" + - this.trailerZero(date.getDate()) - ); - } - - public getTodayISO(): string { - return this.getDateISO(new Date()); - } - - public getTimeISO(date: Date): string { - return ( - this.trailerZero(date.getHours()) + - ":" + - this.trailerZero(date.getMinutes()) + - ":00" - ); - } - - public getDateTimeISO(date: Date): string { - return this.getDateISO(date) + " " + this.getTimeISO(date); - } - - public getDateTimeISOFromString(dateStr: string): string { - const date = this.evaluteDateAsObject(dateStr); - return this.getDateTimeISO(date) + " " + this.getTimeISO(date); - } - - public getCurrentTimeISO(): string { - return this.getTimeISO(new Date()); - } - - private trailerZero(value: number): string { - const str = value.toString(); - return str.length > 1 ? str : "0" + str; - } - - public hasData(array: any[]): boolean { - return array != null && array.length > 0; - } - - public extractNumber(message: string): string { - if (message != null && message.length > 0) { - let startIndex = null; - let endIndex = message.length - 1; - for (let i = 0; i < message.length; i++) { - const code = message.charCodeAt(i); - if (this.inNumberRange(code)) { - if (!startIndex) { - startIndex = i; - } - } else { - if (startIndex) { - endIndex = i; - break; - } - } - } - return startIndex ? message.substring(startIndex, endIndex) : ""; + } + return startIndex ? message.substring(startIndex, endIndex) : ""; + } + return null; + } + public inNumberRange(targetCode: number): boolean { + const minDigit = "0".charCodeAt(0); + const maxDigit = "9".charCodeAt(0); + return targetCode >= minDigit && targetCode <= maxDigit; + } + + public enterPage() {} + + private smsAlertDialog = null; + public presentSMSPasswordDialog( + onAccept: any, + smsCode?: string, + title?: string + ) { + this.dismissSMSDialog().subscribe(removed => { + this.createSMSPAsswordDialog(onAccept, smsCode, title); + }); + } + async createSMSPAsswordDialog( + onAccept: any, + smsCode?: string, + title?: string + ) { + this.smsAlertDialog = await this.alertControllerIonic.create({ + header: title || this.ts.trPK("general", "enter-sms-code"), + inputs: [ + { + name: "sms", + type: "number", + value: smsCode, + placeholder: this.ts.trPK("general", "enter-sms") } - return null; - } - public inNumberRange(targetCode: number): boolean { - const minDigit = "0".charCodeAt(0); - const maxDigit = "9".charCodeAt(0); - return targetCode >= minDigit && targetCode <= maxDigit; - } - - public enterPage() { } - - private smsAlertDialog = null; - public presentSMSPasswordDialog( - onAccept: any, - smsCode?: string, - title?: string - ) { - this.dismissSMSDialog().subscribe(removed => { - this.createSMSPAsswordDialog(onAccept, smsCode, title); - }); - } - async createSMSPAsswordDialog( - onAccept: any, - smsCode?: string, - title?: string - ) { - this.smsAlertDialog = await this.alertControllerIonic.create({ - header: title || this.ts.trPK("general", "enter-sms-code"), - inputs: [ - { - name: "sms", - type: "number", - value: smsCode, - placeholder: this.ts.trPK("general", "enter-sms") - } - ], - buttons: [ - { - text: this.ts.trPK("general", "cancel"), - role: "cancel", - cssClass: 'cancel-button', - handler: () => { } - }, - { - text: this.ts.trPK("general", "ok"), - handler: data => { - onAccept(data.sms); - } - } - ] - }); - - await this.smsAlertDialog.present(); - } - - public getStartOfDay(date: Date): Date { - date.setHours(0, 0, 0, 0); - return date; - } - - public dismissSMSDialog(): Observable { - return Observable.create(observer => { - this.alertControllerIonic.getTop().then( - () => { - this.alertControllerIonic.dismiss().then( - () => { - observer.next(true); - observer.complete(); - }, - () => { - observer.next(false); - observer.complete(); - } - ); - }, - () => { - observer.next(false); - observer.complete(); - } - ); - }); - } - - public getStartOfToday(): number { - const date = new Date(); - date.setHours(0, 0, 0, 0); - return date.getTime(); - } - - public getGraphSeries( - xLabels: string[], - data: number[], - title: string, - color: string, - fill = false - ): any { - return { - labels: xLabels, - datasets: [ - { - label: title, - data: data, - fill: fill, - borderColor: color, - backgroundColor: color - } - ] - }; - } - public getGraphDataSet(title: string, data: number[], color: string, fill = false) { - return { - label: title, - data: data, - fill: fill, - borderColor: color, - backgroundColor: color - }; - } - public getGraphMultiSeries(xLabels: string[], datasets: any[]): any { - return { - labels: xLabels, - datasets: datasets - }; - } - - public get2SeriesMultiGraphData(dataList: any[], value1Key, title1, value2Key, title2, labels: string[]) { - const series1: number[] = []; - const series2: number[] = []; - - for (const data of dataList) { - series1.push(data[value1Key]); - series2.push(data[value2Key]); + ], + buttons: [ + { + text: this.ts.trPK("general", "cancel"), + role: "cancel", + cssClass: "cancel-button", + handler: () => {} + }, + { + text: this.ts.trPK("general", "ok"), + handler: data => { + onAccept(data.sms); + } } - - const dataSets = [ - this.getGraphDataSet(this.ts.trInline(title1), series1, '#d12026'), - this.getGraphDataSet(this.ts.trInline(title2), series2, '#60686b') - ]; - return this.getGraphMultiSeries(labels, dataSets); - } - - async setBadge(count: number) { - this.platform.ready().then(() => { - if (count > 0) { - this.badge.set(count); - } else { - this.badge.clear(); + ] + }); + + await this.smsAlertDialog.present(); + } + + public getStartOfDay(date: Date): Date { + date.setHours(0, 0, 0, 0); + return date; + } + + public dismissSMSDialog(): Observable { + return Observable.create(observer => { + this.alertControllerIonic.getTop().then( + () => { + this.alertControllerIonic.dismiss().then( + () => { + observer.next(true); + observer.complete(); + }, + () => { + observer.next(false); + observer.complete(); } - }); - } - - public isHtml5VideoSupported(): boolean { - const v = document.createElement("video"); - if (v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')) { - return true; + ); + }, + () => { + observer.next(false); + observer.complete(); } - if (v.canPlayType('video/ogg; codecs="theora, vorbis"')) { - return true; + ); + }); + } + + public getStartOfToday(): number { + const date = new Date(); + date.setHours(0, 0, 0, 0); + return date.getTime(); + } + + public getGraphSeries( + xLabels: string[], + data: number[], + title: string, + color: string, + fill = false + ): any { + return { + labels: xLabels, + datasets: [ + { + label: title, + data: data, + fill: fill, + borderColor: color, + backgroundColor: color } - if (v.canPlayType('video/webm; codecs="vp8, vorbis"')) { - return true; - } - return false; - } - - public isCordova(): boolean { - return this.platform.is("cordova"); - } - - public pageRevisited(pageName: string): Observable { - return this.lifeCycle.pageRevisited(pageName); - } - - /* + ] + }; + } + public getGraphDataSet( + title: string, + data: number[], + color: string, + fill = false + ) { + return { + label: title, + data: data, + fill: fill, + borderColor: color, + backgroundColor: color + }; + } + public getGraphMultiSeries(xLabels: string[], datasets: any[]): any { + return { + labels: xLabels, + datasets: datasets + }; + } + + public get2SeriesMultiGraphData( + dataList: any[], + value1Key, + title1, + value2Key, + title2, + labels: string[] + ) { + const series1: number[] = []; + const series2: number[] = []; + + for (const data of dataList) { + series1.push(data[value1Key]); + series2.push(data[value2Key]); + } + + const dataSets = [ + this.getGraphDataSet(this.ts.trInline(title1), series1, "#d12026"), + this.getGraphDataSet(this.ts.trInline(title2), series2, "#60686b") + ]; + return this.getGraphMultiSeries(labels, dataSets); + } + + async setBadge(count: number) { + this.platform.ready().then(() => { + if (count > 0) { + this.badge.set(count); + } else { + this.badge.clear(); + } + }); + } + + public isHtml5VideoSupported(): boolean { + const v = document.createElement("video"); + if (v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')) { + return true; + } + if (v.canPlayType('video/ogg; codecs="theora, vorbis"')) { + return true; + } + if (v.canPlayType('video/webm; codecs="vp8, vorbis"')) { + return true; + } + return false; + } + + public isCordova(): boolean { + return this.platform.is("cordova"); + } + + public pageRevisited(pageName: string): Observable { + return this.lifeCycle.pageRevisited(pageName); + } + + /* open calls */ - public openHome() { - this.nav.navigateRoot(["/home"]); - } - public openForgotPassword() { - this.nav.navigateForward(["/authentication/forgot"]); - } - public openChangePassword() { - this.nav.navigateForward(["/authentication/changepassowrd"]); - } - public openProfile() { - this.nav.navigateForward(["/profile/home"]); - } - public openAccuralPage() { - this.nav.navigateForward(["/accrual-balances/home"]); - } - public openEITPage() { - this.nav.navigateForward(["/eit/homepage"]); - } - public openMyTeamPage() { - this.nav.navigateForward(["/my-team/home"]); - } - public openMyTeamDetails() { - this.nav.navigateForward(["/my-team/details"]); - } - public openAbsencePage() { - this.nav.navigateForward(["/absence/home"]); - } - - public reload(url: string, from: string) { - console.log("force reload called from:" + from); - // window.location.reload(); - location.href = url; - } - - public navigateRoot(url: string) { - this.nav.navigateRoot([url]); - } - - public navigateByURL(url: string) { - this.router.navigateByUrl(url); - // this.router.navigateByUrl([url); - } - - public navigateForward(url: string) { - this.nav.navigateForward([url]); - } - public navigateBack(url: string) { - this.nav.navigateBack([url]); - } - - private alternateNavigate(paths: string[], key: string, root = false) { - let url: string; - if (localStorage.getItem(key) === "yes") { - localStorage.setItem(key, "no"); - url = paths[0]; - } else { - localStorage.setItem(key, "yes"); - url = paths[1]; - } - if (root) { - this.nav.navigateRoot([url]); - } else { - this.nav.navigateForward([url]); - } - } - - public openLogin() { - this.nav.navigateRoot(["/authentication/login"]); - } - - public openUserForgot() { - this.nav.navigateForward(["/authentication/checkuser"]); - } - public openSMSPage() { - this.nav.navigateForward(["/authentication/smspage"]); - } - - - public navigateTo(url: string) { - this.nav.navigateForward([url]); - } - - public keysInObject(obj): any[] { - const keys: any = []; - if (obj != null) { - for (const key in obj) { - keys.push(key); - } - } - return keys.length > 0 ? keys : null; - } - - public keysCountInObject(obj): number { - let count = 0; - if (obj != null) { - for (const key in obj) { - count++; - } - } - - return count; - } - - public checkBlueTooth(feedback: any) { - this.platform.ready().then(() => { - - this.diagnostic.getBluetoothState() - .then((state) => { - if (state == this.diagnostic.bluetoothState.POWERED_ON) { - feedback(); - } else { - this.presentAlert(this.ts.trPK('bluetooth', 'start')); - } - }).catch(e => { - this.presentAlert(this.ts.trPK('bluetooth', 'start')) - }); + public openHome() { + this.nav.navigateRoot(["/home"]); + } + public openForgotPassword() { + this.nav.navigateForward(["/authentication/forgot"]); + } + public openChangePassword() { + this.nav.navigateForward(["/authentication/changepassowrd"]); + } + public openProfile() { + this.nav.navigateForward(["/profile/home"]); + } + public openAccuralPage() { + this.nav.navigateForward(["/accrual-balances/home"]); + } + public openEITPage() { + this.nav.navigateForward(["/eit/homepage"]); + } + public openMyTeamPage() { + this.nav.navigateForward(["/my-team/home"]); + } + public openMyTeamDetails() { + this.nav.navigateForward(["/my-team/details"]); + } + public openAbsencePage() { + this.nav.navigateForward(["/absence/home"]); + } + public openSubmitAbsencePage() { + this.nav.navigateForward(["/absence/submit-absence"]); + } + + public reload(url: string, from: string) { + console.log("force reload called from:" + from); + // window.location.reload(); + location.href = url; + } + + public navigateRoot(url: string) { + this.nav.navigateRoot([url]); + } + + public navigateByURL(url: string) { + this.router.navigateByUrl(url); + // this.router.navigateByUrl([url); + } + + public navigateForward(url: string) { + this.nav.navigateForward([url]); + } + public navigateBack(url: string) { + this.nav.navigateBack([url]); + } + + private alternateNavigate(paths: string[], key: string, root = false) { + let url: string; + if (localStorage.getItem(key) === "yes") { + localStorage.setItem(key, "no"); + url = paths[0]; + } else { + localStorage.setItem(key, "yes"); + url = paths[1]; + } + if (root) { + this.nav.navigateRoot([url]); + } else { + this.nav.navigateForward([url]); + } + } + + public openLogin() { + this.nav.navigateRoot(["/authentication/login"]); + } + + public openUserForgot() { + this.nav.navigateForward(["/authentication/checkuser"]); + } + public openSMSPage() { + this.nav.navigateForward(["/authentication/smspage"]); + } + + public navigateTo(url: string) { + this.nav.navigateForward([url]); + } + + public keysInObject(obj): any[] { + const keys: any = []; + if (obj != null) { + for (const key in obj) { + keys.push(key); + } + } + return keys.length > 0 ? keys : null; + } + + public keysCountInObject(obj): number { + let count = 0; + if (obj != null) { + for (const key in obj) { + count++; + } + } + + return count; + } + + public checkBlueTooth(feedback: any) { + this.platform.ready().then(() => { + this.diagnostic + .getBluetoothState() + .then(state => { + if (state == this.diagnostic.bluetoothState.POWERED_ON) { + feedback(); + } else { + this.presentAlert(this.ts.trPK("bluetooth", "start")); + } + }) + .catch(e => { + this.presentAlert(this.ts.trPK("bluetooth", "start")); }); - - } - - public callPhoneNumber(phoneNumber: string) { - this.platform.ready().then(() => { - if (this.isCordova()) { - this.callNumber.callNumber(phoneNumber, true) - .then(res => { }).catch(err => { }); - } else { - window.open('tel:' + phoneNumber); - // this.presentAlert(this.ts.trPK('error', 'call')); - } - }); - } - - list_to_tree(list) { - let map = {}, node, roots = [], i; - for (i = 0; i < list.length; i += 1) { - map[list[i].MENU_NAME] = i; // initialize the map - list[i].children = []; // initialize the children - } - for (i = 0; i < list.length; i += 1) { - node = list[i]; - if (node.PARENT_MENU_NAME !== "") { - // if you have dangling branches check that map[node.parentId] exists - list[map[node.PARENT_MENU_NAME]].children.push(node); - } else { - roots.push(node); - } - } - return roots; - } - + }); + } + + public callPhoneNumber(phoneNumber: string) { + this.platform.ready().then(() => { + if (this.isCordova()) { + this.callNumber + .callNumber(phoneNumber, true) + .then(res => {}) + .catch(err => {}); + } else { + window.open("tel:" + phoneNumber); + // this.presentAlert(this.ts.trPK('error', 'call')); + } + }); + } + + list_to_tree(list) { + let map = {}, + node, + roots = [], + i; + for (i = 0; i < list.length; i += 1) { + map[list[i].MENU_NAME] = i; // initialize the map + list[i].children = []; // initialize the children + } + for (i = 0; i < list.length; i += 1) { + node = list[i]; + if (node.PARENT_MENU_NAME !== "") { + // if you have dangling branches check that map[node.parentId] exists + list[map[node.PARENT_MENU_NAME]].children.push(node); + } else { + roots.push(node); + } + } + return roots; + } + public reverseFormatDate(date) { + let FormatedDate; + if (date) { + FormatedDate = date.replace(/\//g, "-"); + FormatedDate = FormatedDate.replace(/ 00:00:00/g, ""); + } else { + FormatedDate = date; + } + return FormatedDate; + } + public formatStandardDate(date) { + let FormatedDate; + if (date) { + FormatedDate = date.replace(/-/g, "/"); + } else { + FormatedDate = date; + } + return FormatedDate; + } + public reverseFormatStandardDate(date) { + let FormatedDate; + if (date) { + FormatedDate = date.replace(/\//g, "-"); + } else { + FormatedDate = date; + } + return FormatedDate; + } + public formatDate(date) { + let FormatedDate; + if (date) { + FormatedDate = date.replace(/-/g, "/"); + FormatedDate = FormatedDate + " 00:00:00"; + } else { + FormatedDate = date; + } + return FormatedDate; + } } diff --git a/Mohem/src/app/my-team/home/home.component.html b/Mohem/src/app/my-team/home/home.component.html index 3082739a..065213fb 100644 --- a/Mohem/src/app/my-team/home/home.component.html +++ b/Mohem/src/app/my-team/home/home.component.html @@ -33,7 +33,7 @@
- + diff --git a/Mohem/src/app/uI-elements/date-time.input.ts b/Mohem/src/app/uI-elements/date-time.input.ts index 5a63f93a..03d48ee4 100644 --- a/Mohem/src/app/uI-elements/date-time.input.ts +++ b/Mohem/src/app/uI-elements/date-time.input.ts @@ -45,7 +45,7 @@ export class DateTimeInput extends UiElement { "" + " " + this.label + "" + // "
" + this.value + "
" + - "" + + "" + // " "+ // " "+ // " "+ diff --git a/Mohem/src/app/uI-elements/date.input.ts b/Mohem/src/app/uI-elements/date.input.ts index 433df253..6bab87c5 100644 --- a/Mohem/src/app/uI-elements/date.input.ts +++ b/Mohem/src/app/uI-elements/date.input.ts @@ -41,7 +41,7 @@ export class DateInput extends UiElement { "" + " " + this.label + "" + // "
" + this.value + "
" + - "" + + "" + // " "+ // " "+ // " "+ diff --git a/Mohem/src/app/uI-elements/select.input.ts b/Mohem/src/app/uI-elements/select.input.ts index d7e6079c..3caa7772 100644 --- a/Mohem/src/app/uI-elements/select.input.ts +++ b/Mohem/src/app/uI-elements/select.input.ts @@ -23,19 +23,19 @@ export class SelectInput extends UiElement { if (this.disabled == "N") { this.disabled = "disabled" } else { this.disabled = "" } if (this.hidden == "N") { this.hidden = "display:none;" } else { this.hidden = "" } const template = - // "
" + - // "" + - // "" + - // "
"; + "
" + + "" + + "" + + "
"; - "" + - "" + this.label + "" + - "" + - "" + this.value + "" + - "" + - " "; + // "" + + // "" + this.label + "" + + // "" + + + // "" + + // " "; return template; } diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 67bf868d..a88b954a 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -297,6 +297,10 @@ "en": "Done successfully", "ar": "تم بنجاح" }, + "next":{ + "en":"Next", + "ar":"التالي" + }, "other": { "en": "Other", "ar": "أخري" @@ -1073,5 +1077,78 @@ "en": "My Requests", "ar": "طلباتي" } + }, + "submitAbsence": { + "submitAbsence": { + "en":"Submit Absence", + "ar":"رفع إجازة" + }, + "absenceStatus": { + "en": "Absence Status:", + "ar":"حالة الإجازة:" + + }, + "absenceType": { + "en": "Absence Type", + "ar":"نوع الإجازة" + + }, + "duration": { + "en": "Duration:", + "ar":"المدة:" + }, + "startDate": { + "en": "Start Date", + "ar": "تاريخ البداية" + }, + "startTime": { + "en":"Start Time", + "ar":"وقت البداية" + + }, + "endDate": { + "en": "End Date", + "ar":"تاريخ النهاية" + }, + "endTime": { + "en":"End Time", + "ar": "وقت النهاية" + }, + "totalDays": { + "en":"Total Days:", + "ar":"مجموع الأيام:" + }, + "calculateDays": { + "en":"Calculate Days", + "ar":"حساب الأيام" + }, + "search": { + "en":"Search", + "ar": "بحث" + }, + "expectedReturnToWork": { + "en":"Expected Return to work", + "ar":"العودة المتوقعة إلى العمل" + }, + "comments": { + "en":"Comments", + "ar": "ملاحظات" + }, + "clear": { + "en": "Clear", + "ar":"إزالة" + }, + "enterSDate": { + "en":"Please select the start date", + "ar":"ادخل تاريخ البداية" + }, + "enterEDate": { + "en":"Please select the end date", + "ar":"ادخل تاريخ النهاية" + }, + "selAbsType": { + "en":"Please select absence type", + "ar":"اختر نوع الإجازة" + } } } \ No newline at end of file diff --git a/Mohem/src/theme/styles.scss b/Mohem/src/theme/styles.scss index 538103a8..11e9217d 100644 --- a/Mohem/src/theme/styles.scss +++ b/Mohem/src/theme/styles.scss @@ -514,8 +514,8 @@ img.flipImg{ background-color: var(--light); border-bottom: var(--cusgray) solid 1px; border-radius: 0px; - -webkit-appearance: none; - -moz-appearance: none; + // -webkit-appearance: none; + // -moz-appearance: none; text-indent: 1px; // text-overflow: ''; box-shadow: none; @@ -556,7 +556,7 @@ img.flipImg{ :root[dir="rtl"]{ left: 5px; } - content: ""; + z-index: 98; } @@ -745,4 +745,4 @@ color: var(--dark); margin-top: 0.42cm; width:100%; margin-left: 0.4cm; -} \ No newline at end of file +}