@simitgroup/simpleapp-generator 1.0.63 → 1.0.64
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.js +3 -3
- 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 +3 -3
- 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 +11 -16
- package/templates/basic/nuxt/{pages.crud.vue.eta → pages.new.vue.eta} +22 -9
- 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 -8
- 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 +4 -0
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +2 -1
- package/templates/nuxt/components/{SimpleAppDatatable.vue.eta → DocumentDatatable.vue.eta} +15 -63
- package/templates/nuxt/components/ListView.vue.eta +38 -26
- package/templates/nuxt/components/UserProfileListItem.vue.eta +1 -1
- package/templates/nuxt/components/{EventNotification.vue.eta → event/EventNotification.vue.eta} +1 -1
- 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/renderer/RendererForeignKey.vue.eta +11 -0
- package/templates/nuxt/components/renderer/index.ts.eta +12 -0
- package/templates/nuxt/components/{SimpleAppAutocomplete.vue.eta → simpleApp/SimpleAppAutocomplete.vue.eta} +13 -1
- package/templates/nuxt/components/{SimpleAppAutocompletemulti.vue.eta → simpleApp/SimpleAppAutocompletemulti.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppCalendar.vue.eta → simpleApp/SimpleAppCalendar.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppCheckbox.vue.eta → simpleApp/SimpleAppCheckbox.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppChip.vue.eta → simpleApp/SimpleAppChip.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppColor.vue.eta → simpleApp/SimpleAppColor.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppDocumentNo.vue.eta → simpleApp/SimpleAppDocumentNo.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppEditor.vue.eta → simpleApp/SimpleAppEditor.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppList.vue.eta → simpleApp/SimpleAppList.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppListmulti.vue.eta → simpleApp/SimpleAppListmulti.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppNumber.vue.eta → simpleApp/SimpleAppNumber.vue.eta} +12 -1
- package/templates/nuxt/components/{SimpleAppPassword.vue.eta → simpleApp/SimpleAppPassword.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppRadio.vue.eta → simpleApp/SimpleAppRadio.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppRating.vue.eta → simpleApp/SimpleAppRating.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppSelect.vue.eta → simpleApp/SimpleAppSelect.vue.eta} +12 -2
- package/templates/nuxt/components/{SimpleAppSelectmulti.vue.eta → simpleApp/SimpleAppSelectmulti.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppSlider.vue.eta → simpleApp/SimpleAppSlider.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppSwitch.vue.eta → simpleApp/SimpleAppSwitch.vue.eta} +1 -1
- package/templates/nuxt/components/{SimpleAppText.vue.eta → simpleApp/SimpleAppText.vue.eta} +13 -2
- package/templates/nuxt/components/{SimpleAppTextarea.vue.eta → simpleApp/SimpleAppTextarea.vue.eta} +13 -2
- package/templates/nuxt/composables/getMenus.generate.ts.eta +4 -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/documentlist.vue.eta +23 -7
- package/templates/nuxt/layouts/sidelist.vue.eta +68 -0
- 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 +216 -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 +145 -0
- package/templates/nuxt/pages/[xorg]/organization.vue.eta +130 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +28 -33
- package/templates/nuxt/pages/[xorg]/user.vue.eta +3 -3
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +1 -1
- package/templates/nuxt/types/documentlist.ts.eta +2 -2
- package/templates/project/jsonschemas/category.json._eta +2 -2
- package/templates/project/jsonschemas/customer.json._eta +2 -2
- package/templates/project/jsonschemas/invoice.json._eta +4 -4
- package/templates/project/jsonschemas/product.json._eta +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/renderers/ForeignKeyRender.vue.eta +0 -10
- package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +0 -168
- /package/templates/nuxt/components/{DebugDocumentData.vue.eta → debug/DebugDocumentData.vue.eta} +0 -0
- /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/SimpleAppDynamicInput.vue.eta} +0 -0
- /package/templates/nuxt/components/{SimpleFieldContainer.vue.eta → simpleApp/SimpleAppFieldContainer.vue.eta} +0 -0
- /package/templates/nuxt/components/{SimpleAppForm.vue.eta → simpleApp/SimpleAppForm.vue.eta} +0 -0
- /package/templates/nuxt/components/{SimpleAppInputTable.vue.eta → simpleApp/SimpleAppInputTable.vue.eta} +0 -0
- /package/templates/nuxt/components/{SimpleAppValue.vue.eta → simpleApp/SimpleAppValue.vue.eta} +0 -0
- /package/templates/nuxt/components/{helper.ts.eta → simpleApp/helper.ts.eta} +0 -0
- /package/templates/nuxt/components/{type.ts.eta → simpleApp/type.ts.eta} +0 -0
|
@@ -1,296 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<SimpleAppDatatable
|
|
6
|
-
v-model="recordlist"
|
|
7
|
-
:setting="{}"
|
|
8
|
-
:columns="[
|
|
9
|
-
'branch.label',
|
|
10
|
-
'docNoFormatNo',
|
|
11
|
-
'docNoFormatName',
|
|
12
|
-
'active',
|
|
13
|
-
'docNoPattern',
|
|
14
|
-
'nextNumber',
|
|
15
|
-
]"
|
|
16
|
-
>
|
|
17
|
-
<Column header="action">
|
|
18
|
-
<template #body="{ data, index }">
|
|
19
|
-
<Button
|
|
20
|
-
class="pi pi-pencil btn-primary"
|
|
21
|
-
@click="triggerEdit(data)"
|
|
22
|
-
></Button>
|
|
23
|
-
<Button
|
|
24
|
-
class="pi pi-times btn-danger"
|
|
25
|
-
@click="triggerDelete(data)"
|
|
26
|
-
></Button>
|
|
27
|
-
</template>
|
|
28
|
-
</Column>
|
|
29
|
-
</SimpleAppDatatable>
|
|
30
|
-
<Dialog
|
|
31
|
-
v-model:visible="visible"
|
|
32
|
-
modal
|
|
33
|
-
:header="popuptitle"
|
|
34
|
-
class="crudsimple-dialog"
|
|
35
|
-
:autoZIndex="false"
|
|
36
|
-
:style="{ zIndex: 100, width: '80vw' }"
|
|
37
|
-
>
|
|
38
|
-
<div class="simpleapp-tool-bar col-span-4 text-left gap-4">
|
|
39
|
-
<Button
|
|
40
|
-
class="btn-default"
|
|
41
|
-
:disabled="disabled"
|
|
42
|
-
@click="newRecord"
|
|
43
|
-
type="button"
|
|
44
|
-
v-if="canPerform(resourcename, 'create')"
|
|
45
|
-
>
|
|
46
|
-
New
|
|
47
|
-
</Button>
|
|
48
|
-
<Button
|
|
49
|
-
class="btn-primary"
|
|
50
|
-
:disabled="disabled"
|
|
51
|
-
@click="createData"
|
|
52
|
-
type="button"
|
|
53
|
-
v-if="canPerform(resourcename, 'create') && data.created == ''"
|
|
54
|
-
>
|
|
55
|
-
Create
|
|
56
|
-
</Button>
|
|
57
|
-
<Button
|
|
58
|
-
class="btn-primary"
|
|
59
|
-
:disabled="disabled"
|
|
60
|
-
@click="updateData"
|
|
61
|
-
type="button"
|
|
62
|
-
v-if="canPerform(resourcename, 'update') && data.created != ''"
|
|
63
|
-
>
|
|
64
|
-
Update
|
|
65
|
-
</Button>
|
|
66
|
-
<Button
|
|
67
|
-
class="btn-danger"
|
|
68
|
-
:disabled="disabled"
|
|
69
|
-
@click="deleteData($event)"
|
|
70
|
-
type="button"
|
|
71
|
-
v-if="canPerform(resourcename, 'delete') && data.created != ''"
|
|
72
|
-
>
|
|
73
|
-
Delete
|
|
74
|
-
</Button>
|
|
75
|
-
<ProgressSpinner
|
|
76
|
-
v-if="disabled == true"
|
|
77
|
-
style="width: 2rem; height: 2rem"
|
|
78
|
-
></ProgressSpinner>
|
|
79
|
-
<ConfirmPopup></ConfirmPopup>
|
|
80
|
-
</div>
|
|
81
|
-
<SimpleAppForm :document="doc" #default="o" title="Document No">
|
|
82
|
-
<div class="grid grid-cols-4 gap-4">
|
|
83
|
-
<SimpleAppText
|
|
84
|
-
autofocus
|
|
85
|
-
:setting="o.getField('#/properties/docNoFormatNo')"
|
|
86
|
-
v-model="data.docNoFormatNo"
|
|
87
|
-
/>
|
|
88
|
-
<SimpleAppText
|
|
89
|
-
autofocus
|
|
90
|
-
:setting="o.getField('#/properties/docNoFormatName')"
|
|
91
|
-
v-model="data.docNoFormatName"
|
|
92
|
-
/>
|
|
93
|
-
<SimpleAppAutocomplete
|
|
94
|
-
v-model="data.branch"
|
|
95
|
-
:setting="o.getField('#/properties/branch')"
|
|
96
|
-
:remoteSrc="getAutocomplete('branch')"
|
|
97
|
-
optionLabel="label"
|
|
98
|
-
/>
|
|
99
|
-
<SimpleAppCheckbox
|
|
100
|
-
autofocus
|
|
101
|
-
:setting="o.getField('#/properties/active')"
|
|
102
|
-
v-model="data.active"
|
|
103
|
-
/>
|
|
2
|
+
<div></div>
|
|
3
|
+
</template>
|
|
4
|
+
<script setup lang="ts">
|
|
104
5
|
|
|
105
|
-
|
|
106
|
-
autofocus
|
|
107
|
-
:setting="o.getField('#/properties/default')"
|
|
108
|
-
v-model="data.default"
|
|
109
|
-
/>
|
|
110
|
-
|
|
111
|
-
<SimpleAppText
|
|
112
|
-
autofocus
|
|
113
|
-
:setting="o.getField('#/properties/docNoPattern')"
|
|
114
|
-
v-model="data.docNoPattern"
|
|
115
|
-
@change="updateSample"
|
|
116
|
-
:description="sample"
|
|
117
|
-
v-tooltip="'Examples: PO-<00000>, SI{YY}/<000>, SI{YYMM}/<000>'"
|
|
118
|
-
/>
|
|
119
|
-
|
|
120
|
-
<SimpleAppNumber
|
|
121
|
-
autofocus
|
|
122
|
-
:setting="o.getField('#/properties/nextNumber')"
|
|
123
|
-
v-model="data.nextNumber"
|
|
124
|
-
/>
|
|
125
|
-
</div>
|
|
126
|
-
</SimpleAppForm>
|
|
127
|
-
</Dialog>
|
|
128
|
-
</template>
|
|
129
|
-
<script setup lang="ts">
|
|
130
|
-
import _ from "lodash";
|
|
131
|
-
import moment from "moment";
|
|
132
|
-
import Dialog from "primevue/dialog";
|
|
133
|
-
import Column from "primevue/column";
|
|
134
|
-
import { ListItem } from "@/types/listview";
|
|
135
|
-
import ProgressSpinner from "primevue/progressspinner";
|
|
136
|
-
import ConfirmPopup from "primevue/confirmpopup";
|
|
137
|
-
import { useConfirm } from "primevue/useconfirm";
|
|
138
|
-
const { $event, $listen, $DocnoformatDoc } = useNuxtApp();
|
|
139
|
-
const doc = $DocnoformatDoc();
|
|
140
|
-
const data = doc.getReactiveData();
|
|
141
|
-
|
|
142
|
-
const visible = ref(false);
|
|
143
|
-
const disabled = ref(false);
|
|
144
|
-
const popuptitle = ref("edit");
|
|
145
|
-
const recordlist = ref();
|
|
146
|
-
const selectedDoctype = ref("");
|
|
147
|
-
const havedocdate = ref(false);
|
|
148
|
-
const confirm = useConfirm();
|
|
149
|
-
// This will work in both `<script setup>` and `<script>`
|
|
150
|
-
if(data.value.created==''){
|
|
151
|
-
definePageMeta({
|
|
152
|
-
layout: "sidelistcrud",
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const sample = ref("");
|
|
157
|
-
const resourcename = ref(_.upperFirst(doc.getDocName()));
|
|
158
|
-
|
|
159
|
-
const refresh = async () => {
|
|
160
|
-
const filter = { docNoType: selectedDoctype.value };
|
|
161
|
-
|
|
162
|
-
console.log("selectedDoctype", selectedDoctype.value);
|
|
163
|
-
|
|
164
|
-
const results = await doc.search({ filter: filter });
|
|
165
|
-
recordlist.value = results;
|
|
166
|
-
};
|
|
167
|
-
$listen("itemselected", (item: ListItem) => {
|
|
168
|
-
selectedDoctype.value = item.code;
|
|
169
|
-
havedocdate.value = item.data.documentDate != "";
|
|
170
|
-
refresh();
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
const updateSample = () => {
|
|
174
|
-
sample.value = "Example: " + previewDocNo();
|
|
175
|
-
};
|
|
176
|
-
onMounted(() => {
|
|
177
|
-
const doclist = getDocTypes();
|
|
178
|
-
console.log(doclist);
|
|
179
|
-
const listdata: ListItem[] = getDocTypes()
|
|
180
|
-
.filter((item) => item.docNumber)
|
|
181
|
-
.map(
|
|
182
|
-
(item) =>
|
|
183
|
-
({ name: item.docName, code: item.docType, data: item }) as ListItem,
|
|
184
|
-
);
|
|
185
|
-
$event("listloaded", listdata);
|
|
186
|
-
});
|
|
187
|
-
const newRecord = () => {
|
|
188
|
-
// useRouter().push({ path: `${props.path}` })
|
|
189
|
-
doc.setNew();
|
|
190
|
-
data.value.docNoType = selectedDoctype.value;
|
|
191
|
-
|
|
192
|
-
visible.value = true;
|
|
193
|
-
$event("newRecord");
|
|
194
|
-
};
|
|
195
|
-
const createData = () => {
|
|
196
|
-
disabled.value = true;
|
|
197
|
-
|
|
198
|
-
doc
|
|
199
|
-
.create()
|
|
200
|
-
.then(() => {
|
|
201
|
-
visible.value = false;
|
|
202
|
-
refresh();
|
|
203
|
-
})
|
|
204
|
-
.catch((err) => {
|
|
205
|
-
console.error(err);
|
|
206
|
-
})
|
|
207
|
-
.finally(() => (disabled.value = false));
|
|
208
|
-
};
|
|
209
|
-
const updateData = () => {
|
|
210
|
-
disabled.value = true;
|
|
211
|
-
|
|
212
|
-
doc
|
|
213
|
-
.update()
|
|
214
|
-
.then(() => {
|
|
215
|
-
visible.value = false;
|
|
216
|
-
refresh();
|
|
217
|
-
})
|
|
218
|
-
.catch((err) => {
|
|
219
|
-
console.error(err);
|
|
220
|
-
})
|
|
221
|
-
.finally(() => (disabled.value = false));
|
|
222
|
-
};
|
|
223
|
-
const deleteData = (e: any) => {
|
|
224
|
-
confirm.require({
|
|
225
|
-
target: e.currentTarget as HTMLElement,
|
|
226
|
-
message: "Delete?",
|
|
227
|
-
icon: "pi pi-exclamation-triangle",
|
|
228
|
-
acceptClass: "p-button-danger",
|
|
229
|
-
accept: () => {
|
|
230
|
-
disabled.value = true;
|
|
231
|
-
doc
|
|
232
|
-
.delete(data.value._id ?? "")
|
|
233
|
-
.then(() => (visible.value = false))
|
|
234
|
-
.finally(() => {
|
|
235
|
-
refresh();
|
|
236
|
-
});
|
|
237
|
-
},
|
|
238
|
-
reject: () => {
|
|
239
|
-
console.log("Cancel delete");
|
|
240
|
-
},
|
|
241
|
-
});
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
const triggerDelete = async (event: any) => {
|
|
245
|
-
let id = event._id.toString();
|
|
246
|
-
await doc.delete(id);
|
|
247
|
-
refresh();
|
|
248
|
-
};
|
|
249
|
-
const triggerEdit = async (event: any) => {
|
|
250
|
-
let id = event._id.toString();
|
|
251
|
-
await doc.getById(id);
|
|
252
|
-
console.log(id);
|
|
253
|
-
visible.value = true;
|
|
254
|
-
// useRouter().push({ path: `/${useRoute().params.xorg}/docnoformat/${id}` });
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
const previewDocNo = (): string => {
|
|
258
|
-
const pattern = data.value.docNoPattern;
|
|
259
|
-
if (pattern) {
|
|
260
|
-
const numberReg: RegExp = /\[(.*?)\]/g;
|
|
261
|
-
const dateReg: RegExp = /\{(.*?)\}/g;
|
|
262
|
-
let newvalue = pattern;
|
|
263
|
-
const numberpattern = pattern.match(numberReg);
|
|
264
|
-
const datepattern = pattern.match(dateReg);
|
|
265
|
-
|
|
266
|
-
if (numberpattern && numberpattern.length > 0) {
|
|
267
|
-
const numberlength = numberpattern[0]
|
|
268
|
-
.replace("[", "")
|
|
269
|
-
.replace("]", "").length;
|
|
270
|
-
|
|
271
|
-
let nextnumber = (data.value.nextNumber ?? 0).toString();
|
|
272
|
-
|
|
273
|
-
const numberdiff = numberlength - nextnumber.length;
|
|
274
|
-
|
|
275
|
-
for (let n = 0; n < numberdiff; n++) {
|
|
276
|
-
nextnumber = "0" + nextnumber;
|
|
277
|
-
}
|
|
278
|
-
newvalue = newvalue.replace(numberpattern[0], nextnumber);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (datepattern && datepattern.length > 0) {
|
|
282
|
-
for (let d = 0; d < datepattern.length; d++) {
|
|
283
|
-
const dpattern = datepattern[d];
|
|
284
|
-
const date = new Date();
|
|
285
|
-
const formatteddate = moment().format(
|
|
286
|
-
dpattern.replace("{", "").replace("}", ""),
|
|
287
|
-
);
|
|
288
|
-
newvalue = newvalue.replace(dpattern, formatteddate);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
return newvalue;
|
|
292
|
-
} else {
|
|
293
|
-
return "";
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
</script>
|
|
6
|
+
</script>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="grid grid-cols-5 p-4">
|
|
3
|
+
<ListView :list="getAllDocFormats()"
|
|
4
|
+
idField="docType"
|
|
5
|
+
titleField="docName"
|
|
6
|
+
subTitleField="docType"
|
|
7
|
+
:withFilter="true"
|
|
8
|
+
:url="getDocumentUrl('docnoformat')"></ListView>
|
|
9
|
+
<div class="col-span-4">
|
|
10
|
+
<NuxtPage></NuxtPage>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
</template>
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<!-- <script setup lang="ts">
|
|
22
|
+
/**
|
|
23
|
+
* This file was automatically generated by simpleapp everytime regenerate code.
|
|
24
|
+
* delete file "delete-me-for-avoid-override" if you want to modify this file and
|
|
25
|
+
* prevent regenerate code override it.
|
|
26
|
+
* last change 2023-09-09
|
|
27
|
+
* author: Ks Tan
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { CellSetting } from "~/types";
|
|
31
|
+
const { $DocnoformatDoc } = useNuxtApp();
|
|
32
|
+
const doc = $DocnoformatDoc();
|
|
33
|
+
const data = doc.getReactiveData();
|
|
34
|
+
const visible = ref(false);
|
|
35
|
+
|
|
36
|
+
definePageMeta({
|
|
37
|
+
name: "Docnoformat",
|
|
38
|
+
layout: "documentlist",
|
|
39
|
+
documentName: "docnoformat",
|
|
40
|
+
columns: [
|
|
41
|
+
{
|
|
42
|
+
title: t("branch"),
|
|
43
|
+
field: "branch",
|
|
44
|
+
rendererName: "RendererForeignKey",
|
|
45
|
+
rendererSetting: { collection: "branch" },
|
|
46
|
+
},
|
|
47
|
+
"docNoFormatNo",
|
|
48
|
+
"docNoFormatName",
|
|
49
|
+
"docNoType",
|
|
50
|
+
"docNoPattern",
|
|
51
|
+
"nextNumber",
|
|
52
|
+
] as CellSetting[],
|
|
53
|
+
sorts: [["docNoFormatNo", "asc"]],
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const newData = () => {
|
|
57
|
+
doc.setNew();
|
|
58
|
+
goTo(doc.getDocName(), "new");
|
|
59
|
+
visible.value = true;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const exitRecord = () => {
|
|
63
|
+
goTo(doc.getDocName());
|
|
64
|
+
console.log("exitRecord");
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
watch(
|
|
68
|
+
() => useRoute().fullPath,
|
|
69
|
+
(newvalue, oldvalue) => {
|
|
70
|
+
visible.value = useRoute().params.id ? true : false;
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
onNuxtReady(() => {
|
|
75
|
+
visible.value = useRoute().params.id ? true : false;
|
|
76
|
+
});
|
|
77
|
+
</script>
|
|
78
|
+
<template>
|
|
79
|
+
<div>
|
|
80
|
+
<Button
|
|
81
|
+
class="bg-primary-600 hover:bg-primary-400 text-white"
|
|
82
|
+
v-if="canPerform(String(useRoute().meta.name), 'create')"
|
|
83
|
+
@click="newData"
|
|
84
|
+
>New</Button
|
|
85
|
+
>
|
|
86
|
+
<Dialog
|
|
87
|
+
v-model:visible="visible"
|
|
88
|
+
:pt="{
|
|
89
|
+
root: { class: 'w-full h-full bg-white' },
|
|
90
|
+
headertitle: { class: 'm-2 ml-6 text-2xl font-bold' },
|
|
91
|
+
}"
|
|
92
|
+
modal
|
|
93
|
+
:header="t(doc.getDocName())"
|
|
94
|
+
:autoZIndex="false"
|
|
95
|
+
@update:visible="exitRecord"
|
|
96
|
+
>
|
|
97
|
+
<NuxtPage />
|
|
98
|
+
</Dialog>
|
|
99
|
+
</div>
|
|
100
|
+
</template> -->
|
|
@@ -0,0 +1,14 @@
|
|
|
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 Crud from "./new.vue";
|
|
10
|
+
</script>
|
|
11
|
+
<template>
|
|
12
|
+
<Crud />
|
|
13
|
+
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
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 Crud from "./new.vue";
|
|
10
|
+
</script>
|
|
11
|
+
<template>
|
|
12
|
+
<Crud />
|
|
13
|
+
</template>
|
|
@@ -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="bg-primary-600 hover:bg-primary-400 text-white"
|
|
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="bg-primary-600 hover:bg-primary-400 text-white"
|
|
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="bg-danger-600 hover:bg-danger-400 text-white"
|
|
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>
|