@7365admin1/layer-common 1.8.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.
Files changed (198) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/config.json +11 -0
  3. package/.editorconfig +12 -0
  4. package/.github/workflows/main.yml +17 -0
  5. package/.github/workflows/publish.yml +39 -0
  6. package/.nuxtrc +1 -0
  7. package/.playground/app.vue +41 -0
  8. package/.playground/eslint.config.mjs +6 -0
  9. package/.playground/nuxt.config.ts +22 -0
  10. package/.playground/pages/feedback.vue +30 -0
  11. package/CHANGELOG.md +263 -0
  12. package/README.md +73 -0
  13. package/app.vue +3 -0
  14. package/components/AccessCardAddForm.vue +363 -0
  15. package/components/AccessManagement.vue +420 -0
  16. package/components/Avatar/Main.vue +68 -0
  17. package/components/BillingMain.vue +66 -0
  18. package/components/BtnUploadFile.vue +139 -0
  19. package/components/BuildingForm.vue +303 -0
  20. package/components/BuildingManagement/buildings.vue +335 -0
  21. package/components/BuildingManagement/units.vue +350 -0
  22. package/components/BuildingUnitFormAdd.vue +441 -0
  23. package/components/BuildingUnitFormEdit.vue +429 -0
  24. package/components/CameraForm.vue +264 -0
  25. package/components/CameraMain.vue +352 -0
  26. package/components/Card/DeleteConfirmation.vue +51 -0
  27. package/components/Card/MemberInfoSummary.vue +44 -0
  28. package/components/Card/Toggle.vue +25 -0
  29. package/components/Chat/Bubbles.vue +53 -0
  30. package/components/Chat/Information.vue +416 -0
  31. package/components/Chat/ListCard.vue +62 -0
  32. package/components/Chat/Message.vue +158 -0
  33. package/components/Chat/Navigation.vue +150 -0
  34. package/components/ConfirmDialog.vue +66 -0
  35. package/components/Container/Standard.vue +33 -0
  36. package/components/DashboardPlaceholder.vue +1524 -0
  37. package/components/Dialog/DeleteConfirmation.vue +51 -0
  38. package/components/Dialog/ReplaceAutofillPrompt.vue +49 -0
  39. package/components/Dialog/UpdateMoreAction.vue +103 -0
  40. package/components/DocumentForm.vue +187 -0
  41. package/components/DocumentManagement.vue +376 -0
  42. package/components/Editor.vue +95 -0
  43. package/components/EntryPassMain.vue +518 -0
  44. package/components/Feedback/Form.vue +173 -0
  45. package/components/FeedbackDetail.vue +599 -0
  46. package/components/FeedbackMain.vue +588 -0
  47. package/components/FormDialog.vue +65 -0
  48. package/components/ImageCarousel.vue +138 -0
  49. package/components/Input/Date.vue +177 -0
  50. package/components/Input/DateTimePicker.vue +131 -0
  51. package/components/Input/File.vue +236 -0
  52. package/components/Input/FileV2.vue +234 -0
  53. package/components/Input/InputPhoneNumberV2.vue +164 -0
  54. package/components/Input/ListGroupSelection.vue +96 -0
  55. package/components/Input/NRICNumber.vue +53 -0
  56. package/components/Input/NewDate.vue +123 -0
  57. package/components/Input/Number.vue +124 -0
  58. package/components/Input/Password.vue +22 -0
  59. package/components/Input/PhoneNumber.vue +188 -0
  60. package/components/Input/VehicleNumber.vue +49 -0
  61. package/components/InputLabel.vue +22 -0
  62. package/components/InvitationForm.vue +359 -0
  63. package/components/InvitationMain.vue +310 -0
  64. package/components/Layout/Header.vue +129 -0
  65. package/components/Layout/NavigationDrawer.vue +44 -0
  66. package/components/ListItem.vue +35 -0
  67. package/components/ListView.vue +87 -0
  68. package/components/LocalPagination.vue +31 -0
  69. package/components/MemberMain.vue +459 -0
  70. package/components/NFC/NFCPatrolReportMain.vue +591 -0
  71. package/components/NFC/NFCPatrolRouteForm.vue +596 -0
  72. package/components/NFC/NFCPatrolRouteMain.vue +539 -0
  73. package/components/NFC/NFCTagForm.vue +236 -0
  74. package/components/NFC/NFCTagMain.vue +337 -0
  75. package/components/NFC/PatrolSettings.vue +130 -0
  76. package/components/NavigationItem.vue +83 -0
  77. package/components/NumberSettingField.vue +107 -0
  78. package/components/OnlineFormConfigurationForm.vue +290 -0
  79. package/components/OnlineFormsConfiguration.vue +429 -0
  80. package/components/PeopleForm.vue +452 -0
  81. package/components/PlaceholderComponent.vue +34 -0
  82. package/components/RolePermissionFormCreate.vue +161 -0
  83. package/components/RolePermissionFormPreviewUpdate.vue +183 -0
  84. package/components/RolePermissionMain.vue +361 -0
  85. package/components/SearchVehicleNumberUser.vue +91 -0
  86. package/components/ServiceProviderFormCreate.vue +154 -0
  87. package/components/ServiceProviderMain.vue +547 -0
  88. package/components/SignaturePad.vue +73 -0
  89. package/components/Snackbar.vue +23 -0
  90. package/components/SpecificAttr.vue +53 -0
  91. package/components/SupplyManagement.vue +292 -0
  92. package/components/SwitchContext.vue +108 -0
  93. package/components/TableList.vue +150 -0
  94. package/components/TableListSecondary.vue +164 -0
  95. package/components/TableMain.vue +142 -0
  96. package/components/TableWithButton.vue +94 -0
  97. package/components/VehicleUpdateMoreAction.vue +84 -0
  98. package/components/VideoPlayer.vue +125 -0
  99. package/components/VisitorForm.vue +659 -0
  100. package/components/VisitorFormSelection.vue +53 -0
  101. package/components/VisitorManagement.vue +490 -0
  102. package/components/WorkOrder/Create.vue +284 -0
  103. package/components/WorkOrder/Detail.vue +71 -0
  104. package/components/WorkOrder/ListView.vue +96 -0
  105. package/components/WorkOrder/Main.vue +489 -0
  106. package/components/Workorder.vue +1 -0
  107. package/composables/useAddress.ts +107 -0
  108. package/composables/useBuilding.ts +250 -0
  109. package/composables/useBuildingUnit.ts +116 -0
  110. package/composables/useCard.ts +46 -0
  111. package/composables/useCommonPermission.ts +207 -0
  112. package/composables/useCustomer.ts +113 -0
  113. package/composables/useCustomerSite.ts +56 -0
  114. package/composables/useDashboard.ts +31 -0
  115. package/composables/useDashboardData.ts +425 -0
  116. package/composables/useDocument.ts +57 -0
  117. package/composables/useFacility.ts +246 -0
  118. package/composables/useFeedback.ts +119 -0
  119. package/composables/useFile.ts +55 -0
  120. package/composables/useInvoice.ts +18 -0
  121. package/composables/useLocal.ts +131 -0
  122. package/composables/useLocalAuth.ts +137 -0
  123. package/composables/useLocalSetup.ts +13 -0
  124. package/composables/useMember.ts +111 -0
  125. package/composables/useNFCPatrolRoute.ts +77 -0
  126. package/composables/useNFCPatrolSettings.ts +19 -0
  127. package/composables/useNFCPatrolTag.ts +53 -0
  128. package/composables/useOnlineForm.ts +67 -0
  129. package/composables/useOrg.ts +129 -0
  130. package/composables/usePDFDownload.ts +25 -0
  131. package/composables/usePaymentMethod.ts +101 -0
  132. package/composables/usePeople.ts +81 -0
  133. package/composables/usePermission.ts +54 -0
  134. package/composables/usePhoneCountries.ts +561 -0
  135. package/composables/usePrice.ts +15 -0
  136. package/composables/usePromoCode.ts +36 -0
  137. package/composables/useRecapPermission.ts +26 -0
  138. package/composables/useRole.ts +104 -0
  139. package/composables/useSecurityUtils.ts +18 -0
  140. package/composables/useServiceProvider.ts +224 -0
  141. package/composables/useSite.ts +109 -0
  142. package/composables/useSiteEntryPassSettings.ts +46 -0
  143. package/composables/useSiteSettings.ts +123 -0
  144. package/composables/useSubscription.ts +150 -0
  145. package/composables/useUser.ts +132 -0
  146. package/composables/useUtils.ts +445 -0
  147. package/composables/useVerification.ts +34 -0
  148. package/composables/useVisitor.ts +120 -0
  149. package/composables/useWorkOrder.ts +85 -0
  150. package/error.vue +41 -0
  151. package/layouts/plain.vue +7 -0
  152. package/middleware/01.auth.ts +20 -0
  153. package/middleware/02.org.ts +21 -0
  154. package/middleware/03.customer.ts +13 -0
  155. package/middleware/member.ts +4 -0
  156. package/nuxt.config.ts +54 -0
  157. package/package.json +39 -0
  158. package/pages/index.vue +3 -0
  159. package/pages/payment-method-linked.vue +31 -0
  160. package/pages/require-customer.vue +56 -0
  161. package/pages/require-organization-membership.vue +47 -0
  162. package/pages/unauthorized.vue +29 -0
  163. package/plugins/API.ts +21 -0
  164. package/plugins/iconify.client.ts +5 -0
  165. package/plugins/secure-member.client.ts +86 -0
  166. package/plugins/vuetify.ts +62 -0
  167. package/public/bg-camera.jpg +0 -0
  168. package/public/bg-city.jpg +0 -0
  169. package/public/bg-condo.jpg +0 -0
  170. package/public/images/icons/delete-icon.png +0 -0
  171. package/public/sprite.svg +1 -0
  172. package/tsconfig.json +3 -0
  173. package/types/address.d.ts +13 -0
  174. package/types/building.d.ts +27 -0
  175. package/types/camera.d.ts +31 -0
  176. package/types/card.d.ts +22 -0
  177. package/types/customer.d.ts +27 -0
  178. package/types/document.d.ts +6 -0
  179. package/types/feedback.d.ts +68 -0
  180. package/types/local.d.ts +74 -0
  181. package/types/member.d.ts +21 -0
  182. package/types/online-form.d.ts +15 -0
  183. package/types/org.d.ts +13 -0
  184. package/types/people.d.ts +24 -0
  185. package/types/permission.d.ts +25 -0
  186. package/types/phone-number.d.ts +10 -0
  187. package/types/price.d.ts +17 -0
  188. package/types/promo-code.d.ts +19 -0
  189. package/types/role.d.ts +11 -0
  190. package/types/select.d.ts +4 -0
  191. package/types/service-provider.d.ts +15 -0
  192. package/types/site.d.ts +20 -0
  193. package/types/subscription.d.ts +23 -0
  194. package/types/user.d.ts +19 -0
  195. package/types/verification.d.ts +20 -0
  196. package/types/visitor.d.ts +42 -0
  197. package/types/work-order.d.ts +42 -0
  198. package/utils/phoneMasks.ts +1703 -0
