finish absence confirmation page & add absence submit modal

MOHEMM-SFH-COLORS
Mohamed Mekawy 6 years ago
parent 2ee9d51f7e
commit 69db29931f

@ -1,6 +1,6 @@
<ion-header >
<ion-toolbar class="header-toolbar">
<ion-toolbar class="header-toolbar-new">
<ion-title color="light"> {{ts.trPK('submitAbsenceConfirm','submitAbsenceConfirm')}}</ion-title>
<ion-buttons slot="start">
<nav-buttons></nav-buttons>
@ -11,7 +11,137 @@
<ion-content>
<ion-card>
<!-------------------------------Start New design ---------------------------------------->
<ion-grid>
<ion-row style="margin-top: 20px;margin-left: 12px;">
<ion-col>
<div size="10" class="approvalTitle">{{'general, addAttach' | translate}}</div>
</ion-col>
<ion-col style="padding-left: 7%;" size="2">
<div class="fileDiv">
<input end class="inputfile" style="margin-top: 10px;z-index: 99999;position: absolute;opacity: 0;" type="file" ng2FileSelect [uploader]="uploader"
(change)="onFileSelected($event)" />
<label end for="file" class="attachLable">
<ion-icon style="font-size: 22px;" name="add"></ion-icon>
</label></div>
</ion-col>
</ion-row>
<ion-item class="attachmentDiv" *ngIf="attachListOver?.length == 0">
<ion-img style="height: 26px;width:100%;margin-top:12px" src="../assets/imgs/attach-icon.png"></ion-img>
<ion-label style="margin-top: -24px;" position="floating" class="boldTxtNav">{{ 'general, notAttch' | translate}}</ion-label>
</ion-item>
</ion-grid>
<ion-grid class="attachmentDiv" *ngIf="attachListOver?.length > 0">
<div *ngFor="let attachList of attachListOver ; let i = index">
<ion-row>
<ion-col size="1">
<ion-label style="color: black !important;">
{{attachList.AttachmentID +1 }} .
</ion-label>
</ion-col>
<ion-col style="text-align: left;" size="10">
<ion-label style="color: blue !important;" (click)="OpenAttachFiles(attachList.P_FILE_DATA,attachList.P_FILE_CONTENT_TYPE)">
{{attachList.P_FILE_NAME }}
</ion-label>
</ion-col>
<ion-col size="1">
<!-- <button float-end class="attachImgBtn"
(click)="OpenAttachFiles(attachList.P_FILE_DATA,attachList.P_FILE_CONTENT_TYPE)">
<img class="attachImg" src="../assets/imgs/view.png">
</button> -->
<button float-end [disabled]="attachList.isSuccess" class="attachImgBtn removeLable"
(click)="removeFile(attachList)">
<ion-icon style="font-size:22px;margin-left:-7px;margin-top:-2px;" name="close"></ion-icon>
</button>
</ion-col>
</ion-row>
</div>
</ion-grid>
<ion-grid *ngIf="attachmentRes?.length > 0">
<div *ngFor="let attachRes of attachmentRes">
<ion-row>
<ion-col col-8>
<div> <img float-start class="attachImg" src="../assets/imgs/file.png">
</div>
<ion-label>
{{attachRes.FILE_NAME }} </ion-label>
</ion-col>
<ion-col col-4>
<button float-end class="attachImgBtn"
(click)="OpenAttachFiles(attachRes.FILE_DATA,attachRes.FILE_CONTENT_TYPE)">
<img class="attachImg" src="../assets/imgs/view.png">
</button>
<button float-end [disabled]="!isResubmitEIT" class="attachImgBtn" (click)="delelteFile(attachRes)"><img
class="attachImg" src="../assets/imgs/deletegray.png"></button>
</ion-col>
<!-- <button [disabled]="!isResubmitEIT" class="iconButton" (click)="addAttachment(false,attachRes)"><img
class="imgSize" src="../assets/imgs/editIcon.png"></button>
<button (click)="delelteFile(attachRes)" class="iconButton" [disabled]="!isResubmitEIT"><img
class="imgSize" src="../assets/imgs/cancel.png"></button> -->
</ion-row>
</div>
</ion-grid>
<ion-grid class="">
<div class="approvalTitle">{{'confirmAddEit, comment' | translate}}</div>
<ion-item class="submitNote" lines="none">
<!-- <ion-label position="floating" class="boldTxtNav">{{'confirmAddEit, comment' | translate}}</ion-label> -->
<ion-textarea type="text" [(ngModel)]="absComments"></ion-textarea>
</ion-item>
</ion-grid>
<ion-grid class="approvalList">
<div class="approvalTitle">{{'confirmAddEit, approverList' | translate}}</div>
<div class="noDataDiv" *ngIf="approversList?.length == 0">
<p>{{ 'general, empty' | translate}}</p>
</div>
<div style="background-color: white;border-radius: 32px;border: 1px solid #c8c4c4;" *ngIf="approversList?.length > 0">
<ion-list class="notification-list ">
<div class="timeline">
<ion-item style="padding-left: 4%;" *ngFor="let employee of approversList">
<div class="timeline-item" slot="start">
<div class="timeline-thumb timeline-icon">
<img *ngIf="employee.EMPLOYEE_IMAGE" class="empImge"
[src]="'data:image/png;base64,'+employee.EMPLOYEE_IMAGE">
<img *ngIf="employee.EMPLOYEE_IMAGE == null" class="empImge"
src="../assets/imgs/profile.png"> </div>
</div>
<ion-col>
<ion-label style="color:black !important ;font-weight: bold;padding-top: 0%;">
{{employee.APPROVER}}
</ion-label>
<ion-label style="color:black !important ;padding-top: 4%;">
{{employee.POSITION_TITLE}}
</ion-label>
</ion-col>
<div class="line"></div>
</ion-item>
</div>
</ion-list>
</div>
</ion-grid>
<!-------------------------------End New design ---------------------------------------->
<!-- <ion-card>
<ion-card-header class="boxHdr">
<div class="hrTitle"> {{ts.trPK('confirmAddEit','approverList')}}</div>
</ion-card-header>
@ -123,14 +253,14 @@
</ion-grid>
</ion-card-content>
</ion-card>
</ion-card> -->
</div>
<!-- </div> -->
</ion-content>
<ion-footer>
<div class="centerDiv">
<ion-button color="customnavy" (click)="startAbApproval()">{{ts.trPK('confirmAddEit','start')}}</ion-button>
<ion-button class="confirmEitOkButton" (click)="openSubmitModal()">{{ts.trPK('confirmAddEit','start')}}</ion-button>
</div>
</ion-footer>

