@7365admin1/layer-common 1.10.7 → 1.10.9
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/CHANGELOG.md +12 -0
- package/components/AccessCardAddForm.vue +1 -1
- package/components/AccessCardAssignToUnitForm.vue +1 -1
- package/components/AccessManagement.vue +1 -1
- package/components/{AddSupplyForm.vue → AddEqupmentForm.vue} +5 -5
- package/components/BuildingManagement/units.vue +2 -2
- package/components/BuildingUnitFormAdd.vue +4 -4
- package/components/BuildingUnitFormEdit.vue +114 -68
- package/components/Carousel.vue +474 -0
- package/components/DrawImage.vue +172 -0
- package/components/EntryPassInformation.vue +283 -29
- package/components/{CheckoutItemMain.vue → EquipmentItemMain.vue} +95 -87
- package/components/{SupplyManagement.vue → EquipmentManagement.vue} +3 -3
- package/components/Feedback/Form.vue +4 -4
- package/components/FeedbackMain.vue +748 -145
- package/components/FileInput.vue +289 -0
- package/components/Input/DateTimePicker.vue +17 -11
- package/components/ManageChecklistMain.vue +379 -41
- package/components/StockCard.vue +11 -7
- package/components/TableHygiene.vue +42 -452
- package/components/UnitPersonCard.vue +74 -14
- package/components/VisitorForm.vue +193 -52
- package/components/VisitorFormSelection.vue +13 -2
- package/components/VisitorManagement.vue +83 -55
- package/composables/useAccessManagement.ts +41 -18
- package/composables/useCleaningPermission.ts +7 -7
- package/composables/useDashboardData.ts +2 -2
- package/composables/useEquipment.ts +63 -0
- package/composables/{useCheckout.ts → useEquipmentItem.ts} +7 -7
- package/composables/{useCheckoutPermission.ts → useEquipmentItemPermission.ts} +13 -13
- package/composables/{useSupply.ts → useEquipmentManagement.ts} +1 -1
- package/composables/useEquipmentManagementPermission.ts +96 -0
- package/composables/{useSupplyPermission.ts → useEquipmentPermission.ts} +9 -9
- package/composables/useFeedback.ts +53 -21
- package/composables/useLocalAuth.ts +29 -1
- package/composables/useUploadFiles.ts +94 -0
- package/composables/useUtils.ts +152 -53
- package/composables/useVehicle.ts +21 -2
- package/composables/useVisitor.ts +9 -7
- package/composables/useWorkOrder.ts +25 -3
- package/package.json +2 -1
- package/types/building.d.ts +1 -1
- package/types/{checkout-item.d.ts → equipment-item.d.ts} +3 -3
- package/types/{supply.d.ts → equipment.d.ts} +2 -2
- package/types/feedback.d.ts +5 -2
- package/types/people.d.ts +3 -1
- package/types/user.d.ts +1 -0
- package/types/vehicle.d.ts +2 -0
- package/types/visitor.d.ts +2 -1
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<TableMain :headers="headers" :items="items" :loading="getVisitorPending" :page="page" :pages="pages"
|
|
4
4
|
:extension-height="110" :offset="300" :pageRange="pageRange" :canCreate="canAddVisitor"
|
|
5
5
|
@refresh="getVisitorRefresh" @update:page="handleUpdatePage" createLabel="Add Visitor" show-header
|
|
6
|
-
@row-click="handleRowClick" @create="
|
|
6
|
+
@row-click="handleRowClick" @create="handleAddNew">
|
|
7
7
|
<template #extension>
|
|
8
8
|
<v-row no-gutters class="w-100 d-flex flex-column">
|
|
9
9
|
<v-tabs v-model="activeTab" color="primary" :height="40" @update:model-value="toRoute" class="w-100">
|
|
10
|
-
<v-tab v-for="tab in tabOptions" :value="tab.
|
|
10
|
+
<v-tab v-for="tab in tabOptions" :value="tab.value" :key="tab.value" class="text-capitalize">
|
|
11
11
|
{{ tab.name }}
|
|
12
12
|
</v-tab>
|
|
13
13
|
</v-tabs>
|
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
</v-checkbox>
|
|
23
23
|
<InputDateTimePicker v-model:utc="dateFrom" density="compact" hide-details />
|
|
24
24
|
<InputDateTimePicker v-model:utc="dateTo" density="compact" hide-details />
|
|
25
|
-
<v-select v-model="filterTypes" label="Filter by types" item-title="label"
|
|
26
|
-
:items="visitorSelection" density="compact" clearable multiple max-width="200"
|
|
25
|
+
<v-select v-if="activeTab !== 'guests'" v-model="filterTypes" label="Filter by types" item-title="label"
|
|
26
|
+
item-value="value" :items="visitorSelection" density="compact" clearable multiple max-width="200"
|
|
27
|
+
hide-details>
|
|
27
28
|
<template v-slot:selection="{ item, index }">
|
|
28
29
|
<div class="d-flex align-center text-caption text-nowrap">
|
|
29
30
|
<v-chip v-if="index === 0" color="error" :text="filterTypeSelectionLabel()" size="x-small"
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
<v-icon icon="mdi-user" size="15" />
|
|
50
51
|
<span v-if="item.type === 'contractor'" class="text-capitalize">{{
|
|
51
52
|
formatCamelCaseToWords(item.contractorType)
|
|
52
|
-
|
|
53
|
+
}}</span>
|
|
53
54
|
<span v-else class="text-capitalize">{{ formatType(item) }}</span>
|
|
54
55
|
</span>
|
|
55
56
|
<span class="d-flex align-center ga-2">
|
|
@@ -87,33 +88,39 @@
|
|
|
87
88
|
<v-icon icon="mdi-clock-time-four-outline" color="green" size="20" />
|
|
88
89
|
<span class="text-capitalize">{{
|
|
89
90
|
UTCToLocalTIme(item.checkIn) || "-"
|
|
90
|
-
|
|
91
|
+
}}</span>
|
|
91
92
|
</span>
|
|
92
93
|
<span class="d-flex align-center ga-2">
|
|
93
|
-
<v-icon icon="mdi-clock-time-eight-outline" color="red" size="20"
|
|
94
|
+
<v-icon icon="mdi-clock-time-eight-outline" color="red" size="20" />
|
|
94
95
|
<template v-if="item.checkOut">
|
|
95
96
|
<span class="text-capitalize">{{
|
|
96
97
|
UTCToLocalTIme(item.checkOut) || "_"
|
|
97
|
-
|
|
98
|
+
}}</span>
|
|
98
99
|
<span v-if="item?.manualCheckout">
|
|
99
100
|
<TooltipInfo text="Manual Checkout" density="compact" size="x-small" />
|
|
100
101
|
</span>
|
|
101
102
|
</template>
|
|
102
|
-
<span v-else>
|
|
103
|
+
<span v-else-if="!item?.checkOut && item?.status === 'registered'">
|
|
103
104
|
<v-btn size="x-small" class="text-capitalize" color="red" text="Checkout"
|
|
104
105
|
:loading="loading.checkingOut && item?._id === selectedVisitorId" @click.stop="handleCheckout(item._id)"
|
|
105
106
|
v-if="canCheckoutVisitor" />
|
|
106
107
|
</span>
|
|
107
108
|
</span>
|
|
108
109
|
</template>
|
|
110
|
+
|
|
111
|
+
<template v-slot:item.action="{ item }">
|
|
112
|
+
<v-btn v-if="activeTab === 'unregistered' && canAddVisitor" size="small" color="primary" text="Register"
|
|
113
|
+
@click.stop="handleRegistrationUnregisteredVisitor(item)" />
|
|
114
|
+
</template>
|
|
115
|
+
|
|
109
116
|
</TableMain>
|
|
110
117
|
|
|
111
|
-
|
|
112
|
-
<VisitorFormSelection @cancel="dialog.showSelection = false" @select="handleSelectVisitorType" />
|
|
118
|
+
<v-dialog v-model="dialog.showSelection" width="450" persistent>
|
|
119
|
+
<VisitorFormSelection :mode="mode" @cancel="dialog.showSelection = false" @select="handleSelectVisitorType" />
|
|
113
120
|
</v-dialog>
|
|
114
121
|
|
|
115
|
-
<v-dialog v-model="dialog.
|
|
116
|
-
<VisitorForm mode="
|
|
122
|
+
<v-dialog v-model="dialog.showForm" v-if="activeVisitorFormType" width="450" persistent>
|
|
123
|
+
<VisitorForm :mode="mode" :org="orgId" :site="siteId" :visitor-data="selectedVisitorDataObject" :type="activeVisitorFormType" @back="handleClickBack"
|
|
117
124
|
@done="handleVisitorFormDone" @done:more="handleVisitorFormCreateMore" @close:all="handleCloseAll" />
|
|
118
125
|
</v-dialog>
|
|
119
126
|
|
|
@@ -135,7 +142,7 @@
|
|
|
135
142
|
</span>
|
|
136
143
|
|
|
137
144
|
<span v-else-if="selectedVisitorObject[key]" class="d-flex ga-3 align-center"><strong>{{ label
|
|
138
|
-
|
|
145
|
+
}}:</strong>
|
|
139
146
|
{{ formatValues(key, selectedVisitorObject[key]) }}
|
|
140
147
|
<TooltipInfo v-if="key === 'checkOut'" text="Manual Checkout" density="compact" size="x-small" />
|
|
141
148
|
</span>
|
|
@@ -183,14 +190,6 @@ const props = defineProps({
|
|
|
183
190
|
},
|
|
184
191
|
});
|
|
185
192
|
|
|
186
|
-
const headers = [
|
|
187
|
-
{ title: "Name", value: "name" },
|
|
188
|
-
{ title: "Type/Company", value: "type-company" },
|
|
189
|
-
{ title: "Location", value: "location" },
|
|
190
|
-
{ title: "Contact/Vehicle No.", value: "contact-vehicleNumber" },
|
|
191
|
-
{ title: "Check In/Out", value: "checkin-out" },
|
|
192
|
-
];
|
|
193
|
-
|
|
194
193
|
const {
|
|
195
194
|
getVisitors,
|
|
196
195
|
visitorSelection,
|
|
@@ -225,6 +224,7 @@ const dateFrom = ref("");
|
|
|
225
224
|
const dateTo = ref("");
|
|
226
225
|
const filterTypes = ref<TVisitorType[]>([]);
|
|
227
226
|
const displayNotCheckedOut = ref<boolean>(false);
|
|
227
|
+
const mode = ref<"add" | "edit" | "register">("add");
|
|
228
228
|
|
|
229
229
|
const message = ref("");
|
|
230
230
|
const messageColor = ref("");
|
|
@@ -238,16 +238,31 @@ const loading = reactive({
|
|
|
238
238
|
|
|
239
239
|
const dialog = reactive({
|
|
240
240
|
showSelection: false,
|
|
241
|
-
|
|
241
|
+
showForm: false,
|
|
242
242
|
viewVisitor: false,
|
|
243
243
|
deleteConfirmation: false,
|
|
244
244
|
});
|
|
245
245
|
|
|
246
|
+
const headers = computed(() => [
|
|
247
|
+
{ title: "Name", value: "name" },
|
|
248
|
+
{ title: "Type/Company", value: "type-company" },
|
|
249
|
+
{ title: "Location", value: "location" },
|
|
250
|
+
{ title: "Contact/Vehicle No.", value: "contact-vehicleNumber" },
|
|
251
|
+
{ title: "Check In/Out", value: "checkin-out" },
|
|
252
|
+
...(activeTab.value === 'unregistered' ? [{ title: "Action", value: "action" }] : [])
|
|
253
|
+
])
|
|
254
|
+
|
|
255
|
+
|
|
246
256
|
const tabOptions = [
|
|
247
|
-
{ name: "Registered",
|
|
248
|
-
{ name: "Unregistered",
|
|
257
|
+
{ name: "Registered", value: "registered" },
|
|
258
|
+
{ name: "Unregistered", value: "unregistered" },
|
|
259
|
+
{ name: "Guests", value: "guests" },
|
|
249
260
|
];
|
|
250
261
|
|
|
262
|
+
const selectedVisitorDataObject = computed(() => {
|
|
263
|
+
return items.value.find((x: any) => x?._id === selectedVisitorId.value) || {};
|
|
264
|
+
});
|
|
265
|
+
|
|
251
266
|
const formatType = (item: any) =>
|
|
252
267
|
(item.deliveryType ? item.deliveryType + "-" : "") + item.type;
|
|
253
268
|
|
|
@@ -270,8 +285,9 @@ function filterTypeSelectionLabel() {
|
|
|
270
285
|
return `${length} selected ${length === 1 ? "type" : "types"}` as string;
|
|
271
286
|
}
|
|
272
287
|
|
|
273
|
-
function toRoute(
|
|
274
|
-
|
|
288
|
+
function toRoute(tab: any) {
|
|
289
|
+
|
|
290
|
+
const obj = tabOptions.find((x) => x.value === tab);
|
|
275
291
|
if (!obj) return;
|
|
276
292
|
page.value = 1
|
|
277
293
|
navigateTo({
|
|
@@ -279,9 +295,9 @@ function toRoute(status: any) {
|
|
|
279
295
|
params: {
|
|
280
296
|
org: orgId,
|
|
281
297
|
},
|
|
282
|
-
query: {
|
|
283
|
-
|
|
284
|
-
},
|
|
298
|
+
// query: {
|
|
299
|
+
// tab
|
|
300
|
+
// },
|
|
285
301
|
});
|
|
286
302
|
}
|
|
287
303
|
|
|
@@ -296,28 +312,30 @@ const {
|
|
|
296
312
|
// Optional delay (if needed)
|
|
297
313
|
await new Promise(resolve => setTimeout(resolve, 100))
|
|
298
314
|
|
|
299
|
-
|
|
315
|
+
const params: any = {
|
|
300
316
|
page: page.value,
|
|
301
317
|
site: siteId,
|
|
302
318
|
search: searchInput.value,
|
|
303
319
|
dateTo: dateTo.value,
|
|
304
320
|
dateFrom: dateFrom.value,
|
|
305
321
|
type: filterTypes.value.filter(Boolean).join(","),
|
|
306
|
-
status: activeTab.value as string,
|
|
307
322
|
checkedOut: displayNotCheckedOut.value ? false : undefined
|
|
308
|
-
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (activeTab.value !== "guests") {
|
|
326
|
+
params.status = activeTab.value
|
|
327
|
+
} else if (activeTab.value === "guests") {
|
|
328
|
+
params.type = "guest"
|
|
329
|
+
params.status = undefined
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return await getVisitors(params)
|
|
309
333
|
},
|
|
310
334
|
{
|
|
311
335
|
watch: [
|
|
312
336
|
page,
|
|
313
|
-
activeTab,
|
|
314
|
-
searchInput,
|
|
315
|
-
dateFrom,
|
|
316
|
-
dateTo,
|
|
317
|
-
filterTypes,
|
|
318
|
-
displayNotCheckedOut,
|
|
319
|
-
() => route.query
|
|
320
337
|
],
|
|
338
|
+
immediate: false
|
|
321
339
|
}
|
|
322
340
|
)
|
|
323
341
|
|
|
@@ -355,6 +373,12 @@ function formatValues(key: string, value: any) {
|
|
|
355
373
|
return value;
|
|
356
374
|
}
|
|
357
375
|
|
|
376
|
+
function handleAddNew() {
|
|
377
|
+
dialog.showSelection = true;
|
|
378
|
+
activeVisitorFormType.value = null;
|
|
379
|
+
mode.value = "add";
|
|
380
|
+
}
|
|
381
|
+
|
|
358
382
|
function handleRowClick(data: any) {
|
|
359
383
|
selectedVisitorId.value = data?.item?._id;
|
|
360
384
|
dialog.viewVisitor = true;
|
|
@@ -366,25 +390,25 @@ function handleUpdatePage(newPageNum: number) {
|
|
|
366
390
|
|
|
367
391
|
function handleSelectVisitorType(type: TVisitorType) {
|
|
368
392
|
dialog.showSelection = false;
|
|
369
|
-
dialog.
|
|
393
|
+
dialog.showForm = true;
|
|
370
394
|
activeVisitorFormType.value = type;
|
|
371
395
|
}
|
|
372
396
|
|
|
373
397
|
function handleClickBack() {
|
|
374
398
|
dialog.showSelection = true;
|
|
375
|
-
dialog.
|
|
399
|
+
dialog.showForm = false;
|
|
376
400
|
}
|
|
377
401
|
|
|
378
402
|
function handleVisitorFormDone() {
|
|
379
403
|
getVisitorRefresh();
|
|
380
404
|
dialog.showSelection = false;
|
|
381
|
-
dialog.
|
|
405
|
+
dialog.showForm = false;
|
|
382
406
|
}
|
|
383
407
|
|
|
384
408
|
function handleVisitorFormCreateMore() {
|
|
385
409
|
getVisitorRefresh();
|
|
386
410
|
dialog.showSelection = true;
|
|
387
|
-
dialog.
|
|
411
|
+
dialog.showForm = false;
|
|
388
412
|
}
|
|
389
413
|
|
|
390
414
|
function handleDeleteVisitor() {
|
|
@@ -400,14 +424,17 @@ function showMessage(msg: string, color: string) {
|
|
|
400
424
|
|
|
401
425
|
function handleCloseAll() {
|
|
402
426
|
dialog.showSelection = false;
|
|
403
|
-
dialog.
|
|
427
|
+
dialog.showForm = false;
|
|
404
428
|
}
|
|
405
429
|
|
|
406
|
-
function
|
|
407
|
-
|
|
408
|
-
|
|
430
|
+
function handleRegistrationUnregisteredVisitor(item: Partial<TVisitor>) {
|
|
431
|
+
const id = item?._id || null;
|
|
432
|
+
selectedVisitorId.value = id;
|
|
433
|
+
dialog.showSelection = true;
|
|
434
|
+
mode.value = "register";
|
|
409
435
|
}
|
|
410
436
|
|
|
437
|
+
|
|
411
438
|
async function handleProceedDeleteVisitor() {
|
|
412
439
|
try {
|
|
413
440
|
loading.deletingVisitor = true;
|
|
@@ -462,7 +489,8 @@ async function handleCheckout(userId: string) {
|
|
|
462
489
|
|
|
463
490
|
|
|
464
491
|
const updateRouteQuery = debounce(
|
|
465
|
-
(search: string, from: string, to: string, types: string[], status, checkedOut) => {
|
|
492
|
+
// (search: string, from: string, to: string, types: string[], status, checkedOut) => {
|
|
493
|
+
({ search, from, to, types, tab, checkedOut }: { search: string, from: string, to: string, types: string[], tab: string, checkedOut: boolean }) => {
|
|
466
494
|
router.replace({
|
|
467
495
|
query: {
|
|
468
496
|
...route.query,
|
|
@@ -470,7 +498,7 @@ const updateRouteQuery = debounce(
|
|
|
470
498
|
dateFrom: from || undefined,
|
|
471
499
|
dateTo: to || undefined,
|
|
472
500
|
type: types.filter(Boolean).join(",") || undefined,
|
|
473
|
-
|
|
501
|
+
tab: tab || undefined,
|
|
474
502
|
...(checkedOut === true ? { checkedOut: "true" } : { checkedOut: undefined })
|
|
475
503
|
},
|
|
476
504
|
});
|
|
@@ -480,9 +508,10 @@ const updateRouteQuery = debounce(
|
|
|
480
508
|
|
|
481
509
|
watch(
|
|
482
510
|
[searchInput, dateFrom, dateTo, filterTypes, activeTab, displayNotCheckedOut],
|
|
483
|
-
([search, from, to, types,
|
|
484
|
-
updateRouteQuery(search, from, to, types, status, checkedOut)
|
|
485
|
-
|
|
511
|
+
([search, from, to, types, tab, checkedOut]) => {
|
|
512
|
+
// updateRouteQuery(search, from, to, types, status, checkedOut)
|
|
513
|
+
updateRouteQuery({ search, from, to, types, tab, checkedOut })
|
|
514
|
+
getVisitorRefresh();
|
|
486
515
|
},
|
|
487
516
|
{ deep: true }
|
|
488
517
|
);
|
|
@@ -490,13 +519,12 @@ watch(
|
|
|
490
519
|
|
|
491
520
|
|
|
492
521
|
onMounted(() => {
|
|
493
|
-
activeTab.value = (route.query.
|
|
522
|
+
activeTab.value = (route.query.tab as string) || "unregistered"
|
|
494
523
|
searchInput.value = (route.query.search as string) || "";
|
|
495
524
|
dateFrom.value = (route.query.dateFrom as string) || "";
|
|
496
525
|
dateTo.value = (route.query.dateTo as string) || "";
|
|
497
526
|
filterTypes.value = ((route.query.type as string)?.split(",") || []).filter(Boolean) as TVisitorType[];
|
|
498
527
|
displayNotCheckedOut.value = (route.query.checkedOut as string) == 'true' || false
|
|
499
|
-
|
|
500
528
|
})
|
|
501
529
|
</script>
|
|
502
530
|
|
|
@@ -55,10 +55,7 @@ export default function useAccessManagement() {
|
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function getAllAccessCardsCounts(params: {
|
|
59
|
-
site: string;
|
|
60
|
-
userType: string;
|
|
61
|
-
}) {
|
|
58
|
+
function getAllAccessCardsCounts(params: { site: string; userType: string }) {
|
|
62
59
|
return useNuxtApp().$api<Record<string, any>>(
|
|
63
60
|
`/api/access-management/all-access-cards-counts`,
|
|
64
61
|
{
|
|
@@ -71,14 +68,16 @@ export default function useAccessManagement() {
|
|
|
71
68
|
);
|
|
72
69
|
}
|
|
73
70
|
|
|
74
|
-
function getUserTypeAccessCards(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
function getUserTypeAccessCards(
|
|
72
|
+
params: {
|
|
73
|
+
page?: number;
|
|
74
|
+
limit?: number;
|
|
75
|
+
search?: string;
|
|
76
|
+
organization?: string;
|
|
77
|
+
userType?: string;
|
|
78
|
+
site?: string;
|
|
79
|
+
} = {}
|
|
80
|
+
) {
|
|
82
81
|
return useNuxtApp().$api<Record<string, any>>(
|
|
83
82
|
`/api/access-management/user-type-access-cards`,
|
|
84
83
|
{
|
|
@@ -200,12 +199,14 @@ export default function useAccessManagement() {
|
|
|
200
199
|
);
|
|
201
200
|
}
|
|
202
201
|
|
|
203
|
-
function getVisitorAccessCards(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
202
|
+
function getVisitorAccessCards(
|
|
203
|
+
params: {
|
|
204
|
+
page?: number;
|
|
205
|
+
limit?: number;
|
|
206
|
+
site?: string;
|
|
207
|
+
search?: string;
|
|
208
|
+
} = {}
|
|
209
|
+
) {
|
|
209
210
|
return useNuxtApp().$api<Record<string, any>>(
|
|
210
211
|
`/api/access-management/visitor-access-cards`,
|
|
211
212
|
{
|
|
@@ -221,6 +222,27 @@ export default function useAccessManagement() {
|
|
|
221
222
|
);
|
|
222
223
|
}
|
|
223
224
|
|
|
225
|
+
function getAvailableContractorCards(params: {
|
|
226
|
+
type: "NFC" | "QRCODE";
|
|
227
|
+
siteId: string;
|
|
228
|
+
unitId: string;
|
|
229
|
+
page?: number;
|
|
230
|
+
limit?: number;
|
|
231
|
+
}) {
|
|
232
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
233
|
+
`/api/access-management/available-card-contractor/${params.type}`,
|
|
234
|
+
{
|
|
235
|
+
method: "GET",
|
|
236
|
+
query: {
|
|
237
|
+
siteId: params.siteId,
|
|
238
|
+
unitId: params.unitId,
|
|
239
|
+
page: params.page ?? 1,
|
|
240
|
+
limit: params.limit ?? 100,
|
|
241
|
+
},
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
224
246
|
return {
|
|
225
247
|
getDoorAccessLevels,
|
|
226
248
|
getLiftAccessLevels,
|
|
@@ -238,5 +260,6 @@ export default function useAccessManagement() {
|
|
|
238
260
|
getVisitorAccessCards,
|
|
239
261
|
saveVisitorAccessCardQrTag,
|
|
240
262
|
getAllVisitorAccessCardsQrTags,
|
|
263
|
+
getAvailableContractorCards,
|
|
241
264
|
};
|
|
242
265
|
}
|
|
@@ -162,27 +162,27 @@ export default function useCleaningPermission() {
|
|
|
162
162
|
description: "Allows the user to check in and check out.",
|
|
163
163
|
},
|
|
164
164
|
},
|
|
165
|
-
//
|
|
165
|
+
// equipment management permissions
|
|
166
166
|
"supply-mgmt": {
|
|
167
167
|
"see-all-supplies": {
|
|
168
168
|
check: true,
|
|
169
|
-
description: "Allows the user to view the list of all
|
|
169
|
+
description: "Allows the user to view the list of all equipments.",
|
|
170
170
|
},
|
|
171
171
|
"add-supply": {
|
|
172
172
|
check: true,
|
|
173
|
-
description: "Allows the user to create/add a new
|
|
173
|
+
description: "Allows the user to create/add a new equipment item.",
|
|
174
174
|
},
|
|
175
175
|
"update-supply": {
|
|
176
176
|
check: true,
|
|
177
|
-
description: "Allows the user to update/edit
|
|
177
|
+
description: "Allows the user to update/edit equipment details.",
|
|
178
178
|
},
|
|
179
179
|
"delete-supply": {
|
|
180
180
|
check: true,
|
|
181
|
-
description: "Allows the user to delete/remove
|
|
181
|
+
description: "Allows the user to delete/remove an equipment item.",
|
|
182
182
|
},
|
|
183
183
|
"add-stock": {
|
|
184
184
|
check: true,
|
|
185
|
-
description: "Allows the user to add stock to
|
|
185
|
+
description: "Allows the user to add stock to equipment items.",
|
|
186
186
|
},
|
|
187
187
|
"view-stock": {
|
|
188
188
|
check: true,
|
|
@@ -190,7 +190,7 @@ export default function useCleaningPermission() {
|
|
|
190
190
|
},
|
|
191
191
|
"checkout-item": {
|
|
192
192
|
check: true,
|
|
193
|
-
description: "Allows the user to checkout
|
|
193
|
+
description: "Allows the user to checkout equipment items.",
|
|
194
194
|
},
|
|
195
195
|
},
|
|
196
196
|
// checkout item management permissions
|
|
@@ -137,7 +137,7 @@ const dashboardDataMap: Record<string, ModuleData> = {
|
|
|
137
137
|
color: '#43A047',
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
|
-
title: '
|
|
140
|
+
title: 'Equipment Management',
|
|
141
141
|
value: 42,
|
|
142
142
|
percentage: 12.5,
|
|
143
143
|
isPositive: true,
|
|
@@ -166,7 +166,7 @@ const dashboardDataMap: Record<string, ModuleData> = {
|
|
|
166
166
|
'Work Orders',
|
|
167
167
|
'Schedule Task Ticket',
|
|
168
168
|
'Attendance',
|
|
169
|
-
'
|
|
169
|
+
'Equipment Management',
|
|
170
170
|
'Checkout Items',
|
|
171
171
|
'Cleaning Schedule - Checklist, Area, Unit',
|
|
172
172
|
],
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export default function useEquipment() {
|
|
2
|
+
function getEquipments({ page = 1, search = "", limit = 10, site = "" } = {}) {
|
|
3
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
4
|
+
`/api/hygiene-supplies/site/${site}`,
|
|
5
|
+
{
|
|
6
|
+
method: "GET",
|
|
7
|
+
query: { page, search, limit, site },
|
|
8
|
+
}
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function getEquipmentById(id: string) {
|
|
13
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
14
|
+
`/api/hygiene-supplies/id/${id}`,
|
|
15
|
+
{
|
|
16
|
+
method: "GET",
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function createEquipment(payload: TEquipmentCreate, site: string) {
|
|
22
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
23
|
+
`/api/hygiene-supplies/site/${site}`,
|
|
24
|
+
{
|
|
25
|
+
method: "POST",
|
|
26
|
+
body: {
|
|
27
|
+
name: payload.name,
|
|
28
|
+
unitOfMeasurement: payload.unitOfMeasurement,
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function updateEquipment(id: string, payload: TEquipmentCreate) {
|
|
35
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
36
|
+
`/api/hygiene-supplies/id/${id}`,
|
|
37
|
+
{
|
|
38
|
+
method: "PATCH",
|
|
39
|
+
body: {
|
|
40
|
+
name: payload.name,
|
|
41
|
+
unitOfMeasurement: payload.unitOfMeasurement,
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function deleteEquipment(id: string) {
|
|
48
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
49
|
+
`/api/hygiene-supplies/id/${id}`,
|
|
50
|
+
{
|
|
51
|
+
method: "DELETE",
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
getEquipments,
|
|
58
|
+
getEquipmentById,
|
|
59
|
+
createEquipment,
|
|
60
|
+
updateEquipment,
|
|
61
|
+
deleteEquipment,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export default function
|
|
2
|
-
function
|
|
1
|
+
export default function useEquipmentItem() {
|
|
2
|
+
function getEquipmentItems({
|
|
3
3
|
page = 1,
|
|
4
4
|
search = "",
|
|
5
5
|
limit = 10,
|
|
@@ -14,7 +14,7 @@ export default function useCheckout() {
|
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
function
|
|
17
|
+
function getEquipmentItemById(id: string) {
|
|
18
18
|
return useNuxtApp().$api<Record<string, any>>(
|
|
19
19
|
`/api/hygiene-checkout-items/id/${id}`,
|
|
20
20
|
{
|
|
@@ -23,7 +23,7 @@ export default function useCheckout() {
|
|
|
23
23
|
);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function
|
|
26
|
+
function equipmentItems(site: string, payload: TEquipmentItemCreate) {
|
|
27
27
|
return useNuxtApp().$api<Record<string, any>>(
|
|
28
28
|
`/api/hygiene-checkout-items/site/${site}/batch`,
|
|
29
29
|
{
|
|
@@ -52,9 +52,9 @@ export default function useCheckout() {
|
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
return {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
getEquipmentItems,
|
|
56
|
+
getEquipmentItemById,
|
|
57
|
+
equipmentItems,
|
|
58
58
|
approveItem,
|
|
59
59
|
disapproveItem,
|
|
60
60
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function useEquipmentItemPermission() {
|
|
2
2
|
const { hasPermission } = usePermission();
|
|
3
3
|
const { permissions } = useCleaningPermission();
|
|
4
4
|
const { userAppRole } = useLocalSetup();
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const canViewAllEquipmentItems = computed(() => {
|
|
7
7
|
if (!userAppRole.value) return true;
|
|
8
8
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
9
9
|
return hasPermission(
|
|
@@ -14,7 +14,7 @@ export function useCheckoutPermission() {
|
|
|
14
14
|
);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const canCreateEquipmentItem = computed(() => {
|
|
18
18
|
if (!userAppRole.value) return true;
|
|
19
19
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
20
20
|
return hasPermission(
|
|
@@ -25,7 +25,7 @@ export function useCheckoutPermission() {
|
|
|
25
25
|
);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const canUpdateEquipmentItem = computed(() => {
|
|
29
29
|
if (!userAppRole.value) return true;
|
|
30
30
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
31
31
|
return hasPermission(
|
|
@@ -36,7 +36,7 @@ export function useCheckoutPermission() {
|
|
|
36
36
|
);
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const canApproveEquipmentItem = computed(() => {
|
|
40
40
|
if (!userAppRole.value) return true;
|
|
41
41
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
42
42
|
return hasPermission(
|
|
@@ -47,7 +47,7 @@ export function useCheckoutPermission() {
|
|
|
47
47
|
);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
const
|
|
50
|
+
const canDisapproveEquipmentItem = computed(() => {
|
|
51
51
|
if (!userAppRole.value) return true;
|
|
52
52
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
53
53
|
return hasPermission(
|
|
@@ -58,7 +58,7 @@ export function useCheckoutPermission() {
|
|
|
58
58
|
);
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
const
|
|
61
|
+
const canViewEquipmentItemDetails = computed(() => {
|
|
62
62
|
if (!userAppRole.value) return true;
|
|
63
63
|
if (userAppRole.value.permissions.includes("*")) return true;
|
|
64
64
|
return hasPermission(
|
|
@@ -70,11 +70,11 @@ export function useCheckoutPermission() {
|
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
return {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
canViewAllEquipmentItems,
|
|
74
|
+
canCreateEquipmentItem,
|
|
75
|
+
canUpdateEquipmentItem,
|
|
76
|
+
canApproveEquipmentItem,
|
|
77
|
+
canDisapproveEquipmentItem,
|
|
78
|
+
canViewEquipmentItemDetails,
|
|
79
79
|
};
|
|
80
80
|
}
|