@simitgroup/simpleapp-generator 1.0.32 → 1.0.35
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/.vscode/settings.json +3 -0
- package/README.md +185 -16
- package/buildinschemas copy/autoincreament.autoinc.jsonschema.json +39 -0
- package/buildinschemas copy/branch.branch.jsonschema.json +41 -0
- package/buildinschemas copy/docnoformat.docno.jsonschema.json +41 -0
- package/buildinschemas copy/organization.org.jsonschema.json +50 -0
- package/buildinschemas copy/permission.perm.jsonschema.json +23 -0
- package/buildinschemas copy/permission.perm.jsonschema.try.json +25 -0
- package/buildinschemas copy/tenant.tenant.jsonschema.json +21 -0
- package/buildinschemas copy/tenant.tenant.jsonschema.try.json +27 -0
- package/buildinschemas copy/user.user.jsonschema.json +31 -0
- package/dist/buildinschemas/autoincreament.d.ts +3 -0
- package/dist/buildinschemas/autoincreament.d.ts.map +1 -0
- package/dist/buildinschemas/autoincreament.js +36 -0
- package/dist/buildinschemas/autoincreament.js.map +1 -0
- package/dist/buildinschemas/branch.d.ts +3 -0
- package/dist/buildinschemas/branch.d.ts.map +1 -0
- package/dist/buildinschemas/branch.js +41 -0
- package/dist/buildinschemas/branch.js.map +1 -0
- package/dist/buildinschemas/docnoformat.d.ts +3 -0
- package/dist/buildinschemas/docnoformat.d.ts.map +1 -0
- package/dist/buildinschemas/docnoformat.js +60 -0
- package/dist/buildinschemas/docnoformat.js.map +1 -0
- package/dist/buildinschemas/index.d.ts +8 -0
- package/dist/buildinschemas/index.d.ts.map +1 -0
- package/dist/buildinschemas/index.js +18 -0
- package/dist/buildinschemas/index.js.map +1 -0
- package/dist/buildinschemas/organization.d.ts +3 -0
- package/dist/buildinschemas/organization.d.ts.map +1 -0
- package/dist/buildinschemas/organization.js +34 -0
- package/dist/buildinschemas/organization.js.map +1 -0
- package/dist/buildinschemas/permission.d.ts +3 -0
- package/dist/buildinschemas/permission.d.ts.map +1 -0
- package/dist/buildinschemas/permission.js +34 -0
- package/dist/buildinschemas/permission.js.map +1 -0
- package/dist/buildinschemas/tenant.d.ts +3 -0
- package/dist/buildinschemas/tenant.d.ts.map +1 -0
- package/dist/buildinschemas/tenant.js +41 -0
- package/dist/buildinschemas/tenant.js.map +1 -0
- package/dist/buildinschemas/user.d.ts +3 -0
- package/dist/buildinschemas/user.d.ts.map +1 -0
- package/dist/buildinschemas/user.js +31 -0
- package/dist/buildinschemas/user.js.map +1 -0
- package/dist/constant.d.ts +4 -0
- package/dist/constant.d.ts.map +1 -0
- package/dist/constant.js +2 -1
- package/dist/constant.js.map +1 -1
- package/dist/framework.d.ts +10 -0
- package/dist/framework.d.ts.map +1 -0
- package/dist/framework.js +120 -68
- package/dist/framework.js.map +1 -1
- package/dist/generate-allow-changebackend.js +305 -0
- package/dist/generate-allow-changebackend.js.map +1 -0
- package/dist/generate.d.ts +2 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +310 -230
- package/dist/generate.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -20
- package/dist/index.js.map +1 -1
- package/dist/libs.d.ts +2 -0
- package/dist/libs.d.ts.map +1 -0
- package/dist/processors/groupsbuilder.js +2 -0
- package/dist/processors/groupsbuilder.js.map +1 -0
- package/dist/processors/jsonschemabuilder.d.ts +4 -0
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -0
- package/dist/processors/jsonschemabuilder.js +146 -172
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/schematype/baseschema.js +25 -0
- package/dist/schematype/baseschema.js.map +1 -0
- package/dist/schematype/default.js +2 -0
- package/dist/schematype/default.js.map +1 -0
- package/dist/schematype/index.js +12 -0
- package/dist/schematype/index.js.map +1 -0
- package/dist/schematype/primarymasterdata.js +38 -0
- package/dist/schematype/primarymasterdata.js.map +1 -0
- package/dist/schematype/simple.js +24 -0
- package/dist/schematype/simple.js.map +1 -0
- package/dist/schematype/simplemasterdata.js +31 -0
- package/dist/schematype/simplemasterdata.js.map +1 -0
- package/dist/schematype/transaction.js +74 -0
- package/dist/schematype/transaction.js.map +1 -0
- package/dist/storage.d.ts +3 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +2 -2
- package/dist/storage.js.map +1 -1
- package/dist/type.d.ts +164 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +16 -1
- package/dist/type.js.map +1 -1
- package/dist/validation.d.ts +1 -0
- package/dist/validation.d.ts.map +1 -0
- package/documentation/designconcept.bpmn +349 -0
- package/documentation/documentation.png +0 -0
- package/documentation/infra.drawio +141 -0
- package/documentation/infra.png +0 -0
- package/documentation/management.drawio +57 -0
- package/documentation/stack.drawio +106 -0
- package/package.json +3 -1
- package/src/buildinschemas/autoincreament.ts +34 -0
- package/src/buildinschemas/branch.ts +39 -0
- package/src/buildinschemas/docnoformat.ts +58 -0
- package/src/buildinschemas/index.ts +7 -0
- package/src/buildinschemas/organization.ts +31 -0
- package/src/buildinschemas/permission.ts +31 -0
- package/src/buildinschemas/tenant.ts +38 -0
- package/src/buildinschemas/user.ts +28 -0
- package/src/constant.ts +2 -1
- package/src/framework.ts +126 -67
- package/src/generate.ts +327 -266
- package/src/generate.ts.backup +339 -0
- package/src/index.ts +93 -18
- package/src/processors/jsonschemabuilder.ts +199 -226
- package/src/processors/jsonschemabuilder.ts-old +383 -0
- package/src/storage.ts +1 -1
- package/src/type.ts +94 -27
- package/templates/basic/nest/controller.ts.eta +255 -0
- package/templates/basic/nest/default.ts.eta +42 -0
- package/templates/basic/{model.eta → nest/model.ts.eta} +18 -5
- package/templates/basic/nest/processor.ts.eta +129 -0
- package/templates/basic/nest/service.ts.eta +64 -0
- package/templates/basic/{type.eta → nest/type.ts.eta} +3 -3
- package/templates/basic/nuxt/default.ts.eta +42 -0
- package/templates/basic/{pageindex.vue.eta → nuxt/pages.crud.vue.eta} +85 -22
- package/templates/basic/nuxt/simpleapp.doc.ts.eta +11 -0
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +212 -0
- package/templates/nest/.env.eta +31 -0
- package/templates/nest/.gitignore.eta +40 -0
- package/templates/nest/src/app.controller.ts.eta +19 -0
- package/templates/nest/src/app.module.ts.eta +77 -0
- package/templates/nest/src/app.service.ts.eta +9 -0
- package/templates/nest/src/main.ts.eta +58 -0
- package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +16 -0
- package/templates/nest/src/simpleapp/generate/commons/decorators/appuser.decorator.ts.eta +8 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/foreignkeys.ts.eta +1 -0
- package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +101 -0
- package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +39 -0
- package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +38 -0
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +88 -0
- package/templates/nest/{Workflow.eta → src/simpleapp/generate/commons/providers/workflow.provider.ts.etax} +20 -14
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.decorator.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +28 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +10 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.guard.ts.eta +34 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +391 -0
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +71 -0
- package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +53 -0
- package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +45 -0
- package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +57 -0
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +624 -0
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +19 -0
- package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +74 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +110 -0
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +195 -0
- package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +18 -0
- package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +89 -0
- package/templates/nest/src/simpleapp/services/branch.service.ts.eta +66 -0
- package/templates/nest/src/simpleapp/services/docno.service.ts.eta +93 -0
- package/templates/nest/src/simpleapp/services/org.service.ts.eta +67 -0
- package/templates/nest/src/simpleapp/services/perm.service.ts.eta +102 -0
- package/templates/nest/src/simpleapp/services/tenant.service.ts.eta +69 -0
- package/templates/nest/src/simpleapp/services/user.service.ts.eta +66 -0
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +43 -0
- package/templates/nuxt/.env.eta +21 -0
- package/templates/nuxt/.gitignore.eta +28 -0
- package/templates/nuxt/app.vue.eta +5 -2
- package/templates/nuxt/assets/css/tailwind.css.eta +35 -0
- package/templates/nuxt/components/CrudNestedDoc.vue.eta +164 -0
- package/templates/nuxt/components/CrudSimple.vue.eta +179 -0
- package/templates/nuxt/{components.debugdocdata.vue.eta → components/DebugDocumentData.vue.eta} +4 -1
- package/templates/nuxt/{components.eventmonitor.vue.eta → components/EventMonitor.vue.eta} +27 -27
- package/templates/nuxt/components/Invitation.vue.eta +50 -0
- package/templates/nuxt/components/Menus.vue.eta +58 -0
- package/templates/nuxt/components/PermissionInfo.vue.eta +92 -0
- package/templates/nuxt/components/SimpleAppAutocomplete.vue.eta +131 -0
- package/templates/nuxt/components/SimpleAppAutocompletemulti.vue.eta +73 -0
- package/templates/nuxt/components/SimpleAppCalendar.vue.eta +55 -0
- package/templates/nuxt/components/SimpleAppCheckbox.vue.eta +29 -0
- package/templates/nuxt/components/SimpleAppChip.vue.eta +28 -0
- package/templates/nuxt/components/SimpleAppColor.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppDatatable.vue.eta +20 -0
- package/templates/nuxt/components/SimpleAppDocumentNo.vue.eta +90 -0
- package/templates/nuxt/components/SimpleAppDynamicInput.vue.eta +29 -0
- package/templates/nuxt/components/SimpleAppEditor.vue.eta +31 -0
- package/templates/nuxt/components/SimpleAppForm.vue.eta +131 -0
- package/templates/nuxt/components/SimpleAppInputTable.vue.eta +104 -0
- package/templates/nuxt/components/SimpleAppList.vue.eta +38 -0
- package/templates/nuxt/components/SimpleAppListmulti.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppNumber.vue.eta +32 -0
- package/templates/nuxt/components/SimpleAppPassword.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppRadio.vue.eta +42 -0
- package/templates/nuxt/components/SimpleAppRating.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppSelect.vue.eta +38 -0
- package/templates/nuxt/components/SimpleAppSelectmulti.vue.eta +39 -0
- package/templates/nuxt/components/SimpleAppSlider.vue.eta +42 -0
- package/templates/nuxt/components/SimpleAppSwitch.vue.eta +30 -0
- package/templates/nuxt/components/SimpleAppText.vue.eta +50 -0
- package/templates/nuxt/components/SimpleAppTextarea.vue.eta +30 -0
- package/templates/nuxt/components/SimpleAppValue.vue.eta +86 -0
- package/templates/nuxt/components/SimpleFieldContainer.vue.eta +102 -0
- package/templates/nuxt/components/XorgPicker.vue.eta +66 -0
- package/templates/nuxt/components/helper.ts.eta +90 -0
- package/templates/nuxt/components/type.ts.eta +32 -0
- package/templates/nuxt/composables/docformat.generate.ts.eta +5 -0
- package/templates/nuxt/{composables.getautocomplete.ts.eta → composables/getAutocomplete.generate.ts.eta} +4 -5
- package/templates/nuxt/{composables.getmenus.ts.eta → composables/getMenus.generate.ts.eta} +22 -7
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +6 -0
- package/templates/nuxt/composables/getTenant.generate.ts.eta +4 -0
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +22 -0
- package/templates/nuxt/composables/logout.generate.ts.eta +22 -0
- package/templates/nuxt/composables/roles.generate.ts.eta +48 -0
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +5 -0
- package/templates/nuxt/{layouts.default.vue.eta → layouts/default.vue.eta} +2 -0
- package/templates/nuxt/middleware/10.acl.global.ts.eta +38 -0
- package/templates/nuxt/nuxt.config.ts.eta +12 -2
- package/templates/nuxt/pages/[xorg]/branch/index.vue.eta +102 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/[id].vue.eta +17 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +269 -0
- package/templates/nuxt/pages/[xorg]/index.vue.eta +36 -0
- package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +148 -0
- package/templates/nuxt/pages/[xorg]/permission/index.vue.eta +280 -0
- package/templates/nuxt/pages/[xorg]/tenant/index.vue.eta +93 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +468 -0
- package/templates/nuxt/pages/index.vue.eta +191 -0
- package/templates/nuxt/pages/login.vue.eta +21 -0
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +53 -0
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +155 -0
- package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +23 -0
- package/templates/nuxt/{server.api.ts.eta → server/api/[xorg]/[...].ts.eta} +5 -2
- package/templates/nuxt/server/api/auth/[...].ts.eta +68 -0
- package/templates/nuxt/{server.api.auth.logout.ts.eta → server/api/auth/logout.ts.eta} +1 -3
- package/templates/nuxt/server/api/profile/[...].ts.eta +150 -0
- package/templates/nuxt/server/api/profile/index.ts.eta +103 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +187 -0
- package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +5 -0
- package/templates/nuxt/simpleapp/generate/commons/groups.ts.eta +11 -0
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +21 -0
- package/templates/nuxt/types/index.ts.eta +65 -0
- package/templates/project/README.md +11 -0
- package/templates/project/build.sh.eta +17 -0
- package/templates/project/config.json.eta +2 -0
- package/templates/project/generate.ts.eta +10 -0
- package/templates/project/schemas/category.ts.eta +26 -0
- package/templates/project/schemas/index.ts.eta +5 -0
- package/templates/project/schemas/product.ts.eta +59 -0
- package/templates/project/shares/hello.ts.eta +1 -0
- package/templates/project/shares/index.ts.eta +2 -0
- package/tsconfig.json +9 -2
- package/tsconfig.tsbuildinfo +1 -0
- package/definations/category.cat.jsonschema.json +0 -55
- package/definations/level.lvl.jsonschema.json +0 -48
- package/definations/product.prd.jsonschema.json +0 -46
- package/templates/basic/controller.eta +0 -152
- package/templates/basic/module.eta +0 -22
- package/templates/basic/service.eta +0 -62
- package/templates/basic/simpleappclient.eta +0 -120
- package/templates/nest/SimpleAppController.eta +0 -69
- package/templates/nest/SimpleAppService.eta +0 -366
- package/templates/nest/TenantMiddleware.eta +0 -34
- package/templates/nest/UserProvider.eta +0 -127
- package/templates/nest/app.controller.eta +0 -12
- package/templates/nest/app.module.eta +0 -64
- package/templates/nest/app.service.eta +0 -8
- package/templates/nest/inputvalidation-exception.eta +0 -6
- package/templates/nest/nest.env.eta +0 -28
- package/templates/nest/nest.main.eta +0 -31
- package/templates/nuxt/components.crudsimple.vue.eta +0 -124
- package/templates/nuxt/components.menus.vue.eta +0 -35
- package/templates/nuxt/env.eta +0 -17
- package/templates/nuxt/pages.[xorg].index.vue.eta +0 -20
- package/templates/nuxt/pages.index.vue.eta +0 -72
- package/templates/nuxt/pages.login.vue.eta +0 -20
- package/templates/nuxt/plugins.simpleapp.ts.eta +0 -88
- package/templates/nuxt/server.api.auth[...].ts.eta +0 -233
- package/templates/nuxt/tailwind.css.eta +0 -49
- /package/templates/basic/{apischema.eta → nest/apischema.ts.eta} +0 -0
- /package/templates/basic/{jsonschema.eta → nest/jsonschema.ts.eta} +0 -0
- /package/templates/basic/{pageindexwithid.vue.eta → nuxt/pages.[id].vue.eta} +0 -0
- /package/templates/nest/{oauth2-redirect.eta → public_html/oauth2-redirect.html.eta} +0 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Menu from "primevue/menu";
|
|
3
|
+
import Dialog from "primevue/dialog";
|
|
4
|
+
import _ from "lodash";
|
|
5
|
+
import Panel from "primevue/panel";
|
|
6
|
+
import { ref } from "vue";
|
|
7
|
+
import {
|
|
8
|
+
UserListItem,
|
|
9
|
+
BranchListItem,
|
|
10
|
+
OrgListItem,
|
|
11
|
+
InvitationListItem,
|
|
12
|
+
PermissionListItem,
|
|
13
|
+
} from "../../../types";
|
|
14
|
+
import SelectButton from "primevue/selectbutton";
|
|
15
|
+
import Button from "primevue/button";
|
|
16
|
+
import InputText from "primevue/inputtext";
|
|
17
|
+
|
|
18
|
+
import TabView from "primevue/tabview";
|
|
19
|
+
import TabPanel from "primevue/tabpanel";
|
|
20
|
+
import { Permission } from "../../../simpleapp/generate/openapi/api";
|
|
21
|
+
//initialize api
|
|
22
|
+
const { $PermissionDoc, $OrganizationDoc, $BranchDoc, $InvitationDoc } =
|
|
23
|
+
useNuxtApp();
|
|
24
|
+
const doc = $PermissionDoc();
|
|
25
|
+
const orgdoc = $OrganizationDoc();
|
|
26
|
+
const branchdoc = $BranchDoc();
|
|
27
|
+
const invitedoc = $InvitationDoc();
|
|
28
|
+
|
|
29
|
+
//initialize require list in UI
|
|
30
|
+
const permlist = ref<PermissionListItem[]>([]);
|
|
31
|
+
const userlist = ref<PermissionListItem[]>([]);
|
|
32
|
+
const invitationlist = ref<InvitationListItem[]>([]);
|
|
33
|
+
const orglist = ref<OrgListItem[]>([]);
|
|
34
|
+
const branchlist = ref<BranchListItem[]>([]);
|
|
35
|
+
const currentpermissions = ref<Permission[]>([]);
|
|
36
|
+
const grouplist = getAllGroups().map((item) => {
|
|
37
|
+
return { value: item, label: _.capitalize(item) };
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//initialize some runtime variable
|
|
41
|
+
const inviteemail = ref("");
|
|
42
|
+
const selected = ref("");
|
|
43
|
+
const activeuser = ref("");
|
|
44
|
+
const showpermissioninfo = ref(false);
|
|
45
|
+
const permissionselected = ref();
|
|
46
|
+
const permissiontitle = "Permission Information";
|
|
47
|
+
|
|
48
|
+
//initialize UI methods
|
|
49
|
+
const getPermssionData = (uid: string, branchId: number) => {
|
|
50
|
+
const result = permlist.value.find(
|
|
51
|
+
(el) => el.uid == uid && el.branchId == branchId,
|
|
52
|
+
);
|
|
53
|
+
let pm: Permission = {
|
|
54
|
+
_id: result?._id ?? "",
|
|
55
|
+
orgId: result?.orgId ?? 0,
|
|
56
|
+
tenantId: result?.tenantId ?? 0,
|
|
57
|
+
branchId: branchId,
|
|
58
|
+
uid: uid,
|
|
59
|
+
group: result?.group ?? "",
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return pm;
|
|
63
|
+
};
|
|
64
|
+
const onSelectUser = async (item: any) => {
|
|
65
|
+
orglist.value = await orgdoc.list();
|
|
66
|
+
branchlist.value = await branchdoc.list();
|
|
67
|
+
selected.value = item.uid;
|
|
68
|
+
activeuser.value = item.fullName;
|
|
69
|
+
const uid = item.uid;
|
|
70
|
+
currentpermissions.value = [];
|
|
71
|
+
for (let i = 0; i < branchlist.value.length; i++) {
|
|
72
|
+
const b = branchlist.value[i];
|
|
73
|
+
const permdata = getPermssionData(uid, b.branchId);
|
|
74
|
+
const tmp: Permission = {
|
|
75
|
+
_id: permdata?._id,
|
|
76
|
+
uid: uid,
|
|
77
|
+
tenantId: b.tenantId,
|
|
78
|
+
orgId: b.orgId,
|
|
79
|
+
branchId: b.branchId,
|
|
80
|
+
group: permdata.group,
|
|
81
|
+
};
|
|
82
|
+
currentpermissions.value.push(tmp);
|
|
83
|
+
}
|
|
84
|
+
console.log("currentpermissions", currentpermissions.value);
|
|
85
|
+
};
|
|
86
|
+
const refreshList = async (resetpage:boolean=true) => {
|
|
87
|
+
const items: any[] = [];
|
|
88
|
+
permlist.value = await doc.listUser();
|
|
89
|
+
userlist.value = _.uniqBy(permlist.value, "uid");
|
|
90
|
+
if(resetpage){
|
|
91
|
+
selected.value=''
|
|
92
|
+
activeuser.value=''
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
console.log(permlist.value);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const refreshInvitation = async () => {
|
|
100
|
+
inviteemail.value = "";
|
|
101
|
+
invitationlist.value = await invitedoc.list();
|
|
102
|
+
};
|
|
103
|
+
const checkBranchInOrg = (org: OrgListItem, branch: BranchListItem) => {
|
|
104
|
+
return org.orgId === branch.orgId;
|
|
105
|
+
};
|
|
106
|
+
const previewPermission = () => {
|
|
107
|
+
showpermissioninfo.value = true;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/***** send or remove invitation ******/
|
|
111
|
+
const invite = async () => {
|
|
112
|
+
const result = await sendInvitation(inviteemail.value);
|
|
113
|
+
refreshInvitation();
|
|
114
|
+
};
|
|
115
|
+
const deleteInvitation = async (recordId: string) => {
|
|
116
|
+
await cancelInvitation(recordId);
|
|
117
|
+
refreshInvitation();
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**********applPermission ******/
|
|
121
|
+
/**
|
|
122
|
+
* apply permission:
|
|
123
|
+
* _id:'', group:'' => skip
|
|
124
|
+
* _id: '', group:'something' => create
|
|
125
|
+
* _id:'something', 'group':'something' => update
|
|
126
|
+
* _id:'something', group:'' => remove
|
|
127
|
+
*/
|
|
128
|
+
const applPermission = async (d: Permission) => {
|
|
129
|
+
let result;
|
|
130
|
+
|
|
131
|
+
d._id = String(d._id ?? "");
|
|
132
|
+
d.group = String(d.group ?? "");
|
|
133
|
+
const data = doc.getReactiveData();
|
|
134
|
+
data.value = d;
|
|
135
|
+
console.log("apply permission", data.value)
|
|
136
|
+
if (!d._id && !d.group) {
|
|
137
|
+
//no changes
|
|
138
|
+
} else if (!d._id && d.group) {
|
|
139
|
+
result = await doc.create();
|
|
140
|
+
} else if (d._id && d.group) {
|
|
141
|
+
data.value = d;
|
|
142
|
+
result = await doc.update();
|
|
143
|
+
} else if (d._id && !d.group) {
|
|
144
|
+
d.group = "";
|
|
145
|
+
data.value = d;
|
|
146
|
+
result = await doc.delete(d._id);
|
|
147
|
+
} else {
|
|
148
|
+
console.warn("unknown apply permission", result);
|
|
149
|
+
}
|
|
150
|
+
refreshList(false)
|
|
151
|
+
};
|
|
152
|
+
//init ui
|
|
153
|
+
onMounted(() => {
|
|
154
|
+
refreshList();
|
|
155
|
+
refreshInvitation();
|
|
156
|
+
});
|
|
157
|
+
</script>
|
|
158
|
+
<template>
|
|
159
|
+
<button @click="refreshList()" class="pi pi-refresh"></button>
|
|
160
|
+
<Dialog
|
|
161
|
+
v-model:visible="showpermissioninfo"
|
|
162
|
+
modal
|
|
163
|
+
:header="permissiontitle"
|
|
164
|
+
:autoZIndex="false"
|
|
165
|
+
:style="{ zIndex: 100, width: '80vw' }"
|
|
166
|
+
>
|
|
167
|
+
<PermissionInfo></PermissionInfo>
|
|
168
|
+
</Dialog>
|
|
169
|
+
|
|
170
|
+
<div class="grid grid-cols-3">
|
|
171
|
+
<div v-if="userlist">
|
|
172
|
+
<TabView>
|
|
173
|
+
<TabPanel header="Active">
|
|
174
|
+
<Menu
|
|
175
|
+
:model="userlist"
|
|
176
|
+
class="w w-auto border border-solid border-1"
|
|
177
|
+
:pt="{ root: { class: 'w-auto ' } }"
|
|
178
|
+
>
|
|
179
|
+
<template #start>
|
|
180
|
+
<div class="flex flex-column align">
|
|
181
|
+
<h1>Users</h1>
|
|
182
|
+
</div>
|
|
183
|
+
</template>
|
|
184
|
+
<template #item="{ item, label, props }">
|
|
185
|
+
<a
|
|
186
|
+
class="flex m-2 p-2 flex-col border border-b-2 cursor cursor-pointer"
|
|
187
|
+
@click="onSelectUser(item)"
|
|
188
|
+
>
|
|
189
|
+
<div class="text text-left text-base text-black">
|
|
190
|
+
{{ item.fullName }}
|
|
191
|
+
</div>
|
|
192
|
+
<div class="text text-sm text-right">{{ item.email }}</div>
|
|
193
|
+
</a>
|
|
194
|
+
</template>
|
|
195
|
+
</Menu>
|
|
196
|
+
</TabPanel>
|
|
197
|
+
<TabPanel header="Invite">
|
|
198
|
+
<div class="padding p-2">
|
|
199
|
+
<form @submit.prevent="true" class="w-full">
|
|
200
|
+
<div class="p-inputgroup flex-1">
|
|
201
|
+
|
|
202
|
+
<InputText
|
|
203
|
+
type="email"
|
|
204
|
+
placeholder="email"
|
|
205
|
+
v-model="inviteemail"
|
|
206
|
+
/>
|
|
207
|
+
<button label="Search" class="btn btn-primary" @click="invite"
|
|
208
|
+
>Invite</button
|
|
209
|
+
>
|
|
210
|
+
|
|
211
|
+
</div>
|
|
212
|
+
</form>
|
|
213
|
+
</div>
|
|
214
|
+
<div class="flex flex-col">
|
|
215
|
+
<div
|
|
216
|
+
v-for="(invitation, index) in invitationlist"
|
|
217
|
+
class="grid grid-cols-4"
|
|
218
|
+
>
|
|
219
|
+
<div class="text text-base m-2">{{ index + 1 }}</div>
|
|
220
|
+
<div class="col-span-2 text text-base m-2">
|
|
221
|
+
{{ invitation.email }}
|
|
222
|
+
</div>
|
|
223
|
+
<div>
|
|
224
|
+
<button
|
|
225
|
+
class="btn-danger pi pi-times"
|
|
226
|
+
@click="deleteInvitation(invitation._id)"
|
|
227
|
+
></button>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
</TabPanel>
|
|
232
|
+
</TabView>
|
|
233
|
+
</div>
|
|
234
|
+
<div class="col-span-2" v-if="selected">
|
|
235
|
+
<div class="flex flex-row w w-full">
|
|
236
|
+
<div class="text text-xl p p-2 text-left flex-1">{{ activeuser }}</div>
|
|
237
|
+
<div class="text-right m mr-2">
|
|
238
|
+
<button
|
|
239
|
+
class="btn-primary pi pi-question"
|
|
240
|
+
@click="previewPermission"
|
|
241
|
+
></button>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
|
|
245
|
+
<Panel v-for="o in orglist" :header="o.orgName" class="m-2">
|
|
246
|
+
<table class="w w-full">
|
|
247
|
+
<thead class="">
|
|
248
|
+
<tr>
|
|
249
|
+
<th>Branch Code</th>
|
|
250
|
+
<th>Branch Name</th>
|
|
251
|
+
<th>Access Right</th>
|
|
252
|
+
</tr>
|
|
253
|
+
</thead>
|
|
254
|
+
<tr v-for="(b, index) in branchlist">
|
|
255
|
+
<td v-if="checkBranchInOrg(o, b)">{{ b.branchCode }}</td>
|
|
256
|
+
<td v-if="checkBranchInOrg(o, b)">{{ b.branchName }}</td>
|
|
257
|
+
<td v-if="checkBranchInOrg(o, b)" clas="flex flex-row">
|
|
258
|
+
<div class="grid gap-4 grid-cols-5">
|
|
259
|
+
<div class="col-span-4">
|
|
260
|
+
<SelectButton
|
|
261
|
+
v-model="currentpermissions[index].group"
|
|
262
|
+
:options="grouplist"
|
|
263
|
+
option-label="label"
|
|
264
|
+
option-value="value"
|
|
265
|
+
@change="applPermission(currentpermissions[index])"
|
|
266
|
+
></SelectButton>
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
</td>
|
|
270
|
+
</tr>
|
|
271
|
+
</table>
|
|
272
|
+
</Panel>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
</template>
|
|
276
|
+
<style scoped>
|
|
277
|
+
td {
|
|
278
|
+
text-align: center;
|
|
279
|
+
}
|
|
280
|
+
</style>
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
|
|
10
|
+
import {
|
|
11
|
+
InputTableColumnType,
|
|
12
|
+
InputTableColumn,
|
|
13
|
+
} from "@simitgroup/simpleapp-vue-component/src/type";
|
|
14
|
+
import Column from "primevue/column";
|
|
15
|
+
const { $TenantDoc } = useNuxtApp();
|
|
16
|
+
const doc = $TenantDoc();
|
|
17
|
+
const data = doc.getReactiveData();
|
|
18
|
+
const columns = [
|
|
19
|
+
'_id',
|
|
20
|
+
'tenantId',
|
|
21
|
+
"tenantName",
|
|
22
|
+
"description",
|
|
23
|
+
"owner.label"
|
|
24
|
+
/* skip system columns _id*/,
|
|
25
|
+
/* skip system columns doctype*/
|
|
26
|
+
/* skip system columns created*/
|
|
27
|
+
/* skip system columns updated*/
|
|
28
|
+
/* skip system columns createdby*/
|
|
29
|
+
/* skip system columns updatedby*/
|
|
30
|
+
/* skip system columns orgId*/
|
|
31
|
+
/* skip system columns branchId*/
|
|
32
|
+
];
|
|
33
|
+
//prepare subtable if exists
|
|
34
|
+
/*
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
*/
|
|
50
|
+
//end
|
|
51
|
+
</script>
|
|
52
|
+
<template>
|
|
53
|
+
<div>
|
|
54
|
+
<CrudSimple
|
|
55
|
+
:document="doc"
|
|
56
|
+
title="Tenant"
|
|
57
|
+
#default="o"
|
|
58
|
+
:path="`/${useRoute().params.xorg}/tenant`"
|
|
59
|
+
:listColumns="columns"
|
|
60
|
+
>
|
|
61
|
+
|
|
62
|
+
<SimpleAppText
|
|
63
|
+
autofocus
|
|
64
|
+
:setting="o.getField('#/properties/tenantName')"
|
|
65
|
+
v-model="data.tenantName"
|
|
66
|
+
/>
|
|
67
|
+
|
|
68
|
+
<SimpleAppCheckbox
|
|
69
|
+
autofocus
|
|
70
|
+
:setting="o.getField('#/properties/active')"
|
|
71
|
+
v-model="data.active"
|
|
72
|
+
/>
|
|
73
|
+
|
|
74
|
+
<SimpleAppText
|
|
75
|
+
autofocus
|
|
76
|
+
:setting="o.getField('#/properties/description')"
|
|
77
|
+
v-model="data.description"
|
|
78
|
+
/>
|
|
79
|
+
|
|
80
|
+
<SimpleAppAutocomplete
|
|
81
|
+
:setting="o.getField('#/properties/owner')"
|
|
82
|
+
v-model="data.owner"
|
|
83
|
+
optionLabel="label"
|
|
84
|
+
:remote-src="getAutocomplete('user')"
|
|
85
|
+
/>
|
|
86
|
+
<SimpleAppNumber
|
|
87
|
+
:readonly="true"
|
|
88
|
+
:setting="o.getField('#/properties/tenantId')"
|
|
89
|
+
v-model="data.tenantId"
|
|
90
|
+
/>
|
|
91
|
+
</CrudSimple>
|
|
92
|
+
</div>
|
|
93
|
+
</template>
|