@ -28,4 +28,246 @@ ion-card-content.confirm-details{
}
.confirm-details label{
font-size: 13px;
}
}
/****************** NEW Design ***************************************/
.footer-button {
border-radius: 2px;
padding: 0 1.1em;
min-height: 45px;
min-width: 200px;
}
.Header {
font-weight: bold;
color: #1a586d !important;
font-size: 10px;
}
.tbData {
font-size: 10px;
}
.btnBack {
background: transparent;
float: right;
}
.attachmentDiv{
background: #ffffff;
height: auto;
text-align: center;
padding-top: 1px;
margin: 10px;
border-radius: 15px;
border: 1px solid grey;
}
.noDataDiv{
background: #ffffff;
height: 11%;
text-align: center;
padding-top: 1px;
border-radius: 10px;
margin: 10px;
border-radius: 5px;
}
.submitNote{
background: #ffffff;
height: 80px;
padding-top: 1px;
margin: 10px;
border-radius: 15px;
border: 1px solid grey;
}
.approvalList{
background: #ffffff;
height: auto;
text-align: center;
padding-top: 1px;
border-radius: 10px;
margin: 10px;
border-radius: 5px;
}
/************************New Design**********************************/
.notification-list{
background: none;
background: none;
border-radius: 32px;
ion-item{
// margin-top: 5px;
// margin-bottom: 5px;
background-color: transparent;
.item-date{
width: 100%;
font-size: 16px;
font-weight: bold;
text-align: start;
padding: 0;
margin: 0;
position: absolute;
left: 0;
top: 12%;
}
ion-label , [item-end]{
white-space: normal;
font-size: 14px;
padding-top: 15%;
// :root[dir="ltr"]{
// margin-left: 10px;
// }
// :root[dir="rtl"]{
// margin-right: 10px;
// }
}
}
}
.timeline {
position: relative;
margin: 15px 0 0 0;
// border-bottom: solid 1px var(--cusgray);
}
.timeline:before {
content: '';
position: inherit !important;
top: 0;
bottom: 0;
width: 4px;
// background: #e4e4e4;
z-index: 1;
left: 35px;
/* margin-left: -10px; */
/* z-index: 1; */
}
.timeline .timeline-thumb {
border-radius: 500px;
width: 70px !important;
z-index: 2;
position: absolute;
left: 0px;
// :root[dir="ltr"]{
// left: 37px;
// }
// :root[dir="rtl"]{
// right: 37px;
// }
float: right;
top: 9px;
}
.timeline .timeline-thumb.timeline-icon {
height: 70px;
// text-align: center;
// color: white;
// border: 5px solid #CBD0D3;
// transform: scale(0.2);
}
.timeline .timeline-item {
width: 40px;
}
.timeline .timeline-stats {
position: relative;
font-size: 12px;
color: var(--darkgray);
}
.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;
}
.line{
padding-bottom:87px;
}
.attachLable{
position: absolute;
top: 0px;
z-index: 0;
background: #30b8c6;
color: #fff;
border-radius: 50%;
border: 0px;
width: 24px;
height: 24px;
text-align: center;
font-size: 5px;
}
.removeLable{
top: 0px;
z-index: 0;
background: #d8252d;
color: #fff;
border-radius: 50%;
border: 0px;
width: 20px;
height: 20px;
text-align: center;
font-size: 5px;
}
.note-modal {
// width: 90%;
// height: 50%;
// top: 20%;
// left: 5%;
// right: 5%;
// bottom: 5%;
background: rgba(0, 0, 0, 0.5) !important;
padding: 30% 10% !important;
--height: 12cm !important;
// --width: 80% !important;
--border-radius:20px;
}
.header-toolbar-new{
--background: #22c6b3;
}
.confirmEitOkButton{
white-space: normal !important;
text-transform: capitalize !important;
min-height: 45px !important;
min-width: 5px !important;
margin: 8px !important;
--background: #22c6b3;
width: 80% !important;
color: white!important;
border-radius: 16px !important;
}

