From ed341b1e4787c0ec0a07a2b0be9f0a3aa621fb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=ABl=20van=20de=20Vrie?= <46963141+noelvandevrie@users.noreply.github.com> Date: Sat, 2 Nov 2024 18:33:45 +0100 Subject: [PATCH 1/6] Feature/nfc login (#439) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Noël van de Vrie --- .../src/components/EanLoginComponent.vue | 43 ------------- .../src/components/Keypad/KeypadComponent.vue | 3 +- .../PointOfSaleDisplayComponent.vue | 3 +- .../src/components/ScannersLoginComponent.vue | 58 ++++++++++++++++++ .../components/ScannersUpdateComponent.vue | 60 +++++++++++++++++++ .../UserSearch/UserSearchComponent.vue | 1 - .../UserSearch/UserSearchRowComponent.vue | 3 +- apps/point-of-sale/src/main.ts | 4 +- apps/point-of-sale/src/views/CashierView.vue | 18 ++++++ apps/point-of-sale/src/views/LoginView.vue | 19 +++++- lib/common/src/stores/auth.store.ts | 10 +++- 11 files changed, 170 insertions(+), 52 deletions(-) delete mode 100644 apps/point-of-sale/src/components/EanLoginComponent.vue create mode 100644 apps/point-of-sale/src/components/ScannersLoginComponent.vue create mode 100644 apps/point-of-sale/src/components/ScannersUpdateComponent.vue diff --git a/apps/point-of-sale/src/components/EanLoginComponent.vue b/apps/point-of-sale/src/components/EanLoginComponent.vue deleted file mode 100644 index c5f22b22..00000000 --- a/apps/point-of-sale/src/components/EanLoginComponent.vue +++ /dev/null @@ -1,43 +0,0 @@ - - - - - diff --git a/apps/point-of-sale/src/components/Keypad/KeypadComponent.vue b/apps/point-of-sale/src/components/Keypad/KeypadComponent.vue index 44d24a2a..237df4a4 100644 --- a/apps/point-of-sale/src/components/Keypad/KeypadComponent.vue +++ b/apps/point-of-sale/src/components/Keypad/KeypadComponent.vue @@ -1,7 +1,8 @@ + + + + diff --git a/apps/point-of-sale/src/components/ScannersUpdateComponent.vue b/apps/point-of-sale/src/components/ScannersUpdateComponent.vue new file mode 100644 index 00000000..c4725869 --- /dev/null +++ b/apps/point-of-sale/src/components/ScannersUpdateComponent.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/apps/point-of-sale/src/components/UserSearch/UserSearchComponent.vue b/apps/point-of-sale/src/components/UserSearch/UserSearchComponent.vue index 3687afe7..47a00d0e 100644 --- a/apps/point-of-sale/src/components/UserSearch/UserSearchComponent.vue +++ b/apps/point-of-sale/src/components/UserSearch/UserSearchComponent.vue @@ -39,7 +39,6 @@ import UserSearchRowComponent from "@/components/UserSearch/UserSearchRowCompone import { useCartStore } from "@/stores/cart.store"; import { useAuthStore } from "@sudosos/sudosos-frontend-common"; import { debounce } from 'lodash'; -import axios from 'axios'; import type { AxiosResponse } from 'axios'; import { useSettingStore } from "@/stores/settings.store"; import ScrollPanel from "primevue/scrollpanel"; diff --git a/apps/point-of-sale/src/components/UserSearch/UserSearchRowComponent.vue b/apps/point-of-sale/src/components/UserSearch/UserSearchRowComponent.vue index db1ae4e9..8408763b 100644 --- a/apps/point-of-sale/src/components/UserSearch/UserSearchRowComponent.vue +++ b/apps/point-of-sale/src/components/UserSearch/UserSearchRowComponent.vue @@ -1,5 +1,6 @@ diff --git a/apps/point-of-sale/src/assets/splash.svg b/apps/point-of-sale/src/assets/splash.svg index b854dda6..0708585a 100644 --- a/apps/point-of-sale/src/assets/splash.svg +++ b/apps/point-of-sale/src/assets/splash.svg @@ -1,2 +1,14 @@ - - \ No newline at end of file + + + + + + + + + \ No newline at end of file From 5f3d8b6634aeeb14cdac03c7c47a503efe275585 Mon Sep 17 00:00:00 2001 From: Samuel Date: Thu, 7 Nov 2024 10:56:19 +0100 Subject: [PATCH 4/6] fix(pos): toast service not included in pos (#442) very nice! --- apps/point-of-sale/src/components/ScannersLoginComponent.vue | 1 - apps/point-of-sale/src/main.ts | 2 ++ apps/point-of-sale/vite.config.ts | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/point-of-sale/src/components/ScannersLoginComponent.vue b/apps/point-of-sale/src/components/ScannersLoginComponent.vue index 9b675507..06927417 100644 --- a/apps/point-of-sale/src/components/ScannersLoginComponent.vue +++ b/apps/point-of-sale/src/components/ScannersLoginComponent.vue @@ -40,7 +40,6 @@ const onInput = (event: KeyboardEvent): void => { captures = []; } else { captures.push(event); - console.log(captures); } }; diff --git a/apps/point-of-sale/src/main.ts b/apps/point-of-sale/src/main.ts index fbfba70e..f026c833 100644 --- a/apps/point-of-sale/src/main.ts +++ b/apps/point-of-sale/src/main.ts @@ -19,11 +19,13 @@ import router from './router'; import App from './App.vue'; import { useSettingStore } from "@/stores/settings.store"; import Message from "primevue/message"; +import ToastService from "primevue/toastservice"; const app = createApp(App); app.use(router); app.use(PrimeVue); +app.use(ToastService); // eslint-disable-next-line app.component('Button', Button); diff --git a/apps/point-of-sale/vite.config.ts b/apps/point-of-sale/vite.config.ts index 8d96d5ee..88f8e0df 100644 --- a/apps/point-of-sale/vite.config.ts +++ b/apps/point-of-sale/vite.config.ts @@ -17,6 +17,9 @@ export default defineConfig(({ mode }) => { '@': fileURLToPath(new URL('./src', import.meta.url)), } }, + optimizeDeps: { + exclude: ['ToastService'], + }, css: { preprocessorOptions: { scss: { From e2b3e769d43a755aaeb7ce5ca017a1eaae09aabf Mon Sep 17 00:00:00 2001 From: Victor Klomp Date: Fri, 8 Nov 2024 11:26:40 +0100 Subject: [PATCH 5/6] fix(devcontainer): Add build-libraries step (#443) --- .devcontainer/postCreateCommands.sh | 4 +++- README.md | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.devcontainer/postCreateCommands.sh b/.devcontainer/postCreateCommands.sh index 23ccda5b..aa26e93d 100644 --- a/.devcontainer/postCreateCommands.sh +++ b/.devcontainer/postCreateCommands.sh @@ -6,4 +6,6 @@ yarn install #Copy .env files cp apps/dashboard/.env.example apps/dashboard/.env -cp apps/point-of-sale/.env.example apps/point-of-sale/.env \ No newline at end of file +cp apps/point-of-sale/.env.example apps/point-of-sale/.env + +yarn build-libraries diff --git a/README.md b/README.md index 22773be8..a22aac4b 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,8 @@ You can quickly start development directly in your browser by using [Codespaces] #### Step 1: Installing - Use git to [clone](https://github.com/git-guides#how-do-i-use-git) the repository. - Run `yarn install` -- Copy the .env.example file to .env in the `apps/dashboard` and `apps/point-of-sale` directories +- Copy the `.env.example` file to `.env` file in the `apps/dashboard` and `apps/point-of-sale` directories +- Run `yarn build-libraries` to have the SudoSOS libraries also ready #### Step 2: Running the dashboard/point-of-sale - Run `yarn dev-dashboard` or `yarn dev-pos` to start the development environment. From d5fb1db38c1b34a3a1b0ab4400314b0656ce4754 Mon Sep 17 00:00:00 2001 From: Samuel Date: Fri, 8 Nov 2024 19:41:41 +0100 Subject: [PATCH 6/6] fix(pos): allow for dynamic base paths (#440) --- apps/point-of-sale/index.html | 5 +++++ apps/point-of-sale/src/main.ts | 5 ++--- apps/point-of-sale/src/router/index.ts | 7 +++++-- apps/point-of-sale/src/utils/basePathUtils.ts | 4 ++++ apps/point-of-sale/vite.config.ts | 1 + lib/nginx/default.conf | 16 ++++++++++++++++ 6 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 apps/point-of-sale/src/utils/basePathUtils.ts diff --git a/apps/point-of-sale/index.html b/apps/point-of-sale/index.html index 619bc486..f5b29321 100644 --- a/apps/point-of-sale/index.html +++ b/apps/point-of-sale/index.html @@ -6,6 +6,11 @@ + SudoSOS Point Of Sale diff --git a/apps/point-of-sale/src/main.ts b/apps/point-of-sale/src/main.ts index f026c833..30dc6c9a 100644 --- a/apps/point-of-sale/src/main.ts +++ b/apps/point-of-sale/src/main.ts @@ -1,4 +1,3 @@ -// import "bootstrap/dist/css/bootstrap.css"; import 'primeflex/primeflex.css'; import 'primeicons/primeicons.css'; @@ -15,8 +14,8 @@ import OverlayPanel from "primevue/overlaypanel"; import Dropdown from "primevue/dropdown"; import Toast from "primevue/toast"; -import router from './router'; -import App from './App.vue'; +import router from '@/router'; +import App from '@/App.vue'; import { useSettingStore } from "@/stores/settings.store"; import Message from "primevue/message"; import ToastService from "primevue/toastservice"; diff --git a/apps/point-of-sale/src/router/index.ts b/apps/point-of-sale/src/router/index.ts index 9ffb54b2..879646a3 100644 --- a/apps/point-of-sale/src/router/index.ts +++ b/apps/point-of-sale/src/router/index.ts @@ -2,6 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router'; import { clearTokenInStorage, useAuthStore } from '@sudosos/sudosos-frontend-common'; import LoginView from '@/views/LoginView.vue'; import CashierView from '../views/CashierView.vue'; +import { getBasePath } from '@/utils/basePathUtils'; const authGuard = (to: any, from: any, next: any) => { const authStore = useAuthStore(); @@ -16,8 +17,10 @@ const authGuard = (to: any, from: any, next: any) => { } }; +const baseUrl = getBasePath(); + const router = createRouter({ - history: createWebHistory(import.meta.env.BASE_URL), + history: createWebHistory(baseUrl), routes: [ { path: '/cashier', @@ -29,7 +32,7 @@ const router = createRouter({ path: '/', name: 'login', component: LoginView - } + }, ] }); diff --git a/apps/point-of-sale/src/utils/basePathUtils.ts b/apps/point-of-sale/src/utils/basePathUtils.ts new file mode 100644 index 00000000..0845d896 --- /dev/null +++ b/apps/point-of-sale/src/utils/basePathUtils.ts @@ -0,0 +1,4 @@ +export function getBasePath(): string { + // @ts-ignore + return window.__BASE_URL__ || '/'; +} diff --git a/apps/point-of-sale/vite.config.ts b/apps/point-of-sale/vite.config.ts index 88f8e0df..b0fe0413 100644 --- a/apps/point-of-sale/vite.config.ts +++ b/apps/point-of-sale/vite.config.ts @@ -9,6 +9,7 @@ export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd()); return { + base: "./", plugins: [ vue(), ], diff --git a/lib/nginx/default.conf b/lib/nginx/default.conf index 39bb645c..82ef3552 100644 --- a/lib/nginx/default.conf +++ b/lib/nginx/default.conf @@ -10,6 +10,14 @@ upstream docs { server docs:80; } +upstream pos { + server pos:80; +} + +upstream pos-develop { + server pos-develop:80; +} + server { listen 80; listen [::]:80; @@ -21,6 +29,14 @@ server { proxy_pass http://frontend/; } + location /pos/ { + proxy_pass http://pos/; + } + + location /pos-develop/ { + proxy_pass http://pos-develop/; + } + location /docs/ { proxy_pass http://docs/; }