@goweekdays/layer-common 1.0.0 → 1.0.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.
@@ -15,7 +15,6 @@ export default defineNuxtConfig({
15
15
  APP_ACCOUNT: (process.env.APP_ACCOUNT as string) ?? "",
16
16
  S3_BUCKET_ENDPOINT: (process.env.S3_BUCKET_ENDPOINT as string) ?? "",
17
17
  APP_ADMIN: (process.env.APP_ADMIN as string) ?? "",
18
- APP_CBA_RECAP: (process.env.APP_CBA_RECAP as string) ?? "",
19
18
  },
20
19
  },
21
20
  });
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @goweekdays/layer-common
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - d4fa4a8: Add finance app
8
+
9
+ ## 1.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 5643fd9: Add org switch
14
+
3
15
  ## 1.0.0
4
16
 
5
17
  ### Major Changes
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <v-dialog v-model="dialog" max-width="400" persistent>
3
+ <v-card class="rounded-xl pa-6" elevation="2">
4
+ <!-- Close Button -->
5
+ <v-btn
6
+ icon
7
+ variant="text"
8
+ size="small"
9
+ class="position-absolute"
10
+ style="top: 8px; right: 8px"
11
+ @click="closeDialog"
12
+ >
13
+ <v-icon>mdi-close</v-icon>
14
+ </v-btn>
15
+
16
+ <v-card-text class="text-center">
17
+ <v-row v-if="imageSrc" justify="center" class="py-10">
18
+ <v-img height="120" :src="imageSrc" alt="Dialog Image" contain />
19
+ </v-row>
20
+
21
+ <!-- Title Slot -->
22
+ <div class="text-h6 font-weight-medium mb-2">
23
+ <slot name="title"></slot>
24
+ </div>
25
+
26
+ <!-- Description Slot -->
27
+ <div class="text-body-1 mb-4">
28
+ <slot name="description"></slot>
29
+ </div>
30
+ </v-card-text>
31
+
32
+ <!-- Footer Slot -->
33
+ <v-card-actions>
34
+ <slot name="footer"></slot>
35
+ </v-card-actions>
36
+ </v-card>
37
+ </v-dialog>
38
+ </template>
39
+
40
+ <script lang="ts" setup>
41
+ const props = defineProps({
42
+ modelValue: {
43
+ type: Boolean,
44
+ default: false,
45
+ },
46
+ imageSrc: {
47
+ type: String,
48
+ default: "",
49
+ },
50
+ loading: {
51
+ type: Boolean,
52
+ default: false,
53
+ },
54
+ });
55
+
56
+ const emit = defineEmits(["update:modelValue", "submit"]);
57
+
58
+ const dialog = computed({
59
+ get: () => props.modelValue,
60
+ set: (value) => emit("update:modelValue", value),
61
+ });
62
+
63
+ function closeDialog() {
64
+ dialog.value = false;
65
+ }
66
+ </script>
@@ -0,0 +1,195 @@
1
+ <template>
2
+ <v-row no-gutters>
3
+ <v-col cols="12" class="mb-2">
4
+ <v-row no-gutters>
5
+ <v-btn
6
+ class="text-none mr-2"
7
+ rounded="pill"
8
+ variant="tonal"
9
+ :to="props.inviteRoute"
10
+ size="large"
11
+ v-if="props.inviteMember"
12
+ >
13
+ Invite member
14
+ </v-btn>
15
+ </v-row>
16
+ </v-col>
17
+
18
+ <v-col cols="12">
19
+ <v-card
20
+ width="100%"
21
+ variant="outlined"
22
+ border="thin"
23
+ rounded="lg"
24
+ :loading="loading"
25
+ >
26
+ <v-toolbar density="compact" color="grey-lighten-4">
27
+ <template #prepend>
28
+ <v-btn fab icon density="comfortable" @click="getInvitations()">
29
+ <v-icon>mdi-refresh</v-icon>
30
+ </v-btn>
31
+ </template>
32
+
33
+ <template #append>
34
+ <v-row no-gutters justify="end" align="center">
35
+ <span class="mr-2 text-caption text-fontgray">
36
+ {{ pageRange }}
37
+ </span>
38
+ <local-pagination
39
+ v-model="page"
40
+ :length="pages"
41
+ @update:value="getInvitations()"
42
+ />
43
+ </v-row>
44
+ </template>
45
+
46
+ <template #extension>
47
+ <v-tabs>
48
+ <v-tab
49
+ :to="{
50
+ name: 'org-organization-invitations-status-status',
51
+ params: { status: 'pending', organization },
52
+ }"
53
+ >
54
+ Pending
55
+ </v-tab>
56
+ <v-tab
57
+ :to="{
58
+ name: 'org-organization-invitations-status-status',
59
+ params: { status: 'expired', organization },
60
+ }"
61
+ >
62
+ Expired
63
+ </v-tab>
64
+ </v-tabs>
65
+ </template>
66
+ </v-toolbar>
67
+
68
+ <v-data-table
69
+ :headers="headers"
70
+ :items="items"
71
+ item-value="_id"
72
+ items-per-page="20"
73
+ fixed-header
74
+ hide-default-footer
75
+ hide-default-header
76
+ class="table-height"
77
+ :loading="loading"
78
+ @click:row="tableRowClickHandler"
79
+ >
80
+ <template #item.permissions="{ value }">
81
+ <span class="text-caption font-weight-bold text-capitalize">
82
+ permissions
83
+ </span>
84
+ <v-chip>{{ value.length }}</v-chip>
85
+ </template>
86
+ </v-data-table>
87
+ </v-card>
88
+ </v-col>
89
+ </v-row>
90
+ </template>
91
+
92
+ <script setup lang="ts">
93
+ const props = defineProps({
94
+ status: {
95
+ type: String,
96
+ default: "active",
97
+ },
98
+ app: {
99
+ type: String,
100
+ default: "organization",
101
+ },
102
+ inviteMember: {
103
+ type: Boolean,
104
+ default: false,
105
+ },
106
+ inviteRoute: {
107
+ type: Object as PropType<Record<string, any>>,
108
+ default: () => ({
109
+ name: "index",
110
+ params: {},
111
+ }),
112
+ },
113
+ });
114
+
115
+ const organization = (useRoute().params.organization as string) ?? "";
116
+
117
+ const headers = [
118
+ {
119
+ title: "Date",
120
+ value: "createdAt",
121
+ },
122
+ {
123
+ title: "E-mail",
124
+ value: "email",
125
+ },
126
+ {
127
+ title: "App",
128
+ value: "metadata.app",
129
+ },
130
+ ];
131
+
132
+ const { getVerifications } = useVerification();
133
+
134
+ const page = ref(1);
135
+ const pages = ref(0);
136
+ const pageRange = ref("-- - -- of --");
137
+
138
+ const items = ref<Array<Record<string, any>>>([]);
139
+ const { headerSearch } = useLocal();
140
+
141
+ const {
142
+ data: getInviteReq,
143
+ refresh: getInvitations,
144
+ status: getInviteReqStatus,
145
+ } = await useLazyAsyncData("get-invitations", () =>
146
+ getVerifications({
147
+ page: page.value,
148
+ search: headerSearch.value,
149
+ status: props.status,
150
+ type: "user-invite,member-invite",
151
+ app: props.app,
152
+ })
153
+ );
154
+
155
+ const loading = computed(() => getInviteReqStatus.value === "pending");
156
+
157
+ watchEffect(() => {
158
+ if (getInviteReq.value) {
159
+ const _items = getInviteReq.value.items;
160
+ items.value = _items.length
161
+ ? _items.map((i: Record<string, any>) => ({
162
+ ...i,
163
+ createdAt: new Date(i.createdAt).toLocaleString(),
164
+ }))
165
+ : [];
166
+ pages.value = getInviteReq.value.pages;
167
+ pageRange.value = getInviteReq.value.pageRange;
168
+ }
169
+ });
170
+
171
+ function tableRowClickHandler(_: any, row: any) {
172
+ const item = items.value[row.index];
173
+ useRouter().push({
174
+ name: "roles-permissions-id",
175
+ params: { id: item._id },
176
+ });
177
+ }
178
+
179
+ const selected = ref<Array<string>>([]);
180
+ const selectAll = ref(false);
181
+
182
+ watch(selectAll, (curr) => {
183
+ selected.value.splice(0, selected.value.length);
184
+ if (curr) {
185
+ const ids = items.value.map((i) => i._id as string);
186
+ selected.value.push(...ids);
187
+ }
188
+ });
189
+ </script>
190
+
191
+ <style scoped>
192
+ .table-height {
193
+ max-height: calc(100vh - (220px));
194
+ }
195
+ </style>
@@ -11,9 +11,9 @@
11
11
  </div>