@@ -0,0 +1,13 @@
1
+ export function useLocalSetup() {
2
+ const userAppRole = useState<TRole | null>("userAppRole", () => null);
3
+
4
+ const id = useState<string | null>("memberShipOrgId", () => null);
5
+
6
+ const orgNature = useState<string>("orgNature", () => "");
7
+
8
+ return {
9
+ userAppRole,
10
+ id,
11
+ orgNature,
12
+ };
13
+ }
@@ -0,0 +1,111 @@
1
+ export default function useMember() {
2
+ const members = useState<Array<TMember>>("members", () => []);
3
+ const page = useState("page", () => 1);
4
+ const pages = useState("pages", () => 0);
5
+ const pageRange = useState("pageRange", () => "-- - -- of --");
6
+
7
+ const member = useState<TMember>("member", () => ({
8
+ _id: "",
9
+ org: "",
10
+ orgName: "",
11
+ roleName: "",
12
+ name: "",
13
+ user: "",
14
+ role: "",
15
+ type: "",
16
+ customerOrgId: "",
17
+ customerSiteId: "",
18
+ status: "",
19
+ createdAt: "",
20
+ updatedAt: "",
21
+ deletedAt: "",
22
+ }));
23
+
24
+ function getByUserId(user: string) {
25
+ return useNuxtApp().$api<TMember>(`/api/members/user/${user}`);
26
+ }
27
+
28
+ function getByUserIdType(user: string, type: string) {
29
+ return useNuxtApp().$api<TMember>(`/api/members/user/${user}/app/${type}`);
30
+ }
31
+
32
+ function getByUserType(user: string, type: string, org?: string) {
33
+ return useNuxtApp().$api<TMember>(`/api/members/user/${user}/app/${type}`, {
34
+ method: "GET",
35
+ query: { org },
36
+ });
37
+ }
38
+
39
+ async function getAll({
40
+ page = 1,
41
+ search = "",
42
+ limit = 10,
43
+ user = "",
44
+ org = "",
45
+ type = "",
46
+ status = "active",
47
+ } = {}) {
48
+ return useNuxtApp().$api<Record<string, any>>("/api/members", {
49
+ method: "GET",
50
+ query: { page, limit, search, user, org, type, status },
51
+ });
52
+ }
53
+ function createUserByVerification(
54
+ verificationId: string,
55
+ payload: TMemberUserCreateVerification
56
+ ) {
57
+ return useNuxtApp().$api<TMemberUserCreateVerification>(
58
+ `/api/users/invite/${verificationId}`,
59
+ {
60
+ method: "POST",
61
+ body: payload,
62
+ }
63
+ );
64
+ }
65
+
66
+ function createMemberInvite(verificatonId: string) {
67
+ return useNuxtApp().$api<TMember>(
68
+ `/api/members/verification/${verificatonId}`,
69
+ {
70
+ method: "POST",
71
+ }
72
+ );
73
+ }
74
+ function updateMemberStatus(id: string, status: string) {
75
+ return useNuxtApp().$api<Record<string, any>>(
76
+ `/api/members/${id}/${status}`,
77
+ {
78
+ method: "PUT",
79
+ }
80
+ );
81
+ }
82
+
83
+ function updateMemberRole(
84
+ id: string,
85
+ role: string,
86
+ type: string,
87
+ org: string
88
+ ) {
89
+ return useNuxtApp().$api<Record<string, any>>(
90
+ `/api/members/id/${id}/role/${role}/type/${type}/org/${org}`,
91
+ {
92
+ method: "PUT",
93
+ }
94
+ );
95
+ }
96
+ return {
97
+ members,
98
+ member,
99
+ page,
100
+ pages,
101
+ pageRange,
102
+ getByUserType,
103
+ getAll,
104
+ getByUserId,
105
+ createUserByVerification,
106
+ createMemberInvite,
107
+ getByUserIdType,
108
+ updateMemberStatus,
109
+ updateMemberRole,
110
+ };
111
+ }
@@ -0,0 +1,77 @@
1
+ export default function useNFCPatrolRoute() {
2
+ function getAll({
3
+ page = 1,
4
+ limit = 20,
5
+ site = "",
6
+ search = "",
7
+ } = {}) {
8
+ const query: Record<string, any> = {
9
+ page,
10
+ limit,
11
+ site,
12
+ };
13
+
14
+ // Only include search parameter if it has a value
15
+ if (search) {
16
+ query.search = search;
17
+ }
18
+
19
+ return useNuxtApp().$api<Record<string, any>>(`/api/nfc-patrol-route`, {
20
+ method: "GET",
21
+ query,
22
+ });
23
+ }
24
+
25
+ function add(value: {
26
+ name: string;
27
+ checkPointNumber: number;
28
+ tolerance: string;
29
+ days: number[];
30
+ startTimes: string[];
31
+ checkPoints: Array<{ nfcTag_id: string; travelTime: number }>;
32
+ site: string;
33
+ }) {
34
+ return useNuxtApp().$api<Record<string, any>>("/api/nfc-patrol-route", {
35
+ method: "POST",
36
+ body: value,
37
+ });
38
+ }
39
+
40
+ function getById(id: string) {
41
+ return useNuxtApp().$api<Record<string, any>>(`/api/nfc-patrol-route/id/${id}`, {
42
+ method: "GET",
43
+ });
44
+ }
45
+
46
+ function deleteById(id: string) {
47
+ return useNuxtApp().$api(`/api/nfc-patrol-route/${id}`, {
48
+ method: "DELETE",
49
+ });
50
+ }
51
+
52
+ function updateById(
53
+ id: string,
54
+ value: {
55
+ name: string;
56
+ checkPointNumber: number;
57
+ tolerance: string;
58
+ days: number[];
59
+ startTimes: string[];
60
+ checkPoints: Array<{ nfcTag_id: string; travelTime: number }>;
61
+ site: string;
62
+ }
63
+ ) {
64
+ return useNuxtApp().$api(`/api/nfc-patrol-route/id/${id}`, {
65
+ method: "PATCH",
66
+ body: value,
67
+ });
68
+ }
69
+
70
+ return {
71
+ getAll,
72
+ getById,
73
+ add,
74
+ deleteById,
75
+ updateById,
76
+ };
77
+ }
@@ -0,0 +1,19 @@
1
+ export default function useNFCPatrolSettings() {
2
+ async function getBySite(site: string) {
3
+ return await useNuxtApp().$api<Record<string, any>>(
4
+ `/api/nfc-patrol-settings/site/${site}`
5
+ );
6
+ }
7
+
8
+ function updateBySite(site: string, value: any) {
9
+ return useNuxtApp().$api(`/api/nfc-patrol-settings/site/${site}`, {
10
+ method: "PUT",
11
+ body: value,
12
+ });
13
+ }
14
+
15
+ return {
16
+ getBySite,
17
+ updateBySite,
18
+ };
19
+ }
@@ -0,0 +1,53 @@
1
+ export default function useNFCPatrolTag() {
2
+ function getAll({
3
+ page = 1,
4
+ limit = 10,
5
+ site = "",
6
+ } = {}) {
7
+ return useNuxtApp().$api<Record<string, any>>(`/api/nfc-patrol-tag`, {
8
+ method: "GET",
9
+ query: {
10
+ page,
11
+ limit,
12
+ site,
13
+ },
14
+ });
15
+ }
16
+
17
+ function add(value: { site: string; tagID: string; name: string }) {
18
+ return useNuxtApp().$api<Record<string, any>>("/api/nfc-patrol-tag", {
19
+ method: "POST",
20
+ body: {
21
+ site: value.site,
22
+ tagID: value.tagID,
23
+ name: value.name,
24
+ },
25
+ });
26
+ }
27
+
28
+ function deleteById(id: string) {
29
+ return useNuxtApp().$api(`/api/nfc-patrol-tag/${id}`, {
30
+ method: "DELETE",
31
+ });
32
+ }
33
+
34
+ function updateById(id: string, value: { site: string; tagID: string; name: string; _id?: string; updateType?: string }) {
35
+ return useNuxtApp().$api(`/api/nfc-patrol-tag`, {
36
+ method: "PUT",
37
+ body: {
38
+ name: value.name,
39
+ tagID: value.tagID,
40
+ site: value.site,
41
+ _id: value._id || id,
42
+ updateType: value.updateType || "Edit",
43
+ },
44
+ });
45
+ }
46
+
47
+ return {
48
+ getAll,
49
+ add,
50
+ deleteById,
51
+ updateById,
52
+ };
53
+ }
@@ -0,0 +1,67 @@
1
+ export default function useOnlineForm() {
2
+ function getAll({
3
+ page = 1,
4
+ search = "",
5
+ limit = 10,
6
+ status = "active",
7
+ site = "",
8
+ } = {}) {
9
+ return useNuxtApp().$api<Record<string, any>>(`/api/online-forms`, {
10
+ method: "GET",
11
+ query: {
12
+ page,
13
+ search,
14
+ limit,
15
+ status,
16
+ site,
17
+ },
18
+ });
19
+ }
20
+ function add(value: any) {
21
+ return useNuxtApp().$api<Record<string, any>>("/api/online-forms", {
22
+ method: "POST",
23
+ body: value,
24
+ });
25
+ }
26
+ function getOnlineFormById(id: string) {
27
+ return useNuxtApp().$api<Record<string, any>>(`/api/online-forms/id/${id}`, {
28
+ method: "GET",
29
+ });
30
+ }
31
+ function updateOnlineFormById(id: string, value: any) {
32
+ return useNuxtApp().$api<Record<string, any>>(`/api/online-forms/id/${id}`, {
33
+ method: "PUT",
34
+ body: value,
35
+ });
36
+ }
37
+ function deleteOnlineFormById(id: string) {
38
+ return useNuxtApp().$api(`/api/online-forms/id/${id}`, {
39
+ method: "DELETE",
40
+ });
41
+ }
42
+ function getAllBySiteId(
43
+ siteId: string,
44
+ { page = 1, search = "", limit = 10, status = "active" }
45
+ ) {
46
+ return useNuxtApp().$api<Record<string, any>>(
47
+ `/api/online-forms/site/${siteId}`,
48
+ {
49
+ method: "GET",
50
+ query: {
51
+ page,
52
+ search,
53
+ limit,
54
+ status,
55
+ },
56
+ }
57
+ );
58
+ }
59
+ return {
60
+ getAll,
61
+ add,
62
+ getOnlineFormById,
63
+ updateOnlineFormById,
64
+ deleteOnlineFormById,
65
+ getAllBySiteId,
66
+ };
67
+ }
@@ -0,0 +1,129 @@
1
+ export default function useOrg() {
2
+ function getOrgs({
3
+ page = 1,
4
+ search = "",
5
+ user = "",
6
+ limit = 20,
7
+ type = "organization",
8
+ } = {}) {
9
+ return useNuxtApp().$api<Record<string, any>>(
10
+ `/api/organizations/user/${user}`,
11
+ {
12
+ method: "GET",
13
+ query: {
14
+ page,
15
+ search,
16
+ limit,
17
+ type,
18
+ },
19
+ }
20
+ );
21
+ }
22
+
23
+ const org = useState("org", (): TOrg => {
24
+ return {
25
+ _id: "",
26
+ name: "",
27
+ email: "",
28
+ contact: "",
29
+ busInst: "",
30
+ type: "",
31
+ status: "",
32
+ };
33
+ });
34
+
35
+ function reset() {
36
+ org.value._id = "";
37
+ org.value.name = "";
38
+ org.value.email = "";
39
+ org.value.contact = "";
40
+ org.value.busInst = "";
41
+ org.value.type = "";
42
+ org.value.status = "";
43
+ }
44
+
45
+ function set({
46
+ _id = "",
47
+ name = "",
48
+ email = "",
49
+ contact = "",
50
+ busInst = "",
51
+ type = "",
52
+ status = "",
53
+ } = {}) {
54
+ org.value._id = _id;
55
+ org.value.name = name;
56
+ org.value.email = email;
57
+ org.value.contact = contact;
58
+ org.value.busInst = busInst;
59
+ org.value.type = type;
60
+ org.value.status = status;
61
+ }
62
+
63
+ const perSeatPrice = 8;
64
+ const seats = useState("seats", () => 0);
65
+ const total = computed(() => seats.value * perSeatPrice);
66
+
67
+ function getByName(name = "") {
68
+ return useNuxtApp().$api<TOrg>(`/api/organizations/name/${name}`, {
69
+ method: "GET",
70
+ });
71
+ }
72
+
73
+ function getById(id = "") {
74
+ return useNuxtApp().$api<TOrg>(`/api/organizations/id/${id}`, {
75
+ method: "GET",
76
+ });
77
+ }
78
+
79
+ const { currentUser } = useLocalAuth();
80
+
81
+ const currentOrg = useState("currentOrg", () => "");
82
+
83
+ currentOrg.value =
84
+ (useRoute().params.organization as string) ??
85
+ currentUser.value?.defaultOrg ??
86
+ "unknown";
87
+
88
+ watch(currentUser, () => {
89
+ if (!currentOrg.value) {
90
+ currentOrg.value = currentUser.value?.defaultOrg ?? "unknown";
91
+ }
92
+ });
93
+
94
+ function getAll({ page = 1, search = "", limit = 20, nature = "" } = {}) {
95
+ return useNuxtApp().$api<Record<string, any>>("/api/organizations", {
96
+ method: "GET",
97
+ query: {
98
+ page,
99
+ search,
100
+ limit,
101
+ nature,
102
+ },
103
+ });
104
+ }
105
+
106
+ function add(
107
+ value: Partial<Pick<TOrg, "name" | "email" | "nature" | "contact">>
108
+ ) {
109
+ return useNuxtApp().$api<TOrg>("/api/organizations", {
110
+ method: "POST",
111
+ body: value,
112
+ });
113
+ }
114
+
115
+ return {
116
+ org,
117
+ getOrgs,
118
+ reset,
119
+ set,
120
+ perSeatPrice,
121
+ seats,
122
+ total,
123
+ getByName,
124
+ currentOrg,
125
+ getById,
126
+ getAll,
127
+ add,
128
+ };
129
+ }
@@ -0,0 +1,25 @@
1
+ export default function(){
2
+
3
+ type TDownloadAppKeys = "PROPERTY" | "SECURITY" | "HYGIENE" | "MECHANICAL_ELECTRICAL" | "PEST_CONTROL" | "LANDSCAPING" | "POOL_MAINTENANCE"
4
+
5
+ async function downloadPDF({ url, title, orientation, appKey} : { url: string; title: string; orientation: "P" | "L", appKey: TDownloadAppKeys }) {
6
+ const res = await useNuxtApp().$api<Blob | MediaSource>("/api/site-soa/generate-pdf", {
7
+ method: "GET",
8
+ query: { url, title, orientation, appKey },
9
+ });
10
+ if (!res) throw new Error("Error downloading PDF");
11
+ const downloadUrl = window.URL.createObjectURL(res);
12
+ const a = document.createElement("a");
13
+ a.href = downloadUrl;
14
+ a.download = `SOA DOWNLOAD.pdf`; // Specify the file name
15
+ document.body.appendChild(a);
16
+ a.click(); // Trigger the download
17
+ window.URL.revokeObjectURL(downloadUrl); // Clean up
18
+ }
19
+
20
+ return {
21
+ downloadPDF
22
+ }
23
+
24
+
25
+ }
@@ -0,0 +1,101 @@
1
+ export default function usePaymentMethod() {
2
+ function linkEWallet({
3
+ type = "GCASH",
4
+ customer_id = "",
5
+ success_return_url = "",
6
+ failure_return_url = "",
7
+ cancel_return_url = "",
8
+ category = "individual",
9
+ } = {}) {
10
+ return useNuxtApp().$api<Record<string, any>>(
11
+ "/api/payment-methods/e-wallet",
12
+ {
13
+ method: "POST",
14
+ body: {
15
+ customer_id,
16
+ type,
17
+ success_return_url,
18
+ failure_return_url,
19
+ cancel_return_url,
20
+ category,
21
+ },
22
+ }
23
+ );
24
+ }
25
+
26
+ function linkCard({
27
+ cardType = "",
28
+ cardNumber = "",
29
+ expiryMonth = "",
30
+ expiryYear = "",
31
+ cvv = "",
32
+ cardholderName = "",
33
+ currency = "",
34
+ success_return_url = "",
35
+ failure_return_url = "",
36
+ subscriptionData = {},
37
+ } = {}) {
38
+ return useNuxtApp().$api<Record<string, any>>("/api/payment-methods/card", {
39
+ method: "POST",
40
+ body: {
41
+ cardType,
42
+ cardNumber,
43
+ expiryMonth,
44
+ expiryYear,
45
+ cvv,
46
+ cardholderName,
47
+ currency,
48
+ success_return_url,
49
+ failure_return_url,
50
+ subscriptionData,
51
+ },
52
+ });
53
+ }
54
+
55
+ function getByUser(user = "") {
56
+ return useNuxtApp().$api<Array<Record<string, any>>>(
57
+ `/api/payment-methods/user/${user}`,
58
+ {
59
+ method: "GET",
60
+ }
61
+ );
62
+ }
63
+
64
+ function getByOrg(org = "") {
65
+ return useNuxtApp().$api<Array<Record<string, any>>>(
66
+ `/api/payment-methods/org/${org}`,
67
+ {
68
+ method: "GET",
69
+ }
70
+ );
71
+ }
72
+
73
+ const eWalletNumber = useState("eWalletNumber", () => "");
74
+ const cardNumber = useState("cardNumber", () => "");
75
+ const cardExpiration = useState("cardExpiration", () => "");
76
+ const cardSecurityCode = useState("cardSecurityCode", () => "");
77
+ const cardholderName = useState("cardholderName", () => "");
78
+ const selectedPaymentMethod = useState("selectedPaymentMethod", () => "");
79
+
80
+ function reset() {
81
+ eWalletNumber.value = "";
82
+ cardNumber.value = "";
83
+ cardExpiration.value = "";
84
+ cardSecurityCode.value = "";
85
+ cardholderName.value = "";
86
+ }
87
+
88
+ return {
89
+ linkEWallet,
90
+ linkCard,
91
+ getByUser,
92
+ getByOrg,
93
+ eWalletNumber,
94
+ cardNumber,
95
+ cardExpiration,
96
+ cardSecurityCode,
97
+ cardholderName,
98
+ selectedPaymentMethod,
99
+ reset,
100
+ };
101
+ }
@@ -0,0 +1,81 @@
1
+ export default function(){
2
+
3
+
4
+ async function getAll({
5
+ page = 1,
6
+ limit = 10,
7
+ sort = "asc",
8
+ search = "",
9
+ org = "",
10
+ site = "",
11
+ dateTo = "",
12
+ dateFrom = "",
13
+ type="",
14
+ displayNoCheckOut=false
15
+ } = {}) {
16
+ return await useNuxtApp().$api<Record<string, any>>("/api/people", {
17
+ method: "GET",
18
+ query: { page, limit, sort, search, org, site, dateTo, dateFrom, type }
19
+ });
20
+ }
21
+
22
+ async function findPersonByNRIC(nric: string): Promise<null | Partial<TPeople>> {
23
+ return await $fetch<Record<string, any>>(`/api/people/nric/${nric}`, {
24
+ method: "GET",
25
+ });
26
+ }
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
+
34
+ async function searchCompanyList(company: string): Promise<null | Partial<TPeople>> {
35
+ return await $fetch<Record<string, any>>('/api/people/company', {
36
+ method: "GET",
37
+ query: { search: company}
38
+ });
39
+ }
40
+
41
+ async function create(payload: Partial<TPeoplePayload>){
42
+ return await useNuxtApp().$api<Record<string, any>>("/api/people", {
43
+ method: "POST",
44
+ body: payload,
45
+ });
46
+ }
47
+
48
+ async function updateById(_id: string, payload: Partial<TPeoplePayload>){
49
+ return await useNuxtApp().$api<Record<string, any>>(`/api/people/id/${_id}`, {
50
+ method: "PUT",
51
+ body: payload,
52
+ });
53
+ }
54
+
55
+ async function deleteById(_id: string){
56
+ return await useNuxtApp().$api<Record<string, any>>(`/api/people/id/${_id}`, {
57
+ method: "PUT",
58
+ });
59
+ }
60
+
61
+ async function getPeopleByUnit( _id: string,{
62
+ status = "active",
63
+ type = "resident",
64
+ } = {}){
65
+ return await useNuxtApp().$api<Record<string, any>>(`/api/people/unit/${_id}`, {
66
+ method: "GET",
67
+ query: { status, type }
68
+ });
69
+ }
70
+
71
+ return {
72
+ create,
73
+ getAll,
74
+ updateById,
75
+ deleteById,
76
+ findPersonByNRIC,
77
+ findPersonByContact,
78
+ getPeopleByUnit,
79
+ searchCompanyList
80
+ }
81
+ }