@iservice365/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 +5 -89
- package/components/Layout/NavigationDrawer.vue +68 -2
- package/components/NavigationItem.vue +23 -1
- package/composables/useLocal.ts +0 -7
- package/composables/useLocalAuth.ts +2 -8
- package/composables/useUtils.ts +7 -0
- package/error.vue +41 -0
- package/layouts/plain.vue +7 -0
- package/nuxt.config.ts +9 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-app-bar scroll-behavior="elevate" scroll-threshold="200">
|
|
3
3
|
<div style="width: 264px" class="ml-2">
|
|
4
|
-
<
|
|
5
|
-
class="text-h6 font-weight-medium text-decoration-none APP_NAME"
|
|
6
|
-
:to="{ name: APP_NAME_ROUTE }"
|
|
7
|
-
>
|
|
8
|
-
{{ APP_NAME }}
|
|
9
|
-
</nuxt-link>
|
|
4
|
+
<v-app-bar-nav-icon @click="drawer = !drawer"></v-app-bar-nav-icon>
|
|
10
5
|
</div>
|
|
11
6
|
|
|
12
7
|
<v-row no-gutters>
|
|
@@ -32,86 +27,6 @@
|
|
|
32
27
|
@click="toggleTheme"
|
|
33
28
|
/>
|
|
34
29
|
|
|
35
|
-
<v-menu offset="10px" :close-on-content-click="false">
|
|
36
|
-
<template #activator="{ props }">
|
|
37
|
-
<v-btn icon="mdi-dots-grid" variant="text" v-bind="props" />
|
|
38
|
-
</template>
|
|
39
|
-
|
|
40
|
-
<v-card
|
|
41
|
-
width="380"
|
|
42
|
-
max-height="400px"
|
|
43
|
-
elevation="2"
|
|
44
|
-
rounded="xl"
|
|
45
|
-
class="pa-4"
|
|
46
|
-
>
|
|
47
|
-
<v-row no-gutters>
|
|
48
|
-
<v-col cols="12">
|
|
49
|
-
<v-card width="100%" variant="tonal" rounded="t-xl b-0">
|
|
50
|
-
<v-row class="pa-4">
|
|
51
|
-
<v-col cols="4">
|
|
52
|
-
<v-btn
|
|
53
|
-
prepend-icon="mdi-account"
|
|
54
|
-
stacked
|
|
55
|
-
rounded="xl"
|
|
56
|
-
variant="text"
|
|
57
|
-
class="text-capitalize text-subtitle-2"
|
|
58
|
-
@click="redirect(APP_ACCOUNT, 'home')"
|
|
59
|
-
>
|
|
60
|
-
Account
|
|
61
|
-
</v-btn>
|
|
62
|
-
</v-col>
|
|
63
|
-
|
|
64
|
-
<v-col cols="4">
|
|
65
|
-
<v-btn
|
|
66
|
-
prepend-icon="mdi-security"
|
|
67
|
-
stacked
|
|
68
|
-
rounded="xl"
|
|
69
|
-
variant="text"
|
|
70
|
-
class="text-capitalize text-subtitle-2"
|
|
71
|
-
@click="redirect(APP_ADMIN, 'home')"
|
|
72
|
-
>
|
|
73
|
-
Admin
|
|
74
|
-
</v-btn>
|
|
75
|
-
</v-col>
|
|
76
|
-
</v-row>
|
|
77
|
-
</v-card>
|
|
78
|
-
</v-col>
|
|
79
|
-
|
|
80
|
-
<v-col cols=" 12" class="mt-2">
|
|
81
|
-
<v-card
|
|
82
|
-
width="100%"
|
|
83
|
-
min-height="50px"
|
|
84
|
-
variant="tonal"
|
|
85
|
-
rounded="b-xl"
|
|
86
|
-
>
|
|
87
|
-
<v-card-title class="text-center pb-0"> Apps </v-card-title>
|
|
88
|
-
|
|
89
|
-
<v-row no-gutters class="px-2 pb-2">
|
|
90
|
-
<v-col
|
|
91
|
-
v-for="item in apps"
|
|
92
|
-
:key="item.title"
|
|
93
|
-
cols="4"
|
|
94
|
-
class="pa-2"
|
|
95
|
-
>
|
|
96
|
-
<v-btn
|
|
97
|
-
stacked
|
|
98
|
-
width="100%"
|
|
99
|
-
:prepend-icon="item.icon"
|
|
100
|
-
rounded="xl"
|
|
101
|
-
variant="text"
|
|
102
|
-
class="text-center text-capitalize text-caption"
|
|
103
|
-
@click="redirect(item.link, item.landingPage)"
|
|
104
|
-
>
|
|
105
|
-
{{ item.title }}
|
|
106
|
-
</v-btn>
|
|
107
|
-
</v-col>
|
|
108
|
-
</v-row>
|
|
109
|
-
</v-card>
|
|
110
|
-
</v-col>
|
|
111
|
-
</v-row>
|
|
112
|
-
</v-card>
|
|
113
|
-
</v-menu>
|
|
114
|
-
|
|
115
30
|
<v-menu offset="10px" :close-on-content-click="false">
|
|
116
31
|
<template #activator="{ props }">
|
|
117
32
|
<v-btn fab variant="text" icon v-bind="props" class="mx-2">
|
|
@@ -181,10 +96,11 @@ import { useTheme } from "vuetify";
|
|
|
181
96
|
|
|
182
97
|
const search = defineModel("search", { type: String });
|
|
183
98
|
|
|
184
|
-
const {
|
|
99
|
+
const { drawer } = useLocal();
|
|
100
|
+
|
|
101
|
+
const { redirect } = useUtils();
|
|
185
102
|
|
|
186
|
-
const { APP_ACCOUNT,
|
|
187
|
-
useRuntimeConfig().public;
|
|
103
|
+
const { APP_ACCOUNT, APP_NAME, APP_NAME_ROUTE } = useRuntimeConfig().public;
|
|
188
104
|
|
|
189
105
|
const theme = useTheme();
|
|
190
106
|
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<v-navigation-drawer
|
|
2
|
+
<v-navigation-drawer
|
|
3
|
+
v-model="drawer"
|
|
4
|
+
permanent
|
|
5
|
+
floating
|
|
6
|
+
class="pr-2 bg-primary"
|
|
7
|
+
>
|
|
3
8
|
<v-list>
|
|
4
|
-
<
|
|
9
|
+
<v-list-item>
|
|
10
|
+
<v-list-item-content>
|
|
11
|
+
<v-list-item-title class="text-h6 text-white">
|
|
12
|
+
{{ APP_NAME }}
|
|
13
|
+
</v-list-item-title>
|
|
14
|
+
</v-list-item-content>
|
|
15
|
+
</v-list-item>
|
|
16
|
+
<slot name="action" />
|
|
5
17
|
<template
|
|
6
18
|
v-for="(navigationItem, navigationIndex) in props.navigationItems"
|
|
7
19
|
:key="`${navigationItem.route.name}-${navigationIndex}`"
|
|
@@ -13,6 +25,21 @@
|
|
|
13
25
|
:children="navigationItem.children"
|
|
14
26
|
/>
|
|
15
27
|
</template>
|
|
28
|
+
|
|
29
|
+
<v-list-subheader>
|
|
30
|
+
<span class="font-weight-bold text-white">Services</span>
|
|
31
|
+
</v-list-subheader>
|
|
32
|
+
<template
|
|
33
|
+
v-for="(service, serviceIndex) in services"
|
|
34
|
+
:key="`${service.id}-${serviceIndex}`"
|
|
35
|
+
>
|
|
36
|
+
<NavigationItem
|
|
37
|
+
:name="`${service.id}-${serviceIndex}`"
|
|
38
|
+
:title="service.title"
|
|
39
|
+
:icon="service.icon"
|
|
40
|
+
:link="service.link"
|
|
41
|
+
/>
|
|
42
|
+
</template>
|
|
16
43
|
</v-list>
|
|
17
44
|
</v-navigation-drawer>
|
|
18
45
|
</template>
|
|
@@ -21,4 +48,43 @@
|
|
|
21
48
|
const props = defineProps({
|
|
22
49
|
navigationItems: { type: Array<TNavigationItem>, required: true },
|
|
23
50
|
});
|
|
51
|
+
|
|
52
|
+
const { drawer } = useLocal();
|
|
53
|
+
|
|
54
|
+
const {
|
|
55
|
+
APP_NAME,
|
|
56
|
+
APP_SECURITY,
|
|
57
|
+
APP_HYGIENE,
|
|
58
|
+
APP_PROPERTY_MANAGEMENT,
|
|
59
|
+
APP_MECHANICAL_ELECTRICAL,
|
|
60
|
+
} = useRuntimeConfig().public;
|
|
61
|
+
|
|
62
|
+
const services = computed(() => {
|
|
63
|
+
return [
|
|
64
|
+
{
|
|
65
|
+
id: "security",
|
|
66
|
+
title: "Security",
|
|
67
|
+
icon: "mdi-shield",
|
|
68
|
+
link: APP_SECURITY,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: "hygiene",
|
|
72
|
+
title: "Hygiene",
|
|
73
|
+
icon: "mdi-spray",
|
|
74
|
+
link: APP_HYGIENE,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "property-management",
|
|
78
|
+
title: "Property Management",
|
|
79
|
+
icon: "mdi-home",
|
|
80
|
+
link: APP_PROPERTY_MANAGEMENT,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "mechanical-electrical",
|
|
84
|
+
title: "Mechanical & Electrical",
|
|
85
|
+
icon: "mdi-wrench",
|
|
86
|
+
link: APP_MECHANICAL_ELECTRICAL,
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
});
|
|
24
90
|
</script>
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
</v-list-group>
|
|
23
23
|
|
|
24
24
|
<v-list-item
|
|
25
|
-
v-
|
|
25
|
+
v-if="props.route.name"
|
|
26
|
+
:key="props.name"
|
|
26
27
|
:prepend-icon="icon"
|
|
27
28
|
:to="props.route"
|
|
28
29
|
rounded="e-pill"
|
|
@@ -30,6 +31,17 @@
|
|
|
30
31
|
>
|
|
31
32
|
{{ title }}
|
|
32
33
|
</v-list-item>
|
|
34
|
+
|
|
35
|
+
<v-list-item
|
|
36
|
+
v-if="props.link"
|
|
37
|
+
:key="props.name"
|
|
38
|
+
:prepend-icon="icon"
|
|
39
|
+
:href="props.link"
|
|
40
|
+
rounded="e-pill"
|
|
41
|
+
class="text-subtitle-2"
|
|
42
|
+
>
|
|
43
|
+
{{ title }}
|
|
44
|
+
</v-list-item>
|
|
33
45
|
</template>
|
|
34
46
|
|
|
35
47
|
<script setup lang="ts">
|
|
@@ -50,10 +62,20 @@ const props = defineProps({
|
|
|
50
62
|
return { name: "", params: {} };
|
|
51
63
|
},
|
|
52
64
|
},
|
|
65
|
+
link: {
|
|
66
|
+
type: String,
|
|
67
|
+
required: false,
|
|
68
|
+
default: "",
|
|
69
|
+
},
|
|
53
70
|
children: {
|
|
54
71
|
type: Array<TNavigationItem>,
|
|
55
72
|
required: false,
|
|
56
73
|
default: () => [],
|
|
57
74
|
},
|
|
75
|
+
name: {
|
|
76
|
+
type: String,
|
|
77
|
+
required: false,
|
|
78
|
+
default: "",
|
|
79
|
+
},
|
|
58
80
|
});
|
|
59
81
|
</script>
|
package/composables/useLocal.ts
CHANGED
|
@@ -22,12 +22,6 @@ export default function useLocal() {
|
|
|
22
22
|
];
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
function redirect(link: string, page?: string) {
|
|
26
|
-
const href = page ? `${link}/${page}` : link;
|
|
27
|
-
|
|
28
|
-
window.location.href = href;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
25
|
const headerSearch = useState("headerSearch", () => "");
|
|
32
26
|
|
|
33
27
|
return {
|
|
@@ -35,7 +29,6 @@ export default function useLocal() {
|
|
|
35
29
|
getUserFromCookie,
|
|
36
30
|
drawer,
|
|
37
31
|
apps,
|
|
38
|
-
redirect,
|
|
39
32
|
headerSearch,
|
|
40
33
|
};
|
|
41
34
|
}
|
|
@@ -2,22 +2,16 @@ export default function useLocalAuth() {
|
|
|
2
2
|
const { cookieConfig } = useRuntimeConfig().public;
|
|
3
3
|
|
|
4
4
|
async function login({ email = "", password = "" }) {
|
|
5
|
-
return useNuxtApp().$api<
|
|
5
|
+
return useNuxtApp().$api<Record<string, any>>("/api/auth", {
|
|
6
6
|
method: "POST",
|
|
7
7
|
body: JSON.stringify({ email, password }),
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
function setToken({
|
|
12
|
-
refreshToken = "",
|
|
13
|
-
accessToken = "",
|
|
14
|
-
user = "",
|
|
15
|
-
org = "",
|
|
16
|
-
}) {
|
|
11
|
+
function setToken({ refreshToken = "", accessToken = "", user = "" }) {
|
|
17
12
|
useCookie("accessToken", cookieConfig).value = accessToken;
|
|
18
13
|
useCookie("refreshToken", cookieConfig).value = refreshToken;
|
|
19
14
|
useCookie("user", cookieConfig).value = user;
|
|
20
|
-
useCookie("org", cookieConfig).value = org;
|
|
21
15
|
}
|
|
22
16
|
|
|
23
17
|
function clearCookies() {
|
package/composables/useUtils.ts
CHANGED
|
@@ -93,6 +93,12 @@ export default function useUtils() {
|
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
function redirect(link: string, page?: string) {
|
|
97
|
+
const href = page ? `${link}/${page}` : link;
|
|
98
|
+
|
|
99
|
+
window.location.href = href;
|
|
100
|
+
}
|
|
101
|
+
|
|
96
102
|
return {
|
|
97
103
|
requiredRule,
|
|
98
104
|
emailRule,
|
|
@@ -105,5 +111,6 @@ export default function useUtils() {
|
|
|
105
111
|
insertBetween,
|
|
106
112
|
getNameInitials,
|
|
107
113
|
getDimensions,
|
|
114
|
+
redirect,
|
|
108
115
|
};
|
|
109
116
|
}
|
package/error.vue
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { NuxtError } from "#app";
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
error: Object as () => NuxtError,
|
|
6
|
+
});
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<v-app>
|
|
11
|
+
<v-main>
|
|
12
|
+
<v-row
|
|
13
|
+
class="fill-height"
|
|
14
|
+
no-gutters
|
|
15
|
+
justify="center"
|
|
16
|
+
align-content="center"
|
|
17
|
+
>
|
|
18
|
+
<v-col cols="9">
|
|
19
|
+
<v-row>
|
|
20
|
+
<v-col cols="12" class="text-center text-h2">
|
|
21
|
+
<span class="font-weight-bold">{{ props.error?.message }}</span>
|
|
22
|
+
</v-col>
|
|
23
|
+
<v-col cols="12">
|
|
24
|
+
<v-row no-gutters justify="center">
|
|
25
|
+
<v-btn
|
|
26
|
+
rounded="xl"
|
|
27
|
+
size="large"
|
|
28
|
+
class="text-none font-weight-bold"
|
|
29
|
+
variant="tonal"
|
|
30
|
+
:to="{ name: 'index' }"
|
|
31
|
+
>
|
|
32
|
+
Go back
|
|
33
|
+
</v-btn>
|
|
34
|
+
</v-row>
|
|
35
|
+
</v-col>
|
|
36
|
+
</v-row>
|
|
37
|
+
</v-col>
|
|
38
|
+
</v-row>
|
|
39
|
+
</v-main>
|
|
40
|
+
</v-app>
|
|
41
|
+
</template>
|
package/nuxt.config.ts
CHANGED
|
@@ -13,31 +13,20 @@ export default defineNuxtConfig({
|
|
|
13
13
|
secure: true,
|
|
14
14
|
maxAge: 30 * 24 * 60 * 60,
|
|
15
15
|
},
|
|
16
|
+
API_DO_STORAGE_ENDPOINT:
|
|
17
|
+
(process.env.API_DO_STORAGE_ENDPOINT as string) ?? "",
|
|
16
18
|
APP_NAME: (process.env.APP_NAME as string) ?? "App",
|
|
17
19
|
APP_NAME_ROUTE: (process.env.APP_NAME_ROUTE as string) ?? "index",
|
|
20
|
+
APP_MAIN: (process.env.APP_MAIN as string) ?? "",
|
|
18
21
|
APP_ACCOUNT: (process.env.APP_ACCOUNT as string) ?? "",
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
APP_SCHOOL_HQ: (process.env.APP_SCHOOL_HQ as string) ?? "",
|
|
24
|
-
APP_STUDENT_ZONE: (process.env.APP_STUDENT_ZONE as string) ?? "",
|
|
25
|
-
APP_PARENT_PORTAL: (process.env.APP_PARENT_PORTAL as string) ?? "",
|
|
26
|
-
APP_BOOK_KEEPING: (process.env.APP_BOOK_KEEPING as string) ?? "",
|
|
27
|
-
APP_ASSET_MANAGEMENT: (process.env.APP_ASSET as string) ?? "",
|
|
28
|
-
APP_EMPLOYEE_MANAGEMENT:
|
|
29
|
-
(process.env.APP_EMPLOYEE_MANAGEMENT as string) ?? "",
|
|
30
|
-
APP_PAYROLL: (process.env.APP_PAYROLL as string) ?? "",
|
|
31
|
-
APP_ATTENDANCE_KEEPING:
|
|
32
|
-
(process.env.APP_ATTENDANCE_KEEPING as string) ?? "",
|
|
33
|
-
APP_LEAVE_MANAGEMENT: (process.env.APP_LEAVE_MANAGEMENT as string) ?? "",
|
|
22
|
+
APP_ADMIN: (process.env.APP_ADMIN as string) ?? "",
|
|
23
|
+
APP_ORG: (process.env.APP_ORG as string) ?? "",
|
|
24
|
+
APP_HYGIENE: (process.env.APP_HYGIENE as string) ?? "",
|
|
25
|
+
APP_SECURITY: (process.env.APP_SECURITY as string) ?? "",
|
|
34
26
|
APP_PROPERTY_MANAGEMENT:
|
|
35
27
|
(process.env.APP_PROPERTY_MANAGEMENT as string) ?? "",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
(process.env.API_DO_STORAGE_ENDPOINT as string) ?? "",
|
|
39
|
-
APP_ADMIN: (process.env.APP_ADMIN as string) ?? "",
|
|
40
|
-
APP_RECAP: (process.env.APP_RECAP as string) ?? "",
|
|
28
|
+
APP_MECHANICAL_ELECTRICAL:
|
|
29
|
+
(process.env.APP_MECHANICAL_ELECTRICAL as string) ?? "",
|
|
41
30
|
},
|
|
42
31
|
},
|
|
43
32
|
|