@ -13,7 +13,8 @@ import { ConfirmAddEitService } from '../service/confirm-add-eit-service';
import { AbsenceNotificatonBodyResponse } from '../models/AbsenceNotificationBodyRes';
import { AbsenceAttachmentComponent } from '../absence-attachment/absence-attachment.component';
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';
@Component({
selector: "app-absence-confirm",
templateUrl: "./absence-confirm.component.html",
@ -38,6 +39,9 @@ export class AbsenceConfirmComponent implements OnInit {
attachReqObj: WorkListButtonRequest = new WorkListButtonRequest();
private isResubmitAbs: boolean = false;
private isSubmitBtnClicked: boolean;
filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
constructor(
public common: CommonService,
public ts: TranslatorService,
@ -225,6 +229,41 @@ export class AbsenceConfirmComponent implements OnInit {
}
/*****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.onDidDismiss()
.then((data) => {
console.log(data.data);
if (data.data == "cancel" || data.data == undefined) {
return;
} else {
this.startAbApproval();
}
});
return await modal.present();
}
removeFile(objectitem) {
if (this.attachListOver) {
@ -324,4 +363,96 @@ export class AbsenceConfirmComponent implements OnInit {
if (this.P_TransactionID && this.isSubmitBtnClicked == false)
this.cancelAbProcess();
}
/*******************Add attchement Functions*************/
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,
formatDataFunction: async (item) => {
return new Promise((resolve, reject) => {
resolve({
name: item._file.name,
length: item._file.size,
contentType: item._file.type,
date: new Date()
});
});
}
});
onFileSelected(input) {
// this.uploader.onWhenAddingFileFailed = function (item: any, filter: any, options: any){
if (!(this.filterAllowedType.indexOf(input.target.files[0].type) > -1)) {
let msg: string = "";
msg = this.ts.trPK("general", "notSupport");
this.common.presentAlert(msg);
return
} // todo: show alert that you tried uploading wrong files
else {
const file = input.target.files[0];
// console.log(file);
//var encoded = Base64.encode(file);
this.getBase64(file).then(
data => this.pushObject(data, file.name, file.type)
);
// }
// };
}
}
getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
}
pushObject(fileData, name, type) {
console.log("before push: "+ this.index);
//this.attachListOver.length++;
try {
let array = name.split('.');
let attachType: string = array[array.length - 1];
this.attachListOver.push(
{
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
})
} catch (e) {
}
//console.log("after push: "+ this.index);
// return this.addAttachRequest
}
}

