@iservice365/layer-common 1.3.2 → 1.4.0
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 +6 -0
- package/components/Input/InputPhoneNumberV2.vue +10 -1
- package/components/Input/NRICNumber.vue +1 -1
- package/components/VisitorForm.vue +34 -3
- package/components/VisitorManagement.vue +1 -1
- package/composables/useLocal.ts +2 -0
- package/composables/usePeople.ts +8 -1
- package/nuxt.config.ts +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<v-list-item v-bind="itemProps" :title="item.raw.name" :subtitle="item.raw.dial_code" width="300" />
|
|
9
9
|
</template>
|
|
10
10
|
</v-select>
|
|
11
|
-
<v-mask-input v-model="phone" :mask="currentMask" :rules="[...props.rules, validatePhone]"
|
|
11
|
+
<v-mask-input v-model="phone" :mask="currentMask" :rules="[...props.rules, validatePhone]" :loading="loading"
|
|
12
12
|
:variant="variant" hint="Enter a valid phone number" hide-details persistent-hint return-masked-value
|
|
13
13
|
:density="density" :placeholder="placeholder || currentMask"></v-mask-input>
|
|
14
14
|
</v-col>
|
|
@@ -41,6 +41,10 @@ const props = defineProps({
|
|
|
41
41
|
hideDetails: {
|
|
42
42
|
type: Boolean,
|
|
43
43
|
default: false
|
|
44
|
+
},
|
|
45
|
+
loading: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
44
48
|
}
|
|
45
49
|
})
|
|
46
50
|
|
|
@@ -109,6 +113,11 @@ function handleUpdateCountry() {
|
|
|
109
113
|
phone.value = ''
|
|
110
114
|
}
|
|
111
115
|
|
|
116
|
+
const emit = defineEmits(['update:modelValue'])
|
|
117
|
+
|
|
118
|
+
watch(phone, (newVal) => {
|
|
119
|
+
emit('update:modelValue', newVal)
|
|
120
|
+
})
|
|
112
121
|
|
|
113
122
|
|
|
114
123
|
</script>
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
|
|
61
61
|
<v-col v-if="shouldShowField('contact')" cols="12">
|
|
62
62
|
<InputLabel class="text-capitalize" title="Phone Number" required />
|
|
63
|
-
<InputPhoneNumberV2 v-model="visitor.contact" :rules="[requiredRule]" density="comfortable" />
|
|
63
|
+
<InputPhoneNumberV2 v-model="visitor.contact" :rules="[requiredRule]" density="comfortable" :loading="fetchPersonByContactPending" @update:model-value="handleUpdateContact" />
|
|
64
64
|
</v-col>
|
|
65
65
|
|
|
66
66
|
<v-col v-if="shouldShowField('deliveryType')" cols="12">
|
|
@@ -207,7 +207,7 @@ const prop = defineProps({
|
|
|
207
207
|
const { requiredRule, debounce } = useUtils();
|
|
208
208
|
const { getSiteById, getSiteLevels, getSiteUnits } = useSiteSettings();
|
|
209
209
|
const { createVisitor, typeFieldMap, contractorTypes } = useVisitor();
|
|
210
|
-
const { findPersonByNRIC } = usePeople()
|
|
210
|
+
const { findPersonByNRIC, findPersonByContact } = usePeople()
|
|
211
211
|
|
|
212
212
|
const emit = defineEmits([
|
|
213
213
|
"back",
|
|
@@ -307,7 +307,7 @@ const {
|
|
|
307
307
|
data: fetchPersonByNRICReq,
|
|
308
308
|
refresh: fetchPersonByNRICRefresh,
|
|
309
309
|
pending: fetchPersonByNRICPending,
|
|
310
|
-
} = useLazyAsyncData(`fetch-
|
|
310
|
+
} = useLazyAsyncData(`fetch-person`, () =>{
|
|
311
311
|
const NRIC = visitor.nric;
|
|
312
312
|
if(!NRIC) return Promise.resolve(null)
|
|
313
313
|
return findPersonByNRIC(NRIC)
|
|
@@ -329,6 +329,32 @@ watch(fetchPersonByNRICReq, (obj) => {
|
|
|
329
329
|
}
|
|
330
330
|
})
|
|
331
331
|
|
|
332
|
+
const {
|
|
333
|
+
data: fetchPersonByContactReq,
|
|
334
|
+
refresh: fetchPersonByContactRefresh,
|
|
335
|
+
pending: fetchPersonByContactPending,
|
|
336
|
+
} = useLazyAsyncData(`fetch-contact`, () =>{
|
|
337
|
+
const contact = visitor.contact;
|
|
338
|
+
if(!contact) return Promise.resolve(null)
|
|
339
|
+
return findPersonByContact(contact)
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
|
|
343
|
+
watch(fetchPersonByContactReq, (obj) => {
|
|
344
|
+
if(obj){
|
|
345
|
+
companyNames.value = obj.companyName ?? []
|
|
346
|
+
visitor.name = obj.name
|
|
347
|
+
if(!visitor.company){
|
|
348
|
+
visitor.company = companyNames.value?.[0]
|
|
349
|
+
}
|
|
350
|
+
visitor.plateNumber = obj.plateNumber ?? ""
|
|
351
|
+
visitor.block = obj.block ?? ""
|
|
352
|
+
visitor.level = obj.level ?? ""
|
|
353
|
+
visitor.unit = obj.unit ?? ""
|
|
354
|
+
visitor.nric = obj.nric
|
|
355
|
+
}
|
|
356
|
+
})
|
|
357
|
+
|
|
332
358
|
const {
|
|
333
359
|
data: siteData,
|
|
334
360
|
refresh: refreshSiteData,
|
|
@@ -428,11 +454,16 @@ function handleUpdateUnit(value: any) {
|
|
|
428
454
|
}
|
|
429
455
|
|
|
430
456
|
const debounceFetchNRIC = debounce(fetchPersonByNRICRefresh, 500)
|
|
457
|
+
const debounceFetchContact = debounce(fetchPersonByContactRefresh, 500)
|
|
431
458
|
|
|
432
459
|
function handleUpdateNRIC(){
|
|
433
460
|
debounceFetchNRIC()
|
|
434
461
|
}
|
|
435
462
|
|
|
463
|
+
function handleUpdateContact(){
|
|
464
|
+
debounceFetchContact()
|
|
465
|
+
}
|
|
466
|
+
|
|
436
467
|
function backToSelection() {
|
|
437
468
|
emit("back");
|
|
438
469
|
message.value = "";
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
</v-dialog>
|
|
119
119
|
|
|
120
120
|
<v-dialog v-model="dialog.viewVisitor" width="450" persistent>
|
|
121
|
-
<VehicleUpdateMoreAction title="Preview" :can-update="
|
|
121
|
+
<VehicleUpdateMoreAction title="Preview" :can-update="false" :can-delete="canDeleteVisitor"
|
|
122
122
|
@close="dialog.viewVisitor = false" edit-button-label="Edit Visitor" delete-button-label="Delete Visitor"
|
|
123
123
|
@delete="handleDeleteVisitor">
|
|
124
124
|
<template v-slot:content>
|
package/composables/useLocal.ts
CHANGED
|
@@ -45,6 +45,8 @@ export default function useLocal() {
|
|
|
45
45
|
value: "mechanical_electrical_services",
|
|
46
46
|
},
|
|
47
47
|
{ title: "Cleaning Services", value: "cleaning_services" },
|
|
48
|
+
{ title: "Pest Control Services", value: "pest_control_services" },
|
|
49
|
+
{ title: "Landscaping Services", value: "landscaping_services" },
|
|
48
50
|
];
|
|
49
51
|
|
|
50
52
|
const landingPage = useCookie("landing-page", cookieConfig);
|
package/composables/usePeople.ts
CHANGED
|
@@ -25,6 +25,12 @@ export default function(){
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
async function findPersonByContact(contact: string): Promise<null | Partial<TPeople>> {
|
|
29
|
+
return await $fetch<Record<string, any>>(`/api/people/contact/${contact}`, {
|
|
30
|
+
method: "GET",
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
async function create(payload: Partial<TPeoplePayload>){
|
|
29
35
|
return await useNuxtApp().$api<Record<string, any>>("/api/people", {
|
|
30
36
|
method: "POST",
|
|
@@ -51,6 +57,7 @@ export default function(){
|
|
|
51
57
|
getAll,
|
|
52
58
|
updateById,
|
|
53
59
|
deleteById,
|
|
54
|
-
findPersonByNRIC
|
|
60
|
+
findPersonByNRIC,
|
|
61
|
+
findPersonByContact
|
|
55
62
|
}
|
|
56
63
|
}
|
package/nuxt.config.ts
CHANGED
|
@@ -29,6 +29,9 @@ export default defineNuxtConfig({
|
|
|
29
29
|
(process.env.APP_PROPERTY_MANAGEMENT as string) ?? "",
|
|
30
30
|
APP_MECHANICAL_ELECTRICAL:
|
|
31
31
|
(process.env.APP_MECHANICAL_ELECTRICAL as string) ?? "",
|
|
32
|
+
APP_PEST_CONTROL: (process.env.APP_PEST_CONTROL as string) ?? "",
|
|
33
|
+
APP_LANDSCAPING: (process.env.APP_LANDSCAPING as string) ?? "",
|
|
34
|
+
APP_POOL_MAINTENANCE: (process.env.APP_POOL_MAINTENANCE as string) ?? "",
|
|
32
35
|
},
|
|
33
36
|
},
|
|
34
37
|
|