@simitgroup/simpleapp-generator 1.0.63 → 1.1.0
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/README copy.md +9 -9
- package/buildinschemas copy/autoincreament.autoinc.jsonschema.json +1 -1
- package/buildinschemas copy/docnoformat.docno.jsonschema.json +2 -2
- package/dist/buildinschemas/autoincreament.js +6 -6
- package/dist/buildinschemas/branch.js +3 -3
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/docnoformat.js +5 -5
- package/dist/buildinschemas/docnoformat.js.map +1 -1
- package/dist/buildinschemas/organization.js +3 -3
- package/dist/buildinschemas/permission.js +5 -5
- package/dist/buildinschemas/permission.js.map +1 -1
- package/dist/buildinschemas/tenant.js +2 -2
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +3 -4
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/generate.js +2 -2
- package/dist/generate.js.map +1 -1
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +6 -6
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/type.d.ts +7 -19
- package/dist/type.d.ts.map +1 -1
- package/docs/backend.md +2 -2
- package/docs/jsonschema.md +6 -6
- package/package.json +1 -1
- package/src/buildinschemas/autoincreament.ts +6 -6
- package/src/buildinschemas/branch.ts +3 -3
- package/src/buildinschemas/docnoformat.ts +5 -5
- package/src/buildinschemas/organization.ts +3 -3
- package/src/buildinschemas/permission.ts +5 -5
- package/src/buildinschemas/tenant.ts +2 -2
- package/src/buildinschemas/user.ts +4 -5
- package/src/generate.ts +2 -2
- package/src/processors/jsonschemabuilder.ts +7 -9
- package/src/processors/jsonschemabuilder.ts-old +5 -5
- package/src/type.ts +20 -20
- package/templates/basic/nest/controller.ts.eta +18 -18
- package/templates/basic/nest/processor.ts.eta +1 -1
- package/templates/basic/nuxt/pages.[id].vue.eta +1 -1
- package/templates/basic/nuxt/pages.landing.vue.eta +12 -17
- package/templates/basic/nuxt/{pages.crud.vue.eta → pages.new.vue.eta} +68 -71
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +6 -6
- package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +1 -1
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +20 -10
- package/templates/nest/src/simpleapp/generate/models/apievent.model.ts.eta +1 -1
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +8 -9
- package/templates/nest/src/simpleapp/generate/types/apievent.type.ts.eta +1 -1
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +16 -7
- package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +10 -7
- package/templates/nest/src/simpleapp/services/branch.service.ts.eta +2 -2
- package/templates/nuxt/assets/css/style.css._eta +32 -0
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +9 -2
- package/templates/nuxt/components/{DebugDocumentData.vue.eta → debug/DebugDocumentData.vue.eta} +8 -4
- package/templates/nuxt/components/{EventNotification.vue.eta → event/EventNotification.vue.eta} +13 -9
- package/templates/nuxt/components/{HeaderBar.vue.eta → header/HeaderBar.vue.eta} +6 -6
- package/templates/nuxt/components/{SelectBranch.vue.eta → header/HeaderSelectBranch.vue.eta} +2 -2
- package/templates/nuxt/components/{ButtonMenuPicker.vue.eta → header/button/HeaderButtonMenuPicker.vue.eta} +3 -3
- package/templates/nuxt/components/list/ListView.vue.eta +64 -0
- package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +11 -0
- package/templates/nuxt/components/renderer/index.ts.eta +12 -0
- package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +77 -0
- package/templates/nuxt/components/{SimpleFieldContainer.vue.eta → simpleApp/SimpleAppFieldContainer.vue.eta} +12 -11
- package/templates/nuxt/components/{SimpleAppForm.vue.eta → simpleApp/SimpleAppForm.vue.eta} +5 -4
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +288 -0
- package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +56 -0
- package/templates/nuxt/components/{SimpleAppAutocomplete.vue.eta → simpleApp/pending/SimpleAppAutocomplete.vue} +14 -3
- package/templates/nuxt/components/{SimpleAppAutocompletemulti.vue.eta → simpleApp/pending/SimpleAppAutocompletemulti.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppCalendar.vue.eta → simpleApp/pending/SimpleAppCalendar.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppCheckbox.vue.eta → simpleApp/pending/SimpleAppCheckbox.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppChip.vue.eta → simpleApp/pending/SimpleAppChip.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppColor.vue.eta → simpleApp/pending/SimpleAppColor.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppDocumentNo.vue.eta → simpleApp/pending/SimpleAppDocumentNo.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppEditor.vue.eta → simpleApp/pending/SimpleAppEditor.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppInputTable.vue.eta → simpleApp/pending/SimpleAppInputTable.vue} +1 -22
- package/templates/nuxt/components/{SimpleAppList.vue.eta → simpleApp/pending/SimpleAppList.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppListmulti.vue.eta → simpleApp/pending/SimpleAppListmulti.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppNumber.vue.eta → simpleApp/pending/SimpleAppNumber.vue} +12 -1
- package/templates/nuxt/components/{SimpleAppPassword.vue.eta → simpleApp/pending/SimpleAppPassword.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppRadio.vue.eta → simpleApp/pending/SimpleAppRadio.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppRating.vue.eta → simpleApp/pending/SimpleAppRating.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppSelect.vue.eta → simpleApp/pending/SimpleAppSelect.vue} +12 -2
- package/templates/nuxt/components/{SimpleAppSelectmulti.vue.eta → simpleApp/pending/SimpleAppSelectmulti.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppSlider.vue.eta → simpleApp/pending/SimpleAppSlider.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppSwitch.vue.eta → simpleApp/pending/SimpleAppSwitch.vue} +1 -1
- package/templates/nuxt/components/{SimpleAppText.vue.eta → simpleApp/pending/SimpleAppText.vue} +13 -4
- package/templates/nuxt/components/{SimpleAppTextarea.vue.eta → simpleApp/pending/SimpleAppTextarea.vue} +13 -2
- package/templates/nuxt/components/{SimpleAppDatatable.vue.eta → table/TableDocuments.vue.eta} +15 -63
- package/templates/nuxt/components/{UserProfileListItem.vue.eta → user/UserProfileListItem.vue.eta} +1 -1
- package/templates/nuxt/composables/getMenus.generate.ts.eta +4 -1
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +32 -1
- package/templates/nuxt/composables/goTo.generate.ts.eta +7 -0
- package/templates/nuxt/composables/notifications.generate.ts.eta +1 -1
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +1 -0
- package/templates/nuxt/layouts/default.vue.eta +1 -1
- package/templates/nuxt/layouts/documentlist.vue.eta +24 -8
- package/templates/nuxt/layouts/sidelist.vue.eta +68 -0
- package/templates/nuxt/layouts/sidelistcrud.vue.eta +1 -1
- package/templates/nuxt/nuxt.config.ts.eta +0 -1
- package/templates/nuxt/pages/[xorg]/branch/index.vue.etax +2 -2
- package/templates/nuxt/pages/[xorg]/docnoformat/{[id].vue.eta → [doctype]/[id].vue.eta} +2 -5
- package/templates/nuxt/pages/[xorg]/docnoformat/[doctype]/new.vue.eta +222 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/[doctype].vue.eta +33 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +4 -294
- package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +100 -0
- package/templates/nuxt/pages/[xorg]/organization/[bid].vue.eta +14 -0
- package/templates/nuxt/pages/[xorg]/organization/[id]/branches/[bid].vue +13 -0
- package/templates/nuxt/pages/[xorg]/organization/[id]/branches/new.vue +149 -0
- package/templates/nuxt/pages/[xorg]/organization/[id]/index.vue.eta +1 -0
- package/templates/nuxt/pages/[xorg]/organization/new.vue.eta +151 -0
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +145 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +23 -23
- package/templates/nuxt/pages/[xorg]/user.vue.eta +13 -11
- package/templates/nuxt/pages/index.vue._eta +2 -2
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +10 -1
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +1 -1
- package/templates/nuxt/types/documentlist.ts.eta +2 -2
- package/templates/nuxt/types/index.ts.eta +2 -1
- package/templates/nuxt/types/simpleappinput.ts.eta +39 -0
- package/templates/project/jsonschemas/category.json._eta +5 -5
- package/templates/project/jsonschemas/customer.json._eta +5 -5
- package/templates/project/jsonschemas/invoice.json._eta +7 -7
- package/templates/project/jsonschemas/product.json._eta +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/ListView.vue.eta +0 -52
- package/templates/nuxt/components/renderers/ForeignKeyRender.vue.eta +0 -10
- package/templates/nuxt/composables/getAutocomplete.generate.ts.eta +0 -32
- package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +0 -168
- /package/templates/nuxt/components/{EventDecision.vue.eta → event/EventDecision.vue.eta} +0 -0
- /package/templates/nuxt/components/{ButtonHome.vue.eta → header/button/HeaderButtonHome.vue.eta} +0 -0
- /package/templates/nuxt/components/{ButtonLogout.vue.eta → header/button/HeaderButtonLogout.vue.eta} +0 -0
- /package/templates/nuxt/components/{ButtonProfile.vue.eta → header/button/HeaderButtonProfile.vue.eta} +0 -0
- /package/templates/nuxt/components/{renderers/BooleanRender.vue.eta → renderer/RendererBoolean.vue.eta} +0 -0
- /package/templates/nuxt/components/{renderers/DateRender.vue.eta → renderer/RendererDate.vue.eta} +0 -0
- /package/templates/nuxt/components/{renderers/MoneyRender.vue.eta → renderer/RendererMoney.vue.eta} +0 -0
- /package/templates/nuxt/components/{renderers/MultiTextRender.vue.eta → renderer/RendererMultiText.vue.eta} +0 -0
- /package/templates/nuxt/components/{SimpleAppDynamicInput.vue.eta → simpleApp/pending/SimpleAppDynamicInput.vue} +0 -0
- /package/templates/nuxt/components/{SimpleAppValue.vue.eta → simpleApp/pending/SimpleAppValue.vue} +0 -0
- /package/templates/nuxt/components/{helper.ts.eta → simpleApp/pending/helper.ts-backup} +0 -0
- /package/templates/nuxt/components/{type.ts.eta → simpleApp/pending/type.ts-backup} +0 -0
- /package/templates/nuxt/components/{CrudNestedDoc.vue.eta → suspended/CrudNestedDoc.vue.eta} +0 -0
- /package/templates/nuxt/components/{CrudSimple.vue.eta → suspended/CrudSimple.vue.eta} +0 -0
- /package/templates/nuxt/components/{Menus.vue.eta → suspended/Menus.vue.eta} +0 -0
- /package/templates/nuxt/components/{Spinner.vue.eta → suspended/Spinner.vue.eta} +0 -0
- /package/templates/nuxt/components/{ButtonCreateTenant.vue.eta → user/UserButtonCreateTenant.vue.eta} +0 -0
- /package/templates/nuxt/components/{ButtonPermissionInfo.vue.eta → user/UserButtonPermissionInfo.vue.eta} +0 -0
- /package/templates/nuxt/components/{Invitation.vue.eta → user/UserInvitation.vue.eta} +0 -0
- /package/templates/nuxt/components/{TenantPicker.vue.eta → user/UserTenantPicker.vue.eta} +0 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by simpleapp everytime regenerate code.
|
|
4
|
+
* delete file "delete-me-for-avoid-override" if you want to modify this file and
|
|
5
|
+
* prevent regenerate code override it.
|
|
6
|
+
* last change 2023-09-09
|
|
7
|
+
* author: Ks Tan
|
|
8
|
+
*/
|
|
9
|
+
import ConfirmPopup from "primevue/confirmpopup";
|
|
10
|
+
import { useConfirm } from "primevue/useconfirm";
|
|
11
|
+
const confirm = useConfirm();
|
|
12
|
+
|
|
13
|
+
const { $BranchDoc, $OrganizationDoc, $event } = useNuxtApp();
|
|
14
|
+
const orgdoc = $OrganizationDoc();
|
|
15
|
+
const doc = $BranchDoc();
|
|
16
|
+
const data = doc.getReactiveData();
|
|
17
|
+
const bid = ref(String(useRoute().params.bid ?? ""));
|
|
18
|
+
|
|
19
|
+
const fetchRecord = async (id: string) => {
|
|
20
|
+
await doc.getById(id);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const disabled = computed(() => {
|
|
24
|
+
return false;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const createData = async () => {
|
|
28
|
+
doc
|
|
29
|
+
.create()
|
|
30
|
+
.then((res) => {
|
|
31
|
+
refresh();
|
|
32
|
+
goBranch(res.data.organization._id, res.data._id);
|
|
33
|
+
})
|
|
34
|
+
.catch((err) => {
|
|
35
|
+
console.error(err);
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const updateData = async () => {
|
|
39
|
+
doc
|
|
40
|
+
.update()
|
|
41
|
+
.then(() => {
|
|
42
|
+
// visible.value=false
|
|
43
|
+
refresh();
|
|
44
|
+
})
|
|
45
|
+
.catch((err) => {
|
|
46
|
+
console.error(err);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
const deleteData = (event: Event) => {
|
|
50
|
+
confirm.require({
|
|
51
|
+
target: event.currentTarget as HTMLElement,
|
|
52
|
+
message: "Delete?",
|
|
53
|
+
icon: "pi pi-exclamation-triangle",
|
|
54
|
+
acceptClass: "p-button-danger",
|
|
55
|
+
accept: () => {
|
|
56
|
+
// disabled.value=true
|
|
57
|
+
doc.delete(data.value._id ?? "").then((res) => {
|
|
58
|
+
refresh();
|
|
59
|
+
goTo(doc.getDocName());
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
reject: () => {
|
|
63
|
+
console.log("Cancel delete");
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const refresh = () => {
|
|
69
|
+
$event("RefreshDocumentList", { documentName: doc.getDocName() });
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
if (bid.value) {
|
|
73
|
+
console.log("bid value", bid.value);
|
|
74
|
+
fetchRecord(bid.value);
|
|
75
|
+
} else {
|
|
76
|
+
const orgRecordid = ref(String(useRoute().params.id));
|
|
77
|
+
const orgdata = (await orgdoc.getById(orgRecordid.value)).data;
|
|
78
|
+
doc.setNew();
|
|
79
|
+
data.value.tenantId = orgdata.tenantId;
|
|
80
|
+
data.value.orgId = orgdata.orgId;
|
|
81
|
+
data.value.organization._id = orgRecordid.value;
|
|
82
|
+
data.value.organization.label = orgdata.orgName;
|
|
83
|
+
data.value.organization.orgId = orgdata.orgId;
|
|
84
|
+
data.value.organization.code = orgdata.orgCode;
|
|
85
|
+
}
|
|
86
|
+
</script>
|
|
87
|
+
<template>
|
|
88
|
+
<div class="grid grid-cols2">
|
|
89
|
+
<SimpleAppForm :document="doc" #default="o">
|
|
90
|
+
<div class="simpleapp-tool-bar col-span-4 text-left gap-4">
|
|
91
|
+
<!-- <Button
|
|
92
|
+
class=""
|
|
93
|
+
:disabled="disabled"
|
|
94
|
+
@click="newData"
|
|
95
|
+
type="button"
|
|
96
|
+
v-if="canPerform(doc.getDocName(), 'create')"
|
|
97
|
+
>New</Button
|
|
98
|
+
> -->
|
|
99
|
+
<Button
|
|
100
|
+
class="btn btn-primary"
|
|
101
|
+
:disabled="disabled"
|
|
102
|
+
@click="createData"
|
|
103
|
+
type="button"
|
|
104
|
+
v-if="canPerform(doc.getDocName(), 'create') && doc.isNew()"
|
|
105
|
+
>Create</Button
|
|
106
|
+
>
|
|
107
|
+
<Button
|
|
108
|
+
class="btn btn-primary"
|
|
109
|
+
:disabled="disabled"
|
|
110
|
+
@click="updateData"
|
|
111
|
+
type="button"
|
|
112
|
+
v-if="canPerform(doc.getDocName(), 'update') && !doc.isNew()"
|
|
113
|
+
>Update</Button
|
|
114
|
+
>
|
|
115
|
+
<Button
|
|
116
|
+
class="btn btn-danger"
|
|
117
|
+
:disabled="disabled"
|
|
118
|
+
@click="deleteData($event)"
|
|
119
|
+
type="button"
|
|
120
|
+
v-if="canPerform(doc.getDocName(), 'delete') && !doc.isNew()"
|
|
121
|
+
>Delete</Button
|
|
122
|
+
>
|
|
123
|
+
|
|
124
|
+
<ProgressSpinner
|
|
125
|
+
v-if="disabled == true"
|
|
126
|
+
style="width: 2rem; height: 2rem"
|
|
127
|
+
></ProgressSpinner>
|
|
128
|
+
<ConfirmPopup></ConfirmPopup>
|
|
129
|
+
</div>
|
|
130
|
+
<SimpleAppText
|
|
131
|
+
v-model="data.branchCode"
|
|
132
|
+
:setting="o.getField('#/properties/branchCode')"
|
|
133
|
+
/>
|
|
134
|
+
<SimpleAppText
|
|
135
|
+
v-model="data.branchName"
|
|
136
|
+
:setting="o.getField('#/properties/branchName')"
|
|
137
|
+
/>
|
|
138
|
+
<SimpleAppCheckbox
|
|
139
|
+
v-model="data.active"
|
|
140
|
+
:setting="o.getField('#/properties/active')"
|
|
141
|
+
/>
|
|
142
|
+
<SimpleAppTextarea
|
|
143
|
+
v-model="data.description"
|
|
144
|
+
:setting="o.getField('#/properties/description')"
|
|
145
|
+
/>
|
|
146
|
+
</SimpleAppForm>
|
|
147
|
+
<DebugDocumentData v-model="data" label="branch" />
|
|
148
|
+
</div>
|
|
149
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template></template>
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by simpleapp everytime regenerate code.
|
|
4
|
+
* delete file "delete-me-for-avoid-override" if you want to modify this file and
|
|
5
|
+
* prevent regenerate code override it.
|
|
6
|
+
* last change 2023-09-09
|
|
7
|
+
* author: Ks Tan
|
|
8
|
+
*/
|
|
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
|
+
|
|
70
|
+
const refresh = () => {
|
|
71
|
+
$event("RefreshDocumentList", { documentName: doc.getDocName() });
|
|
72
|
+
isReadOnly.value = true;
|
|
73
|
+
};
|
|
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
|
+
</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>
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by simpleapp everytime regenerate code.
|
|
4
|
+
* delete file "delete-me-for-avoid-override" if you want to modify this file and
|
|
5
|
+
* prevent regenerate code override it.
|
|
6
|
+
* last change 2023-09-09
|
|
7
|
+
* author: Ks Tan
|
|
8
|
+
*/
|
|
9
|
+
import { SimpleAppInputType } from "~/types";
|
|
10
|
+
import ConfirmPopup from "primevue/confirmpopup";
|
|
11
|
+
import { useConfirm } from "primevue/useconfirm";
|
|
12
|
+
const confirm = useConfirm();
|
|
13
|
+
|
|
14
|
+
const { $OrganizationDoc, $BranchDoc, $event, $listen } = useNuxtApp();
|
|
15
|
+
const doc = $OrganizationDoc();
|
|
16
|
+
const brancdoc = $BranchDoc();
|
|
17
|
+
const data = doc.getReactiveData();
|
|
18
|
+
const branchlist = ref([]);
|
|
19
|
+
const isReadOnly = ref(true);
|
|
20
|
+
const getCurrentOrg = async () => {
|
|
21
|
+
await doc.getById(getUserProfile().orgRecordId);
|
|
22
|
+
};
|
|
23
|
+
const fetchRecord = async (id: string) => {
|
|
24
|
+
await doc.getById(id);
|
|
25
|
+
branchlist.value = await brancdoc.search({
|
|
26
|
+
filter: { orgId: data.value.orgId },
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const id = computed((): string => String(useRoute().params.id ?? ""));
|
|
31
|
+
const updateData = async () => {
|
|
32
|
+
doc
|
|
33
|
+
.update()
|
|
34
|
+
.then(() => {
|
|
35
|
+
refresh();
|
|
36
|
+
isReadOnly.value = true;
|
|
37
|
+
})
|
|
38
|
+
.catch((err) => {
|
|
39
|
+
console.error(err);
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const refresh = () => {
|
|
44
|
+
$event("RefreshDocumentList", { documentName: doc.getDocName() });
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//branch record update then reload
|
|
48
|
+
$listen("RefreshDocumentList", (data) => {
|
|
49
|
+
console.log("refresh from branch", data.documentName, "==", doc.getDocName());
|
|
50
|
+
if (data.documentName == "branch") {
|
|
51
|
+
fetchRecord(id.value);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (id) {
|
|
56
|
+
fetchRecord(id.value);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getCurrentOrg();
|
|
60
|
+
</script>
|
|
61
|
+
<template>
|
|
62
|
+
<div class="grid grid-cols-3">
|
|
63
|
+
<div class="">
|
|
64
|
+
<Card>
|
|
65
|
+
<template #header><h1 class="text-2xl">Organization</h1></template>
|
|
66
|
+
<template #content>
|
|
67
|
+
<SimpleAppForm #default="o" :document="doc" :readonly="isReadOnly">
|
|
68
|
+
<div
|
|
69
|
+
class="simpleapp-tool-bar col-span-4 text-left gap-4"
|
|
70
|
+
v-if="canPerform(doc.getDocName(), 'update')"
|
|
71
|
+
>
|
|
72
|
+
<Button
|
|
73
|
+
v-if="isReadOnly"
|
|
74
|
+
class="btn btn-primary"
|
|
75
|
+
@click="isReadOnly = false"
|
|
76
|
+
type="button"
|
|
77
|
+
>Edit</Button
|
|
78
|
+
>
|
|
79
|
+
<Button
|
|
80
|
+
v-else
|
|
81
|
+
class="btn btn-primary"
|
|
82
|
+
@click="updateData"
|
|
83
|
+
type="button"
|
|
84
|
+
>Update</Button
|
|
85
|
+
>
|
|
86
|
+
<ConfirmPopup></ConfirmPopup>
|
|
87
|
+
</div>
|
|
88
|
+
<div class="flex flex-col">
|
|
89
|
+
<div class="flex flex-row gap-4">
|
|
90
|
+
<SimpleAppInput
|
|
91
|
+
:input-type="SimpleAppInputType.text"
|
|
92
|
+
autofocus
|
|
93
|
+
v-model="data.orgCode"
|
|
94
|
+
:setting="o.getField('#/properties/orgCode')"
|
|
95
|
+
/>
|
|
96
|
+
<SimpleAppInput
|
|
97
|
+
:input-type="SimpleAppInputType.text"
|
|
98
|
+
v-model="data.orgName"
|
|
99
|
+
class=""
|
|
100
|
+
:setting="o.getField('#/properties/orgName')"
|
|
101
|
+
/>
|
|
102
|
+
<SimpleAppInput
|
|
103
|
+
:input-type="SimpleAppInputType.checkbox"
|
|
104
|
+
v-model="data.active"
|
|
105
|
+
:setting="o.getField('#/properties/active')"
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
<div>
|
|
109
|
+
<SimpleAppInput
|
|
110
|
+
:input-type="SimpleAppInputType.textarea"
|
|
111
|
+
:setting="o.getField('#/properties/description')"
|
|
112
|
+
v-model="data.description"
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
<DebugDocumentData v-model="data" label="organization" />
|
|
117
|
+
</SimpleAppForm>
|
|
118
|
+
</template>
|
|
119
|
+
</Card>
|
|
120
|
+
</div>
|
|
121
|
+
<div>
|
|
122
|
+
<Card>
|
|
123
|
+
<template #header>
|
|
124
|
+
<!-- <h1 class="text-2xl font-bold">{{ data.orgName }}</h1> -->
|
|
125
|
+
</template>
|
|
126
|
+
<template #content>
|
|
127
|
+
<div class="">
|
|
128
|
+
<h1>Branches</h1>
|
|
129
|
+
<Button @click="goBranch('new')">New</Button>
|
|
130
|
+
<ListView
|
|
131
|
+
:list="branchlist"
|
|
132
|
+
title-field="branchName"
|
|
133
|
+
sub-title-field="branchCode"
|
|
134
|
+
:url="getDocumentUrl('organization', id)"
|
|
135
|
+
>
|
|
136
|
+
</ListView>
|
|
137
|
+
</div>
|
|
138
|
+
</template>
|
|
139
|
+
</Card>
|
|
140
|
+
</div>
|
|
141
|
+
<div>
|
|
142
|
+
<NuxtPage></NuxtPage>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</template>
|
|
@@ -7,39 +7,40 @@
|
|
|
7
7
|
<template #content>
|
|
8
8
|
<SimpleAppForm :document="userdoc" #default="o">
|
|
9
9
|
<div class="flex flex-col gap-2">
|
|
10
|
-
<
|
|
10
|
+
<SimpleAppInput
|
|
11
|
+
:input-type="SimpleAppInputType.text"
|
|
11
12
|
autofocus
|
|
12
|
-
:setting="o.getField('#/properties/
|
|
13
|
-
v-model="userdata.
|
|
13
|
+
:setting="o.getField('#/properties/fullName')"
|
|
14
|
+
v-model="userdata.fullName"
|
|
14
15
|
/>
|
|
15
16
|
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
type="
|
|
17
|
+
<SimpleAppInput
|
|
18
|
+
:input-type="SimpleAppInputType.text"
|
|
19
|
+
type="email"
|
|
19
20
|
:setting="o.getField('#/properties/email')"
|
|
20
21
|
v-model="userdata.email"
|
|
21
22
|
/>
|
|
22
23
|
|
|
23
|
-
<
|
|
24
|
-
|
|
24
|
+
<SimpleAppInput
|
|
25
|
+
:input-type="SimpleAppInputType.checkbox"
|
|
25
26
|
:setting="o.getField('#/properties/active')"
|
|
26
27
|
v-model="userdata.active"
|
|
27
28
|
/>
|
|
28
|
-
<
|
|
29
|
-
|
|
29
|
+
<SimpleAppInput
|
|
30
|
+
:input-type="SimpleAppInputType.textarea"
|
|
30
31
|
:setting="o.getField('#/properties/description')"
|
|
31
32
|
v-model="userdata.description"
|
|
32
33
|
/>
|
|
33
34
|
<div>
|
|
34
35
|
<Button
|
|
35
36
|
@click="saveUser"
|
|
36
|
-
class="
|
|
37
|
+
class="btn btn-primary"
|
|
37
38
|
>Save</Button
|
|
38
39
|
>
|
|
39
40
|
<Button
|
|
40
41
|
v-if="canPerform('user', 'delete')"
|
|
41
42
|
@click="deleteUser"
|
|
42
|
-
class="
|
|
43
|
+
class="btn btn-danger"
|
|
43
44
|
>Delete</Button
|
|
44
45
|
>
|
|
45
46
|
</div>
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
<div class="relative w-full ...">
|
|
54
55
|
<h1 class="font-bold">{{ permissiontitle }}</h1>
|
|
55
56
|
<div class="absolute top-0 right-0 h-16 w-16 ...">
|
|
56
|
-
<
|
|
57
|
+
<UserButtonPermissionInfo></UserButtonPermissionInfo>
|
|
57
58
|
</div>
|
|
58
59
|
</div>
|
|
59
60
|
</template>
|
|
@@ -64,16 +65,14 @@
|
|
|
64
65
|
</div> -->
|
|
65
66
|
|
|
66
67
|
<div class="">
|
|
67
|
-
<Card
|
|
68
|
+
<Card
|
|
69
|
+
v-if="currentpermissions.length > 0"
|
|
70
|
+
v-for="o in orglist"
|
|
71
|
+
class="m-2"
|
|
72
|
+
>
|
|
68
73
|
<template #title>{{ o.orgName }}</template>
|
|
69
74
|
<template #content>
|
|
70
75
|
<table class="w w-full">
|
|
71
|
-
<!-- <thead class="">
|
|
72
|
-
<tr>
|
|
73
|
-
<th class="text-center font-normal">Branch</th>
|
|
74
|
-
<th class="text-left font-normal">Access Right</th>
|
|
75
|
-
</tr>
|
|
76
|
-
</thead> -->
|
|
77
76
|
<tr v-for="(b, index) in branchlist">
|
|
78
77
|
<td v-if="checkBranchInOrg(o, b)" class="text-center">
|
|
79
78
|
{{ b.branchCode }}
|
|
@@ -103,7 +102,8 @@
|
|
|
103
102
|
</div>
|
|
104
103
|
</template>
|
|
105
104
|
<script setup lang="ts">
|
|
106
|
-
import Card from "primevue/card";
|
|
105
|
+
// import Card from "primevue/card";
|
|
106
|
+
import {SimpleAppInputType} from "~/types"
|
|
107
107
|
import { Permission, User } from "../../../simpleapp/generate/openapi/api";
|
|
108
108
|
import _ from "lodash";
|
|
109
109
|
import SelectButton from "primevue/selectbutton";
|
|
@@ -207,7 +207,7 @@ const saveUser = async () => {
|
|
|
207
207
|
};
|
|
208
208
|
|
|
209
209
|
const onSelectUser = async (userId: string) => {
|
|
210
|
-
console.log(
|
|
210
|
+
console.log("onSelectUser", userId);
|
|
211
211
|
// .addRoute()
|
|
212
212
|
// const user: UserListItem = { ...menuitem };
|
|
213
213
|
const orgsearchbody: SearchBody = {
|
|
@@ -296,7 +296,7 @@ const getPermssionData = (userId: string, branchId: number) => {
|
|
|
296
296
|
|
|
297
297
|
onMounted(() => {
|
|
298
298
|
const id = String(useRoute().params.id);
|
|
299
|
-
console.log("id",id)
|
|
299
|
+
console.log("id", id);
|
|
300
300
|
onSelectUser(id);
|
|
301
301
|
});
|
|
302
302
|
</script>
|
|
@@ -72,7 +72,7 @@ const refreshList = async (resetpage: boolean = true) => {
|
|
|
72
72
|
"uid",
|
|
73
73
|
"email",
|
|
74
74
|
"created",
|
|
75
|
-
"
|
|
75
|
+
"fullName",
|
|
76
76
|
"active",
|
|
77
77
|
"lastActivity",
|
|
78
78
|
"description",
|
|
@@ -111,7 +111,7 @@ const invite = async () => {
|
|
|
111
111
|
inviteuserdoc.setNew();
|
|
112
112
|
const newuserdata = inviteuserdoc.getReactiveData();
|
|
113
113
|
newuserdata.value.email = inviteemail.value;
|
|
114
|
-
newuserdata.value.
|
|
114
|
+
newuserdata.value.fullName = inviteemail.value.split("@")[0];
|
|
115
115
|
newuserdata.value.active = true;
|
|
116
116
|
newuserdata.value.tenantId = currentuser.tenantId;
|
|
117
117
|
newuserdata.value.orgId = currentuser.orgId;
|
|
@@ -126,7 +126,7 @@ const invite = async () => {
|
|
|
126
126
|
$listen("RefreshUser", () => {
|
|
127
127
|
refreshList();
|
|
128
128
|
});
|
|
129
|
-
onMounted(() => {
|
|
129
|
+
onMounted(() => {
|
|
130
130
|
refreshList();
|
|
131
131
|
});
|
|
132
132
|
</script>
|
|
@@ -161,19 +161,21 @@ onMounted(() => {
|
|
|
161
161
|
<TabPanel header="Invite">
|
|
162
162
|
<div class="padding p-2">
|
|
163
163
|
<form @submit.prevent="true" class="w-full">
|
|
164
|
-
<div class="p-inputgroup flex-
|
|
164
|
+
<div class="p-inputgroup flex flex-row ">
|
|
165
165
|
<InputText
|
|
166
|
+
class="flex-1"
|
|
166
167
|
type="email"
|
|
167
168
|
placeholder="email"
|
|
168
169
|
v-model="inviteemail"
|
|
169
170
|
/>
|
|
170
|
-
<
|
|
171
|
-
label="Search"
|
|
172
|
-
class="
|
|
173
|
-
@click="invite"
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
</
|
|
171
|
+
<div class="p-inputgroup-addon p p-0">
|
|
172
|
+
<button label="Search"
|
|
173
|
+
class="border rounded-tl-none rounded-bl-none btn btn-primary -ml-1 h-full p-3 rounded-r-md"
|
|
174
|
+
@click="invite">
|
|
175
|
+
Invite
|
|
176
|
+
</button>
|
|
177
|
+
</div>
|
|
178
|
+
|
|
177
179
|
</div>
|
|
178
180
|
</form>
|
|
179
181
|
</div>
|
|
@@ -56,7 +56,7 @@ onMounted(() => {
|
|
|
56
56
|
something else.
|
|
57
57
|
</p>
|
|
58
58
|
<div class="mt-8 md:flex justify-start md:gap-4">
|
|
59
|
-
<
|
|
59
|
+
<UserButtonCreateTenant></UserButtonCreateTenant>
|
|
60
60
|
</div>
|
|
61
61
|
</div>
|
|
62
62
|
<div class="pt-8 lg:pt-0">
|
|
@@ -95,7 +95,7 @@ onMounted(() => {
|
|
|
95
95
|
</div>
|
|
96
96
|
</div>
|
|
97
97
|
<div class="grid grid-cols-2">
|
|
98
|
-
<
|
|
98
|
+
<UserTenantPicker v-for="tenant in alltenants" :tenant="tenant" class="col col-span-1"></UserTenantPicker>
|
|
99
99
|
</div>
|
|
100
100
|
</div>
|
|
101
101
|
</template>
|
|
@@ -14,13 +14,16 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
const useUserStore = defineStore('userstore', {
|
|
17
|
-
state: ()=>({
|
|
17
|
+
state: ()=>({
|
|
18
|
+
_id: ref(''),
|
|
18
19
|
sessionId:ref(''),
|
|
19
20
|
tenantId:ref(0),
|
|
20
21
|
orgId:ref(0),
|
|
21
22
|
branchId:ref(0),
|
|
23
|
+
branchRecordId:ref(''),
|
|
22
24
|
branchCode:ref(''),
|
|
23
25
|
branchName:ref(''),
|
|
26
|
+
orgRecordId:ref(''),
|
|
24
27
|
orgCode:ref(''),
|
|
25
28
|
orgName:ref(''),
|
|
26
29
|
uid: ref(''),
|
|
@@ -52,10 +55,13 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
52
55
|
if(!res){
|
|
53
56
|
return
|
|
54
57
|
}
|
|
58
|
+
this._id = res.data._id
|
|
55
59
|
this.sessionId = res.data.sessionId
|
|
56
60
|
this.tenantId = res.data.tenantId
|
|
57
61
|
this.orgId = res.data.orgId
|
|
62
|
+
this.orgRecordId = res.data.orgRecordId
|
|
58
63
|
this.branchId = res.data.branchId
|
|
64
|
+
this.branchRecordId = res.data.branchRecordId
|
|
59
65
|
this.branchCode = res.data.branchCode
|
|
60
66
|
this.branchName = res.data.branchName
|
|
61
67
|
this.orgCode = res.data.orgCode
|
|
@@ -136,10 +142,13 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
136
142
|
},
|
|
137
143
|
getUserInfo(){
|
|
138
144
|
return {
|
|
145
|
+
_id : this._id,
|
|
139
146
|
sessionId : this.sessionId,
|
|
140
147
|
tenantId : this.tenantId,
|
|
141
148
|
orgId : this.orgId,
|
|
142
149
|
branchId : this.branchId,
|
|
150
|
+
orgRecordId: this.orgRecordId,
|
|
151
|
+
branchRecordId: this.branchRecordId,
|
|
143
152
|
uid : this.uid,
|
|
144
153
|
email : this.email,
|
|
145
154
|
branchCode: this.branchCode,
|