12
12
 
13
13
  <v-row no-gutters>
14
- <v-col cols="6">
14
+ <v-col cols="12" lg="6" md="9">
15
15
  <v-text-field
16
- v-model="search"
16
+ v-model="_search"
17
17
  width="100%"
18
18
  prepend-inner-icon="mdi-magnify"
19
19
  variant="solo-filled"
@@ -171,8 +171,19 @@
171
171
  <script setup lang="ts">
172
172
  import { useTheme } from "vuetify";
173
173
 
174
+ const { getNameInitials, debounce } = useUtils();
175
+
176
+ const _search = ref("");
177
+
174
178
  const search = defineModel("search", { type: String });
175
179
 
180
+ watch(
181
+ _search,
182
+ debounce((value) => {
183
+ search.value = value;
184
+ }, 1000)
185
+ );
186
+
176
187
  const { redirect, apps, drawer } = useLocal();
177
188
 
178
189
  const {
@@ -219,8 +230,6 @@ const name = computed(() => {
219
230
  return name;
220
231
  });
221
232
 
222
- const { getNameInitials } = useUtils();
223
-
224
233
  const defaultApps = computed(() => [
225
234
  {
226
235
  title: "Account",
@@ -234,7 +243,7 @@ const defaultApps = computed(() => [
234
243
  link: APP_ORG,
235
244
  landingPage: currentUser.value?.defaultOrg
236
245
  ? `org/${currentUser.value?.defaultOrg}`
237
- : "index",
246
+ : "",
238
247
  },
239
248
  {
240
249
  title: "Admin",