@7365admin1/layer-common 1.11.9 → 1.11.11

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 1.11.11
4
+
5
+ ### Patch Changes
6
+
7
+ - 9ee7b8c: Update Vehicle Form
8
+
9
+ ## 1.11.10
10
+
11
+ ### Patch Changes
12
+
13
+ - f24ef5d: Update Version Avatar
14
+
3
15
  ## 1.11.9
4
16
 
5
17
  ### Patch Changes
@@ -34,7 +34,7 @@ const props = defineProps({
34
34
  })
35
35
 
36
36
 
37
- const { getNameInitials } = useUtils();
37
+ const { getNameInitials } = useUtils();
38
38
  const { getFileUrl } = useFile();
39
39
 
40
40
  const initials = computed(() => {
@@ -54,7 +54,7 @@
54
54
 
55
55
  <v-col v-if="shouldShowField('nric')" cols="12">
56
56
  <InputLabel class="text-capitalize" title="NRIC" required />
57
- <InputNRICNumber v-model="vehicle.nric" density="comfortable" :rules="[requiredRule]" :disabled="disablePrefilledInputs" />
57
+ <InputNRICNumber v-model="vehicle.nric" density="comfortable" :rules="[requiredRule]" :disabled="disablePrefilledInputs" />
58
58
  </v-col>
59
59
 
60
60
  <v-col v-if="shouldShowField('name')" cols="12">
@@ -62,7 +62,7 @@
62
62
  <v-col cols="12">
63
63
  <InputLabel class="text-capitalize" title="Full Name" required />
64
64
  <v-text-field v-model.trim="vehicle.name" density="comfortable" :rules="[requiredRule]"
65
- :disabled="disablePrefilledInputs" />
65
+ />
66
66
  </v-col>
67
67
  </v-row>
68
68
  </v-col>
@@ -290,6 +290,7 @@ const vehicle = reactive<Omit<ExceptPartial<TVehicle>, 'type'> & { type: TVehicl
290
290
  site: prop.site,
291
291
  org: prop.org,
292
292
  _id: '',
293
+ peopleId: '',
293
294
  });
294
295
 
295
296
  const newPlateNumbers = ref<string[]>(['']);
@@ -516,14 +517,15 @@ async function submit() {
516
517
  }
517
518
 
518
519
 
519
- const { plateNumber, type, category, name, phoneNumber, block, level, unit, nric, remarks, seasonPassType, start, end, site, org } = vehicle
520
+ const { plateNumber, type, category, name, phoneNumber, block, level, unit, nric, remarks, seasonPassType, start, end, site, org, peopleId } = vehicle
520
521
 
521
522
  let payload: Partial<TVehiclePayload> = {
522
523
  plateNumber: newPlateNumbers.value,
523
524
  name,
524
525
  phoneNumber,
525
526
  type: type === 'seasonpass' ? 'whitelist' : type, // season pass will be created as whitelist type in backend with additional seasonPassType field,
526
- nric
527
+ nric,
528
+ peopleId
527
529
  };
528
530
 
529
531
  if (prop.mode === 'add') {
@@ -652,6 +654,7 @@ function selectPeopleRecord(record: TPeople) {
652
654
  vehicle.plates = record.plates || [];
653
655
  disablePrefilledInputs.value = true;
654
656
  showMatchingPeopleDialog.value = false;
657
+ vehicle.peopleId = record._id || '';
655
658
  }
656
659
 
657
660
 
@@ -696,7 +699,7 @@ async function checkPeopleById() {
696
699
  // Lock editable fields while we verify if this NRIC has existing records.
697
700
  disablePrefilledInputs.value = true;
698
701
  try {
699
- const res = await getPeopleByUnit(vehicle.unit) as TPeople[]| null;
702
+ const res = await getPeopleByUnit(vehicle.unit, { status: 'active', type: 'resident,tenant' }) as TPeople[]| null;
700
703
 
701
704
  if (Array.isArray(res) && res.length > 0) {
702
705
  matchingPeople.value = res || []
@@ -736,7 +739,7 @@ const resetVehicleDetails = () => {
736
739
  vehicle.phoneNumber = '';
737
740
  vehicle.plates = [];
738
741
  vehicle.nric = '';
739
- disablePrefilledInputs.value = false;
742
+ vehicle.peopleId = '';
740
743
  }
741
744
 
742
745
 
@@ -254,17 +254,19 @@ export default function useFacilityBookings() {
254
254
  remarks = "",
255
255
  status = "",
256
256
  site = "",
257
+ userType,
257
258
  updatedBy,
258
259
  }: {
259
260
  _ids?: string[];
260
261
  remarks?: string;
261
262
  status?: string;
262
263
  site?: string;
264
+ userType?: string;
263
265
  updatedBy?: string;
264
266
  }) {
265
267
  return useNuxtApp().$api("/api/facilities-booking/update-booking/v1", {
266
268
  method: "POST",
267
- body: { _ids, remarks, status, site, updatedBy },
269
+ body: { _ids, remarks, status, site, userType, updatedBy },
268
270
  });
269
271
  }
270
272
 
@@ -331,16 +331,20 @@ export default function useKey() {
331
331
  }
332
332
 
333
333
  async function getKeyWithSequence(
334
- { site, _id } = {} as {
334
+ { site, _id, userType, updatedBy } = {} as {
335
335
  site?: string;
336
336
  _id?: string;
337
+ userType?: string;
338
+ updatedBy?: string;
337
339
  }
338
340
  ) {
339
341
  const response = useNuxtApp().$api<TKeyLog[]>(keyLogApiUrl, {
340
342
  method: "PUT",
341
- query: {
343
+ body: {
342
344
  site,
343
345
  _id,
346
+ userType,
347
+ updatedBy,
344
348
  },
345
349
  });
346
350
  keyList.value = response;
@@ -228,12 +228,16 @@ export default function usePassKey() {
228
228
  site = "",
229
229
  quantity = 0,
230
230
  nextNumber = 0,
231
+ userType,
232
+ updatedBy,
231
233
  } = {} as {
232
234
  template?: any | null;
233
235
  passType?: any | null;
234
236
  site?: any;
235
237
  quantity?: number | null;
236
238
  nextNumber: number;
239
+ userType?: string;
240
+ updatedBy?: string;
237
241
  }
238
242
  ) {
239
243
  return useNuxtApp().$api("/api/keys/generate/v1", {
@@ -244,6 +248,8 @@ export default function usePassKey() {
244
248
  site,
245
249
  quantity,
246
250
  nextNumber,
251
+ userType,
252
+ updatedBy,
247
253
  },
248
254
  });
249
255
  }
@@ -168,9 +168,25 @@ export default function useRedDot() {
168
168
  );
169
169
  }
170
170
 
171
- /**
172
- * COMPLEX BUSINESS LOGIC FROM BE IS HERE:
173
- * **/
171
+ function createRDPAccount(payload: TReddotCreateAccount) {
172
+ return useNuxtApp().$api("/api/payment-gateways/v1", {
173
+ method: "POST",
174
+ body: payload,
175
+ });
176
+ }
177
+
178
+ function getBySiteTypeMethod(
179
+ site: string,
180
+ paymentType: string,
181
+ paymentMethod: string,
182
+ userType: string
183
+ ) {
184
+ const payload = { site, paymentType, paymentMethod, userType };
185
+ return useNuxtApp().$api("/api/payment-gateways/get/v1", {
186
+ method: "POST",
187
+ body: payload,
188
+ });
189
+ }
174
190
 
175
191
  return {
176
192
  item,
@@ -187,5 +203,7 @@ export default function useRedDot() {
187
203
  getMerchantDetailsById,
188
204
  getCartById,
189
205
  cancelCart,
206
+ createRDPAccount,
207
+ getBySiteTypeMethod,
190
208
  };
191
209
  }
@@ -94,7 +94,7 @@ export default function () {
94
94
  `/api/people/unit/${_id}`,
95
95
  {
96
96
  method: "GET",
97
- query: { status },
97
+ query: { status, type },
98
98
  }
99
99
  );
100
100
  }
@@ -7,6 +7,7 @@ export default function useTemplateReusable() {
7
7
  updatedBy?: string;
8
8
  site: string;
9
9
  status?: string;
10
+ userType?: string;
10
11
  A4Enabled?: boolean;
11
12
  A4Orientation?: string;
12
13
  A4FrontWysiwyg?: string;
@@ -55,6 +56,7 @@ export default function useTemplateReusable() {
55
56
  updatedBy,
56
57
  site,
57
58
  status = "",
59
+ userType,
58
60
  A4Enabled = false,
59
61
  A4Orientation = "portrait",
60
62
  A4FrontWysiwyg = "",
@@ -93,7 +95,7 @@ export default function useTemplateReusable() {
93
95
  CCBackQREnabled = false,
94
96
  CCFrontQREnabled = false,
95
97
  // prefixKey = "",
96
- } = {} as TQrCodeTemplate,
98
+ } = {} as TQrCodeTemplate
97
99
  ) {
98
100
  this._id = _id;
99
101
  this.name = name;
@@ -102,6 +104,7 @@ export default function useTemplateReusable() {
102
104
  this.updatedBy = updatedBy;
103
105
  this.site = site;
104
106
  this.status = status;
107
+ this.userType = userType;
105
108
  this.A4Enabled = A4Enabled;
106
109
  this.A4Orientation = A4Orientation;
107
110
  this.A4FrontWysiwyg = A4FrontWysiwyg;
@@ -145,11 +148,11 @@ export default function useTemplateReusable() {
145
148
  const tab = useState("templatesTab", () => "active");
146
149
  const templateQrCode = useState(
147
150
  "templateQrCode",
148
- () => new MQrCodeTemplate(),
151
+ () => new MQrCodeTemplate()
149
152
  );
150
153
  const templateQrCodes = useState(
151
154
  "templateQrCodes",
152
- (): TQrCodeTemplate[] => [],
155
+ (): TQrCodeTemplate[] => []
153
156
  );
154
157
  const page = useState("templatesPage", () => 1);
155
158
  const pages = useState("templatesPages", () => 0);
@@ -166,7 +169,7 @@ export default function useTemplateReusable() {
166
169
  templateQrCode.value = data || new MQrCodeTemplate();
167
170
  }
168
171
 
169
- function setTemplates(
172
+ function setTemplates(
170
173
  {
171
174
  _id,
172
175
  sites,
@@ -181,11 +184,11 @@ export default function useTemplateReusable() {
181
184
  name?: string;
182
185
  statuses?: string[];
183
186
  //date?: any;
184
- },
187
+ }
185
188
  ) {
186
189
  try {
187
190
  isTemplatesLoading.value = true;
188
- const _templateQrCodes: any = getTemplatesByPageSearch({
191
+ const _templateQrCodes: any = getTemplatesByPageSearch({
189
192
  _id,
190
193
  page: page.value,
191
194
  search: search,
@@ -207,7 +210,7 @@ export default function useTemplateReusable() {
207
210
  }
208
211
  }
209
212
 
210
- function getTemplatesByPageSearch({
213
+ function getTemplatesByPageSearch({
211
214
  _id = "",
212
215
  page = 1,
213
216
  search = "",
@@ -215,8 +218,8 @@ export default function useTemplateReusable() {
215
218
  limit = 10,
216
219
  sites = [],
217
220
  statuses = [],
218
- //date = "",
219
- }: {
221
+ }: //date = "",
222
+ {
220
223
  _id?: string;
221
224
  page?: number;
222
225
  search?: string;
@@ -226,44 +229,43 @@ export default function useTemplateReusable() {
226
229
  statuses?: string[];
227
230
  //date?: any;
228
231
  }) {
229
- return useNuxtApp().$api("/api/qr-code-templates/v1", {
230
- method: "PATCH",
231
- body: {
232
- _id,
233
- page,
234
- search,
235
- name,
236
- limit,
237
- sites,
238
- statuses,
239
- },
240
- });
232
+ return useNuxtApp().$api("/api/qr-code-templates/v1", {
233
+ method: "PATCH",
234
+ body: {
235
+ _id,
236
+ page,
237
+ search,
238
+ name,
239
+ limit,
240
+ sites,
241
+ statuses,
242
+ },
243
+ });
241
244
  }
242
245
 
243
246
  type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
244
247
 
245
- function getTemplatesByPageSearchReusable({
248
+ function getTemplatesByPageSearchReusable({
246
249
  dataArgument,
247
250
  method = "GET",
248
251
  }: {
249
252
  dataArgument: any;
250
253
  method?: HttpMethod;
251
254
  }) {
252
- return useNuxtApp().$api("/api/qr-code-templates/v1", {
253
- method,
254
- body: dataArgument,
255
- });
255
+ return useNuxtApp().$api("/api/qr-code-templates/v1", {
256
+ method,
257
+ body: dataArgument,
258
+ });
256
259
  }
257
260
 
258
- function addQrCodeTemplate(templateQrCode: TQrCodeTemplate) {
259
- return useNuxtApp().$api("/api/qr-code-templates/v1", {
260
- method: "POST",
261
- body: new MQrCodeTemplate(templateQrCode),
262
- });
263
-
261
+ function addQrCodeTemplate(templateQrCode: TQrCodeTemplate) {
262
+ return useNuxtApp().$api("/api/qr-code-templates/v1", {
263
+ method: "POST",
264
+ body: JSON.stringify(new MQrCodeTemplate(templateQrCode)),
265
+ });
264
266
  }
265
267
 
266
- function updateTemplateStatus({
268
+ function updateTemplateStatus({
267
269
  _id,
268
270
  site,
269
271
  status,
@@ -272,10 +274,10 @@ export default function useTemplateReusable() {
272
274
  site?: string;
273
275
  status?: string;
274
276
  }) {
275
- return useNuxtApp().$api("/api/qr-code-templates/v1", {
276
- method: "PUT",
277
- body: { _id, site, status },
278
- });
277
+ return useNuxtApp().$api("/api/qr-code-templates/v1", {
278
+ method: "PUT",
279
+ body: { _id, site, status },
280
+ });
279
281
  }
280
282
 
281
283
  function nextPage(
@@ -289,7 +291,7 @@ export default function useTemplateReusable() {
289
291
  search?: string;
290
292
 
291
293
  statuses?: string[];
292
- },
294
+ }
293
295
  ) {
294
296
  page.value++;
295
297
  setTemplates({
@@ -311,7 +313,7 @@ export default function useTemplateReusable() {
311
313
  search?: string;
312
314
 
313
315
  statuses?: string[];
314
- },
316
+ }
315
317
  ) {
316
318
  page.value--;
317
319
  setTemplates({
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.11.9",
5
+ "version": "1.11.11",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "publishConfig": {
@@ -0,0 +1,51 @@
1
+ declare interface TPayment extends IBaseModel {
2
+ orderId: string;
3
+ amount: number;
4
+ googlePayToken: any;
5
+ }
6
+
7
+ declare type TStripeCreateAccount = {
8
+ country: string;
9
+ email: string;
10
+ };
11
+
12
+ declare type TStripeCreateAccountResponse = {
13
+ accountLink: any;
14
+ accountId: string;
15
+ };
16
+
17
+ declare interface TPaymentRequest {
18
+ apiVersion: number;
19
+ apiVersionMinor: number;
20
+ allowedPaymentMethods: [
21
+ {
22
+ type: string;
23
+ parameters: {
24
+ allowedAuthMethods: string[];
25
+ allowedCardNetworks: string[];
26
+ };
27
+ tokenizationSpecification: {
28
+ type: string;
29
+ parameters: {
30
+ gateway: string;
31
+ gatewayMerchantId: string;
32
+ };
33
+ };
34
+ },
35
+ ];
36
+ merchantInfo: {
37
+ merchantId: string;
38
+ merchantName: string;
39
+ };
40
+ transactionInfo: {
41
+ totalPriceStatus: string;
42
+ totalPrice: number;
43
+ currencyCode: string;
44
+ countryCode: string;
45
+ };
46
+ }
47
+
48
+ declare type TReddotCreateAccount = {
49
+ merchant_id: string;
50
+ secret_key: string;
51
+ };
@@ -6,6 +6,7 @@ declare type TQrCodeTemplate = {
6
6
  updatedBy?: string;
7
7
  site: string;
8
8
  status?: string;
9
+ userType?: string;
9
10
  A4Enabled?: boolean;
10
11
  A4Orientation?: string;
11
12
  A4FrontWysiwyg?: string;
@@ -19,6 +19,7 @@ declare type TVehicle = {
19
19
  _id?: string;
20
20
  recNo?: string;
21
21
  status?: TVehicleStatus;
22
+ peopleId?: string; // For linking to a people record, if applicable
22
23
  };
23
24
 
24
25
  declare type TVehicleType = "whitelist" | "blocklist";
@@ -41,4 +42,5 @@ declare type TVehiclePayload = Pick<
41
42
  | "end"
42
43
  | "site"
43
44
  | "org"
45
+ | "peopleId"
44
46
  > & { plateNumber: string[] };