|
|
|
|
@ -15,13 +15,14 @@ import { AbsenceAttachmentComponent } from '../absence-attachment/absence-attach
|
|
|
|
|
import { WorkListAttachViewComponent } from 'src/app/notification/work-list-attach-view/work-list-attach-view.component';
|
|
|
|
|
import { FileUploader } from 'ng2-file-upload';
|
|
|
|
|
import { SubmitAbsenceModalComponent } from '../submit-absence-modal/submit-absence-modal.component';
|
|
|
|
|
import { HomeComponent } from "src/app/notification/home/home.component";
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-absence-confirm',
|
|
|
|
|
templateUrl: './absence-confirm.component.html',
|
|
|
|
|
styleUrls: ['./absence-confirm.component.scss']
|
|
|
|
|
})
|
|
|
|
|
export class AbsenceConfirmComponent implements OnInit {
|
|
|
|
|
direction:string;
|
|
|
|
|
direction: string;
|
|
|
|
|
P_TransactionID: number;
|
|
|
|
|
approversList = [];
|
|
|
|
|
selEmp: string = '';
|
|
|
|
|
@ -58,7 +59,7 @@ export class AbsenceConfirmComponent implements OnInit {
|
|
|
|
|
this.P_TransactionID = this.common.sharedService.getSharedData(
|
|
|
|
|
AbsenceResponse.SHARED_DATA
|
|
|
|
|
);
|
|
|
|
|
this.getPassNotificationDetails =this.common.sharedService.getSharedData(
|
|
|
|
|
this.getPassNotificationDetails = this.common.sharedService.getSharedData(
|
|
|
|
|
AbsenceNotificatonBodyResponse.NOT_WORKLIST,
|
|
|
|
|
true
|
|
|
|
|
);
|
|
|
|
|
@ -89,7 +90,7 @@ export class AbsenceConfirmComponent implements OnInit {
|
|
|
|
|
this.getApproversList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {}
|
|
|
|
|
ngOnInit() { }
|
|
|
|
|
startAbApproval() {
|
|
|
|
|
if (this.attachListOver) {
|
|
|
|
|
//first call add attach inside success call submit
|
|
|
|
|
@ -126,12 +127,12 @@ export class AbsenceConfirmComponent implements OnInit {
|
|
|
|
|
this.startAbsApprovalProcess();
|
|
|
|
|
} else {
|
|
|
|
|
//stope
|
|
|
|
|
let filtered = this.attachListOver.filter(function(el) {
|
|
|
|
|
let filtered = this.attachListOver.filter(function (el) {
|
|
|
|
|
return el.isSuccess == true;
|
|
|
|
|
});
|
|
|
|
|
this.attachListOver = filtered;
|
|
|
|
|
let msg: string = '';
|
|
|
|
|
// msg = this.translate.translate("addAttach.errorMsg");
|
|
|
|
|
// msg = this.translate.translate("addAttach.errorMsg");
|
|
|
|
|
//this.common.showAlert(msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -168,11 +169,12 @@ export class AbsenceConfirmComponent implements OnInit {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.isSubmitBtnClicked = true;
|
|
|
|
|
//if(this.isResubmitAbs==false){
|
|
|
|
|
// let msg: string = this.ts.trPK('general', 'messageSuccess');
|
|
|
|
|
// this.common.presentAlert(msg);
|
|
|
|
|
this.common.greenToastPK("eit", "approval-message-success")
|
|
|
|
|
// let msg: string = this.ts.trPK('general', 'messageSuccess');
|
|
|
|
|
// this.common.presentAlert(msg);
|
|
|
|
|
this.common.greenToastPK("eit", "approval-message-success")
|
|
|
|
|
// }
|
|
|
|
|
// this.navCtrl.popToRoot();
|
|
|
|
|
this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED);
|
|
|
|
|
this.common.openNotificationPage();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -204,61 +206,61 @@ export class AbsenceConfirmComponent implements OnInit {
|
|
|
|
|
// });
|
|
|
|
|
const modal = await this.modalCtrl.create({
|
|
|
|
|
component: AbsenceAttachmentComponent,
|
|
|
|
|
componentProps:{ indexLastObj: this.attachListOver.length, TransactionID: this.P_TransactionID},
|
|
|
|
|
componentProps: { indexLastObj: this.attachListOver.length, TransactionID: this.P_TransactionID },
|
|
|
|
|
keyboardClose: true,
|
|
|
|
|
animated: false
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
modal.onDidDismiss()
|
|
|
|
|
.then((data) => {
|
|
|
|
|
if (data == 'cancel' || data == 'undefined') {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
if (!str) {
|
|
|
|
|
this.updateFile(data, attachDocID);
|
|
|
|
|
.then((data) => {
|
|
|
|
|
if (data == 'cancel' || data == 'undefined') {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
this.attachListDisplay = data.data;
|
|
|
|
|
this.attachItems = this.attachListDisplay.map(function (el) {
|
|
|
|
|
var o = Object.assign({}, el);
|
|
|
|
|
o.isSuccess = false;
|
|
|
|
|
return o;
|
|
|
|
|
});
|
|
|
|
|
this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems;
|
|
|
|
|
if (!str) {
|
|
|
|
|
this.updateFile(data, attachDocID);
|
|
|
|
|
} else {
|
|
|
|
|
this.attachListDisplay = data.data;
|
|
|
|
|
this.attachItems = this.attachListDisplay.map(function (el) {
|
|
|
|
|
var o = Object.assign({}, el);
|
|
|
|
|
o.isSuccess = false;
|
|
|
|
|
return o;
|
|
|
|
|
});
|
|
|
|
|
this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return await modal.present();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****submit modal********/
|
|
|
|
|
async openSubmitModal() {
|
|
|
|
|
this.common.sharedService.setSharedData( this.attachListOver, 'submitAbsAttachmentList');
|
|
|
|
|
this.common.sharedService.setSharedData(this.absComments, 'absComments');
|
|
|
|
|
const modal = await this.modalCtrl.create({
|
|
|
|
|
component: SubmitAbsenceModalComponent,
|
|
|
|
|
backdropDismiss: false,
|
|
|
|
|
/*****submit modal********/
|
|
|
|
|
async openSubmitModal() {
|
|
|
|
|
this.common.sharedService.setSharedData(this.attachListOver, 'submitAbsAttachmentList');
|
|
|
|
|
this.common.sharedService.setSharedData(this.absComments, 'absComments');
|
|
|
|
|
const modal = await this.modalCtrl.create({
|
|
|
|
|
component: SubmitAbsenceModalComponent,
|
|
|
|
|
backdropDismiss: false,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
modal.cssClass = 'note-modal';
|
|
|
|
|
});
|
|
|
|
|
modal.cssClass = 'note-modal';
|
|
|
|
|
|
|
|
|
|
modal.onDidDismiss()
|
|
|
|
|
.then((data) => {
|
|
|
|
|
console.log(data.data);
|
|
|
|
|
modal.onDidDismiss()
|
|
|
|
|
.then((data) => {
|
|
|
|
|
console.log(data.data);
|
|
|
|
|
|
|
|
|
|
if (data.data == 'cancel' || data.data == undefined) {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
this.startAbApproval();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (data.data == 'cancel' || data.data == undefined) {
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
this.startAbApproval();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return await modal.present();
|
|
|
|
|
return await modal.present();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -266,7 +268,7 @@ async openSubmitModal() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
removeFile(objectitem) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.attachListOver) {
|
|
|
|
|
let index2 = this.attachListOver.findIndex(item => item == objectitem);
|
|
|
|
|
if (index2 > -1) {
|
|
|
|
|
@ -300,12 +302,12 @@ async openSubmitModal() {
|
|
|
|
|
} // valid it
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async OpenAttachFiles(value, Type) {
|
|
|
|
|
async OpenAttachFiles(value, Type) {
|
|
|
|
|
this.common.sharedService.setSharedData({ displayData: value, TypeData: Type }, 'WorkListAttachViewPage');
|
|
|
|
|
const modal = await this.modalCtrl.create({
|
|
|
|
|
component: WorkListAttachViewComponent
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modal.onDidDismiss()
|
|
|
|
|
.then((data) => {
|
|
|
|
|
});
|
|
|
|
|
@ -314,7 +316,7 @@ async openSubmitModal() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateFile(attachList, attachDocID) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let req = {
|
|
|
|
|
P_ATTACHED_DOCUMENT_ID: attachDocID,
|
|
|
|
|
P_FILE_DATA: attachList[0].P_FILE_DATA,
|
|
|
|
|
@ -327,7 +329,7 @@ async openSubmitModal() {
|
|
|
|
|
let msg: string = '';
|
|
|
|
|
// msg = this.translate.translate("addAttach.attachUpdate");
|
|
|
|
|
// this.common.showAlert(msg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID);
|
|
|
|
|
}
|
|
|
|
|
} // val
|
|
|
|
|
@ -345,7 +347,7 @@ async openSubmitModal() {
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
continueDelete(attach) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let req = {
|
|
|
|
|
P_ATTACHED_DOCUMENT_ID: attach.ATTACHED_DOCUMENT_ID
|
|
|
|
|
};
|
|
|
|
|
@ -367,9 +369,9 @@ async openSubmitModal() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************Add attchement Functions*************/
|
|
|
|
|
/*******************Add attchement Functions*************/
|
|
|
|
|
|
|
|
|
|
public uploader: FileUploader = new FileUploader({
|
|
|
|
|
public uploader: FileUploader = new FileUploader({
|
|
|
|
|
allowedMimeType: ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
|
|
|
|
|
maxFileSize: 10 * 1024 * 1024,
|
|
|
|
|
formatDataFunctionIsAsync: true,
|
|
|
|
|
@ -386,7 +388,7 @@ async openSubmitModal() {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onFileSelectedclick(event){
|
|
|
|
|
onFileSelectedclick(event) {
|
|
|
|
|
event.target.value = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -430,7 +432,7 @@ async openSubmitModal() {
|
|
|
|
|
|
|
|
|
|
pushObject(fileData, name, type) {
|
|
|
|
|
|
|
|
|
|
console.log('before push: '+ this.index);
|
|
|
|
|
console.log('before push: ' + this.index);
|
|
|
|
|
//this.attachListOver.length++;
|
|
|
|
|
try {
|
|
|
|
|
let array = name.split('.');
|
|
|
|
|
@ -438,11 +440,11 @@ async openSubmitModal() {
|
|
|
|
|
|
|
|
|
|
this.attachListOver.push(
|
|
|
|
|
{
|
|
|
|
|
AttachmentID: this.attachListOver.length,
|
|
|
|
|
AttachmentID: this.attachListOver.length,
|
|
|
|
|
P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1],
|
|
|
|
|
P_FILE_DATA: fileData.split(',')[1],
|
|
|
|
|
P_FILE_NAME: name,//.split('.')[0],
|
|
|
|
|
P_TRANSACTION_ID: this.P_TransactionID
|
|
|
|
|
P_TRANSACTION_ID: this.P_TransactionID
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|