@simitgroup/simpleapp-generator 1.6.4-alpha → 1.6.4-b-alpha

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 (27) hide show
  1. package/package.json +1 -1
  2. package/templates/basic/nest/controller.ts.eta +1 -1
  3. package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +21 -8
  4. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +9 -5
  5. package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +7 -12
  6. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +17 -13
  7. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +14 -11
  8. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +13 -8
  9. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +54 -47
  10. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +10 -11
  11. package/templates/nuxt/components/form/FormUser.vue._eta +2 -4
  12. package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +34 -16
  13. package/templates/nuxt/components/renderer/RendererDate.vue.eta +1 -1
  14. package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +10 -5
  15. package/templates/nuxt/components/select/SelectTemplate.vue.eta +27 -22
  16. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +2 -2
  17. package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +37 -41
  18. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +57 -25
  19. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +11 -10
  20. package/templates/nuxt/components/user/UserButtonPermissionInfo.vue.eta +17 -8
  21. package/templates/nuxt/components/user/UserInvitation.vue.eta +53 -45
  22. package/templates/nuxt/components/user/UserTenantPicker.vue.eta +31 -70
  23. package/templates/nuxt/composables/getUserStore.generate.ts.eta +3 -2
  24. package/templates/nuxt/composables/roles.generate.ts.eta +1 -0
  25. package/templates/nuxt/error.vue._eta +4 -2
  26. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +12 -3
  27. package/templates/project/lang/default._json +4 -1
@@ -23,19 +23,24 @@ type SettingProp = { collection: SimpleAppDocumentType; displayField?: string };
23
23
  const modelValue = defineModel<ForeignKey>();
24
24
 
25
25
  const emits = defineEmits(["after"]);
26
- const props = defineProps<{value?:ForeignKey; setting: SettingProp }>();
26
+ const props = defineProps<{ value?: ForeignKey; setting: SettingProp }>();
27
27
  const displayText = computed(() => {
28
28
  const s = props.setting;
29
29
  if (!modelValue.value && !props.value) return undefined;
30
- else if (!s.collection) return modelValue.value??props.value;
31
- else if (s.displayField) return modelValue.value[s.displayField] ??props.value[s.displayField];
32
- else return modelValue.value?.label ??props.value?.label;
30
+ else if (!s.collection) return modelValue.value ?? props.value;
31
+ else if (s.displayField) {
32
+ if(modelValue.value) return modelValue.value[s.displayField]
33
+ else if (props.value) props.value[s.displayField];
34
+ else return ''
35
+ }
36
+
37
+ else return modelValue.value?.label ?? props.value?.label;
33
38
  });
34
39
  const { $event } = useNuxtApp();
35
40
  const viewer = ref();
