@simitgroup/simpleapp-generator 1.6.2-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.
Files changed (161) hide show
  1. package/README.md +6 -5
  2. package/dist/buildinschemas/branch.d.ts.map +1 -1
  3. package/dist/buildinschemas/branch.js +1 -2
  4. package/dist/buildinschemas/branch.js.map +1 -1
  5. package/dist/buildinschemas/changehistories.d.ts +3 -0
  6. package/dist/buildinschemas/changehistories.d.ts.map +1 -0
  7. package/dist/buildinschemas/changehistories.js +36 -0
  8. package/dist/buildinschemas/changehistories.js.map +1 -0
  9. package/dist/buildinschemas/index.d.ts +1 -0
  10. package/dist/buildinschemas/index.d.ts.map +1 -1
  11. package/dist/buildinschemas/index.js +3 -1
  12. package/dist/buildinschemas/index.js.map +1 -1
  13. package/dist/buildinschemas/organization.js +2 -2
  14. package/dist/buildinschemas/organization.js.map +1 -1
  15. package/dist/buildinschemas/user.d.ts.map +1 -1
  16. package/dist/buildinschemas/user.js +5 -1
  17. package/dist/buildinschemas/user.js.map +1 -1
  18. package/dist/buildinschemas/webhook.d.ts +3 -0
  19. package/dist/buildinschemas/webhook.d.ts.map +1 -0
  20. package/dist/buildinschemas/webhook.js +33 -0
  21. package/dist/buildinschemas/webhook.js.map +1 -0
  22. package/dist/framework.d.ts.map +1 -1
  23. package/dist/framework.js +3 -2
  24. package/dist/framework.js.map +1 -1
  25. package/dist/generate.js +30 -11
  26. package/dist/generate.js.map +1 -1
  27. package/dist/index.js +4 -1
  28. package/dist/index.js.map +1 -1
  29. package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
  30. package/dist/processors/jsonschemabuilder.js +10 -2
  31. package/dist/processors/jsonschemabuilder.js.map +1 -1
  32. package/dist/type.d.ts +2 -0
  33. package/dist/type.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/src/buildinschemas/branch.ts +1 -2
  36. package/src/buildinschemas/changehistories.ts +33 -0
  37. package/src/buildinschemas/index.ts +2 -1
  38. package/src/buildinschemas/organization.ts +2 -2
  39. package/src/buildinschemas/user.ts +5 -1
  40. package/src/buildinschemas/webhook.ts +31 -0
  41. package/src/framework.ts +3 -2
  42. package/src/generate.ts +35 -15
  43. package/src/index.ts +8 -3
  44. package/src/processors/jsonschemabuilder.ts +10 -2
  45. package/src/type.ts +2 -0
  46. package/templates/basic/nest/controller.ts.eta +23 -2
  47. package/templates/basic/nest/model.ts.eta +9 -1
  48. package/templates/basic/nest/resolver.ts.eta +2 -2
  49. package/templates/basic/nuxt/pages.[id].vue.eta +7 -7
  50. package/templates/basic/nuxt/pages.form.vue.eta +3 -6
  51. package/templates/basic/nuxt/pages.landing.vue.eta +2 -21
  52. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +8 -1
  53. package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +2 -0
  54. package/templates/nest/src/simpleapp/generate/commons/dicts/documents.ts.eta +9 -2
  55. package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +36 -30
  56. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +5 -10
  57. package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +1 -0
  58. package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +50 -0
  59. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +13 -3
  60. package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +9 -1
  61. package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +12 -6
  62. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +128 -14
  63. package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +3 -1
  64. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +1 -0
  65. package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +19 -0
  66. package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +30 -8
  67. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +2 -1
  68. package/templates/nuxt/{app.vue._eta → app.vue.eta} +3 -1
  69. package/templates/nuxt/assets/css/calendar.css._eta +3 -0
  70. package/templates/nuxt/assets/css/style.css._eta +1 -1
  71. package/templates/nuxt/assets/images/unknown.png.eta +0 -0
  72. package/templates/nuxt/assets/primevue/passthrough.ts._eta +6 -1
  73. package/templates/nuxt/components/button/ButtonAction.vue._eta +49 -7
  74. package/templates/nuxt/components/button/ButtonDanger.vue._eta +11 -3
  75. package/templates/nuxt/components/button/ButtonDefault.vue._eta +11 -3
  76. package/templates/nuxt/components/button/ButtonPrimary.vue._eta +9 -3
  77. package/templates/nuxt/components/button/ButtonSecondary.vue._eta +33 -0
  78. package/templates/nuxt/components/button/ButtonText.vue._eta +9 -5
  79. package/templates/nuxt/components/button/ButtonWarning.vue._eta +11 -3
  80. package/templates/nuxt/components/calendar/CalendarInput.vue.eta +17 -14
  81. package/templates/nuxt/components/calendar/CalendarSmall.vue.eta +33 -16
  82. package/templates/nuxt/components/chart/card.vue._eta +1 -1
  83. package/templates/nuxt/components/debug/DebugDocumentData.vue.eta +36 -26
  84. package/templates/nuxt/components/event/EventDocumentViewer.vue._eta +62 -22
  85. package/templates/nuxt/components/form/FormBranch.vue._eta +52 -5
  86. package/templates/nuxt/components/form/FormDocnoformat.vue.eta +14 -10
  87. package/templates/nuxt/components/form/FormUser.vue._eta +1 -1
  88. package/templates/nuxt/components/form/user/FormUserPermission.vue.eta +77 -59
  89. package/templates/nuxt/components/header/HeaderSelectBranch.vue.eta +42 -35
  90. package/templates/nuxt/components/image/ImageAvatar.vue.eta._vue +30 -0
  91. package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +7 -5
  92. package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +67 -50
  93. package/templates/nuxt/components/list/ListDocument.vue.eta +10 -5
  94. package/templates/nuxt/components/list/ListDocumentTable.vue.eta +21 -13
  95. package/templates/nuxt/components/list/ListMessages.vue.eta +1 -1
  96. package/templates/nuxt/components/list/ListView.vue.eta +94 -56
  97. package/templates/nuxt/components/overlay/OverlayPanelWithToolBar.vue.eta +11 -4
  98. package/templates/nuxt/components/overlay/OverlaySideBarCrud.vue.eta +17 -6
  99. package/templates/nuxt/components/overlay/OverlayViewer.vue.eta +16 -6
  100. package/templates/nuxt/components/page/PageDocList.vue.eta +108 -31
  101. package/templates/nuxt/components/renderer/RendererDate.vue.eta +8 -2
  102. package/templates/nuxt/components/renderer/RendererDateTime.vue.eta +7 -1
  103. package/templates/nuxt/components/renderer/RendererDocHistories.vue.eta +56 -0
  104. package/templates/nuxt/components/renderer/RendererForeignKey.vue.eta +9 -8
  105. package/templates/nuxt/components/renderer/RendererLink.vue.eta +7 -4
  106. package/templates/nuxt/components/renderer/RendererMoney.vue.eta +25 -17
  107. package/templates/nuxt/components/renderer/RendererTime.vue.eta +7 -1
  108. package/templates/nuxt/components/renderer/RendererViewer.vue.eta +19 -9
  109. package/templates/nuxt/components/select/SelectTemplate.vue.eta +76 -38
  110. package/templates/nuxt/components/session/SessionBlock.vue.eta +44 -46
  111. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +61 -24
  112. package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +64 -0
  113. package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +26 -14
  114. package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +8 -8
  115. package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +1 -1
  116. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +128 -33
  117. package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +89 -168
  118. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +43 -40
  119. package/templates/nuxt/components/simpleApp/SimpleAppUserPicker.vue.eta +387 -0
  120. package/templates/nuxt/components/text/TextDocStatus.vue._eta +22 -0
  121. package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +13 -15
  122. package/templates/nuxt/components/user/UserButtonPermissionInfo.vue.eta +127 -93
  123. package/templates/nuxt/components/user/UserTenantPicker.vue.eta +1 -1
  124. package/templates/nuxt/composables/confirm.generate.ts.eta +19 -0
  125. package/templates/nuxt/composables/date.generate.ts.eta +106 -8
  126. package/templates/nuxt/composables/getDocument.generate.ts.eta +8 -6
  127. package/templates/nuxt/composables/getOpenApi.generate.ts.eta +58 -10
  128. package/templates/nuxt/composables/getUserStore.generate.ts.eta +37 -5
  129. package/templates/nuxt/composables/goTo.generate.ts.eta +14 -1
  130. package/templates/nuxt/composables/graphquery.generate.ts.eta +20 -2
  131. package/templates/nuxt/composables/recently.generate.ts.eta +16 -0
  132. package/templates/nuxt/composables/roles.generate.ts.eta +8 -13
  133. package/templates/nuxt/composables/stringHelper.generate.ts.eta +54 -1
  134. package/templates/nuxt/composables/sysmessage.generate.ts.eta +1 -1
  135. package/templates/nuxt/pages/[xorg]/docnoformat.vue.eta +1 -1
  136. package/templates/nuxt/pages/[xorg]/mobile/docnoformat/{index.vue.eta → index.vue.etaxxx} +1 -1
  137. package/templates/nuxt/pages/[xorg]/mobile/user/{index.vue.eta → index.vue.etaxxx} +1 -1
  138. package/templates/nuxt/pages/[xorg]/{organization.vue.eta → organization.vue._eta} +39 -10
  139. package/templates/nuxt/pages/[xorg]/profile.vue.eta +1 -1
  140. package/templates/nuxt/pages/[xorg]/user.vue.eta +13 -10
  141. package/templates/nuxt/pages/login.vue._eta +4 -1
  142. package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +4 -0
  143. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +45 -26
  144. package/templates/nuxt/plugins/70.recently.ts.eta +55 -0
  145. package/templates/nuxt/providers/my-provider.ts.eta +22 -0
  146. package/templates/nuxt/server/api/[xorg]/{[...].ts.eta → [...].ts._eta} +47 -21
  147. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +44 -3
  148. package/templates/nuxt/types/events.ts.eta +3 -2
  149. package/templates/nuxt/types/others.ts.eta +11 -1
  150. package/templates/nuxt/types/schema.ts.eta +3 -1
  151. package/templates/nuxt/types/simpleappinput.ts.eta +1 -1
  152. package/templates/nuxt/types/user.ts.eta +8 -7
  153. package/templates/project/jsonschemas/branch.json._eta +1 -0
  154. package/templates/project/jsonschemas/invoice.json._eta +4 -3
  155. package/templates/project/jsonschemas/organization.json._eta +2 -2
  156. package/templates/project/lang/default._json +5 -1
  157. package/tsconfig.tsbuildinfo +1 -1
  158. package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +0 -38
  159. /package/templates/nuxt/pages/[xorg]/mobile/{index.vue._eta → index.vue._etaxxx} +0 -0
  160. /package/templates/nuxt/pages/[xorg]/mobile/organization/{[id].vue._eta → [id].vue._etaxxx} +0 -0
  161. /package/templates/nuxt/pages/[xorg]/mobile/{pickgroup.vue._eta → pickgroup.vue._etaxxx} +0 -0
