@iservice365/layer-common 1.2.0 → 1.3.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/CHANGELOG.md +21 -0
- package/components/BuildingForm.vue +303 -0
- package/components/BuildingManagement/buildings.vue +395 -0
- package/components/BuildingManagement/units.vue +391 -0
- package/components/BuildingUnitFormAdd.vue +338 -0
- package/components/BuildingUnitFormEdit.vue +278 -0
- package/components/Chat/Information.vue +1 -1
- package/components/Input/DateTimePicker.vue +5 -4
- package/components/Input/FileV2.vue +0 -5
- package/components/Input/InputPhoneNumberV2.vue +0 -1
- package/components/Input/NRICNumber.vue +12 -0
- package/components/Input/VehicleNumber.vue +8 -0
- package/components/PeopleForm.vue +64 -32
- package/components/TableMain.vue +5 -1
- package/components/VisitorForm.vue +114 -279
- package/components/VisitorManagement.vue +95 -174
- package/components/WorkOrder/Create.vue +22 -4
- package/components/WorkOrder/Main.vue +7 -3
- package/composables/useBuilding.ts +1 -1
- package/composables/usePeople.ts +9 -1
- package/composables/useVisitor.ts +74 -50
- package/composables/useWorkOrder.ts +3 -3
- package/package.json +1 -1
- package/types/building.d.ts +2 -0
- package/types/people.d.ts +8 -7
- package/types/visitor.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 1.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 25ae6f4: Building Mgmt - add building mgmt components
|
|
8
|
+
|
|
9
|
+
## 1.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 88b8014: ## What's Changed
|
|
14
|
+
|
|
15
|
+
- 20089 add edit guest feature by @aguirremac17 in https://github.com/Seven365-Pte-Ltd/iservice365-layer-common/pull/156
|
|
16
|
+
- chore: remove deltefile integration in frontend by @aguirremac17 in https://github.com/Seven365-Pte-Ltd/iservice365-layer-common/pull/157
|
|
17
|
+
- Work Order subject form update by @Jerome7365 in https://github.com/Seven365-Pte-Ltd/iservice365-layer-common/pull/158
|
|
18
|
+
- chore: update query key to status by @aguirremac17 in https://github.com/Seven365-Pte-Ltd/iservice365-layer-common/pull/159
|
|
19
|
+
- 20114 update key type to status in visitor management by @aguirremac17 in https://github.com/Seven365-Pte-Ltd/iservice365-layer-common/pull/160
|
|
20
|
+
- Update Work Order Component And Composable by @Jerome7365 in https://github.com/Seven365-Pte-Ltd/iservice365-layer-common/pull/161
|
|
21
|
+
|
|
22
|
+
**Full Changelog**: https://github.com/Seven365-Pte-Ltd/iservice365-layer-common/compare/v1.2.0...1.3.0
|
|
23
|
+
|
|
3
24
|
## 1.2.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-card width="100%">
|
|
3
|
+
<v-toolbar>
|
|
4
|
+
<v-row no-gutters class="fill-height px-6" align="center">
|
|
5
|
+
<span class="font-weight-bold text-h5 text-capitalize">
|
|
6
|
+
{{ prop.mode }} Building
|
|
7
|
+
</span>
|
|
8
|
+
</v-row>
|
|
9
|
+
</v-toolbar>
|
|
10
|
+
<v-card-text style="max-height: 100vh; overflow-y: auto" class="pa-0">
|
|
11
|
+
<v-form v-model="validForm" :disabled="disable">
|
|
12
|
+
<v-row no-gutters class="px-6 pt-4">
|
|
13
|
+
<v-col cols="12" class="mt-2">
|
|
14
|
+
<v-row no-gutters>
|
|
15
|
+
<InputLabel
|
|
16
|
+
class="text-capitalize font-weight-bold"
|
|
17
|
+
title="Name"
|
|
18
|
+
required
|
|
19
|
+
/>
|
|
20
|
+
<v-col cols="12">
|
|
21
|
+
<v-text-field
|
|
22
|
+
v-model="building.name"
|
|
23
|
+
density="comfortable"
|
|
24
|
+
:rules="[requiredRule]"
|
|
25
|
+
></v-text-field>
|
|
26
|
+
</v-col>
|
|
27
|
+
</v-row>
|
|
28
|
+
</v-col>
|
|
29
|
+
|
|
30
|
+
<v-col cols="12">
|
|
31
|
+
<v-row>
|
|
32
|
+
<v-col cols="6" class="mt-2">
|
|
33
|
+
<v-row no-gutters>
|
|
34
|
+
<InputLabel
|
|
35
|
+
class="text-capitalize font-weight-bold"
|
|
36
|
+
title="Block"
|
|
37
|
+
required
|
|
38
|
+
/>
|
|
39
|
+
<v-col cols="12">
|
|
40
|
+
<v-select
|
|
41
|
+
v-model.number="building.block"
|
|
42
|
+
:items="blocks"
|
|
43
|
+
density="comfortable"
|
|
44
|
+
:rules="[
|
|
45
|
+
requiredRule,
|
|
46
|
+
() =>
|
|
47
|
+
(building.block && building.block > 0) ||
|
|
48
|
+
'Block is required',
|
|
49
|
+
]"
|
|
50
|
+
type="number"
|
|
51
|
+
></v-select>
|
|
52
|
+
</v-col>
|
|
53
|
+
</v-row>
|
|
54
|
+
</v-col>
|
|
55
|
+
|
|
56
|
+
<v-col cols="6" class="mt-2">
|
|
57
|
+
<v-row no-gutters>
|
|
58
|
+
<InputLabel
|
|
59
|
+
class="text-capitalize font-weight-bold"
|
|
60
|
+
title="Levels"
|
|
61
|
+
required
|
|
62
|
+
/>
|
|
63
|
+
<v-col cols="12">
|
|
64
|
+
<v-text-field
|
|
65
|
+
v-model.number="buildingLevels"
|
|
66
|
+
density="comfortable"
|
|
67
|
+
:rules="[requiredRule]"
|
|
68
|
+
type="number"
|
|
69
|
+
@update:model-value="setBuildingLevels()"
|
|
70
|
+
></v-text-field>
|
|
71
|
+
</v-col>
|
|
72
|
+
</v-row>
|
|
73
|
+
</v-col>
|
|
74
|
+
</v-row>
|
|
75
|
+
</v-col>
|
|
76
|
+
|
|
77
|
+
<v-col v-if="buildingLevels" cols="12">
|
|
78
|
+
<v-row justify="center">
|
|
79
|
+
<v-col cols="6">
|
|
80
|
+
<v-btn
|
|
81
|
+
block
|
|
82
|
+
color="primary"
|
|
83
|
+
variant="text"
|
|
84
|
+
class="text-none font-weight-bold"
|
|
85
|
+
text="Set level labels"
|
|
86
|
+
@click="show = !show"
|
|
87
|
+
></v-btn>
|
|
88
|
+
</v-col>
|
|
89
|
+
</v-row>
|
|
90
|
+
</v-col>
|
|
91
|
+
</v-row>
|
|
92
|
+
|
|
93
|
+
<v-expand-transition>
|
|
94
|
+
<v-row v-show="show" no-gutters class="px-6">
|
|
95
|
+
<template
|
|
96
|
+
v-for="(level, levelIndex) in building.levels"
|
|
97
|
+
:key="levelIndex"
|
|
98
|
+
>
|
|
99
|
+
<v-col cols="12">
|
|
100
|
+
<v-row no-gutters>
|
|
101
|
+
<InputLabel
|
|
102
|
+
class="text-capitalize font-weight-bold"
|
|
103
|
+
:title="`Level ${levelIndex + 1}`"
|
|
104
|
+
/>
|
|
105
|
+
<v-col cols="12">
|
|
106
|
+
<v-text-field
|
|
107
|
+
v-model.trim="building.levels[levelIndex]"
|
|
108
|
+
density="comfortable"
|
|
109
|
+
></v-text-field>
|
|
110
|
+
</v-col>
|
|
111
|
+
</v-row>
|
|
112
|
+
</v-col>
|
|
113
|
+
</template>
|
|
114
|
+
</v-row>
|
|
115
|
+
</v-expand-transition>
|
|
116
|
+
|
|
117
|
+
<v-col cols="12" class="px-6">
|
|
118
|
+
<InputLabel class="text-capitalize" title="Building Floor plan" />
|
|
119
|
+
<InputFileV2 v-model="building.buildingFloorPlan" :multiple="true" :max-length="10" title="Upload Images" />
|
|
120
|
+
</v-col>
|
|
121
|
+
|
|
122
|
+
<v-col cols="12" class="mt-2">
|
|
123
|
+
<v-checkbox v-model="createMore" density="comfortable" hide-details>
|
|
124
|
+
<template #label>
|
|
125
|
+
<span class="text-subtitle-2 font-weight-bold">
|
|
126
|
+
Create more
|
|
127
|
+
</span>
|
|
128
|
+
</template>
|
|
129
|
+
</v-checkbox>
|
|
130
|
+
</v-col>
|
|
131
|
+
|
|
132
|
+
<v-col cols="12">
|
|
133
|
+
<v-row no-gutters>
|
|
134
|
+
<v-col cols="12" class="text-center">
|
|
135
|
+
<span
|
|
136
|
+
class="text-none text-subtitle-2 font-weight-medium text-error"
|
|
137
|
+
>
|
|
138
|
+
{{ message }}
|
|
139
|
+
</span>
|
|
140
|
+
</v-col>
|
|
141
|
+
</v-row>
|
|
142
|
+
</v-col>
|
|
143
|
+
</v-form>
|
|
144
|
+
</v-card-text>
|
|
145
|
+
|
|
146
|
+
<v-toolbar density="compact">
|
|
147
|
+
<v-row no-gutters>
|
|
148
|
+
<v-col cols="6">
|
|
149
|
+
<v-btn
|
|
150
|
+
tile
|
|
151
|
+
block
|
|
152
|
+
variant="text"
|
|
153
|
+
class="text-none"
|
|
154
|
+
size="48"
|
|
155
|
+
@click="cancel"
|
|
156
|
+
:disabled="disable"
|
|
157
|
+
>
|
|
158
|
+
Cancel
|
|
159
|
+
</v-btn>
|
|
160
|
+
</v-col>
|
|
161
|
+
|
|
162
|
+
<v-col cols="6">
|
|
163
|
+
<v-btn
|
|
164
|
+
tile
|
|
165
|
+
block
|
|
166
|
+
variant="flat"
|
|
167
|
+
color="black"
|
|
168
|
+
class="text-none"
|
|
169
|
+
size="48"
|
|
170
|
+
:disabled="!validForm || disable"
|
|
171
|
+
@click="submit"
|
|
172
|
+
:loading="disable"
|
|
173
|
+
>
|
|
174
|
+
Submit
|
|
175
|
+
</v-btn>
|
|
176
|
+
</v-col>
|
|
177
|
+
</v-row>
|
|
178
|
+
</v-toolbar>
|
|
179
|
+
</v-card>
|
|
180
|
+
</template>
|
|
181
|
+
|
|
182
|
+
<script setup lang="ts">
|
|
183
|
+
const prop = defineProps({
|
|
184
|
+
site: {
|
|
185
|
+
type: String,
|
|
186
|
+
default: "",
|
|
187
|
+
},
|
|
188
|
+
mode: {
|
|
189
|
+
type: String,
|
|
190
|
+
default: "add",
|
|
191
|
+
},
|
|
192
|
+
building: {
|
|
193
|
+
type: Object as PropType<TBuilding>,
|
|
194
|
+
default: () => ({
|
|
195
|
+
site: "",
|
|
196
|
+
name: "",
|
|
197
|
+
block: null,
|
|
198
|
+
levels: [],
|
|
199
|
+
buildingFloorPlan: []
|
|
200
|
+
}),
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
const { getSiteById } = useSite();
|
|
205
|
+
|
|
206
|
+
const site = ref<TSite | null>(null);
|
|
207
|
+
|
|
208
|
+
const { data: getSiteReq } = useLazyAsyncData(
|
|
209
|
+
"get-site-by-id-" + prop.site,
|
|
210
|
+
async () => getSiteById(prop.site)
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
watchEffect(() => {
|
|
214
|
+
if (getSiteReq.value) {
|
|
215
|
+
site.value = getSiteReq.value;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
const blocks = computed(() => {
|
|
220
|
+
if (!site.value) return [];
|
|
221
|
+
return Array.from({ length: site.value?.metadata?.block || 0 }, (_, i) => i + 1);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
const emit = defineEmits(["cancel", "success", "success:create-more"]);
|
|
225
|
+
|
|
226
|
+
const validForm = ref(false);
|
|
227
|
+
|
|
228
|
+
const buildingLevels = ref(0);
|
|
229
|
+
|
|
230
|
+
const show = ref(false);
|
|
231
|
+
|
|
232
|
+
function setBuildingLevels() {
|
|
233
|
+
building.value.levels.length = 0;
|
|
234
|
+
for (let index = 0; index < buildingLevels.value; index++) {
|
|
235
|
+
building.value.levels.push(`Lvl${index + 1}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const building = ref<TBuilding>({
|
|
240
|
+
site: "",
|
|
241
|
+
name: "",
|
|
242
|
+
block: null,
|
|
243
|
+
levels: [],
|
|
244
|
+
buildingFloorPlan: []
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
building.value.site = prop.site;
|
|
248
|
+
if (prop.mode === "edit") {
|
|
249
|
+
building.value = JSON.parse(JSON.stringify(prop.building));
|
|
250
|
+
buildingLevels.value = building.value.levels.length;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const createMore = ref(false);
|
|
254
|
+
const disable = ref(false);
|
|
255
|
+
|
|
256
|
+
const { requiredRule } = useUtils();
|
|
257
|
+
|
|
258
|
+
const message = ref("");
|
|
259
|
+
|
|
260
|
+
const { createBuilding, updateById } = useBuilding();
|
|
261
|
+
|
|
262
|
+
async function submit() {
|
|
263
|
+
disable.value = true;
|
|
264
|
+
|
|
265
|
+
try {
|
|
266
|
+
if (prop.mode === "add") {
|
|
267
|
+
await createBuilding(building.value);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (prop.mode === "edit") {
|
|
271
|
+
await updateById(building.value._id ?? "", {
|
|
272
|
+
name: building.value.name,
|
|
273
|
+
block: building.value.block,
|
|
274
|
+
levels: building.value.levels,
|
|
275
|
+
buildingFloorPlan: building.value.buildingFloorPlan
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (createMore.value) {
|
|
280
|
+
building.value.levels = [];
|
|
281
|
+
building.value.name = "";
|
|
282
|
+
building.value.block = null;
|
|
283
|
+
|
|
284
|
+
message.value = "";
|
|
285
|
+
emit("success:create-more");
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
emit("success");
|
|
290
|
+
} catch (error: any) {
|
|
291
|
+
message.value =
|
|
292
|
+
error.response?._data?.message || "Failed to create building";
|
|
293
|
+
} finally {
|
|
294
|
+
disable.value = false;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function cancel() {
|
|
299
|
+
createMore.value = false;
|
|
300
|
+
message.value = "";
|
|
301
|
+
emit("cancel");
|
|
302
|
+
}
|
|
303
|
+
</script>
|