36
41
  const viewRecord = () => {
37
42
  viewer.value = getDocument(props.setting.collection)?.viewer;
38
- const value = modelValue.value?? props.value
43
+ const value = modelValue.value ?? props.value;
39
44
  // getDocumentUrl(setting.collection,modelValue ? modelValue['_id']:'')
40
45
  //getDocumentUrl(setting.collection,modelValue ? modelValue['_id']:'')
41
46
  $event("ViewRecord", {
@@ -25,15 +25,17 @@
25
25
  filter
26
26
  :placeholder="placeholder"
27
27
  >
28
- <template #value="slotProps">
29
- <slot name="value" :slotProps="slotProps">
30
- </slot>
31
- </template>
32
- <template #option="slotProps">
33
- <slot name="default" :option="slotProps.option" :index="slotProps.index">
34
- </slot>
35
- </template>
36
-
28
+ <template #value="slotProps">
29
+ <slot name="value" :slotProps="slotProps"> </slot>
30
+ </template>
31
+ <template #option="slotProps">
32
+ <slot
33
+ name="default"
34
+ :option="slotProps.option"
35
+ :index="slotProps.index"
36
+ >
37
+ </slot>
38
+ </template>
37
39
  </MultiSelect>
38
40
  <Dropdown
39
41
  class="w-full md:w-full"
@@ -47,13 +49,16 @@
47
49
  optionValue="value"
48
50
  :placeholder="placeholder"
49
51
  >
50
- <template #value="slotProps">
51
- <slot name="value" :item="getItem(modelValue)"></slot>
52
- </template>
53
- <template #option="slotProps" >
54
- <slot name="default" :option="slotProps.option" :index="slotProps.index"></slot>
52
+ <template #value="slotProps">
53
+ <slot name="value" :item="getItem(modelValue)"></slot>
54
+ </template>
55
+ <template #option="slotProps">
56
+ <slot
57
+ name="default"
58
+ :option="slotProps.option"
59
+ :index="slotProps.index"
60
+ ></slot>
55
61
  </template>
56
-
57
62
  </Dropdown>
58
63
  </div>
59
64
  </template>
@@ -80,7 +85,7 @@ const props = defineProps<{
80
85
  }>();
81
86
  // const initvalue = props.multiple==true ? [] : ''
82
87
  const modelValue = defineModel<string | string[]>();
83
-
88
+ const allowAddNew = computed(()=> props.allowAddNew && canPerform(props.documentName,'create'))
84
89
  const list = ref<ForeignKey[]>([]);
85
90
  const fieldid = randomUUID();
86
91
 
@@ -88,7 +93,7 @@ const options = ref<
88
93
  {
89
94
  value: string;
90
95
  label: string;
91
- more:any;
96
+ more: any;
92
97
  }[]
93
98
  >([]);
94
99
  const getListOptions = async () => {
@@ -102,17 +107,17 @@ const getListOptions = async () => {
102
107
  options.value = list.value.map((item) => ({
103
108
  value: item._id,
104
109
  label: item.label,
105
- more: item
110
+ more: item,
106
111
  }));
107
112
  };
108
113
  onMounted(async () => {
109
-
110
114
  await getListOptions();
111
115
  if (modelValue.value) change(modelValue.value);
112
116
  });
113
- const getItem = (id: string) => list.value?.find((item) => {
114
- return item._id == id
115
- });
117
+ const getItem = (id: string) =>
118
+ list.value?.find((item) => {
119
+ return item._id == id;
120
+ });
116
121
 
117
122
  const change = (id: string | string[]) => {
118
123
  const selectedItem = getItem(id);
@@ -285,7 +285,7 @@ const getListFromAutocompleteApi = (event: any) => {
285
285
  console.log("Run autocomplete?");
286
286
  list.value = res.data;
287
287
 
288
- if (props.allowAddNew) {
288
+ if (props.allowAddNew && canPerform(upperFirst(targetDocument),'create')) {
289
289
  list.value = list.value.concat({
290
290
  _id: "new",
291
291
  label: "<" + t("new") + ">",
@@ -333,7 +333,7 @@ const setFocus = (ev: any) => {
333
333
  const openViewer = (readonly: boolean) => {
334
334
  if (remotedoc) {
335
335
  $event("ViewRecord", {
336
- _id: (modelValue.value?._id ?? '' )as string,
336
+ _id: (modelValue.value?._id ?? "") as string,
337
337
  eventId: randomUUID(),
338
338
  label: (readonly
339
339
  ? modelValue.value?.label
@@ -2,63 +2,59 @@
2
2
  <Calendar
3
3
  :pt="pt"
4
4
  :inputId="uuid"
5
- :path="setting.instancepath"
5
+ :path="setting.instancepath"
6
6
  v-model="datetimevalue"
7
- @update:modelValue="updateDateTime"
7
+ @update:modelValue="updateDateTime"
8
8
  showButtonBar
9
9
  :readonly="readonly"
10
- :placeholder="placeholder"
10
+ :placeholder="placeholder"
11
11
  :showTime="showtime"
12
12
  :timeOnly="timeOnly"
13
13
  hourFormat="12"
14
14
  v-bind="componentProps as CalendarProps"
15
- />
15
+ />
16
16
  </template>
17
17
  <script setup lang="ts">
18
18
  // :date-format="getDateFormat()"
19
- import { CalendarProps } from 'primevue/calendar';
20
- const props =defineProps<{
21
- pt:any
22
- uuid:string
23
- placeholder?:string
24
- setting: any;
25
- readonly?: boolean;
26
- componentProps?:CalendarProps
27
- type: "date"|"time"|"datetime"
28
- }>()
29
-
30
-
31
- const emits = defineEmits(['change'])
32
- const showtime = props.type == 'date'? false : true
33
- const timeOnly = props.type=='time'?true:false
19
+ import { CalendarProps } from "primevue/calendar";
20
+ const props = defineProps<{
21
+ pt: any;
22
+ uuid: string;
23
+ placeholder?: string;
24
+ setting: any;
25
+ readonly?: boolean;
26
+ componentProps?: CalendarProps;
27
+ type: "date" | "time" | "datetime";
28
+ }>();
29
+
30
+ const emits = defineEmits(["change"]);
31
+ const showtime = props.type == "date" ? false : true;
32
+ const timeOnly = props.type == "time" ? true : false;
34
33
  const modelValue = defineModel<string>({ required: true });
35
34
  const datetimevalue = ref<Date>();
36
35
 
36
+ const refreshFromParent = () => {
37
+ if (modelValue.value === undefined || modelValue.value == "")
38
+ datetimevalue.value = undefined;
39
+ else if (props.type == "time")
40
+ datetimevalue.value = stringToDate(
41
+ "2000-01-01 " + (modelValue.value ?? "00:00:00"),
42
+ );
43
+ else if (props.type == "date")
44
+ datetimevalue.value = stringToDate(modelValue.value + "T00:00:00");
45
+ else datetimevalue.value = stringToDate(modelValue.value);
46
+ };
37
47
 
38
- const refreshFromParent = ()=>{
39
- if(modelValue.value === undefined || modelValue.value=='')
40
- datetimevalue.value = undefined
41
- else if(props.type=='time')
42
- datetimevalue.value = stringToDate(('2000-01-01 '+modelValue.value??'00:00:00'))
43
- else if(props.type=='date')
44
- datetimevalue.value = stringToDate((modelValue.value)+'T00:00:00')
45
- else
46
- datetimevalue.value = stringToDate(modelValue.value)
47
- }
48
-
49
- watch(modelValue, () => refreshFromParent())
48
+ watch(modelValue, () => refreshFromParent());
50
49
 
51
50
  const updateDateTime = (value: any) => {
52
- if (!value) modelValue.value = "";
53
- else if(props.type=='datetime')modelValue.value = dateToISOString(value)
54
- else if(props.type=='date')modelValue.value = dateToString(value)
55
- else if(props.type=='time') modelValue.value = dateToTimeString(value)
56
-
57
-
51
+ if (!value) modelValue.value = "";
52
+ else if (props.type == "datetime") modelValue.value = dateToISOString(value);
53
+ else if (props.type == "date") modelValue.value = dateToString(value);
54
+ else if (props.type == "time") modelValue.value = dateToTimeString(value);
58
55
 
59
- emits('change');
56
+ emits("change");
60
57
  };
61
58
 
62
-
63
- refreshFromParent()
64
- </script>
59
+ refreshFromParent();
60
+ </script>
@@ -47,6 +47,14 @@
47
47
  <div v-for="(menu, index) in menus" :key="index">
48
48
  <div v-if="menu.label && menu.type == 'crud'">
49
49
  <ButtonAction
50
+ v-if="menu.action == 'print'"
51
+ :disabled="!canPerform(doc.getDocName(true), 'access')"
52
+ @click="emitEvent(menu, $event)"
53
+ :action-name="menu.action"
54
+ >{{ menu.label }}</ButtonAction>
55
+ <ButtonAction
56
+ v-else
57
+ :disabled="!canPerform(doc.getDocName(true), menu.action)"
50
58
  @click="emitEvent(menu, $event)"
51
59
  :action-name="menu.action"
52
60
  >{{ menu.label }}</ButtonAction
@@ -66,6 +74,7 @@
66
74
  <div v-for="(menu, index) in menus" :key="index">
67
75
  <div v-if="menu.label && menu.type == 'docstatus'">
68
76
  <ButtonAction
77
+ :disabled="!canPerform(doc.getDocName(true), menu.action)"
69
78
  @click="emitEvent(menu, $event)"
70
79
  :action-name="menu.action"
71
80
  >{{ menu.label }}</ButtonAction
@@ -74,22 +83,8 @@
74
83
  </div>
75
84
  </div>
76
85
  </div>
77
- <ConfirmPopup></ConfirmPopup>
78
86
  </div>
79
- <!-- <Dialog v-model:visible="visiblePrintFormats" :header="t('printFormats')">
80
- <div>
81
- <ListView
82
- :list="printformats"
83
- #default="{ item, index }"
84
- @click="printPdf"
85
- >
86
- <div class="flex flex-col">
87
- <TextBold>{{ t(item.formatName) }}</TextBold>
88
- <TextSubtitle>{{ item.description }}</TextSubtitle>
89
- </div>
90
- </ListView>
91
- </div>
92
- </Dialog> -->
87
+
93
88
  <OverlayPanelWithToolBar
94
89
  v-if="visiblePrintPreview"
95
90
  v-model="visiblePrintPreview"
@@ -193,7 +188,12 @@ const data = doc.getReactiveData();
193
188
 
194
189
  const createData = async () => {
195
190
  try {
196
- setRecentDocument(data.value._id,{docName:doc.getDocName(),label:title.value})
191
+ setRecentDocument(data.value._id, {
192
+ docName: doc.getDocName(),
193
+ label: title.value,
194
+ branchId: data.value.branchId,
195
+ time: new Date().toISOString(),
196
+ });
197
197
  return await doc.create();
198
198
  } catch (e) {
199
199
  console.debug("validation error:", e);
@@ -201,7 +201,12 @@ const createData = async () => {
201
201
  };
202
202
  const updateData = async () => {
203
203
  try {
204
- setRecentDocument(data.value._id,{docName:doc.getDocName(),label:title.value})
204
+ setRecentDocument(data.value._id, {
205
+ docName: doc.getDocName(),
206
+ label: title.value,
207
+ branchId: data.value.branchId,
208
+ time: new Date().toISOString(),
209
+ });
205
210
  return await doc.update();
206
211
  } catch (e) {
207
212
  console.debug("validation error:", e);
@@ -209,7 +214,7 @@ const updateData = async () => {
209
214
  };
210
215
  const deleteData = async () => {
211
216
  try {
212
- getRecently().delete(data.value._id)
217
+ getRecently().delete(data.value._id);
213
218
  return await doc.delete();
214
219
  } catch (e) {
215
220
  console.debug("validation error:", e);
@@ -218,13 +223,27 @@ const deleteData = async () => {
218
223
 
219
224
  type Datatype = keyof typeof data.value;
220
225
  const config = doc.getSchema()["x-simpleapp-config"];
221
- const titlefield = (config.documentTitle ?? config.uniqueKey) as Datatype;
226
+ const titlefield = (
227
+ config.allStatus && config.allStatus.length > 0
228
+ ? config.uniqueKey
229
+ : config.documentTitle
230
+ ) as Datatype;
222
231
  const title = computed(() =>
223
232
  data.value[titlefield as Datatype]
224
233
  ? data.value[titlefield as Datatype]
225
234
  : t(doc.getDocName()),
226
235
  );
227
- const printformats = doc.getSchema()["x-simpleapp-config"]?.printFormats;
236
+ const printformats = computed(() => {
237
+ const formats = doc.getSchema()["x-simpleapp-config"]?.printFormats;
238
+ if (Array.isArray(formats)) {
239
+ return formats.map((item) => {
240
+ item.formatName = t(item.formatName);
241
+ return item;
242
+ });
243
+ } else {
244
+ return [];
245
+ }
246
+ });
228
247
  const menu = ref();
229
248
  const menus = computed(() =>
230
249
  [...getActions(), ...getDocActions()].filter((item) => showMenuButton(item)),
@@ -251,11 +270,18 @@ const emitMobileEvent = (itemevent: MenuItemCommandEvent) => {
251
270
 
252
271
  const printPdf = async (dropdown?: DropdownChangeEvent) => {
253
272
  let index = 0;
254
-
255
- if (printformats && printformats.length > 0 && dropdown !== undefined) {
256
- index = printformats?.findIndex((item) => item.formatId == dropdown.value);
273
+ setRecentDocument(data.value._id, {
274
+ docName: doc.getDocName(),
275
+ label: title.value,
276
+ branchId: data.value.branchId,
277
+ time: new Date().toISOString(),
278
+ });
279
+ if (printformats && printformats.value.length > 0 && dropdown !== undefined) {
280
+ index = printformats.value.findIndex(
281
+ (item) => item.formatId == dropdown.value,
282
+ );
257
283
  }
258
- let format: SchemaPrintFormat = printformats[index];
284
+ let format: SchemaPrintFormat = printformats.value[index];
259
285
  printservererror.value = false;
260
286
  const formatid: string = format.formatId;
261
287
  currentprintformat.value = formatid;
@@ -295,7 +321,7 @@ const getActions = () => {
295
321
  });
296
322
  }
297
323
  });
298
- if (printformats && printformats.length > 0) {
324
+ if (printformats && printformats.value.length > 0) {
299
325
  crudmenus.push({
300
326
  action: "print",
301
327
  label: t("preview"),
@@ -334,6 +360,12 @@ const emitEvent = async (menu: FormMenu, clickEvent: Event | MouseEvent) => {
334
360
  } else if (menu.action == "update") {
335
361
  if (await updateData()) emits("on", FormCrudEvent.update);
336
362
  } else if (menu.type == "docstatus") {
363
+ setRecentDocument(data.value._id, {
364
+ docName: doc.getDocName(),
365
+ label: title.value,
366
+ branchId: data.value.branchId,
367
+ time: new Date().toISOString(),
368
+ });
337
369
  emits("on", FormCrudEvent.setDocStatus, menu.action);
338
370
  } else if (menu.action == FormCrudEvent.exit)
339
371
  emits("on", FormCrudEvent.exit);
@@ -3,6 +3,7 @@
3
3
  v-bind="$attrs"
4
4
  stripedRows
5
5
  resizableColumns
6
+ :rowClass="()=>'align-top'"
6
7
  class="simpleapp-datatable p-datatable-sm"
7
8
  :value="modelValue"
8
9
  >
@@ -11,16 +12,16 @@
11
12
  </template>
12
13
  <template #header v-if="!setting.readonly && !readonly">
13
14
  <div class="flex flex-row gap-2">
14
- <slot name="header">
15
- <Button
16
- icon="pi pi-plus"
17
- @click="addNew()"
18
- class="simpleapp-datatable-add btn-primary"
19
- type="button"
20
- >{{ t("add") }}</Button
21
- >
22
- </slot>
23
- </div>
15
+ <slot name="header">
16
+ <Button
17
+ icon="pi pi-plus"
18
+ @click="addNew()"
19
+ class="simpleapp-datatable-add btn-primary"
20
+ type="button"
21
+ >{{ t("add") }}</Button
22
+ >
23
+ </slot>
24
+ </div>
24
25
  </template>
25
26
  <slot>
26
27
  <Column class="text-center" header="undefine columns">
@@ -6,6 +6,7 @@
6
6
  <Sidebar
7
7
  v-model:visible="showpermissioninfo"
8
8
  modal
9
+ :pt="{ root: { class: 'w-2/3' } }"
9
10
  :header="permissiontitle"
10
11
  position="right"
11
12
  >
@@ -55,7 +56,7 @@
55
56
  <div class="text text-gray-400">{{ copied }}</div>
56
57
  </div>
57
58
  <pre id="permissionstr">
58
- {{ permissions }}
59
+ {{ computedpermissions }}
59
60
  </pre
60
61
  >
61
62
  </div>
@@ -65,7 +66,7 @@
65
66
  v-else="showjson"
66
67
  >
67
68
  <div class="m mr-3">{{ res }}</div>
68
- <div class="gap-4" v-if="allactions">
69
+ <div class="gap-4" v-if="allactions" >
69
70
  <SelectButton
70
71
  v-if="mode == 'edit'"
71
72
  multiple
@@ -75,12 +76,12 @@
75
76
 
76
77
  <span v-else v-for="actionname in allactions[res]" class="m m-1">
77
78
  <Chip
78
- class="bg-primary"
79
+ class="bg-primary-600 text-white"
79
80
  v-if="canPerformAction(selectedgroup, res, actionname)"
80
81
  severity="success"
81
- :label="actionname"
82
+ :label="t(actionname)"
82
83
  ></Chip>
83
- <Chip v-else :label="actionname"></Chip>
84
+ <Chip v-else :label="t(actionname)"></Chip>
84
85
  </span>
85
86
  </div>
86
87
  </div>
@@ -110,8 +111,16 @@ const mode = ref("preview");
110
111
 
111
112
  const allresources = getUniqueResource();
112
113
  const allactions = ref();
113
- const permissions = ref();
114
-
114
+ const permissions = ref<{ [key: string]: string[] }>();
115
+ const computedpermissions = computed(() => {
116
+ const tmp: { [key: string]: string[] } = {};
117
+ for (const keyname in permissions.value) {
118
+ if (permissions.value[keyname].length > 0)
119
+ tmp[keyname] = permissions.value[keyname];
120
+ }
121
+ return tmp;
122
+ // return permissions.value.filter((item:string[],key:string)=>item.length>0)
123
+ });
115
124
  const activeroles = ref();
116
125
  const copied = ref("");
117
126
 
@@ -136,7 +145,7 @@ const selectGroup = (selectedgroup: any) => {
136
145
  permissions.value = {};
137
146
  for (let i = 0; i < allresources.length; i++) {
138
147
  const r = allresources[i];
139
- console.log(r);
148
+ // console.log(r);
140
149
  const actions = getActionFromResource(r);
141
150
  allactions.value[r] = actions;
142
151
  permissions.value[r] = getGroupResourcePermission(groupname, r).map(
@@ -1,19 +1,29 @@
1
1
  <template>
2
- <Dialog v-model:visible="visible" modal :header="popuptitle" class="crudsimple-dialog" :autoZIndex="false" :style="{zIndex:100 }">
2
+ <Dialog
3
+ v-model:visible="visible"
4
+ modal
5
+ :header="popuptitle"
6
+ class="crudsimple-dialog">
3
7
  <div v-if="invites">
4
-
5
- <div v-for="item in invites" class="w w-auto p p-2 grid grid-cols-3 hover-list-primary border">
6
- <div class="flex flex-col col-span-2">
7
- <div class="font font-bold">{{item.tenantName}}</div>
8
- <div class="text text-xs text-gray-500 italic">{{ item.created }}</div>
9
- </div>
10
- <div >
11
- <Button class="btn-primary" @click="approve(item._id)">Approve</Button>
12
- <Button class="btn-danger" @click="decline(item._id)">Decline</Button>
13
- </div>
8
+ <div
9
+ v-for="item in invites"
10
+ class="w w-auto p p-2 grid grid-cols-3 hover-list-primary border"
11
+ >
12
+ <div class="flex flex-col col-span-2">
13
+ <div class="font font-bold">{{ item.tenantName }}</div>
14
+ <div class="text text-xs text-gray-500 italic">
15
+ {{ item.created }}
16
+ </div>
14
17
  </div>
15
- </div>
16
- </Dialog>
18
+ <div class="flex flex-row gap-2">
19
+ <ButtonPrimary @click="approve(item._id)"
20
+ >{{t('approve')}}</ButtonPrimary
21
+ >
22
+ <ButtonDanger @click="decline(item._id)">{{t('decline')}}</ButtonDanger>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </Dialog>
17
27
  </template>
18
28
  <script setup lang="ts">
19
29
  /**
@@ -22,35 +32,33 @@
22
32
  * last change 2023-10-28
23
33
  * Author: Ks Tan
24
34
  */
25
- import Dialog from 'primevue/dialog';
26
- import {onMounted, ref} from 'vue'
27
- import {EventType} from '../types'
28
- import ProgressSpinner from 'primevue/progressspinner'
29
- const {$userstore,$event}= useNuxtApp()
30
- const disabled = ref(false)
31
- const visible=ref(false)
32
- const invites = ref()
33
- const invitationmsg = "There is some invitation to join their organization:"
34
- const popuptitle = ref(invitationmsg)
35
- onMounted(()=>{
36
- invites.value = getUserProfile().invites
37
- if(invites.value.length>0){
38
- visible.value=true
39
- }
40
- })
41
-
42
- const approve = async (id:string) =>{
43
-
44
- // await reloadUserStore()
45
- await $userstore.decideInvitation(id,'accept')
46
- $event('InvitationAccepted',id)
47
- visible.value=false
48
- }
49
- const decline = async (id:string) => {
50
- // await reloadUserStore()
51
- await $userstore.decideInvitation(id,'reject')
52
- $event('InvitationRejected',id)
53
- visible.value=false
54
- }
55
-
56
- </script>
35
+ import Dialog from "primevue/dialog";
36
+ import { onMounted, ref } from "vue";
37
+ import { EventType } from "../types";
38
+ import ProgressSpinner from "primevue/progressspinner";
39
+ const { $userstore, $event } = useNuxtApp();
40
+ const disabled = ref(false);
41
+ const visible = ref(false);
42
+ const invites = ref();
43
+ const invitationmsg = "There is some invitation to join their organization:";
44
+ const popuptitle = ref(invitationmsg);
45
+ onMounted(() => {
46
+ invites.value = getUserProfile().invites;
47
+ if (invites.value.length > 0) {
48
+ visible.value = true;
49
+ }
50
+ });
51
+
52
+ const approve = async (id: string) => {
53
+ // await reloadUserStore()
54
+ await $userstore.decideInvitation(id, "accept");
55
+ $event("InvitationAccepted", id);
56
+ visible.value = false;
57
+ };
58
+ const decline = async (id: string) => {
59
+ // await reloadUserStore()
60
+ await $userstore.decideInvitation(id, "reject");
61
+ $event("InvitationRejected", id);
62
+ visible.value = false;
63
+ };
64
+ </script>