@simitgroup/simpleapp-generator 1.2.8 → 1.3.0-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.
- package/dist/buildinschemas/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +3 -1
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +3 -8
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +14 -14
- package/dist/generate.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/organization.ts +3 -1
- package/src/framework.ts +4 -8
- package/src/generate.ts +17 -16
- package/templates/basic/nest/controller.ts.eta +17 -0
- package/templates/basic/nest/default.ts.eta +6 -2
- package/templates/basic/nuxt/default.ts.eta +10 -6
- package/templates/basic/nuxt/pages.[id].vue.eta +9 -7
- package/templates/basic/nuxt/pages.form.vue.eta +16 -36
- package/templates/basic/nuxt/pages.landing.vue.eta +42 -35
- package/templates/basic/nuxt/pages.viewer.vue.eta +4 -6
- package/templates/nest/.env._eta +0 -1
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +14 -2
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +32 -18
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +76 -13
- package/templates/nuxt/assets/css/style.css._eta +19 -7
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +20 -9
- package/templates/nuxt/components/button/ButtonDefault.vue._eta +1 -2
- package/templates/nuxt/components/button/ButtonMultiple.vue._eta +21 -0
- package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +3 -4
- package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +75 -65
- package/templates/nuxt/components/form/FormBranch.vue.eta +83 -0
- package/templates/nuxt/components/form/readme.md.eta +1 -0
- package/templates/nuxt/components/header/button/HeaderButtonMenuPicker.vue._eta +13 -11
- package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +11 -17
- package/templates/nuxt/components/list/ListDocument.vue.eta +25 -0
- package/templates/nuxt/components/list/ListDocumentTable.vue.eta +77 -0
- package/templates/nuxt/components/list/ListView.vue.eta +129 -60
- package/templates/nuxt/components/mobile/MobileToolbar.vue.eta +10 -0
- package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +21 -0
- package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +20 -0
- package/templates/nuxt/components/page/PageDocList.vue.eta +170 -0
- package/templates/nuxt/components/renderer/RendererBoolean.vue.eta +8 -4
- package/templates/nuxt/components/renderer/RendererDate.vue.eta +4 -4
- package/templates/nuxt/components/renderer/RendererLink.vue.eta +12 -20
- package/templates/nuxt/components/renderer/RendererViewer.vue.eta +27 -21
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +201 -174
- package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +115 -111
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue.eta +183 -91
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +383 -263
- package/templates/nuxt/components/table/TableDocuments.vue.eta +3 -3
- package/templates/nuxt/components/text/TextDanger.vue._eta +5 -0
- package/templates/nuxt/components/text/TextSubtitle.vue._eta +5 -0
- package/templates/nuxt/components/text/TextTitle.vue._eta +5 -0
- package/templates/nuxt/composables/date.generate.ts.eta +14 -9
- package/templates/nuxt/i18n.config.ts.eta +1 -1
- package/templates/nuxt/lang/en.ts.eta +16 -0
- package/templates/nuxt/layouts/default.vue._eta +32 -17
- package/templates/nuxt/layouts/mobile.vue._eta +35 -12
- package/templates/nuxt/nuxt.config.ts._eta +3 -7
- package/templates/nuxt/pages/[xorg]/organization/[id].vue.eta +39 -0
- package/templates/nuxt/pages/[xorg]/organization/new.vue.eta +30 -143
- package/templates/nuxt/pages/[xorg]/organization/viewer.vue.eta +3 -0
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +81 -127
- package/templates/nuxt/pages/[xorg]/user/[id].vue.eta +38 -4
- package/templates/nuxt/pages/[xorg]/user/form.vue.eta +329 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +29 -292
- package/templates/nuxt/pages/[xorg]/{organization/[id]/branches/[bid].vue → user/new.vue.eta} +10 -4
- package/templates/nuxt/pages/[xorg]/user/viewer.vue.eta +30 -0
- package/templates/nuxt/pages/[xorg]/user.vue.eta +88 -78
- package/templates/nuxt/pages/profile.vue.eta +12 -3
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +2 -3
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +41 -2
- package/templates/nuxt/types/documentlist.ts.eta +0 -9
- package/templates/nuxt/types/events.ts.eta +1 -0
- package/templates/nuxt/types/simpleappinput.ts.eta +12 -2
- package/templates/nuxt/types/user.ts.eta +2 -0
- package/templates/project/lang/default._json +5 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/docPage/DocPageList.vue.eta +0 -125
- package/templates/nuxt/lang/en.ts._eta +0 -6
- package/templates/nuxt/pages/[xorg]/organization/[bid].vue.eta +0 -14
- package/templates/nuxt/pages/[xorg]/organization/[id]/branches/new.vue +0 -149
- package/templates/nuxt/pages/[xorg]/organization/[id]/index.vue.eta +0 -1
- /package/templates/nuxt/lang/{df.ts.eta → df.ts.etaxxxx} +0 -0
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
</div>
|
|
23
23
|
<div class="flex-1">
|
|
24
24
|
<slot name="title">
|
|
25
|
-
<h1 class="text text-2xl pt-2 text-center">{{ t(title) }}</h1>
|
|
25
|
+
<h1 class="text text-2xl pt-2 text-center dark:text-white">{{ t(title) }}</h1>
|
|
26
26
|
</slot>
|
|
27
27
|
|
|
28
28
|
</div>
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
</slot>
|
|
96
96
|
</Datatable>
|
|
97
97
|
</template>
|
|
98
|
-
<script setup lang="ts">
|
|
98
|
+
<script setup lang="ts" generic="T">
|
|
99
99
|
import {CellSetting} from '~/types'
|
|
100
100
|
import { FilterMatchMode } from 'primevue/api';
|
|
101
101
|
import DataTable from 'primevue/datatable';
|
|
@@ -103,7 +103,7 @@ import Column from 'primevue/column';
|
|
|
103
103
|
import renderComponent from '~/components/renderer'
|
|
104
104
|
import { emit } from 'process';
|
|
105
105
|
const props = defineProps<{
|
|
106
|
-
value:
|
|
106
|
+
value:T[]
|
|
107
107
|
columns: CellSetting[]
|
|
108
108
|
title:string
|
|
109
109
|
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import moment from "moment";
|
|
2
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export const setDateLocale = (localename:string) => useDayjs().locale(localename)
|
|
3
5
|
export const dateExists = (date:Date,listDate:Date[]) => {
|
|
4
6
|
const existsrecord = listDate.find(item=>{
|
|
5
7
|
return date.getTime()===item.getTime()
|
|
6
8
|
})
|
|
7
9
|
return existsrecord===undefined ? false :true
|
|
8
10
|
}
|
|
9
|
-
export const
|
|
10
|
-
export const lastDateOfMonth = (datestr:string) =>
|
|
11
|
-
export const today = () =>
|
|
12
|
-
export const dateToString = (date:Date) =>
|
|
13
|
-
export const dateToDateTimeString = (date:Date)=>
|
|
14
|
-
export const toLocalDate = (
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
export const getDayJs = ()=>useDayjs()
|
|
12
|
+
export const lastDateOfMonth = (datestr:string) => useDayjs()(datestr).endOf('month').format('YYYY-MM-DD');
|
|
13
|
+
export const today = () => useDayjs()().format('YYYY-MM-DD')
|
|
14
|
+
export const dateToString = (date:Date) => useDayjs()(date).format('YYYY-MM-DD')
|
|
15
|
+
export const dateToDateTimeString = (date:Date)=> useDayjs()(date).format('YYYY-MM-DD HH:mm:ss')
|
|
16
|
+
export const toLocalDate = (date:string | Date)=> useDayjs()(date).format(getDateFormat())
|
|
17
|
+
export const getDateFormat = ():string=> 'DD-MM-YYYY'
|
|
18
|
+
export const getPrimevueCalendarDateFormat = () => {
|
|
19
|
+
const country = <string>getUserProfile()?.country
|
|
20
|
+
return 'dd/mm/yy'
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
//auto generate from lang/default.ts
|
|
3
|
+
<%let langkeys = Object.keys(it.lang) %>
|
|
4
|
+
<% for(let l=0; l< langkeys.length; l++){ %>
|
|
5
|
+
<% let key = langkeys[l] %>
|
|
6
|
+
'<%=key%>' : '<%= it.lang[key] %>',
|
|
7
|
+
<%}%>
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
//auto generate from schema
|
|
11
|
+
<% for(let i=0; i< it.allfields.length; i++){ %>
|
|
12
|
+
<% let f = it.allfields[i] %>
|
|
13
|
+
'<%= f %>' : '<%= camelCaseToWords(f) %>',
|
|
14
|
+
<%}%>
|
|
15
|
+
|
|
16
|
+
}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="h-full flex flex-row">
|
|
3
|
-
<div class="flex flex-col
|
|
4
|
-
<div
|
|
5
|
-
<HeaderButtonMenuPicker class="cursor-pointer p-2 text-6xl "></HeaderButtonMenuPicker>
|
|
3
|
+
<div class="flex flex-col h-screen ">
|
|
4
|
+
<div class="flex-1">
|
|
6
5
|
<div class="" v-for="item in menus">
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
<div class="">
|
|
7
|
+
<NuxtLink v-if="item.path !==undefined"
|
|
8
|
+
:class="`pi ${item.iconClass} p-2 text-6xl cursor-pointer`"
|
|
9
|
+
:to="getDocumentUrl(item.path)"
|
|
10
|
+
></NuxtLink>
|
|
11
|
+
<div v-else-if="item.command" :class="`pi ${item.iconClass} p-2 text-6xl cursor-pointer`" @click="item.command">
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="p-2 text-6xl cursor-pointer pi pi-user dark:text-white" @click="openProfile">
|
|
17
|
+
<HeaderButtonProfile v-model="showProfile"/>
|
|
14
18
|
</div>
|
|
15
|
-
|
|
19
|
+
|
|
16
20
|
</div>
|
|
17
21
|
<div class="flex-1">
|
|
18
22
|
<HeaderBar />
|
|
@@ -20,15 +24,26 @@
|
|
|
20
24
|
<slot></slot>
|
|
21
25
|
</div>
|
|
22
26
|
</div>
|
|
27
|
+
<div >
|
|
28
|
+
<HeaderButtonMenuPicker v-model="showMenu"></HeaderButtonMenuPicker>
|
|
29
|
+
</div>
|
|
23
30
|
|
|
24
31
|
</template>
|
|
25
32
|
<script setup lang="ts">
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
const showMenu =ref(false)
|
|
34
|
+
const showProfile =ref(false)
|
|
35
|
+
|
|
36
|
+
const openMenu = ()=>showMenu.value=true
|
|
37
|
+
const openProfile = ()=>showProfile.value=true
|
|
38
|
+
|
|
39
|
+
const menus=[
|
|
40
|
+
{iconClass:'pi-home dark:text-white',path:''},
|
|
41
|
+
//{iconClass:'pi-users dark:text-white',path:'managestudents/new'},
|
|
42
|
+
//{iconClass:'pi-calendar dark:text-white',path:`manageclasses`},
|
|
31
43
|
// {iconClass:'pi-database',path:'managedata'},
|
|
32
|
-
{iconClass:'pi-chart-pie text-white',path:'reports'},
|
|
44
|
+
{iconClass:'pi-chart-pie dark:text-white',path:'reports'},
|
|
45
|
+
{iconClass:'pi-bars dark:text-white',command: openMenu},
|
|
46
|
+
|
|
47
|
+
|
|
33
48
|
]
|
|
34
49
|
</script>
|
|
@@ -1,29 +1,52 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="h-screen flex flex-col">
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
<div class="flex flex-col grow overflow-y-auto">
|
|
5
|
+
<div class="flex flex-row mb-36 w-full">
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
|
|
5
10
|
</div>
|
|
6
11
|
<!-- fixed -->
|
|
7
|
-
<div v-if="getCurrentXorg()" class="flex h-
|
|
8
|
-
<
|
|
9
|
-
|
|
12
|
+
<div v-if="getCurrentXorg()" class="flex h-16 border-t-2 dark:border-t-gray-700 text-3xl flex-row left-0 w-full justify justify-between bottom-0 fixed z-50 bg-white dark:bg-slate-800 opacity opacity-95 " >
|
|
13
|
+
<div v-for="item in menus">
|
|
14
|
+
<NuxtLink v-if="item.path !== undefined"
|
|
15
|
+
:class="`pi ${item.iconClass} p-4 cursor-pointer inline-block align-middle`"
|
|
10
16
|
:to="getDocumentUrl(item.path)"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
>
|
|
18
|
+
|
|
19
|
+
</NuxtLink>
|
|
20
|
+
<div v-else-if="item.command" :class="`pi ${item.iconClass} p-4 cursor-pointer inline-block align-middle`" @click="item.command">
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<HeaderButtonMenuPicker v-model="showMenu"></HeaderButtonMenuPicker>
|
|
25
|
+
<HeaderButtonProfile v-model="showProfile"/>
|
|
14
26
|
<UserInvitation/>
|
|
15
27
|
</div>
|
|
28
|
+
|
|
16
29
|
<!-- <HeaderBar class="border flex flex-row h-10 fixed left-0 w-full justify justify-between top-0 z-50 bg-white dark:bg-gray-800"/> -->
|
|
17
30
|
|
|
18
31
|
</div>
|
|
19
32
|
</template>
|
|
20
33
|
<script setup lang="ts">
|
|
34
|
+
const showMenu =ref(false)
|
|
35
|
+
const showProfile =ref(false)
|
|
36
|
+
|
|
37
|
+
const openMenu = ()=>showMenu.value=true
|
|
38
|
+
const openProfile = ()=>showProfile.value=true
|
|
21
39
|
const menus=[
|
|
22
40
|
// {iconClass:'pi-bars',path:'managestudents/profile'},
|
|
23
|
-
{iconClass:'pi-home text-white',path:''},
|
|
24
|
-
//
|
|
25
|
-
//
|
|
41
|
+
{iconClass:'pi-home dark:text-white',path:''},
|
|
42
|
+
//{iconClass:'pi-users dark:text-white',path:'managestudents'},
|
|
43
|
+
//{iconClass:'pi-calendar dark:text-white',path:`manageclasses`},
|
|
44
|
+
{iconClass:'pi-chart-pie dark:text-white',path:'reports'},
|
|
45
|
+
{iconClass:'pi-bars dark:text-white',command: openMenu},
|
|
46
|
+
{iconClass:'pi-user dark:text-white',command: openProfile},
|
|
26
47
|
// {iconClass:'pi-database',path:'managedata'},
|
|
27
|
-
|
|
48
|
+
|
|
28
49
|
]
|
|
50
|
+
|
|
51
|
+
|
|
29
52
|
</script>
|
|
@@ -38,6 +38,7 @@ devServer: {
|
|
|
38
38
|
'@nuxtjs/color-mode',
|
|
39
39
|
'@nuxtjs/device',
|
|
40
40
|
'@nuxtjs/i18n',
|
|
41
|
+
'dayjs-nuxt',
|
|
41
42
|
'@sidebase/nuxt-auth',
|
|
42
43
|
'nuxt-primevue',
|
|
43
44
|
// '@nuxtjs/pwa', //cannot turn on, will cause nuxt cant start
|
|
@@ -63,12 +64,7 @@ devServer: {
|
|
|
63
64
|
langDir: "lang/",
|
|
64
65
|
strategy: "no_prefix",
|
|
65
66
|
locales: [
|
|
66
|
-
|
|
67
|
-
code: "df",
|
|
68
|
-
iso: "df",
|
|
69
|
-
name: "Default",
|
|
70
|
-
file: "df.ts",
|
|
71
|
-
},
|
|
67
|
+
|
|
72
68
|
{
|
|
73
69
|
code: "en",
|
|
74
70
|
iso: "en",
|
|
@@ -83,7 +79,7 @@ devServer: {
|
|
|
83
79
|
|
|
84
80
|
},
|
|
85
81
|
],
|
|
86
|
-
defaultLocale: "
|
|
82
|
+
defaultLocale: "en",
|
|
87
83
|
},
|
|
88
84
|
primevue: {
|
|
89
85
|
options: {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<LazyFormBranch :_id="_id" @after="after" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
/**
|
|
7
|
+
* This file was automatically generated by simpleapp generator.
|
|
8
|
+
* last change 2023-09-09
|
|
9
|
+
* author: Ks Tan
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { Branch } from "~/simpleapp/generate/types";
|
|
13
|
+
const doc = useNuxtApp().$BranchDoc();
|
|
14
|
+
|
|
15
|
+
const props = defineProps<{ _id: string }>();
|
|
16
|
+
const after = (actionName: string, data: Branch) => {
|
|
17
|
+
console.log("Branch capture after emits ", actionName,doc.getDocName().toLowerCase());
|
|
18
|
+
switch (actionName) {
|
|
19
|
+
case "new":
|
|
20
|
+
goTo('organization');
|
|
21
|
+
break;
|
|
22
|
+
case "create":
|
|
23
|
+
goTo('organization');
|
|
24
|
+
refreshDocumentList('branch');
|
|
25
|
+
useNuxtApp().$event("CloseDialog", doc.getDocName().toLowerCase());
|
|
26
|
+
break;
|
|
27
|
+
case "update":
|
|
28
|
+
goTo('organization');
|
|
29
|
+
refreshDocumentList('branch');
|
|
30
|
+
useNuxtApp().$event("CloseDialog", doc.getDocName().toLowerCase());
|
|
31
|
+
break;
|
|
32
|
+
case "delete":
|
|
33
|
+
goTo('organization');
|
|
34
|
+
refreshDocumentList('branch');
|
|
35
|
+
useNuxtApp().$event("CloseDialog", doc.getDocName().toLowerCase());
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
</script>
|
|
@@ -1,151 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<LazyFormBranch _id="new" @after="after" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
1
5
|
<script setup lang="ts">
|
|
2
6
|
/**
|
|
3
|
-
* This file was automatically generated by simpleapp
|
|
4
|
-
* delete file "delete-me-for-avoid-override" if you want to modify this file and
|
|
5
|
-
* prevent regenerate code override it.
|
|
7
|
+
* This file was automatically generated by simpleapp generator.
|
|
6
8
|
* last change 2023-09-09
|
|
7
9
|
* author: Ks Tan
|
|
8
10
|
*/
|
|
9
|
-
import { SimpleAppInputType } from "~/types";
|
|
10
|
-
import ConfirmPopup from "primevue/confirmpopup";
|
|
11
|
-
import { useConfirm } from "primevue/useconfirm";
|
|
12
|
-
const confirm = useConfirm();
|
|
13
|
-
|
|
14
|
-
const { $BranchDoc, $OrganizationDoc, $event } = useNuxtApp();
|
|
15
|
-
const orgdoc = $OrganizationDoc();
|
|
16
|
-
const doc = $BranchDoc();
|
|
17
|
-
const data = doc.getReactiveData();
|
|
18
|
-
const bid = ref(String(useRoute().params.bid ?? ""));
|
|
19
|
-
const isReadOnly = ref(true);
|
|
20
|
-
const fetchRecord = async (id: string) => {
|
|
21
|
-
await doc.getById(id);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const disabled = computed(() => {
|
|
25
|
-
return false;
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const createData = async () => {
|
|
29
|
-
doc
|
|
30
|
-
.create()
|
|
31
|
-
.then((res) => {
|
|
32
|
-
refresh();
|
|
33
|
-
goBranch(res.data._id);
|
|
34
|
-
})
|
|
35
|
-
.catch((err) => {
|
|
36
|
-
console.error(err);
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
const updateData = async () => {
|
|
40
|
-
doc
|
|
41
|
-
.update()
|
|
42
|
-
.then(() => {
|
|
43
|
-
// visible.value=false
|
|
44
|
-
refresh();
|
|
45
|
-
})
|
|
46
|
-
.catch((err) => {
|
|
47
|
-
console.error(err);
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
const deleteData = (event: Event) => {
|
|
51
|
-
confirm.require({
|
|
52
|
-
target: event.currentTarget as HTMLElement,
|
|
53
|
-
message: "Delete?",
|
|
54
|
-
icon: "pi pi-exclamation-triangle",
|
|
55
|
-
acceptClass: "p-button-danger",
|
|
56
|
-
accept: () => {
|
|
57
|
-
// disabled.value=true
|
|
58
|
-
doc.delete(data.value._id ?? "").then((res) => {
|
|
59
|
-
refresh();
|
|
60
|
-
|
|
61
|
-
goTo(doc.getDocName());
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
reject: () => {
|
|
65
|
-
console.log("Cancel delete");
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
11
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
12
|
+
import { Branch } from "~/simpleapp/generate/types";
|
|
13
|
+
const doc = useNuxtApp().$BranchDoc();
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const after = (actionName: string, data: Branch) => {
|
|
17
|
+
console.log("Branch capture after emits ", actionName,'branch');
|
|
18
|
+
switch (actionName) {
|
|
19
|
+
case "create":
|
|
20
|
+
goTo('organization');
|
|
21
|
+
refreshDocumentList('branch');
|
|
22
|
+
useNuxtApp().$event("CloseDialog", 'branch');
|
|
23
|
+
break;
|
|
24
|
+
case "update":
|
|
25
|
+
goTo('organization');
|
|
26
|
+
refreshDocumentList('branch');
|
|
27
|
+
useNuxtApp().$event("CloseDialog", 'branch');
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
break;
|
|
31
|
+
case "delete":
|
|
32
|
+
goTo('organization');
|
|
33
|
+
refreshDocumentList('branch');
|
|
34
|
+
useNuxtApp().$event("CloseDialog", 'branch');
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
73
37
|
};
|
|
74
|
-
|
|
75
|
-
if (bid.value) {
|
|
76
|
-
fetchRecord(bid.value);
|
|
77
|
-
} else {
|
|
78
|
-
// const orgRecordid = ref(String(useRoute().params.id));
|
|
79
|
-
// const orgdata = (await orgdoc.getById(orgRecordid.value)).data;
|
|
80
|
-
doc.setNew();
|
|
81
|
-
isReadOnly.value = false;
|
|
82
|
-
data.value.tenantId = getUserProfile().tenantId;
|
|
83
|
-
data.value.orgId = getUserProfile().orgId;
|
|
84
|
-
data.value.organization._id = getUserProfile().orgRecordId;
|
|
85
|
-
data.value.organization.label = getUserProfile().orgName;
|
|
86
|
-
data.value.organization.orgId = getUserProfile().orgId;
|
|
87
|
-
data.value.organization.code = getUserProfile().orgCode;
|
|
88
|
-
}
|
|
89
38
|
</script>
|
|
90
|
-
<template>
|
|
91
|
-
<div class="grid grid-cols2">
|
|
92
|
-
<SimpleAppForm :document="doc" #default="o" :readonly="isReadOnly">
|
|
93
|
-
<div v-if="!isReadOnly" class="col-span-4 text-left gap-4">
|
|
94
|
-
<Button
|
|
95
|
-
class="btn btn-primary"
|
|
96
|
-
:isReadOnly="isReadOnly"
|
|
97
|
-
@click="createData"
|
|
98
|
-
type="button"
|
|
99
|
-
v-if="canPerform(doc.getDocName(), 'create') && doc.isNew()"
|
|
100
|
-
>Create</Button
|
|
101
|
-
>
|
|
102
|
-
<Button
|
|
103
|
-
class="btn btn-primary"
|
|
104
|
-
@click="updateData"
|
|
105
|
-
type="button"
|
|
106
|
-
v-if="canPerform(doc.getDocName(), 'update') && !doc.isNew()"
|
|
107
|
-
>Update</Button
|
|
108
|
-
>
|
|
109
|
-
<Button
|
|
110
|
-
class="btn btn-danger"
|
|
111
|
-
@click="deleteData($event)"
|
|
112
|
-
type="button"
|
|
113
|
-
v-if="canPerform(doc.getDocName(), 'delete') && !doc.isNew()"
|
|
114
|
-
>Delete</Button
|
|
115
|
-
>
|
|
116
|
-
|
|
117
|
-
<ConfirmPopup></ConfirmPopup>
|
|
118
|
-
</div>
|
|
119
|
-
<div v-else class="col-span-4 text-left gap-4">
|
|
120
|
-
<Button
|
|
121
|
-
class="btn btn-primary"
|
|
122
|
-
@click="isReadOnly = false"
|
|
123
|
-
type="button"
|
|
124
|
-
>Edit</Button
|
|
125
|
-
>
|
|
126
|
-
</div>
|
|
127
|
-
|
|
128
|
-
<SimpleAppInput
|
|
129
|
-
:input-type="SimpleAppInputType.text"
|
|
130
|
-
v-model="data.branchCode"
|
|
131
|
-
:setting="o.getField('#/properties/branchCode')"
|
|
132
|
-
/>
|
|
133
|
-
<SimpleAppInput
|
|
134
|
-
:input-type="SimpleAppInputType.text"
|
|
135
|
-
v-model="data.branchName"
|
|
136
|
-
:setting="o.getField('#/properties/branchName')"
|
|
137
|
-
/>
|
|
138
|
-
<SimpleAppInput
|
|
139
|
-
:input-type="SimpleAppInputType.checkbox"
|
|
140
|
-
v-model="data.active"
|
|
141
|
-
:setting="o.getField('#/properties/active')"
|
|
142
|
-
/>
|
|
143
|
-
<SimpleAppInput
|
|
144
|
-
:input-type="SimpleAppInputType.textarea"
|
|
145
|
-
v-model="data.description"
|
|
146
|
-
:setting="o.getField('#/properties/description')"
|
|
147
|
-
/>
|
|
148
|
-
</SimpleAppForm>
|
|
149
|
-
<DebugDocumentData v-model="data" label="branch" />
|
|
150
|
-
</div>
|
|
151
|
-
</template>
|