diff --git a/.env b/.env index ddde0502fe0dee862ae8d2e42a443d88ee564004..13f07ff7f2a54c8625b0c3bab82988df01704dd0 100644 --- a/.env +++ b/.env @@ -1 +1,4 @@ -VITE_API_BASE_URL=http://localhost:4000 +# .env.local (สำหรับ localhost) +VITE_EMP_IMAGE_BASE=http://localhost:4000/images/emp/ +VITE_SCHEDULER_API=http://localhost:9000/run-schedule +VITE_API_BASE_URL=http://localhost:4000 \ No newline at end of file diff --git a/.env.docker b/.env.docker deleted file mode 100644 index 87cde372c605d46ba615a212b404e2b14221cfb7..0000000000000000000000000000000000000000 --- a/.env.docker +++ /dev/null @@ -1,3 +0,0 @@ -# .env.docker (ใช้ตอนรันใน Docker หรือ production) -VITE_EMP_IMAGE_BASE=http://dekdee3.informatics.buu.ac.th:8012/images/emp/ -VITE_SCHEDULER_API=http://dekdee3.informatics.buu.ac.th:8013/run-schedule \ No newline at end of file diff --git a/.env.production b/.env.production index 787a791d6f4f17cd56eb05fafa6d993ae98396dd..741929e734f286dad19467b8b438c59107669700 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,4 @@ -VITE_API_BASE_URL=http://dekdee3.informatics.buu.ac.th:8012 +# .env.docker (ใช้ตอนรันใน Docker หรือ production) VITE_EMP_IMAGE_BASE=http://dekdee3.informatics.buu.ac.th:8012/images/emp/ -VITE_SCHEDULER_API=http://dekdee3.informatics.buu.ac.th:8013/run-schedule \ No newline at end of file +VITE_SCHEDULER_API=http://dekdee3.informatics.buu.ac.th:8013/run-schedule +VITE_API_BASE_URL=http://dekdee3.informatics.buu.ac.th:8012 diff --git a/Dockerfile b/Dockerfile index 2c0fcb4372060e47f666000506e6c982e7884f9b..211bed4815b49a73c4b9ffba6c069fc81e24007d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN npm install # คัดลอก source code ทั้งหมด COPY . . - +COPY .env.production .env # สร้าง production build RUN npm run build diff --git a/docker-compose.yml b/docker-compose.yml index 639a1b7db36ed82745e831966452c6096b5dace9..bd4e4b59d1ee38bf48ab89654ece0dabea3c7489 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,5 +3,7 @@ services: lookoad-frontend: build: . ports: - - "8011:80" # นายจองไว้เรียบร้อย + - "8011:80" # นายจองไว้เรียบร้อย restart: always + env_file: + - .env.production # 👈 เพิ่มตรงนี้ diff --git a/package-lock.json b/package-lock.json index e8b2aef1bfa8e0ecae5e9f93631695f53f23e98c..3a98320e6af9b506a2a1502d56c2bb4c1dc7a667 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "class-validator": "^0.14.1", "d3": "^7.9.0", "date-fns": "^4.1.0", - "dayjs": "^1.11.10", + "dayjs": "^1.11.13", "install": "^0.13.0", "jsplumb": "^2.15.6", "pinia": "^2.1.7", @@ -2848,9 +2848,10 @@ } }, "node_modules/dayjs": { - "version": "1.11.10", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", - "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==" + "version": "1.11.13", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", + "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==", + "license": "MIT" }, "node_modules/de-indent": { "version": "1.0.2", diff --git a/package.json b/package.json index 9f8b03fe68eec004dbd964e995082d6b0367a244..0f0491b06debb0ad388aadeb102dc36373812c7b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "class-validator": "^0.14.1", "d3": "^7.9.0", "date-fns": "^4.1.0", - "dayjs": "^1.11.10", + "dayjs": "^1.11.13", "install": "^0.13.0", "jsplumb": "^2.15.6", "pinia": "^2.1.7", diff --git a/src/components/GanttChart/GanttChart.vue b/src/components/GanttChart/GanttChart.vue index 8fc0e8d66239250c5e384be4ff4045cbcff6604a..077ad5692e1b149862d659fb5c0bfc9b8b1ad1b8 100644 --- a/src/components/GanttChart/GanttChart.vue +++ b/src/components/GanttChart/GanttChart.vue @@ -108,9 +108,7 @@ import AddQueueDialog from './AddQueueDialog.vue' import MakequeueBtn from './MakequeueBtn.vue' import SettingBtn from './SettingBtn.vue' import './ganttChart.css' -import dayjs from 'dayjs' -import utc from 'dayjs/plugin/utc' -import timezone from 'dayjs/plugin/timezone' + // Stores const queueStore = useQueueStore() @@ -220,13 +218,14 @@ function clearOriginalMaps() { Object.keys(originalColorMap).forEach((k) => delete originalColorMap[+k]) } -dayjs.extend(utc) -dayjs.extend(timezone) - function convertToLocalTime(utcString: string): string { - return dayjs.utc(utcString).tz("Asia/Bangkok").format("YYYY-MM-DD HH:mm") + const d = new Date(utcString) + const iso = d.toISOString() + // 🟢 คืนแบบไม่แปลง timezone (แค่ตัดเวลาให้ format สวย) + return iso.slice(0, 16).replace('T', ' ') } + // Pagination & Dialog const pages = computed(() => pageStore.pages.map((p) => p.pagenum)) const pageToShowDelete = ref<number | null>(null) diff --git a/src/components/Navbar/MainMenu.vue b/src/components/Navbar/MainMenu.vue index 424839a6743850d10c999722af6f426db30ea964..483b012af822fd4ced2e6d5e1f8794fa16326f7b 100644 --- a/src/components/Navbar/MainMenu.vue +++ b/src/components/Navbar/MainMenu.vue @@ -6,14 +6,14 @@ import { useUserStore } from '@/stores/user' const drawer = inject<Ref<boolean>>('drawer') const rail = inject<Ref<boolean>>('rail') const authStore = useAuthStore() +const API_BASE = import.meta.env.VITE_API_BASE_URL </script> <template> <v-navigation-drawer expand-on-hover rail style="background-color: #2B2E3F; color:white;"> <!-- profile --> <v-list> - <v-list-item - :prepend-avatar="`http://localhost:4000/images/users/${authStore.getCurrentUser()?.image || 'default.jpg'}`"> + <v-list-item :prepend-avatar="`${API_BASE}/images/users/${authStore.getCurrentUser()?.image || 'default.jpg'}`"> <template #title> <span style="font-size: 20px; font-weight: bold"> {{ authStore.getCurrentUser()?.name || 'Unknown User' }}