From 18dabcb13e8824bbafb73d7174d94249ba0caca9 Mon Sep 17 00:00:00 2001 From: ashwaq Date: Sun, 23 Feb 2020 16:15:34 +0300 Subject: [PATCH] add vacation rule --- .../services/common/common.service.ts | 4 +- .../ui/fab-button/fab-button.component.html | 10 +- .../ui/fab-button/fab-button.component.scss | 36 +- .../ui/fab-button/fab-button.component.ts | 5 +- Mohem/src/app/home/home.page.html | 4 +- Mohem/src/app/home/home.page.ts | 1 + .../vacation-rule/home/home.component.html | 58 +- .../vacation-rule/home/home.component.scss | 61 ++ .../app/vacation-rule/home/home.component.ts | 8 +- .../notification-type.component.html | 10 +- .../replacement-list.component.html | 73 +- .../replacement-list.component.scss | 156 +++- .../replacement-list.component.ts | 93 +- .../app/vacation-rule/vacation-rule.module.ts | 3 + .../vacation-type.component.html | 171 +++- .../vacation-type.component.scss | 63 +- .../vacation-type/vacation-type.component.ts | 855 +++++++++++++++++- Mohem/src/assets/imgs/delete-circle.png | Bin 0 -> 983 bytes Mohem/src/assets/imgs/green.png | Bin 0 -> 977 bytes Mohem/src/assets/imgs/update-circle.png | Bin 0 -> 886 bytes Mohem/src/assets/localization/i18n.json | 10 + Mohem/src/theme/styles.scss | 15 +- Mohem/src/theme/worklist.scss | 4 +- 23 files changed, 1548 insertions(+), 92 deletions(-) create mode 100644 Mohem/src/assets/imgs/delete-circle.png create mode 100644 Mohem/src/assets/imgs/green.png create mode 100644 Mohem/src/assets/imgs/update-circle.png 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 88fdba44..dc65e9a3 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -482,7 +482,7 @@ public getMonthNameAr(value: number): string { { text: cancelLabel, role: "cancel", - cssClass: "cancelBtn", + cssClass: "checkOutCancelBtn", handler: () => { if (onCancel) { onCancel(); @@ -494,7 +494,7 @@ public getMonthNameAr(value: number): string { text: acceptLabel, role: "Confirm", - cssClass: "confirmBtn", + cssClass: "checkOutOkBtn", handler: () => { diff --git a/Mohem/src/app/hmg-common/ui/fab-button/fab-button.component.html b/Mohem/src/app/hmg-common/ui/fab-button/fab-button.component.html index 8e405be4..18d70a13 100644 --- a/Mohem/src/app/hmg-common/ui/fab-button/fab-button.component.html +++ b/Mohem/src/app/hmg-common/ui/fab-button/fab-button.component.html @@ -3,10 +3,16 @@
- + - +
+

{{ 'attendance-tracking,title' | translate }}

+
+
+ + +
diff --git a/Mohem/src/app/hmg-common/ui/fab-button/fab-button.component.scss b/Mohem/src/app/hmg-common/ui/fab-button/fab-button.component.scss index e6cfd86d..cc8cdf42 100644 --- a/Mohem/src/app/hmg-common/ui/fab-button/fab-button.component.scss +++ b/Mohem/src/app/hmg-common/ui/fab-button/fab-button.component.scss @@ -1,15 +1,15 @@ ////////////////////book btn///////////////////// -ion-fab-button{ - --background: var(--darkblue)!important; - // background: url(/assets/icon/sliderBG.jpg); - background-size: cover; - background-position: top right; - border-radius: 50%; - height:112px; - width: 112px; -} +// ion-fab-button{ +// --background: var(--darkblue)!important; +// // background: url(/assets/icon/sliderBG.jpg); +// background-size: cover; +// background-position: top right; +// border-radius: 50%; +// height:112px; +// width: 112px; +// } .cbookApointmentBtn{ // --background:transparent !important; @@ -19,6 +19,22 @@ ion-fab-button{ --background: transparent; } +.addnon{ + --background: var(--darkblue)!important; + background-size: cover; + background-position: top right; + border-radius: 50%; + height: 80px; + width: 80px; + width: 80px; + height: 80px; + right: 8%; + position: fixed; + color: white; + bottom: 20%; + border-radius: 50%; + z-index: 999; +} .fab-p{ // position: absolute; @@ -51,7 +67,7 @@ button-inner{ } .iconFab{ - margin-top: -37px; + margin-top: -37px; width: 100px; height: 60px; } diff --git a/Mohem/src/app/hmg-common/ui/fab-button/fab-button.component.ts b/Mohem/src/app/hmg-common/ui/fab-button/fab-button.component.ts index c61f785e..cd6b4502 100644 --- a/Mohem/src/app/hmg-common/ui/fab-button/fab-button.component.ts +++ b/Mohem/src/app/hmg-common/ui/fab-button/fab-button.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, Output, EventEmitter } from '@angular/core'; +import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; import { TranslatorService } from '../../services/translator/translator.service'; @Component({ @@ -7,13 +7,14 @@ import { TranslatorService } from '../../services/translator/translator.service' styleUrls: ['./fab-button.component.scss'], }) export class FabButtonComponent implements OnInit { - + @Input() type:string; @Output() trigger = new EventEmitter(); public direction: any; constructor( ) { } ngOnInit() { + console.log("type" + this.type); this.direction = TranslatorService.getCurrentDirection(); } diff --git a/Mohem/src/app/home/home.page.html b/Mohem/src/app/home/home.page.html index ab687c35..362f46a6 100644 --- a/Mohem/src/app/home/home.page.html +++ b/Mohem/src/app/home/home.page.html @@ -28,8 +28,8 @@

Monthly Attendance

View your Monthly Time Sheet - - View Detail + + View Detail Vacation Rule *
diff --git a/Mohem/src/app/home/home.page.ts b/Mohem/src/app/home/home.page.ts index c29c014b..b013bc8f 100644 --- a/Mohem/src/app/home/home.page.ts +++ b/Mohem/src/app/home/home.page.ts @@ -596,6 +596,7 @@ export class HomePage implements OnInit { this.common.openEditProfile(); } + } diff --git a/Mohem/src/app/vacation-rule/home/home.component.html b/Mohem/src/app/vacation-rule/home/home.component.html index 0106c44a..4d59d520 100644 --- a/Mohem/src/app/vacation-rule/home/home.component.html +++ b/Mohem/src/app/vacation-rule/home/home.component.html @@ -1,6 +1,6 @@ - - + + @@ -10,13 +10,13 @@ - + -
- + + + + + + + + {{notBadge}} + +

{{item.RULE_STATUS}}


+

{{item.RULE_NAME}} | {{item.ITEM_TYPE_DISPLAY_NAME}}


+

{{item.BEGIN_DATE | dateString }} - {{item.END_DATE | dateString}}


+

Created on:


+ +
+ + + + +
+ + + + + + + + + + + + + + + +
+ +
- - -
+
+ + +
+ + \ No newline at end of file diff --git a/Mohem/src/app/vacation-rule/home/home.component.scss b/Mohem/src/app/vacation-rule/home/home.component.scss index af66a677..e777adaa 100644 --- a/Mohem/src/app/vacation-rule/home/home.component.scss +++ b/Mohem/src/app/vacation-rule/home/home.component.scss @@ -69,3 +69,64 @@ ion-card-header { margin: 0px 5px !important; } } + +//////////new design//////////////////////// +.itemVR +{ + background: #f0efef !important; + --background: #f0efef !important; + border: #dbdbdb 1px solid; + border-radius: 10px; + margin-bottom: 7px; +} +.listVR{ + background: transparent !important; + +} + +.red-status{ + color: var(--light) !important; + font-weight:bold; + background: var( --red); + border-radius: 9px; + text-align: center; + margin-top: 10px; + position: relative; + width: auto; + height: 100%; + display: inline-block !important; + padding: 0px 15px 0px 15px; +} + +.green-status{ + color: var(--light) !important; + font-weight:bold; + background: var( --custgreen); + border-radius: 9px; + text-align: center; + margin-top: 10px; + position: relative; + width: auto; + height: 100%; + display: inline-block !important; + padding: 0px 15px 0px 15px; +} + +.textBold{ + color: black; + font-weight: bold; + font-size: 17px; + +} +.label{ + margin-top: -19px; + border-bottom: #eaeaea solid; + padding-bottom: 8px; + color: black !important; +} +.createdOn{ + margin: -12px 0px -14px 0px; +} +.optionBtn{ +background: transparent !important; +} diff --git a/Mohem/src/app/vacation-rule/home/home.component.ts b/Mohem/src/app/vacation-rule/home/home.component.ts index 7ba084bc..fb95a2a3 100644 --- a/Mohem/src/app/vacation-rule/home/home.component.ts +++ b/Mohem/src/app/vacation-rule/home/home.component.ts @@ -25,7 +25,7 @@ export class HomeComponent implements OnInit { isUpdate: boolean = false; IsReachEnd: boolean = false; RespondAttributeList: any; - + add:any='add'; button: ButtonInput; // dateTime: DateTimeInput; // date: DateInput; @@ -37,7 +37,7 @@ export class HomeComponent implements OnInit { constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService, private router: Router) { this.P_PAGE_NUM = 1; - this.P_PAGE_LIMIT = 1; + this.P_PAGE_LIMIT = 50; //this.button = new ButtonInput('btnSubmit', 'Submit', 'containerDiv', 'Y'); // this.dateTime = new DateTimeInput('Start Date', 'SDate', '', 'containerDiv', 'Y', 'Y', 'Y'); @@ -141,7 +141,9 @@ export class HomeComponent implements OnInit { this.isUpdate = true; this.cs.sharedService.setSharedData(this.isUpdate, 'isUpdate'); - this.router.navigate(['/vacation-rule/create-vacation-rule']); + // this.router.navigate(['/vacation-rule/create-vacation-rule']); + this.cs.navigateForward('/vacation-rule/vacation-type'); + } diff --git a/Mohem/src/app/vacation-rule/notification-type/notification-type.component.html b/Mohem/src/app/vacation-rule/notification-type/notification-type.component.html index 3db310f4..794c5bcb 100644 --- a/Mohem/src/app/vacation-rule/notification-type/notification-type.component.html +++ b/Mohem/src/app/vacation-rule/notification-type/notification-type.component.html @@ -10,25 +10,19 @@ -
    +
  • {{'vacation-rule, itemType' | translate}}
  • - -
  • {{'vacation-rule, notification-type' | translate}}
  • -
    -
  • {{'vacation-rule, create-vacation-rule' | translate}}
  • -
    -
+ -->
diff --git a/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.html b/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.html index b36cf41d..44770b53 100644 --- a/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.html +++ b/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.html @@ -1,17 +1,17 @@ - + - {{ 'vacation-rule, search-employee' | translate}} - + {{ 'vacation-rule, search-employee' | translate}} + - -
+ + {{'vacation-rule, search-by' | translate}} @@ -23,13 +23,16 @@ - - - - + + + + + + + - + + +
+
+
+ + + + +
+ + + +
+ +
+ +
+ + + {{employee.EMPLOYEE_DISPLAY_NAME}} +
{{employee.USER_NAME}}
+ {{employee.EMAIL_ADDRESS}} +
+
+
+ +
+
+ + +
-
+ + + + +
+ + {{'general, save' | translate}} + + + {{'general, cancel' | translate}} +
\ No newline at end of file diff --git a/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.scss b/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.scss index 0187d5a3..31ba8d46 100644 --- a/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.scss +++ b/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.scss @@ -2,7 +2,18 @@ ion-item { margin-top: 5%; margin-right: 7%; } - +.labelRep{ + --color: initial; + display: block; + color: var(--color); + font-family: var(--ion-font-family,inherit); + font-size: inherit; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} .footer-button { border-radius: 3px; padding: 0 1.1em; @@ -12,4 +23,145 @@ ion-item { .item-radio-checked ion-label { color: #3ac1f1 !important; } -.boldTxt{font-weight:bold;} \ No newline at end of file +.boldTxt{font-weight:bold;} +//////////////////////// +button.item-button.button.button-md.button-clear.button-clear-md { + background-color: transparent; +} + +.footer-button { + border-radius: 3px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; +} + +// ion-item { +// margin-top: 5%; +// margin-right: 7%; +// width: 100%; +// } +.ionItem{ + border: #e4e4e4 solid; + /* margin: 6px; */ + /* padding: 11px; */ + height: 85px; + width: 164px; + border-radius: 5px; + text-align: center; + +} + + +.profileImageDiv{ + text-align: center; + margin-bottom: -27px; + z-index: 3; + position: relative; + top: 0; + +} +.profileImage{ + width:60px !important; + // margin-left: -25px; + // margin-right: 22px; +} + +.activated{ + border: #209a83 0.02cm solid ; +} +.deactivated{ border: #e4e4e4 0.02cm solid; +} +.repContentDiv{ + text-align: center; + width: 85%; + font-size: 14px; + border: #e4e4e4 solid; + border-radius: 5px; + padding: 20px 8px 8px 8px; + margin-top: -9px; + margin-right: -35px + +} +.selIEmpDiv{ + text-align: right; + margin-bottom: -26px; + margin-right: 0px; + z-index: 3; + position: relative; + top: 0; +} + +.selIEmpImage{ + width:22px !important + +} + +.noteInput{ + border: solid var(--gray) 1px; + border-radius: 15px; + margin: 8px 17px 0px 17px; + padding: 10px 2px 10px 2px; +} +.filterInput{ + border: solid var(--gray) 1px; + border-radius: 21px; + padding-left: 10px !important; +} +.filterBtn{ + background: var(--newgreen); + --background: var (--newgreen); + border-radius: 50%; + height: 60px; + width: 60px; +} + + + +*{ + box-sizing: border-box; +} + +.square-container{ + // padding: 8px; + width:100%; +} +.square{ + // width:calc(100% / 2); + width:50%; + float:left; + position: relative; + // padding-bottom: calc(100% / 2); +} + +.square .content{ + width: calc(100% - 16px) !important; + height: calc(100% - 16px) !important; + margin: 8px; + padding: 16px; + // position: absolute; + color: white; + border-radius: 9px; + text-align: center; + min-height: 90px; + // background-color: #0095ff; + // box-shadow: 0 2px 5px rgba(0, 0, 0, 0.26); +} + + + +.empImge{ + border-radius: 50%; + width:100%; + height: 100%; + border: #dedede solid 1px; + +} +.empImgeRep { + border-radius: 50% !important; + width: 80px; + height: 80px; + border: #dedede solid 1px; +} + + diff --git a/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.ts b/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.ts index d294e22c..d136c2a1 100644 --- a/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.ts +++ b/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.ts @@ -28,6 +28,7 @@ export class ReplacementListComponent implements OnInit { replacmentRequest: any = ""; isAbs: boolean = false; isSave: boolean = false; + active: any; constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService, public modalController: ModalController) { } @@ -104,27 +105,97 @@ export class ReplacementListComponent implements OnInit { } } - doInfinite(infiniteScroll) { - - } + closePage() { this.isSave = true; let data: any = null; if (this.isSave == true) { if (this.selEmp) { - data = this.ReplacementList[this.selEmp]; + // data = this.ReplacementList[this.selEmp]; + data=this.selEmp; } else { - data = null; + let msg: string = this.ts.trPK("replacementRoll", "msg"); + this.cs.presentAlert(msg); + return; } - if (typeof this.callback == 'function') { - this.callback(data); + // if (typeof this.callback == 'function') { + // this.callback(data); + // } + + + // this.modalController.dismiss({ + // 'dismissed': true, + // empData: data + // }); + + + this.modalController.dismiss(data); + + // }else{ + + // let msg: string = this.ts.trPK("replacementRoll", "msg"); + // this.cs.presentAlert(msg); + // return; + + + // } + } + + } + closeModal() { + this.modalController.dismiss(); + } - this.modalController.dismiss({ - 'dismissed': true, - empData: data - }); + select(selectEmp,index){ + console.log(selectEmp.EMPLOYEE_DISPLAY_NAME); + this.selEmp=selectEmp + console.log("this.selEmp" + this.selEmp); + + this.active=index; + } + + + doInfinite(infiniteScroll) { + if (!this.IsReachEnd) { + + + const request = new ReplacementServiceRequest(); + request.P_PAGE_NUM = this.P_PAGE_NUM; + request.P_PAGE_LIMIT = this.P_PAGE_LIMIT; + + // request.P_SELECTED_EMPLOYEE_NUMBER=this.selEmp; + + this.vacationRuleService.getReplacementList(request). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (this.cs.hasData(result.ReplacementList)) { + this.P_PAGE_NUM++; + result.ReplacementList.forEach(vr => { + if (vr.ROW_NUM == vr.NO_OF_ROWS) { + this.IsReachEnd = true; + } + else { + this.IsReachEnd = false; + } + this.ReplacementList.push(vr); + // this.pro.GetVacationRulesList.push(vr); + }); + } else { + this.IsReachEnd = true; + } + } + //this.P_PAGE_NUM++; + if (infiniteScroll) + infiniteScroll.target.complete(); + + + // console.log(resFlag); + }, (Error) => console.log(Error), () => infiniteScroll.target.complete()); + } else { + if (infiniteScroll) + infiniteScroll.target.complete(); } } } diff --git a/Mohem/src/app/vacation-rule/vacation-rule.module.ts b/Mohem/src/app/vacation-rule/vacation-rule.module.ts index 7f2456cc..d376a3e0 100644 --- a/Mohem/src/app/vacation-rule/vacation-rule.module.ts +++ b/Mohem/src/app/vacation-rule/vacation-rule.module.ts @@ -13,6 +13,7 @@ import { CreateVacationRuleComponent } from './create-vacation-rule/create-vacat import { ReplacementListComponent } from './replacement-list/replacement-list.component'; // import { MaterialDesignFrameworkModule } from 'angular6-json-schema-form'; +import { PipesModule } from '../pipes/pipes.module'; const routes: Routes = [ { @@ -48,6 +49,8 @@ const routes: Routes = [ CommonModule, FormsModule, IonicModule, + PipesModule, + HmgCommonModule, // { // ngModule: JsonSchemaFormModule, diff --git a/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.html b/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.html index ef4dc2d2..b526fb7f 100644 --- a/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.html +++ b/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.html @@ -1,45 +1,44 @@ - - + + {{ 'vacation-rule, vacation-type' | translate}} - + -
    +
  • {{'vacation-rule, itemType' | translate}}
  • - -
  • {{'vacation-rule, notification-type' | translate}}
  • -
    -
  • {{'vacation-rule, create-vacation-rule' | translate}}
  • -
    -
+ --> - + +
+
+
+ +
- + {{'vacation-rule, itemType' | translate}} + [(ngModel)]="index" (ionChange)="vacationRuleSel($event)" required> {{x.ITEM_TYPE_DISPLAY_NAME}} @@ -54,12 +53,148 @@

+
+
+ +
+ +
+ + + + + + {{'vacation-rule, all-label' | translate}} + + + + {{'vacation-rule, select-label' | translate}} + + + + + + + + + + {{'vacation-rule, notification' | translate}} + + + {{x.NOTIFICATION_DISPLAY_NAME}} + + + + +
+ +
+
+ +
+ + + + + +

{{'vacation-rule, itemType' | translate}}


+

{{P_ITEM_TYPE_TITLE}}

+
+ +

{{'vacation-rule, notification' | translate}}


+

{{Notification_Title}}

+
+
+
+ + + + + + + {{'vacation-rule, start-date' | translate}} + + + + {{'vacation-rule, end-date' | translate}} + + + + {{'vacation-rule, message-label' | translate}} + + + + + + + {{assignMode.RADIO_BUTTON_LABEL}} + + + + {{'vacation-rule, deliver' | translate}} + + + + + {{'vacation-rule, close' | translate}} + + + + + + {{'vacation-rule, respond' | translate}} + + + + +
+
+ + + + + + + + + + +
+
- +
- + -
+ + +
+ +
+ +
+ +
+
+ + +
\ No newline at end of file diff --git a/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.scss b/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.scss index 2c5eb1e1..c42fe244 100644 --- a/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.scss +++ b/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.scss @@ -12,7 +12,7 @@ li { } ion-item { - width: 100%; + width: 95%; margin-left: 2%; margin-right: 5%; } @@ -30,6 +30,67 @@ p.smallTip { min-width: 200px; } +.noteInput{ + border: solid var(--gray) 1px; + border-radius: 15px; + margin: 8px 17px 0px 17px; + padding: 10px 2px 10px 2px; +} +// new css // +.divStep{ + border: solid var(--gray) 1px; + border-radius: 15px; + padding: 10px 2px 10px 2px; + background: white; + box-shadow: 0px 0px 6px 0px #d5d5d5ab; + margin-bottom: 17px; +} +.ionItemStep{ + width: 100%; + margin-left: 5%; + margin-right: 5%; + margin-top: 10px; + border-radius: 30px; + border: 1px solid #dbdbdb; +} + +.selectItem{ + border: solid 1px #dbdbdb; + border-radius: 25px; + margin: 15px; + width: 100%; +} + +.labelTitle{ + + margin-left: 15px; +} +.labelValue{ + margin-top: -27px; + font-weight: 900; + margin-left: 15px; +} + +.labelRadio{ +white-space: pre-line !important; +color: black !important; +} +.dynamicFields{ + width: 321px; + border: #dbdbdb solid 1px; + border-radius: 16px; + margin: 10px; + padding: 10px; + +} +.stepHeaderDiv{ + text-align: center; + margin: auto; + font-weight: bolder; +} +.stepHeaderLebal{ + margin:0; +} // .progcontainer { // margin: auto; // text-align: center; diff --git a/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.ts b/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.ts index ac3df459..04823ce6 100644 --- a/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.ts +++ b/Mohem/src/app/vacation-rule/vacation-type/vacation-type.component.ts @@ -1,10 +1,23 @@ import { vacationTypeResponse } from './../model/vacationType.Respond'; import { notificationTypeResponse } from './../model/notification.Respond'; import { VacationTypeRequest } from './../model/VacationTypeRequest'; -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ElementRef } from '@angular/core'; import { VacationRuleServiceService } from '../service/vacation-rule-service.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { notificationTypeRequest } from '../model/notification.Request'; +import * as moment from 'moment'; +import { vacationRuleResponse } from '../model/vacationRule.Respond'; +import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request'; +import { ReplacementServiceRequest } from '../model/replacement-Service.request'; +import { NumberInput } from 'src/app/uI-elements/number.input'; +import { DateInput } from 'src/app/uI-elements/date.input'; +import { SelectInput } from 'src/app/uI-elements/select.input'; +import { TextInput } from 'src/app/uI-elements/text.input'; +import { ModalController } from '@ionic/angular'; +import { ReplacementListComponent } from '../replacement-list/replacement-list.component'; +import { createVacationRequest } from '../model/createVacation.Request'; +import { WorkListReplacementRollComponent } from 'src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component'; @Component({ selector: 'app-vacation-type', @@ -12,14 +25,194 @@ import { CommonService } from 'src/app/hmg-common/services/common/common.service styleUrls: ['./vacation-type.component.scss'], }) export class VacationTypeComponent implements OnInit { - ruleTypeList: any; index: any; + vactionRuleSelected:any =-1; + notificationTypeSelected: number; + notification_list: any; //// + notificationTypeShow:boolean=false; + notificationSelected: any; + createVacationRuleShow: boolean=false; + createBtn: boolean; + Sdate: any; + isUpdate: any; + SelAction: any; + updateData: any; + notificationType: { NOTIFICATION_NAME: any; NOTIFICATION_DISPLAY_NAME: any; NOTIFICATION_SUBJECT: any; FYI_FLAG: any; }; + P_ITEM_TYPE_TITLE: any; + selEmployeeID: any; + selEmployeeName: any; + employeeSel: any; + msgVal: any; + notifTypeSel: any; + itemType: any; + Edate: string; + Notification_Title: any; + showForType_Y: boolean; + isDeliver: boolean; + REASSIGN_val: any =[]; + var_notification: any; + exampleJsonObject: {}; + RespondAttributeList: any=[]; + GetRespondAttributeValueList: any; + wFLookUpList: any; + Resp2_val: any; + dateInput: DateInput; + numberInput: NumberInput; + selectInput: any; + textInput: TextInput; + hideForwordEmployee: any; + notifTypeSelP2: string; + P_RESPOND_ATTRIBUTES_TBL: any=[]; + vacationRuleRequest: createVacationRequest; + confirmMsg: string; + + constructor(public vacationRuleService: VacationRuleServiceService, + public ts: TranslatorService, + public cs: CommonService, + public modalController: ModalController, + private elementRef: ElementRef) { - constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService) { } + + + } ngOnInit() { - this.getVacationType(); + this.isUpdate = this.cs.sharedService.getSharedData('isUpdate'); + if (this.isUpdate) { + this.initCreateVaction(); + + } + else{ + this.getVacationType(); + } + } + + initCreateVaction(){ + this.Sdate = moment().format('YYYY-MM-DDTHH:mm:ssZ'); + this.Edate=""; + + // this.isUpdate = this.cs.sharedService.getSharedData('isUpdate'); + + if (this.isUpdate) { + this.updateData = this.cs.sharedService.getSharedData(vacationRuleResponse.SHARED_DATA, false); + this.SelAction = this.updateData.ACTION; + if (this.updateData.ACTION == "RESPOND" && this.updateData.FYI_FLAG == "Y") { + this.SelAction = "Close" + } + this.notificationType = { + NOTIFICATION_NAME: this.updateData.NOTIFICATION_NAME, + NOTIFICATION_DISPLAY_NAME: this.updateData.NOTIFICATION_SUBJECT, + NOTIFICATION_SUBJECT: this.updateData.NOTIFICATION_SUBJECT, + FYI_FLAG: this.updateData.FYI_FLAG + } + /*************** */ + this.P_ITEM_TYPE_TITLE = this.updateData.ITEM_TYPE_DISPLAY_NAME; + this.selEmployeeID = this.updateData.REPLACEMENT_USER_NAME; + if (this.selEmployeeID) { + this.selEmployeeName = this.updateData.RULE_NAME; + this.employeeSel = this.updateData.RULE_NAME; + } + /************ */ + this.msgVal = this.updateData.MESSAGE; + this.notifTypeSel = this.updateData.ACTION; + this.itemType = this.updateData; + this.notificationType = this.updateData; + //this.Sdate = this.updateData.BEGIN_DATE; + //this.Edate = this.updateData.END_DATE; + let _Sdate = this.updateData.BEGIN_DATE ? this.updateData.BEGIN_DATE : ""; + let _Edate = this.updateData.END_DATE ? this.updateData.END_DATE : ""; + //let tzoffset = moment().utcOffset(); //offset in milliseconds + if (_Sdate) { + this.Sdate = moment(_Sdate).format('YYYY-MM-DDTHH:mm:ssZ'); + //this.Sdate = (new Date(myStartTime - tzoffset)).toISOString().slice(0, -1); + //this.startTime = this.Sdate; + } + if (_Edate) { + this.Edate = moment(_Edate).format('YYYY-MM-DDTHH:mm:ssZ'); + //this.Edate = (new Date(myEndTime - tzoffset)).toISOString().slice(0, -1); + // this.endTime = this.Edate; + } + + //this.schemaNotific =this.updateData.RespondAttributeList; + + //this.notifTypeSel=this.REASSIGN_val[0].RADIO_BUTTON_LABEL; + //console.log(this.notifTypeSel); + // this.getNotificationReassign(); + } else { + this.msgVal=""; + this.isUpdate = false; + this.SelAction = ""; + this.employeeSel = ""; + this.itemType = this.cs.sharedService.getSharedData(vacationTypeResponse.SHARED_DATA, false); + this.notificationType = this.cs.sharedService.getSharedData(notificationTypeResponse.SHARED_DATA, false); + } + this.Notification_Title = this.notificationType.NOTIFICATION_DISPLAY_NAME; + this.P_ITEM_TYPE_TITLE = this.itemType.ITEM_TYPE_DISPLAY_NAME; + console.log("showForType_Y"); + if (this.notificationType.FYI_FLAG == 'Y') { + this.showForType_Y = true; + } else { + this.showForType_Y = false; + } + if (this.itemType.ITEM_TYPE == "*") { + this.isDeliver = false; + } else { + this.isDeliver = true; + } + + this.getNotificationReassign(); + this.respondAttributes(); + + + } + vacationRuleSel(event){ + this.vactionRuleSelected=event.detail.value; + if(this.notificationTypeShow){ + //this.notificationTypeShow = false + this.notificationTypeShow = false + this.notifTypeSelP2 = "*"; + //this.part3show = false + } + if (this.createVacationRuleShow){ + this.createVacationRuleShow = false + this.createBtn=false; + + + + } + + + + + console.log("event: "+ event.detail.value); + } + notificationSel(event){ + + this.notificationSelected=event.detail.value; + if(this.createVacationRuleShow){ + //this.notificationTypeShow = false + this.createVacationRuleShow = false + this.createBtn=false; + //this.part3show = false + } + + + // + console.log("notificationSel event: "+ event.detail.value); + + } + + notificationTypeSel(event){ + // notifTypeSelP2 + this.notificationTypeSelected=event.detail.value; + if(this.createVacationRuleShow){ + //this.notificationTypeShow = false + this.createVacationRuleShow = false + this.createBtn=false; + //this.part3show = false + } + } getVacationType() { @@ -38,6 +231,11 @@ export class VacationTypeComponent implements OnInit { } NextPage() { + //notification_list + + if(this.vactionRuleSelected >= 0 ){ + //&& !this.notificationTypeShow && !this.notificationTypeShow){ + if(!this.notificationTypeShow){ this.cs.sharedService.setSharedData(this.ruleTypeList[this.index], vacationTypeResponse.SHARED_DATA); if (this.ruleTypeList[this.index].ITEM_TYPE == "*") { @@ -47,12 +245,657 @@ export class VacationTypeComponent implements OnInit { notificatioAtt.NOTIFICATION_NAME = "*"; notificatioAtt.NOTIFICATION_SUBJECT = ""; this.cs.sharedService.setSharedData(notificatioAtt, notificationTypeResponse.SHARED_DATA); - this.cs.navigateForward('/vacation-rule/create-vacation-rule'); + //part 3 + this.createVacationRuleShow = true + this.createBtn=true; + // if (this.notifTypeSelP2 == "*") { + // let notificatioAtt: notificationTypeResponse = new notificationTypeResponse(); + // notificatioAtt.FYI_FLAG = ""; + // notificatioAtt.NOTIFICATION_DISPLAY_NAME = "All"; + // notificatioAtt.NOTIFICATION_NAME = "*"; + // notificatioAtt.NOTIFICATION_SUBJECT = ""; + // this.cs.sharedService.setSharedData(notificatioAtt, notificationTypeResponse.SHARED_DATA); + // } else { + // this.cs.sharedService.setSharedData(this.notification_list[this.var_notification], notificationTypeResponse.SHARED_DATA); + // } + + this.initCreateVaction(); + + //this.cs.navigateForward('/vacation-rule/create-vacation-rule'); + + } else { + //part 2 + this.getNotificationType(); + + // this.cs.navigateForward('/vacation-rule/notification-type'); + } + + }//end part not show + else{ + // check if notifictype sele and part 3 not show + //this.notificationSelected=event.detail.value; + ///if(this.createVacationRuleShow + if((this.notificationSelected >= 0 || this.notifTypeSelP2 == '*') && !this.createVacationRuleShow){ + //call part3 + this.createVacationRuleShow = false + this.createBtn=false; + + if (this.notifTypeSelP2 == "*") { + let notificatioAtt: notificationTypeResponse = new notificationTypeResponse(); + notificatioAtt.FYI_FLAG = ""; + notificatioAtt.NOTIFICATION_DISPLAY_NAME = "All"; + notificatioAtt.NOTIFICATION_NAME = "*"; + notificatioAtt.NOTIFICATION_SUBJECT = ""; + this.cs.sharedService.setSharedData(notificatioAtt, notificationTypeResponse.SHARED_DATA); + } else { + this.cs.sharedService.setSharedData(this.notification_list[this.var_notification], notificationTypeResponse.SHARED_DATA); + } + + this.initCreateVaction(); + } + + } + } + + + else{ + alert("please select vaction rule"); + } + + }//////////////////////////////// + + getNotificationType() { + let request: notificationTypeRequest = new notificationTypeRequest(); + request.P_ITEM_TYPE = this.ruleTypeList[this.index].ITEM_TYPE; //;this.itemTypeObj.ITEM_TYPE; + this.vacationRuleService.getNotificationType(request, () => { + this.getNotificationType(); + }, this.ts.trPK('general', 'retry')).subscribe((result) => { + console.log(result); + if (this.cs.validResponse(result)) { + console.log(result.GetItemTypeNotificationsList); + this.notification_list = result.GetItemTypeNotificationsList; + //rest radio button of notifTypeSel (All , select) + this.notificationTypeShow=true; + + } else { + this.cs.presentAlert(result.ErrorEndUserMessage); + } + }); + } + + getNotificationReassign() { + let request: LoginRequest = new LoginRequest(); + + this.vacationRuleService.notificationReassign(request, () => { + this.getNotificationReassign(); + }, this.ts.trPK('general', 'retry')).subscribe((result) => { + console.log(result); + if (this.cs.validResponse(result)) { + console.log(result.GetNotificationReassignModeList); + this.REASSIGN_val = result.GetNotificationReassignModeList;//[0].RADIO_BUTTON_ACTION; + this.notifTypeSel = this.REASSIGN_val[0].RADIO_BUTTON_ACTION; + this.reverseAction(); + this.createVacationRuleShow = true; + this.createBtn=true; + } else { + this.cs.presentAlert(result.ErrorEndUserMessage); + } + }); + } + reverseAction() { + if (this.updateData) { + switch (this.SelAction) { + case 'FORWARD': { + this.notifTypeSel = "DELEGATE"; + break; + } + case 'RESPOND': { + this.notifTypeSel = "RESPOND"; + break; + } + case 'CLOSE': { + this.notifTypeSel = "CLOSE"; + break; + } + case 'NOOP': { + this.notifTypeSel = "DELIVER"; + break; + } + case 'TRANSFER': { + this.notifTypeSel = "TRANSFER"; + break; + } + default: { + this.notifTypeSel = ""; + break; + } + } + } + } +///////////////////////////////////// +respondAttributes() { + let request: notificationTypeRequest = new notificationTypeRequest(); + request.P_NOTIFICATION_NAME = this.notificationType.NOTIFICATION_NAME; + request.P_ITEM_TYPE = this.itemType.ITEM_TYPE; + // this.vacationRuleService.respondAttributes( + // request). + // subscribe((result: Response) => { + // this.handlerespondAttributesResult(result); + // }); + this.vacationRuleService.respondAttributes(request, () => { + this.respondAttributes(); + }, this.ts.trPK('general', 'retry')).subscribe((result) => { + this.handlerespondAttributesResult(result); + }); + + +} +handlerespondAttributesResult(result) { + if (this.cs.validResponse(result)) { + this.RespondAttributeList = result.RespondAttributesList; + if (result.RespondRolesList != "" && result.RespondRolesList[0].ATTRIBUTE_NAME != null && result.RespondRolesList[0].ATTRIBUTE_NAME != undefined) { + this.Resp2_val = result.RespondRolesList[0].ATTRIBUTE_NAME; + this.hideForwordEmployee = result.RespondRolesList[0]; + } + + if (result.RespondAttributesList) { + //this.schemaNotific = JSON.parse(result.P_Schema); + ////////************************************** */ + this.createVacationDynamicFields(result.RespondAttributesList); + } + this.reverseAction(); + if (this.isUpdate) { + this.fillResposeAtrributes(result.RespondAttributesList); + } + // ATTRIBUTE_DISPLAY_NAME: "Note" + // ATTRIBUTE_FORMAT: "4000" + // ATTRIBUTE_NAME: "WF_NOTE" + // ATTRIBUTE_TYPE: "VARCHAR2" + } +} + +createVacationDynamicFields(RespondAttributesList) { + console.log("createVacationDynamicFields"); + const containerId = 'CVDynamicFields'; + for (let i = 0; i < RespondAttributesList.length; i++) { + if (RespondAttributesList[i].ATTRIBUTE_TYPE == "VARCHAR2") { + console.log("1"); + + this.textInput = new TextInput(RespondAttributesList[i].ATTRIBUTE_DISPLAY_NAME, RespondAttributesList[i].ATTRIBUTE_NAME, "", containerId, "", "", "", ""); + } else if (RespondAttributesList[i].ATTRIBUTE_TYPE == "LOOKUP") { + console.log("2"); + //call create WF_LOOKUP + //call there or when the got response from responsedAtt + this.selectInput = new SelectInput(RespondAttributesList[i].ATTRIBUTE_DISPLAY_NAME, RespondAttributesList[i].ATTRIBUTE_NAME, "", containerId, "", "", ""); + this.getWFLookUp(RespondAttributesList[i].ATTRIBUTE_FORMAT, RespondAttributesList[i].ATTRIBUTE_NAME); + + } else if (RespondAttributesList[i].ATTRIBUTE_TYPE == "DATE") { + console.log("3"); + + this.dateInput = new DateInput(RespondAttributesList[i].ATTRIBUTE_DISPLAY_NAME, RespondAttributesList[i].ATTRIBUTE_NAME, "", containerId, "", "", ""); + } else if (RespondAttributesList[i].ATTRIBUTE_TYPE == "NUMBER") { + console.log("4"); + + this.numberInput = new NumberInput(RespondAttributesList[i].ATTRIBUTE_DISPLAY_NAME, RespondAttributesList[i].ATTRIBUTE_NAME, "", containerId, "", "", ""); + } + } +} + +fillResposeAtrributes(respList) { + let body = { + P_RULE_ID: this.updateData.RULE_ID, + GetRespondAttributeValueTBL: respList + } + this.vacationRuleService.getRespondAttributeValues( + body). + subscribe((result: Response) => { + this.handleFillResponseAttr(result); + }); +} + +handleFillResponseAttr(result) { + if (this.cs.validResponse(result)) { + if (result.GetRespondAttributeValueList && result.GetRespondAttributeValueList.length > 0) { + this.GetRespondAttributeValueList=result.GetRespondAttributeValueList; + let resp_val: any = result.GetRespondAttributeValueList[0].P_ATTRIBUTE_NAME; + let Emp_ID: any = result.GetRespondAttributeValueList[0].P_ATTRIBUTE_TEXT_VALUE; + let valueList = result.GetRespondAttributeValueList; + var obj = {}; + if (resp_val == this.Resp2_val) { + let request: ReplacementServiceRequest = new ReplacementServiceRequest(); + + request.P_SEARCH_USER_NAME = Emp_ID; + request.P_SEARCH_EMPLOYEE_DISPLAY_NAME = ""; + request.P_SEARCH_EMAIL_ADDRESS = ""; + request.P_PAGE_NUM = 1; + request.P_PAGE_LIMIT = 1000 + + this.vacationRuleService.getReplacementList(request). + subscribe((result: Response) => { + this.handleFillRole(result); + }); + } + for (let i = 0; i < valueList.length; i++) { + obj[valueList[i].P_ATTRIBUTE_NAME] = valueList[i].P_ATTRIBUTE_TEXT_VALUE; + } + this.exampleJsonObject = obj; + //Call set value of responsed attribute + // this.createVacationDynamicFields(this.exampleJsonObject);//ashwaq + this.setRespondAttributeValue(); + // this.exampleJsonObject = new Map(valueList.map(obj => [ obj., obj.P_ATTRIBUTE_TEXT_VALUE ])); + } + } +} +handleFillRole(result) { + if (this.cs.validResponse(result)) { + this.selEmployeeName = result.ReplacementList[0].EMPLOYEE_DISPLAY_NAME; + this.selEmployeeID = result.ReplacementList[0].USER_NAME; + } +} +setRespondAttributeValue(){ + + for (let i = 0; i < this.RespondAttributeList.length; i++) { + if(this.RespondAttributeList[i].ATTRIBUTE_NAME == this.GetRespondAttributeValueList[i].P_ATTRIBUTE_NAME){ + if (this.RespondAttributeList[i].ATTRIBUTE_TYPE == "VARCHAR2") { + console.log("1"); + let x = (document.getElementById(this.RespondAttributeList[i].ATTRIBUTE_NAME)) as HTMLInputElement; + x.value=this.GetRespondAttributeValueList[i].P_ATTRIBUTE_NUMBER_VALUE; + } else if (this.RespondAttributeList[i].ATTRIBUTE_TYPE == "LOOKUP") { + console.log("2"); + //call create WF_LOOKUPP_ATTRIBUTE_NAME + //call there or when the got response from responsedAtt + + let x = (document.getElementById(this.RespondAttributeList[i].ATTRIBUTE_NAME)) as HTMLSelectElement; + if(this.wFLookUpList){ + let index= this.wFLookUpList.findIndex(x => x.LOOKUP_CODE == this.GetRespondAttributeValueList[i].P_ATTRIBUTE_TEXT_VALUE); + console.log("Hel: "+ index); + x.options[index+1].selected=true; + + } + + } else if (this.RespondAttributeList[i].ATTRIBUTE_TYPE == "DATE") { + console.log("3"); + + } else if (this.RespondAttributeList[i].ATTRIBUTE_TYPE == "NUMBER") { + console.log("4"); + let x = (document.getElementById(this.RespondAttributeList[i].ATTRIBUTE_NAME)) as HTMLInputElement; + x.value=this.GetRespondAttributeValueList[i].P_ATTRIBUTE_NUMBER_VALUE; + + } + }//end if + } + +} + +getWFLookUp(resAttrFormat: any, ATTRIBUTE_NAME) { + + const request = { + P_LOOKUP_TYPE: resAttrFormat, + } + + this.vacationRuleService.getLookup(request, () => { }, this.ts.trPK('general', 'retry')).subscribe( + (result: any) => { + if (this.cs.validResponse(result)) { + // console.log("Lookup result "+ result); + + this.wFLookUpList=result.WFLookUpList + this.fillDropdownList(result.WFLookUpList, ATTRIBUTE_NAME); + } else { + this.cs.presentAlert(result.ErrorEndUserMessage); + } + }); + +} + +fillDropdownList(optionList: any = [],attributeID) { + let elemID: any = attributeID; + let eitObj: any; + + if (optionList.length > 0) { + + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + + + var firstoption = document.createElement("option"); + firstoption.text = this.ts.trPK("general", "choose"); + firstoption.value = ""; + select.add(firstoption); + for (let i = 0; i < optionList.length; i++) { + + var option = document.createElement("option"); + option.text = optionList[i].LOOKUP_MEANING; + option.value = optionList[i].LOOKUP_CODE; + select.add(option); + + } + + select.disabled = false; + } + +} + +async SearchReplacment() { + const modal = await this.modalController.create({ + component: ReplacementListComponent + }); + modal.cssClass = 'replaceRoll-modal'; + + + modal.onDidDismiss() + .then((data) => { + const user = data.data; + console.log(data) + console.log(user); + if (data) { + this.selEmployeeName = user.EMPLOYEE_DISPLAY_NAME; + this.selEmployeeID = user.USER_NAME; + this.employeeSel = this.selEmployeeName + "," + this.selEmployeeID + } + + + + + + }); + + return await modal.present(); +} + +clearEmployee() { + this.selEmployeeName = ""; + this.selEmployeeID = ""; +} + +///////////////////////////////////////////// + +ApplyFunc() { + (this.elementRef.nativeElement.querySelectorAll('ion-item') as HTMLElement[]).forEach((x) => { + if (x.classList.contains('requiredItem')) { + x.classList.add('ng-touched'); + x.classList.remove('ng-untouched'); + } + }); + let msg: string = ""; + if (this.notifTypeSel == undefined) { + msg = this.ts.trPK('vacation-rule', 'fillAction'); + this.cs.presentAlert(msg); + } else if (this.msgVal == undefined) { + msg = this.ts.trPK('vacation-rule', 'fillMsg'); + this.cs.presentAlert(msg); + } else if (this.Sdate == undefined) { + msg = this.ts.trPK('vacation-rule', 'fillSDate'); + this.cs.presentAlert(msg); + } + // else if (this.selEmployeeID == undefined) { + // msg = this.ts.trPK('vacation-rule', 'fillReplacement'); + // this.cs.presentAlert(msg); + // } + else { + // var responseAttrDic = this.exampleJsonObject;//haroon + var responseAttrDic =this.RespondAttributeList; // Ashwaq + this.P_RESPOND_ATTRIBUTES_TBL = []; + for (let key in responseAttrDic) { + let obj: any = {}; + obj.ATTRIBUTE_NAME =responseAttrDic[key].ATTRIBUTE_NAME;//ashwaq to get ATTRIBUTE_NAME + + if (typeof responseAttrDic[key] === "number") { + obj.ATTRIBUTE_NUMBER_VALUE = (document.getElementById(responseAttrDic[key].ATTRIBUTE_NAME) as HTMLInputElement).value; + + } + + else { + obj.ATTRIBUTE_TEXT_VALUE =(document.getElementById(responseAttrDic[key].ATTRIBUTE_NAME) as HTMLInputElement).value; + + } + this.P_RESPOND_ATTRIBUTES_TBL.push(obj); + } + + + + let repUserName = this.selEmployeeID; + if(repUserName == null || repUserName ==""){ + + } + if (this.hideForwordEmployee && this.hideForwordEmployee.ATTRIBUTE_NAME) { + let obj: any = {}; + repUserName = ""; + obj.ATTRIBUTE_NAME = this.hideForwordEmployee.ATTRIBUTE_NAME; + obj.ATTRIBUTE_TEXT_VALUE = this.selEmployeeID; + this.P_RESPOND_ATTRIBUTES_TBL.push(obj); + } + let pAction = ""; + pAction = this.getActionValue(); + let jsonSDate = ""; + let jsonEDate = ""; + if (this.Sdate) { + let startDate = moment(this.Sdate).format('YYYY-MM-DDTHH:mm:ssZ'); + jsonSDate = this.cs.convertISODateToJsonDate(startDate); + } else { + jsonSDate = null; + } + if (this.Edate) { + + let endDate = moment(this.Edate).format('YYYY-MM-DDTHH:mm:ssZ'); + jsonEDate = this.cs.convertISODateToJsonDate(endDate); } else { - this.cs.navigateForward('/vacation-rule/notification-type'); + jsonEDate = null; } + let request: createVacationRequest = new createVacationRequest(); + request.P_BEGIN_DATE = jsonSDate; + request.P_END_DATE = jsonEDate; + request.P_MESSAGE = this.msgVal; + request.P_REPLACEMENT_USER_NAME = repUserName; + request.P_ITEM_TYPE = this.itemType.ITEM_TYPE; + request.P_NOTIFICATION_NAME = this.notificationType.NOTIFICATION_NAME; + request.P_ACTION = pAction; + request.RespondAttributeList = this.P_RESPOND_ATTRIBUTES_TBL; + this.vacationRuleRequest = request; + + + + + + this.vacationRuleService.createVacationRule(request, () => { + }, this.ts.trPK('general', 'retry')).subscribe((result) => { + if (this.cs.validResponse(result)) { + console.log(result); + this.handlecreateVacationResult(result); + } else { + this.cs.presentAlert(result.ErrorEndUserMessage); + } + }); } +} +handlecreateVacationResult(result) { + if (this.cs.validResponse(result)) { + this.cs.JustAlertDialog(this.ts.trPK('general', 'ok'), this.ts.trPK('vacation-rule', 'rule-success')) + this.goToStart(); + + } +} + +goToStart() { + + this.cs.navigateRoot('/home') +} + +updateVacationRule() { + (this.elementRef.nativeElement.querySelectorAll('ion-item') as HTMLElement[]).forEach((x) => { + if (x.classList.contains('requiredItem')) { + x.classList.add('ng-touched'); + x.classList.remove('ng-untouched'); + } + }); + let msg: string = ""; + if (this.notifTypeSel == undefined) { + msg = this.ts.trPK('vacation-rule', 'fillAction'); + } else if (this.msgVal == undefined) { + msg = this.ts.trPK('vacation-rule', 'fillMsg'); + } else if (this.Sdate == undefined) { + msg = this.ts.trPK('vacation-rule', 'fillSDate'); + } else { + var responseAttrDic = this.exampleJsonObject; + this.P_RESPOND_ATTRIBUTES_TBL = []; + for (let key in responseAttrDic) { + let obj: any = {}; + obj.ATTRIBUTE_NAME = key; + if (typeof responseAttrDic[key] === "number") { + obj.ATTRIBUTE_NUMBER_VALUE = responseAttrDic[key]; + } + + else { + obj.ATTRIBUTE_TEXT_VALUE = responseAttrDic[key]; + } + this.P_RESPOND_ATTRIBUTES_TBL.push(obj); + } + let repUserName = this.selEmployeeID; + if (this.hideForwordEmployee && this.hideForwordEmployee.ATTRIBUTE_NAME) { + let obj: any = {}; + repUserName = ""; + obj.ATTRIBUTE_NAME = this.hideForwordEmployee.ATTRIBUTE_NAME; + obj.ATTRIBUTE_TEXT_VALUE = this.selEmployeeID; + this.P_RESPOND_ATTRIBUTES_TBL.push(obj); + } + let pAction = ""; + pAction = this.getActionValue(); + let jsonSDate = ""; + let jsonEDate = ""; + + if (this.Sdate) { + + let startDate = moment(this.Sdate).format('YYYY-MM-DDTHH:mm:ssZ'); + + jsonSDate = this.cs.convertISODateToJsonDate(startDate); + } else { + jsonSDate = null; + } + + if (this.Edate) { + + let endDate = moment(this.Edate).format('YYYY-MM-DDTHH:mm:ssZ'); + jsonEDate = this.cs.convertISODateToJsonDate(endDate); + } else { + jsonEDate = null; + } + let body: any = { + P_RULE_ID: this.updateData.RULE_ID, + P_BEGIN_DATE: jsonSDate, + P_END_DATE: jsonEDate, + P_MESSAGE: this.msgVal, + P_REPLACEMENT_USER_NAME: repUserName, + P_ACTION: pAction, + RespondAttributeList: this.P_RESPOND_ATTRIBUTES_TBL + } + this.vacationRuleService.updateVacationRule( + body). + subscribe((result: Response) => { + this.handleupdateVacationResult(result); + }); + } } + +handleupdateVacationResult(result) { + if (this.cs.validResponse(result)) { + this.cs.JustAlertDialog(this.ts.trPK('general', 'ok'), this.ts.trPK('vacation-rule', 'rule-update-success')) + this.goToStart(); + } +} + + +getActionValue(): string { + let pAction = ""; + //this.pAction = this.notifTypeSel; + //console.log(this.pAction); + if (this.notifTypeSel) { + switch (this.notifTypeSel) { + case 'DELEGATE': { + pAction = "FORWARD"; + break; + } + case 'RESPOND': { + pAction = "RESPOND"; + break; + } + case 'CLOSE': { + pAction = "RESPOND"; + break; + } + case 'DELIVER': { + pAction = "NOOP"; + break; + } + case 'TRANSFER': { + pAction = "TRANSFER"; + break; + } + default: { + pAction = ""; + break; + } + } + return pAction; + } +} + +async openReplacementRoll() { + + const modal = await this.modalController.create({ + component: ReplacementListComponent, + backdropDismiss: false, + + }); + modal.cssClass = 'replaceRoll-modal'; + + modal.onDidDismiss().then((data) => { + console.log(data.data); + + if (data.data == "cancel" || data.data == undefined) { + return; + } else { + + this.selEmployeeName = data.data.EMPLOYEE_DISPLAY_NAME; + this.selEmployeeID = data.data.USER_NAME; + this.employeeSel = this.selEmployeeName + "," + this.selEmployeeID + } + }); + + return await modal.present(); + + + + +} + +////// +openConfirmAlertDialogAction(flag){ + if(flag==true){ + + this.confirmMsg = this.ts.trPK('vacation-rule', 'confirm-msg-success') + + } + else{ + this.confirmMsg= this.ts.trPK('vacation-rule', 'update-msg-success') + + } +this.cs.confirmAlertDialogAction( + () => { + if(flag==true){ + this.ApplyFunc(); + } + else{ + this.updateVacationRule(); + } + }, this.ts.trPK('general', 'ok'), + () => { }, this.ts.trPK('general', 'cancel'), + this.ts.trPK('vacation-rule', 'confirmation'), + this.confirmMsg + ) +} + + +////// +} \ No newline at end of file diff --git a/Mohem/src/assets/imgs/delete-circle.png b/Mohem/src/assets/imgs/delete-circle.png new file mode 100644 index 0000000000000000000000000000000000000000..3c478232df20c5148f7cac545731c1e2363c30c7 GIT binary patch literal 983 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.swiper-pagination-bullets, .swiper-pagination-custom, .swiper-pagination-fraction { @@ -992,3 +993,15 @@ border:0px justify-content: center !important; } +.replaceRoll-modal { + + padding: 30% 1% !important; + --height: 15cm !important; + --width: 100% !important; + --border-radius: 0.4cm; + +} +.header-toolbar-new { + --background: #22c6b3; + background: #22c6b3; +} \ No newline at end of file diff --git a/Mohem/src/theme/worklist.scss b/Mohem/src/theme/worklist.scss index ff4399e6..7a8ec184 100644 --- a/Mohem/src/theme/worklist.scss +++ b/Mohem/src/theme/worklist.scss @@ -1,5 +1,7 @@ .colorBG{ - --background: #f0efef; + --background: #f0efef !important; + background: #f0efef !important; + } .footerSearchBtn{ padding: 0px !important;