diff --git a/Mohem/src/app/absence/submit-absence/submit-absence.component.scss b/Mohem/src/app/absence/submit-absence/submit-absence.component.scss index d89d2ed7..94ac7f71 100644 --- a/Mohem/src/app/absence/submit-absence/submit-absence.component.scss +++ b/Mohem/src/app/absence/submit-absence/submit-absence.component.scss @@ -34,8 +34,8 @@ border-bottom: var(--cusgray) solid 1px; border-radius: 0px; // margin-left: 20px; - margin-left: 34px; - margin-top: -10px; + margin-left: 30px; + // margin-top: -10px; // -webkit-appearance: none; // -moz-appearance: none; text-indent: 1px; diff --git a/Mohem/src/app/hmg-common/services/attend-services/attend-scan.service.ts b/Mohem/src/app/hmg-common/services/attend-services/attend-scan.service.ts index 709e415e..9d20ed44 100644 --- a/Mohem/src/app/hmg-common/services/attend-services/attend-scan.service.ts +++ b/Mohem/src/app/hmg-common/services/attend-services/attend-scan.service.ts @@ -136,29 +136,6 @@ export class AttendScanService { }); } - - - public async checkFirestoreDocument(userID : string) { - let result = {}; - await this.firebasex.fetchDocumentInFirestoreCollection(userID, this.collection, (document: any) => { - console.log("Successfully Fetched the document with id ="); - result = { - isDocumentAvailable: true, - document: document - }; - this.common.sharedService.setSharedData(result, 'firebase-document'); - this.common.stopLoading(); - }, (error: any) => { - console.log(error); - result = { - isDocumentAvailable: false, - document: null - }; - this.common.sharedService.setSharedData(result, 'firebase-document'); - this.common.stopLoading(); - }) - } - fakeSwipeAttendance() { const request: any = {}; request.Latitude = this.lat; @@ -176,42 +153,76 @@ export class AttendScanService { }); } - public updateFirebaseDocument(resultObject: any) { - let currentFirebaseDocument = this.common.sharedService.getSharedData('firebase-document'); - let currentSwipeArray = currentFirebaseDocument.document.swipeData; - currentSwipeArray.push(resultObject); - const updatedDocument = { - swipeData: currentSwipeArray - }; - console.log(updatedDocument); - this.firebasex.updateDocumentInFirestoreCollection(this.userData.EMPLOYEE_NUMBER, updatedDocument, this.collection, () => { - console.log("Successfully added document with id=" + this.userData.EMPLOYEE_NUMBER); - }, (error) => { - console.error("Error adding document: " + error); - }); + public async checkFirestoreDocument(userID : string) { + try { + let result = {}; + await this.firebasex.fetchDocumentInFirestoreCollection(userID, this.collection, (document: any) => { + console.log("Successfully Fetched the document with id ="); + result = { + isDocumentAvailable: true, + document: document + }; + this.common.sharedService.setSharedData(result, 'firebase-document'); + this.common.stopLoading(); + }, (error: any) => { + console.log(error); + result = { + isDocumentAvailable: false, + document: null + }; + this.common.sharedService.setSharedData(result, 'firebase-document'); + this.common.stopLoading(); + }) + } catch(error) { + console.log(error); + this.common.stopLoading(); + } } - public processFirebaseDocument(mode: string, result: any, isDocumentAvailable: boolean) { - console.log(mode); - console.log(result); - console.log(isDocumentAvailable); - this.userData = this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false); - console.log(this.userData); - const resultObject = { - modeOfAttendance: mode, - messageStatus: result.MessageStatus, - transactionID: result.SWP_AuthenticateAndSwipeUserModel.TransactionID, - userID: result.SWP_AuthenticateAndSwipeUserModel.UserID, - pointID: result.SWP_AuthenticateAndSwipeUserModel.PointID, - branchDescription: result.SWP_AuthenticateAndSwipeUserModel.BranchDescription - } - if (isDocumentAvailable) { - this.updateFirebaseDocument(resultObject); - } else { - this.createNewDocument(resultObject); + public updateFirebaseDocument(resultObject: any) { + try { + let currentFirebaseDocument = this.common.sharedService.getSharedData('firebase-document'); + let currentSwipeArray = currentFirebaseDocument.document.swipeData; + currentSwipeArray.push(resultObject); + const updatedDocument = { + swipeData: currentSwipeArray + }; + console.log(updatedDocument); + this.firebasex.updateDocumentInFirestoreCollection(this.userData.EMPLOYEE_NUMBER, updatedDocument, this.collection, () => { + console.log("Successfully added document with id=" + this.userData.EMPLOYEE_NUMBER); + }, (error) => { + console.error("Error adding document: " + error); + }); + } catch (error) { + console.log(error); } } + public processFirebaseDocument(mode: string, result: any, isDocumentAvailable: boolean) { + try { + console.log(mode); + console.log(result); + console.log(isDocumentAvailable); + this.userData = this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false); + console.log(this.userData); + const resultObject = { + modeOfAttendance: mode, + messageStatus: result.MessageStatus, + transactionID: result.SWP_AuthenticateAndSwipeUserModel.TransactionID, + userID: result.SWP_AuthenticateAndSwipeUserModel.UserID, + pointID: result.SWP_AuthenticateAndSwipeUserModel.PointID, + branchDescription: result.SWP_AuthenticateAndSwipeUserModel.BranchDescription + } + if (isDocumentAvailable) { + this.updateFirebaseDocument(resultObject); + } else { + this.createNewDocument(resultObject); + } + } catch (error) { + console.log(error); + } + } + public createNewDocument(resultObject: any) { let swipeData = []; swipeData.push(resultObject); diff --git a/Mohem/src/app/hmg-common/services/connector/connector.service.ts b/Mohem/src/app/hmg-common/services/connector/connector.service.ts index 97a29e98..dae990dc 100644 --- a/Mohem/src/app/hmg-common/services/connector/connector.service.ts +++ b/Mohem/src/app/hmg-common/services/connector/connector.service.ts @@ -28,7 +28,7 @@ export class ConnectorService { public static timeOut = 120 * 1000; public static host = 'https://uat.hmgwebservices.com/'; - //public static host = 'https://hmgwebservices.com/'; + // public static host = 'https://hmgwebservices.com/'; constructor(public httpClient: HttpClient, public cs: CommonService, diff --git a/Mohem/src/app/my-team/details/details.component.html b/Mohem/src/app/my-team/details/details.component.html index aade25f1..581748b2 100644 --- a/Mohem/src/app/my-team/details/details.component.html +++ b/Mohem/src/app/my-team/details/details.component.html @@ -66,16 +66,16 @@ {{ts.trPK('myTeam','profile-details')}} - + + - {{ts.trPK('vacation-rule','create-request')}} + {{ts.trPK('vacation-rule','create-request')}}