create-nexwire 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +233 -0
- package/express/.dockerignore +14 -0
- package/express/.env +44 -0
- package/express/.env.example +42 -0
- package/express/.vscode/settings.json +26 -0
- package/express/LICENSE +21 -0
- package/express/README.md +211 -0
- package/express/biome.json +66 -0
- package/express/drizzle.config.ts +25 -0
- package/express/gitignore-stub +24 -0
- package/express/package.json +108 -0
- package/express/public/.gitkeep +0 -0
- package/express/src/config/app.ts +41 -0
- package/express/src/config/auth.ts +12 -0
- package/express/src/config/cache.ts +16 -0
- package/express/src/config/cookie.ts +15 -0
- package/express/src/config/cors.ts +12 -0
- package/express/src/config/database.ts +29 -0
- package/express/src/config/index.ts +83 -0
- package/express/src/config/jwt.ts +19 -0
- package/express/src/config/logging.ts +13 -0
- package/express/src/config/mail.ts +24 -0
- package/express/src/config/openapi.ts +54 -0
- package/express/src/config/queue.ts +30 -0
- package/express/src/config/rateLimit.ts +17 -0
- package/express/src/config/realtime.ts +15 -0
- package/express/src/config/redis.ts +18 -0
- package/express/src/config/security.ts +44 -0
- package/express/src/config/session.ts +17 -0
- package/express/src/config/storage.ts +22 -0
- package/express/src/config/validate.ts +40 -0
- package/express/src/database/migrations/sqlite/0000_init.sql +61 -0
- package/express/src/database/migrations/sqlite/meta/0000_snapshot.json +412 -0
- package/express/src/database/migrations/sqlite/meta/_journal.json +13 -0
- package/express/src/database/schema.ts +3 -0
- package/express/src/env.ts +76 -0
- package/express/src/framework/cache/cache.ts +81 -0
- package/express/src/framework/circuit-breaker/cb.ts +60 -0
- package/express/src/framework/database/connection.ts +196 -0
- package/express/src/framework/database/migrate-hooks.ts +87 -0
- package/express/src/framework/database/paginate.ts +227 -0
- package/express/src/framework/database/schema.ts +20 -0
- package/express/src/framework/database/seed.ts +139 -0
- package/express/src/framework/events/dispatcher.ts +49 -0
- package/express/src/framework/facade.ts +48 -0
- package/express/src/framework/http/app.ts +107 -0
- package/express/src/framework/http/cors.ts +7 -0
- package/express/src/framework/http/logger.ts +69 -0
- package/express/src/framework/http/metrics.ts +22 -0
- package/express/src/framework/http/openapi.ts +54 -0
- package/express/src/framework/http/ratelimiter.ts +16 -0
- package/express/src/framework/http/router.ts +178 -0
- package/express/src/framework/http/security.ts +23 -0
- package/express/src/framework/http/static.ts +23 -0
- package/express/src/framework/http/validation.ts +18 -0
- package/express/src/framework/kernel.ts +52 -0
- package/express/src/framework/maker-cli/db/core.mjs +288 -0
- package/express/src/framework/maker-cli/db/index.mjs +204 -0
- package/express/src/framework/maker-cli/deploy/core.mjs +1047 -0
- package/express/src/framework/maker-cli/deploy/index.mjs +91 -0
- package/express/src/framework/maker-cli/index.mjs +53 -0
- package/express/src/framework/maker-cli/middleware/core.mjs +47 -0
- package/express/src/framework/maker-cli/middleware/index.mjs +17 -0
- package/express/src/framework/maker-cli/module/core.mjs +684 -0
- package/express/src/framework/maker-cli/module/index.mjs +140 -0
- package/express/src/framework/maker-cli/runtime/build-ui.mjs +16 -0
- package/express/src/framework/maker-cli/runtime/core.mjs +543 -0
- package/express/src/framework/maker-cli/runtime/index.mjs +104 -0
- package/express/src/framework/maker-cli/runtime/redis-commander-patch.cjs +20 -0
- package/express/src/framework/maker-cli/stubs/controller/openapi.ts.stub +47 -0
- package/express/src/framework/maker-cli/stubs/controller/openapi.with-model.ts.stub +48 -0
- package/express/src/framework/maker-cli/stubs/controller/plain.ts.stub +54 -0
- package/express/src/framework/maker-cli/stubs/controller/schema.plain.ts.stub +14 -0
- package/express/src/framework/maker-cli/stubs/controller/schema.ts.stub +33 -0
- package/express/src/framework/maker-cli/stubs/deploy/Dockerfile.bun.stub +52 -0
- package/express/src/framework/maker-cli/stubs/deploy/Dockerfile.pnpm.stub +55 -0
- package/express/src/framework/maker-cli/stubs/deploy/Dockerfile.stub +51 -0
- package/express/src/framework/maker-cli/stubs/deploy/Dockerfile.yarn.stub +55 -0
- package/express/src/framework/maker-cli/stubs/deploy/README.stub +59 -0
- package/express/src/framework/maker-cli/stubs/deploy/compose/mysql.server.stub +45 -0
- package/express/src/framework/maker-cli/stubs/deploy/compose/postgres.server.stub +45 -0
- package/express/src/framework/maker-cli/stubs/deploy/compose/sqlite.stub +45 -0
- package/express/src/framework/maker-cli/stubs/deploy/env/mysql.server.stub +68 -0
- package/express/src/framework/maker-cli/stubs/deploy/env/postgres.server.stub +68 -0
- package/express/src/framework/maker-cli/stubs/deploy/env/sqlite.stub +67 -0
- package/express/src/framework/maker-cli/stubs/deploy/scripts/auto-migrate.sh.stub +41 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/README.stub +78 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/compose/noredis.stub +120 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/compose/redis.dev.stub +133 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/compose/redis.stub +131 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/env/local.example.stub +11 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/env/noredis.stub +25 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/env/redis.stub +25 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/README.stub +16 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/app.example.com.stub +13 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/pgadmin/servers.stub +14 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/redis/redis.conf.stub +7 -0
- package/express/src/framework/maker-cli/stubs/deploy/supervisor/noredis.stub +54 -0
- package/express/src/framework/maker-cli/stubs/deploy/supervisor/redis.stub +70 -0
- package/express/src/framework/maker-cli/stubs/deploy/workflow/local.json.stub +25 -0
- package/express/src/framework/maker-cli/stubs/deploy/workflow/remote.json.stub +24 -0
- package/express/src/framework/maker-cli/stubs/example/console.ts.stub +34 -0
- package/express/src/framework/maker-cli/stubs/example/controller.ts.stub +418 -0
- package/express/src/framework/maker-cli/stubs/example/job.ts.stub +75 -0
- package/express/src/framework/maker-cli/stubs/example/route.api.ts.stub +207 -0
- package/express/src/framework/maker-cli/stubs/example/route.plain.ts.stub +18 -0
- package/express/src/framework/maker-cli/stubs/example/schema.plain.ts.stub +42 -0
- package/express/src/framework/maker-cli/stubs/example/schema.ts.stub +42 -0
- package/express/src/framework/maker-cli/stubs/job/name.ts.stub +25 -0
- package/express/src/framework/maker-cli/stubs/middleware/name.ts.stub +14 -0
- package/express/src/framework/maker-cli/stubs/model/name.mysql.ts.stub +9 -0
- package/express/src/framework/maker-cli/stubs/model/name.postgresql.ts.stub +9 -0
- package/express/src/framework/maker-cli/stubs/model/name.sqlite.ts.stub +9 -0
- package/express/src/framework/maker-cli/stubs/notification/controller.ts.stub +77 -0
- package/express/src/framework/maker-cli/stubs/notification/job.ts.stub +13 -0
- package/express/src/framework/maker-cli/stubs/notification/route.api.ts.stub +50 -0
- package/express/src/framework/maker-cli/stubs/notification/route.plain.ts.stub +12 -0
- package/express/src/framework/maker-cli/stubs/notification/schema.plain.ts.stub +26 -0
- package/express/src/framework/maker-cli/stubs/notification/schema.ts.stub +26 -0
- package/express/src/framework/maker-cli/stubs/route/api.ts.stub +80 -0
- package/express/src/framework/maker-cli/stubs/route/plain.ts.stub +11 -0
- package/express/src/framework/maker-cli/stubs/schedule/name.ts.stub +36 -0
- package/express/src/framework/maker-cli/stubs/seeder/name.ts.stub +20 -0
- package/express/src/framework/maker-cli/stubs/test/unit.ts.stub +22 -0
- package/express/src/framework/maker-cli/utils/env-config.mjs +44 -0
- package/express/src/framework/maker-cli/utils/env-db.mjs +61 -0
- package/express/src/framework/maker-cli/utils/file-ops.mjs +30 -0
- package/express/src/framework/maker-cli/utils/flags.mjs +14 -0
- package/express/src/framework/maker-cli/utils/help.mjs +50 -0
- package/express/src/framework/maker-cli/utils/naming.mjs +13 -0
- package/express/src/framework/maker-cli/utils/process.mjs +52 -0
- package/express/src/framework/modules/discover.ts +54 -0
- package/express/src/framework/modules/routes.ts +21 -0
- package/express/src/framework/notification/index.ts +116 -0
- package/express/src/framework/queue/clear.ts +22 -0
- package/express/src/framework/queue/queue.ts +342 -0
- package/express/src/framework/queue/ui.ts +187 -0
- package/express/src/framework/queue/worker.ts +61 -0
- package/express/src/framework/realtime/broadcast.ts +46 -0
- package/express/src/framework/realtime/index.ts +2 -0
- package/express/src/framework/realtime/socket-cookie.ts +71 -0
- package/express/src/framework/realtime/socket.ts +119 -0
- package/express/src/framework/realtime/types.ts +6 -0
- package/express/src/framework/realtime/ui.ts +16 -0
- package/express/src/framework/redis/client.ts +151 -0
- package/express/src/framework/runtime/runtime.ts +23 -0
- package/express/src/framework/runtime/server-adapter.ts +34 -0
- package/express/src/framework/scheduler/lock.ts +116 -0
- package/express/src/framework/scheduler/run.ts +48 -0
- package/express/src/framework/scheduler/scheduler.ts +155 -0
- package/express/src/framework/server.ts +177 -0
- package/express/src/framework/session/session.ts +98 -0
- package/express/src/framework/storage/storage.ts +785 -0
- package/express/src/framework/support/cookie.ts +62 -0
- package/express/src/framework/support/jwt.ts +33 -0
- package/express/src/framework/support/lifecycle.ts +35 -0
- package/express/src/framework/support/logger.ts +148 -0
- package/express/src/framework/support/mail.ts +48 -0
- package/express/src/framework/support/password.ts +23 -0
- package/express/src/framework/support/upload.ts +160 -0
- package/express/src/framework/support/url.ts +41 -0
- package/express/src/middlewares/auth-middleware.ts +98 -0
- package/express/src/middlewares/role-middleware.ts +25 -0
- package/express/src/modules/auth/controllers/auth.controller.ts +358 -0
- package/express/src/modules/auth/controllers/auth.helpers.ts +104 -0
- package/express/src/modules/auth/controllers/auth.schema.ts +102 -0
- package/express/src/modules/auth/controllers/role.controller.ts +15 -0
- package/express/src/modules/auth/database/models/notifications.ts +24 -0
- package/express/src/modules/auth/database/models/role.ts +14 -0
- package/express/src/modules/auth/database/models/user.ts +46 -0
- package/express/src/modules/auth/database/seeders/role.ts +18 -0
- package/express/src/modules/auth/database/seeders/user.ts +35 -0
- package/express/src/modules/auth/jobs/forgetpass.ts +20 -0
- package/express/src/modules/auth/jobs/registeruser.ts +23 -0
- package/express/src/modules/auth/jobs/verifyemail.ts +18 -0
- package/express/src/modules/auth/routes/api.ts +150 -0
- package/express/src/modules/auth/routes/role.ts +33 -0
- package/express/src/resources/index.html +17 -0
- package/express/src/resources/src/App.vue +5 -0
- package/express/src/resources/src/assets/css/styles.css +14761 -0
- package/express/src/resources/src/assets/css/styles.css.map +1 -0
- package/express/src/resources/src/assets/fonts/public-sans/public-sans-latin-ext.woff2 +0 -0
- package/express/src/resources/src/assets/fonts/public-sans/public-sans-latin.woff2 +0 -0
- package/express/src/resources/src/assets/images/favicon/favicon.ico +0 -0
- package/express/src/resources/src/assets/images/logo.png +0 -0
- package/express/src/resources/src/assets/scss/custom.css +217 -0
- package/express/src/resources/src/assets/scss/custom.css.map +1 -0
- package/express/src/resources/src/assets/scss/custom.scss +1346 -0
- package/express/src/resources/src/components/Button.vue +32 -0
- package/express/src/resources/src/components/Checkbox.vue +29 -0
- package/express/src/resources/src/components/Datepicker.vue +106 -0
- package/express/src/resources/src/components/FeatureButton.vue +53 -0
- package/express/src/resources/src/components/FloatButton.vue +33 -0
- package/express/src/resources/src/components/Href.vue +32 -0
- package/express/src/resources/src/components/Input.vue +223 -0
- package/express/src/resources/src/components/InputGroup.vue +145 -0
- package/express/src/resources/src/components/InputPasswordToggle.vue +213 -0
- package/express/src/resources/src/components/Modal.vue +55 -0
- package/express/src/resources/src/components/Pagebar.vue +26 -0
- package/express/src/resources/src/components/Select.vue +384 -0
- package/express/src/resources/src/components/Spinner.vue +42 -0
- package/express/src/resources/src/components/Switch.vue +65 -0
- package/express/src/resources/src/components/TextArea.vue +117 -0
- package/express/src/resources/src/components/Toast.vue +56 -0
- package/express/src/resources/src/components/datatable/DataTableSkeleton.vue +98 -0
- package/express/src/resources/src/components/datatable/Pagination.vue +147 -0
- package/express/src/resources/src/components/datatable/SelectOpption.vue +64 -0
- package/express/src/resources/src/components/datatable/index.vue +199 -0
- package/express/src/resources/src/composables/useAuth.ts +52 -0
- package/express/src/resources/src/helpers/nformatter.ts +10 -0
- package/express/src/resources/src/helpers/utils.ts +75 -0
- package/express/src/resources/src/layouts/AuthLayout.vue +20 -0
- package/express/src/resources/src/layouts/Layout/Footer.vue +23 -0
- package/express/src/resources/src/layouts/Layout/Header.vue +105 -0
- package/express/src/resources/src/layouts/Layout/Sidebar.vue +137 -0
- package/express/src/resources/src/layouts/Layout/index.vue +87 -0
- package/express/src/resources/src/main.ts +26 -0
- package/express/src/resources/src/pages/auth/forgetPassword.vue +82 -0
- package/express/src/resources/src/pages/auth/login.vue +99 -0
- package/express/src/resources/src/pages/auth/register.vue +133 -0
- package/express/src/resources/src/pages/auth/resetPassword.vue +118 -0
- package/express/src/resources/src/pages/auth/verifyEmail.vue +68 -0
- package/express/src/resources/src/pages/dashboard/index.vue +66 -0
- package/express/src/resources/src/plugins/axios.ts +31 -0
- package/express/src/resources/src/plugins/browserDetect.ts +55 -0
- package/express/src/resources/src/plugins/dialog.ts +216 -0
- package/express/src/resources/src/plugins/gum.ts +367 -0
- package/express/src/resources/src/plugins/pulse.ts +147 -0
- package/express/src/resources/src/plugins/routeProgress.ts +87 -0
- package/express/src/resources/src/router/index.ts +85 -0
- package/express/src/resources/src/stores/admin-ui.ts +148 -0
- package/express/src/resources/src/stores/auth.ts +164 -0
- package/express/src/resources/tsconfig.json +19 -0
- package/express/src/resources/vite.config.ts +46 -0
- package/express/src/storage/app/private/.gitkeep +0 -0
- package/express/src/storage/app/public/.gitkeep +0 -0
- package/express/src/storage/app/tmp/generated/.gitkeep +0 -0
- package/express/src/storage/database/nexwire.sqlite +0 -0
- package/express/src/storage/logs/.gitkeep +0 -0
- package/express/src/storage/tmp/.gitkeep +0 -0
- package/express/src/storage/trash/modules/.gitkeep +0 -0
- package/express/src/types/global.d.ts +26 -0
- package/express/tsconfig.json +19 -0
- package/express/vitest.config.ts +23 -0
- package/hono/.dockerignore +14 -0
- package/hono/.env +44 -0
- package/hono/.env.example +42 -0
- package/hono/.vscode/settings.json +26 -0
- package/hono/LICENSE +21 -0
- package/hono/README.md +211 -0
- package/hono/biome.json +76 -0
- package/hono/drizzle.config.ts +25 -0
- package/hono/gitignore-stub +24 -0
- package/hono/package.json +99 -0
- package/hono/public/.gitkeep +0 -0
- package/hono/src/config/app.ts +41 -0
- package/hono/src/config/auth.ts +12 -0
- package/hono/src/config/cache.ts +16 -0
- package/hono/src/config/cookie.ts +15 -0
- package/hono/src/config/cors.ts +12 -0
- package/hono/src/config/database.ts +29 -0
- package/hono/src/config/index.ts +83 -0
- package/hono/src/config/jwt.ts +19 -0
- package/hono/src/config/logging.ts +13 -0
- package/hono/src/config/mail.ts +24 -0
- package/hono/src/config/openapi.ts +54 -0
- package/hono/src/config/queue.ts +30 -0
- package/hono/src/config/rateLimit.ts +17 -0
- package/hono/src/config/realtime.ts +15 -0
- package/hono/src/config/redis.ts +18 -0
- package/hono/src/config/security.ts +44 -0
- package/hono/src/config/session.ts +17 -0
- package/hono/src/config/storage.ts +22 -0
- package/hono/src/config/validate.ts +40 -0
- package/hono/src/database/migrations/sqlite/0000_init.sql +61 -0
- package/hono/src/database/migrations/sqlite/meta/0000_snapshot.json +412 -0
- package/hono/src/database/migrations/sqlite/meta/_journal.json +13 -0
- package/hono/src/database/schema.ts +3 -0
- package/hono/src/env.ts +76 -0
- package/hono/src/framework/cache/cache.ts +81 -0
- package/hono/src/framework/circuit-breaker/cb.ts +60 -0
- package/hono/src/framework/database/connection.ts +196 -0
- package/hono/src/framework/database/migrate-hooks.ts +87 -0
- package/hono/src/framework/database/paginate.ts +253 -0
- package/hono/src/framework/database/schema.ts +20 -0
- package/hono/src/framework/database/seed.ts +139 -0
- package/hono/src/framework/events/dispatcher.ts +49 -0
- package/hono/src/framework/facade.ts +29 -0
- package/hono/src/framework/http/app.ts +109 -0
- package/hono/src/framework/http/cors.ts +19 -0
- package/hono/src/framework/http/logger.ts +81 -0
- package/hono/src/framework/http/metrics.ts +22 -0
- package/hono/src/framework/http/openapi.ts +42 -0
- package/hono/src/framework/http/ratelimiter.ts +172 -0
- package/hono/src/framework/http/router.ts +76 -0
- package/hono/src/framework/http/security.ts +23 -0
- package/hono/src/framework/http/static.ts +70 -0
- package/hono/src/framework/http/validation.ts +21 -0
- package/hono/src/framework/kernel.ts +48 -0
- package/hono/src/framework/maker-cli/db/core.mjs +288 -0
- package/hono/src/framework/maker-cli/db/index.mjs +204 -0
- package/hono/src/framework/maker-cli/deploy/core.mjs +1038 -0
- package/hono/src/framework/maker-cli/deploy/index.mjs +91 -0
- package/hono/src/framework/maker-cli/index.mjs +53 -0
- package/hono/src/framework/maker-cli/middleware/core.mjs +47 -0
- package/hono/src/framework/maker-cli/middleware/index.mjs +12 -0
- package/hono/src/framework/maker-cli/module/core.mjs +684 -0
- package/hono/src/framework/maker-cli/module/index.mjs +140 -0
- package/hono/src/framework/maker-cli/runtime/build-ui.mjs +17 -0
- package/hono/src/framework/maker-cli/runtime/core.mjs +543 -0
- package/hono/src/framework/maker-cli/runtime/index.mjs +104 -0
- package/hono/src/framework/maker-cli/runtime/redis-commander-patch.cjs +20 -0
- package/hono/src/framework/maker-cli/stubs/controller/openapi.ts.stub +57 -0
- package/hono/src/framework/maker-cli/stubs/controller/openapi.with-model.ts.stub +58 -0
- package/hono/src/framework/maker-cli/stubs/controller/plain.ts.stub +59 -0
- package/hono/src/framework/maker-cli/stubs/controller/schema.plain.ts.stub +14 -0
- package/hono/src/framework/maker-cli/stubs/controller/schema.ts.stub +33 -0
- package/hono/src/framework/maker-cli/stubs/deploy/Dockerfile.bun.stub +52 -0
- package/hono/src/framework/maker-cli/stubs/deploy/Dockerfile.pnpm.stub +55 -0
- package/hono/src/framework/maker-cli/stubs/deploy/Dockerfile.stub +51 -0
- package/hono/src/framework/maker-cli/stubs/deploy/Dockerfile.yarn.stub +55 -0
- package/hono/src/framework/maker-cli/stubs/deploy/README.stub +59 -0
- package/hono/src/framework/maker-cli/stubs/deploy/compose/mysql.server.stub +45 -0
- package/hono/src/framework/maker-cli/stubs/deploy/compose/postgres.server.stub +45 -0
- package/hono/src/framework/maker-cli/stubs/deploy/compose/sqlite.stub +45 -0
- package/hono/src/framework/maker-cli/stubs/deploy/env/mysql.server.stub +68 -0
- package/hono/src/framework/maker-cli/stubs/deploy/env/postgres.server.stub +68 -0
- package/hono/src/framework/maker-cli/stubs/deploy/env/sqlite.stub +67 -0
- package/hono/src/framework/maker-cli/stubs/deploy/scripts/auto-migrate.sh.stub +41 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/README.stub +78 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/compose/noredis.stub +120 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/compose/redis.dev.stub +133 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/compose/redis.stub +131 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/env/local.example.stub +11 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/env/noredis.stub +25 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/env/redis.stub +25 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/README.stub +16 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/app.example.com.stub +13 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/pgadmin/servers.stub +14 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/redis/redis.conf.stub +7 -0
- package/hono/src/framework/maker-cli/stubs/deploy/supervisor/noredis.stub +54 -0
- package/hono/src/framework/maker-cli/stubs/deploy/supervisor/redis.stub +70 -0
- package/hono/src/framework/maker-cli/stubs/deploy/workflow/local.json.stub +25 -0
- package/hono/src/framework/maker-cli/stubs/deploy/workflow/remote.json.stub +24 -0
- package/hono/src/framework/maker-cli/stubs/example/console.ts.stub +34 -0
- package/hono/src/framework/maker-cli/stubs/example/controller.ts.stub +505 -0
- package/hono/src/framework/maker-cli/stubs/example/job.ts.stub +75 -0
- package/hono/src/framework/maker-cli/stubs/example/route.api.ts.stub +207 -0
- package/hono/src/framework/maker-cli/stubs/example/route.plain.ts.stub +18 -0
- package/hono/src/framework/maker-cli/stubs/example/schema.plain.ts.stub +42 -0
- package/hono/src/framework/maker-cli/stubs/example/schema.ts.stub +42 -0
- package/hono/src/framework/maker-cli/stubs/job/name.ts.stub +25 -0
- package/hono/src/framework/maker-cli/stubs/middleware/name.ts.stub +14 -0
- package/hono/src/framework/maker-cli/stubs/model/name.mysql.ts.stub +9 -0
- package/hono/src/framework/maker-cli/stubs/model/name.postgresql.ts.stub +9 -0
- package/hono/src/framework/maker-cli/stubs/model/name.sqlite.ts.stub +9 -0
- package/hono/src/framework/maker-cli/stubs/notification/controller.ts.stub +86 -0
- package/hono/src/framework/maker-cli/stubs/notification/job.ts.stub +13 -0
- package/hono/src/framework/maker-cli/stubs/notification/route.api.ts.stub +50 -0
- package/hono/src/framework/maker-cli/stubs/notification/route.plain.ts.stub +12 -0
- package/hono/src/framework/maker-cli/stubs/notification/schema.plain.ts.stub +26 -0
- package/hono/src/framework/maker-cli/stubs/notification/schema.ts.stub +26 -0
- package/hono/src/framework/maker-cli/stubs/route/api.ts.stub +80 -0
- package/hono/src/framework/maker-cli/stubs/route/plain.ts.stub +11 -0
- package/hono/src/framework/maker-cli/stubs/schedule/name.ts.stub +36 -0
- package/hono/src/framework/maker-cli/stubs/seeder/name.ts.stub +20 -0
- package/hono/src/framework/maker-cli/stubs/test/unit.ts.stub +22 -0
- package/hono/src/framework/maker-cli/utils/env-config.mjs +44 -0
- package/hono/src/framework/maker-cli/utils/env-db.mjs +61 -0
- package/hono/src/framework/maker-cli/utils/file-ops.mjs +30 -0
- package/hono/src/framework/maker-cli/utils/flags.mjs +14 -0
- package/hono/src/framework/maker-cli/utils/help.mjs +50 -0
- package/hono/src/framework/maker-cli/utils/naming.mjs +13 -0
- package/hono/src/framework/maker-cli/utils/process.mjs +52 -0
- package/hono/src/framework/modules/discover.ts +54 -0
- package/hono/src/framework/modules/routes.ts +24 -0
- package/hono/src/framework/notification/index.ts +116 -0
- package/hono/src/framework/queue/clear.ts +22 -0
- package/hono/src/framework/queue/queue.ts +342 -0
- package/hono/src/framework/queue/ui.ts +214 -0
- package/hono/src/framework/queue/worker.ts +61 -0
- package/hono/src/framework/realtime/broadcast.ts +46 -0
- package/hono/src/framework/realtime/index.ts +2 -0
- package/hono/src/framework/realtime/socket-cookie.ts +68 -0
- package/hono/src/framework/realtime/socket.ts +196 -0
- package/hono/src/framework/realtime/types.ts +6 -0
- package/hono/src/framework/realtime/ui.ts +16 -0
- package/hono/src/framework/redis/client.ts +151 -0
- package/hono/src/framework/runtime/runtime.ts +23 -0
- package/hono/src/framework/runtime/server-adapter.ts +94 -0
- package/hono/src/framework/scheduler/lock.ts +116 -0
- package/hono/src/framework/scheduler/run.ts +48 -0
- package/hono/src/framework/scheduler/scheduler.ts +155 -0
- package/hono/src/framework/server.ts +183 -0
- package/hono/src/framework/session/session.ts +116 -0
- package/hono/src/framework/storage/storage.ts +785 -0
- package/hono/src/framework/support/cookie.ts +99 -0
- package/hono/src/framework/support/jwt.ts +45 -0
- package/hono/src/framework/support/lifecycle.ts +35 -0
- package/hono/src/framework/support/logger.ts +148 -0
- package/hono/src/framework/support/mail.ts +48 -0
- package/hono/src/framework/support/password.ts +23 -0
- package/hono/src/framework/support/url.ts +41 -0
- package/hono/src/middlewares/auth-middleware.ts +98 -0
- package/hono/src/middlewares/role-middleware.ts +25 -0
- package/hono/src/modules/auth/controllers/auth.controller.ts +413 -0
- package/hono/src/modules/auth/controllers/auth.helpers.ts +128 -0
- package/hono/src/modules/auth/controllers/auth.schema.ts +102 -0
- package/hono/src/modules/auth/controllers/role.controller.ts +25 -0
- package/hono/src/modules/auth/database/models/notifications.ts +24 -0
- package/hono/src/modules/auth/database/models/role.ts +14 -0
- package/hono/src/modules/auth/database/models/user.ts +46 -0
- package/hono/src/modules/auth/database/seeders/role.ts +18 -0
- package/hono/src/modules/auth/database/seeders/user.ts +35 -0
- package/hono/src/modules/auth/jobs/forgetpass.ts +20 -0
- package/hono/src/modules/auth/jobs/registeruser.ts +23 -0
- package/hono/src/modules/auth/jobs/verifyemail.ts +18 -0
- package/hono/src/modules/auth/routes/api.ts +150 -0
- package/hono/src/modules/auth/routes/role.ts +33 -0
- package/hono/src/resources/index.html +17 -0
- package/hono/src/resources/src/App.vue +5 -0
- package/hono/src/resources/src/assets/css/styles.css +14913 -0
- package/hono/src/resources/src/assets/css/styles.css.map +1 -0
- package/hono/src/resources/src/assets/fonts/public-sans/public-sans-latin-ext.woff2 +0 -0
- package/hono/src/resources/src/assets/fonts/public-sans/public-sans-latin.woff2 +0 -0
- package/hono/src/resources/src/assets/images/favicon/favicon.ico +0 -0
- package/hono/src/resources/src/assets/images/logo.png +0 -0
- package/hono/src/resources/src/assets/scss/custom.css +217 -0
- package/hono/src/resources/src/assets/scss/custom.css.map +1 -0
- package/hono/src/resources/src/assets/scss/custom.scss +1346 -0
- package/hono/src/resources/src/components/Button.vue +32 -0
- package/hono/src/resources/src/components/Checkbox.vue +29 -0
- package/hono/src/resources/src/components/Datepicker.vue +106 -0
- package/hono/src/resources/src/components/FeatureButton.vue +53 -0
- package/hono/src/resources/src/components/FloatButton.vue +33 -0
- package/hono/src/resources/src/components/Href.vue +32 -0
- package/hono/src/resources/src/components/Input.vue +234 -0
- package/hono/src/resources/src/components/InputGroup.vue +149 -0
- package/hono/src/resources/src/components/InputPasswordToggle.vue +222 -0
- package/hono/src/resources/src/components/Modal.vue +55 -0
- package/hono/src/resources/src/components/Pagebar.vue +26 -0
- package/hono/src/resources/src/components/Select.vue +415 -0
- package/hono/src/resources/src/components/Spinner.vue +42 -0
- package/hono/src/resources/src/components/Switch.vue +65 -0
- package/hono/src/resources/src/components/TextArea.vue +121 -0
- package/hono/src/resources/src/components/Toast.vue +56 -0
- package/hono/src/resources/src/components/datatable/DataTableSkeleton.vue +98 -0
- package/hono/src/resources/src/components/datatable/Pagination.vue +147 -0
- package/hono/src/resources/src/components/datatable/SelectOpption.vue +64 -0
- package/hono/src/resources/src/components/datatable/index.vue +199 -0
- package/hono/src/resources/src/composables/useAuth.ts +52 -0
- package/hono/src/resources/src/helpers/nformatter.ts +10 -0
- package/hono/src/resources/src/helpers/utils.ts +75 -0
- package/hono/src/resources/src/layouts/AuthLayout.vue +20 -0
- package/hono/src/resources/src/layouts/Layout/Footer.vue +23 -0
- package/hono/src/resources/src/layouts/Layout/Header.vue +105 -0
- package/hono/src/resources/src/layouts/Layout/Sidebar.vue +137 -0
- package/hono/src/resources/src/layouts/Layout/index.vue +87 -0
- package/hono/src/resources/src/main.ts +26 -0
- package/hono/src/resources/src/pages/auth/forgetPassword.vue +82 -0
- package/hono/src/resources/src/pages/auth/login.vue +99 -0
- package/hono/src/resources/src/pages/auth/register.vue +133 -0
- package/hono/src/resources/src/pages/auth/resetPassword.vue +118 -0
- package/hono/src/resources/src/pages/auth/verifyEmail.vue +68 -0
- package/hono/src/resources/src/pages/dashboard/index.vue +66 -0
- package/hono/src/resources/src/plugins/axios.ts +31 -0
- package/hono/src/resources/src/plugins/browserDetect.ts +55 -0
- package/hono/src/resources/src/plugins/dialog.ts +216 -0
- package/hono/src/resources/src/plugins/gum.ts +367 -0
- package/hono/src/resources/src/plugins/pulse.ts +147 -0
- package/hono/src/resources/src/plugins/routeProgress.ts +87 -0
- package/hono/src/resources/src/router/index.ts +85 -0
- package/hono/src/resources/src/stores/admin-ui.ts +148 -0
- package/hono/src/resources/src/stores/auth.ts +164 -0
- package/hono/src/resources/tsconfig.json +19 -0
- package/hono/src/resources/vite.config.ts +46 -0
- package/hono/src/storage/app/private/.gitkeep +0 -0
- package/hono/src/storage/app/public/.gitkeep +0 -0
- package/hono/src/storage/app/tmp/generated/.gitkeep +0 -0
- package/hono/src/storage/database/nexwire.sqlite +0 -0
- package/hono/src/storage/logs/.gitkeep +0 -0
- package/hono/src/storage/tmp/.gitkeep +0 -0
- package/hono/src/storage/trash/modules/.gitkeep +0 -0
- package/hono/src/types/global.d.ts +26 -0
- package/hono/tsconfig.json +20 -0
- package/hono/vitest.config.ts +23 -0
- package/package.json +238 -0
- package/src/index.js +204 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="skeleton card border">
|
|
3
|
+
<div class="card-header border-bottom-0 pb-0 px-2 px-sm-3">
|
|
4
|
+
<div class="row align-items-center">
|
|
5
|
+
<div class="col-12 col-sm-6 col-lg-3 col-xl-3 mb-2 mb-lg-0 d-flex">
|
|
6
|
+
<div class="py-2 rounded-1 border bg-custom ps-3 me-2"></div>
|
|
7
|
+
<div class="form-control py-2 bg-custom"></div>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="col-12 col-sm-6 col-lg-4 col-xl-5 mb-2 mb-lg-0">
|
|
10
|
+
<slot name="extra-option"></slot>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="col-12 col-lg-5 col-xl-4">
|
|
13
|
+
<div class="row gx-1">
|
|
14
|
+
<div class="col-2 col-sm-4 col-md-6 col-lg-2 text-start text-lg-end">
|
|
15
|
+
<span class="form-control py-2 bg-custom"></span>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="mb-2 mb-sm-0 text-start col-6 col-sm-6 col-md-4 col-lg-7">
|
|
18
|
+
<span class="form-control py-2 bg-custom"></span>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="col-4 col-sm-2 col-md-2 col-lg-3 text-end">
|
|
21
|
+
<span class="bg-custom form-control py-2"></span>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="card-body py-3 px-2 px-sm-3">
|
|
28
|
+
<div class="table-responsive rounded-1">
|
|
29
|
+
<table class="table table-bordered table-striped table-sm align-middle m-0">
|
|
30
|
+
<thead>
|
|
31
|
+
<tr>
|
|
32
|
+
<th v-for="dt in colCount" :key="`h-${dt}`" class="bg-custom py-2"></th>
|
|
33
|
+
</tr>
|
|
34
|
+
</thead>
|
|
35
|
+
<tbody>
|
|
36
|
+
<tr v-for="r in rowCount" :key="`r-${r}`">
|
|
37
|
+
<td v-for="c in colCount" :key="`c-${r}-${c}`" class="bg-custom py-2"></td>
|
|
38
|
+
</tr>
|
|
39
|
+
</tbody>
|
|
40
|
+
</table>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="card-footer border-top-0 pt-0 px-2 px-sm-3">
|
|
44
|
+
<div class="row align-items-center">
|
|
45
|
+
<div class="col-12 col-md-5 mb-2 mb-md-0"></div>
|
|
46
|
+
<div class="col-12 col-md-7 text-center text-md-end">
|
|
47
|
+
<span class="form-control bg-custom py-2"></span>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
import { computed, useAttrs } from "vue";
|
|
56
|
+
|
|
57
|
+
defineOptions({ inheritAttrs: false });
|
|
58
|
+
|
|
59
|
+
const $attrs = useAttrs();
|
|
60
|
+
const colCount = computed(() => Number($attrs.col ?? 1));
|
|
61
|
+
const rowCount = computed(() => Number($attrs.row ?? 1));
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style lang="scss" scoped>
|
|
65
|
+
table,
|
|
66
|
+
tr,
|
|
67
|
+
th,
|
|
68
|
+
td {
|
|
69
|
+
border-color: #cccccc;
|
|
70
|
+
animation: anim 3s infinite;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.bg-custom {
|
|
74
|
+
animation: anim 3s infinite;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@keyframes anim {
|
|
78
|
+
0% {
|
|
79
|
+
background-color: #efefef;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
25% {
|
|
83
|
+
background-color: #f8f8f8;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
50% {
|
|
87
|
+
background-color: #efefef;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
75% {
|
|
91
|
+
background-color: #f8f8f8;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
100% {
|
|
95
|
+
background-color: #efefef;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="row">
|
|
3
|
+
<div class="col-12 col-md-6 mb-3 mb-md-0">
|
|
4
|
+
<div class="py-2 text-black-50 text-center text-md-start">
|
|
5
|
+
Showing {{ page.from }} to {{ page.to }} of {{ nFormatter(page.total) }} entries
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="col-12 col-md-6">
|
|
9
|
+
<nav :class="['datatable-pagination', `pagination-${variant}`]" aria-label="Page navigation">
|
|
10
|
+
<ul class="pagination justify-content-center justify-content-md-end">
|
|
11
|
+
<!-- First -->
|
|
12
|
+
<li :class="['page-item', { disabled: noPreviousPage }]">
|
|
13
|
+
<button type="button" class="page-link" :aria-disabled="noPreviousPage ? 'true' : 'false'"
|
|
14
|
+
:tabindex="noPreviousPage ? -1 : 0" @click.prevent="!noPreviousPage && loadPage(1)">
|
|
15
|
+
<i class="bi bi-chevron-double-left"></i>
|
|
16
|
+
</button>
|
|
17
|
+
</li>
|
|
18
|
+
|
|
19
|
+
<!-- Prev -->
|
|
20
|
+
<li :class="['page-item', { disabled: noPreviousPage }]">
|
|
21
|
+
<button type="button" class="page-link" :aria-disabled="noPreviousPage ? 'true' : 'false'"
|
|
22
|
+
:tabindex="noPreviousPage ? -1 : 0"
|
|
23
|
+
@click.prevent="!noPreviousPage && loadPage(props.data.current_page - 1)">
|
|
24
|
+
<i class="bi bi-chevron-left"></i>
|
|
25
|
+
</button>
|
|
26
|
+
</li>
|
|
27
|
+
|
|
28
|
+
<li class="page-item">
|
|
29
|
+
<div class="input-group input-group-sm">
|
|
30
|
+
<Input v-model="page.page" type="text" category="number" topclass="m-0" class="text-center"
|
|
31
|
+
style="width: 100px" @keyup.enter="loadPage(page.page)" />
|
|
32
|
+
</div>
|
|
33
|
+
</li>
|
|
34
|
+
|
|
35
|
+
<li class="page-item">
|
|
36
|
+
<span class="page-link text-nowrap"> of {{ nFormatter(props.data.last_page) }} </span>
|
|
37
|
+
</li>
|
|
38
|
+
|
|
39
|
+
<!-- Next -->
|
|
40
|
+
<li :class="['page-item', { disabled: noNextPage }]">
|
|
41
|
+
<button type="button" class="page-link" :aria-disabled="noNextPage ? 'true' : 'false'"
|
|
42
|
+
:tabindex="noNextPage ? -1 : 0" @click.prevent="!noNextPage && loadPage(props.data.current_page + 1)">
|
|
43
|
+
<i class="bi bi-chevron-right"></i>
|
|
44
|
+
</button>
|
|
45
|
+
</li>
|
|
46
|
+
|
|
47
|
+
<!-- Last -->
|
|
48
|
+
<li :class="['page-item', { disabled: noNextPage }]">
|
|
49
|
+
<button type="button" class="page-link" :aria-disabled="noNextPage ? 'true' : 'false'"
|
|
50
|
+
:tabindex="noNextPage ? -1 : 0" @click.prevent="!noNextPage && loadPage(props.data.last_page)">
|
|
51
|
+
<i class="bi bi-chevron-double-right"></i>
|
|
52
|
+
</button>
|
|
53
|
+
</li>
|
|
54
|
+
</ul>
|
|
55
|
+
</nav>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script setup lang="ts">
|
|
61
|
+
import { computed, reactive, watchEffect } from "vue";
|
|
62
|
+
import { useRoute } from "vue-router";
|
|
63
|
+
import Input from "@/components/Input.vue";
|
|
64
|
+
import { formatCompactNumber } from "@/helpers/nformatter";
|
|
65
|
+
import { useGum } from "@/plugins/gum";
|
|
66
|
+
|
|
67
|
+
interface PaginationData {
|
|
68
|
+
current_page: number;
|
|
69
|
+
last_page: number;
|
|
70
|
+
per_page: number;
|
|
71
|
+
total: number;
|
|
72
|
+
path: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface PaginationProps {
|
|
76
|
+
data: PaginationData;
|
|
77
|
+
selectedoption?: string | number;
|
|
78
|
+
search?: string;
|
|
79
|
+
variant?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const props = withDefaults(defineProps<PaginationProps>(), {
|
|
83
|
+
search: "",
|
|
84
|
+
variant: "dark"
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const gum = useGum();
|
|
88
|
+
const route = useRoute();
|
|
89
|
+
|
|
90
|
+
const page = reactive({ page: 1, from: 0, to: 0, total: 0 });
|
|
91
|
+
|
|
92
|
+
const noPreviousPage = computed(() => props.data.current_page - 1 <= 0);
|
|
93
|
+
const noNextPage = computed(() => props.data.current_page + 1 > props.data.last_page);
|
|
94
|
+
|
|
95
|
+
const loadPage = (pageNo: string | number) => {
|
|
96
|
+
let p = parseInt(String(pageNo), 10);
|
|
97
|
+
|
|
98
|
+
// fallback if NaN
|
|
99
|
+
if (Number.isNaN(p)) p = props.data.current_page;
|
|
100
|
+
|
|
101
|
+
const last = Number(props.data.last_page) || 1;
|
|
102
|
+
|
|
103
|
+
// clamp between 1 and last
|
|
104
|
+
if (p < 1) p = 1;
|
|
105
|
+
if (p > last) p = last;
|
|
106
|
+
|
|
107
|
+
return gum.get(props.data.path, {
|
|
108
|
+
query: { page: p, size: props.selectedoption, search: props.search },
|
|
109
|
+
routePath: route.path,
|
|
110
|
+
preserveState: true,
|
|
111
|
+
preserveScroll: true,
|
|
112
|
+
skipFetch: true
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const nFormatter = formatCompactNumber;
|
|
117
|
+
|
|
118
|
+
watchEffect(() => {
|
|
119
|
+
// "Showing {$from} to {$to} of {$total} entries"
|
|
120
|
+
page.page = props.data.current_page;
|
|
121
|
+
page.from = (props.data.current_page - 1) * props.data.per_page + 1;
|
|
122
|
+
page.to = Math.min(props.data.current_page * props.data.per_page, props.data.total);
|
|
123
|
+
page.total = props.data.total;
|
|
124
|
+
});
|
|
125
|
+
</script>
|
|
126
|
+
|
|
127
|
+
<style lang="scss" scoped>
|
|
128
|
+
ul.pagination {
|
|
129
|
+
margin: 0;
|
|
130
|
+
|
|
131
|
+
:deep(.page-item.disabled .page-link),
|
|
132
|
+
:deep(.page-link:disabled),
|
|
133
|
+
:deep(.page-link[aria-disabled="true"]) {
|
|
134
|
+
pointer-events: none;
|
|
135
|
+
cursor: not-allowed;
|
|
136
|
+
opacity: 0.5;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.page-link {
|
|
140
|
+
border-radius: 5px !important;
|
|
141
|
+
margin-left: 0;
|
|
142
|
+
border-color: #cdcdcd !important;
|
|
143
|
+
color: inherit;
|
|
144
|
+
box-shadow: none;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
</style>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="d-flex align-items-center justify-content-center justify-content-md-start mb-2 mb-md-0" :class="{ 'd-none': !props.isOptions }">
|
|
3
|
+
Show
|
|
4
|
+
<select
|
|
5
|
+
v-model="selectedoption"
|
|
6
|
+
class="form-select shadow-none w-auto mx-2"
|
|
7
|
+
@change="selectOption">
|
|
8
|
+
<option v-for="(val, i) in props.option" :key="i" :value="val">{{ val }}</option>
|
|
9
|
+
</select>
|
|
10
|
+
entries
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
import { ref, watch } from "vue";
|
|
16
|
+
import { useRoute } from "vue-router";
|
|
17
|
+
import { useGum } from "@/plugins/gum";
|
|
18
|
+
|
|
19
|
+
interface DataPage {
|
|
20
|
+
path: string;
|
|
21
|
+
current_page: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface SelectOptionProps {
|
|
25
|
+
data: DataPage;
|
|
26
|
+
search?: string;
|
|
27
|
+
isOptions?: boolean;
|
|
28
|
+
option?: Array<string | number>;
|
|
29
|
+
selectedoption?: string | number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const props = withDefaults(defineProps<SelectOptionProps>(), {
|
|
33
|
+
search: "",
|
|
34
|
+
isOptions: true,
|
|
35
|
+
option: () => []
|
|
36
|
+
});
|
|
37
|
+
const gum = useGum();
|
|
38
|
+
const route = useRoute();
|
|
39
|
+
|
|
40
|
+
// select option and pass SelectOption component
|
|
41
|
+
const selectedoption = ref<string | number | undefined>(props.selectedoption);
|
|
42
|
+
|
|
43
|
+
watch(
|
|
44
|
+
() => props.selectedoption,
|
|
45
|
+
(value) => {
|
|
46
|
+
selectedoption.value = value;
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const selectOption = (e: Event) => {
|
|
51
|
+
const target = e.target as HTMLSelectElement;
|
|
52
|
+
selectedoption.value = target.value;
|
|
53
|
+
|
|
54
|
+
return gum.get(props.data.path, {
|
|
55
|
+
query: { page: props.data.current_page, size: selectedoption.value, search: props.search },
|
|
56
|
+
routePath: route.path,
|
|
57
|
+
preserveState: true,
|
|
58
|
+
preserveScroll: true,
|
|
59
|
+
skipFetch: true
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="card border">
|
|
3
|
+
<div class="card-header" :class="{ 'd-none': !(props.removable || props.searchable || props.optionable) }">
|
|
4
|
+
<div class="row align-items-center gx-1">
|
|
5
|
+
<div class="col-12 col-md-3">
|
|
6
|
+
<SelectOption :is-options="props.optionable" :option="props.option" :data="dataForOption"
|
|
7
|
+
:selectedoption="selectedoption" :search="searchdata" />
|
|
8
|
+
</div>
|
|
9
|
+
<div class="col-12 col-md-9">
|
|
10
|
+
<slot name="extra-tools"></slot>
|
|
11
|
+
<div class="d-flex align-items-center justify-content-center justify-content-md-end">
|
|
12
|
+
<div v-if="checked.checkcolumn.length > 0" class="me-1" :class="{ 'd-none': !props.removable }">
|
|
13
|
+
<Button type="button" class="btn btn-outline-danger" @click.prevent="remove">
|
|
14
|
+
<i class="bi bi-trash"></i>
|
|
15
|
+
</Button>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="d-flex align-items-center" :class="{ 'd-none': !props.searchable }">
|
|
18
|
+
<Button class="btn btn-outline-secondary rounded-0 rounded-start" type="button" @click="searchMe">
|
|
19
|
+
<i class="bi bi-search"></i>
|
|
20
|
+
</Button>
|
|
21
|
+
<Input v-model="searchdata" type="text" class="w-auto rounded-0 rounded-end" topclass="mb-0"
|
|
22
|
+
placeholder="Search..." @keyup.enter="searchMe" @keyup.delete="searchMe" />
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="card-body">
|
|
29
|
+
<slot name="extra"></slot>
|
|
30
|
+
<div class="table-responsive">
|
|
31
|
+
<table
|
|
32
|
+
class="table table-bordered table-striped border-custom table-sm align-middle m-0 datatable no-shrink-table">
|
|
33
|
+
<slot name="customhead"></slot>
|
|
34
|
+
<thead :class="{ 'd-none': slots.customhead }">
|
|
35
|
+
<tr>
|
|
36
|
+
<th class="align-middle" :class="{ 'd-none': !props.removable || !props.data.current_page }">
|
|
37
|
+
<Checkbox v-model="checked.check" topclass="ms-2" :value="checked.check" :disabled="props.disabled"
|
|
38
|
+
@click="checkAll" />
|
|
39
|
+
</th>
|
|
40
|
+
<th class="text-center align-middle" :class="{ 'd-none': !props.countable }">#</th>
|
|
41
|
+
<slot name="thead"></slot>
|
|
42
|
+
</tr>
|
|
43
|
+
</thead>
|
|
44
|
+
|
|
45
|
+
<slot name="custombody"></slot>
|
|
46
|
+
<tbody :class="{ 'd-none': slots.custombody }">
|
|
47
|
+
<tr v-for="(dt, i) in tableRows" :key="`${dt.id}-${i}`">
|
|
48
|
+
<td class="align-middle" :class="{ 'd-none': !props.removable || !props.data.current_page }">
|
|
49
|
+
<Checkbox v-model="checked.checkcolumn" topclass="ms-2" :value="dt.id" :disabled="props.disabled"
|
|
50
|
+
@change="updateChecked" />
|
|
51
|
+
</td>
|
|
52
|
+
<td class="text-center align-middle" :class="{ 'd-none': !props.countable }">
|
|
53
|
+
{{
|
|
54
|
+
props.data.current_page
|
|
55
|
+
? props.data.per_page * (props.data.current_page - 1) + (i + 1)
|
|
56
|
+
: i + 1
|
|
57
|
+
}}
|
|
58
|
+
</td>
|
|
59
|
+
<slot name="tbody" :td="dt"></slot>
|
|
60
|
+
</tr>
|
|
61
|
+
</tbody>
|
|
62
|
+
</table>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="card-footer" :class="{ 'd-none': props.data.total <= props.data.data?.length }">
|
|
66
|
+
<Pagination :data="props.data" :selectedoption="selectedoption" :search="searchdata" />
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script setup lang="ts">
|
|
72
|
+
import { debounce } from "lodash-es";
|
|
73
|
+
import { computed, reactive, ref, useSlots, watchEffect } from "vue";
|
|
74
|
+
import { useRoute } from "vue-router";
|
|
75
|
+
import Button from "@/components/Button.vue";
|
|
76
|
+
import Checkbox from "@/components/Checkbox.vue";
|
|
77
|
+
import Input from "@/components/Input.vue";
|
|
78
|
+
import { useGum } from "@/plugins/gum";
|
|
79
|
+
import Pagination from "./Pagination.vue";
|
|
80
|
+
import SelectOption from "./SelectOpption.vue";
|
|
81
|
+
|
|
82
|
+
interface DataRow {
|
|
83
|
+
id: string | number;
|
|
84
|
+
[key: string]: any;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface DataPage {
|
|
88
|
+
path: string;
|
|
89
|
+
current_page: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface DataTableProps {
|
|
93
|
+
data: any;
|
|
94
|
+
search?: string;
|
|
95
|
+
loop?: DataRow[] | false;
|
|
96
|
+
option?: Array<string | number>;
|
|
97
|
+
removable?: boolean;
|
|
98
|
+
countable?: boolean;
|
|
99
|
+
searchable?: boolean;
|
|
100
|
+
optionable?: boolean;
|
|
101
|
+
disabled?: boolean;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const props = withDefaults(defineProps<DataTableProps>(), {
|
|
105
|
+
search: "",
|
|
106
|
+
option: () => [],
|
|
107
|
+
removable: true,
|
|
108
|
+
countable: true,
|
|
109
|
+
searchable: true,
|
|
110
|
+
optionable: true,
|
|
111
|
+
disabled: false
|
|
112
|
+
});
|
|
113
|
+
const gum = useGum();
|
|
114
|
+
const route = useRoute();
|
|
115
|
+
|
|
116
|
+
const slots = useSlots();
|
|
117
|
+
|
|
118
|
+
const emit = defineEmits<(event: "remove", value: Array<string | number>) => void>();
|
|
119
|
+
|
|
120
|
+
// checkbox select
|
|
121
|
+
let checked = reactive<{ check: boolean; checkcolumn: Array<string | number>; }>({
|
|
122
|
+
check: false,
|
|
123
|
+
checkcolumn: []
|
|
124
|
+
});
|
|
125
|
+
const checkAll = () => {
|
|
126
|
+
if (!checked.check) {
|
|
127
|
+
props.data.data.forEach((dt: DataRow) => {
|
|
128
|
+
if (!checked.checkcolumn.includes(dt.id)) {
|
|
129
|
+
checked.checkcolumn.push(dt.id);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
checked.checkcolumn = [];
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const updateChecked = () => (checked.checkcolumn.length === props.data.data.length ? (checked.check = true) : (checked.check = false));
|
|
137
|
+
|
|
138
|
+
// remove from parent
|
|
139
|
+
const remove = () => {
|
|
140
|
+
emit("remove", checked.checkcolumn);
|
|
141
|
+
checked.check = false;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// for change data size show
|
|
145
|
+
const selectedoption = ref<string | number | undefined>(undefined);
|
|
146
|
+
const dataForOption = computed<DataPage>(() => ({
|
|
147
|
+
path: props.data.path,
|
|
148
|
+
current_page: props.data.current_page
|
|
149
|
+
}));
|
|
150
|
+
const tableRows = computed<DataRow[]>(() => (props.loop ? props.loop : props.data.data));
|
|
151
|
+
|
|
152
|
+
// search data
|
|
153
|
+
const searchdata = ref(props.search || "");
|
|
154
|
+
const searchMe = debounce(() => {
|
|
155
|
+
const isSearching = !!searchdata.value && searchdata.value.trim() !== "";
|
|
156
|
+
gum.get(props.data.path, {
|
|
157
|
+
query: {
|
|
158
|
+
page: isSearching ? 1 : props.data.current_page,
|
|
159
|
+
size: selectedoption.value,
|
|
160
|
+
search: searchdata.value
|
|
161
|
+
},
|
|
162
|
+
routePath: route.path,
|
|
163
|
+
preserveState: true,
|
|
164
|
+
preserveScroll: true,
|
|
165
|
+
skipFetch: true
|
|
166
|
+
});
|
|
167
|
+
}, 500);
|
|
168
|
+
|
|
169
|
+
// watch instantce
|
|
170
|
+
watchEffect(() => {
|
|
171
|
+
selectedoption.value = props.option.find((x) => Number(x) === Number(props.data.per_page));
|
|
172
|
+
searchdata.value = props.search || "";
|
|
173
|
+
});
|
|
174
|
+
</script>
|
|
175
|
+
|
|
176
|
+
<style lang="scss" scoped>
|
|
177
|
+
.border-custom {
|
|
178
|
+
border-color: #cccccc !important;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.no-shrink-table th,
|
|
182
|
+
.no-shrink-table td {
|
|
183
|
+
white-space: nowrap;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* By default (large screens and up) do not force a min-width:
|
|
187
|
+
allow table to size normally so no horizontal scrollbar on large screens */
|
|
188
|
+
@media (min-width: 992px) {
|
|
189
|
+
.no-shrink-table {
|
|
190
|
+
min-width: 0;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@media (max-width: 991.98px) {
|
|
195
|
+
.no-shrink-table {
|
|
196
|
+
min-width: 1000px;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { computed, type Ref, readonly, ref } from "vue";
|
|
2
|
+
|
|
3
|
+
type UnknownRecord = Record<string, unknown>;
|
|
4
|
+
|
|
5
|
+
export type RoleLike = {
|
|
6
|
+
id?: string | number;
|
|
7
|
+
name?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
slug?: string;
|
|
10
|
+
} & UnknownRecord;
|
|
11
|
+
|
|
12
|
+
export type AuthUser = UnknownRecord & {
|
|
13
|
+
id?: string | number;
|
|
14
|
+
name?: string;
|
|
15
|
+
role?: RoleLike | null;
|
|
16
|
+
roles?: RoleLike[] | null;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const userRef: Ref<AuthUser | null> = ref(null);
|
|
20
|
+
|
|
21
|
+
export function setUser(user: AuthUser | null) {
|
|
22
|
+
userRef.value = user;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function clearUser() {
|
|
26
|
+
userRef.value = null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function useAuth() {
|
|
30
|
+
return {
|
|
31
|
+
user: readonly(userRef),
|
|
32
|
+
isAuthenticated: computed(() => !!userRef.value),
|
|
33
|
+
setUser,
|
|
34
|
+
clearUser
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const authUser = computed<AuthUser>(() => userRef.value ?? {});
|
|
39
|
+
|
|
40
|
+
export function hasRole(...wanted: string[]): boolean {
|
|
41
|
+
const subject = userRef.value;
|
|
42
|
+
if (!subject) return false;
|
|
43
|
+
|
|
44
|
+
const current = (subject.roles ?? (subject.role ? [subject.role] : []))
|
|
45
|
+
.map((item) => (item.name || item.title || item.slug || "").toLowerCase().trim())
|
|
46
|
+
.filter(Boolean);
|
|
47
|
+
|
|
48
|
+
if (!wanted.length) return current.length > 0;
|
|
49
|
+
|
|
50
|
+
const expected = wanted.map((item) => item.toLowerCase().trim()).filter(Boolean);
|
|
51
|
+
return current.some((item) => expected.includes(item));
|
|
52
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const compactFormatter = new Intl.NumberFormat("en", {
|
|
2
|
+
notation: "compact",
|
|
3
|
+
maximumFractionDigits: 1
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
export function formatCompactNumber(value: number): string | number {
|
|
7
|
+
if (!Number.isFinite(value)) return String(value);
|
|
8
|
+
if (Math.abs(value) < 1000) return value;
|
|
9
|
+
return compactFormatter.format(value).replace(/\s/g, "");
|
|
10
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { DateTime } from "luxon";
|
|
3
|
+
|
|
4
|
+
declare const route: (name: string, params?: Record<string, unknown>) => string;
|
|
5
|
+
|
|
6
|
+
export function inArray<T>(needle: T, haystack: T[], strict = false): boolean {
|
|
7
|
+
if (!Array.isArray(haystack)) {
|
|
8
|
+
throw new TypeError("haystack must be an array");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (strict) {
|
|
12
|
+
return haystack.includes(needle);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
for (const value of haystack) {
|
|
16
|
+
if (value === needle) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (typeof value === "number" && typeof needle === "number" && Number.isNaN(value) && Number.isNaN(needle)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function empty(v: unknown): boolean {
|
|
29
|
+
if (v == null) return true;
|
|
30
|
+
if (typeof v === "boolean") return v === false;
|
|
31
|
+
if (typeof v === "number") return v === 0 || Number.isNaN(v);
|
|
32
|
+
if (typeof v === "bigint") return v === 0n;
|
|
33
|
+
if (typeof v === "string") return v === "" || v === "0";
|
|
34
|
+
if (Array.isArray(v)) return v.length === 0;
|
|
35
|
+
if (v instanceof Map || v instanceof Set) return v.size === 0;
|
|
36
|
+
if (typeof v === "object") return Object.keys(v).length === 0;
|
|
37
|
+
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function downloadFile(url: string, fileName: string): Promise<void> {
|
|
42
|
+
try {
|
|
43
|
+
const isDirectUrl = url.startsWith("/") || url.startsWith("http://") || url.startsWith("https://");
|
|
44
|
+
const targetUrl = isDirectUrl ? url : route(url, { file_name: fileName });
|
|
45
|
+
const res = await axios.get(targetUrl, { responseType: "blob" });
|
|
46
|
+
if (res.data) {
|
|
47
|
+
const objectUrl = window.URL.createObjectURL(new Blob([res.data]));
|
|
48
|
+
const link = document.createElement("a");
|
|
49
|
+
link.href = objectUrl;
|
|
50
|
+
link.setAttribute("download", fileName);
|
|
51
|
+
document.body.appendChild(link);
|
|
52
|
+
link.click();
|
|
53
|
+
link.remove();
|
|
54
|
+
window.URL.revokeObjectURL(objectUrl);
|
|
55
|
+
}
|
|
56
|
+
} catch (e) {
|
|
57
|
+
console.error("Export failed:", e);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function downloadExcel(url: string, fileName: string): Promise<void> {
|
|
62
|
+
await downloadFile(url, fileName);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function formatTaxPeriod(value: string): string {
|
|
66
|
+
if (!value) return "";
|
|
67
|
+
const date = DateTime.fromFormat(value, "yyyy-MM");
|
|
68
|
+
return date.isValid ? date.toFormat("MMM yyyy") : value;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function formatDate(value: string | null): string {
|
|
72
|
+
if (!value) return "";
|
|
73
|
+
const date = DateTime.fromISO(value);
|
|
74
|
+
return date.isValid ? date.toFormat("dd MMM yyyy") : value;
|
|
75
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<router-view />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { onBeforeUnmount, onMounted } from "vue";
|
|
7
|
+
import { useAdminUiStore } from "@/stores/admin-ui";
|
|
8
|
+
|
|
9
|
+
const ui = useAdminUiStore();
|
|
10
|
+
|
|
11
|
+
onMounted(() => {
|
|
12
|
+
ui.initTheme();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
onBeforeUnmount(() => {
|
|
16
|
+
ui.cleanupTheme();
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<style scoped></style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- footer start -->
|
|
3
|
+
<footer
|
|
4
|
+
class="d-flex flex-column flex-sm-row row-gap-2 align-items-center justify-content-center justify-content-sm-between py-3 fst-italic">
|
|
5
|
+
<div class="text-secondary">
|
|
6
|
+
© nexwire {{ startYear }} - {{ currentYear }} ❤️ created by
|
|
7
|
+
<a href="#" target="_blank" class="text-decoration-none">niYam</a>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="d-block">
|
|
10
|
+
<a href="#" target="_blank" class="text-decoration-none me-2">About</a>
|
|
11
|
+
<a href="#" target="_blank" class="text-decoration-none me-2">Support</a>
|
|
12
|
+
<a href="#" target="_blank" class="text-decoration-none me-2">Contact Us</a>
|
|
13
|
+
</div>
|
|
14
|
+
</footer>
|
|
15
|
+
<!-- footer end -->
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
const startYear: number = 2026;
|
|
20
|
+
const currentYear: number = new Date().getFullYear();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style scoped></style>
|