@iservice365/layer-common 1.3.0 → 1.3.2

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.
@@ -1,19 +1,20 @@
1
- export default function(){
2
-
1
+ export default function () {
3
2
  type TVisitorSelection = {
4
3
  label: string;
5
- value: TVisitorType
6
- }
4
+ value: TVisitorType;
5
+ };
7
6
 
8
7
  const visitorSelection: TVisitorSelection[] =[
8
+ { label: "Guest", value: "guest" },
9
9
  { label: "Contractor", value: "contractor" },
10
10
  { label: "Delivery", value: "delivery" },
11
- { label: "Walk-In", value: "walk-in"},
12
- { label: "Pick-Up", value: "pick-up"},
13
- { label: "Drop-Off", value: "drop-off"}
11
+ { label: "Walk-In", value: "walk-in" },
12
+ { label: "Pick-Up", value: "pick-up" },
13
+ { label: "Drop-Off", value: "drop-off" },
14
14
  ];
15
15
 
16
16
  const typeFieldMap: Record<TVisitorType, (keyof TVisitorPayload)[]> = {
17
+ guest: ['name', 'nric', 'contact', 'block', 'level', 'unit' , 'unitName', 'remarks'],
17
18
  contractor: ['contractorType', 'name', 'nric', 'company', 'contact', 'plateNumber', 'block', 'level', 'unit', 'unitName', 'remarks'],
18
19
  delivery: ['attachments', 'name', 'deliveryType', 'company', 'nric', 'contact', 'plateNumber', 'block', 'level', 'unit' , 'unitName', 'remarks'],
19
20
  'walk-in': ['name', 'company', 'nric', 'contact', 'block', 'level', 'unit' , 'unitName', 'remarks'],
@@ -22,59 +23,81 @@ export default function(){
22
23
  }
23
24
 
24
25
  const contractorTypes = [
25
- { title: "Estate Contractor", value: "estate-contractor" },
26
- { title: "Home Contractor", value: "home-contractor" },
27
- { title: "Property Agent", value: "property-agent" },
28
- { title: "House Mover", value: "house-mover" },
29
- ]
30
-
26
+ { title: "Estate Contractor", value: "estate-contractor" },
27
+ { title: "Home Contractor", value: "home-contractor" },
28
+ { title: "Property Agent", value: "property-agent" },
29
+ { title: "House Mover", value: "house-mover" },
30
+ ];
31
31
 
32
- async function getVisitors({
33
- page = 1,
34
- limit = 10,
35
- sort = "asc",
36
- search = "",
37
- org = "",
38
- site = "",
39
- dateTo = "",
40
- dateFrom = "",
41
- type="",
42
- displayNoCheckOut=false,
43
- // status = "registered"
44
- } = {}) {
45
- return await useNuxtApp().$api<Record<string, any>>("/api/visitor-transactions", {
32
+ async function getVisitors({
33
+ page = 1,
34
+ limit = 10,
35
+ sort = "asc",
36
+ search = "",
37
+ org = "",
38
+ site = "",
39
+ dateTo = "",
40
+ dateFrom = "",
41
+ type = "",
42
+ status = "registered",
43
+ // status = "registered"
44
+ } = {}) {
45
+ return await useNuxtApp().$api<Record<string, any>>(
46
+ "/api/visitor-transactions",
47
+ {
46
48
  method: "GET",
47
- query: { page, limit, sort, search, org, site, dateTo, dateFrom, ...(type.length > 0 && {type}), ...(displayNoCheckOut === true && {checkedOut: false}) },
48
- });
49
+ query: {
50
+ page,
51
+ limit,
52
+ sort,
53
+ search,
54
+ org,
55
+ site,
56
+ dateTo,
57
+ dateFrom,
58
+ type,
59
+ status,
60
+ },
61
+ }
62
+ );
49
63
  }
50
64
 
51
- async function createVisitor(payload: Partial<TVisitorPayload>){
52
- return await useNuxtApp().$api<Record<string, any>>("/api/visitor-transactions", {
65
+ async function createVisitor(payload: Partial<TVisitorPayload>) {
66
+ return await useNuxtApp().$api<Record<string, any>>(
67
+ "/api/visitor-transactions",
68
+ {
53
69
  method: "POST",
54
70
  body: payload,
55
- });
56
- }
71
+ }
72
+ );
73
+ }
57
74
 
58
- async function updateVisitor(_id: string, payload: Partial<TVisitorPayload>){
59
- return await useNuxtApp().$api<Record<string, any>>(`/api/visitor-transactions/id/${_id}`, {
75
+ async function updateVisitor(_id: string, payload: Partial<TVisitorPayload>) {
76
+ return await useNuxtApp().$api<Record<string, any>>(
77
+ `/api/visitor-transactions/id/${_id}`,
78
+ {
60
79
  method: "PUT",
61
80
  body: payload,
62
- });
63
- }
81
+ }
82
+ );
83
+ }
64
84
 
65
- async function deleteVisitor(_id: string){
66
- return await useNuxtApp().$api<Record<string, any>>(`/api/visitor-transactions/id/${_id}`, {
85
+ async function deleteVisitor(_id: string) {
86
+ return await useNuxtApp().$api<Record<string, any>>(
87
+ `/api/visitor-transactions/id/${_id}`,
88
+ {
67
89
  method: "DELETE",
68
- });
69
- }
90
+ }
91
+ );
92
+ }
70
93
 
71
- return {
72
- typeFieldMap,
73
- visitorSelection,
74
- contractorTypes,
75
- createVisitor,
76
- getVisitors,
77
- updateVisitor,
78
- deleteVisitor
79
- }
80
- }
94
+ return {
95
+ typeFieldMap,
96
+ visitorSelection,
97
+ contractorTypes,
98
+ createVisitor,
99
+ getVisitors,
100
+ updateVisitor,
101
+ deleteVisitor,
102
+ };
103
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@iservice365/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "1.3.0",
5
+ "version": "1.3.2",
6
6
  "main": "./nuxt.config.ts",
7
7
  "scripts": {
8
8
  "dev": "nuxi dev .playground",
@@ -4,6 +4,7 @@ declare type TBuilding = {
4
4
  name: string;
5
5
  block: number | null;
6
6
  levels: string[];
7
+ buildingFloorPlan: string[]
7
8
  };
8
9
 
9
10
  declare type TBuildingUnit = {
@@ -16,4 +17,9 @@ declare type TBuildingUnit = {
16
17
  level: string | null;
17
18
  category: string;
18
19
  status: string;
20
+ buildingUnitFiles: string[];
21
+ companyName: string;
22
+ companyRegistrationNumber: number | string;
23
+ leaseStart: string;
24
+ leaseEnd: string;
19
25
  };
package/types/people.d.ts CHANGED
@@ -2,7 +2,8 @@ declare type TPeople = {
2
2
  name?: string;
3
3
  block?: number | string;
4
4
  level?: string;
5
- unit?: string | Partial<TBuildingUnit>;
5
+ unit?: string
6
+ companyName?: sring[];
6
7
  unitName?: string;
7
8
  contact?: string;
8
9
  plateNumber?: string;
@@ -21,7 +21,7 @@ declare type TVisitor = {
21
21
  manualCheckout?: boolean;
22
22
  };
23
23
 
24
- declare type TVisitorType = "contractor" | "delivery" | "walk-in" | "pick-up" | "drop-off";
24
+ declare type TVisitorType = "contractor" | "delivery" | "walk-in" | "pick-up" | "drop-off" | "guest";
25
25
 
26
26
  declare type TVisitorPayload = Pick<TVisitor, "name" | "type" | "company" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "checkOut" | "contractorType" | "deliveryType" | "nric" | "contact" | "remarks" | "attachments" | "org" | "site"> & {
27
27
  members?: TMemberInfo[]