@ -20,6 +20,7 @@ import { AbsenceAttachmentComponent } from "./absence-attachment/absence-attachm
import { AddAttachService } from "./service/add-attach-service";
import { WorkListAttachViewComponent } from "src/app/notification/work-list-attach-view/work-list-attach-view.component";
import { ViewAttachmentsComponent } from './view-attachments/view-attachments.component';
import { SubmitAbsenceModalComponent } from './submit-absence-modal/submit-absence-modal.component';
const routes: Routes = [
{
path: "",
@ -52,6 +53,10 @@ const routes: Routes = [
{
path:'view-attachements',
component:ViewAttachmentsComponent
},
{
path:'absence-submit-modal',
component:SubmitAbsenceModalComponent
}
]
}
@ -81,7 +86,8 @@ const routes: Routes = [
SubmitAbsenceComponent,
AbsenceConfirmComponent,
AbsenceAttachmentComponent,
ViewAttachmentsComponent
ViewAttachmentsComponent,
SubmitAbsenceModalComponent
]
})
export class AbsencePageModule {}

@ -0,0 +1,39 @@
<ion-content padding>
<!--
<ion-col col-1
style="margin-right: -22px;margin-top: -10px;">
<ion-button class="closeIcon" (click)="closeModal()">
<img src="../assets/imgs/close.png">
</ion-button>
</ion-col> -->
<h2><div class="Header">Confirmation</div></h2>
<div>
<div *ngIf="submitAbsAttachmentList.length==0" class="labelcheck" lines="none" style="text-align: center;">
No Attachment
</div>
<div *ngIf="absComments==''" class="labelcheck" style="text-align: center;margin-bottom: 5px;padding-bottom: 16px;">
No Note
</div>
</div>
<ion-footer style="border-top: 1px solid grey !important;">
<ion-row class="rowBtn">
<ion-label class="labelRadio">Are you sure you want to submit</ion-label>
<ion-button class="submitOkButton" (click)="OkBtnModal()"> {{ts.trPK('general','ok')}}
</ion-button>
</ion-row>
<ion-row class="rowBtn">
<ion-button class="submitCancelButton" (click)="closeModal()"> {{ts.trPK('general','cancel')}}
</ion-button>
</ion-row>
</ion-footer>
</ion-content>

@ -0,0 +1,53 @@
.rowBtn{
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.Header{
color: black !important;
font-size: 25px !important;
font-weight: bold !important;;
margin: 0;
text-align: center;
margin-bottom: 20px;
}
.labelRadio{
color: black !important;
font-weight: bold !important;
padding-bottom: 20px;
}
.labelcheck{
color: red !important;
font-weight: bold !important;
margin-bottom: 10px;
}
.submitOkButton{
white-space: normal !important;
text-transform: capitalize !important;
min-height: 45px !important;
min-width: 5px !important;
margin: 8px !important;
--background:: #22c6b3;
width: 100% !important;
color: white!important;
border-radius: 16px !important;
}
.submitCancelButton{
white-space: normal !important;
text-transform: capitalize !important;
min-height: 45px !important;
min-width: 5px !important;
margin: 8px !important;
--background:: #094875;
width: 100% !important;
color: white!important;
border-radius: 16px !important;
}

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SubmitAbsenceModalComponent } from './submit-absence-modal.component';
describe('SubmitAbsenceModalComponent', () => {
let component: SubmitAbsenceModalComponent;
let fixture: ComponentFixture<SubmitAbsenceModalComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SubmitAbsenceModalComponent ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SubmitAbsenceModalComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,36 @@
import { Component, OnInit } from '@angular/core';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { ModalController } from '@ionic/angular';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
@Component({
selector: 'app-submit-absence-modal',
templateUrl: './submit-absence-modal.component.html',
styleUrls: ['./submit-absence-modal.component.scss'],
})
export class SubmitAbsenceModalComponent implements OnInit {
submitAbsAttachmentList :any =[];
absComments: string;
constructor( private ts: TranslatorService,private modalCtrl: ModalController, private cs: CommonService){
this.submitAbsAttachmentList = this.cs.sharedService.getSharedData('submitAbsAttachmentList', false);
this.absComments = this.cs.sharedService.getSharedData('absComments', false);
}
ngOnInit() {
console.log("modal");
//this.actionBtns = this.cs.sharedService.getSharedData("passActionMore" , false);
console.log("modal");
}
closeModal() {
this.modalCtrl.dismiss();
}
OkBtnModal() {
let data = "ok";
this.modalCtrl.dismiss(data);
}
}
Loading…
Cancel
Save