|
|
|
@ -186,7 +186,7 @@ export class AttendScanService {
|
|
|
|
|
|
|
|
|
|
|
|
public updateFirebaseDocument(resultObject: any) {
|
|
|
|
public updateFirebaseDocument(resultObject: any) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
let currentFirebaseDocument = this.common.sharedService.getSharedData('firebase-document');
|
|
|
|
let currentFirebaseDocument = this.common.sharedService.getSharedData('firebase-document', false);
|
|
|
|
let currentSwipeArray = currentFirebaseDocument.document.swipeData;
|
|
|
|
let currentSwipeArray = currentFirebaseDocument.document.swipeData;
|
|
|
|
if (currentSwipeArray) {
|
|
|
|
if (currentSwipeArray) {
|
|
|
|
currentSwipeArray.push(resultObject);
|
|
|
|
currentSwipeArray.push(resultObject);
|
|
|
|
@ -200,7 +200,12 @@ export class AttendScanService {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
console.log(updatedDocument);
|
|
|
|
console.log(updatedDocument);
|
|
|
|
this.firebasex.updateDocumentInFirestoreCollection(this.userData.EMPLOYEE_NUMBER, updatedDocument, this.collection, () => {
|
|
|
|
this.firebasex.updateDocumentInFirestoreCollection(this.userData.EMPLOYEE_NUMBER, updatedDocument, this.collection, () => {
|
|
|
|
console.log("Successfully added document with id=" + this.userData.EMPLOYEE_NUMBER);
|
|
|
|
console.log("Successfully updated document with id = " + this.userData.EMPLOYEE_NUMBER);
|
|
|
|
|
|
|
|
const result = {
|
|
|
|
|
|
|
|
isDocumentAvailable: true,
|
|
|
|
|
|
|
|
document: updatedDocument
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
this.common.sharedService.setSharedData(result, 'firebase-document');
|
|
|
|
}, (error) => {
|
|
|
|
}, (error) => {
|
|
|
|
console.error("Error adding document: " + error);
|
|
|
|
console.error("Error adding document: " + error);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -247,6 +252,11 @@ export class AttendScanService {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.firebasex.setDocumentInFirestoreCollection(this.userData.EMPLOYEE_NUMBER, newDocument, this.collection, () => {
|
|
|
|
this.firebasex.setDocumentInFirestoreCollection(this.userData.EMPLOYEE_NUMBER, newDocument, this.collection, () => {
|
|
|
|
console.log("Successfully added document");
|
|
|
|
console.log("Successfully added document");
|
|
|
|
|
|
|
|
const result = {
|
|
|
|
|
|
|
|
isDocumentAvailable: true,
|
|
|
|
|
|
|
|
document: newDocument
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
this.common.sharedService.setSharedData(result, 'firebase-document');
|
|
|
|
}, (error) => {
|
|
|
|
}, (error) => {
|
|
|
|
console.error("Error adding document: "+error);
|
|
|
|
console.error("Error adding document: "+error);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|