Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix/feedback-POS-notin-debt' int…
Browse files Browse the repository at this point in the history
…o fix/feedback-POS-notin-debt
  • Loading branch information
SvenMokveldje committed Nov 21, 2024
2 parents a2da663 + 0dc1c0a commit 8587185
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
23 changes: 20 additions & 3 deletions apps/point-of-sale/src/components/Cart/CartActionsComponent.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<template>
<Message v-show="userCannotGoInDebt" severity="warn" :closable="false">
You cannot checkout as you are a user that cannot go into debt!
<Dialog
v-model:visible="userCannotGoInDebt"
:show-header="false"
:content-style="{ width: '35rem' }"
>
<Message severity="warn" :closable="false" :icon="undefined">
You cannot checkout as you are a user that cannot go into debt! <br>
Please remove items before you can continue.
</Message>
</Dialog>
<div class="flex justify-content-between w-full">
<button
class="c-btn rounder font-medium checkout text-3xl"
:class="{ countdown: checkingOut, disabled: !enabled, borrelMode }"
:class="{ countdown: checkingOut, disabled: !enabled || userCannotGoInDebt, borrelMode }"
@click="checkout"
>
{{ checkoutText }}
Expand Down Expand Up @@ -33,6 +40,7 @@ const borrelMode = computed(() => settings.isBorrelmode);
const sound = ref<HTMLAudioElement | null>(null);
const buyer = computed(() => cartStore.getBuyer);
const checkoutText = computed(() => {
if (checkingOut.value) return duration.value;
Expand All @@ -43,7 +51,16 @@ const checkoutText = computed(() => {
const enabled = computed(() => {
return cartItems.length > 0 && buyer.value;
});
const userCannotGoInDebt = computed(() => cartStore.checkUserCannotGoIntoDebt());
const showDebtWarning = ref(true);
const showDebtWarningDialog = computed(() => {
return userCannotGoInDebt.value && showDebtWarning.value;
});
const resetDialog = () => {
showDebtWarning.value = false;
};
const duration = ref(3);
const checkingOut = ref(false);
Expand Down
2 changes: 1 addition & 1 deletion apps/point-of-sale/src/stores/activity.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const useActivityStore = defineStore('activity', {

async onTimerEnd() {
const cartStore = useCartStore();
if (cartStore.checkUserCannotGoIntoDebt()) return this.restartTimer();
if (cartStore.checkUserCannotGoIntoDebt()) return logoutService();
if (useSettingStore().isBorrelmode) return;
if (cartStore.cartTotalCount > 0 ) await useCartStore().checkout();
await logoutService();
Expand Down

0 comments on commit 8587185

Please sign in to comment.