create-nexgen 1.0.4
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/package.json +26 -0
- package/src/index.js +108 -0
- package/template/.dockerignore +14 -0
- package/template/.env +58 -0
- package/template/.env.example +59 -0
- package/template/.prettierignore +5 -0
- package/template/.prettierrc +8 -0
- package/template/README.md +447 -0
- package/template/drizzle.config.ts +29 -0
- package/template/eslint.config.js +52 -0
- package/template/gitignore-stub +24 -0
- package/template/package.json +96 -0
- package/template/public/assets/AuthLayout-CbswhpjJ.js +1 -0
- package/template/public/assets/Button-_7aQ7gHL.js +1 -0
- package/template/public/assets/Input-CLNJXmKc.css +1 -0
- package/template/public/assets/Input-z8GI8Aqo.js +1 -0
- package/template/public/assets/InputPasswordToggle-BxlzVGp3.js +1 -0
- package/template/public/assets/InputPasswordToggle-C77FI9Eg.css +1 -0
- package/template/public/assets/Layout-DotR1sQC.js +1 -0
- package/template/public/assets/Refresh-BdqsPPBC.js +1 -0
- package/template/public/assets/admin-ui-CU34rLdN.js +1 -0
- package/template/public/assets/bootstrap-icons-BeopsB42.woff +0 -0
- package/template/public/assets/bootstrap-icons-mSm7cUeB.woff2 +0 -0
- package/template/public/assets/dashboard-CwybEyLc.js +1 -0
- package/template/public/assets/dashboard-Dc4d-Pi7.css +1 -0
- package/template/public/assets/forgetPassword-CKEJaXsq.js +1 -0
- package/template/public/assets/index-Bleyx5dm.js +64 -0
- package/template/public/assets/index-DUw8E6Yg.css +1 -0
- package/template/public/assets/login-DC7PTlQF.js +1 -0
- package/template/public/assets/realtime-test-BPQdrFym.css +1 -0
- package/template/public/assets/realtime-test-tQZ0rBEJ.js +1 -0
- package/template/public/assets/register-3O7Qs28C.js +1 -0
- package/template/public/assets/resetPassword-A5AzMWKs.js +1 -0
- package/template/public/assets/verifyEmail-DDBEQHOv.js +1 -0
- package/template/public/index.html +17 -0
- package/template/src/database/migrations/mysql/0000_init.sql +73 -0
- package/template/src/database/migrations/mysql/meta/0000_snapshot.json +484 -0
- package/template/src/database/migrations/mysql/meta/_journal.json +13 -0
- package/template/src/database/schema.ts +4 -0
- package/template/src/env.ts +107 -0
- package/template/src/framework/cache/cache.ts +81 -0
- package/template/src/framework/database/connection.ts +168 -0
- package/template/src/framework/database/optional-db-drivers.d.ts +9 -0
- package/template/src/framework/database/paginate.ts +200 -0
- package/template/src/framework/database/schema.ts +26 -0
- package/template/src/framework/database/seed.ts +33 -0
- package/template/src/framework/events/dispatcher.ts +57 -0
- package/template/src/framework/facade.ts +27 -0
- package/template/src/framework/http/app.ts +61 -0
- package/template/src/framework/http/cors.ts +19 -0
- package/template/src/framework/http/logger.ts +85 -0
- package/template/src/framework/http/openapi.ts +34 -0
- package/template/src/framework/http/ratelimiter.ts +13 -0
- package/template/src/framework/http/router.ts +76 -0
- package/template/src/framework/http/static.ts +33 -0
- package/template/src/framework/http/validation.ts +24 -0
- package/template/src/framework/kernel.ts +40 -0
- package/template/src/framework/maker-cli/src/index.mjs +51 -0
- package/template/src/framework/maker-cli/src/levels/level-1/env-db.mjs +57 -0
- package/template/src/framework/maker-cli/src/levels/level-1/file-ops.mjs +30 -0
- package/template/src/framework/maker-cli/src/levels/level-1/flags.mjs +16 -0
- package/template/src/framework/maker-cli/src/levels/level-1/help.mjs +24 -0
- package/template/src/framework/maker-cli/src/levels/level-1/naming.mjs +13 -0
- package/template/src/framework/maker-cli/src/levels/level-1/process.mjs +47 -0
- package/template/src/framework/maker-cli/src/levels/level-2/db/core.mjs +299 -0
- package/template/src/framework/maker-cli/src/levels/level-2/db/index.mjs +177 -0
- package/template/src/framework/maker-cli/src/levels/level-2/deploy/core.mjs +635 -0
- package/template/src/framework/maker-cli/src/levels/level-2/deploy/index.mjs +145 -0
- package/template/src/framework/maker-cli/src/levels/level-2/module/core.mjs +707 -0
- package/template/src/framework/maker-cli/src/levels/level-2/module/index.mjs +116 -0
- package/template/src/framework/maker-cli/src/levels/level-2/runtime/build-frontend.mjs +16 -0
- package/template/src/framework/maker-cli/src/levels/level-2/runtime/core.mjs +311 -0
- package/template/src/framework/maker-cli/src/levels/level-2/runtime/index.mjs +71 -0
- package/template/src/framework/maker-cli/stubs/controller/openapi.ts.stub +55 -0
- package/template/src/framework/maker-cli/stubs/controller/openapi.with-model.ts.stub +56 -0
- package/template/src/framework/maker-cli/stubs/controller/plain.ts.stub +57 -0
- package/template/src/framework/maker-cli/stubs/controller/schema.plain.ts.stub +13 -0
- package/template/src/framework/maker-cli/stubs/controller/schema.ts.stub +32 -0
- package/template/src/framework/maker-cli/stubs/deploy/Dockerfile.bun.stub +49 -0
- package/template/src/framework/maker-cli/stubs/deploy/Dockerfile.pnpm.stub +53 -0
- package/template/src/framework/maker-cli/stubs/deploy/Dockerfile.stub +49 -0
- package/template/src/framework/maker-cli/stubs/deploy/Dockerfile.yarn.stub +53 -0
- package/template/src/framework/maker-cli/stubs/deploy/README.stub +55 -0
- package/template/src/framework/maker-cli/stubs/deploy/compose/mysql.server.stub +29 -0
- package/template/src/framework/maker-cli/stubs/deploy/compose/postgres.server.stub +29 -0
- package/template/src/framework/maker-cli/stubs/deploy/compose/sqlite.stub +29 -0
- package/template/src/framework/maker-cli/stubs/deploy/env/mysql.server.stub +73 -0
- package/template/src/framework/maker-cli/stubs/deploy/env/postgres.server.stub +73 -0
- package/template/src/framework/maker-cli/stubs/deploy/env/sqlite.stub +72 -0
- package/template/src/framework/maker-cli/stubs/deploy/scripts/auto-migrate.sh.stub +15 -0
- package/template/src/framework/maker-cli/stubs/deploy/server/README.stub +77 -0
- package/template/src/framework/maker-cli/stubs/deploy/server/compose/noredis.stub +118 -0
- package/template/src/framework/maker-cli/stubs/deploy/server/compose/redis.dev.stub +131 -0
- package/template/src/framework/maker-cli/stubs/deploy/server/compose/redis.stub +129 -0
- package/template/src/framework/maker-cli/stubs/deploy/server/env/local.example.stub +10 -0
- package/template/src/framework/maker-cli/stubs/deploy/server/env/noredis.stub +24 -0
- package/template/src/framework/maker-cli/stubs/deploy/server/env/redis.stub +24 -0
- package/template/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/README.stub +15 -0
- package/template/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/app.example.com.stub +12 -0
- package/template/src/framework/maker-cli/stubs/deploy/server/pgadmin/servers.stub +13 -0
- package/template/src/framework/maker-cli/stubs/deploy/server/redis/redis.conf.stub +6 -0
- package/template/src/framework/maker-cli/stubs/deploy/supervisor/noredis.stub +53 -0
- package/template/src/framework/maker-cli/stubs/deploy/supervisor/redis.stub +69 -0
- package/template/src/framework/maker-cli/stubs/deploy/workflow/local.json.stub +24 -0
- package/template/src/framework/maker-cli/stubs/deploy/workflow/remote.json.stub +20 -0
- package/template/src/framework/maker-cli/stubs/example/console.ts.stub +33 -0
- package/template/src/framework/maker-cli/stubs/example/controller.ts.stub +503 -0
- package/template/src/framework/maker-cli/stubs/example/job.ts.stub +74 -0
- package/template/src/framework/maker-cli/stubs/example/route.api.ts.stub +206 -0
- package/template/src/framework/maker-cli/stubs/example/schema.ts.stub +41 -0
- package/template/src/framework/maker-cli/stubs/job/name.ts.stub +24 -0
- package/template/src/framework/maker-cli/stubs/model/name.mysql.ts.stub +8 -0
- package/template/src/framework/maker-cli/stubs/model/name.postgresql.ts.stub +8 -0
- package/template/src/framework/maker-cli/stubs/model/name.sqlite.ts.stub +8 -0
- package/template/src/framework/maker-cli/stubs/notification/NotificationBell.vue.stub +218 -0
- package/template/src/framework/maker-cli/stubs/notification/controller.ts.stub +85 -0
- package/template/src/framework/maker-cli/stubs/notification/index.vue.stub +211 -0
- package/template/src/framework/maker-cli/stubs/notification/job.ts.stub +12 -0
- package/template/src/framework/maker-cli/stubs/notification/route.api.ts.stub +49 -0
- package/template/src/framework/maker-cli/stubs/notification/schema.ts.stub +25 -0
- package/template/src/framework/maker-cli/stubs/route/api.ts.stub +79 -0
- package/template/src/framework/maker-cli/stubs/route/plain.ts.stub +10 -0
- package/template/src/framework/maker-cli/stubs/schedule/name.ts.stub +35 -0
- package/template/src/framework/maker-cli/stubs/seeder/name.ts.stub +17 -0
- package/template/src/framework/modules/discover.ts +54 -0
- package/template/src/framework/modules/routes.ts +26 -0
- package/template/src/framework/notification/index.ts +109 -0
- package/template/src/framework/queue/clear.ts +20 -0
- package/template/src/framework/queue/queue.ts +213 -0
- package/template/src/framework/queue/ui.ts +104 -0
- package/template/src/framework/queue/worker.ts +33 -0
- package/template/src/framework/realtime/broadcast.ts +27 -0
- package/template/src/framework/realtime/index.ts +1 -0
- package/template/src/framework/realtime/socket-cookie.ts +65 -0
- package/template/src/framework/realtime/socket.ts +132 -0
- package/template/src/framework/realtime/types.ts +6 -0
- package/template/src/framework/realtime/ui.ts +16 -0
- package/template/src/framework/redis/client.ts +126 -0
- package/template/src/framework/scheduler/lock.ts +124 -0
- package/template/src/framework/scheduler/run.ts +26 -0
- package/template/src/framework/scheduler/scheduler.ts +82 -0
- package/template/src/framework/server.ts +147 -0
- package/template/src/framework/session/session.ts +116 -0
- package/template/src/framework/storage/storage.ts +743 -0
- package/template/src/framework/support/cookie.ts +78 -0
- package/template/src/framework/support/jwt.ts +45 -0
- package/template/src/framework/support/lifecycle.ts +35 -0
- package/template/src/framework/support/logger.ts +102 -0
- package/template/src/framework/support/mail.ts +43 -0
- package/template/src/framework/support/password.ts +23 -0
- package/template/src/framework/support/url.ts +25 -0
- package/template/src/middlewares/auth-middleware.ts +98 -0
- package/template/src/middlewares/role-middleware.ts +24 -0
- package/template/src/modules/auth/controllers/auth.controller.ts +445 -0
- package/template/src/modules/auth/controllers/auth.helpers.ts +110 -0
- package/template/src/modules/auth/controllers/auth.schema.ts +102 -0
- package/template/src/modules/auth/controllers/role.controller.ts +25 -0
- package/template/src/modules/auth/database/models/notifications.ts +22 -0
- package/template/src/modules/auth/database/models/role.ts +14 -0
- package/template/src/modules/auth/database/models/user.ts +46 -0
- package/template/src/modules/auth/database/seeders/role.ts +19 -0
- package/template/src/modules/auth/database/seeders/user.ts +33 -0
- package/template/src/modules/auth/jobs/forgetpass.ts +18 -0
- package/template/src/modules/auth/jobs/registeruser.ts +31 -0
- package/template/src/modules/auth/jobs/verifyemail.ts +18 -0
- package/template/src/modules/auth/routes/api.ts +151 -0
- package/template/src/modules/auth/routes/role.ts +39 -0
- package/template/src/modules/welcome/controllers/welcome.controller.ts +14 -0
- package/template/src/modules/welcome/controllers/welcome.schema.ts +6 -0
- package/template/src/modules/welcome/database/models/welcome.ts +6 -0
- package/template/src/modules/welcome/routes/api.ts +20 -0
- package/template/src/resources/index.html +16 -0
- package/template/src/resources/src/App.vue +5 -0
- package/template/src/resources/src/assets/css/styles.css +14934 -0
- package/template/src/resources/src/assets/css/styles.css.map +1 -0
- package/template/src/resources/src/assets/images/favicon/favicon.ico +0 -0
- package/template/src/resources/src/assets/images/favicon/favicon1.ico +0 -0
- package/template/src/resources/src/assets/images/logo-1.png +0 -0
- package/template/src/resources/src/assets/images/logo-dark-sm.png +0 -0
- package/template/src/resources/src/assets/images/logo-dark.png +0 -0
- package/template/src/resources/src/assets/images/logo-dark1.png +0 -0
- package/template/src/resources/src/assets/images/logo-sm.png +0 -0
- package/template/src/resources/src/assets/images/logo1.png +0 -0
- package/template/src/resources/src/assets/images/logo2.png +0 -0
- package/template/src/resources/src/assets/scss/custom.css +217 -0
- package/template/src/resources/src/assets/scss/custom.css.map +1 -0
- package/template/src/resources/src/assets/scss/custom.scss +1100 -0
- package/template/src/resources/src/components/Button.vue +35 -0
- package/template/src/resources/src/components/Checkbox.vue +29 -0
- package/template/src/resources/src/components/FloatButton.vue +36 -0
- package/template/src/resources/src/components/Href.vue +32 -0
- package/template/src/resources/src/components/Input.vue +227 -0
- package/template/src/resources/src/components/InputGroup.vue +153 -0
- package/template/src/resources/src/components/InputPasswordToggle.vue +226 -0
- package/template/src/resources/src/components/Modal.vue +102 -0
- package/template/src/resources/src/components/Pagebar.vue +28 -0
- package/template/src/resources/src/components/Refresh.vue +26 -0
- package/template/src/resources/src/components/Select.vue +390 -0
- package/template/src/resources/src/components/Spinner.vue +42 -0
- package/template/src/resources/src/components/Switch.vue +65 -0
- package/template/src/resources/src/components/TextArea.vue +121 -0
- package/template/src/resources/src/components/Toast.vue +56 -0
- package/template/src/resources/src/components/datatable/DataTableSkeleton.vue +99 -0
- package/template/src/resources/src/components/datatable/Pagination.vue +161 -0
- package/template/src/resources/src/components/datatable/SelectOpption.vue +54 -0
- package/template/src/resources/src/components/datatable/index.vue +237 -0
- package/template/src/resources/src/composables/useAuth.ts +52 -0
- package/template/src/resources/src/composables/useBrowserDetect.ts +5 -0
- package/template/src/resources/src/composables/useDialog.ts +5 -0
- package/template/src/resources/src/composables/useGum.ts +3 -0
- package/template/src/resources/src/composables/usePulse.ts +5 -0
- package/template/src/resources/src/env.d.ts +20 -0
- package/template/src/resources/src/helpers/nformatter.ts +10 -0
- package/template/src/resources/src/helpers/utils.ts +68 -0
- package/template/src/resources/src/layouts/AuthLayout.vue +20 -0
- package/template/src/resources/src/layouts/Layout/Footer.vue +23 -0
- package/template/src/resources/src/layouts/Layout/Header.vue +90 -0
- package/template/src/resources/src/layouts/Layout/Sidebar.vue +137 -0
- package/template/src/resources/src/layouts/Layout/index.vue +76 -0
- package/template/src/resources/src/main.ts +27 -0
- package/template/src/resources/src/pages/auth/forgetPassword.vue +76 -0
- package/template/src/resources/src/pages/auth/login.vue +93 -0
- package/template/src/resources/src/pages/auth/register.vue +130 -0
- package/template/src/resources/src/pages/auth/resetPassword.vue +119 -0
- package/template/src/resources/src/pages/auth/verifyEmail.vue +60 -0
- package/template/src/resources/src/pages/dashboard/index.vue +76 -0
- package/template/src/resources/src/plugins/axios.ts +33 -0
- package/template/src/resources/src/plugins/browserDetect.ts +55 -0
- package/template/src/resources/src/plugins/dialog.ts +167 -0
- package/template/src/resources/src/plugins/gum.ts +343 -0
- package/template/src/resources/src/plugins/pulse.ts +141 -0
- package/template/src/resources/src/plugins/routeProgress.ts +87 -0
- package/template/src/resources/src/router/index.ts +85 -0
- package/template/src/resources/src/stores/admin-ui.ts +148 -0
- package/template/src/resources/src/stores/auth.ts +151 -0
- package/template/src/resources/tsconfig.json +19 -0
- package/template/src/resources/vite.config.ts +43 -0
- package/template/src/storage/logs/app.log +20179 -0
- package/template/src/storage/logs/fatal.log +727 -0
- package/template/tsconfig.json +20 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="topclass">
|
|
3
|
+
<div class="position-relative">
|
|
4
|
+
<label :for="inputId" class="d-flex align-items-center" :class="{ 'd-none': !inputLabel }">
|
|
5
|
+
<div class="position-relative">
|
|
6
|
+
<span class="text-capitalize mb-1" v-html="inputLabel"></span>
|
|
7
|
+
<span
|
|
8
|
+
class="position-absolute text-danger rounded-circle bg-danger must"
|
|
9
|
+
:class="{ 'd-none': !props.must }"></span>
|
|
10
|
+
</div>
|
|
11
|
+
<div
|
|
12
|
+
class="text-end ms-auto text-primary align-self-center"
|
|
13
|
+
:class="{ 'd-none': !props.hood }"
|
|
14
|
+
style="font-size: 12px; margin-top: 0.15rem"
|
|
15
|
+
v-html="hoodHtml"></div>
|
|
16
|
+
</label>
|
|
17
|
+
|
|
18
|
+
<div class="input-group mb-3">
|
|
19
|
+
<input
|
|
20
|
+
class="form-control border-0"
|
|
21
|
+
:type="showPassword ? 'text' : 'password'"
|
|
22
|
+
:value="props.modelValue"
|
|
23
|
+
:maxlength="maxLengthAttr"
|
|
24
|
+
:readonly="props.readonly"
|
|
25
|
+
v-bind="$attrs"
|
|
26
|
+
@input="updateModel" />
|
|
27
|
+
<button
|
|
28
|
+
class="input-group-text p-0 border-0 border-start border-1 position-relative z-1"
|
|
29
|
+
type="button"
|
|
30
|
+
@click="togglePassword">
|
|
31
|
+
<i
|
|
32
|
+
class="py-2 px-3"
|
|
33
|
+
:class="showPassword ? 'bi bi-eye' : 'bi bi-eye-slash'"
|
|
34
|
+
style="font-size: 15px"></i>
|
|
35
|
+
</button>
|
|
36
|
+
</div>
|
|
37
|
+
<!-- <input class="form-control" v-model="model" :maxlength="max" v-bind="$attrs"> vue3.3 (2nd way)/3.4 -->
|
|
38
|
+
<div
|
|
39
|
+
class="position-absolute bottom-0 end-0 pe-1 text-secondary max"
|
|
40
|
+
:class="{ 'd-none': !max }">
|
|
41
|
+
{{ maxCounter }}
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div
|
|
45
|
+
:id="`${inputId}Help`"
|
|
46
|
+
class="form-text mt-1 text-danger"
|
|
47
|
+
:class="{ 'd-none': !props.err }">
|
|
48
|
+
{{ props.err }}
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script setup lang="ts">
|
|
54
|
+
import { computed, onMounted, nextTick, useAttrs, ref } from "vue";
|
|
55
|
+
import useBrowserDetect from "../composables/useBrowserDetect";
|
|
56
|
+
|
|
57
|
+
defineOptions({ name: "InputPasswordToggle", inheritAttrs: false });
|
|
58
|
+
const { isFirefox } = useBrowserDetect();
|
|
59
|
+
|
|
60
|
+
const $attrs = useAttrs();
|
|
61
|
+
type InputPasswordCategory =
|
|
62
|
+
| "number"
|
|
63
|
+
| "decimal"
|
|
64
|
+
| "mobile"
|
|
65
|
+
| "tax-period"
|
|
66
|
+
| "bin"
|
|
67
|
+
| "challan-number"
|
|
68
|
+
| string;
|
|
69
|
+
|
|
70
|
+
interface InputPasswordProps {
|
|
71
|
+
focus?: boolean;
|
|
72
|
+
must?: boolean;
|
|
73
|
+
err?: string | boolean;
|
|
74
|
+
modelValue?: string | number;
|
|
75
|
+
category?: InputPasswordCategory;
|
|
76
|
+
hood?: string | boolean | number;
|
|
77
|
+
readonly?: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const props = withDefaults(defineProps<InputPasswordProps>(), {
|
|
81
|
+
err: false,
|
|
82
|
+
modelValue: ""
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const topclass = computed(() => ($attrs.topclass as string | undefined) || "mb-3");
|
|
86
|
+
const inputId = computed(() => ($attrs.id as string | undefined) || "");
|
|
87
|
+
const inputLabel = computed(() => ($attrs.label as string | undefined) || "");
|
|
88
|
+
const inputType = computed(() => ($attrs.type as string | undefined) || "text");
|
|
89
|
+
|
|
90
|
+
const max = computed<number | null>(() => {
|
|
91
|
+
const raw = $attrs.maxlength as string | number | undefined;
|
|
92
|
+
return raw != null ? Number(raw) : null;
|
|
93
|
+
});
|
|
94
|
+
const maxLengthAttr = computed<number | undefined>(() => max.value ?? undefined);
|
|
95
|
+
|
|
96
|
+
const hoodHtml = computed(() =>
|
|
97
|
+
props.hood === false || props.hood == null ? "" : String(props.hood)
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const maxCounter = computed(() => {
|
|
101
|
+
if (max.value == null) {
|
|
102
|
+
return "";
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!isFirefox && inputType.value === "month") {
|
|
106
|
+
return "";
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return max.value - String(props.modelValue).length;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const emit = defineEmits<{
|
|
113
|
+
(event: "update:modelValue", value: string | number): void;
|
|
114
|
+
}>();
|
|
115
|
+
const updateModel = (e: Event) => {
|
|
116
|
+
const target = e.target as HTMLInputElement;
|
|
117
|
+
|
|
118
|
+
if (props.category === "number") {
|
|
119
|
+
emit("update:modelValue", (target.value = target.value.replace(/[^\d]/gi, "")));
|
|
120
|
+
} else if (props.category === "decimal") {
|
|
121
|
+
let val = target.value.replace(/[^\d.]/g, "");
|
|
122
|
+
const parts = val.split(".");
|
|
123
|
+
val = parts[0];
|
|
124
|
+
if (parts.length > 1) {
|
|
125
|
+
val += "." + parts.slice(1).join("");
|
|
126
|
+
}
|
|
127
|
+
emit("update:modelValue", (target.value = val));
|
|
128
|
+
} else if (props.category === "mobile") {
|
|
129
|
+
let digits = target.value.replace(/[^\d]/g, ""); // only digits
|
|
130
|
+
let val = digits;
|
|
131
|
+
if (target.value.includes("+")) {
|
|
132
|
+
val = "+" + digits;
|
|
133
|
+
}
|
|
134
|
+
emit("update:modelValue", (target.value = val));
|
|
135
|
+
} else if (props.category === "tax-period") {
|
|
136
|
+
let val = target.value.replace(/[^\d-]/g, ""); // Only numbers and hyphen
|
|
137
|
+
val = val.replace(/-/g, ""); // Remove all hyphens
|
|
138
|
+
val = val.slice(0, 6); // Only 6 digits (YYYYMM)
|
|
139
|
+
|
|
140
|
+
if (val.length > 4) {
|
|
141
|
+
let year = val.slice(0, 4);
|
|
142
|
+
let month = val.slice(4, 6);
|
|
143
|
+
|
|
144
|
+
// Only correct if both month digits entered
|
|
145
|
+
if (month.length === 2) {
|
|
146
|
+
let m = parseInt(month, 10);
|
|
147
|
+
// Clamp month between 1 and 12
|
|
148
|
+
if (m < 1) m = 1;
|
|
149
|
+
if (m > 12) m = 12;
|
|
150
|
+
// Always pad to 2 digits
|
|
151
|
+
month = m.toString().padStart(2, "0");
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
val = year + "-" + month;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
emit("update:modelValue", (target.value = val));
|
|
158
|
+
} else if (props.category === "bin") {
|
|
159
|
+
let digits = target.value.replace(/[^\d]/g, "");
|
|
160
|
+
digits = digits.slice(0, 14);
|
|
161
|
+
let formatted = digits;
|
|
162
|
+
if (digits.length > 9) {
|
|
163
|
+
formatted = digits.slice(0, 9) + "-" + digits.slice(9, 14);
|
|
164
|
+
}
|
|
165
|
+
emit("update:modelValue", (target.value = formatted));
|
|
166
|
+
} else if (props.category === "challan-number") {
|
|
167
|
+
let digits = target.value.replace(/[^\d]/g, "");
|
|
168
|
+
digits = digits.slice(0, 16);
|
|
169
|
+
let formatted = digits;
|
|
170
|
+
if (digits.length > 4) {
|
|
171
|
+
formatted = digits.slice(0, 4) + "-" + digits.slice(4, 16);
|
|
172
|
+
}
|
|
173
|
+
emit("update:modelValue", (target.value = formatted));
|
|
174
|
+
} else {
|
|
175
|
+
emit("update:modelValue", target.value);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const showPassword = ref(false);
|
|
180
|
+
const togglePassword = () => (showPassword.value = !showPassword.value);
|
|
181
|
+
|
|
182
|
+
onMounted(() => {
|
|
183
|
+
if (!props.focus || !inputId.value) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
nextTick(() => {
|
|
188
|
+
const input = document.querySelector(`#${inputId.value}`) as HTMLInputElement | null;
|
|
189
|
+
input?.focus();
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
</script>
|
|
193
|
+
|
|
194
|
+
<style lang="scss" scoped>
|
|
195
|
+
input {
|
|
196
|
+
border-color: #cccccc;
|
|
197
|
+
|
|
198
|
+
&:read-only {
|
|
199
|
+
background-color: #f8f8f8;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&::placeholder {
|
|
203
|
+
color: #bfbfbf;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
button:focus-visible {
|
|
208
|
+
border: none;
|
|
209
|
+
box-shadow: none;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.form-text {
|
|
213
|
+
font-size: 0.75rem;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.must {
|
|
217
|
+
width: 4px;
|
|
218
|
+
height: 4px;
|
|
219
|
+
margin-left: 2px;
|
|
220
|
+
margin-top: 5px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.max {
|
|
224
|
+
font-size: 0.6rem;
|
|
225
|
+
}
|
|
226
|
+
</style>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="#modal-show">
|
|
3
|
+
<div
|
|
4
|
+
:id="props.id"
|
|
5
|
+
ref="modal"
|
|
6
|
+
class="modal fade"
|
|
7
|
+
data-bs-backdrop="static"
|
|
8
|
+
data-bs-keyboard="false"
|
|
9
|
+
tabindex="-1"
|
|
10
|
+
:aria-labelledby="`${props.id}Label`">
|
|
11
|
+
<div
|
|
12
|
+
:class="`modal-dialog modal-dialog-centered modal-dialog-scrollable modal-${props.size}`">
|
|
13
|
+
<div class="modal-content border">
|
|
14
|
+
<div class="modal-header">
|
|
15
|
+
<div class="d-flex w-100 justify-content-between align-items-center">
|
|
16
|
+
<h5 id="modalScrollableTitle" class="modal-title me-3">{{ props.title }}</h5>
|
|
17
|
+
<button
|
|
18
|
+
type="button"
|
|
19
|
+
class="btn-close shadow-none"
|
|
20
|
+
data-bs-dismiss="modal"
|
|
21
|
+
aria-label="Close"></button>
|
|
22
|
+
<slot name="modal-header-extra"></slot>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="modal-body">
|
|
26
|
+
<slot name="modalbody"></slot>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="modal-footer py-2">
|
|
29
|
+
<slot name="modalfooter"></slot>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</Teleport>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
import { ref, onMounted, onBeforeUnmount } from "vue";
|
|
39
|
+
import { Modal } from "bootstrap";
|
|
40
|
+
|
|
41
|
+
type ModalSize = "sm" | "md" | "lg" | "xl" | string;
|
|
42
|
+
|
|
43
|
+
interface ModalProps {
|
|
44
|
+
id: string;
|
|
45
|
+
title?: string;
|
|
46
|
+
size?: ModalSize;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
defineOptions({ name: "Modal", inheritAttrs: false });
|
|
50
|
+
|
|
51
|
+
const props = withDefaults(defineProps<ModalProps>(), {
|
|
52
|
+
title: "",
|
|
53
|
+
size: "md"
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const modal = ref<HTMLElement | null>(null);
|
|
57
|
+
let modalInstance: Modal | null = null;
|
|
58
|
+
|
|
59
|
+
const getOrCreateModal = () => {
|
|
60
|
+
if (!modal.value) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!modalInstance) {
|
|
65
|
+
modalInstance = new Modal(modal.value, {
|
|
66
|
+
backdrop: "static",
|
|
67
|
+
keyboard: false
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return modalInstance;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
onMounted(() => {
|
|
75
|
+
getOrCreateModal();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const open = () => {
|
|
79
|
+
getOrCreateModal()?.show();
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const close = () => {
|
|
83
|
+
const instance = getOrCreateModal();
|
|
84
|
+
if (!instance) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (document.activeElement instanceof HTMLElement) {
|
|
89
|
+
document.activeElement.blur(); // to avoid aria-hidden warning
|
|
90
|
+
}
|
|
91
|
+
instance.hide();
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
onBeforeUnmount(() => {
|
|
95
|
+
modalInstance?.dispose();
|
|
96
|
+
modalInstance = null;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
defineExpose({ close, open });
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport v-if="target" :to="target">
|
|
3
|
+
<slot v-if="hasDefaultSlot" />
|
|
4
|
+
<p v-else-if="props.title" class="m-0 fs-4">{{ props.title }}</p>
|
|
5
|
+
</Teleport>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { computed, ref, onMounted, useSlots } from "vue";
|
|
10
|
+
|
|
11
|
+
defineOptions({ name: "PageBar", inheritAttrs: false });
|
|
12
|
+
|
|
13
|
+
interface PageBarProps {
|
|
14
|
+
title?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const props = defineProps<PageBarProps>();
|
|
18
|
+
const slots = useSlots();
|
|
19
|
+
|
|
20
|
+
const target = ref<HTMLElement | null>(null);
|
|
21
|
+
const hasDefaultSlot = computed(() => Boolean(slots.default?.().length));
|
|
22
|
+
|
|
23
|
+
onMounted(() => {
|
|
24
|
+
target.value = document.getElementById("pagebar");
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template></template>
|
|
2
|
+
|
|
3
|
+
<script setup lang="ts">
|
|
4
|
+
import { onBeforeUnmount, onMounted } from "vue";
|
|
5
|
+
|
|
6
|
+
defineOptions({ name: "Refresh", inheritAttrs: false });
|
|
7
|
+
|
|
8
|
+
const emit = defineEmits<{
|
|
9
|
+
(event: "click"): void;
|
|
10
|
+
}>();
|
|
11
|
+
|
|
12
|
+
let target: HTMLElement | null = null;
|
|
13
|
+
const onRefreshClick = () => emit("click");
|
|
14
|
+
|
|
15
|
+
onMounted(() => {
|
|
16
|
+
target = document.getElementById("refresh");
|
|
17
|
+
target?.addEventListener("click", onRefreshClick);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
onBeforeUnmount(() => {
|
|
21
|
+
target?.removeEventListener("click", onRefreshClick);
|
|
22
|
+
target = null;
|
|
23
|
+
});
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<style lang="scss" scoped></style>
|