@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.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.editorconfig +12 -0
- package/.github/workflows/main.yml +17 -0
- package/.github/workflows/publish.yml +39 -0
- package/.nuxtrc +1 -0
- package/.playground/app.vue +41 -0
- package/.playground/eslint.config.mjs +6 -0
- package/.playground/nuxt.config.ts +22 -0
- package/.playground/pages/feedback.vue +30 -0
- package/CHANGELOG.md +263 -0
- package/README.md +73 -0
- package/app.vue +3 -0
- package/components/AccessCardAddForm.vue +363 -0
- package/components/AccessManagement.vue +420 -0
- package/components/Avatar/Main.vue +68 -0
- package/components/BillingMain.vue +66 -0
- package/components/BtnUploadFile.vue +139 -0
- package/components/BuildingForm.vue +303 -0
- package/components/BuildingManagement/buildings.vue +335 -0
- package/components/BuildingManagement/units.vue +350 -0
- package/components/BuildingUnitFormAdd.vue +441 -0
- package/components/BuildingUnitFormEdit.vue +429 -0
- package/components/CameraForm.vue +264 -0
- package/components/CameraMain.vue +352 -0
- package/components/Card/DeleteConfirmation.vue +51 -0
- package/components/Card/MemberInfoSummary.vue +44 -0
- package/components/Card/Toggle.vue +25 -0
- package/components/Chat/Bubbles.vue +53 -0
- package/components/Chat/Information.vue +416 -0
- package/components/Chat/ListCard.vue +62 -0
- package/components/Chat/Message.vue +158 -0
- package/components/Chat/Navigation.vue +150 -0
- package/components/ConfirmDialog.vue +66 -0
- package/components/Container/Standard.vue +33 -0
- package/components/DashboardPlaceholder.vue +1524 -0
- package/components/Dialog/DeleteConfirmation.vue +51 -0
- package/components/Dialog/ReplaceAutofillPrompt.vue +49 -0
- package/components/Dialog/UpdateMoreAction.vue +103 -0
- package/components/DocumentForm.vue +187 -0
- package/components/DocumentManagement.vue +376 -0
- package/components/Editor.vue +95 -0
- package/components/EntryPassMain.vue +518 -0
- package/components/Feedback/Form.vue +173 -0
- package/components/FeedbackDetail.vue +599 -0
- package/components/FeedbackMain.vue +588 -0
- package/components/FormDialog.vue +65 -0
- package/components/ImageCarousel.vue +138 -0
- package/components/Input/Date.vue +177 -0
- package/components/Input/DateTimePicker.vue +131 -0
- package/components/Input/File.vue +236 -0
- package/components/Input/FileV2.vue +234 -0
- package/components/Input/InputPhoneNumberV2.vue +164 -0
- package/components/Input/ListGroupSelection.vue +96 -0
- package/components/Input/NRICNumber.vue +53 -0
- package/components/Input/NewDate.vue +123 -0
- package/components/Input/Number.vue +124 -0
- package/components/Input/Password.vue +22 -0
- package/components/Input/PhoneNumber.vue +188 -0
- package/components/Input/VehicleNumber.vue +49 -0
- package/components/InputLabel.vue +22 -0
- package/components/InvitationForm.vue +359 -0
- package/components/InvitationMain.vue +310 -0
- package/components/Layout/Header.vue +129 -0
- package/components/Layout/NavigationDrawer.vue +44 -0
- package/components/ListItem.vue +35 -0
- package/components/ListView.vue +87 -0
- package/components/LocalPagination.vue +31 -0
- package/components/MemberMain.vue +459 -0
- package/components/NFC/NFCPatrolReportMain.vue +591 -0
- package/components/NFC/NFCPatrolRouteForm.vue +596 -0
- package/components/NFC/NFCPatrolRouteMain.vue +539 -0
- package/components/NFC/NFCTagForm.vue +236 -0
- package/components/NFC/NFCTagMain.vue +337 -0
- package/components/NFC/PatrolSettings.vue +130 -0
- package/components/NavigationItem.vue +83 -0
- package/components/NumberSettingField.vue +107 -0
- package/components/OnlineFormConfigurationForm.vue +290 -0
- package/components/OnlineFormsConfiguration.vue +429 -0
- package/components/PeopleForm.vue +452 -0
- package/components/PlaceholderComponent.vue +34 -0
- package/components/RolePermissionFormCreate.vue +161 -0
- package/components/RolePermissionFormPreviewUpdate.vue +183 -0
- package/components/RolePermissionMain.vue +361 -0
- package/components/SearchVehicleNumberUser.vue +91 -0
- package/components/ServiceProviderFormCreate.vue +154 -0
- package/components/ServiceProviderMain.vue +547 -0
- package/components/SignaturePad.vue +73 -0
- package/components/Snackbar.vue +23 -0
- package/components/SpecificAttr.vue +53 -0
- package/components/SupplyManagement.vue +292 -0
- package/components/SwitchContext.vue +108 -0
- package/components/TableList.vue +150 -0
- package/components/TableListSecondary.vue +164 -0
- package/components/TableMain.vue +142 -0
- package/components/TableWithButton.vue +94 -0
- package/components/VehicleUpdateMoreAction.vue +84 -0
- package/components/VideoPlayer.vue +125 -0
- package/components/VisitorForm.vue +659 -0
- package/components/VisitorFormSelection.vue +53 -0
- package/components/VisitorManagement.vue +490 -0
- package/components/WorkOrder/Create.vue +284 -0
- package/components/WorkOrder/Detail.vue +71 -0
- package/components/WorkOrder/ListView.vue +96 -0
- package/components/WorkOrder/Main.vue +489 -0
- package/components/Workorder.vue +1 -0
- package/composables/useAddress.ts +107 -0
- package/composables/useBuilding.ts +250 -0
- package/composables/useBuildingUnit.ts +116 -0
- package/composables/useCard.ts +46 -0
- package/composables/useCommonPermission.ts +207 -0
- package/composables/useCustomer.ts +113 -0
- package/composables/useCustomerSite.ts +56 -0
- package/composables/useDashboard.ts +31 -0
- package/composables/useDashboardData.ts +425 -0
- package/composables/useDocument.ts +57 -0
- package/composables/useFacility.ts +246 -0
- package/composables/useFeedback.ts +119 -0
- package/composables/useFile.ts +55 -0
- package/composables/useInvoice.ts +18 -0
- package/composables/useLocal.ts +131 -0
- package/composables/useLocalAuth.ts +137 -0
- package/composables/useLocalSetup.ts +13 -0
- package/composables/useMember.ts +111 -0
- package/composables/useNFCPatrolRoute.ts +77 -0
- package/composables/useNFCPatrolSettings.ts +19 -0
- package/composables/useNFCPatrolTag.ts +53 -0
- package/composables/useOnlineForm.ts +67 -0
- package/composables/useOrg.ts +129 -0
- package/composables/usePDFDownload.ts +25 -0
- package/composables/usePaymentMethod.ts +101 -0
- package/composables/usePeople.ts +81 -0
- package/composables/usePermission.ts +54 -0
- package/composables/usePhoneCountries.ts +561 -0
- package/composables/usePrice.ts +15 -0
- package/composables/usePromoCode.ts +36 -0
- package/composables/useRecapPermission.ts +26 -0
- package/composables/useRole.ts +104 -0
- package/composables/useSecurityUtils.ts +18 -0
- package/composables/useServiceProvider.ts +224 -0
- package/composables/useSite.ts +109 -0
- package/composables/useSiteEntryPassSettings.ts +46 -0
- package/composables/useSiteSettings.ts +123 -0
- package/composables/useSubscription.ts +150 -0
- package/composables/useUser.ts +132 -0
- package/composables/useUtils.ts +445 -0
- package/composables/useVerification.ts +34 -0
- package/composables/useVisitor.ts +120 -0
- package/composables/useWorkOrder.ts +85 -0
- package/error.vue +41 -0
- package/layouts/plain.vue +7 -0
- package/middleware/01.auth.ts +20 -0
- package/middleware/02.org.ts +21 -0
- package/middleware/03.customer.ts +13 -0
- package/middleware/member.ts +4 -0
- package/nuxt.config.ts +54 -0
- package/package.json +39 -0
- package/pages/index.vue +3 -0
- package/pages/payment-method-linked.vue +31 -0
- package/pages/require-customer.vue +56 -0
- package/pages/require-organization-membership.vue +47 -0
- package/pages/unauthorized.vue +29 -0
- package/plugins/API.ts +21 -0
- package/plugins/iconify.client.ts +5 -0
- package/plugins/secure-member.client.ts +86 -0
- package/plugins/vuetify.ts +62 -0
- package/public/bg-camera.jpg +0 -0
- package/public/bg-city.jpg +0 -0
- package/public/bg-condo.jpg +0 -0
- package/public/images/icons/delete-icon.png +0 -0
- package/public/sprite.svg +1 -0
- package/tsconfig.json +3 -0
- package/types/address.d.ts +13 -0
- package/types/building.d.ts +27 -0
- package/types/camera.d.ts +31 -0
- package/types/card.d.ts +22 -0
- package/types/customer.d.ts +27 -0
- package/types/document.d.ts +6 -0
- package/types/feedback.d.ts +68 -0
- package/types/local.d.ts +74 -0
- package/types/member.d.ts +21 -0
- package/types/online-form.d.ts +15 -0
- package/types/org.d.ts +13 -0
- package/types/people.d.ts +24 -0
- package/types/permission.d.ts +25 -0
- package/types/phone-number.d.ts +10 -0
- package/types/price.d.ts +17 -0
- package/types/promo-code.d.ts +19 -0
- package/types/role.d.ts +11 -0
- package/types/select.d.ts +4 -0
- package/types/service-provider.d.ts +15 -0
- package/types/site.d.ts +20 -0
- package/types/subscription.d.ts +23 -0
- package/types/user.d.ts +19 -0
- package/types/verification.d.ts +20 -0
- package/types/visitor.d.ts +42 -0
- package/types/work-order.d.ts +42 -0
- package/utils/phoneMasks.ts +1703 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
export default function useSubscription() {
|
|
2
|
+
function add(subscriptionId: string, user: string) {
|
|
3
|
+
return useNuxtApp().$api("/api/subscriptions", {
|
|
4
|
+
method: "POST",
|
|
5
|
+
body: {
|
|
6
|
+
subscriptionId,
|
|
7
|
+
user,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function getById(id: string) {
|
|
13
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
14
|
+
`/api/subscriptions/id/${id}`
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function getByAffiliateId(id: string) {
|
|
19
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
20
|
+
`/api/subscriptions/affiliate/${id}`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function getByOrgId(id: string) {
|
|
25
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
26
|
+
`/api/subscriptions/org/${id}`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getSubscriptions() {
|
|
31
|
+
return useNuxtApp().$api("/api/subscriptions");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function getSubscriptionStatusById(id: string) {
|
|
35
|
+
return useNuxtApp().$api<Record<string, string>>(
|
|
36
|
+
`/api/subscriptions/status/${id}`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function cancelSubscription(id: string) {
|
|
41
|
+
return useNuxtApp().$api(`/api/subscriptions/cancel/${id}`, {
|
|
42
|
+
method: "DELETE",
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const affiliateSubscription = useState(
|
|
47
|
+
"affiliateSubscription",
|
|
48
|
+
() => "inactive"
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
async function affSubscriptionStatus() {
|
|
52
|
+
const { currentUser } = useLocalAuth();
|
|
53
|
+
|
|
54
|
+
if (currentUser.value && currentUser.value._id) {
|
|
55
|
+
try {
|
|
56
|
+
const result = await getByAffiliateId(currentUser.value._id);
|
|
57
|
+
affiliateSubscription.value = result.status as string;
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error("failed to get the subscription", error);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const orgSubscription = useState("orgSubscription", () => "inactive");
|
|
65
|
+
|
|
66
|
+
async function orgSubscriptionStatus() {
|
|
67
|
+
const { currentOrg } = useOrg();
|
|
68
|
+
|
|
69
|
+
if (currentOrg.value) {
|
|
70
|
+
try {
|
|
71
|
+
const result = await getByOrgId(currentOrg.value);
|
|
72
|
+
orgSubscription.value = result.status as string;
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error("failed to get the subscription", error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type TSub = {
|
|
80
|
+
amount: number;
|
|
81
|
+
payment_method_type: string;
|
|
82
|
+
payment_method_card_number?: string;
|
|
83
|
+
payment_method_expiry_month?: string;
|
|
84
|
+
payment_method_expiry_year?: string;
|
|
85
|
+
payment_method_cvv?: string;
|
|
86
|
+
payment_method_cardholder_name?: string;
|
|
87
|
+
currency?: string;
|
|
88
|
+
seats?: number;
|
|
89
|
+
organization?: TOrg;
|
|
90
|
+
billingAddress: TAddress;
|
|
91
|
+
promoCode?: string;
|
|
92
|
+
user?: string;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
function initOrgSubscription(value: TSub) {
|
|
96
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
97
|
+
"/api/subscriptions/organization",
|
|
98
|
+
{
|
|
99
|
+
method: "POST",
|
|
100
|
+
body: value,
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function initAffiliateSubscription(value: TSub) {
|
|
106
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
107
|
+
"/api/subscriptions/affiliate",
|
|
108
|
+
{
|
|
109
|
+
method: "POST",
|
|
110
|
+
body: value,
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function updateSeatsById({
|
|
116
|
+
subscriptionId = "",
|
|
117
|
+
seats = 0,
|
|
118
|
+
amount = 0,
|
|
119
|
+
promoCode = "",
|
|
120
|
+
} = {}) {
|
|
121
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
122
|
+
`/api/subscriptions/seats/${subscriptionId}`,
|
|
123
|
+
{
|
|
124
|
+
method: "PUT",
|
|
125
|
+
body: {
|
|
126
|
+
seats,
|
|
127
|
+
amount,
|
|
128
|
+
promoCode,
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
add,
|
|
136
|
+
getById,
|
|
137
|
+
getByOrgId,
|
|
138
|
+
getSubscriptions,
|
|
139
|
+
affSubscriptionStatus,
|
|
140
|
+
affiliateSubscription,
|
|
141
|
+
orgSubscriptionStatus,
|
|
142
|
+
orgSubscription,
|
|
143
|
+
getSubscriptionStatusById,
|
|
144
|
+
cancelSubscription,
|
|
145
|
+
initAffiliateSubscription,
|
|
146
|
+
initOrgSubscription,
|
|
147
|
+
getByAffiliateId,
|
|
148
|
+
updateSeatsById,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export default function useUser() {
|
|
2
|
+
function inviteUser({
|
|
3
|
+
email = "",
|
|
4
|
+
app = "",
|
|
5
|
+
role = "",
|
|
6
|
+
name = "",
|
|
7
|
+
org = "",
|
|
8
|
+
site="",
|
|
9
|
+
siteName="",
|
|
10
|
+
} = {}) {
|
|
11
|
+
return useNuxtApp().$api<Record<string, any>>("/api/auth/invite", {
|
|
12
|
+
method: "POST",
|
|
13
|
+
body: { email, app, role, name, org, ...(site && {siteId: site}), ...(siteName && {siteName}) },
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function updateName(name = "") {
|
|
18
|
+
return useNuxtApp().$api<Record<string, any>>("/api/users/name", {
|
|
19
|
+
method: "PUT",
|
|
20
|
+
body: { name },
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function updateBirthday(id: string, { month = "", day = 0, year = 0 } = {}) {
|
|
25
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/users/birthday/${id}`, {
|
|
26
|
+
method: "PATCH",
|
|
27
|
+
body: { month, day, year },
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function updateGender(gender = "") {
|
|
32
|
+
return useNuxtApp().$api<Record<string, any>>("/api/users/gender", {
|
|
33
|
+
method: "PUT",
|
|
34
|
+
body: { gender },
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function updateEmail(email = "") {
|
|
39
|
+
return useNuxtApp().$api<Record<string, any>>("/api/users/email", {
|
|
40
|
+
method: "PUT",
|
|
41
|
+
body: { email },
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function updateContact(contact = "") {
|
|
46
|
+
return useNuxtApp().$api<Record<string, any>>("/api/users/contact", {
|
|
47
|
+
method: "PUT",
|
|
48
|
+
body: { contact },
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function updatePassword(
|
|
53
|
+
id: string,
|
|
54
|
+
{ currentPassword = "", newPassword = "", passwordConfirmation = "" }
|
|
55
|
+
) {
|
|
56
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/users/password/${id}`, {
|
|
57
|
+
method: "PATCH",
|
|
58
|
+
body: { currentPassword, newPassword, passwordConfirmation },
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function updateUserFieldById(id = "", field = "", value = "") {
|
|
63
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/users/field/${id}`, {
|
|
64
|
+
method: "PATCH",
|
|
65
|
+
body: { field, value },
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function getUsers({
|
|
70
|
+
status = "active",
|
|
71
|
+
type = "",
|
|
72
|
+
search = "",
|
|
73
|
+
page = 1,
|
|
74
|
+
} = {}) {
|
|
75
|
+
return useNuxtApp().$api<Record<string, any>>("/api/users", {
|
|
76
|
+
method: "GET",
|
|
77
|
+
query: { status, search, page, type },
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function getById(id = "") {
|
|
82
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/users/id/${id}`, {
|
|
83
|
+
method: "GET",
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function createUserByInvite({
|
|
88
|
+
firstName = "",
|
|
89
|
+
lastName = "",
|
|
90
|
+
password = "",
|
|
91
|
+
id = "",
|
|
92
|
+
} = {}) {
|
|
93
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/users/invite/${id}`, {
|
|
94
|
+
method: "POST",
|
|
95
|
+
body: { firstName, lastName, password },
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function createUserByVerification({
|
|
100
|
+
name = "",
|
|
101
|
+
password = "",
|
|
102
|
+
id = "",
|
|
103
|
+
type = "",
|
|
104
|
+
} = {}) {
|
|
105
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/users/invite/${id}`, {
|
|
106
|
+
method: "POST",
|
|
107
|
+
body: { name, password, type },
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function getUserByEmail(email = "") {
|
|
112
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/users/email/${email}`, {
|
|
113
|
+
method: "GET"
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
inviteUser,
|
|
119
|
+
updateName,
|
|
120
|
+
updateBirthday,
|
|
121
|
+
updateGender,
|
|
122
|
+
updateEmail,
|
|
123
|
+
updateContact,
|
|
124
|
+
updatePassword,
|
|
125
|
+
updateUserFieldById,
|
|
126
|
+
getUsers,
|
|
127
|
+
createUserByInvite,
|
|
128
|
+
getById,
|
|
129
|
+
createUserByVerification,
|
|
130
|
+
getUserByEmail
|
|
131
|
+
};
|
|
132
|
+
}
|