mobioffice-cli 0.2.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{src/index.ts → lib/index.d.ts} +1 -45
- package/lib/models/Feed-Details-Screen.model.d.ts +6 -0
- package/lib/models/Feed-Details-Screen.model.js +27 -0
- package/lib/models/action.model.d.ts +58 -0
- package/lib/models/action.model.js +315 -0
- package/lib/models/actions/doffing.d.ts +6 -0
- package/lib/models/actions/doffing.js +64 -0
- package/lib/models/actions/folding.d.ts +7 -0
- package/lib/models/actions/folding.js +37 -0
- package/lib/models/attendance.model.d.ts +44 -0
- package/lib/models/attendance.model.js +446 -0
- package/lib/models/cicoPost.model.d.ts +9 -0
- package/lib/models/cicoPost.model.js +19 -0
- package/lib/models/company.model.d.ts +67 -0
- package/lib/models/company.model.js +725 -0
- package/lib/models/contact-us/resquest.model.d.ts +30 -0
- package/lib/models/contact-us/resquest.model.js +73 -0
- package/lib/models/crud/crud.d.ts +7 -0
- package/lib/models/crud/crud.js +27 -0
- package/lib/models/customCollection.model.d.ts +9 -0
- package/lib/models/customCollection.model.js +40 -0
- package/lib/models/customer/customer.model.d.ts +32 -0
- package/lib/models/customer/customer.model.js +62 -0
- package/lib/models/deviceChangeReq.d.ts +10 -0
- package/lib/models/deviceChangeReq.js +138 -0
- package/lib/models/dispatch.model.d.ts +14 -0
- package/lib/models/dispatch.model.js +93 -0
- package/lib/models/feed.models.d.ts +8 -0
- package/lib/models/feed.models.js +97 -0
- package/lib/models/geofence.model.d.ts +7 -0
- package/lib/models/geofence.model.js +61 -0
- package/lib/models/leaveApplicationPost.model.d.ts +12 -0
- package/lib/models/leaveApplicationPost.model.js +72 -0
- package/lib/models/license.model.d.ts +25 -0
- package/lib/models/license.model.js +198 -0
- package/lib/models/log.model.d.ts +6 -0
- package/{src/models/log.model.ts → lib/models/log.model.js} +11 -11
- package/lib/models/meeting.model.d.ts +11 -0
- package/lib/models/meeting.model.js +79 -0
- package/lib/models/meter.model.d.ts +18 -0
- package/lib/models/meter.model.js +54 -0
- package/lib/models/missingPunchPost.model.d.ts +15 -0
- package/lib/models/missingPunchPost.model.js +69 -0
- package/lib/models/offline.model.d.ts +70 -0
- package/lib/models/offline.model.js +831 -0
- package/lib/models/post.model.d.ts +38 -0
- package/lib/models/post.model.js +94 -0
- package/lib/models/printDetailsScreen.model.d.ts +6 -0
- package/lib/models/printDetailsScreen.model.js +27 -0
- package/lib/models/pushNotifications/pushNotification.model.d.ts +4 -0
- package/lib/models/pushNotifications/pushNotification.model.js +17 -0
- package/lib/models/report-actions.model.d.ts +26 -0
- package/lib/models/report-actions.model.js +56 -0
- package/lib/models/report-definition-details.model.d.ts +13 -0
- package/lib/models/report-definition-details.model.js +85 -0
- package/lib/models/report-definition.model.d.ts +23 -0
- package/lib/models/report-definition.model.js +26 -0
- package/lib/models/report-definitions-summary.model.d.ts +8 -0
- package/lib/models/report-definitions-summary.model.js +59 -0
- package/lib/models/report-detail-data.model.d.ts +46 -0
- package/lib/models/report-detail-data.model.js +49 -0
- package/lib/models/report-visibility.model.d.ts +7 -0
- package/lib/models/report-visibility.model.js +42 -0
- package/lib/models/report.model.d.ts +19 -0
- package/lib/models/report.model.js +138 -0
- package/lib/models/reportGenerator.model.d.ts +164 -0
- package/lib/models/reportGenerator.model.js +642 -0
- package/lib/models/response.model.d.ts +18 -0
- package/lib/models/response.model.js +30 -0
- package/lib/models/steps.factory.model.d.ts +172 -0
- package/lib/models/steps.factory.model.js +187 -0
- package/lib/models/storeGupShupLog.model.d.ts +6 -0
- package/lib/models/storeGupShupLog.model.js +51 -0
- package/lib/models/summary.model.d.ts +10 -0
- package/{src/models/summary.model.ts → lib/models/summary.model.js} +28 -27
- package/lib/models/tasks/sub-task-group.model.d.ts +42 -0
- package/lib/models/tasks/sub-task-group.model.js +154 -0
- package/lib/models/tasks/tags.model.d.ts +29 -0
- package/lib/models/tasks/tags.model.js +70 -0
- package/lib/models/tasks/task-group.model.d.ts +53 -0
- package/lib/models/tasks/task-group.model.js +156 -0
- package/lib/models/tasks/task.model.d.ts +163 -0
- package/lib/models/tasks/task.model.js +603 -0
- package/lib/models/tempCollection.model.d.ts +40 -0
- package/{src/models/tempCollection.model.ts → lib/models/tempCollection.model.js} +114 -130
- package/lib/models/user.model.d.ts +42 -0
- package/lib/models/user.model.js +272 -0
- package/lib/models/utility.model.d.ts +13 -0
- package/lib/models/utility.model.js +93 -0
- package/lib/models/visitorManagement/acknowledgement.model.d.ts +9 -0
- package/lib/models/visitorManagement/acknowledgement.model.js +55 -0
- package/lib/models/visitorManagement/invite.model.d.ts +32 -0
- package/lib/models/visitorManagement/invite.model.js +326 -0
- package/lib/models/visitorManagement/newIn.model.d.ts +19 -0
- package/lib/models/visitorManagement/newIn.model.js +67 -0
- package/lib/models/visitorManagement/selfServe.model.d.ts +13 -0
- package/lib/models/visitorManagement/selfServe.model.js +46 -0
- package/lib/models/worklogPost.model.d.ts +6 -0
- package/lib/models/worklogPost.model.js +9 -0
- package/lib/services/customer.d.ts +30 -0
- package/lib/services/customer.js +354 -0
- package/lib/services/meeting.d.ts +19 -0
- package/lib/services/meeting.js +109 -0
- package/package.json +4 -1
- package/.prettierrc +0 -4
- package/a.js +0 -3
- package/scripts/1.ts +0 -1300
- package/scripts/GCloudPubSub/pub-sub-config.json +0 -12
- package/scripts/GCloudPubSub/visitorAutoRejection.ts +0 -86
- package/scripts/actions/assignUsersFromOneActionToOther.ts +0 -64
- package/scripts/actions/assignUsersListToAction.ts +0 -81
- package/scripts/actions/getActionsListOfUser.ts +0 -42
- package/scripts/actions/getCompanyUserDetails.ts +0 -49
- package/scripts/actions/giveActionToUser.ts +0 -41
- package/scripts/actions/giveUsersToActivitySelector.ts +0 -56
- package/scripts/actions/groupActionsInActivitySelector.ts +0 -101
- package/scripts/actions/modifySummaryReportDB.ts +0 -42
- package/scripts/actions/setUrlToActionStep.ts +0 -18
- package/scripts/actions/syncMySqlAttendanceDBWithFirebase.ts +0 -93
- package/scripts/actions/syncMySqlMeetingsDBWithFirebase.ts +0 -103
- package/scripts/actions/test.ts +0 -29
- package/scripts/actions/transferFeedsOldIdToNew.ts +0 -40
- package/scripts/actions/transformUserIntoManager.ts +0 -89
- package/scripts/argvConfig.js +0 -9
- package/scripts/backUpData/testCode.ts +0 -131
- package/scripts/benaraScripts/addWorkAreaMap.ts +0 -46
- package/scripts/benaraScripts/add_customers.ts +0 -26
- package/scripts/benaraScripts/add_customers_contact.ts +0 -27
- package/scripts/benaraScripts/add_empty_work_area.ts +0 -17
- package/scripts/benaraScripts/assignManagers.ts +0 -35
- package/scripts/benaraScripts/changeCheckInFlag.ts +0 -45
- package/scripts/benaraScripts/createCustomerContactsList.ts +0 -170
- package/scripts/benaraScripts/createUserByDeletingOldUser.ts +0 -70
- package/scripts/benaraScripts/createUsersAreaMapCollection.ts +0 -23
- package/scripts/benaraScripts/createWorkAreaMap.ts +0 -24
- package/scripts/benaraScripts/mapWorkAreasToUsers.ts +0 -112
- package/scripts/companies_data.json +0 -2496
- package/scripts/create_or_update_users.ts +0 -31
- package/scripts/csvToJson/csvToJson.ts +0 -90
- package/scripts/csvToJson/users.json +0 -3896
- package/scripts/db.js +0 -27
- package/scripts/db.json +0 -13
- package/scripts/dbMySql.ts +0 -63
- package/scripts/delete_action_steps.ts +0 -11
- package/scripts/delete_user.ts +0 -71
- package/scripts/dev_companies_data.json +0 -613
- package/scripts/enroll.xlsx +0 -0
- package/scripts/export_users.ts +0 -72
- package/scripts/files/visitorManagementFiles/displayScreen.json +0 -70
- package/scripts/files/visitorManagementFiles/init_report_visibility.ts +0 -79
- package/scripts/firebaseConfig.js +0 -12
- package/scripts/firebaseDocs/deleteIncommingCollection.ts +0 -47
- package/scripts/firebaseDocs/updateDoc.ts +0 -43
- package/scripts/getActionDataIntoJSON/getActionData.ts +0 -68
- package/scripts/get_attendance_by_any_date.ts +0 -14
- package/scripts/get_attendance_by_month.ts +0 -12
- package/scripts/get_attendance_monthly_by_team.ts +0 -11
- package/scripts/get_daily_report.ts +0 -10
- package/scripts/get_mangers.ts +0 -13
- package/scripts/grant_user_license.ts +0 -18
- package/scripts/init_CustomCollection.ts +0 -16
- package/scripts/init_action_steps.ts +0 -28
- package/scripts/init_actions.ts +0 -31
- package/scripts/init_company.ts +0 -18
- package/scripts/init_customer_mysql.ts +0 -12
- package/scripts/init_feed.ts +0 -4
- package/scripts/init_feed_details_screen.ts +0 -14
- package/scripts/init_geofence.ts +0 -26
- package/scripts/init_print_details_screen.ts +0 -14
- package/scripts/init_report_actions.ts +0 -24
- package/scripts/init_report_definition_detail.ts +0 -26
- package/scripts/init_report_definition_summary.ts +0 -16
- package/scripts/init_report_visibility.ts +0 -46
- package/scripts/init_user_customcollection.ts +0 -16
- package/scripts/json/action.json +0 -21
- package/scripts/json/company.json +0 -24
- package/scripts/json/report-action.json +0 -13
- package/scripts/json/report-def-deet.json +0 -43
- package/scripts/json/resp.json +0 -784
- package/scripts/json/steps.json +0 -24
- package/scripts/json/test.ts +0 -49
- package/scripts/mysqlConfig.ts +0 -9
- package/scripts/revoke_or_extend_license.ts +0 -14
- package/scripts/stream.js +0 -4
- package/scripts/testing1.ts +0 -35
- package/scripts/update/doc.json +0 -20
- package/scripts/update/getDocByPath.ts +0 -34
- package/scripts/update/updateDocByPath.ts +0 -47
- package/scripts/update/updateUsersOfCompanies.ts +0 -58
- package/scripts/update_actions.ts +0 -19
- package/scripts/update_actions_steps.ts +0 -19
- package/scripts/update_company.ts +0 -19
- package/scripts/update_geofence.ts +0 -20
- package/scripts/update_managers.ts +0 -16
- package/scripts/visitorMgmt/createArea.ts +0 -68
- package/scripts/visitorMgmt/createArea.txt +0 -3
- package/scripts/visitorMgmt/createVisitorPathInstructionDocs.ts +0 -130
- package/scripts/visitorMgmt/createVisitorPathInstructionDocs.txt +0 -18
- package/scripts/visitorMgmt/encryptDateString.ts +0 -71
- package/scripts/visitorMgmt/makeHostsManagersOfEachOther.ts +0 -117
- package/scripts/whatsapp_gupshup/sendMessage.ts +0 -97
- package/src/models/Feed-Details-Screen.model.ts +0 -29
- package/src/models/action.model.ts +0 -355
- package/src/models/actions/doffing.ts +0 -71
- package/src/models/actions/folding.ts +0 -39
- package/src/models/attendance.model.ts +0 -615
- package/src/models/cicoPost.model.ts +0 -20
- package/src/models/company.model.ts +0 -975
- package/src/models/contact-us/resquest.model.ts +0 -87
- package/src/models/crud/crud.ts +0 -30
- package/src/models/customCollection.model.ts +0 -47
- package/src/models/customer/customer.model.ts +0 -85
- package/src/models/deviceChangeReq.ts +0 -150
- package/src/models/dispatch.model.ts +0 -99
- package/src/models/feed.models.ts +0 -104
- package/src/models/geofence.model.ts +0 -61
- package/src/models/leaveApplicationPost.model.ts +0 -79
- package/src/models/license.model.ts +0 -215
- package/src/models/meeting.model.ts +0 -80
- package/src/models/meter.model.ts +0 -62
- package/src/models/missingPunchPost.model.ts +0 -84
- package/src/models/offline.model.ts +0 -1133
- package/src/models/post.model.ts +0 -105
- package/src/models/printDetailsScreen.model.ts +0 -30
- package/src/models/pushNotifications/pushNotification.model.ts +0 -17
- package/src/models/report-actions.model.ts +0 -57
- package/src/models/report-definition-details.model.ts +0 -89
- package/src/models/report-definition.model.ts +0 -26
- package/src/models/report-definitions-summary.model.ts +0 -59
- package/src/models/report-detail-data.model.ts +0 -49
- package/src/models/report-visibility.model.ts +0 -44
- package/src/models/report.model.ts +0 -179
- package/src/models/reportGenerator.model.ts +0 -883
- package/src/models/response.model.ts +0 -31
- package/src/models/steps.factory.model.ts +0 -195
- package/src/models/storeGupShupLog.model.ts +0 -49
- package/src/models/tasks/sub-task-group.model.ts +0 -173
- package/src/models/tasks/tags.model.ts +0 -113
- package/src/models/tasks/task-group.model.ts +0 -172
- package/src/models/tasks/task.model.ts +0 -681
- package/src/models/user.model.ts +0 -319
- package/src/models/utility.model.ts +0 -100
- package/src/models/visitorManagement/acknowledgement.model.ts +0 -71
- package/src/models/visitorManagement/invite.model.ts +0 -406
- package/src/models/visitorManagement/newIn.model.ts +0 -82
- package/src/models/visitorManagement/selfServe.model.ts +0 -58
- package/src/models/worklogPost.model.ts +0 -8
- package/src/services/customer.ts +0 -382
- package/src/services/meeting.ts +0 -123
- package/test/1.ts +0 -13
- package/test/db.js +0 -19
- package/test/firebaseConfig.js +0 -1
- package/tsconfig.json +0 -16
@@ -0,0 +1,326 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.Invitation = void 0;
|
7
|
+
const company_model_1 = require("../company.model");
|
8
|
+
const post_model_1 = require("../post.model");
|
9
|
+
const attendance_model_1 = require("../attendance.model");
|
10
|
+
const crud_1 = __importDefault(require("../crud/crud"));
|
11
|
+
class Invitation extends post_model_1.Post {
|
12
|
+
isProcessed = false;
|
13
|
+
static async setIncomingInfoToInvitation(firestore, invitationInfo, post, nickName) {
|
14
|
+
const userDetails = await company_model_1.Company.getUserDetailsByPhone(firestore, nickName, "+" + invitationInfo.phone);
|
15
|
+
const whomToMeet = userDetails[0].name;
|
16
|
+
post.actionEvent = invitationInfo.extra.actionEvent;
|
17
|
+
post.actionId = invitationInfo.extra.actionId;
|
18
|
+
post.actionName = invitationInfo.extra.actionName;
|
19
|
+
post.actionType = invitationInfo.extra.actionType;
|
20
|
+
post.companyId = invitationInfo.extra.companyId;
|
21
|
+
post.createdAt = invitationInfo.extra.createdAt;
|
22
|
+
post.refId = invitationInfo.extra.extraData.phone;
|
23
|
+
post.description = `${invitationInfo.extra.extraData.visitorName} is going to meet ${whomToMeet} `;
|
24
|
+
post.eventId = invitationInfo.extra.eventId;
|
25
|
+
post.isGeofence = invitationInfo.extra.isGeofence;
|
26
|
+
post.userId = invitationInfo.userId;
|
27
|
+
const newExtraData = await this.modifyExtraDAtaForInvitation(invitationInfo, whomToMeet);
|
28
|
+
post.extraData = newExtraData;
|
29
|
+
post.time = invitationInfo.extra.time;
|
30
|
+
let postOBJ = JSON.parse(JSON.stringify(post));
|
31
|
+
postOBJ["isApproved"] = invitationInfo.isApproved;
|
32
|
+
return postOBJ;
|
33
|
+
}
|
34
|
+
static async modifyExtraDAtaForInvitation(invitationInfo, whomToMeet) {
|
35
|
+
const visitorName = invitationInfo.extra.extraData.visitorName;
|
36
|
+
const personToMeet = whomToMeet;
|
37
|
+
const meetingTimeObj = invitationInfo.extra.extraData.meetingTime;
|
38
|
+
const meetingEpochTime = meetingTimeObj._seconds * 1000 +
|
39
|
+
Math.floor(meetingTimeObj._nanoseconds / 1000000);
|
40
|
+
const visitorPhoneNumber = invitationInfo.extra.extraData.phone;
|
41
|
+
const acknowledgedTime = null;
|
42
|
+
const checkOutTimeOfVisitor = null;
|
43
|
+
const newExtraData = {
|
44
|
+
visitorName,
|
45
|
+
personToMeet,
|
46
|
+
visitorPhoneNumber,
|
47
|
+
status: "Invitation Sent",
|
48
|
+
acknowledgedTime,
|
49
|
+
time: meetingEpochTime,
|
50
|
+
date: invitationInfo.extra.extraData.meetingDate,
|
51
|
+
checkInTimeOfVisitor: null,
|
52
|
+
checkInDateOfVisitor: "---",
|
53
|
+
checkOutTimeOfVisitor,
|
54
|
+
};
|
55
|
+
return newExtraData;
|
56
|
+
}
|
57
|
+
static async uploadEntryToMySql(connection, info) {
|
58
|
+
const crudServicce = new crud_1.default(connection);
|
59
|
+
try {
|
60
|
+
const checkInTime = info.checkInTime ? `'${info.checkInTime}'` : null;
|
61
|
+
const qryString = info.cardColor == null ||
|
62
|
+
info.image == null ||
|
63
|
+
info.idProofType == null ||
|
64
|
+
info.idImage == null
|
65
|
+
? `INSERT INTO visits (visitorName, phoneNo, meetingPerson,
|
66
|
+
checkInTime, companyId, visitId, category, meetingPersonPhone,
|
67
|
+
visitType, scheduledTime, purposeOfVisit, isApproved, cardColor, additionalVisitors, visitorsLeaving, assets, image, idProofType, idImage, refId, inGateKeeperId)
|
68
|
+
VALUES ('${info.visitorName}',
|
69
|
+
'${info.visitorPhone}',
|
70
|
+
'${info.meetingPerson}',
|
71
|
+
${checkInTime},
|
72
|
+
'${info.companyId}',
|
73
|
+
'${info.visitId}',
|
74
|
+
'${info.category}',
|
75
|
+
'${info.meetingPersonPhone}',
|
76
|
+
'${info.visitType}',
|
77
|
+
'${info.scheduledTime}',
|
78
|
+
'${info.purposeOfVisit}',
|
79
|
+
${info.isApproved},
|
80
|
+
'${info.cardColor ?? ""}',
|
81
|
+
${info.additionalVisitors},
|
82
|
+
${info.visitorsLeaving},
|
83
|
+
'${info.assets}',
|
84
|
+
'${info.image}',
|
85
|
+
${info.idProofType},
|
86
|
+
'${info.idImage ?? ""}',
|
87
|
+
'${info.refId ?? ""}',
|
88
|
+
'${info.inGateKeeperId ?? ""}');`
|
89
|
+
: `INSERT INTO visits (visitorName, phoneNo, meetingPerson,
|
90
|
+
checkInTime, companyId, visitId, category, meetingPersonPhone,
|
91
|
+
visitType, scheduledTime, purposeOfVisit, isApproved, cardColor, additionalVisitors, visitorsLeaving, assets, image, idProofType, idImage, refId, inGateKeeperId)
|
92
|
+
VALUES ('${info.visitorName}',
|
93
|
+
'${info.visitorPhone}',
|
94
|
+
'${info.meetingPerson}',
|
95
|
+
${checkInTime},
|
96
|
+
'${info.companyId}',
|
97
|
+
'${info.visitId}',
|
98
|
+
'${info.category}',
|
99
|
+
'${info.meetingPersonPhone}',
|
100
|
+
'${info.visitType}',
|
101
|
+
'${info.scheduledTime}',
|
102
|
+
'${info.purposeOfVisit}',
|
103
|
+
${info.isApproved},
|
104
|
+
'${info.cardColor}',
|
105
|
+
${info.additionalVisitors},
|
106
|
+
${info.visitorsLeaving},
|
107
|
+
'${info.assets}',
|
108
|
+
'${info.image}',
|
109
|
+
'${info.idProofType}',
|
110
|
+
'${info.idImage}',
|
111
|
+
'${info.refId}',
|
112
|
+
'${info.inGateKeeperId}');`;
|
113
|
+
console.log(qryString);
|
114
|
+
await crudServicce.query(qryString);
|
115
|
+
}
|
116
|
+
catch (error) {
|
117
|
+
console.log(error.message);
|
118
|
+
throw new Error(error.message);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
static async updateInvitationEntryOnReception(connection, visitId, redId, inGateKeeperId, checkInTime) {
|
122
|
+
const crudServicce = new crud_1.default(connection);
|
123
|
+
try {
|
124
|
+
const qryString = `UPDATE visits SET checkInTime = '${checkInTime}', refId = '${redId}', inGateKeeperId = '${inGateKeeperId}' WHERE visitId = '${visitId}';`;
|
125
|
+
await crudServicce.query(qryString);
|
126
|
+
}
|
127
|
+
catch (error) {
|
128
|
+
console.log(error.message);
|
129
|
+
throw new Error(error.message);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
static async updateInvitationOnApproval(connection, visitId, isApproved) {
|
133
|
+
const curdService = new crud_1.default(connection);
|
134
|
+
try {
|
135
|
+
const qryString = `UPDATE visits SET isApproved = ${isApproved} WHERE visitId = '${visitId}';`;
|
136
|
+
await curdService.query(qryString);
|
137
|
+
}
|
138
|
+
catch (error) {
|
139
|
+
console.log(error.message);
|
140
|
+
throw new Error(error.message);
|
141
|
+
}
|
142
|
+
}
|
143
|
+
static async updateInvitationWithCardColor(connection, visitId, cardColor) {
|
144
|
+
const crudServicce = new crud_1.default(connection);
|
145
|
+
try {
|
146
|
+
const qryString = cardColor == null
|
147
|
+
? `UPDATE visits SET cardColor = ${cardColor} WHERE visitId = '${visitId}';`
|
148
|
+
: `UPDATE visits SET cardColor = '${cardColor}' WHERE visitId = '${visitId}';`;
|
149
|
+
await crudServicce.query(qryString);
|
150
|
+
}
|
151
|
+
catch (error) {
|
152
|
+
console.log(error.message);
|
153
|
+
throw new Error(error.message);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
static async updateInvitationWithIdProof(connection, visitId, proofType, proofImage) {
|
157
|
+
const crudServicce = new crud_1.default(connection);
|
158
|
+
try {
|
159
|
+
let qryString = `UPDATE visits SET idProofType = `;
|
160
|
+
if (proofType) {
|
161
|
+
qryString += `'${proofType}', idImage = `;
|
162
|
+
}
|
163
|
+
else {
|
164
|
+
qryString += `null, idImage = `;
|
165
|
+
}
|
166
|
+
if (proofImage) {
|
167
|
+
qryString += `'${proofImage}' `;
|
168
|
+
}
|
169
|
+
else {
|
170
|
+
qryString += `null `;
|
171
|
+
}
|
172
|
+
qryString += `where visitId = '${visitId}';`;
|
173
|
+
console.log(qryString);
|
174
|
+
console.log("--------------------------");
|
175
|
+
await crudServicce.query(qryString);
|
176
|
+
}
|
177
|
+
catch (error) {
|
178
|
+
console.log(error.message);
|
179
|
+
throw new Error(error.message);
|
180
|
+
}
|
181
|
+
}
|
182
|
+
static async updateInvitationWithVisitorsLeaving(connection, visitId, outGateKeeperId, visitorsLeaving) {
|
183
|
+
const crudServicce = new crud_1.default(connection);
|
184
|
+
try {
|
185
|
+
const qryString = `UPDATE visits
|
186
|
+
SET visitorsLeaving = '${Number(visitorsLeaving)}', outGateKeeperId = '${outGateKeeperId}'
|
187
|
+
WHERE visitId = '${visitId}';`;
|
188
|
+
await crudServicce.query(qryString);
|
189
|
+
}
|
190
|
+
catch (error) {
|
191
|
+
console.log(error.message);
|
192
|
+
throw new Error(error.message);
|
193
|
+
}
|
194
|
+
}
|
195
|
+
static async updateInvitationWithImage(connection, visitId, imageBase64, additionalVisitors, assets) {
|
196
|
+
const crudServicce = new crud_1.default(connection);
|
197
|
+
try {
|
198
|
+
const qryString = `UPDATE visits
|
199
|
+
SET image = '${imageBase64}', additionalVisitors = '${additionalVisitors}', assets = '${assets}'
|
200
|
+
WHERE visitId = '${visitId}';`;
|
201
|
+
await crudServicce.query(qryString);
|
202
|
+
}
|
203
|
+
catch (error) {
|
204
|
+
console.log(error.message);
|
205
|
+
throw new Error(error.message);
|
206
|
+
}
|
207
|
+
}
|
208
|
+
static async updateInvitationWithApprovedAt(connection, visitId, approvedAt) {
|
209
|
+
const crudServicce = new crud_1.default(connection);
|
210
|
+
try {
|
211
|
+
const qryString = `UPDATE visits SET approvedAt = '${approvedAt}' WHERE visitId = '${visitId}';`;
|
212
|
+
await crudServicce.query(qryString);
|
213
|
+
}
|
214
|
+
catch (error) {
|
215
|
+
console.log(error.message);
|
216
|
+
throw new Error(error.message);
|
217
|
+
}
|
218
|
+
}
|
219
|
+
static async fetchHostMeetingsForTheDay(connection, hostPhone, companyId) {
|
220
|
+
const crudServicce = new crud_1.default(connection);
|
221
|
+
try {
|
222
|
+
let date = await attendance_model_1.Attendance.getCurrentdate();
|
223
|
+
date = date.split("/").reverse().join('-');
|
224
|
+
console.log("current date:", date);
|
225
|
+
const qryString = `SELECT * FROM visits
|
226
|
+
WHERE meetingPersonPhone = '${hostPhone}'
|
227
|
+
AND companyId = '${companyId}'
|
228
|
+
AND isReassigned IS NOT true
|
229
|
+
AND meetingTime IS NULL
|
230
|
+
AND DATE(scheduledTime) = '${date}'`;
|
231
|
+
const meetingsListInfo = await crudServicce.query(qryString);
|
232
|
+
const meetingsList = meetingsListInfo.map((meetingInfo) => {
|
233
|
+
return {
|
234
|
+
id: meetingInfo.id,
|
235
|
+
visitId: meetingInfo.visitId,
|
236
|
+
visitorName: meetingInfo.visitorName,
|
237
|
+
scheduledTime: meetingInfo.scheduledTime,
|
238
|
+
meetingPerson: meetingInfo.meetingPerson,
|
239
|
+
visitType: meetingInfo.visitType
|
240
|
+
};
|
241
|
+
});
|
242
|
+
return meetingsList;
|
243
|
+
}
|
244
|
+
catch (error) {
|
245
|
+
console.log(error.message);
|
246
|
+
throw new Error(error.message);
|
247
|
+
}
|
248
|
+
}
|
249
|
+
static async checkUserIsExist(connection, Phone, companyId) {
|
250
|
+
const currentDateIST = new Date().toLocaleString("en-US", {
|
251
|
+
timeZone: "Asia/Kolkata",
|
252
|
+
year: "numeric",
|
253
|
+
month: "2-digit",
|
254
|
+
day: "2-digit",
|
255
|
+
hour: "2-digit",
|
256
|
+
minute: "2-digit",
|
257
|
+
second: "2-digit",
|
258
|
+
hour12: false,
|
259
|
+
});
|
260
|
+
const [date, time] = currentDateIST.split(", ");
|
261
|
+
const [day, month, year] = date.split("/");
|
262
|
+
const formattedDate = `${year}-${day}-${month} ${time}`;
|
263
|
+
const crudServicce = new crud_1.default(connection);
|
264
|
+
try {
|
265
|
+
const qryString = `SELECT id, companyId, phone, fromTime, toTime, isActive, createdAt FROM gatePassDetails
|
266
|
+
WHERE isActive = true
|
267
|
+
AND companyId = '${companyId}'
|
268
|
+
AND phone = '${Phone}'
|
269
|
+
AND fromTime <= '${formattedDate}'
|
270
|
+
AND toTime >= '${formattedDate}'
|
271
|
+
ORDER BY id DESC
|
272
|
+
LIMIT 1;`;
|
273
|
+
console.log("qryString ====================================> ", qryString);
|
274
|
+
const meetingsListInfo = await crudServicce.query(qryString);
|
275
|
+
return meetingsListInfo;
|
276
|
+
}
|
277
|
+
catch (error) {
|
278
|
+
console.log(error.message);
|
279
|
+
throw new Error(error.message);
|
280
|
+
}
|
281
|
+
}
|
282
|
+
static async createGatePass(connection, companyId, phone, from, to, name, createdBy, faceJpg) {
|
283
|
+
const crudServicce = new crud_1.default(connection);
|
284
|
+
try {
|
285
|
+
const currentDateIST = new Date().toLocaleString("en-US", {
|
286
|
+
timeZone: "Asia/Kolkata",
|
287
|
+
year: "numeric",
|
288
|
+
month: "2-digit",
|
289
|
+
day: "2-digit",
|
290
|
+
hour: "2-digit",
|
291
|
+
minute: "2-digit",
|
292
|
+
second: "2-digit",
|
293
|
+
hour12: false,
|
294
|
+
});
|
295
|
+
const [date, time] = currentDateIST.split(", ");
|
296
|
+
const [day, month, year] = date.split("/");
|
297
|
+
const formattedDate = `${year}-${day}-${month} ${time}`;
|
298
|
+
console.log(formattedDate);
|
299
|
+
const qryString = `INSERT INTO gatePassDetails (companyId, phone, fromTime, toTime, isActive, createdAt, name, createdBy, image)
|
300
|
+
VALUES('${companyId}', '${phone}', '${from}', '${to}', 1, '${formattedDate}', '${name}', '${createdBy}', '${faceJpg}');`;
|
301
|
+
console.log("qryString ====================================> ", qryString);
|
302
|
+
const meetingsListInfo = await crudServicce.query(qryString);
|
303
|
+
return meetingsListInfo;
|
304
|
+
}
|
305
|
+
catch (error) {
|
306
|
+
console.log(error.message);
|
307
|
+
throw new Error(error.message);
|
308
|
+
}
|
309
|
+
}
|
310
|
+
static async updateUserGatePassData(connection, id, to) {
|
311
|
+
const crudServicce = new crud_1.default(connection);
|
312
|
+
try {
|
313
|
+
const qryString = `UPDATE gatePassDetails
|
314
|
+
SET toTime = '${to}'
|
315
|
+
WHERE id = '${id}';`;
|
316
|
+
console.log("qryString ====================================> ", qryString);
|
317
|
+
const meetingsListInfo = await crudServicce.query(qryString);
|
318
|
+
return meetingsListInfo;
|
319
|
+
}
|
320
|
+
catch (error) {
|
321
|
+
console.log(error.message);
|
322
|
+
throw new Error(error.message);
|
323
|
+
}
|
324
|
+
}
|
325
|
+
}
|
326
|
+
exports.Invitation = Invitation;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { Post } from "../post.model";
|
2
|
+
declare class NewIn extends Post {
|
3
|
+
isProcessed: boolean;
|
4
|
+
static setIncomingInfoToNewIn(visitorInfo: any, post: NewIn): Promise<NewIn>;
|
5
|
+
static modifyExtraDataForNewIn(visitorInfo: any): Promise<{
|
6
|
+
visitorName: any;
|
7
|
+
personToMeet: any;
|
8
|
+
visitorPhoneNumber: any;
|
9
|
+
checkInTimeOfVisitor: any;
|
10
|
+
visitorPicture: any;
|
11
|
+
checkInDateOfVisitor: any;
|
12
|
+
status: string;
|
13
|
+
checkOutTimeOfVisitor: null;
|
14
|
+
acknowledgedTime: null;
|
15
|
+
personToMeetId: any;
|
16
|
+
}>;
|
17
|
+
static uploadQRcodeImg(storageRef: any, imgAsBase64: string, actionName: string, createdAt: string): Promise<any>;
|
18
|
+
}
|
19
|
+
export { NewIn };
|
@@ -0,0 +1,67 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.NewIn = void 0;
|
4
|
+
const post_model_1 = require("../post.model");
|
5
|
+
class NewIn extends post_model_1.Post {
|
6
|
+
isProcessed = false;
|
7
|
+
static async setIncomingInfoToNewIn(visitorInfo, post) {
|
8
|
+
post.actionEvent = visitorInfo.extra.actionEvent;
|
9
|
+
post.actionId = visitorInfo.extra.actionId;
|
10
|
+
post.actionName = visitorInfo.extra.actionName;
|
11
|
+
post.actionType = visitorInfo.extra.actionType;
|
12
|
+
post.companyId = visitorInfo.extra.companyId;
|
13
|
+
post.createdAt = visitorInfo.extra.createdAt;
|
14
|
+
post.description = `${visitorInfo.extra.extraData.visitorName} is going to meet ${visitorInfo.extra.extraData.whomToMeet} `;
|
15
|
+
post.eventId = visitorInfo.extra.eventId;
|
16
|
+
post.isGeofence = visitorInfo.extra.isGeofence;
|
17
|
+
post.userId = visitorInfo.userId;
|
18
|
+
const newExtraData = await this.modifyExtraDataForNewIn(visitorInfo);
|
19
|
+
post.extraData = newExtraData;
|
20
|
+
post.seen = visitorInfo.extra.seen;
|
21
|
+
post.stepValues = visitorInfo.extra.stepValues;
|
22
|
+
post.time = visitorInfo.extra.time;
|
23
|
+
return post;
|
24
|
+
}
|
25
|
+
static async modifyExtraDataForNewIn(visitorInfo) {
|
26
|
+
const visitorName = visitorInfo.extra.extraData.visitorName;
|
27
|
+
const personToMeet = visitorInfo.extra.extraData.whomToMeet;
|
28
|
+
const personToMeetId = visitorInfo.extra.extraData.whomToMeetId;
|
29
|
+
const visitorPhoneNumber = visitorInfo.extra.extraData.phone;
|
30
|
+
const checkInTimeOfVisitor = visitorInfo.createdAt;
|
31
|
+
const visitorPicture = visitorInfo.visitorImage;
|
32
|
+
const checkInDateOfVisitor = visitorInfo.date;
|
33
|
+
const status = "In Progress";
|
34
|
+
const checkOutTimeOfVisitor = null;
|
35
|
+
const acknowledgedTime = null;
|
36
|
+
const newExtraData = {
|
37
|
+
visitorName,
|
38
|
+
personToMeet,
|
39
|
+
visitorPhoneNumber,
|
40
|
+
checkInTimeOfVisitor,
|
41
|
+
visitorPicture,
|
42
|
+
checkInDateOfVisitor,
|
43
|
+
status,
|
44
|
+
checkOutTimeOfVisitor,
|
45
|
+
acknowledgedTime,
|
46
|
+
personToMeetId
|
47
|
+
};
|
48
|
+
return newExtraData;
|
49
|
+
}
|
50
|
+
static async uploadQRcodeImg(storageRef, imgAsBase64, actionName, createdAt) {
|
51
|
+
console.log("imgAsBase64");
|
52
|
+
let imageBuffer = Buffer.from(imgAsBase64, "base64");
|
53
|
+
let file = await storageRef.file(`visitorManagement/${actionName}/qrCodes/${createdAt}`);
|
54
|
+
await file.save(imageBuffer, {
|
55
|
+
metadata: { contentType: "image/jpeg" },
|
56
|
+
}, () => {
|
57
|
+
return "Unable to upload the image.";
|
58
|
+
});
|
59
|
+
let options = {
|
60
|
+
action: "read",
|
61
|
+
expires: "03-17-2025",
|
62
|
+
};
|
63
|
+
const url = await file.getSignedUrl(options);
|
64
|
+
return url[0];
|
65
|
+
}
|
66
|
+
}
|
67
|
+
exports.NewIn = NewIn;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Post } from "../post.model";
|
2
|
+
declare class SelfServe extends Post {
|
3
|
+
isProcessed: boolean;
|
4
|
+
static setIncomingInfoToNewIn(visitorInfo: any, post: SelfServe): Promise<SelfServe>;
|
5
|
+
static modifyExtraDataForNewIn(visitorInfo: any): Promise<{
|
6
|
+
visitorName: any;
|
7
|
+
personToMeet: any;
|
8
|
+
vistorPhoneNumber: any;
|
9
|
+
checkInTimeOfVisitor: any;
|
10
|
+
visitorPicture: any;
|
11
|
+
}>;
|
12
|
+
}
|
13
|
+
export { SelfServe };
|
@@ -0,0 +1,46 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SelfServe = void 0;
|
4
|
+
const post_model_1 = require("../post.model");
|
5
|
+
class SelfServe extends post_model_1.Post {
|
6
|
+
isProcessed = false;
|
7
|
+
static async setIncomingInfoToNewIn(visitorInfo, post) {
|
8
|
+
post.actionEvent = visitorInfo.extra.actionEvent;
|
9
|
+
post.actionId = visitorInfo.extra.actionId;
|
10
|
+
post.actionName = visitorInfo.extra.actionName;
|
11
|
+
post.actionType = visitorInfo.extra.actionType;
|
12
|
+
post.companyId = visitorInfo.extra.companyId;
|
13
|
+
post.createdAt = visitorInfo.extra.createdAt;
|
14
|
+
post.description = `${visitorInfo.extra.extraData.visitorName} is going to meet ${visitorInfo.extra.extraData.whomToMeet} `;
|
15
|
+
post.eventId = visitorInfo.extra.eventId;
|
16
|
+
post.isGeofence = visitorInfo.extra.isGeofence;
|
17
|
+
post.userId = visitorInfo.userId;
|
18
|
+
const newExtraData = await this.modifyExtraDataForNewIn(visitorInfo);
|
19
|
+
post.extraData = newExtraData;
|
20
|
+
post.forApproval = visitorInfo.extra.forApproval;
|
21
|
+
post.forApprovalText = visitorInfo.extra.forApprovalText;
|
22
|
+
post.seen = visitorInfo.extra.seen;
|
23
|
+
post.endAt = "";
|
24
|
+
post.endLat = "";
|
25
|
+
post.endLong = "";
|
26
|
+
post.stepValues = visitorInfo.extra.stepValues;
|
27
|
+
post.time = visitorInfo.extra.time;
|
28
|
+
return post;
|
29
|
+
}
|
30
|
+
static async modifyExtraDataForNewIn(visitorInfo) {
|
31
|
+
const visitorName = visitorInfo.extra.extraData.visitorName;
|
32
|
+
const personToMeet = visitorInfo.extra.extraData.whomToMeet;
|
33
|
+
const vistorPhoneNumber = visitorInfo.phone;
|
34
|
+
const checkInTimeOfVisitor = visitorInfo.checkInTime;
|
35
|
+
const visitorPicture = visitorInfo.visitorImage;
|
36
|
+
const newExtraData = {
|
37
|
+
visitorName,
|
38
|
+
personToMeet,
|
39
|
+
vistorPhoneNumber,
|
40
|
+
checkInTimeOfVisitor,
|
41
|
+
visitorPicture
|
42
|
+
};
|
43
|
+
return newExtraData;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
exports.SelfServe = SelfServe;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.WorklogPost = void 0;
|
4
|
+
const post_model_1 = require("./post.model");
|
5
|
+
class WorklogPost extends post_model_1.Post {
|
6
|
+
actionType = "worklog";
|
7
|
+
actionName = "worklog";
|
8
|
+
}
|
9
|
+
exports.WorklogPost = WorklogPost;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import * as admin from "firebase-admin";
|
2
|
+
import { Customer, CustomerContact } from "../models/customer/customer.model";
|
3
|
+
import { HttpResponseAndErrorHandling } from "../models/response.model";
|
4
|
+
import { Pool } from 'mysql2';
|
5
|
+
declare class CustomerServices {
|
6
|
+
static createCustomer(firestore: admin.firestore.Firestore, connection: Pool, arrayUnion: any, customerNUserInfo: any): Promise<HttpResponseAndErrorHandling | {
|
7
|
+
statusCode: number;
|
8
|
+
message: string;
|
9
|
+
data: any;
|
10
|
+
}>;
|
11
|
+
static createCustomerCard(customerInfo: any, userInfo: any): Promise<any>;
|
12
|
+
static createObjForAddingCustomer(extraData: any): Promise<Customer>;
|
13
|
+
static addCustomerContact(firestore: admin.firestore.Firestore, connection: Pool, customerContactNUserInfo: any): Promise<HttpResponseAndErrorHandling>;
|
14
|
+
static saveContactInfoToDB(connection: Pool, contactInfo: any): Promise<void>;
|
15
|
+
static createContactCard(contactInfo: any, userInfo: any): Promise<any>;
|
16
|
+
static createObjForContact(contactInfo: any): Promise<CustomerContact>;
|
17
|
+
static addCustomers(firestore: admin.firestore.Firestore, nickName: string, customerInfo: any): Promise<string | undefined>;
|
18
|
+
static addCustomerContactViaCsv(firestore: admin.firestore.Firestore, nickName: string, customerContactInfo: any): Promise<string>;
|
19
|
+
static addCustomerContactsViaJSON(firestore: admin.firestore.Firestore, nickName: string, customerContactInfo: any): Promise<string>;
|
20
|
+
static deleteCustomerContact(firestore: admin.firestore.Firestore, nickName: string, customerContactInfo: any): Promise<string>;
|
21
|
+
static getCustomer(firestore: admin.firestore.Firestore, connection: Pool, companyId: string, phone: string): Promise<{
|
22
|
+
id: any;
|
23
|
+
label: string;
|
24
|
+
}[]>;
|
25
|
+
static getCustomerContact(firestore: admin.firestore.Firestore, connection: Pool, companyId: string, customerId: string): Promise<unknown>;
|
26
|
+
static insertCustomerDetails(connection: Pool): Promise<any>;
|
27
|
+
static insertCustomerContact(connection: Pool): Promise<any>;
|
28
|
+
static inertUserWorkArea(connection: Pool): Promise<any>;
|
29
|
+
}
|
30
|
+
export { CustomerServices };
|