@goweekdays/layer-common 0.0.1 → 0.0.3
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 +12 -0
- package/components/Layout/Header.vue +1 -1
- package/components/SwitchOrg.vue +113 -0
- package/composables/useOrg.ts +12 -2
- package/composables/usePaymentMethod.ts +29 -2
- package/package.json +4 -1
- package/plugins/vuetify.ts +0 -4
- package/public/gcash-logo.png +0 -0
- package/public/paymaya-logo.jpg +0 -0
- package/types/local.d.ts +0 -19
- package/types/subscription.d.ts +2 -2
- package/types/user.d.ts +18 -0
- package/types/verification.d.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-app-bar scroll-behavior="elevate" scroll-threshold="200">
|
|
3
|
-
<div style="width: 264px" class="ml-
|
|
3
|
+
<div style="width: 264px" class="ml-4">
|
|
4
4
|
<nuxt-link
|
|
5
5
|
class="text-h6 font-weight-medium text-decoration-none APP_NAME"
|
|
6
6
|
:to="{ name: APP_NAME_ROUTE }"
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row no-gutters class="mb-4 pl-4 fill-height" align="center">
|
|
3
|
+
<v-avatar color="surface-variant" size="28">
|
|
4
|
+
<v-img :src="profile" width="200" height="200"></v-img>
|
|
5
|
+
</v-avatar>
|
|
6
|
+
|
|
7
|
+
<v-menu
|
|
8
|
+
v-model="menu"
|
|
9
|
+
location="bottom"
|
|
10
|
+
offset="5px"
|
|
11
|
+
:close-on-content-click="false"
|
|
12
|
+
>
|
|
13
|
+
<template #activator="{ props }">
|
|
14
|
+
<v-btn variant="text" class="text-none ml-2" v-bind="props">
|
|
15
|
+
<div class="d-block text-truncate" style="max-width: 130px">
|
|
16
|
+
{{ selectedOrg?.text || "Select organization" }}
|
|
17
|
+
</div>
|
|
18
|
+
<v-icon class="ml-1">mdi-menu-down</v-icon>
|
|
19
|
+
</v-btn>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<v-card width="300px" rounded="lg" class="pa-4">
|
|
23
|
+
<span class="text-subtitle-2 font-weight-bold">
|
|
24
|
+
Switch organization context
|
|
25
|
+
</span>
|
|
26
|
+
<v-text-field density="compact" width="100%" hide-details class="mb-2">
|
|
27
|
+
<template #prepend-inner>
|
|
28
|
+
<v-icon>mdi-magnify</v-icon>
|
|
29
|
+
</template>
|
|
30
|
+
</v-text-field>
|
|
31
|
+
<v-divider />
|
|
32
|
+
<v-list class="pa-0 my-2" density="compact" max-height="200px">
|
|
33
|
+
<v-list-item
|
|
34
|
+
density="compact"
|
|
35
|
+
class="text-caption font-weight-bold"
|
|
36
|
+
v-for="item in orgs"
|
|
37
|
+
:key="item.value"
|
|
38
|
+
@click="switchOrg(item.value)"
|
|
39
|
+
>
|
|
40
|
+
<v-icon size="16" class="mr-2">
|
|
41
|
+
{{ currentOrg === item.value ? "mdi-check" : "" }}
|
|
42
|
+
</v-icon>
|
|
43
|
+
|
|
44
|
+
{{ item.text }}
|
|
45
|
+
</v-list-item>
|
|
46
|
+
</v-list>
|
|
47
|
+
|
|
48
|
+
<v-btn
|
|
49
|
+
block
|
|
50
|
+
class="text-none mb-1"
|
|
51
|
+
variant="tonal"
|
|
52
|
+
:to="{ name: 'organizations' }"
|
|
53
|
+
>
|
|
54
|
+
Manage Organizations
|
|
55
|
+
</v-btn>
|
|
56
|
+
<v-btn
|
|
57
|
+
block
|
|
58
|
+
class="text-none mt-1"
|
|
59
|
+
variant="tonal"
|
|
60
|
+
:to="{ name: 'organizations-create' }"
|
|
61
|
+
>
|
|
62
|
+
Create Organization
|
|
63
|
+
</v-btn>
|
|
64
|
+
</v-card>
|
|
65
|
+
</v-menu>
|
|
66
|
+
</v-row>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script setup lang="ts">
|
|
70
|
+
const { currentUser } = useLocalAuth();
|
|
71
|
+
|
|
72
|
+
const menu = ref(false);
|
|
73
|
+
|
|
74
|
+
const profile = computed(() => {
|
|
75
|
+
return `/api/public/${currentUser.value?.profile}`;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const { getOrgs: _getOrgs, currentOrg } = useOrg();
|
|
79
|
+
|
|
80
|
+
const orgs = ref<Array<Record<string, any>>>([]);
|
|
81
|
+
const page = ref(1);
|
|
82
|
+
|
|
83
|
+
const selectedOrg = ref<Record<string, any> | null>();
|
|
84
|
+
|
|
85
|
+
function setOrg() {
|
|
86
|
+
selectedOrg.value = orgs.value.find((org) => org.value === currentOrg.value);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
watch(currentOrg, () => {
|
|
90
|
+
menu.value = false;
|
|
91
|
+
setOrg();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
async function getOrgs() {
|
|
95
|
+
try {
|
|
96
|
+
const res = await _getOrgs({ user: currentUser.value?._id });
|
|
97
|
+
orgs.value = res.items;
|
|
98
|
+
page.value = res.page;
|
|
99
|
+
setOrg();
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.log(error);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
getOrgs();
|
|
106
|
+
|
|
107
|
+
function switchOrg(org: string) {
|
|
108
|
+
navigateTo({
|
|
109
|
+
name: "org-organization",
|
|
110
|
+
params: { organization: org },
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
</script>
|
package/composables/useOrg.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export default function useOrg() {
|
|
2
|
-
function getOrgs({ page = 1, search = "", user = "" } = {}) {
|
|
3
|
-
return useNuxtApp().$api<
|
|
2
|
+
function getOrgs({ page = 1, search = "", user = "", limit = 20 } = {}) {
|
|
3
|
+
return useNuxtApp().$api<Record<string, any>>("/api/organizations", {
|
|
4
4
|
method: "GET",
|
|
5
5
|
query: {
|
|
6
6
|
page,
|
|
7
7
|
search,
|
|
8
8
|
user,
|
|
9
|
+
limit,
|
|
9
10
|
},
|
|
10
11
|
});
|
|
11
12
|
}
|
|
@@ -60,6 +61,14 @@ export default function useOrg() {
|
|
|
60
61
|
});
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
const { currentUser } = useLocalAuth();
|
|
65
|
+
|
|
66
|
+
const currentOrg = computed(
|
|
67
|
+
() =>
|
|
68
|
+
(useRoute().params.organization as string) ||
|
|
69
|
+
currentUser.value?.defaultOrg
|
|
70
|
+
);
|
|
71
|
+
|
|
63
72
|
return {
|
|
64
73
|
org,
|
|
65
74
|
getOrgs,
|
|
@@ -69,5 +78,6 @@ export default function useOrg() {
|
|
|
69
78
|
seats,
|
|
70
79
|
total,
|
|
71
80
|
getByName,
|
|
81
|
+
currentOrg,
|
|
72
82
|
};
|
|
73
83
|
}
|
|
@@ -2,6 +2,8 @@ export default function usePaymentMethod() {
|
|
|
2
2
|
function linkEWallet({
|
|
3
3
|
mobile_number = "",
|
|
4
4
|
type = "GCASH",
|
|
5
|
+
org = "",
|
|
6
|
+
user = "",
|
|
5
7
|
success_return_url = "",
|
|
6
8
|
failure_return_url = "",
|
|
7
9
|
cancel_return_url = "",
|
|
@@ -14,6 +16,8 @@ export default function usePaymentMethod() {
|
|
|
14
16
|
body: {
|
|
15
17
|
mobile_number,
|
|
16
18
|
type,
|
|
19
|
+
user,
|
|
20
|
+
org,
|
|
17
21
|
success_return_url,
|
|
18
22
|
failure_return_url,
|
|
19
23
|
cancel_return_url,
|
|
@@ -52,18 +56,41 @@ export default function usePaymentMethod() {
|
|
|
52
56
|
});
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
function getByUser() {
|
|
59
|
+
function getByUser(user = "") {
|
|
56
60
|
return useNuxtApp().$api<Array<Record<string, any>>>(
|
|
57
|
-
|
|
61
|
+
`/api/payment-methods/user/${user}`,
|
|
58
62
|
{
|
|
59
63
|
method: "GET",
|
|
60
64
|
}
|
|
61
65
|
);
|
|
62
66
|
}
|
|
63
67
|
|
|
68
|
+
function getByOrg(org = "") {
|
|
69
|
+
return useNuxtApp().$api<Array<Record<string, any>>>(
|
|
70
|
+
`/api/payment-methods/org/${org}`,
|
|
71
|
+
{
|
|
72
|
+
method: "GET",
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const eWalletNumber = useState("eWalletNumber", () => "");
|
|
78
|
+
const cardNumber = useState("cardNumber", () => "");
|
|
79
|
+
const cardExpiration = useState("cardExpiration", () => "");
|
|
80
|
+
const cardSecurityCode = useState("cardSecurityCode", () => "");
|
|
81
|
+
const cardholderName = useState("cardholderName", () => "");
|
|
82
|
+
const selectedPaymentMethod = useState("selectedPaymentMethod", () => "");
|
|
83
|
+
|
|
64
84
|
return {
|
|
65
85
|
linkEWallet,
|
|
66
86
|
linkCard,
|
|
67
87
|
getByUser,
|
|
88
|
+
getByOrg,
|
|
89
|
+
eWalletNumber,
|
|
90
|
+
cardNumber,
|
|
91
|
+
cardExpiration,
|
|
92
|
+
cardSecurityCode,
|
|
93
|
+
cardholderName,
|
|
94
|
+
selectedPaymentMethod,
|
|
68
95
|
};
|
|
69
96
|
}
|
package/package.json
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
"name": "@goweekdays/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.3",
|
|
6
6
|
"main": "./nuxt.config.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
7
10
|
"scripts": {
|
|
8
11
|
"dev": "nuxi dev .playground",
|
|
9
12
|
"dev:prepare": "nuxt prepare .playground",
|
package/plugins/vuetify.ts
CHANGED
|
@@ -3,7 +3,6 @@ import "@mdi/font/css/materialdesignicons.css";
|
|
|
3
3
|
|
|
4
4
|
import "vuetify/styles";
|
|
5
5
|
import { createVuetify } from "vuetify";
|
|
6
|
-
import { VStepperVertical } from "vuetify/labs/VStepperVertical";
|
|
7
6
|
|
|
8
7
|
const defaultTheme = {
|
|
9
8
|
dark: false,
|
|
@@ -35,9 +34,6 @@ export default defineNuxtPlugin((app) => {
|
|
|
35
34
|
defaultTheme,
|
|
36
35
|
},
|
|
37
36
|
},
|
|
38
|
-
components: {
|
|
39
|
-
VStepperVertical,
|
|
40
|
-
},
|
|
41
37
|
});
|
|
42
38
|
|
|
43
39
|
app.vueApp.use(vuetify);
|
|
Binary file
|
|
Binary file
|
package/types/local.d.ts
CHANGED
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
declare type TUser = {
|
|
2
|
-
_id: string;
|
|
3
|
-
email: string;
|
|
4
|
-
password: string;
|
|
5
|
-
firstName: string;
|
|
6
|
-
middleName?: string;
|
|
7
|
-
lastName: string;
|
|
8
|
-
suffix?: string;
|
|
9
|
-
birthMonth?: string;
|
|
10
|
-
birthDate?: string;
|
|
11
|
-
birthYear?: string;
|
|
12
|
-
profile?: string;
|
|
13
|
-
defaultOrg?: string;
|
|
14
|
-
createdAt: string;
|
|
15
|
-
updatedAt: string;
|
|
16
|
-
status: string;
|
|
17
|
-
deletedAt: string;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
1
|
declare type TToken = {
|
|
21
2
|
accessToken: string;
|
|
22
3
|
refreshToken: string;
|
package/types/subscription.d.ts
CHANGED
package/types/user.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare type TUser = {
|
|
2
|
+
_id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
password: string;
|
|
5
|
+
firstName: string;
|
|
6
|
+
middleName?: string;
|
|
7
|
+
lastName: string;
|
|
8
|
+
suffix?: string;
|
|
9
|
+
birthMonth?: string;
|
|
10
|
+
birthDate?: string;
|
|
11
|
+
birthYear?: string;
|
|
12
|
+
profile?: string;
|
|
13
|
+
defaultOrg?: string;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
status: string;
|
|
17
|
+
deletedAt: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare type TVerificationMetadata = {
|
|
2
|
+
app?: string;
|
|
3
|
+
role?: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
declare type TVerification = {
|
|
7
|
+
_id?: string;
|
|
8
|
+
type: string;
|
|
9
|
+
email: string;
|
|
10
|
+
metadata?: TVerificationMetadata;
|
|
11
|
+
status?: string;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt?: string | null;
|
|
14
|
+
expireAt: string;
|
|
15
|
+
};
|