@simitgroup/simpleapp-generator 1.6.3-alpha → 1.6.4-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +1 -0
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/changehistories.d.ts +3 -0
- package/dist/buildinschemas/changehistories.d.ts.map +1 -0
- package/dist/buildinschemas/changehistories.js +36 -0
- package/dist/buildinschemas/changehistories.js.map +1 -0
- package/dist/buildinschemas/index.d.ts +1 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +3 -1
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/organization.js +2 -2
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +5 -1
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/buildinschemas/webhook.d.ts +3 -0
- package/dist/buildinschemas/webhook.d.ts.map +1 -0
- package/dist/buildinschemas/webhook.js +33 -0
- package/dist/buildinschemas/webhook.js.map +1 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +3 -2
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +30 -11
- package/dist/generate.js.map +1 -1
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +10 -2
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/type.d.ts +2 -0
- package/dist/type.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/branch.ts +1 -0
- package/src/buildinschemas/changehistories.ts +33 -0
- package/src/buildinschemas/index.ts +2 -1
- package/src/buildinschemas/organization.ts +2 -2
- package/src/buildinschemas/user.ts +5 -1
- package/src/buildinschemas/webhook.ts +31 -0
- package/src/framework.ts +3 -2
- package/src/generate.ts +35 -15
- package/src/processors/jsonschemabuilder.ts +10 -2
- package/src/type.ts +2 -0
- package/templates/basic/nest/controller.ts.eta +23 -2
- package/templates/basic/nest/model.ts.eta +9 -1
- package/templates/basic/nest/resolver.ts.eta +2 -2
- package/templates/basic/nuxt/pages.[id].vue.eta +7 -7
- package/templates/basic/nuxt/pages.form.vue.eta +1 -4
- package/templates/basic/nuxt/pages.landing.vue.eta +1 -20
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +8 -1
- package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +2 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +9 -2
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +5 -10
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +1 -0
- package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +50 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +13 -3
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +9 -1
- package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +12 -6
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +120 -19
- package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +3 -1
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +1 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +19 -0
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +30 -8
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +2 -1
- package/templates/nuxt/assets/css/calendar.css._eta +3 -0
- package/templates/nuxt/assets/css/style.css._eta +1 -1
- package/templates/nuxt/assets/images/unknown.png.eta +0 -0
- package/templates/nuxt/assets/primevue/passthrough.ts._eta +6 -1
- package/templates/nuxt/components/button/ButtonAction.vue._eta +40 -39
- package/templates/nuxt/components/button/ButtonDanger.vue._eta +11 -3
- package/templates/nuxt/components/button/ButtonDefault.vue._eta +11 -3
- package/templates/nuxt/components/button/ButtonPrimary.vue._eta +9 -3
- package/templates/nuxt/components/button/ButtonSecondary.vue._eta +33 -0
- package/templates/nuxt/components/button/ButtonText.vue._eta +9 -5
- package/templates/nuxt/components/button/ButtonWarning.vue._eta +11 -3
- package/templates/nuxt/components/calendar/CalendarInput.vue.eta +4 -3
- package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +33 -16
- package/templates/nuxt/components/chart/card.vue._eta +1 -1
- package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +36 -26
- package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +36 -13
- package/templates/nuxt/components/form/FormBranch.vue._eta +52 -5
- package/templates/nuxt/components/form/FormDocnoformat.vue.eta +14 -10
- package/templates/nuxt/components/form/FormUser.vue._eta +1 -1
- package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +77 -59
- package/templates/nuxt/components/header/HeaderSelectBranch.vue.eta +42 -35
- package/templates/nuxt/components/image/ImageAvatar.vue.eta._vue +30 -0
- package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +7 -5
- package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +67 -50
- package/templates/nuxt/components/list/ListDocumentTable.vue.eta +20 -12
- package/templates/nuxt/components/list/ListView.vue.eta +64 -35
- package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +5 -4
- package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +8 -8
- package/templates/nuxt/components/page/PageDocList.vue.eta +36 -13
- package/templates/nuxt/components/renderer/RendererDate.vue.eta +8 -2
- package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +7 -1
- package/templates/nuxt/components/renderer/RendererDocHistories.vue.eta +56 -0
- package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +9 -8
- package/templates/nuxt/components/renderer/RendererLink.vue.eta +7 -4
- package/templates/nuxt/components/renderer/RendererMoney.vue.eta +25 -17
- package/templates/nuxt/components/renderer/RendererTime.vue.eta +7 -1
- package/templates/nuxt/components/renderer/RendererViewer.vue.eta +19 -9
- package/templates/nuxt/components/select/SelectTemplate.vue.eta +47 -21
- package/templates/nuxt/components/session/SessionBlock.vue.eta +44 -46
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +24 -15
- package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +64 -0
- package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +16 -8
- package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +8 -8
- package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +1 -1
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +66 -22
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +89 -168
- package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +43 -40
- package/templates/nuxt/components/simpleApp/SimpleAppUserPicker.vue.eta +387 -0
- package/templates/nuxt/components/text/TextDocStatus.vue._eta +22 -0
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +13 -15
- package/templates/nuxt/components/user/UserButtonPermissionInfo.vue.eta +127 -93
- package/templates/nuxt/components/user/UserTenantPicker.vue.eta +1 -1
- package/templates/nuxt/composables/date.generate.ts.eta +105 -8
- package/templates/nuxt/composables/getDocument.generate.ts.eta +8 -6
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +58 -10
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +37 -5
- package/templates/nuxt/composables/goTo.generate.ts.eta +14 -1
- package/templates/nuxt/composables/graphquery.generate.ts.eta +20 -2
- package/templates/nuxt/composables/recently.generate.ts.eta +16 -0
- package/templates/nuxt/composables/roles.generate.ts.eta +8 -13
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +52 -0
- package/templates/nuxt/composables/sysmessage.generate.ts.eta +1 -1
- package/templates/nuxt/pages/[xorg]/{organization.vue.eta → organization.vue._eta} +38 -9
- package/templates/nuxt/pages/[xorg]/user.vue.eta +12 -9
- package/templates/nuxt/pages/login.vue._eta +4 -1
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +45 -26
- package/templates/nuxt/plugins/70.recently.ts.eta +55 -0
- package/templates/nuxt/providers/my-provider.ts.eta +22 -0
- package/templates/nuxt/server/api/[xorg]/{[...].ts.eta → [...].ts._eta} +47 -21
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +44 -3
- package/templates/nuxt/types/events.ts.eta +3 -2
- package/templates/nuxt/types/others.ts.eta +11 -1
- package/templates/nuxt/types/schema.ts.eta +3 -1
- package/templates/nuxt/types/simpleappinput.ts.eta +1 -1
- package/templates/nuxt/types/user.ts.eta +8 -7
- package/templates/project/jsonschemas/branch.json._eta +1 -0
- package/templates/project/jsonschemas/invoice.json._eta +4 -3
- package/templates/project/jsonschemas/organization.json._eta +2 -2
- package/templates/project/lang/default._json +3 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +0 -38
- /package/templates/nuxt/pages/[xorg]/mobile/docnoformat/{index.vue.eta → index.vue.etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/{index.vue._eta → index.vue._etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/organization/{[id].vue._eta → [id].vue._etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/{pickgroup.vue._eta → pickgroup.vue._etaxxx} +0 -0
- /package/templates/nuxt/pages/[xorg]/mobile/user/{index.vue.eta → index.vue.etaxxx} +0 -0
|
@@ -1,83 +1,101 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
2
|
+
<div class="w-full">
|
|
3
|
+
<UserButtonPermissionInfo/>
|
|
3
4
|
<div v-for="(b, index) in branchList" :key="index" class="flex flex-col">
|
|
4
|
-
<div>{{ b.branchName }}</div>
|
|
5
|
-
<div>
|
|
6
|
-
<SelectButton
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
<div>{{ b.branchName }}</div>
|
|
6
|
+
<div>
|
|
7
|
+
<SelectButton
|
|
8
|
+
:options="grouplist"
|
|
9
|
+
v-model="permdata[b.branchId ?? 0].groups"
|
|
10
|
+
@update:model-value="updatePermission($event, b.branchId ?? 0)"
|
|
11
|
+
multiple
|
|
12
|
+
option-value="value"
|
|
13
|
+
option-label="label"
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
10
16
|
</div>
|
|
11
17
|
</div>
|
|
12
18
|
</template>
|
|
13
19
|
<script lang="ts" setup>
|
|
14
|
-
import {
|
|
15
|
-
|
|
20
|
+
import {
|
|
21
|
+
Branch,
|
|
22
|
+
Permission,
|
|
23
|
+
UserPermission,
|
|
24
|
+
} from "~/simpleapp/generate/openapi";
|
|
25
|
+
import _ from "lodash";
|
|
16
26
|
const props = defineProps<{ id: string }>();
|
|
17
27
|
const perm = useNuxtApp().$PermissionDoc();
|
|
18
|
-
const branchList = ref<Branch[]>()
|
|
19
|
-
const branch = useNuxtApp().$BranchDoc()
|
|
28
|
+
const branchList = ref<Branch[]>();
|
|
29
|
+
const branch = useNuxtApp().$BranchDoc();
|
|
20
30
|
const grouplist = getAllGroups().map((item) => {
|
|
21
31
|
return { value: item, label: _.capitalize(item) };
|
|
22
32
|
});
|
|
23
33
|
const orgs = ref<UserPermission[]>();
|
|
24
|
-
const selectedGroup=ref()
|
|
25
|
-
type PermDataType = {[key:number]: {groups?:string[]
|
|
26
|
-
const permdata=ref<PermDataType>({})
|
|
27
|
-
const loadBranches = async ()=>{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
const selectedGroup = ref();
|
|
35
|
+
type PermDataType = { [key: number]: { groups?: string[]; permId?: string } };
|
|
36
|
+
const permdata = ref<PermDataType>({});
|
|
37
|
+
const loadBranches = async () => {
|
|
38
|
+
branchList.value = await branch.search({
|
|
39
|
+
filter: { orgId: getUserProfile()?.orgId },
|
|
40
|
+
fields: ["branchCode", "branchName", "active", "branchId"],
|
|
41
|
+
sorts: [["branchCode", "asc"]],
|
|
42
|
+
});
|
|
33
43
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
44
|
+
branchList.value?.forEach((b) => {
|
|
45
|
+
const branchId: number = b.branchId ?? 0;
|
|
46
|
+
permdata.value[branchId] = { groups: [], permId: "" };
|
|
47
|
+
});
|
|
48
|
+
};
|
|
39
49
|
const loadPermission = async () => {
|
|
40
|
-
const permissions:Permission[] = await perm.search({
|
|
41
|
-
filter:{userId:props.id},
|
|
42
|
-
fields:[
|
|
43
|
-
})
|
|
44
|
-
console.log("load permissions"
|
|
45
|
-
permissions.forEach(p=>{
|
|
46
|
-
console.log("PPP",p)
|
|
47
|
-
if(p.branchId && permdata.value[p.branchId]){
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
const permissions: Permission[] = await perm.search({
|
|
51
|
+
filter: { userId: props.id },
|
|
52
|
+
fields: ["groups", "userId", "uid", "branchId"],
|
|
53
|
+
});
|
|
54
|
+
console.log("load permissions", permissions);
|
|
55
|
+
permissions.forEach((p) => {
|
|
56
|
+
console.log("PPP", p);
|
|
57
|
+
if (p.branchId && permdata.value[p.branchId]) {
|
|
58
|
+
permdata.value[p.branchId].groups = p.groups ?? [];
|
|
59
|
+
permdata.value[p.branchId].permId = p._id;
|
|
50
60
|
}
|
|
51
|
-
})
|
|
61
|
+
});
|
|
52
62
|
};
|
|
53
|
-
const updatePermission = async (newgroups:string[],branchId:number)=>{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if(permdata.value[branchId] && permdata.value[branchId].permId){
|
|
65
|
-
await perm.update()
|
|
66
|
-
}else{
|
|
67
|
-
await perm.create()
|
|
63
|
+
const updatePermission = async (newgroups: string[], branchId: number) => {
|
|
64
|
+
const data = perm.getReactiveData();
|
|
65
|
+
const userdoc = useNuxtApp().$UserDoc()
|
|
66
|
+
await userdoc.getById(props.id);
|
|
67
|
+
const userdata = userdoc.getReactiveData()
|
|
68
|
+
console.log("userdata",userdata.value)
|
|
69
|
+
|
|
70
|
+
if (permdata.value[branchId] && permdata.value[branchId].permId) {
|
|
71
|
+
await perm.getById(permdata.value[branchId].permId);
|
|
72
|
+
if(!data.value.uid && userdata.value.uid){
|
|
73
|
+
data.value.uid = userdata.value.uid
|
|
68
74
|
}
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
} else {
|
|
76
|
+
data.value._id = randomUUID();
|
|
77
|
+
data.value.userId = props.id;
|
|
78
|
+
data.value.uid = userdata.value.uid
|
|
79
|
+
data.value.branchId = branchId
|
|
80
|
+
}
|
|
81
|
+
data.value.groups = newgroups;
|
|
82
|
+
// console.log("data",data.value)
|
|
83
|
+
// return false
|
|
84
|
+
if (permdata.value[branchId] && permdata.value[branchId].permId) {
|
|
85
|
+
await perm.update();
|
|
86
|
+
} else {
|
|
87
|
+
await perm.create();
|
|
88
|
+
}
|
|
89
|
+
await loadPermission();
|
|
90
|
+
};
|
|
71
91
|
onMounted(async () => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
92
|
+
await loadBranches();
|
|
93
|
+
await loadPermission();
|
|
75
94
|
});
|
|
76
95
|
watch(
|
|
77
96
|
() => props.id,
|
|
78
97
|
async () => {
|
|
79
|
-
await loadPermission()
|
|
80
|
-
|
|
81
|
-
}
|
|
98
|
+
await loadPermission();
|
|
99
|
+
},
|
|
82
100
|
);
|
|
83
101
|
</script>
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<select
|
|
4
|
+
v-if="selectedbranch"
|
|
5
|
+
v-model="selectedbranch"
|
|
6
|
+
style="background: transparent; border: none;"
|
|
7
|
+
class="text-right pt-3 pb-3 text-lg"
|
|
8
|
+
@change="switchXorg()"
|
|
9
|
+
>
|
|
10
|
+
<optgroup v-for="o in orgList" :label="o.label">
|
|
11
|
+
<option v-for="b in getBranchesForOrg(o)" :value="b['xOrg']">
|
|
12
|
+
{{ b["branch"]["branchCode"] }}
|
|
13
|
+
</option>
|
|
14
|
+
</optgroup>
|
|
15
|
+
</select>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
1
19
|
<script setup lang="ts">
|
|
2
20
|
/**
|
|
3
21
|
* This file was automatically generated by simpleapp generator. Every
|
|
@@ -5,42 +23,31 @@
|
|
|
5
23
|
* last change 2023-10-28
|
|
6
24
|
* Author: Ks Tan
|
|
7
25
|
*/
|
|
8
|
-
import _ from
|
|
9
|
-
import {ref} from
|
|
26
|
+
import _ from "lodash";
|
|
27
|
+
import { ref } from "vue";
|
|
10
28
|
|
|
11
|
-
const selectedbranch = ref(getCurrentXorg())
|
|
12
|
-
const currentTenant=ref(getUserProfile()
|
|
13
|
-
|
|
14
|
-
type Org = {orgId:number, label:string,_id:string}
|
|
15
|
-
const branches = getUserProfile().branches.filter((item:any)=>{return item.branch.tenantId == currentTenant.value})
|
|
16
|
-
const orgList:Org[] = _.uniqBy(branches,'branch.orgId').map((item)=>({
|
|
17
|
-
_id:item['branch']['organization']['_id'],
|
|
18
|
-
orgId:item['branch']['orgId'],
|
|
19
|
-
label:item['branch']['organization']['label']}))
|
|
20
|
-
// console.log("orgList",orgList)
|
|
21
|
-
const getBranchesForOrg = (org:Org)=>{
|
|
22
|
-
const branchlist = branches.filter((item,index)=>{
|
|
23
|
-
// console.log(org['orgId'] ,'===', item['branch']['orgId'])
|
|
24
|
-
return org['orgId'] === item['branch']['orgId']
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
return branchlist
|
|
28
|
-
}
|
|
29
|
-
const switchXorg = ()=>{
|
|
30
|
-
navigateTo(`/${selectedbranch.value}`,{external:true})
|
|
31
|
-
}
|
|
29
|
+
const selectedbranch = ref(getCurrentXorg());
|
|
30
|
+
const currentTenant = ref(getUserProfile()?.tenantId);
|
|
32
31
|
|
|
32
|
+
type Org = { orgId: number; label: string; _id: string };
|
|
33
|
+
const branches = getUserProfile()?.branches.filter((item: any) => {
|
|
34
|
+
return item.branch.tenantId == currentTenant.value;
|
|
35
|
+
});
|
|
36
|
+
const orgList: Org[] = _.uniqBy(branches, "branch.orgId").map((item) => ({
|
|
37
|
+
_id: item["branch"]["organization"]["_id"],
|
|
38
|
+
orgId: item["branch"]["orgId"],
|
|
39
|
+
label: item["branch"]["organization"]["label"],
|
|
40
|
+
}));
|
|
41
|
+
// console.log("orgList",orgList)
|
|
42
|
+
const getBranchesForOrg = (org: Org) => {
|
|
43
|
+
const branchlist = branches.filter((item, index) => {
|
|
44
|
+
// console.log(org['orgId'] ,'===', item['branch']['orgId'])
|
|
45
|
+
return org["orgId"] === item["branch"]["orgId"];
|
|
46
|
+
});
|
|
33
47
|
|
|
48
|
+
return branchlist;
|
|
49
|
+
};
|
|
50
|
+
const switchXorg = () => {
|
|
51
|
+
navigateTo(`/${selectedbranch.value}`, { external: true });
|
|
52
|
+
};
|
|
34
53
|
</script>
|
|
35
|
-
<template>
|
|
36
|
-
<div>
|
|
37
|
-
|
|
38
|
-
<select v-if="selectedbranch" v-model="selectedbranch" class=" text-right" @change="switchXorg()">
|
|
39
|
-
<optgroup v-for="o in orgList" :label="o.label">
|
|
40
|
-
<option v-for="b in getBranchesForOrg(o)" :value="b['xOrg']">{{ b['branch']['branchCode']}} </option>
|
|
41
|
-
</optgroup>
|
|
42
|
-
|
|
43
|
-
</select>
|
|
44
|
-
</div>
|
|
45
|
-
|
|
46
|
-
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="inline-block border rounded-lg w-20 h-20 bg-white">
|
|
3
|
+
<Avatar v-if="email"
|
|
4
|
+
:image="getAvatarLink(<string>email, size)"
|
|
5
|
+
shape="circle"
|
|
6
|
+
size="xlarge"
|
|
7
|
+
/>
|
|
8
|
+
<Avatar v-else-if="id"
|
|
9
|
+
:image="getAvatarByUid(<string>id, size)"
|
|
10
|
+
shape="circle"
|
|
11
|
+
size="xlarge"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
</template>
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
/**
|
|
19
|
+
* This file was automatically generated by simpleapp generator during initialization.
|
|
20
|
+
* --remove-this-line-to-prevent-override--
|
|
21
|
+
* last change 2024-04-06
|
|
22
|
+
* author: Ks Tan
|
|
23
|
+
*/
|
|
24
|
+
const props = defineProps<{
|
|
25
|
+
email?: string;
|
|
26
|
+
id?: string;
|
|
27
|
+
size: number;
|
|
28
|
+
}>();
|
|
29
|
+
|
|
30
|
+
</script>
|
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
class="w-20 h-20 place-content-center"
|
|
6
6
|
@image-uploaded="handleBase64"
|
|
7
7
|
>
|
|
8
|
-
<Image :src="imageData"></Image>
|
|
8
|
+
<Image v-if="imageData!=''" :src="imageData"></Image>
|
|
9
|
+
<svg v-else xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="black" d="M21 10h-2V4h1V2H4v2h1v6H3a1 1 0 0 0-1 1v9h20v-9a1 1 0 0 0-1-1m-7 8v-4h-4v4H7V4h10v14z"/><path fill="black" d="M9 6h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2z"/></svg>
|
|
9
10
|
</ImageToBase64Uploader>
|
|
10
|
-
<div v-else class="inline-block border rounded-lg w-20 h-20">
|
|
11
|
-
<Image :src="imageData"></Image>
|
|
11
|
+
<div v-else class="inline-block border rounded-lg w-20 h-20 bg-white">
|
|
12
|
+
<Image v-if="imageData!=''" :src="imageData"></Image>
|
|
13
|
+
<svg v-else xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="black" d="M21 10h-2V4h1V2H4v2h1v6H3a1 1 0 0 0-1 1v9h20v-9a1 1 0 0 0-1-1m-7 8v-4h-4v4H7V4h10v14z"/><path fill="black" d="M9 6h2v2H9zm4 0h2v2h-2zm-4 4h2v2H9zm4 0h2v2h-2z"/></svg>
|
|
12
14
|
</div>
|
|
13
15
|
</template>
|
|
14
16
|
<script lang="ts" setup>
|
|
@@ -22,7 +24,7 @@ const handleBase64 = async (data: string) => {
|
|
|
22
24
|
key: "organizationLogo",
|
|
23
25
|
value: data,
|
|
24
26
|
};
|
|
25
|
-
|
|
27
|
+
|
|
26
28
|
const uploadok = await useNuxtApp()
|
|
27
29
|
.$OrganizationDoc()
|
|
28
30
|
.getApi()
|
|
@@ -33,7 +35,7 @@ const handleBase64 = async (data: string) => {
|
|
|
33
35
|
};
|
|
34
36
|
const loadLogo = async () => {
|
|
35
37
|
await refreshOrgLogo();
|
|
36
|
-
imageData.value = getOrgLogo();
|
|
38
|
+
imageData.value = getOrgLogo();
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
onMounted(async () => await loadLogo());
|
|
@@ -1,73 +1,90 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<div
|
|
3
3
|
@click="openUploadDialog"
|
|
4
4
|
:title="selectedBase64Img"
|
|
5
|
-
class="place-content-center image-to-base64-uploader rounded-lg border block"
|
|
5
|
+
class="vvv place-content-center image-to-base64-uploader rounded-lg border block"
|
|
6
6
|
>
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
<ClientOnly>
|
|
8
|
+
<slot name="default">
|
|
9
|
+
<Image v-if="selectedBase64Img" :src="selectedBase64Img" />
|
|
10
|
+
<i v-else class="pi pi-upload text-3xl"></i>
|
|
11
|
+
</slot>
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
13
|
+
<Dialog
|
|
14
|
+
v-if="dialogVisible"
|
|
15
|
+
v-model:visible="dialogVisible"
|
|
16
|
+
header="Image Upload"
|
|
17
|
+
:pt="{ root: { class: 'w-4/5' } }"
|
|
18
|
+
>
|
|
19
|
+
<div class="w-full grid grid-cols-2 gap-2">
|
|
20
|
+
<div class="w-7/8 border rounded p-4">
|
|
21
|
+
<TabView lazy>
|
|
22
|
+
<TabPanel :header="t('upload')">
|
|
23
|
+
<div class="upload-container">
|
|
24
|
+
<input
|
|
25
|
+
type="file"
|
|
26
|
+
ref="fileInput"
|
|
27
|
+
accept="image/*"
|
|
28
|
+
@change="handleImageUpload"
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
</TabPanel>
|
|
32
|
+
<TabPanel :header="t('webcam')">
|
|
33
|
+
<div class="webcam-container h h-1/6">
|
|
34
|
+
<WebCamUI :fullscreenState="false" @photoTaken="photoTaken" />
|
|
35
|
+
</div>
|
|
36
|
+
</TabPanel>
|
|
37
|
+
</TabView>
|
|
38
|
+
</div>
|
|
39
|
+
<div id="preview" class="w-7/8 border rounded p-4">
|
|
40
|
+
<Cropper
|
|
41
|
+
v-if="scaledImage"
|
|
42
|
+
ref="cropperInstance"
|
|
43
|
+
:src="scaledImage"
|
|
44
|
+
:stencil-props="{ aspectRatio: 1 }"
|
|
45
|
+
:options="cropperOptions"
|
|
46
|
+
@change="changeChropper"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
34
49
|
</div>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
|
|
51
|
+
<template #footer>
|
|
52
|
+
<div class="flex flex-row gap-4">
|
|
53
|
+
<ButtonDefault @click="dialogVisible = false">{{
|
|
54
|
+
t("cancel")
|
|
55
|
+
}}</ButtonDefault>
|
|
56
|
+
<ButtonPrimary @click="confirm">{{ t("confirm") }}</ButtonPrimary>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
</Dialog>
|
|
60
|
+
</ClientOnly>
|
|
61
|
+
</div>
|
|
46
62
|
</template>
|
|
47
63
|
|
|
48
64
|
<script setup lang="ts">
|
|
49
|
-
/**
|
|
50
|
-
* This file was automatically generated by simpleapp generator during initialization.
|
|
51
|
-
* IT IS NOT CHANGABLE
|
|
52
|
-
* last change 2024-04-06
|
|
53
|
-
* author: Ks Tan
|
|
54
|
-
*/
|
|
55
65
|
// Assuming the Dialog component and Cropper component are globally available or imported in a parent component
|
|
56
|
-
import { defineEmits } from "vue";
|
|
66
|
+
// import { defineEmits } from "vue";
|
|
67
|
+
import { WebCamUI } from "vue-camera-lib";
|
|
68
|
+
import VueCameraLib from "vue-camera-lib";
|
|
69
|
+
|
|
57
70
|
// import Cropper from 'cropperjs'; // Assuming CropperJS is installed using a package manager
|
|
58
71
|
import { Cropper } from "vue-advanced-cropper";
|
|
59
72
|
import "vue-advanced-cropper/dist/style.css";
|
|
73
|
+
|
|
60
74
|
const selectedBase64Img = ref("");
|
|
61
75
|
const cropedBase64Img = ref("");
|
|
62
76
|
const dialogVisible = ref(false);
|
|
63
77
|
const previewImage = ref<string | null>(null);
|
|
64
78
|
const scaledImage = ref<string | null>(null);
|
|
65
|
-
const image = ref<string | null>(null);
|
|
66
|
-
|
|
79
|
+
// const image = ref<string | null>(null);
|
|
67
80
|
const emit = defineEmits<{
|
|
68
81
|
(event: "image-uploaded", imageData: string): void;
|
|
69
82
|
}>();
|
|
70
83
|
|
|
84
|
+
// Use camera reference to call functions
|
|
85
|
+
const photoTaken = (data: any) => {
|
|
86
|
+
scaledImage.value = data.image_data_url;
|
|
87
|
+
};
|
|
71
88
|
const openUploadDialog = () => {
|
|
72
89
|
dialogVisible.value = true;
|
|
73
90
|
};
|
|
@@ -79,8 +96,8 @@ const handleImageUpload = (event) => {
|
|
|
79
96
|
reader.onload = (e) => {
|
|
80
97
|
const img = new Image();
|
|
81
98
|
img.onload = () => {
|
|
82
|
-
const maxWidth =
|
|
83
|
-
const maxHeight =
|
|
99
|
+
const maxWidth = 400; // Set your desired maximum width
|
|
100
|
+
const maxHeight = 300; // Set your desired maximum height
|
|
84
101
|
const scale = Math.min(maxWidth / img.width, maxHeight / img.height);
|
|
85
102
|
const scaledWidth = img.width * scale;
|
|
86
103
|
const scaledHeight = img.height * scale;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<DataTable
|
|
3
|
+
ref="documentlisttable"
|
|
3
4
|
v-bind="$attrs"
|
|
4
5
|
stripedRows
|
|
5
6
|
dataKey="_id"
|
|
@@ -29,15 +30,17 @@
|
|
|
29
30
|
</h1>
|
|
30
31
|
</slot>
|
|
31
32
|
</div>
|
|
32
|
-
<
|
|
33
|
-
|
|
33
|
+
<div class="p-input-icon-left gap-2 flex flex-row">
|
|
34
|
+
<ButtonPrimary @click="exportData">
|
|
35
|
+
<i class="pi pi-external-link"/>
|
|
36
|
+
</ButtonPrimary>
|
|
34
37
|
<InputText
|
|
35
38
|
type="search"
|
|
36
39
|
v-model="filters['global'].value"
|
|
37
40
|
class="w-full dark:text-white text-sm"
|
|
38
41
|
placeholder="Keyword Search"
|
|
39
42
|
/>
|
|
40
|
-
</
|
|
43
|
+
</div>
|
|
41
44
|
</div>
|
|
42
45
|
</template>
|
|
43
46
|
<!-- no data found -->
|
|
@@ -46,10 +49,10 @@
|
|
|
46
49
|
<div class="text-3xl text-gray-400 pi pi-exclamation-circle"></div>
|
|
47
50
|
<div class="text-3xl text-gray-400">{{ t("noDataFound") }}</div>
|
|
48
51
|
</div>
|
|
49
|
-
</template>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
</template>
|
|
53
|
+
<slot name="default">
|
|
54
|
+
<Column header="undefineColumns"></Column>
|
|
55
|
+
</slot>
|
|
53
56
|
</DataTable>
|
|
54
57
|
</template>
|
|
55
58
|
<script setup lang="ts" generic="T">
|
|
@@ -65,18 +68,23 @@ import DataTable from "primevue/datatable";
|
|
|
65
68
|
import Column from "primevue/column";
|
|
66
69
|
import renderComponent from "~/components/renderer";
|
|
67
70
|
import { emit } from "process";
|
|
71
|
+
import ButtonPrimary from "../button/ButtonPrimary.vue";
|
|
72
|
+
const documentlisttable = ref()
|
|
68
73
|
const props = defineProps<{
|
|
69
|
-
value: T[]
|
|
70
|
-
title: string
|
|
71
|
-
columns: string[]
|
|
72
|
-
uniqueKey: string
|
|
73
|
-
documentTitle: string
|
|
74
|
+
value: T[];
|
|
75
|
+
title: string;
|
|
76
|
+
columns: string[];
|
|
77
|
+
uniqueKey: string;
|
|
78
|
+
documentTitle: string;
|
|
74
79
|
}>();
|
|
75
80
|
const emits = defineEmits(["selectRow"]);
|
|
76
81
|
const clickRow = (eventdata: any) => {
|
|
77
82
|
emits("selectRow", eventdata.data);
|
|
78
83
|
};
|
|
79
84
|
|
|
85
|
+
const exportData = ()=>{
|
|
86
|
+
documentlisttable.value.exportCSV()
|
|
87
|
+
}
|
|
80
88
|
const filters = ref({
|
|
81
89
|
global: { value: null, matchMode: FilterMatchMode.CONTAINS },
|
|
82
90
|
});
|