@@ -5,8 +5,8 @@
5
5
  * Author: Ks Tan
6
6
  */
7
7
  import { UserService, User } from './../services/user.service';
8
- import countrytimezone from 'countries-and-timezones'
9
- import countryToCurrency, { Currencies, Countries } from "country-to-currency";
8
+ import countrytimezone from 'countries-and-timezones';
9
+ import countryToCurrency, { Currencies, Countries } from 'country-to-currency';
10
10
  import {
11
11
  Injectable,
12
12
  Scope,
@@ -91,14 +91,14 @@ export class ProfileService {
91
91
  appuser: UserContext,
92
92
  tenantName: string,
93
93
  timeZone: string,
94
- utcOffset: number
94
+ utcOffset: number,
95
95
  ) {
96
96
  // try{
97
- const timezonedata = countrytimezone.getCountriesForTimezone(timeZone)[0]
98
- const countryCode = timezonedata['id']
99
- const countryName = timezonedata['name']
100
- const currencyCode = countryToCurrency[countryCode]
101
-
97
+ const timezonedata = countrytimezone.getCountriesForTimezone(timeZone)[0];
98
+ const countryCode = timezonedata['id'];
99
+ const countryName = timezonedata['name'];
100
+ const currencyCode = countryToCurrency[countryCode];
101
+
102
102
  appuser.getDBSession().startTransaction();
103
103
  const tenantdata: Tenant = {
104
104
  tenantId: 1,
@@ -245,4 +245,26 @@ export class ProfileService {
245
245
  async getSession(appuser: UserContext) {
246
246
  return 'OK';
247
247
  }
248
+
249
+
250
+ async runTourComplete(appuser: UserContext, guideName: string) {
251
+ if (!guideName || guideName == '')
252
+ throw new BadRequestException('undefine guideName');
253
+
254
+ const user = await this.usersvc.findById(
255
+ appuser,
256
+ appuser.getId(),
257
+ );
258
+ if(!Array.isArray(user.completedTours)){
259
+ user.completedTours=[]
260
+ }
261
+
262
+ if (!user.completedTours.includes(guideName)) {
263
+
264
+ user.completedTours.push(guideName);
265
+ const res = await this.usersvc.findIdThenUpdate(appuser, user._id, user);
266
+ }
267
+
268
+ return 'ok';
269
+ }
248
270
  }
@@ -10,7 +10,7 @@ import {DocNumberFormatGenerator} from './generate/commons/docnogenerator.servic
10
10
  import { AuditTrail } from './generate/commons/audittrail.service';
11
11
  import { CloudapiModule } from 'src/cloudapi/cloudapi.module';
12
12
  import { PrintapiModule } from 'src/printapi/printapi.module';
13
-
13
+ import { RunWebhookService } from 'src/simpleapp/generate/commons/runwebhook.service'
14
14
  import { UserResolverService } from './services/userresolver.service';
15
15
  // auto import modules
16
16
  <% for(let i=0;i<it.modules.length; i++){ %>
@@ -53,6 +53,7 @@ import { <%=capitalizeFirstLetter(bpmn)%>ListenerService } from 'src/simpleapp/w
53
53
  controllers: [<% for(let i=0;i<it.modules.length; i++){ %><%= it.modules[i].docname %>Controller,<%}%> ProfileController,WorkflowController],
54
54
  providers: [
55
55
  SimpleAppRobotUserService,
56
+ RunWebhookService,
56
57
  AuditTrail,DocNumberFormatGenerator,<% for(let i=0;i<it.modules.length; i++){ %>
57
58
  <%= it.modules[i].docname %>Service,
58
59
  <%= it.modules[i].docname %>Resolver,
@@ -1,5 +1,7 @@
1
1
  <template>
2
- <NuxtLayout :name="getLayout()">
2
+ <NuxtLayout :name="getLayout()">
3
+ <ConfirmDialog></ConfirmDialog>
4
+ <DynamicDialog />
3
5
  <SessionBlock/>
4
6
  <OverlayHoldscreen/>
5
7
  <EventDocumentViewer></EventDocumentViewer>
@@ -5,6 +5,9 @@
5
5
  * author: Ks Tan
6
6
  */
7
7
  /* calendar */
8
+ .vuecal .p-button{
9
+ color: initial;
10
+ }
8
11
 
9
12
  #monthviewcal .vuecal__cell--current,
10
13
  #monthviewcal .vuecal__cell--today {
@@ -9,7 +9,7 @@
9
9
  @apply bg-gray-100 dark:bg-slate-800 dark:text-gray-300
10
10
  }
11
11
 
12
- [disabled=true],input[disabled] ,input[readonly] ,textarea[readonly]{
12
+ [disabled=true],input[disabled] ,input[readonly] ,textarea[readonly], .p-dropdown[readonly]{
13
13
  @apply bg-gray-300 dark:bg-gray-600
14
14
  }
15
15
 
@@ -24,7 +24,12 @@ const CustomTailwind = usePassThrough(
24
24
  root:{class:'bg-white dark:bg-gray-800 shadow p-2 rounded-2xl'},
25
25
  // title:{class:''},
26
26
  // header:{class:''}
27
- },
27
+ },
28
+ fieldset:{
29
+ root:{class:'border p-2 mt-1'},
30
+ legend:{class:''},
31
+ content:{class:'p-2'}
32
+ },
28
33
  // tabview:{
29
34
  // tabpanel:{
30
35
  // headeraction:{class:'p-tabview-nav-link p-tabview-header-action items-center cursor-pointer flex overflow-hidden relative select-none text-decoration-none select-none border-b-2 p-5 font-bold rounded-t-md transition-shadow duration-200 m-0 transition-colors duration-200 bg-white border-blue-500 text-blue-500 dark:bg-gray-600 dark:border-blue-300 dark:text-blue-300'}
@@ -1,18 +1,34 @@
1
1
  <template>
2
- <ButtonDefault v-if="!actionName" :animate="animate"
3
- ><slot></slot>def</ButtonDefault
2
+ <ButtonDefault v-if="!actionName" :animate="animate">
3
+ <i :class="getIcon()" /><slot></slot>def</ButtonDefault
4
4
  >
5
5
  <ButtonPrimary
6
- v-else-if="['create', 'update','print'].includes(actionName)"
6
+ v-else-if="['create', 'update', 'confirm'].includes(actionName)"
7
7
  :animate="animate"
8
- ><slot></slot
8
+ >
9
+ <i :class="getIcon()" />
10
+ <slot></slot
9
11
  ></ButtonPrimary>
12
+
10
13
  <ButtonDanger
11
14
  v-else-if="['delete', 'void'].includes(actionName)"
12
15
  :animate="animate"
13
- ><slot></slot
14
- ></ButtonDanger>
15
- <ButtonWarning v-else :animate="animate"><slot></slot></ButtonWarning>
16
+ >
17
+ <i :class="getIcon()" />
18
+ <slot></slot>
19
+ </ButtonDanger>
20
+ <ButtonWarning v-else-if="['draft'].includes(actionName)" :animate="animate">
21
+ <i :class="getIcon()" />
22
+ <slot></slot>
23
+ </ButtonWarning>
24
+ <ButtonSecondary v-else-if="actionName == 'print'">
25
+ <i :class="getIcon()" />
26
+ <slot></slot
27
+ ></ButtonSecondary>
28
+ <ButtonDefault v-else :animate="animate">
29
+ <i :class="getIcon()" />
30
+ <slot></slot
31
+ ></ButtonDefault>
16
32
  </template>
17
33
  <script setup lang="ts">
18
34
  /**
@@ -21,5 +37,31 @@
21
37
  * last change 2024-03-01
22
38
  * author: Ks Tan
23
39
  */
40
+
24
41
  const props = defineProps<{ actionName?: string; animate?: boolean }>();
42
+ const getIcon = () => {
43
+ let cssname = "mr-1 pi ";
44
+ switch (props.actionName) {
45
+ case "create":
46
+ case "update":
47
+ cssname += "pi-save";
48
+ break;
49
+ case "delete":
50
+ cssname += "pi-trash";
51
+ break;
52
+ case "print":
53
+ cssname += "pi-file-pdf";
54
+ break;
55
+ case "confirm":
56
+ cssname += "pi-check";
57
+ break;
58
+ case "void":
59
+ cssname += "pi-file-excel";
60
+ break;
61
+ case "draft":
62
+ cssname += "pi-file-edit";
63
+ break;
64
+ }
65
+ return cssname;
66
+ };
25
67
  </script>
@@ -1,12 +1,20 @@
1
1
  <template>
2
2
  <Button
3
3
  v-if="isMobile()"
4
- :class="`w-full rounded-full text-center block dark:bg-danger-600 bg-danger-600 active:dark:bg-danger-400 text-white ${animate ? 'animate-bounce' :'' }`"
4
+ severity="danger"
5
+ :class="`w-full rounded-full text-center block ${
6
+ animate ? 'animate-bounce' : ''
7
+ }`"
5
8
  @click="onActivate"
6
9
  >
7
10
  <slot></slot>
8
11
  </Button>
9
- <Button v-else :class="`btn-danger ${animate ? 'animate-bounce' :'' }`" @click="onActivate">
12
+ <Button
13
+ v-else
14
+ severity="danger"
15
+ :class="`${animate ? 'animate-bounce' : ''}`"
16
+ @click="onActivate"
17
+ >
10
18
  <slot></slot>
11
19
  </Button>
12
20
  </template>
@@ -18,7 +26,7 @@
18
26
  * author: Ks Tan
19
27
  */
20
28
  const emits = defineEmits(["click"]);
21
- const props = defineProps<{animate?:boolean}>()
29
+ const props = defineProps<{ animate?: boolean }>();
22
30
  const onActivate = (e: Event) => {
23
31
  emits("click", e);
24
32
  };
@@ -1,12 +1,20 @@
1
1
  <template>
2
2
  <Button
3
3
  v-if="isMobile()"
4
- :class="`w-full rounded-full text-center block dark:bg-gray-600 bg-gray-600 active:dark:bg-gray-400 text-white ${animate ? 'animate-bounce' :'' }`"
4
+ severity="secondary"
5
+ :class="`w-full rounded-full text-center block ${
6
+ animate ? 'animate-bounce' : ''
7
+ }`"
5
8
  @click="onActivate"
6
9
  >
7
10
  <slot></slot>
8
11
  </Button>
9
- <Button v-else :class="`btn-default ${animate ? 'animate-bounce' :'' }`" @click="onActivate">
12
+ <Button
13
+ v-else
14
+ severity="secondary"
15
+ :class="`${animate ? 'animate-bounce' : ''}`"
16
+ @click="onActivate"
17
+ >
10
18
  <slot></slot>
11
19
  </Button>
12
20
  </template>
@@ -18,7 +26,7 @@
18
26
  * author: Ks Tan
19
27
  */
20
28
  const emits = defineEmits(["click"]);
21
- const props = defineProps<{animate?:boolean}>()
29
+ const props = defineProps<{ animate?: boolean }>();
22
30
  const onActivate = (e: Event) => {
23
31
  emits("click", e);
24
32
  };
@@ -1,12 +1,18 @@
1
1
  <template>
2
2
  <Button
3
3
  v-if="isMobile()"
4
- :class="`w-full rounded-full text-center block dark:bg-primary-600 bg-primary-600 active:dark:bg-primary-400 text-white ${animate ? 'animate-bounce' :'' }`"
4
+ :class="`w-full rounded-full text-center block dark:bg-primary-600 bg-primary-600 active:dark:bg-primary-400 text-white ${
5
+ animate ? 'animate-bounce' : ''
6
+ }`"
5
7
  @click="onActivate"
6
8
  >
7
9
  <slot></slot>
8
10
  </Button>
9
- <Button v-else :class="`btn-primary ${animate ? 'animate-bounce' :'' }`" @click="onActivate">
11
+ <Button
12
+ v-else
13
+ :class="`btn-primary ${animate ? 'animate-bounce' : ''}`"
14
+ @click="onActivate"
15
+ >
10
16
  <slot></slot>
11
17
  </Button>
12
18
  </template>
@@ -18,7 +24,7 @@
18
24
  * author: Ks Tan
19
25
  */
20
26
  const emits = defineEmits(["click"]);
21
- const props = defineProps<{animate?:boolean}>()
27
+ const props = defineProps<{ animate?: boolean }>();
22
28
  const onActivate = (e: Event) => {
23
29
  emits("click", e);
24
30
  };
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <Button
3
+ v-if="isMobile()"
4
+ severity="info"
5
+ :class="`w-full rounded-full text-center block ${
6
+ animate ? 'animate-bounce' : ''
7
+ }`"
8
+ @click="onActivate"
9
+ >
10
+ <slot></slot>
11
+ </Button>
12
+ <Button
13
+ v-else
14
+ severity="info"
15
+ :class="`${animate ? 'animate-bounce' : ''}`"
16
+ @click="onActivate"
17
+ >
18
+ <slot></slot>
19
+ </Button>
20
+ </template>
21
+ <script setup lang="ts">
22
+ /**
23
+ * This file was automatically generated by simpleapp generator during initialization. It is changable.
24
+ * --remove-this-line-to-prevent-override--
25
+ * last change 2024-02-22
26
+ * author: Ks Tan
27
+ */
28
+ const emits = defineEmits(["click"]);
29
+ const props = defineProps<{ animate?: boolean }>();
30
+ const onActivate = (e: Event) => {
31
+ emits("click", e);
32
+ };
33
+ </script>
@@ -2,17 +2,21 @@
2
2
  <Button
3
3
  v-if="isMobile()"
4
4
  @click="onActivate"
5
- :class="`border-none dark:text-white active:text-primary-600 click:bg-gray-600 ${animate ? 'animate-bounce' :'' }`"
5
+ :class="`border-none dark:text-white active:text-primary-600 click:bg-gray-600 ${
6
+ animate ? 'animate-bounce' : ''
7
+ }`"
6
8
  >
7
9
  <slot></slot>
8
10
  </Button>
9
- <Button
11
+ <div
10
12
  v-else
11
13
  @click="onActivate"
12
- :class="`border-none dark:text-white active:text-primary-600 click:bg-gray-600 ${animate ? 'animate-bounce' :'' }`"
14
+ :class="`cursor-pointer p-3 border-none text-center dark:text-white active:text-primary-600 click:bg-gray-600 ${
15
+ animate ? 'animate-bounce' : ''
16
+ }`"
13
17
  >
14
18
  <slot></slot>
15
- </Button>
19
+ </div>
16
20
  </template>
17
21
  <script setup lang="ts">
18
22
  /**
@@ -22,7 +26,7 @@
22
26
  * author: Ks Tan
23
27
  */
24
28
  const emits = defineEmits(["click"]);
25
- const props = defineProps<{animate?:boolean}>()
29
+ const props = defineProps<{ animate?: boolean }>();
26
30
  let stopawhile = false;
27
31
  const onActivate = (e: Event) => {
28
32
  emits("click", e);
@@ -1,12 +1,20 @@
1
1
  <template>
2
2
  <Button
3
3
  v-if="isMobile()"
4
- :class="`w-full rounded-full text-center block dark:bg-warning-600 bg-warning-600 active:bg-warning-400 text-white ${animate ? 'animate-bounce' :'' }`"
4
+ severity="warning"
5
+ :class="`w-full rounded-full text-center block ${
6
+ animate ? 'animate-bounce' : ''
7
+ }`"
5
8
  @click="onActivate"
6
9
  >
7
10
  <slot></slot>
8
11
  </Button>
9
- <Button v-else :class="`btn-warn ${animate ? 'animate-bounce' :'' }`" @click="onActivate">
12
+ <Button
13
+ v-else
14
+ severity="warning"
15
+ :class="`${animate ? 'animate-bounce' : ''}`"
16
+ @click="onActivate"
17
+ >
10
18
  <slot></slot>
11
19
  </Button>
12
20
  </template>
@@ -18,7 +26,7 @@
18
26
  * author: Ks Tan
19
27
  */
20
28
  const emits = defineEmits(["click"]);
21
- const props = defineProps<{animate?:boolean}>()
29
+ const props = defineProps<{ animate?: boolean }>();
22
30
  const onActivate = (e: Event) => {
23
31
  emits("click", e);
24
32
  };
@@ -1,13 +1,15 @@
1
1
  <template>
2
- <div class="flex flex-col ">
3
- <label v-if="label" :for="inputid">{{ label }}</label>
4
- <Calendar
5
- v-model="modelValue"
6
- class="w-full"
7
- :inputid="inputid"
8
- :date-format="getPrimevueCalendarDateFormat()"
9
- />
10
- </div>
2
+ <div class="flex flex-col">
3
+ <label v-if="label" :for="inputid">{{ label }}</label>
4
+ <Calendar
5
+ v-model="modelValue"
6
+ class="w-full"
7
+ :inputid="inputid"
8
+ :date-format="getPrimevueCalendarDateFormat()"
9
+ @update:modelValue="emits('change', modelValue)"
10
+ showButtonBar
11
+ />
12
+ </div>
11
13
  </template>
12
14
  <script setup lang="ts">
13
15
  /**
@@ -16,9 +18,10 @@
16
18
  * last change 2024-04-16
17
19
  * author: Ks Tan
18
20
  */
19
- const modelValue = defineModel<Date>({required:true})
20
- const inputid=randomUUID()
21
+ const modelValue = defineModel<Date>({ required: true });
22
+ const inputid = randomUUID();
23
+ const emits = defineEmits(["change"]);
21
24
  const props = defineProps<{
22
- label?:string
23
- }>()
24
- </script>
25
+ label?: string;
26
+ }>();
27
+ </script>
@@ -1,4 +1,5 @@
1
1
  <template>
2
+ <ClientOnly>
2
3
  <VueCal
3
4
  :id="id"
4
5
  class="w-full"
@@ -13,25 +14,24 @@
13
14
  @view-change="viewChange"
14
15
  :events="allevents"
15
16
  @cell-focus="chooseDate"
16
-
17
17
  xsmall
18
18
  >
19
19
  <template #today-button>
20
20
  <!-- Using Vuetify (but we prefer Wave UI 🤘) -->
21
- <div
22
- @click="chooseDate(new Date(), true)">{{ t("today") }}</div>
21
+ <div @click="chooseDate(new Date(), true)">{{ t("today") }}</div>
23
22
  </template>
24
23
  <template #cell-content="{ cell, events }">
25
24
  <div>
26
25
  <div>
27
- <s
28
- v-if="dateExists(new Date(cell.formattedDate), alloffdays)"
29
- v-tooltip="getHolidayName(new Date(cell.formattedDate))"
30
- class="text text-red-400 font-bold"
31
- >{{ cell.content }}</s
32
- >
26
+ <s v-if="isHoliday(cell.formattedDate)" v-tooltip="getHolidayName(new Date(cell.formattedDate))"
27
+ class="text text-red-400 dark:text-red-400 font-bold"
28
+ >{{ cell.content }}</s>
29
+ <div v-else-if="isOffDay(cell)" class="text-gray-400">
30
+ <s v-tooltip="t('offDay')">{{ cell.content }}</s>
31
+ </div>
33
32
  <span v-else>{{ cell.content }} </span>
34
33
  </div>
34
+
35
35
  <div>
36
36
  <slot name="default" :cell="cell" :events="events">
37
37
  <Badge
@@ -45,6 +45,7 @@
45
45
  </div>
46
46
  </template>
47
47
  </VueCal>
48
+ </ClientOnly>
48
49
  </template>
49
50
  <script lang="ts" setup generic="T">
50
51
  /**
@@ -66,24 +67,25 @@ const viewStatus = ref<CalViewChange>();
66
67
  const props = defineProps<{
67
68
  id: string;
68
69
  items: CalEventType<T>[];
69
- offdays: OffDay[];
70
+ holidays: OffDay[];
70
71
  }>();
72
+ const offdays = ref<string[]>([]);
71
73
  const emits = defineEmits(["chooseDate", "rightClick"]);
72
- const alloffdays = computed(() => props.offdays.map((item) => item.date));
74
+ // const allholidays = computed(() => props.holidays.map((item) => item.date));
73
75
  const selectedDate = defineModel<Date>({ required: true });
74
76
  const getHolidayName = (date: Date) =>
75
- props.offdays.find((item) => item.date.getTime() == date.getTime())?.title;
77
+ props.holidays.find((item) => item.date.getTime() == date.getTime())?.title;
76
78
  const allevents = computed(() => {
77
79
  const list = props.items.map((item) => {
78
80
  if (item.start instanceof Date)
79
81
  item.start = item.start.format("YYYY-MM-DD HH:mm");
80
- else if (typeof item.start == 'string' ){
81
- item.start = item.start.substring(0,16).replace('T',' ');
82
+ else if (typeof item.start == "string") {
83
+ item.start = item.start.substring(0, 16).replace("T", " ");
82
84
  }
83
85
  if (item.end instanceof Date)
84
86
  item.end = item.end.format("YYYY-MM-DD HH:mm");
85
- else if (typeof item.end == 'string' ){
86
- item.end = item.end.substring(0,16).replace('T',' ');
87
+ else if (typeof item.end == "string") {
88
+ item.end = item.end.substring(0, 16).replace("T", " ");
87
89
  }
88
90
  return item;
89
91
  });
@@ -93,6 +95,17 @@ const viewChange = (event: CalViewChange) => {
93
95
  viewStatus.value = event;
94
96
  };
95
97
 
98
+ const isHoliday = (datestr: string) => {
99
+ return props.holidays.find(
100
+ (item) => item.date.format("YYYY-MM-DD") == datestr,
101
+ );
102
+ };
103
+ const isOffDay = (cell: any) => {
104
+
105
+ const dayname: string = new Date(cell.formattedDate) .toLocaleString("en", { weekday: "short" }).toLowerCase();
106
+ if (offdays.value.includes(dayname)) return true;
107
+ else return false;
108
+ };
96
109
  const chooseDate = (date1: Date, force?: boolean) => {
97
110
  if (force || !viewStatus.value || viewStatus.value.view == "month") {
98
111
  selectedDate.value = date1;
@@ -102,4 +115,8 @@ const chooseDate = (date1: Date, force?: boolean) => {
102
115
  const onRightClickDate = (e: MouseEvent, cell: CalRightClickEvent) => {
103
116
  emits("rightClick", e, cell);
104
117
  };
118
+
119
+ onMounted(() => {
120
+ offdays.value = getCurrentBranch()?.branch.offdays ?? [];
121
+ });
105
122
  </script>
@@ -1,5 +1,5 @@
1
1
  <template >
2
- <div class="rounded-lg h-20 p-2" @click="showCartDialog">
2
+ <div class="rounded-lg p-2" @click="showCartDialog">
3
3
  <div class="line-clamp-1 text-sm md:text-base">{{ title }}</div>
4
4
  <div class="text text-2xl md:text-3xl text-right">
5
5
  <slot name="default"></slot>
@@ -1,41 +1,51 @@
1
1
  <template>
2
- <div :class="`p-0 absolute bg-yellow-200 bottom-100 right-0`" v-if="isdebug=='1'">
3
- <button @click="visible=true" class=" text-white text-xs bg-warning-800 p-0 m-0">
4
- <i class="pi pi-code"></i>{{ label }}</button>
5
- <Sidebar v-model:visible="visible" class="text-red-100">
6
-
7
- <template #header >
8
- <h1 class="text-gray-700 text-lg font-bold content-center">{{ label }} Data</h1>
9
- </template>
10
- <template #default>
11
- <pre class="border rounder-lg m-0 p-0 dark:bg-gray-500">{{ modelValue }}
12
- </pre>
13
- </template>
14
-
15
- </Sidebar>
16
-
2
+ <div :class="`p-0 bg-yellow-200 dark:bg-yellow-700 rounded-lg border`" v-if="isdebug == '1'">
3
+ <div
4
+ @click="visible = true"
5
+ class="cursor-pointer text-xs p-0 m-0 flex flex-col p-2 text-center"
6
+ >
7
+ <i class="pi pi-code"></i>
8
+ <span>{{ label }}</span>
17
9
  </div>
18
-
10
+ <Sidebar
11
+ v-model:visible="visible"
12
+ :pt="{ root: { class: 'w-5/6' } }"
13
+ class="text-red-100"
14
+ >
15
+ <template #header>
16
+ <h1 class="text-gray-700 text-lg font-bold content-center">
17
+ {{ label }} Data
18
+ </h1>
19
+ </template>
20
+ <template #default>
21
+ <pre class="border rounder-lg m-0 p-0 bg-gray-500 text-white"
22
+ >{{ modelValue }}
23
+ </pre
24
+ >
25
+ </template>
26
+ </Sidebar>
27
+ </div>
19
28
  </template>
20
29
 
21
30
  <script setup lang="ts">
22
31
  /**
23
- * This file was automatically generated by simpleapp generator during initialization.
32
+ * This file was automatically generated by simpleapp generator during initialization.
24
33
  * IT IS NOT CHANGABLE
25
34
  * last change 2024-02-22
26
35
  * author: Ks Tan
27
36
  */
28
37
  // import Panel from 'primevue/panel';
29
38
  // import ScrollPanel from 'primevue/scrollpanel';
30
- import Dialog from 'primevue/dialog';
31
- import Sidebar from 'primevue/sidebar';
39
+ import Dialog from "primevue/dialog";
40
+ import Sidebar from "primevue/sidebar";
32
41
 
33
- import {ref} from 'vue'
34
- const modelValue = defineModel()
35
- const isdebug = ref(useRuntimeConfig().public.DEBUGDATA)
36
- const visible = ref(false)
37
- const props = withDefaults(defineProps<{label?:string}>(),{label:'label'})
38
- const buttonlabel = computed(()=>props.label??'debug')
42
+ import { ref } from "vue";
43
+ const modelValue = defineModel();
44
+ const isdebug = ref(useRuntimeConfig().public.DEBUGDATA);
45
+ const visible = ref(false);
46
+ const props = withDefaults(defineProps<{ label?: string }>(), {
47
+ label: "label",
48
+ });
49
+ const buttonlabel = computed(() => props.label ?? "debug");
39
50
  const op = ref();
40
-
41
51
  </script>