diff --git a/Mohem/src/app/authentication/login/login.component.ts b/Mohem/src/app/authentication/login/login.component.ts
index 4e3b310b..d8d2c2b7 100644
--- a/Mohem/src/app/authentication/login/login.component.ts
+++ b/Mohem/src/app/authentication/login/login.component.ts
@@ -87,6 +87,7 @@ export class LoginComponent implements OnInit, OnDestroy {
this.authService
.login(request, () => { }, this.ts.trPK("general", "ok"))
.subscribe((result: CheckUserAuthenticationResponse) => {
+ console.log(result);
if (this.cs.validResponse(result)) {
this.loginData.LogInTokenID = result.LogInTokenID;
this.loginData.MobileNumber = result.MemberLoginList.P_MOBILE_NUMBER;
diff --git a/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.html b/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.html
index e1cf75d5..7db5bed9 100644
--- a/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.html
+++ b/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.html
@@ -11,19 +11,13 @@
-
- {{'vacation-rule, itemType' | translate}}
-
-
- {{'vacation-rule, notification-type' | translate}}
-
-
- {{'vacation-rule, create-vacation-rule' | translate}}
-
@@ -52,33 +46,58 @@
-
+
+
{{assignMode.RADIO_BUTTON_LABEL}}
- {{'createVacationRule.deliver' | translate}}
+ {{'vacation-rule, deliver' | translate}}
-
+
- {{'createVacationRule.close' | translate}}
+ {{'vacation-rule, close' | translate}}
-
+
- {{'createVacationRule.respond' | translate}}
+ {{'vacation-rule, respond' | translate}}
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+
+
+
+
+
\ No newline at end of file
diff --git a/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.scss b/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.scss
index ea1b58d3..b82126ca 100644
--- a/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.scss
+++ b/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.scss
@@ -12,3 +12,8 @@ ion-item {
width: 100%;
margin-right: 7%;
}
+
+.select-text {
+ font-size: small;
+ white-space: normal;
+}
diff --git a/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.ts b/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.ts
index c0cf23d8..e315e623 100644
--- a/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.ts
+++ b/Mohem/src/app/vacation-rule/create-vacation-rule/create-vacation-rule.component.ts
@@ -1,9 +1,18 @@
-import { Component, OnInit } from '@angular/core';
+import { createVacationRequest } from './../model/createVacation.Request';
+import { ReplacementServiceRequest } from './../model/replacement-Service.request';
+import { notificationTypeRequest } from './../model/notification.Request';
+import { vacationTypeResponse } from './../model/vacationType.Respond';
+import { vacationRuleResponse } from './../model/vacationRule.Respond';
+import { Component, OnInit, ElementRef } from '@angular/core';
import * as moment from 'moment';
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 { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request';
+import { NavController, ModalController } from '@ionic/angular';
+import { notificationTypeResponse } from '../model/notification.Respond';
+import { Router, ActivatedRoute } from '@angular/router';
+import { ReplacementListComponent } from '../replacement-list/replacement-list.component';
@Component({
selector: 'app-create-vacation-rule',
@@ -30,7 +39,7 @@ export class CreateVacationRuleComponent implements OnInit {
itemType: any;
notificationType: any;
RespondAttributeList: any;
- // vacationRuleRequest: createVacationRequest;
+ vacationRuleRequest: createVacationRequest;
REASSIGN_val: any;
schemaNotific: any;
notifTypeSel: any;
@@ -42,14 +51,346 @@ export class CreateVacationRuleComponent implements OnInit {
hideForwordEmployee: any;
exampleJsonObject: any;
- constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService) {
+ constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService,
+ private elementRef: ElementRef, public navCtrl: NavController, public router: Router, public modalController: ModalController,
+ private route: ActivatedRoute) {
this.Sdate = moment().format('YYYY-MM-DDTHH:mm:ssZ');
+
+ this.isUpdate = this.cs.sharedService.getSharedData('isUpdate');
+
+ if (this.isUpdate) {
+ this.updateData = this.cs.sharedService.getSharedData(vacationRuleResponse.SHARED_DATA, true);
+ 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.isUpdate = false;
+ this.SelAction = "";
+ this.itemType = this.cs.sharedService.getSharedData(vacationTypeResponse.SHARED_DATA, true);
+ this.notificationType = this.cs.sharedService.getSharedData(notificationTypeResponse.SHARED_DATA, true);
+ }
+ this.Notification_Title = this.notificationType.NOTIFICATION_DISPLAY_NAME;
+ this.P_ITEM_TYPE_TITLE = this.itemType.ITEM_TYPE_DISPLAY_NAME;
+ 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;
+ }
}
- ngOnInit() {
+ ngOnInit() {
this.getNotificationReassign();
+ this.respondAttributes();
+ }
+
+ async SearchReplacment() {
+ const modal = await this.modalController.create({
+ component: ReplacementListComponent
+ });
+
+ modal.onDidDismiss()
+ .then((data) => {
+ const user = data.data.empData;
+ 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');
+ }
+ });
+ // console.log(this.msgVal)
+ let msg: string = "";
+ if (this.notifTypeSel == undefined) {
+ msg = this.ts.trPK('vacation-rule', 'fillAction');
+ // this.common.showAlert(msg);
+ this.cs.presentAlert(msg);
+ } else if (this.msgVal == undefined) {
+ msg = this.ts.trPK('vacation-rule', 'fillMsg');
+ // this.common.showAlert(msg);
+ this.cs.presentAlert(msg);
+ } else if (this.Sdate == undefined) {
+ msg = this.ts.trPK('vacation-rule', 'fillSDate');
+ // this.common.showAlert(msg);
+ this.cs.presentAlert(msg);
+ } 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 if (isDate(responseAttrDic[key])) {
+ // obj.ATTRIBUTE_DATE_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 x: any; let y: any;
+ // x = moment(this.Sdate).format('YYYY/MM/DD');
+ // if (this.startTime)
+ // y = moment(this.startTime).format('hh:mm:ss');
+ // else
+ // y='00:00:00'
+ // jsonSDate = this.common.convertISODateToJsonDate(x + " " + y);
+ let startDate = moment(this.Sdate).format('YYYY-MM-DDTHH:mm:ssZ');
+ jsonSDate = this.cs.convertISODateToJsonDate(startDate);
+ } else {
+ jsonSDate = null;
+ }
+ if (this.Edate) {
+ // let x: any; let y: any;
+ // x = moment(this.Edate).format('YYYY/MM/DD');
+ // if (this.endTime)
+ // y = this.endTime;
+ // else
+ // y='00:00:00'
+ let endDate = moment(this.Edate).format('YYYY-MM-DDTHH:mm:ssZ');
+ jsonEDate = this.cs.convertISODateToJsonDate(endDate);
+ //jsonEDate = this.common.convertISODateToJsonDate(x + " " + y);
+ } else {
+ 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.ApplyFunc();
+ }, 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.navCtrl.pop();
+ this.cs.JustAlertDialog(this.ts.trPK('general', 'ok'), this.ts.trPK('vacation-rule', 'rule-success'))
+ this.goToStart();
+ // this.navCtrl.push("VacationRulePage");
+ // let index= this.navCtrl.indexOf('VacationRulePage');
+ // this.navCtrl.popTo('VacationRulePage');
+ }
}
+ goToStart() {
+ // let index: number;
+ // let views: any[] = this.navCtrl()
+ // let found: boolean = views.some((view, i) => {
+ // index = i
+ // return (view.id == 'VacationRulePage')
+ // })
+ // found ? this.navCtrl.popTo(views[index]) : this.navCtrl.push("HomePage")
+ 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');
+ // this.common.showAlert(msg);
+ } else if (this.msgVal == undefined) {
+ msg = this.ts.trPK('vacation-rule', 'fillMsg');
+ // this.common.showAlert(msg);
+ } else if (this.Sdate == undefined) {
+ msg = this.ts.trPK('vacation-rule', 'fillSDate');
+ // this.common.showAlert(msg);
+ } 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 if (isDate(responseAttrDic[key])) {
+ // obj.ATTRIBUTE_DATE_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 x: any; let y: any;
+ // x = moment(this.Sdate).format('YYYY/MM/DD');
+ // if (this.startTime)
+ // y = moment(this.startTime).format('hh:mm:ss');
+ // jsonSDate = this.common.convertISODateToJsonDate(x + " " + y);
+ // } else {
+ // jsonSDate = null;
+ // }
+ if (this.Sdate) {
+ // let x: any; let y: any;
+ // x = moment(this.Sdate).format('YYYY/MM/DD');
+ // if (this.startTime)
+ // y = moment(this.startTime).format('hh:mm:ss');
+ // else
+ // y='00:00:00'
+ // jsonSDate = this.common.convertISODateToJsonDate(x + " " + y);
+ let startDate = moment(this.Sdate).format('YYYY-MM-DDTHH:mm:ssZ');
+
+ jsonSDate = this.cs.convertISODateToJsonDate(startDate);
+ } else {
+ jsonSDate = null;
+ }
+ // if (this.Edate)
+ // jsonEDate = this.common.convertISODateToJsonDate(this.Edate + " " + this.endTime);
+ // else
+ // jsonEDate = null;
+ if (this.Edate) {
+ // let x: any; let y: any;
+ // x = moment(this.Edate).format('YYYY/MM/DD');
+ // if (this.endTime)
+ // y = moment(this.endTime).format('hh:mm:ss');
+ // else
+ // y='00:00:00'
+ // jsonEDate = this.common.convertISODateToJsonDate(x + " " + y);
+ 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
+ }
+ //let request = this.sharedData.getSharedData(vacationRuleResponse.SHARED_DATA);
+ 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();
+ //this.navCtrl.popTo('VacationRulePage');
+ }
+ }
+
+
+
+
getNotificationReassign() {
let request: LoginRequest = new LoginRequest();
@@ -68,6 +409,92 @@ export class CreateVacationRuleComponent implements OnInit {
});
}
+ 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.P_Schema)
+ this.schemaNotific = JSON.parse(result.P_Schema);
+ this.reverseAction();
+ if (this.isUpdate) {
+ this.fillResposeAtrributes(result.RespondAttributesList);
+ }
+ // ATTRIBUTE_DISPLAY_NAME: "Note"
+ // ATTRIBUTE_FORMAT: "4000"
+ // ATTRIBUTE_NAME: "WF_NOTE"
+ // ATTRIBUTE_TYPE: "VARCHAR2"
+ }
+ }
+
+ 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) {
+ 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;
+ // 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;
+ }
+ }
+
reverseAction() {
if (this.updateData) {
switch (this.SelAction) {
@@ -99,9 +526,40 @@ export class CreateVacationRuleComponent implements OnInit {
}
}
- respondAttributes() {
+ 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;
+ }
}
-
}
diff --git a/Mohem/src/app/vacation-rule/home/home.component.ts b/Mohem/src/app/vacation-rule/home/home.component.ts
index 3e6f204a..38d42351 100644
--- a/Mohem/src/app/vacation-rule/home/home.component.ts
+++ b/Mohem/src/app/vacation-rule/home/home.component.ts
@@ -1,8 +1,12 @@
+import { vacationRuleResponse } from './../model/vacationRule.Respond';
+import { notificationTypeRequest } from './../model/notification.Request';
+import { DeleteVacationRuleRequest } from './../model/deleteVacationRule.Request';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { VacationRuleServiceService } from './../service/vacation-rule-service.service';
import { VacationRuleRequest } from './../model/VacationRuleRequest';
import { Component, OnInit } from '@angular/core';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
+import { NavigationExtras, Router } from '@angular/router';
@Component({
selector: 'app-home',
@@ -20,102 +24,9 @@ export class HomeComponent implements OnInit {
RespondAttributeList: any;
- constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService) {
+ constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService, private router: Router) {
this.P_PAGE_NUM = 1;
this.P_PAGE_LIMIT = 50;
-
- this.GetVacationRulesList = [
- {
- "ACTION": "FORWARD",
- "ACTION_DISPLAY": "Forward",
- "BEGIN_DATE": "6/26/2019 2:50:14 PM",
- "END_DATE": "6/30/2019 2:50:22 PM",
- "FROM_ROW_NUM": 1,
- "FYI_FLAG": "Y",
- "ITEM_TYPE": "HRSSA",
- "ITEM_TYPE_DISPLAY_NAME": "HR",
- "MESSAGE": "TEst Rule",
- "NOTIFICATION_DISPLAY_NAME": "",
- "NOTIFICATION_NAME": "*",
- "NOTIFICATION_SUBJECT": "",
- "NO_OF_ROWS": 1,
- "REPLACEMENT_USER_NAME": "70915",
- "ROW_NUM": 1,
- "RULE_ID": 7770756,
- "RULE_NAME": "Delegate: Al Oulah, Mohammed",
- "RULE_STATUS": "Active",
- "RULE_TIP_MESSAGE": "",
- "TO_ROW_NUM": 1
- },
- {
- "ACTION": "FORWARD",
- "ACTION_DISPLAY": "Forward",
- "BEGIN_DATE": "6/26/2019 2:50:14 PM",
- "END_DATE": "6/30/2019 2:50:22 PM",
- "FROM_ROW_NUM": 1,
- "FYI_FLAG": "Y",
- "ITEM_TYPE": "HRSSA",
- "ITEM_TYPE_DISPLAY_NAME": "HR",
- "MESSAGE": "TEst Rule",
- "NOTIFICATION_DISPLAY_NAME": "",
- "NOTIFICATION_NAME": "*",
- "NOTIFICATION_SUBJECT": "",
- "NO_OF_ROWS": 1,
- "REPLACEMENT_USER_NAME": "70915",
- "ROW_NUM": 1,
- "RULE_ID": 7770756,
- "RULE_NAME": "Delegate: Al Oulah, Mohammed",
- "RULE_STATUS": "Active",
- "RULE_TIP_MESSAGE": "",
- "TO_ROW_NUM": 1
- },
- {
- "ACTION": "FORWARD",
- "ACTION_DISPLAY": "Forward",
- "BEGIN_DATE": "6/26/2019 2:50:14 PM",
- "END_DATE": "6/30/2019 2:50:22 PM",
- "FROM_ROW_NUM": 1,
- "FYI_FLAG": "Y",
- "ITEM_TYPE": "HRSSA",
- "ITEM_TYPE_DISPLAY_NAME": "HR",
- "MESSAGE": "TEst Rule",
- "NOTIFICATION_DISPLAY_NAME": "",
- "NOTIFICATION_NAME": "*",
- "NOTIFICATION_SUBJECT": "",
- "NO_OF_ROWS": 1,
- "REPLACEMENT_USER_NAME": "70915",
- "ROW_NUM": 1,
- "RULE_ID": 7770756,
- "RULE_NAME": "Delegate: Al Oulah, Mohammed",
- "RULE_STATUS": "Active",
- "RULE_TIP_MESSAGE": "",
- "TO_ROW_NUM": 1
- },
- {
- "ACTION": "FORWARD",
- "ACTION_DISPLAY": "Forward",
- "BEGIN_DATE": "6/26/2019 2:50:14 PM",
- "END_DATE": "6/30/2019 2:50:22 PM",
- "FROM_ROW_NUM": 1,
- "FYI_FLAG": "Y",
- "ITEM_TYPE": "HRSSA",
- "ITEM_TYPE_DISPLAY_NAME": "HR",
- "MESSAGE": "TEst Rule",
- "NOTIFICATION_DISPLAY_NAME": "",
- "NOTIFICATION_NAME": "*",
- "NOTIFICATION_SUBJECT": "",
- "NO_OF_ROWS": 1,
- "REPLACEMENT_USER_NAME": "70915",
- "ROW_NUM": 1,
- "RULE_ID": 7770756,
- "RULE_NAME": "Delegate: Al Oulah, Mohammed",
- "RULE_STATUS": "Active",
- "RULE_TIP_MESSAGE": "",
- "TO_ROW_NUM": 1
- }
-
- ];
-
}
ngOnInit() {
@@ -129,6 +40,7 @@ export class HomeComponent implements OnInit {
}
getVacationRules() {
+ this.GetVacationRulesList = [];
this.P_PAGE_NUM = 1;
this.IsReachEnd = false;
let request: VacationRuleRequest = new VacationRuleRequest();
@@ -139,8 +51,9 @@ export class HomeComponent implements OnInit {
this.getVacationRules();
}, this.ts.trPK('general', 'retry')).subscribe((result) => {
if (this.cs.validResponse(result)) {
- console.log(result);
- console.log(JSON.stringify(result));
+ // console.log(result);
+ // console.log(JSON.stringify(result));
+ this.GetVacationRulesList = result.GetVacationRulesList;
} else {
this.cs.presentAlert(result.ErrorEndUserMessage);
}
@@ -148,9 +61,64 @@ export class HomeComponent implements OnInit {
}
deleteFunc(i) {
+ let alert = this.cs.confirmAlertDialog(() => {
+ this.deleteVacationRule(i);
+ }, this.ts.trPK('general', 'ok'), () => {
+ }, this.ts.trPK('general', 'cancel'), this.ts.trPK('vacation-rule', 'confirmation'), this.ts.trPK('vacation-rule', 'deleteVR'));
+ }
+
+ deleteVacationRule(i) {
+ let request: DeleteVacationRuleRequest = new DeleteVacationRuleRequest();
+ request.P_RULE_ID = this.GetVacationRulesList[i].RULE_ID;
+ this.vacationRuleService.deleteVacationRule(request, () => {
+ this.deleteVacationRule(i);
+ }, this.ts.trPK('general', 'retry')).subscribe((result) => {
+ if (this.cs.validResponse(result)) {
+ this.handleDeleteVacationRuleResult(result)
+ } else {
+ this.cs.presentAlert(result.ErrorEndUserMessage);
+ }
+ });
+ }
+
+ handleDeleteVacationRuleResult(result) {
+ if (this.cs.validResponse(result)) {
+ //this.navCtrl.push('HomePage');
+ this.cs.JustAlertDialog(this.ts.trPK('general', 'ok'), this.ts.trPK('vacation-rule', 'rule-delete-success'));
+ this.getVacationRules();
+ }
}
updateFunc(i) {
+ this.respondAttributes(i);
+
+ this.cs.sharedService.setSharedData(this.GetVacationRulesList[i], vacationRuleResponse.SHARED_DATA);
+ this.isUpdate = true;
+
+ this.cs.sharedService.setSharedData(this.isUpdate, 'isUpdate');
+ this.router.navigate(['/vacation-rule/create-vacation-rule']);
+ }
+
+
+ respondAttributes(i) {
+ let request: notificationTypeRequest = new notificationTypeRequest();
+ request.P_NOTIFICATION_NAME = this.GetVacationRulesList[i].NOTIFICATION_NAME;
+ request.P_ITEM_TYPE = this.GetVacationRulesList[i].ITEM_TYPE;
+ this.vacationRuleService.respondAttributes(request, () => {
+ this.respondAttributes(i);
+ }, this.ts.trPK('general', 'retry')).subscribe((result) => {
+ this.handlerespondAttributesResult(result, i);
+ });
+
+ }
+ handlerespondAttributesResult(result, i) {
+ // console.log("Respond att: ")
+ if (this.cs.validResponse(result)) {
+ // console.log(result.RespondAttributesList);
+ this.RespondAttributeList = result.RespondAttributesList;
+ this.GetVacationRulesList[i].RespondAttributeList = this.RespondAttributeList;
+ }
}
+
}
diff --git a/Mohem/src/app/vacation-rule/model/createVacation.Request.ts b/Mohem/src/app/vacation-rule/model/createVacation.Request.ts
new file mode 100644
index 00000000..d370c09b
--- /dev/null
+++ b/Mohem/src/app/vacation-rule/model/createVacation.Request.ts
@@ -0,0 +1,13 @@
+import { LoginRequest } from '../../hmg-common/services/authentication/models/login.request';
+
+export class createVacationRequest extends LoginRequest{
+ public static SHARED_DATA = 'vacation-request';
+ public P_ITEM_TYPE: string;
+ public P_BEGIN_DATE: string;
+ public P_END_DATE: string;
+ public P_MESSAGE: string;
+ public P_REPLACEMENT_USER_NAME: string;
+ public P_NOTIFICATION_NAME: string;
+ public P_ACTION:string;
+ public RespondAttributeList: string;
+}
diff --git a/Mohem/src/app/vacation-rule/model/deleteVacationRule.Request.ts b/Mohem/src/app/vacation-rule/model/deleteVacationRule.Request.ts
new file mode 100644
index 00000000..ddbcf6b0
--- /dev/null
+++ b/Mohem/src/app/vacation-rule/model/deleteVacationRule.Request.ts
@@ -0,0 +1,6 @@
+import { LoginRequest } from '../../hmg-common/services/authentication/models/login.request';
+
+export class DeleteVacationRuleRequest extends LoginRequest{
+ public static SHARED_DATA = 'deleteVacation-request';
+ public P_RULE_ID : number;
+}
diff --git a/Mohem/src/app/vacation-rule/model/replacement-Service.request.ts b/Mohem/src/app/vacation-rule/model/replacement-Service.request.ts
new file mode 100644
index 00000000..685ebd9c
--- /dev/null
+++ b/Mohem/src/app/vacation-rule/model/replacement-Service.request.ts
@@ -0,0 +1,10 @@
+import { Request } from '../../hmg-common/services/models/request';
+
+export class ReplacementServiceRequest extends Request{
+ P_SEARCH_USER_NAME:string;
+ P_SEARCH_EMPLOYEE_DISPLAY_NAME:string;
+ P_SEARCH_EMAIL_ADDRESS:string;
+ P_PAGE_NUM:number;
+ P_PAGE_LIMIT:number;
+ P_SELECTED_EMPLOYEE_NUMBER:string
+}
\ No newline at end of file
diff --git a/Mohem/src/app/vacation-rule/model/vacationRule.Respond.ts b/Mohem/src/app/vacation-rule/model/vacationRule.Respond.ts
new file mode 100644
index 00000000..b286e2cd
--- /dev/null
+++ b/Mohem/src/app/vacation-rule/model/vacationRule.Respond.ts
@@ -0,0 +1,27 @@
+import { Response } from '../../hmg-common/services/models/response';
+
+
+export class vacationRuleResponse extends Response {
+ public static SHARED_DATA = 'vacationRuleRespond-shared';
+ public ACTION:string;
+ public ACTION_DISPLAY: string;
+ public BEGIN_DATE :string;
+ public END_DATE : string;
+ public FROM_ROW_NUM :number;
+ public FYI_FLAG :string;
+ public ITEM_TYPE : string;
+ public ITEM_TYPE_DISPLAY_NAME: string;
+ public MESSAGE: string;
+ public NOTIFICATION_DISPLAY_NAME: string;
+ public NOTIFICATION_NAME: string;
+ public NOTIFICATION_SUBJECT: string;
+ public NO_OF_ROWS : number;
+ public REPLACEMENT_USER_NAME: string;
+ public ROW_NUM : number;
+ public RULE_ID :number;
+ public RULE_NAME: string;
+ public RULE_STATUS: string;
+ public RULE_TIP_MESSAGE: string;
+ public TO_ROW_NUM : number;
+ public RespondAttributeList: any[];
+}
diff --git a/Mohem/src/app/vacation-rule/model/vacationType.Respond.ts b/Mohem/src/app/vacation-rule/model/vacationType.Respond.ts
new file mode 100644
index 00000000..04e5de8f
--- /dev/null
+++ b/Mohem/src/app/vacation-rule/model/vacationType.Respond.ts
@@ -0,0 +1,8 @@
+
+import { Response } from '../../hmg-common/services/models/response';
+
+import {VRuleItemType} from './vr.itemType.List'
+export class vacationTypeResponse extends Response {
+ public static SHARED_DATA = 'vacationTypeRespond-shared';
+ public VrItemTypesList : VRuleItemType[];
+}
diff --git a/Mohem/src/app/vacation-rule/model/vr.itemType.List.ts b/Mohem/src/app/vacation-rule/model/vr.itemType.List.ts
new file mode 100644
index 00000000..c66a8a57
--- /dev/null
+++ b/Mohem/src/app/vacation-rule/model/vr.itemType.List.ts
@@ -0,0 +1,5 @@
+
+export class VRuleItemType {
+ public ITEM_TYPE:string;
+ public ITEM_TYPE_DISPLAY_NAME: string;
+}
diff --git a/Mohem/src/app/vacation-rule/notification-type/notification-type.component.ts b/Mohem/src/app/vacation-rule/notification-type/notification-type.component.ts
index 10188377..0b640594 100644
--- a/Mohem/src/app/vacation-rule/notification-type/notification-type.component.ts
+++ b/Mohem/src/app/vacation-rule/notification-type/notification-type.component.ts
@@ -1,3 +1,6 @@
+import { vacationTypeResponse } from './../model/vacationType.Respond';
+import { VRuleItemType } from './../model/vr.itemType.List';
+import { notificationTypeResponse } from './../model/notification.Respond';
import { Component, OnInit } from '@angular/core';
import { VacationRuleServiceService } from '../service/vacation-rule-service.service';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@@ -11,7 +14,7 @@ import { notificationTypeRequest } from '../model/notification.Request';
})
export class NotificationTypeComponent implements OnInit {
- itemTypeObj: any;
+ itemTypeObj: VRuleItemType;
itemType: string;
notifTypeSel: any;
notification_list: any;
@@ -19,15 +22,26 @@ export class NotificationTypeComponent implements OnInit {
constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService) {
- this.itemTypeObj = this.cs.sharedService.getSharedData('selectedItemType');
+ this.itemTypeObj= this.cs.sharedService.getSharedData(vacationTypeResponse.SHARED_DATA, false);
this.itemType = this.itemTypeObj.ITEM_TYPE_DISPLAY_NAME;
}
- ngOnInit() {
+ ngOnInit() {
+ console.log(this.cs.sharedService.getSharedData(vacationTypeResponse.SHARED_DATA, false));
this.getNotificationType();
}
NextPage() {
+ if (this.notifTypeSel == "*") {
+ 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.cs.navigateForward('/vacation-rule/create-vacation-rule');
}
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
new file mode 100644
index 00000000..c2e2980f
--- /dev/null
+++ b/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.html
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+ {{'vacation-rule, search-by' | translate}}
+
+ {{'vacation-rule, search-by-name' | translate}}
+ {{'vacation-rule, search-by-username' | translate}}
+ {{'vacation-rule, search-by-email' | translate}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{employee.EMPLOYEE_DISPLAY_NAME}}
{{employee.USER_NAME}}
+ {{employee.EMAIL_ADDRESS}}
+
+
+
+
+
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 00000000..fad75a46
--- /dev/null
+++ b/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.scss
@@ -0,0 +1,11 @@
+ion-item {
+ margin-top: 5%;
+ margin-right: 7%;
+}
+
+.footer-button {
+ border-radius: 3px;
+ padding: 0 1.1em;
+ min-height: 45px;
+ min-width: 200px;
+ }
\ No newline at end of file
diff --git a/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.spec.ts b/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.spec.ts
new file mode 100644
index 00000000..0c96f230
--- /dev/null
+++ b/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.spec.ts
@@ -0,0 +1,27 @@
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ReplacementListComponent } from './replacement-list.component';
+
+describe('ReplacementListComponent', () => {
+ let component: ReplacementListComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ ReplacementListComponent ],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ReplacementListComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
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
new file mode 100644
index 00000000..d294e22c
--- /dev/null
+++ b/Mohem/src/app/vacation-rule/replacement-list/replacement-list.component.ts
@@ -0,0 +1,130 @@
+import { ReplacementServiceRequest } from './../model/replacement-Service.request';
+import { Component, OnInit } 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 { ModalController } from '@ionic/angular';
+
+
+
+@Component({
+ selector: 'app-replacement-list',
+ templateUrl: './replacement-list.component.html',
+ styleUrls: ['./replacement-list.component.scss'],
+})
+export class ReplacementListComponent implements OnInit {
+
+ P_SEARCH_USER_NAME: string = "";
+ P_SEARCH_EMPLOYEE_DISPLAY_NAME: string = "";
+ P_SEARCH_EMAIL_ADDRESS: string = "";
+ P_PAGE_NUM: number = 1;
+ P_PAGE_LIMIT: number = 50;
+ ReplacementList: any = [];
+ IsReachEnd: boolean = false;
+ selEmp: string = null;
+ callback: any;
+ searchKey: any = "";
+ searchKeySelect: string = "";
+ replacmentRequest: any = "";
+ isAbs: boolean = false;
+ isSave: boolean = false;
+
+ constructor(public vacationRuleService: VacationRuleServiceService, public ts: TranslatorService, public cs: CommonService, public modalController: ModalController) { }
+
+ ngOnInit() { }
+
+ SearchReplacementList() {
+ this.ReplacementList = [];
+ this.IsReachEnd = false;
+ this.P_PAGE_NUM = 1;
+ if (this.searchKey) {
+ switch (this.searchKeySelect) {
+ case '1': {
+
+ this.P_SEARCH_EMPLOYEE_DISPLAY_NAME = this.searchKey;
+ this.P_SEARCH_USER_NAME = "";
+ this.P_SEARCH_EMAIL_ADDRESS = "";
+
+ break;
+ }
+ case '2': {
+ this.P_SEARCH_USER_NAME = this.searchKey;
+ this.P_SEARCH_EMPLOYEE_DISPLAY_NAME = "";
+ this.P_SEARCH_EMAIL_ADDRESS = "";
+ break;
+ }
+ case '3': {
+ this.P_SEARCH_EMAIL_ADDRESS = this.searchKey;
+ this.P_SEARCH_USER_NAME = "";
+ this.P_SEARCH_EMPLOYEE_DISPLAY_NAME = "";
+ break;
+ }
+ default: {
+ this.P_SEARCH_USER_NAME = "";
+ this.P_SEARCH_EMPLOYEE_DISPLAY_NAME = "";
+ this.P_SEARCH_EMAIL_ADDRESS = "";
+ break;
+ }
+ }
+ } else {
+ this.P_SEARCH_USER_NAME = "";
+ this.P_SEARCH_EMPLOYEE_DISPLAY_NAME = "";
+ this.P_SEARCH_EMAIL_ADDRESS = "";
+ }
+
+ const request = new ReplacementServiceRequest();
+ request.P_SEARCH_USER_NAME = this.P_SEARCH_USER_NAME;
+ request.P_SEARCH_EMPLOYEE_DISPLAY_NAME = this.P_SEARCH_EMPLOYEE_DISPLAY_NAME;
+ request.P_SEARCH_EMAIL_ADDRESS = this.P_SEARCH_EMAIL_ADDRESS;
+ 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) => {
+ this.handleReplacment(result);
+ });
+ }
+
+ handleReplacment(result) {
+ if (this.cs.validResponse(result)) {
+ if (this.cs.hasData(result.ReplacementList)) {
+ this.ReplacementList = result.ReplacementList;
+ this.P_PAGE_NUM++;
+ let lastItemIndex = this.ReplacementList.length - 1;
+ if (result.ReplacementList[lastItemIndex]) {
+ let lastitem = result.ReplacementList[lastItemIndex];
+ if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) {
+ this.IsReachEnd = true;
+ } else {
+ this.IsReachEnd = false;
+ }
+ }
+ }
+ }
+ }
+
+ doInfinite(infiniteScroll) {
+
+ }
+
+ closePage() {
+ this.isSave = true;
+ let data: any = null;
+ if (this.isSave == true) {
+ if (this.selEmp) {
+ data = this.ReplacementList[this.selEmp];
+ } else {
+ data = null;
+ }
+ if (typeof this.callback == 'function') {
+ this.callback(data);
+ }
+
+ this.modalController.dismiss({
+ 'dismissed': true,
+ empData: data
+ });
+ }
+ }
+}
diff --git a/Mohem/src/app/vacation-rule/service/vacation-rule-service.service.ts b/Mohem/src/app/vacation-rule/service/vacation-rule-service.service.ts
index 5d54a159..4359879f 100644
--- a/Mohem/src/app/vacation-rule/service/vacation-rule-service.service.ts
+++ b/Mohem/src/app/vacation-rule/service/vacation-rule-service.service.ts
@@ -1,3 +1,4 @@
+import { ReplacementServiceRequest } from './../model/replacement-Service.request';
import { notificationTypeRequest } from './../model/notification.Request';
import { Response } from 'src/app/hmg-common/services/models/response';
import { VacationRuleRequest } from './../model/VacationRuleRequest';
@@ -7,6 +8,7 @@ import { Observable } from 'rxjs';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { VacationTypeRequest } from '../model/VacationTypeRequest';
import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request';
+import { DeleteVacationRuleRequest } from '../model/deleteVacationRule.Request';
@Injectable({
providedIn: 'root'
@@ -24,11 +26,13 @@ export class VacationRuleServiceService {
public static updateVacationRule = 'Services/ERP.svc/REST/UPDATE_VACATION_RULE';
public static respondAttributes = 'Services/ERP.svc/REST/GET_RESPOND_ATTRIBUTES';
public static notificationReassign = 'Services/ERP.svc/REST/GET_NOTIFICATION_REASSIGN_MODE';
+ public static getRespondAttributeValues = 'Services/ERP.svc/REST/GET_RESPOND_ATTRIBUTE_VALUE';
+ public static getReplacmentEmployeeList = 'Services/ERP.svc/REST/GET_REPLACEMENT_LIST';
constructor(public authService: AuthenticationService, public con: ConnectorService) { }
- public getVacationRule(vacationRuleRequest: VacationRuleRequest, onError: any, errorLabel: string): Observable {
+ public getVacationRule(vacationRuleRequest: VacationRuleRequest, onError: any, errorLabel: string): Observable {
const request = vacationRuleRequest;
console.log(request);
this.authService.authenticateRequest(request);
@@ -53,4 +57,39 @@ export class VacationRuleServiceService {
return this.con.post(VacationRuleServiceService.notificationReassign, request, onError, errorLabel);
}
+ public respondAttributes(notificationTypeRequest: notificationTypeRequest, onError: any, errorLabel: string): Observable {
+ const request = notificationTypeRequest;
+ this.authService.authenticateRequest(request);
+ return this.con.post(VacationRuleServiceService.respondAttributes, request, onError, errorLabel);
+ }
+
+ public getRespondAttributeValues(repsondAttrValues: any, onError?: any, errorLabel?: string): Observable {
+ const request = repsondAttrValues;
+ this.authService.authenticateRequest(request);
+ return this.con.post(VacationRuleServiceService.getRespondAttributeValues, request, onError, errorLabel);
+ }
+
+ public getReplacementList(req: ReplacementServiceRequest, onError?: any, errorLabel?: string): Observable {
+ const request = req;
+ this.authService.authenticateRequest(request);
+ return this.con.post(VacationRuleServiceService.getReplacmentEmployeeList, request, onError, errorLabel);
+ }
+
+ public createVacationRule(ActionHistoryRequest: LoginRequest, onError?: any, errorLabel?: string): Observable {
+ const request = ActionHistoryRequest;
+ this.authService.authenticateRequest(request);
+ return this.con.post(VacationRuleServiceService.createVacationRule, request, onError, errorLabel);
+ }
+
+ public updateVacationRule(ActionHistoryRequest: LoginRequest, onError?: any, errorLabel?: string): Observable {
+ const request = ActionHistoryRequest;
+ this.authService.authenticateRequest(request);
+ return this.con.post(VacationRuleServiceService.updateVacationRule, request, onError, errorLabel);
+ }
+
+ public deleteVacationRule(ActionHistoryRequest: DeleteVacationRuleRequest, onError?: any, errorLabel?: string): Observable {
+ const request = ActionHistoryRequest;
+ this.authService.authenticateRequest(request);
+ return this.con.post(VacationRuleServiceService.deleteVacationRule, request, onError, errorLabel);
+ }
}
diff --git a/Mohem/src/app/vacation-rule/vacation-rule.module.ts b/Mohem/src/app/vacation-rule/vacation-rule.module.ts
index 2dcf55ef..57c90173 100644
--- a/Mohem/src/app/vacation-rule/vacation-rule.module.ts
+++ b/Mohem/src/app/vacation-rule/vacation-rule.module.ts
@@ -4,13 +4,15 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
-
import { IonicModule } from '@ionic/angular';
-
import { VacationRulePage } from './vacation-rule.page';
import { VacationTypeComponent } from './vacation-type/vacation-type.component';
import { NotificationTypeComponent } from './notification-type/notification-type.component';
import { CreateVacationRuleComponent } from './create-vacation-rule/create-vacation-rule.component';
+// import { JsonSchemaFormModule, Framework, WidgetLibraryService, FrameworkLibraryService, JsonSchemaFormService } from 'angular6-json-schema-form';
+import { ReplacementListComponent } from './replacement-list/replacement-list.component';
+// import { MaterialDesignFrameworkModule } from 'angular6-json-schema-form';
+
const routes: Routes = [
{
@@ -32,6 +34,10 @@ const routes: Routes = [
{
path: 'create-vacation-rule',
component: CreateVacationRuleComponent
+ },
+ {
+ path: 'replacement-list',
+ component: ReplacementListComponent
}
]
}
@@ -43,6 +49,17 @@ const routes: Routes = [
FormsModule,
IonicModule,
HmgCommonModule,
+ // {
+ // ngModule: JsonSchemaFormModule,
+ // providers: [
+ // JsonSchemaFormService,
+ // FrameworkLibraryService,
+ // WidgetLibraryService,
+ // // { provide: Framework, useClass: IonicFramework, multi: true }
+ // ]
+ // },
+ // IonicFrameworkModule,
+ // MaterialDesignFrameworkModule,
RouterModule.forChild(routes)
],
declarations: [
@@ -50,7 +67,8 @@ const routes: Routes = [
HomeComponent,
VacationTypeComponent,
NotificationTypeComponent,
- CreateVacationRuleComponent
+ CreateVacationRuleComponent,
+ ReplacementListComponent
]
})
export class VacationRulePageModule { }
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 9934809f..ac3df459 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,3 +1,4 @@
+import { vacationTypeResponse } from './../model/vacationType.Respond';
import { notificationTypeResponse } from './../model/notification.Respond';
import { VacationTypeRequest } from './../model/VacationTypeRequest';
import { Component, OnInit } from '@angular/core';
@@ -37,8 +38,7 @@ export class VacationTypeComponent implements OnInit {
}
NextPage() {
- this.cs.sharedService.setSharedData(this.ruleTypeList[this.index], 'selectedItemType');
- this.cs.navigateForward('/vacation-rule/notification-type');
+ this.cs.sharedService.setSharedData(this.ruleTypeList[this.index], vacationTypeResponse.SHARED_DATA);
if (this.ruleTypeList[this.index].ITEM_TYPE == "*") {
let notificatioAtt: notificationTypeResponse = new notificationTypeResponse();
diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json
index f5e7c8b6..de3e596f 100644
--- a/Mohem/src/assets/localization/i18n.json
+++ b/Mohem/src/assets/localization/i18n.json
@@ -878,6 +878,78 @@
"message-label": {
"en": "Message",
"ar": "رسالة"
+ },
+ "fillMsg": {
+ "en": "Please fill message field",
+ "ar": "يرجى ملء حقل الرسالة"
+ },
+ "fillSDate": {
+ "en": "Please fill start date",
+ "ar": "يرجى ملء تاريخ البدء"
+ },
+ "fillAction": {
+ "en": "Please fill action field",
+ "ar": "يرجى ملء حقل العمل"
+ },
+ "deliver": {
+ "en": "Deliver notifications to me regardless of any general rules",
+ "ar": "تسليم الإخطارات لي بغض النظر عن أي قواعد عامة"
+ },
+ "close": {
+ "en": "Close",
+ "ar": "أغلق"
+ },
+ "respond": {
+ "en": "Respond",
+ "ar": "رد"
+ },
+ "apply": {
+ "en": "Apply",
+ "ar": "تطبيق"
+ },
+ "update": {
+ "en": "Update",
+ "ar": "تحديث"
+ },
+ "search-employee": {
+ "en": "Search for an Employee",
+ "ar": "البحث عن موظف"
+ },
+ "replacement-employee-tip": {
+ "en": "You can search for an employee by Name , User Name and Email ",
+ "ar": "يمكنك البحث عن موظف ب الاسم , اسم المستخدم ,أو البريد الإلكتروني "
+ },
+ "search-by": {
+ "en": "Search by",
+ "ar": "البحث بواسطة"
+ },
+ "search-by-name": {
+ "en": "Name",
+ "ar": "اسم"
+ },
+ "search-by-username": {
+ "en": "Username",
+ "ar": "اسم المستخدم"
+ },
+ "search-by-email": {
+ "en": "Email",
+ "ar": "البريد الإلكتروني"
+ },
+ "confirmation": {
+ "en": "Confirmation",
+ "ar": "البريد الإلكتروني"
+ },
+ "rule-success": {
+ "en": "Rule created successfully",
+ "ar": "تم إنشاء القاعدة بنجاح"
+ },
+ "rule-delete-success": {
+ "en": "Rule deleted successfully",
+ "ar": "تم حذف القاعدة بنجاح"
+ },
+ "rule-update-success": {
+ "en": "Rule updated successfully",
+ "ar": "تم تحديث القاعدة بنجاح"
}
},
"absenceList": {