diff --git a/.eslintrc.js b/.eslintrc.js index e9a84a0..a0b479f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,20 +1,19 @@ module.exports = { root: true, env: { - node: true + node: true, + es2022: true, }, - 'extends': [ + extends: [ 'plugin:vue/vue3-essential', 'eslint:recommended', - '@vue/typescript/recommended' - + '@vue/typescript/recommended', ], - parserOptions: { - ecmaVersion: 2020 - }, rules: { // 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', // 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' - 'vue/no-mutating-props': 'off' - } + 'vue/no-mutating-props': 'off', + // '@typescript-eslint/no-explicit-any': 'off', + 'vue/multi-word-component-names': 'off' + }, } diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..f8dec5b --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,5 @@ +{ + "tabWidth": 2, + "semi": false, + "singleQuote": true +} diff --git a/README.md b/README.md index 9ff1f52..579ee97 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,30 @@ -# maptest +# BMA ระบบลงเวลาเข้า-ออกงาน ## Project setup + ``` npm install ``` ### Compiles and hot-reloads for development + ``` npm run dev ``` ### Compiles and minifies for production + ``` npm run build +npm run preview ``` -### Lints and fixes files +### Format and fixes files + ``` -npm run lint +npm run format ``` ### Customize configuration + See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/babel.config.js b/babel.config.js deleted file mode 100644 index e955840..0000000 --- a/babel.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - presets: [ - '@vue/cli-plugin-babel/preset' - ] -} diff --git a/cypress.config.ts b/cypress.config.ts new file mode 100644 index 0000000..4a22885 --- /dev/null +++ b/cypress.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from 'cypress' + +export default defineConfig({ + e2e: { + specPattern: 'cypress/e2e/**/*.{cy,spec}.{js,jsx,ts,tsx}', + baseUrl: 'http://localhost:4173', + }, +}) diff --git a/env.d.ts b/env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/env.d.ts @@ -0,0 +1 @@ +/// diff --git a/index.html b/index.html new file mode 100644 index 0000000..b9d284d --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + + BMA ระบบลงเวลาเข้า-ออกงาน + + +
+ + + diff --git a/package.json b/package.json index c7b8b27..b872917 100644 --- a/package.json +++ b/package.json @@ -3,39 +3,60 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "vue-cli-service serve", - "build": "vue-cli-service build", - "lint": "vue-cli-service lint" + "dev": "vite", + "build": "run-p type-check build-only", + "preview": "vite preview --port 3008", + "test:unit": "vitest --environment jsdom --root src/", + "test:e2e": "start-server-and-test preview :4173 'cypress run --e2e'", + "test:e2e:dev": "start-server-and-test 'vite dev --port 4173' :4173 'cypress open --e2e'", + "build-only": "vite build", + "type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false", + "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", + "format": "prettier . --write" }, "dependencies": { + "@fullcalendar/core": "^6.1.8", + "@fullcalendar/daygrid": "^6.1.8", + "@fullcalendar/interaction": "^6.1.8", + "@fullcalendar/list": "^6.1.8", + "@fullcalendar/timegrid": "^6.1.8", + "@fullcalendar/vue3": "^6.1.8", "@googlemaps/js-api-loader": "^1.16.2", - "@quasar/cli": "^2.3.0", - "@quasar/extras": "^1.0.0", - "@vuepic/vue-datepicker": "^7.2.1", - "core-js": "^3.8.3", + "@quasar/extras": "^1.15.8", + "@vuepic/vue-datepicker": "^5.2.1", "moment": "^2.29.4", - "pinia": "^2.1.7", - "quasar": "^2.0.0", + "pinia": "^2.1.4", + "quasar": "^2.11.1", "register-service-worker": "^1.7.2", - "vue": "^3.2.13", - "vue-router": "^4.0.3", + "simple-vue-camera": "^1.1.3", + "vite-plugin-pwa": "^0.16.7", + "vue": "^3.2.45", + "vue-router": "^4.1.6", "vue3-google-map": "^0.18.0" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", - "@vue/cli-plugin-babel": "~5.0.0", - "@vue/cli-plugin-eslint": "~5.0.0", - "@vue/cli-plugin-pwa": "~5.0.0", - "@vue/cli-plugin-router": "~5.0.0", - "@vue/cli-plugin-typescript": "~5.0.0", - "@vue/cli-service": "~5.0.0", - "@vue/eslint-config-typescript": "^9.1.0", - "eslint": "^8.53.0", - "eslint-plugin-prettier": "^5.0.1", - "sass": "1.32.12", - "sass-loader": "^12.0.0", - "typescript": "~4.5.5", - "vue-cli-plugin-quasar": "~5.0.2" + "@quasar/vite-plugin": "^1.3.0", + "@rushstack/eslint-patch": "^1.1.4", + "@types/jsdom": "^20.0.1", + "@types/node": "^18.11.12", + "@vitejs/plugin-vue": "^4.0.0", + "@vitejs/plugin-vue-jsx": "^3.0.0", + "@vue/eslint-config-prettier": "^7.0.0", + "@vue/eslint-config-typescript": "^11.0.0", + "@vue/test-utils": "^2.2.6", + "@vue/tsconfig": "^0.1.3", + "cypress": "^12.0.2", + "eslint": "^8.22.0", + "eslint-plugin-cypress": "^2.12.1", + "eslint-plugin-vue": "^9.3.0", + "jsdom": "^20.0.3", + "npm-run-all": "^4.1.5", + "prettier": "^2.7.1", + "sass": "^1.32.12", + "start-server-and-test": "^1.15.2", + "typescript": "~4.7.4", + "vite": "^4.0.0", + "vitest": "^0.25.6", + "vue-tsc": "^1.0.12" } } diff --git a/public/img/icons/android-chrome-192x192.png b/public/icons/android-chrome-192x192.png similarity index 100% rename from public/img/icons/android-chrome-192x192.png rename to public/icons/android-chrome-192x192.png diff --git a/public/img/icons/android-chrome-512x512.png b/public/icons/android-chrome-512x512.png similarity index 100% rename from public/img/icons/android-chrome-512x512.png rename to public/icons/android-chrome-512x512.png diff --git a/public/img/icons/android-chrome-maskable-192x192.png b/public/icons/android-chrome-maskable-192x192.png similarity index 100% rename from public/img/icons/android-chrome-maskable-192x192.png rename to public/icons/android-chrome-maskable-192x192.png diff --git a/public/img/icons/android-chrome-maskable-512x512.png b/public/icons/android-chrome-maskable-512x512.png similarity index 100% rename from public/img/icons/android-chrome-maskable-512x512.png rename to public/icons/android-chrome-maskable-512x512.png diff --git a/public/img/icons/android-launchericon-144-144.png b/public/icons/android-launchericon-144-144.png similarity index 100% rename from public/img/icons/android-launchericon-144-144.png rename to public/icons/android-launchericon-144-144.png diff --git a/public/img/icons/android-launchericon-48-48.png b/public/icons/android-launchericon-48-48.png similarity index 100% rename from public/img/icons/android-launchericon-48-48.png rename to public/icons/android-launchericon-48-48.png diff --git a/public/img/icons/android-launchericon-72-72.png b/public/icons/android-launchericon-72-72.png similarity index 100% rename from public/img/icons/android-launchericon-72-72.png rename to public/icons/android-launchericon-72-72.png diff --git a/public/img/icons/android-launchericon-96-96.png b/public/icons/android-launchericon-96-96.png similarity index 100% rename from public/img/icons/android-launchericon-96-96.png rename to public/icons/android-launchericon-96-96.png diff --git a/public/img/icons/apple-touch-icon-120x120.png b/public/icons/apple-touch-icon-120x120.png similarity index 100% rename from public/img/icons/apple-touch-icon-120x120.png rename to public/icons/apple-touch-icon-120x120.png diff --git a/public/img/icons/apple-touch-icon-152x152.png b/public/icons/apple-touch-icon-152x152.png similarity index 100% rename from public/img/icons/apple-touch-icon-152x152.png rename to public/icons/apple-touch-icon-152x152.png diff --git a/public/icons/apple-touch-icon-180x180.png b/public/icons/apple-touch-icon-180x180.png new file mode 100644 index 0000000..407a6e0 Binary files /dev/null and b/public/icons/apple-touch-icon-180x180.png differ diff --git a/public/img/icons/apple-touch-icon-60x60.png b/public/icons/apple-touch-icon-60x60.png similarity index 100% rename from public/img/icons/apple-touch-icon-60x60.png rename to public/icons/apple-touch-icon-60x60.png diff --git a/public/img/icons/apple-touch-icon-76x76.png b/public/icons/apple-touch-icon-76x76.png similarity index 100% rename from public/img/icons/apple-touch-icon-76x76.png rename to public/icons/apple-touch-icon-76x76.png diff --git a/public/img/icons/apple-touch-icon.png b/public/icons/apple-touch-icon.png similarity index 100% rename from public/img/icons/apple-touch-icon.png rename to public/icons/apple-touch-icon.png diff --git a/public/img/icons/favicon-16x16.png b/public/icons/favicon-16x16.png similarity index 100% rename from public/img/icons/favicon-16x16.png rename to public/icons/favicon-16x16.png diff --git a/public/img/icons/favicon-32x32.png b/public/icons/favicon-32x32.png similarity index 100% rename from public/img/icons/favicon-32x32.png rename to public/icons/favicon-32x32.png diff --git a/public/img/icons/msapplication-icon-144x144.png b/public/icons/msapplication-icon-144x144.png similarity index 100% rename from public/img/icons/msapplication-icon-144x144.png rename to public/icons/msapplication-icon-144x144.png diff --git a/public/img/icons/mstile-150x150.png b/public/icons/mstile-150x150.png similarity index 100% rename from public/img/icons/mstile-150x150.png rename to public/icons/mstile-150x150.png diff --git a/public/img/icons/safari-pinned-tab.svg b/public/icons/safari-pinned-tab.svg similarity index 100% rename from public/img/icons/safari-pinned-tab.svg rename to public/icons/safari-pinned-tab.svg diff --git a/public/img/icons/apple-touch-icon-180x180.png b/public/img/icons/apple-touch-icon-180x180.png deleted file mode 100644 index 404e192..0000000 Binary files a/public/img/icons/apple-touch-icon-180x180.png and /dev/null differ diff --git a/public/index.html b/public/index.html deleted file mode 100644 index c570a09..0000000 --- a/public/index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - <%= htmlWebpackPlugin.options.title %> - - - -
- -
- - - diff --git a/src/components/CustomDialog.vue b/src/components/CustomDialog.vue index fcedbed..4c5c29b 100644 --- a/src/components/CustomDialog.vue +++ b/src/components/CustomDialog.vue @@ -35,44 +35,43 @@ - - - + + + + diff --git a/src/components/HeaderPopup.vue b/src/components/HeaderPopup.vue index 0db45d4..98df5c6 100644 --- a/src/components/HeaderPopup.vue +++ b/src/components/HeaderPopup.vue @@ -1,35 +1,34 @@ - - - - + + + + diff --git a/src/components/MapCheckin.vue b/src/components/MapCheckin.vue index bff12c8..c505458 100644 --- a/src/components/MapCheckin.vue +++ b/src/components/MapCheckin.vue @@ -1,101 +1,101 @@ - - - - - + + + + + diff --git a/src/components/PopUp.vue b/src/components/PopUp.vue index b3c8a3e..d5bdc63 100644 --- a/src/components/PopUp.vue +++ b/src/components/PopUp.vue @@ -1,45 +1,45 @@ - - - - + + + + diff --git a/src/components/TableHistory.vue b/src/components/TableHistory.vue index 69733c1..a2e36d1 100644 --- a/src/components/TableHistory.vue +++ b/src/components/TableHistory.vue @@ -1,311 +1,311 @@ - - - - + + + + diff --git a/src/components/ToolBar.vue b/src/components/ToolBar.vue index 6c713ed..30d38c9 100644 --- a/src/components/ToolBar.vue +++ b/src/components/ToolBar.vue @@ -1,49 +1,49 @@ - - - - + + + + diff --git a/src/interface/index/Main.ts b/src/interface/index/Main.ts index 401821a..7fa0d3d 100644 --- a/src/interface/index/Main.ts +++ b/src/interface/index/Main.ts @@ -1,10 +1,10 @@ -interface DataOption { - id: string; - name: string; -} -interface FormRef { - date: object | null; - reason: object | null; - [key: string]: any; -} -export type { DataOption, FormRef }; +interface DataOption { + id: string + name: string +} +interface FormRef { + date: object | null + reason: object | null + [key: string]: any +} +export type { DataOption, FormRef } diff --git a/src/interface/response/checkin.ts b/src/interface/response/checkin.ts index 5745b88..edfebdb 100644 --- a/src/interface/response/checkin.ts +++ b/src/interface/response/checkin.ts @@ -1,7 +1,7 @@ -interface FormRef { - model: object | null; - useLocation: object | null; - [key: string]: any; -} - -export type { FormRef }; +interface FormRef { + model: object | null + useLocation: object | null + [key: string]: any +} + +export type { FormRef } diff --git a/src/main.ts b/src/main.ts index 6c599a5..16db08d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,29 +1,36 @@ -import { createApp } from "vue"; -import App from "./App.vue"; -import "./registerServiceWorker"; -import router from "./router"; -import { createPinia } from "pinia"; +import { createApp, defineAsyncComponent } from 'vue' +import App from './App.vue' +import './registerServiceWorker' +import router from './router' +import { createPinia } from 'pinia' -import { Quasar, Dialog, Notify, Loading } from "quasar"; -import '@quasar/extras/material-icons/material-icons.css'; -import './styles/quasar.sass'; -import quasarUserOptions from "./quasar-user-options"; -import VueDatePicker from "@vuepic/vue-datepicker"; -import "@vuepic/vue-datepicker/dist/main.css"; +import { Quasar, Dialog, Notify, Loading } from 'quasar' +import '@vuepic/vue-datepicker/dist/main.css' +import quasarUserOptions from './quasar-user-options' -const app = createApp(App); -const pinia = createPinia(); +import 'quasar/src/css/index.sass' +import th from "quasar/lang/th"; + + +const app = createApp(App) +const pinia = createPinia() + +app.use(router) +app.use(pinia) -app.use(router); -app.use(Quasar, quasarUserOptions); app.use(Quasar, { + ...quasarUserOptions, plugins: { Notify, Dialog, Loading, }, -}); -app.use(pinia); -app.component("VueDatePicker", VueDatePicker); + lang: th, +}) -app.mount("#app"); +app.component( + 'datepicker', + defineAsyncComponent(() => import('@vuepic/vue-datepicker')) +) + +app.mount('#app') diff --git a/src/quasar-user-options.ts b/src/quasar-user-options.ts index 5cc6de3..56dff8b 100644 --- a/src/quasar-user-options.ts +++ b/src/quasar-user-options.ts @@ -1,10 +1,11 @@ -import "./styles/quasar.sass"; -// import "quasar/dist/quasar.css"; -import "@quasar/extras/material-icons/material-icons.css"; -import { Dialog, Notify } from "quasar"; +// import "./styles/quasar.scss" +import '@quasar/extras/material-icons/material-icons.css' +import '@quasar/extras/material-icons-outlined/material-icons-outlined.css' +import '@quasar/extras/fontawesome-v5/fontawesome-v5.css' +import '@quasar/extras/mdi-v4/mdi-v4.css' // To be used on app.use(Quasar, { ... }) export default { config: {}, - plugins: { Dialog, Notify }, -}; + plugins: {}, +} diff --git a/src/registerServiceWorker.ts b/src/registerServiceWorker.ts index 76cede0..adbd55d 100644 --- a/src/registerServiceWorker.ts +++ b/src/registerServiceWorker.ts @@ -3,30 +3,32 @@ import { register } from 'register-service-worker' if (process.env.NODE_ENV === 'production') { - register(`${process.env.BASE_URL}service-worker.js`, { - ready () { + register('registerSW.js', { + ready() { console.log( 'App is being served from cache by a service worker.\n' + - 'For more details, visit https://goo.gl/AFskqB' + 'For more details, visit https://goo.gl/AFskqB' ) }, - registered () { + registered() { console.log('Service worker has been registered.') }, - cached () { + cached() { console.log('Content has been cached for offline use.') }, - updatefound () { + updatefound() { console.log('New content is downloading.') }, - updated () { + updated() { console.log('New content is available; please refresh.') }, - offline () { - console.log('No internet connection found. App is running in offline mode.') + offline() { + console.log( + 'No internet connection found. App is running in offline mode.' + ) }, - error (error) { + error(error) { console.error('Error during service worker registration:', error) - } + }, }) } diff --git a/src/router/index.ts b/src/router/index.ts index 8a59ac2..9a565ec 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,32 +1,42 @@ -import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router"; -import HomeView from "../views/HomeView.vue"; -import HistoryView from "@/views/HistoryView.vue"; - -const routes: Array = [ - { - path: "/", - name: "home", - component: HomeView, - }, - { - path: "/about", - name: "about", - // route level code-splitting - // this generates a separate chunk (about.[hash].js) for this route - // which is lazy-loaded when the route is visited. - component: () => - import(/* webpackChunkName: "about" */ "../views/AboutView.vue"), - }, - { - path: "/history", - name: "history", - component: HistoryView, - }, -]; +import { createRouter, createWebHistory } from 'vue-router' +import HomeView from '@/views/HomeView.vue' const router = createRouter({ - history: createWebHistory(process.env.BASE_URL), - routes, -}); + history: createWebHistory(import.meta.env.BASE_URL), + routes: [ + { + path: '/', + name: 'home', + component: HomeView, + }, + { + path: '/about', + name: 'about', + // route level code-splitting + // this generates a separate chunk (about.[hash].js) for this route + // which is lazy-loaded when the route is visited. + component: () => import('@/views/AboutView.vue'), + }, + { + path: '/history', + name: 'history', + component: () => import('@/views/HistoryView.vue'), + }, + // { + // path: '/camera', + // name: 'camera', + // component: () => import('@/views/SampleCamera.vue'), + // }, + /** + * 404 Not Found + * ref: https://router.vuejs.org/guide/essentials/dynamic-matching.html#catch-all-404-not-found-route + */ + { + path: '/:pathMatch(.*)*', + name: 'NotFound', + component: () => import('@/views/ErrorNotFoundPage.vue'), + }, + ], +}) -export default router; +export default router diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts index df9f4ba..01b57df 100644 --- a/src/shims-vue.d.ts +++ b/src/shims-vue.d.ts @@ -1 +1 @@ -declare module '*.vue'; +declare module '*.vue' diff --git a/src/stores/chekin.ts b/src/stores/chekin.ts index 10a083e..8506ab1 100644 --- a/src/stores/chekin.ts +++ b/src/stores/chekin.ts @@ -1,61 +1,61 @@ -import { defineStore } from "pinia"; -import { ref } from "vue"; - -export const useChekIn = defineStore("checkin", () => { - const rows = ref(); - - function fetchHistoryList(data: any) { - console.log(data); - const datalist = data.map((e: any) => ({ - no: e.no, - date: e.date, - in: e.in, - loIn: e.loIn, - out: e.out, - loOut: e.loOut, - status: e.status, - Morningstatus: convertStatus(e.Morningstatus), - AfternoonStatus: convertStatus(e.AfternoonStatus), - statusEdit: e.statusEdit, - statusEditName: convertStatusEdit(e.statusEdit), - })); - rows.value = datalist; - } - - function convertStatus(status: string) { - switch (status) { - case "1": - return "ขาดราชการ"; - case "2": - return "ปกติ"; - case "3": - return "สาย"; - default: - return ""; - } - } - function convertStatusEdit(val: string) { - switch (val) { - case "edit": - return "ขอแก้ไข"; - case "wait": - return "รออนุมัติ"; - case "approve": - return "อนุมัติ"; - } - } - function classColorStatus(val: string) { - switch (val) { - case "wait": - return "orange"; - case "approve": - return "green"; - } - } - - return { - rows, - fetchHistoryList, - classColorStatus, - }; -}); +import { defineStore } from 'pinia' +import { ref } from 'vue' + +export const useChekIn = defineStore('checkin', () => { + const rows = ref() + + function fetchHistoryList(data: any) { + console.log(data) + const datalist = data.map((e: any) => ({ + no: e.no, + date: e.date, + in: e.in, + loIn: e.loIn, + out: e.out, + loOut: e.loOut, + status: e.status, + Morningstatus: convertStatus(e.Morningstatus), + AfternoonStatus: convertStatus(e.AfternoonStatus), + statusEdit: e.statusEdit, + statusEditName: convertStatusEdit(e.statusEdit), + })) + rows.value = datalist + } + + function convertStatus(status: string) { + switch (status) { + case '1': + return 'ขาดราชการ' + case '2': + return 'ปกติ' + case '3': + return 'สาย' + default: + return '' + } + } + function convertStatusEdit(val: string) { + switch (val) { + case 'edit': + return 'ขอแก้ไข' + case 'wait': + return 'รออนุมัติ' + case 'approve': + return 'อนุมัติ' + } + } + function classColorStatus(val: string) { + switch (val) { + case 'wait': + return 'orange' + case 'approve': + return 'green' + } + } + + return { + rows, + fetchHistoryList, + classColorStatus, + } +}) diff --git a/src/stores/mixin.ts b/src/stores/mixin.ts index 2e8096d..dda6fbd 100644 --- a/src/stores/mixin.ts +++ b/src/stores/mixin.ts @@ -1,122 +1,122 @@ -import { defineStore } from "pinia"; -import CustomComponent from "@/components/CustomDialog.vue"; -import { useQuasar } from "quasar"; -const $q = useQuasar(); +import { defineStore } from 'pinia' +import CustomComponent from '@/components/CustomDialog.vue' -export const useCounterMixin = defineStore("mixin", () => { +export const useCounterMixin = defineStore('mixin', () => { function date2Thai(srcDate: Date, isFullMonth = false, isTime = false) { if (srcDate == null) { - return null; - ` - `; + return null + ;` + ` } - const date = new Date(srcDate); - const isValidDate = Boolean(+date); - if (!isValidDate) return srcDate.toString(); - if (isValidDate && date.getFullYear() < 1000) return srcDate.toString(); + const date = new Date(srcDate) + const isValidDate = Boolean(+date) + if (!isValidDate) return srcDate.toString() + if (isValidDate && date.getFullYear() < 1000) return srcDate.toString() const fullMonthThai = [ - "มกราคม", - "กุมภาพันธ์", - "มีนาคม", - "เมษายน", - "พฤษภาคม", - "มิถุนายน", - "กรกฎาคม", - "สิงหาคม", - "กันยายน", - "ตุลาคม", - "พฤศจิกายน", - "ธันวาคม", - ]; + 'มกราคม', + 'กุมภาพันธ์', + 'มีนาคม', + 'เมษายน', + 'พฤษภาคม', + 'มิถุนายน', + 'กรกฎาคม', + 'สิงหาคม', + 'กันยายน', + 'ตุลาคม', + 'พฤศจิกายน', + 'ธันวาคม', + ] const abbrMonthThai = [ - "ม.ค.", - "ก.พ.", - "มี.ค.", - "เม.ย.", - "พ.ค.", - "มิ.ย.", - "ก.ค.", - "ส.ค.", - "ก.ย.", - "ต.ค.", - "พ.ย.", - "ธ.ค.", - ]; - let dstYear = 0; + 'ม.ค.', + 'ก.พ.', + 'มี.ค.', + 'เม.ย.', + 'พ.ค.', + 'มิ.ย.', + 'ก.ค.', + 'ส.ค.', + 'ก.ย.', + 'ต.ค.', + 'พ.ย.', + 'ธ.ค.', + ] + let dstYear = 0 if (date.getFullYear() > 2500) { - dstYear = date.getFullYear(); + dstYear = date.getFullYear() } else { - dstYear = date.getFullYear() + 543; + dstYear = date.getFullYear() + 543 } - let dstMonth = ""; + let dstMonth = '' if (isFullMonth) { - dstMonth = fullMonthThai[date.getMonth()]; + dstMonth = fullMonthThai[date.getMonth()] } else { - dstMonth = abbrMonthThai[date.getMonth()]; + dstMonth = abbrMonthThai[date.getMonth()] } - let dstTime = ""; + let dstTime = '' if (isTime) { - const H = date.getHours().toString().padStart(2, "0"); - const M = date.getMinutes().toString().padStart(2, "0"); + const H = date.getHours().toString().padStart(2, '0') + const M = date.getMinutes().toString().padStart(2, '0') // const S = date.getSeconds().toString().padStart(2, "0") // dstTime = " " + H + ":" + M + ":" + S + " น." - dstTime = " " + H + ":" + M + " น."; + dstTime = ' ' + H + ':' + M + ' น.' } return ( - date.getDate().toString().padStart(2, "0") + - " " + + date.getDate().toString().padStart(2, '0') + + ' ' + dstMonth + - " " + + ' ' + dstYear + dstTime - ); + ) } + function covertDateObject(date: string) { if (date) { - const dateParts = date.split("/"); + const dateParts = date.split('/') // ประกาศตัวแปรเพื่อเก็บค่าวันที่, เดือน, และ ปี - const day = parseInt(dateParts[0], 10); - const month = parseInt(dateParts[1], 10) - 1; - const year = parseInt(dateParts[2], 10) + 2500; + const day = parseInt(dateParts[0], 10) + const month = parseInt(dateParts[1], 10) - 1 + const year = parseInt(dateParts[2], 10) + 2500 // สร้างอ็อบเจ็กต์ Date ด้วยค่าที่ได้ - const dateObject = new Date(year, month, day); - return date2Thai(dateObject); + const dateObject = new Date(year, month, day) + return date2Thai(dateObject) } } - type OkCallback = () => void; - type CancelCallback = () => void; - const dialogConfirm = ( + + type OkCallback = () => void + type CancelCallback = () => void + function dialogConfirm( q: any, ok?: OkCallback, title?: string, // ถ้ามี cancel action ใส่เป็น null desc?: string, // ถ้ามี cancel action ใส่เป็น null cancel?: CancelCallback - ) => { + ) { q.dialog({ component: CustomComponent, componentProps: { - title: title && title != null ? title : "ยืนยันการบันทึก", + title: title && title != null ? title : 'ยืนยันการบันทึก', message: desc && desc != null ? desc - : "ต้องการยืนยันการบันทึกข้อมูลนี้ใช่หรือไม่?", - icon: "info", - color: "public", - textOk: "ตกลง", + : 'ต้องการยืนยันการบันทึกข้อมูลนี้ใช่หรือไม่?', + icon: 'info', + color: 'public', + textOk: 'ตกลง', onlycancel: false, }, }) .onOk(() => { - if (ok) ok(); + if (ok) ok() }) .onCancel(() => { - if (cancel) cancel(); - }); - }; + if (cancel) cancel() + }) + } return { date2Thai, covertDateObject, dialogConfirm, - }; -}); + } +}) diff --git a/src/styles/quasar.variables.sass b/src/style/quasar-variables.sass similarity index 100% rename from src/styles/quasar.variables.sass rename to src/style/quasar-variables.sass diff --git a/src/styles/quasar.sass b/src/styles/quasar.sass deleted file mode 100644 index 1ba19fe..0000000 --- a/src/styles/quasar.sass +++ /dev/null @@ -1,3 +0,0 @@ -@import './quasar.variables.sass' -@import '~quasar-styl' -// @import '~quasar-addon-styl' diff --git a/src/views/ErrorNotFoundPage.vue b/src/views/ErrorNotFoundPage.vue new file mode 100644 index 0000000..1be87ac --- /dev/null +++ b/src/views/ErrorNotFoundPage.vue @@ -0,0 +1,27 @@ + + + diff --git a/src/views/HistoryView.vue b/src/views/HistoryView.vue index cb68efe..1e0a737 100644 --- a/src/views/HistoryView.vue +++ b/src/views/HistoryView.vue @@ -1,103 +1,103 @@ - - + + diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index e2fcea4..b47b55b 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -1,202 +1,134 @@