fixed qa issues

MOHEMM-SFH-COLORS
umasoodch 4 years ago
parent 1aafd62e4a
commit 2833749d2f

@ -34,8 +34,8 @@
border-bottom: var(--cusgray) solid 1px; border-bottom: var(--cusgray) solid 1px;
border-radius: 0px; border-radius: 0px;
// margin-left: 20px; // margin-left: 20px;
margin-left: 34px; margin-left: 30px;
margin-top: -10px; // margin-top: -10px;
// -webkit-appearance: none; // -webkit-appearance: none;
// -moz-appearance: none; // -moz-appearance: none;
text-indent: 1px; text-indent: 1px;

@ -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() { fakeSwipeAttendance() {
const request: any = {}; const request: any = {};
request.Latitude = this.lat; request.Latitude = this.lat;
@ -176,42 +153,76 @@ export class AttendScanService {
}); });
} }
public updateFirebaseDocument(resultObject: any) { public async checkFirestoreDocument(userID : string) {
let currentFirebaseDocument = this.common.sharedService.getSharedData('firebase-document'); try {
let currentSwipeArray = currentFirebaseDocument.document.swipeData; let result = {};
currentSwipeArray.push(resultObject); await this.firebasex.fetchDocumentInFirestoreCollection(userID, this.collection, (document: any) => {
const updatedDocument = { console.log("Successfully Fetched the document with id =");
swipeData: currentSwipeArray result = {
}; isDocumentAvailable: true,
console.log(updatedDocument); document: document
this.firebasex.updateDocumentInFirestoreCollection(this.userData.EMPLOYEE_NUMBER, updatedDocument, this.collection, () => { };
console.log("Successfully added document with id=" + this.userData.EMPLOYEE_NUMBER); this.common.sharedService.setSharedData(result, 'firebase-document');
}, (error) => { this.common.stopLoading();
console.error("Error adding document: " + error); }, (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) { public updateFirebaseDocument(resultObject: any) {
console.log(mode); try {
console.log(result); let currentFirebaseDocument = this.common.sharedService.getSharedData('firebase-document');
console.log(isDocumentAvailable); let currentSwipeArray = currentFirebaseDocument.document.swipeData;
this.userData = this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false); currentSwipeArray.push(resultObject);
console.log(this.userData); const updatedDocument = {
const resultObject = { swipeData: currentSwipeArray
modeOfAttendance: mode, };
messageStatus: result.MessageStatus, console.log(updatedDocument);
transactionID: result.SWP_AuthenticateAndSwipeUserModel.TransactionID, this.firebasex.updateDocumentInFirestoreCollection(this.userData.EMPLOYEE_NUMBER, updatedDocument, this.collection, () => {
userID: result.SWP_AuthenticateAndSwipeUserModel.UserID, console.log("Successfully added document with id=" + this.userData.EMPLOYEE_NUMBER);
pointID: result.SWP_AuthenticateAndSwipeUserModel.PointID, }, (error) => {
branchDescription: result.SWP_AuthenticateAndSwipeUserModel.BranchDescription console.error("Error adding document: " + error);
} });
if (isDocumentAvailable) { } catch (error) {
this.updateFirebaseDocument(resultObject); console.log(error);
} else {
this.createNewDocument(resultObject);
} }
} }
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) { public createNewDocument(resultObject: any) {
let swipeData = []; let swipeData = [];
swipeData.push(resultObject); swipeData.push(resultObject);

@ -28,7 +28,7 @@ export class ConnectorService {
public static timeOut = 120 * 1000; public static timeOut = 120 * 1000;
public static host = 'https://uat.hmgwebservices.com/'; public static host = 'https://uat.hmgwebservices.com/';
//public static host = 'https://hmgwebservices.com/'; // public static host = 'https://hmgwebservices.com/';
constructor(public httpClient: HttpClient, constructor(public httpClient: HttpClient,
public cs: CommonService, public cs: CommonService,

@ -66,16 +66,16 @@
<span class="btnTitle">{{ts.trPK('myTeam','profile-details')}}</span> <span class="btnTitle">{{ts.trPK('myTeam','profile-details')}}</span>
</ion-col> </ion-col>
</ion-col> </ion-col>
<ion-col [size]="3"> <ion-col [size]="3" (click)="getMenuEntries(employee)">
<ion-col> <ion-col>
<ion-segment-button <ion-segment-button
value="create-request" value="create-request"
[ngClass]="activeSegment == 'create-request' ? 'active-Segment' : 'normal-Segment'"> [ngClass]="activeSegment == 'create-request' ? 'active-Segment' : 'normal-Segment'">
<img (click)="getMenuEntries(employee)" class="imgSize" src="../assets/imgs/create-req.svg"> <img class="imgSize" src="../assets/imgs/create-req.svg">
<!-- <ion-label> {{ts.trPK('vacation-rule','create-request')}}</ion-label> --> <!-- <ion-label> {{ts.trPK('vacation-rule','create-request')}}</ion-label> -->
</ion-segment-button> </ion-segment-button>
</ion-col> </ion-col>
<ion-col (click)="getMenuEntries(employee)"> <span class="btnTitle">{{ts.trPK('vacation-rule','create-request')}}</span></ion-col> <ion-col > <span class="btnTitle">{{ts.trPK('vacation-rule','create-request')}}</span></ion-col>
</ion-col> </ion-col>
<ion-col [size]="3"> <ion-col [size]="3">
<ion-col> <ion-col>

Loading…
Cancel
Save