Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fac27697b | ||
|
|
44e3167278 | ||
|
|
5cc22f14bc | ||
|
|
8519af5cbb | ||
|
|
3fc4be8335 | ||
|
|
36c1f10de8 | ||
|
|
278298ecd2 | ||
|
|
dec90bbbbf | ||
|
|
a4b9d2f04d | ||
|
|
ee41366c08 | ||
|
|
e22f78a449 | ||
|
|
0e9292d6d9 | ||
|
|
69250ada66 | ||
|
|
7f3a8c07e2 | ||
|
|
bd14d58f08 | ||
|
|
b8494cd1d9 | ||
|
|
49772c1334 | ||
|
|
02ddb99000 |
@@ -112,6 +112,8 @@ jobs:
|
||||
env:
|
||||
PLAYWRIGHT_ARTIFACT_NAMESPACE: e2e-pr-${{ matrix.suite }}-${{ matrix.project }}
|
||||
PLAYWRIGHT_REPORTER_MODE: line-html
|
||||
PLAYWRIGHT_WORKERS: 1
|
||||
PLAYWRIGHT_VIDEO_MODE: on-first-retry
|
||||
steps:
|
||||
- name: Repair self-hosted workspace permissions
|
||||
shell: bash
|
||||
@@ -140,6 +142,7 @@ jobs:
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
HEAD_SHA: ${{ github.sha }}
|
||||
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
PUSH_BEFORE_SHA: ${{ github.event.before }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -152,8 +155,13 @@ jobs:
|
||||
else
|
||||
base_ref="$PUSH_BEFORE_SHA"
|
||||
fi
|
||||
if [[ "$EVENT_NAME" == "pull_request" && -n "$PR_HEAD_SHA" ]]; then
|
||||
head_ref="$PR_HEAD_SHA"
|
||||
else
|
||||
head_ref="$HEAD_SHA"
|
||||
fi
|
||||
echo "base=$base_ref" >> "$GITHUB_OUTPUT"
|
||||
echo "head=$HEAD_SHA" >> "$GITHUB_OUTPUT"
|
||||
echo "head=$head_ref" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v5
|
||||
@@ -223,7 +231,10 @@ jobs:
|
||||
--env CI="${CI:-}" \
|
||||
--env PLAYWRIGHT_ARTIFACT_NAMESPACE="$PLAYWRIGHT_ARTIFACT_NAMESPACE" \
|
||||
--env PLAYWRIGHT_REPORTER_MODE="$PLAYWRIGHT_REPORTER_MODE" \
|
||||
--env PLAYWRIGHT_WORKERS="$PLAYWRIGHT_WORKERS" \
|
||||
--env PLAYWRIGHT_VIDEO_MODE="$PLAYWRIGHT_VIDEO_MODE" \
|
||||
--env PLAYWRIGHT_DEV_PORT="$playwright_dev_port" \
|
||||
--env PLAYWRIGHT_WORKERS="${PLAYWRIGHT_WORKERS:-1}" \
|
||||
--env MATRIX_SUITE="$MATRIX_SUITE" \
|
||||
--env MATRIX_PROJECT="$MATRIX_PROJECT" \
|
||||
--env DIFF_BASE_REF="$DIFF_BASE_REF" \
|
||||
|
||||
@@ -7,14 +7,18 @@ export const fallbackChangePatterns = [
|
||||
/^vite\.config\.js$/u,
|
||||
/^playwright(?:\..+)?\.config\.(?:js|ts)$/u,
|
||||
/^playwright\.global-(?:setup|teardown)\.mjs$/u,
|
||||
/^scripts\/run-playwright-(?:pr|ci-parallel|batched-chromium)\.mjs$/u,
|
||||
/^scripts\/run-playwright-(?:ci-parallel|batched-chromium)\.mjs$/u,
|
||||
/^tests\/e2e\/(?:support|fixtures)\//u,
|
||||
];
|
||||
|
||||
export const sourceMappings = [
|
||||
{
|
||||
name: "auth",
|
||||
patterns: [/^src\/(?:views|components|middleware)\/.*auth/iu, /^src\/views\/auth\//u, /^src\/components\/session\//u],
|
||||
patterns: [
|
||||
/^src\/(?:views|components|middleware)\/.*auth/iu,
|
||||
/^src\/views\/auth\//u,
|
||||
/^src\/components\/session\/(?!token\/SessionUser\/Objects\/)/u,
|
||||
],
|
||||
specs: ["tests/e2e/auth.smoke.spec.js", "tests/e2e/userAuth.spec.ts"],
|
||||
projects: chromiumProjects,
|
||||
},
|
||||
@@ -33,6 +37,16 @@ export const sourceMappings = [
|
||||
specs: ["tests/e2e/superuser-roles-permissions.spec.ts"],
|
||||
projects: chromiumProjects,
|
||||
},
|
||||
{
|
||||
name: "superuser-department-overview",
|
||||
patterns: [
|
||||
/^src\/services\/superuserDepartmentOverview\.js$/u,
|
||||
/^src\/views\/dashboards\/superUserDashboard\/department\/Department\.vue$/u,
|
||||
/^src\/views\/dashboards\/superUserDashboard\/department\/SuperUserDashboardDepartmentNavigation\.vue$/u,
|
||||
],
|
||||
specs: ["tests/e2e/superuser-department-overview.spec.js"],
|
||||
projects: chromiumProjects,
|
||||
},
|
||||
{
|
||||
name: "booking",
|
||||
patterns: [/bookings?/iu, /time-bookings/iu, /^src\/views\/guest\/book\//u],
|
||||
@@ -51,8 +65,19 @@ export const sourceMappings = [
|
||||
},
|
||||
{
|
||||
name: "pos",
|
||||
patterns: [/\/pos[/-]/iu, /POS/iu, /^src\/assets\/pos\.css$/u],
|
||||
specs: ["tests/e2e/pos-flow.spec.js", "tests/e2e/pos-mobile-order-flow.spec.js", "tests/e2e/admin-pos-orders.spec.ts"],
|
||||
patterns: [
|
||||
/\/pos[/-]/iu,
|
||||
/POS/iu,
|
||||
/^src\/assets\/pos\.css$/u,
|
||||
/^src\/components\/displays\/boxes\/ProductBox\.vue$/u,
|
||||
/^src\/features\/customer\/customerProductRules\.js$/u,
|
||||
],
|
||||
specs: [
|
||||
"tests/e2e/pos-flow.spec.js",
|
||||
"tests/e2e/pos-mobile-order-flow.spec.js",
|
||||
"tests/e2e/admin-pos-orders.spec.ts",
|
||||
"tests/e2e/pos-customer-rules.spec.js",
|
||||
],
|
||||
projects: chromiumProjects,
|
||||
},
|
||||
{
|
||||
@@ -70,6 +95,12 @@ export const sourceMappings = [
|
||||
specs: ["tests/e2e/admin-department-notifications.spec.ts"],
|
||||
projects: chromiumProjects,
|
||||
},
|
||||
{
|
||||
name: "limited-backoffice",
|
||||
patterns: [/^src\/views\/backoffice\/LimitedBackoffice/u],
|
||||
specs: ["tests/e2e/limited-backoffice.spec.ts"],
|
||||
projects: chromiumProjects,
|
||||
},
|
||||
{
|
||||
name: "invoicing",
|
||||
patterns: [/invoic/iu, /economic[-/]?queue/iu, /collected-order/iu],
|
||||
@@ -92,6 +123,15 @@ export const sourceMappings = [
|
||||
specs: ["tests/e2e/superuser-system-status.smoke.spec.js"],
|
||||
projects: chromiumProjects,
|
||||
},
|
||||
{
|
||||
name: "superuser-department-pricing",
|
||||
patterns: [
|
||||
/^src\/views\/dashboards\/superUserDashboard\/department\/(?:DepartmentPricing|SuperUserSelectedDepartmentObject)\.vue$/u,
|
||||
/^src\/components\/session\/token\/SessionUser\/Objects\/Departments\.vue$/u,
|
||||
],
|
||||
specs: ["tests/e2e/superuser-department-pricing-custom-only.spec.ts"],
|
||||
projects: ["chromium-desktop"],
|
||||
},
|
||||
{
|
||||
name: "self-serve",
|
||||
patterns: [/self[-/]?serve/iu, /selfserve/iu, /wash\/MyWash/iu],
|
||||
|
||||
@@ -101,8 +101,10 @@ export const ownedFilesByRole = {
|
||||
"superuser-customer-complaints.spec.ts",
|
||||
"superuser-customers-mass-import.spec.ts",
|
||||
"superuser-department-branding.spec.js",
|
||||
"superuser-department-overview.spec.js",
|
||||
"superuser-department-gates.spec.ts",
|
||||
"superuser-department-lanes.spec.ts",
|
||||
"superuser-department-pricing-custom-only.spec.ts",
|
||||
"superuser-departments-archive.spec.ts",
|
||||
"superuser-drafts.spec.ts",
|
||||
"superuser-products-layout.spec.ts",
|
||||
|
||||
@@ -261,6 +261,8 @@ function selectChangedTests(changedFiles) {
|
||||
specProjects: new Map(),
|
||||
mappedFiles: [],
|
||||
unmappedFiles: [],
|
||||
directSpecFiles: [],
|
||||
skippedDirectSpecFiles: [],
|
||||
fallback: false,
|
||||
};
|
||||
|
||||
@@ -270,8 +272,7 @@ function selectChangedTests(changedFiles) {
|
||||
const file = normalizePath(rawFile);
|
||||
|
||||
if (isE2eSpec(file)) {
|
||||
addSpec(selection, file, selectedProjects);
|
||||
selection.mappedFiles.push(file);
|
||||
selection.directSpecFiles.push(file);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -295,13 +296,26 @@ function selectChangedTests(changedFiles) {
|
||||
|
||||
selection.mappedFiles.push(file);
|
||||
for (const mapping of matches) {
|
||||
const projects = mapping.projects.filter((project) => selectedProjects.includes(project));
|
||||
const mappedProjects = mapping.projects.length > 0 ? mapping.projects : selectedProjects;
|
||||
const projects = mappedProjects.filter((project) => selectedProjects.includes(project));
|
||||
if (projects.length === 0) {
|
||||
continue;
|
||||
}
|
||||
for (const spec of mapping.specs) {
|
||||
addSpec(selection, spec, projects.length > 0 ? projects : selectedProjects);
|
||||
addSpec(selection, spec, projects);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selection.specProjects.size === 0 && !selection.fallback) {
|
||||
for (const file of selection.directSpecFiles) {
|
||||
addSpec(selection, file, selectedProjects);
|
||||
selection.mappedFiles.push(file);
|
||||
}
|
||||
} else {
|
||||
selection.skippedDirectSpecFiles.push(...selection.directSpecFiles);
|
||||
}
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
||||
@@ -370,6 +384,12 @@ async function runChangedSelection(selection) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (selection.skippedDirectSpecFiles.length > 0) {
|
||||
console.log(
|
||||
`[playwright-pr] Source mappings selected changed-area specs; direct E2E file edits are covered by mapped/core gates: ${selection.skippedDirectSpecFiles.join(", ")}`
|
||||
);
|
||||
}
|
||||
|
||||
for (const [index, group] of groups.entries()) {
|
||||
for (const project of group.projects) {
|
||||
const code = await runPlaywright({
|
||||
|
||||
@@ -6,6 +6,7 @@ import Swal from "sweetalert2";
|
||||
import CustomerProductDiscountDisplay
|
||||
from "@/components/displays/department/pos/displays/CustomerProductDiscountDisplay.vue";
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { isProductRestrictedForCustomer } from "@/features/customer/customerProductRules.js";
|
||||
|
||||
const { t } = useI18n();
|
||||
const expandIcon = ref(null);
|
||||
@@ -83,23 +84,6 @@ const hasRestrictAdditionalServices = () => {
|
||||
return customerAttributesSafe.value.some((attribute) => attribute.attribute === 'restrictAdditionalServices');
|
||||
};
|
||||
|
||||
const hasRestrictSpotFree = () => {
|
||||
return customerAttributesSafe.value.some((attribute) => attribute.attribute === 'restrictSpotFree');
|
||||
};
|
||||
|
||||
const hasRestrictInteriorCleaning = () => {
|
||||
return customerAttributesSafe.value.some((attribute) => attribute.attribute === 'restrictInteriorCleaning');
|
||||
};
|
||||
|
||||
const hasRestrictTankCleaning = () => {
|
||||
return customerAttributesSafe.value.some((attribute) => attribute.attribute === 'restrictTankCleaning');
|
||||
};
|
||||
|
||||
const hasOnlyTankCleaning = () => {
|
||||
return customerAttributesSafe.value.some((attribute) => attribute.attribute === 'onlyTankCleaning');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* On before add product addon
|
||||
* This is used to check if adding a product has any requirements.
|
||||
@@ -162,37 +146,19 @@ const doesAddonHaveNoteRequirement = (addon) => {
|
||||
};
|
||||
|
||||
const isAddonRestricted = (addon) => {
|
||||
const addonName = getAddonName(addon).toLowerCase();
|
||||
// Check if the addon has "Spot Free" in the name
|
||||
if (hasRestrictSpotFree() && addonName.includes('spot free')) {
|
||||
return true;
|
||||
}
|
||||
// Check if the addon has "Indvendig vask" in the name
|
||||
if (hasRestrictInteriorCleaning() && addonName.includes('indvendig vask')) {
|
||||
return true;
|
||||
}
|
||||
const addonProduct = getAddonProduct(addon);
|
||||
return isProductRestrictedForCustomer({
|
||||
...addonProduct,
|
||||
name: getAddonName(addon) || addonProduct.name,
|
||||
category: addonProduct.category ?? addon?.category,
|
||||
}, customerAttributesSafe.value);
|
||||
};
|
||||
|
||||
const isProductRestricted = () => {
|
||||
const productName = String(props.name || '').toLowerCase();
|
||||
// Check if the product has "Spot Free" in the name
|
||||
if (hasRestrictSpotFree() && productName.includes('spot free')) {
|
||||
return true;
|
||||
}
|
||||
// Check if the product has "Indvendig vask" in the name
|
||||
if (hasRestrictInteriorCleaning() && productName.includes('indvendig vask')) {
|
||||
return true;
|
||||
}
|
||||
// Check if the product category is 5 (Tank Cleaning)
|
||||
if (props.product?.category === 5) {
|
||||
if (hasRestrictTankCleaning()) {
|
||||
return true;
|
||||
}
|
||||
if (!hasOnlyTankCleaning()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return isProductRestrictedForCustomer({
|
||||
...props.product,
|
||||
name: props.name || props.product?.name,
|
||||
}, customerAttributesSafe.value);
|
||||
};
|
||||
|
||||
const orderByOrderPriority = (addons) => {
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useWindowSize } from "@vueuse/core";
|
||||
import { BMessage } from "buefy";
|
||||
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import { formatLocalDateOnly, parseLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
type DateRange = {
|
||||
startDate: Date,
|
||||
@@ -115,23 +116,11 @@ const availableYears = computed(() => (
|
||||
));
|
||||
|
||||
const formatDateInputValue = (date: Date) => {
|
||||
if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
return `${year}-${month}-${day}`;
|
||||
return formatLocalDateOnly(date);
|
||||
};
|
||||
|
||||
const parseDateInputValue = (value: string) => {
|
||||
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
||||
if (!match) {
|
||||
return new Date(value);
|
||||
}
|
||||
|
||||
return new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));
|
||||
return parseLocalDateOnly(value);
|
||||
};
|
||||
|
||||
const isSameDateInputValue = (left: Date, right: Date) => (
|
||||
|
||||
@@ -30,6 +30,7 @@ import PosLastScannedLicensePlatesV2 from "@/components/displays/department/pos/
|
||||
import PosDesktopOrderBookingSelectorModal from "@/components/displays/department/pos/steps/elements/PosDesktopOrderBookingSelectorModal.vue";
|
||||
import PosDesktopCustomerConflictModal from "@/components/displays/department/pos/steps/elements/PosDesktopCustomerConflictModal.vue";
|
||||
import PosDesktopDuplicateWarning from "@/components/displays/department/pos/steps/elements/PosDesktopDuplicateWarning.vue";
|
||||
import { todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import { parsePosRouteSearch } from "@/views/dashboards/departmentDashboard/modules/Pos/posRouteState.js";
|
||||
import {
|
||||
@@ -377,8 +378,8 @@ const fetchDuplicateOrdersForContext = async (context) => {
|
||||
try {
|
||||
const response = await SessionUser.request(SessionUser.objects.orders.meta.endpoint, "GET", {
|
||||
filters: `reg_1:${normalizedContext.reg1},department_id:${department_id.value},created_at-date_from:${
|
||||
new Date().toISOString().split("T")[0]
|
||||
},created_at-date_to:${new Date().toISOString().split("T")[0]}`,
|
||||
todayLocalDateOnly()
|
||||
},created_at-date_to:${todayLocalDateOnly()}`,
|
||||
limit: 5,
|
||||
});
|
||||
|
||||
|
||||
+44
-7
@@ -22,7 +22,7 @@ import PosDepartmentStep2MobileVehicleSelection
|
||||
import GenericButton from "@/components/viewport/page/templates/generic/graphics/GenericButton.vue";
|
||||
import PosDepartmentStepMobile2FloatingCart
|
||||
from "@/components/displays/department/pos/steps/mobile/elements/PosDepartmentStepMobile2FloatingCart.vue";
|
||||
import { isAddonRestricted, canBuyAdditionalServices } from "@/components/shop/POSDepartmentProcess.vue";
|
||||
import { isAddonRestricted, canBuyAdditionalServices, isProductRestricted } from "@/components/shop/POSDepartmentProcess.vue";
|
||||
|
||||
const props = defineProps({
|
||||
label: {
|
||||
@@ -46,6 +46,7 @@ const props = defineProps({
|
||||
},
|
||||
});
|
||||
|
||||
const canSelectAdditionalItems = computed(() => canBuyAdditionalServices());
|
||||
const checked = ref(props.defaultChecked);
|
||||
// Function to generate a summary from the last order
|
||||
function generateSummary(order: PosOrder): string {
|
||||
@@ -72,6 +73,12 @@ const displaySubtitle = computed(() => {
|
||||
});
|
||||
// Emit event on toggle
|
||||
function onToggle(isOpen: boolean) {
|
||||
if (isOpen && !canSelectAdditionalItems.value) {
|
||||
checked.value = false;
|
||||
pos.views.additionalItemSelection.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
checked.value = isOpen;
|
||||
// Open the additional item selection view if toggled open
|
||||
if (isOpen) {
|
||||
@@ -118,17 +125,45 @@ const getAvailableAdditionalItems = () => {
|
||||
}));
|
||||
}
|
||||
const availableAdditionalItems = ref<Addon[]>(getAvailableAdditionalItems());
|
||||
const isAdditionalItemRestricted = (product: PosProduct) => {
|
||||
if (!canSelectAdditionalItems.value) {
|
||||
return true;
|
||||
}
|
||||
if (isProductRestricted(product)) {
|
||||
return true;
|
||||
}
|
||||
return isAddonRestricted(convertProductToAddon(product));
|
||||
}
|
||||
|
||||
watch(canSelectAdditionalItems, (canSelect) => {
|
||||
if (!canSelect) {
|
||||
checked.value = false;
|
||||
pos.views.additionalItemSelection.value = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Computed property to filter out restricted additional items based on customer attributes
|
||||
const filteredAdditionalItems = computed(() => {
|
||||
// If additional services are restricted, return empty array
|
||||
if (!canBuyAdditionalServices()) {
|
||||
if (!canSelectAdditionalItems.value) {
|
||||
return [];
|
||||
}
|
||||
// Filter out individually restricted addons
|
||||
return availableAdditionalItems.value.filter((addon: Addon) => !isAddonRestricted(addon));
|
||||
return availableAdditionalItems.value.filter((addon: Addon) => {
|
||||
if (isAddonRestricted(addon)) {
|
||||
return false;
|
||||
}
|
||||
if (addon.product && isProductRestricted(addon.product)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
});
|
||||
const onClickAddOtherProduct = () => {
|
||||
if (!canSelectAdditionalItems.value) {
|
||||
pos.views.additionalItemSelection.value = false;
|
||||
return;
|
||||
}
|
||||
pos.views.additionalItemSelection.value = !pos.views.additionalItemSelection.value;
|
||||
}
|
||||
|
||||
@@ -159,7 +194,9 @@ watch(() => pos.transactionItems.additionalItems.value, (newVal) => {
|
||||
}, { deep: true });
|
||||
|
||||
const onClickAddProduct = async (product: PosProduct) => {
|
||||
// If the product requires note, open note input.
|
||||
if (isAdditionalItemRestricted(product)) {
|
||||
return;
|
||||
}
|
||||
pos.transactionItems.addAdditionalItem(product);
|
||||
// If the view is fullscreen, close it after adding
|
||||
//if (pos.views.additionalItemSelection.value) {
|
||||
@@ -171,7 +208,7 @@ const onClickAddProduct = async (product: PosProduct) => {
|
||||
<template>
|
||||
<div data-testid="pos-mobile-additional-items">
|
||||
<!-- Minimal view, when not set as fullscreen view -->
|
||||
<WhiteBoxCard :toggleable="pos.transactionItems.additionalItems.value && pos.transactionItems.additionalItems.value.length == 0"
|
||||
<WhiteBoxCard :toggleable="canSelectAdditionalItems && pos.transactionItems.additionalItems.value && pos.transactionItems.additionalItems.value.length == 0"
|
||||
:defaultOpen="pos.transactionItems.additionalItems.value && pos.transactionItems.additionalItems.value.length > 0"
|
||||
@toggle="onToggle"
|
||||
:forceState="(pos.transactionItems.additionalItems.value && pos.transactionItems.additionalItems.value.length > 0) ? true : (pos.views.additionalItemSelection.value)"
|
||||
@@ -201,7 +238,7 @@ const onClickAddProduct = async (product: PosProduct) => {
|
||||
</div>
|
||||
</template>
|
||||
<!-- Footer -->
|
||||
<template #footer>
|
||||
<template #footer v-if="canSelectAdditionalItems">
|
||||
<!-- Select other product button -->
|
||||
<a class="card-footer-item" data-testid="pos-mobile-additional-items-open" @click="onClickAddOtherProduct">
|
||||
<span class="icon">
|
||||
@@ -212,7 +249,7 @@ const onClickAddProduct = async (product: PosProduct) => {
|
||||
</template>
|
||||
</WhiteBoxCard>
|
||||
<!-- Fullscreen view, when selecting other products -->
|
||||
<template v-else>
|
||||
<template v-else-if="canSelectAdditionalItems">
|
||||
<div data-testid="pos-mobile-additional-items-selection">
|
||||
<!-- Categories of products -->
|
||||
<PosDepartmentStep2MobileVehicleSelection :onAddProduct="onClickAddProduct" :onSearchClick="() => console.warn('AdditionalItem Search Clicked')"/><!-- :asAddons="true" :addons="availableAdditionalItems" @update:addons="availableAdditionalItems = $event"/>-->
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@ import PosDepartmentStepMobileButtonNextStep from "@/components/displays/departm
|
||||
import SessionUser from "@/components/session/token/SessionUser.vue";
|
||||
import { PosOrder } from "@/components/displays/department/pos/steps/mobile/objects/PosOrder.vue";
|
||||
import WhiteBoxCard from "@/components/displays/boxes/WhiteBoxCard.vue";
|
||||
import { todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
// Define the close event to emit when the component is closed
|
||||
const emit = defineEmits(["close"]);
|
||||
/** Display variables */
|
||||
@@ -126,7 +127,7 @@ const liveTransactions = ref(null);
|
||||
const isLoading = ref(true);
|
||||
|
||||
const syncListTransactionHistory = async () => {
|
||||
let dateToday = new Date().toISOString().split("T")[0]; // Get today's date in YYYY-MM-DD format
|
||||
let dateToday = todayLocalDateOnly(); // Get today's date in YYYY-MM-DD format
|
||||
isLoading.value = true;
|
||||
// Fetch the list of orders created today for the current department
|
||||
SessionUser.objects.orders.get
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { formatLocalDateOnly } from '@/services/dateOnly.js';
|
||||
type startEndDate = {
|
||||
start: Date; // The start date of the range
|
||||
end: Date; // The end date of the range
|
||||
@@ -27,7 +28,7 @@ const datePresetFunctions = {
|
||||
month: {
|
||||
// Get the first day of the month based on the provided date first day at 00:00:01
|
||||
firstDayOfMonth: (date: Date): Date => {
|
||||
return new Date(date.getFullYear(), date.getMonth(), 2, 0, 0, 1, 0); // Set to the first day of the month at 00:00:01
|
||||
return new Date(date.getFullYear(), date.getMonth(), 1, 0, 0, 0, 0); // Set to the first day of the month at 00:00:00
|
||||
},
|
||||
// Get the last day of the month based on the provided date last day at 23:59:59
|
||||
lastDayOfMonth: (date: Date): Date => {
|
||||
@@ -116,7 +117,7 @@ export const datePresets = <datePreset[]>[
|
||||
*/
|
||||
|
||||
const convertToISO = (date: Date): string => {
|
||||
return date.toISOString().split('T')[0]; // Convert to YYYY-MM-DD format
|
||||
return formatLocalDateOnly(date); // Convert to YYYY-MM-DD format
|
||||
};
|
||||
|
||||
export const dateFunctions = {
|
||||
@@ -150,4 +151,4 @@ export default defineComponent({
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template></template>
|
||||
<template></template>
|
||||
|
||||
@@ -50,6 +50,7 @@ import ShowErrorField from "@/components/global/ShowErrorField.vue";
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { BSwitch } from "buefy";
|
||||
import { isUsageOrderAttachedToOrder } from "@/components/displays/department/pos/sync/xlvaskUsageFilters.js";
|
||||
import { formatLocalDateOnly, parseLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
const { t } = useI18n()
|
||||
const router = useRouter();
|
||||
@@ -63,7 +64,7 @@ const parseInitialDate = (value) => {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
const parsed = new Date(`${value}T00:00:00`);
|
||||
const parsed = parseLocalDateOnly(value);
|
||||
return Number.isNaN(parsed.getTime()) ? new Date() : parsed;
|
||||
};
|
||||
|
||||
@@ -129,7 +130,7 @@ const dateFrom = ref(parseInitialDate(props.initialDateFrom));
|
||||
const dateTo = ref(parseInitialDate(props.initialDateTo));
|
||||
|
||||
const parsedDate = (date) => {
|
||||
return new Date(date);
|
||||
return parseLocalDateOnly(date);
|
||||
};
|
||||
|
||||
const reloadScheduled = ref(false);
|
||||
@@ -148,14 +149,14 @@ const actions = {
|
||||
from: {
|
||||
select: (date) => {
|
||||
dateFrom.value = parsedDate(date);
|
||||
setFilter("StartTime-date_from", date.toISOString().split("T")[0], false);
|
||||
setFilter("StartTime-date_from", formatLocalDateOnly(date), false);
|
||||
scheduleReload();
|
||||
}
|
||||
},
|
||||
to: {
|
||||
select: (date) => {
|
||||
dateTo.value = parsedDate(date);
|
||||
setFilter("StartTime-date_to", date.toISOString().split("T")[0], false);
|
||||
setFilter("StartTime-date_to", formatLocalDateOnly(date), false);
|
||||
scheduleReload();
|
||||
}
|
||||
},
|
||||
|
||||
+4
-4
@@ -109,8 +109,8 @@ import OrdersTable from "@/components/displays/department/pos/orders/ordersTable
|
||||
import {SessionUser} from "@/components/session/token/SessionUser.vue";
|
||||
import PaginationDisplayFilters from "@/components/displays/pagination/PaginationDisplayFilters.vue";
|
||||
import DatePeriodSelector from "@/components/displays/buttons/DatePeriodSelector.vue";
|
||||
import {now} from "@vueuse/core";
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { formatLocalDateOnly, parseLocalDateOnly, todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
const { t } = useI18n()
|
||||
const router = useRouter();
|
||||
@@ -176,8 +176,8 @@ if (props.autoLoad) {
|
||||
const date_from = ref(null);
|
||||
const date_to = ref(null);
|
||||
const onDateRangeSelected = (newSelectionStartDate, newSelectionToDate) => {
|
||||
const formattedStartDate = newSelectionStartDate.toISOString().split("T")[0];
|
||||
const formattedEndDate = newSelectionToDate.toISOString().split("T")[0];
|
||||
const formattedStartDate = formatLocalDateOnly(newSelectionStartDate);
|
||||
const formattedEndDate = formatLocalDateOnly(newSelectionToDate);
|
||||
date_from.value = formattedStartDate;
|
||||
date_to.value = formattedEndDate;
|
||||
setFilter("created_at-date_from", formattedStartDate, true);
|
||||
@@ -361,7 +361,7 @@ const doesEndpointMatch = (matcher) => {
|
||||
<!-- Shortcuts for date filters -->
|
||||
<DatePeriodSelector :on-selection-change="onDateRangeSelected"
|
||||
:visibility="{ showDailySelector: false, showWeeklySelector: false, showMultipleMonthWarning: false, showUpdateButton: false, showMonthSelector: false, showStartDate: false, showEndDate: false, showSelectionValidity: false, showYearSelector: false, showToLabel: false }"
|
||||
v-bind:selection="{ startDate: date_from ? new Date(date_from) : new Date(now()), endDate: date_to ? new Date(date_to) : new Date(now()) }"/>
|
||||
v-bind:selection="{ startDate: parseLocalDateOnly(date_from || todayLocalDateOnly()), endDate: parseLocalDateOnly(date_to || todayLocalDateOnly()) }"/>
|
||||
</div>
|
||||
</template>
|
||||
<template #default>
|
||||
|
||||
@@ -28,6 +28,7 @@ import {ref, watch} from "vue";
|
||||
import { Colors } from "@/ThemeConfig.vue";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
const { t } = useI18n()
|
||||
const router = useRouter();
|
||||
@@ -52,7 +53,7 @@ watch(() => getFilter("status"), (value) => {
|
||||
// If the route starts with /user, set the endpoint to /user/bookings
|
||||
if (router.currentRoute.value.path.startsWith("/user")) {
|
||||
setEndpoint("/user/bookings", false);
|
||||
setFilter("date", new Date().toISOString().split("T")[0], false);
|
||||
setFilter("date", todayLocalDateOnly(), false);
|
||||
setOrder("created_at", "desc");
|
||||
}
|
||||
// If the route starts with /superuser, set the endpoint to /bookings
|
||||
@@ -81,7 +82,7 @@ loadList();
|
||||
const showingToday = ref(true);
|
||||
|
||||
watch(() => getFilter("date"), (value) => {
|
||||
showingToday.value = value === new Date().toISOString().split("T")[0];
|
||||
showingToday.value = value === todayLocalDateOnly();
|
||||
});
|
||||
|
||||
// If the screen is mobile, set the is small variable to true
|
||||
@@ -151,7 +152,7 @@ const showNewOrderBookingsPortal = () => {
|
||||
<label class="label">{{ isSmall ? t('common.today') : t('pagination.show_only_today') }}</label>
|
||||
<div class="control">
|
||||
<div class="field">
|
||||
<input id="today" type="checkbox" class="switch is-rounded" @change="(event) => { setFilter('date', event.target.checked ? new Date().toISOString().split('T')[0] : '*') }" checked="checked" :class="{ 'is-link': showingToday }" />
|
||||
<input id="today" type="checkbox" class="switch is-rounded" @change="(event) => { setFilter('date', event.target.checked ? todayLocalDateOnly() : '*') }" checked="checked" :class="{ 'is-link': showingToday }" />
|
||||
<label for="today"></label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -188,4 +189,4 @@ const showNewOrderBookingsPortal = () => {
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -8,6 +8,7 @@ import OrderBookingsTable from "@/views/dashboards/userDashboard/bookings/displa
|
||||
import { departments, getDepartments } from "@/components/pagination/departmentTabs.vue";
|
||||
import { Colors } from "@/ThemeConfig.vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { endOfLocalDate, startOfLocalDate, todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
const { t } = useI18n();
|
||||
/**
|
||||
@@ -52,11 +53,9 @@ const onOnlyTodayFilterChange = (event, autoLoadList = true) => {
|
||||
setFilter("datetime-date_from", null, false);
|
||||
setFilter("datetime-date_to", null, false);
|
||||
} else {
|
||||
const startOfDay = new Date().setHours(0, 0, 0, 0);
|
||||
const endOfDay = new Date().setHours(23, 59, 59, 999);
|
||||
//setFilter('datetime', null, false);
|
||||
setFilter("datetime-date_from", new Date(startOfDay).toISOString(), false);
|
||||
setFilter("datetime-date_to", new Date(endOfDay).toISOString(), false);
|
||||
setFilter("datetime-date_from", startOfLocalDate(val).toISOString(), false);
|
||||
setFilter("datetime-date_to", endOfLocalDate(val).toISOString(), false);
|
||||
}
|
||||
if (autoLoadList) {
|
||||
loadList();
|
||||
@@ -95,7 +94,7 @@ onMounted(() => {
|
||||
departmentFilter.value = value;
|
||||
} else if (key === "only_today" && value === true) {
|
||||
setFilterKey = false; // Since the only_today filter is handled separately
|
||||
onOnlyTodayFilterChange({ target: { value: new Date().toISOString().split("T")[0] } }, false);
|
||||
onOnlyTodayFilterChange({ target: { value: todayLocalDateOnly() } }, false);
|
||||
}
|
||||
if (setFilterKey) {
|
||||
setFilter(key, value, false);
|
||||
@@ -170,7 +169,7 @@ onMounted(() => {
|
||||
<div class="select">
|
||||
<select :value="onlyTodayFilter" @change="onOnlyTodayFilterChange">
|
||||
<option value="*">{{ t("common.all") }}</option>
|
||||
<option :value="new Date().toISOString().split('T')[0]">{{ t("common.yes") }}</option>
|
||||
<option :value="todayLocalDateOnly()">{{ t("common.yes") }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -193,7 +192,7 @@ onMounted(() => {
|
||||
@change="
|
||||
(event) => {
|
||||
onOnlyTodayFilterChange({
|
||||
target: { value: event.target.checked ? new Date().toISOString().split('T')[0] : '*' },
|
||||
target: { value: event.target.checked ? todayLocalDateOnly() : '*' },
|
||||
});
|
||||
}
|
||||
"
|
||||
@@ -226,7 +225,7 @@ onMounted(() => {
|
||||
@change="
|
||||
(event) => {
|
||||
onOnlyTodayFilterChange(
|
||||
{ target: { value: event.target.checked ? new Date().toISOString().split('T')[0] : '*' } },
|
||||
{ target: { value: event.target.checked ? todayLocalDateOnly() : '*' } },
|
||||
false
|
||||
);
|
||||
onOrderIdFilterChange({ target: { value: event.target.checked ? 'is null' : '*' } });
|
||||
|
||||
@@ -52,6 +52,10 @@ loadList();
|
||||
:columnLabels="{ type: SessionUser.objects.vehicles.columns.type.label }"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="$slots.actions" class="vehicles-pagination__add-action">
|
||||
<label class="label is-small"> </label>
|
||||
<slot name="actions" />
|
||||
</div>
|
||||
<!-- Create a new vehicle, if the route is /user -->
|
||||
<div class="vehicles-pagination__add-action"
|
||||
v-if="router.currentRoute.value.path.startsWith('/user')">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import PaginationDisplayItemColumn from "@/components/displays/pagination/PaginationDisplayItemColumn.vue";
|
||||
import { ref, computed } from "vue";
|
||||
import { computed } from "vue";
|
||||
import { formatLocalDateOnly, parseLocalDateOnly } from "@/services/dateOnly.js";
|
||||
const props = defineProps({
|
||||
label: {
|
||||
type: String,
|
||||
@@ -19,7 +20,7 @@ defineExpose({
|
||||
});
|
||||
|
||||
const formattedDate = computed(() => {
|
||||
return date.value.toISOString().split('T')[0];
|
||||
return formatLocalDateOnly(date.value);
|
||||
});
|
||||
|
||||
// This component is used to display a date input in a pagination display item column.
|
||||
@@ -36,8 +37,7 @@ const formattedDate = computed(() => {
|
||||
class="input"
|
||||
:value="formattedDate"
|
||||
@input="(e) => {
|
||||
const newDate = new Date(e.target.value);
|
||||
console.log('Selected date:', newDate);
|
||||
const newDate = parseLocalDateOnly(e.target.value);
|
||||
emit('update:date', newDate);
|
||||
}"
|
||||
/>
|
||||
@@ -47,4 +47,4 @@ const formattedDate = computed(() => {
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { SessionUser } from '@/components/session/token/SessionUser.vue';
|
||||
|
||||
@@ -10,7 +9,7 @@ import PaginationDisplayTemplateButton
|
||||
from "@/components/displays/pagination/templates/PaginationDisplayTemplateButton.vue";
|
||||
import { datePresets , dateFunctions} from '@/components/displays/pagination/PaginationDisplayDates.vue';
|
||||
|
||||
const props = defineProps({
|
||||
defineProps({
|
||||
startDate: {
|
||||
type: Date,
|
||||
required: true,
|
||||
@@ -46,6 +45,7 @@ function updateStartDate(date: Date) {
|
||||
// Update the end date model when the date is changed
|
||||
function updateEndDate(date: Date) {
|
||||
endDateModel.value = date;
|
||||
emits('update:endDate', date);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -79,4 +79,4 @@ function updateEndDate(date: Date) {
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -13,6 +13,7 @@ import { showDownloadWashCertificate } from "@/components/shop/DownloadWashCerti
|
||||
import { authenticatedRequest } from "@/components/session/authenticatedRequest.vue";
|
||||
import Swal from 'sweetalert2';
|
||||
import EditableTableColumn from "@/components/displays/buttons/EditableTableColumn.vue";
|
||||
import { todayLocalDateOnly, yesterdayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
const redirectBookingObjectPage = (objectId) => {
|
||||
// Send the user to the object page
|
||||
window.location.href = `/user/bookings/${objectId}`;
|
||||
@@ -237,7 +238,8 @@ window.addEventListener('resize', () => {
|
||||
* To organize the bookings, we want to show the bookings that are created today first, then yesterday, then all other days
|
||||
* @type {string}
|
||||
*/
|
||||
const currentDate = new Date().toISOString().split("T")[0];
|
||||
const currentDate = todayLocalDateOnly();
|
||||
const previousDate = yesterdayLocalDateOnly();
|
||||
|
||||
/**
|
||||
* Sort the bookings by date
|
||||
@@ -362,7 +364,7 @@ const canUserEditObject = (object) => {
|
||||
</span>
|
||||
<span class="has-text-grey">
|
||||
<!-- Human readable date (Today, Yesterday, etc.) -->
|
||||
{{ object.date === currentDate ? $t('tables.bookings.today') : object.date === new Date(new Date().setDate(new Date().getDate() - 1)).toISOString().split("T")[0] ? $t('tables.bookings.yesterday') : object.date }}
|
||||
{{ object.date === currentDate ? $t('tables.bookings.today') : object.date === previousDate ? $t('tables.bookings.yesterday') : object.date }}
|
||||
<!-- Number of bookings on the date -->
|
||||
({{ $t('tables.bookings.bookings_count', { count: objects.filter((booking) => booking.date === object.date).length }) }})
|
||||
</span>
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
getProductsCategory,
|
||||
loadOrderItems,
|
||||
productCategoryAllowed,
|
||||
isProductRestricted,
|
||||
setProductsCategory,
|
||||
getUserProductDiscount,
|
||||
showFakeCreateOrderItem,
|
||||
@@ -13,7 +14,8 @@ import {
|
||||
getUserGlobalDiscount,
|
||||
getUserDiscounts,
|
||||
customer_id,
|
||||
customer_attributes
|
||||
customer_attributes,
|
||||
loadCustomerAttributes
|
||||
} from "@/components/shop/POSDepartmentProcess.vue";
|
||||
import {getProductCategory, getProducts} from "@/components/shop/Products.vue";
|
||||
import {createOrderItem} from "@/components/shop/OrdersItems.vue";
|
||||
@@ -151,6 +153,10 @@ const fetchProductsForCategory = async ({
|
||||
products.value = [];
|
||||
|
||||
try {
|
||||
if (customerNumber) {
|
||||
await loadCustomerAttributes(customerNumber);
|
||||
}
|
||||
|
||||
const response = normalizedCategory === null
|
||||
? await getProducts(departmentId, props.finalPrice, customerNumber)
|
||||
: await getProductCategory(normalizedCategory, departmentId, props.finalPrice, customerNumber);
|
||||
@@ -593,7 +599,7 @@ const getRecommendedProductPrice = (productId) => {
|
||||
|
||||
const isRecommendedProductCategoryAllowed = (productId) => {
|
||||
const product = getProductById(productId);
|
||||
return !!product && productCategoryAllowed(product.category);
|
||||
return !!product && !isProductRestricted(product);
|
||||
};
|
||||
|
||||
const addRecommendedProductToOrder = async (productId) => {
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
<script setup>
|
||||
import { computed, nextTick, onMounted, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import CustomerSearchSelect from "@/components/search/economic/CustomerSearchSelect.vue";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
|
||||
const emit = defineEmits(["close", "created"]);
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const selectedCustomer = ref(null);
|
||||
const registrationNumber = ref("");
|
||||
const vehicleType = ref("");
|
||||
const washSubscription = ref(false);
|
||||
const reference = ref("");
|
||||
const vehicleTypeOptions = ref([]);
|
||||
const isLoadingVehicleTypes = ref(false);
|
||||
const isSubmitting = ref(false);
|
||||
const errorMessage = ref("");
|
||||
const vehicleTypeError = ref("");
|
||||
|
||||
const getCustomerNumber = (customer) => {
|
||||
const parsedValue = Number.parseInt(
|
||||
String(customer?.customerNumber ?? customer?.customer_number ?? customer?.customer_id ?? customer?.id ?? ""),
|
||||
10
|
||||
);
|
||||
|
||||
return Number.isInteger(parsedValue) && parsedValue > 0 ? parsedValue : null;
|
||||
};
|
||||
|
||||
const selectedCustomerNumber = computed(() => getCustomerNumber(selectedCustomer.value));
|
||||
|
||||
const normalizedVehicleType = computed(() => {
|
||||
if (vehicleType.value === "") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const parsedValue = Number.parseInt(String(vehicleType.value), 10);
|
||||
return Number.isInteger(parsedValue) && parsedValue >= 0 ? parsedValue : null;
|
||||
});
|
||||
|
||||
const normalizedRegistrationNumber = computed(() => {
|
||||
return registrationNumber.value.trim().toUpperCase();
|
||||
});
|
||||
|
||||
const canSubmit = computed(() => {
|
||||
return (
|
||||
!isSubmitting.value &&
|
||||
!isLoadingVehicleTypes.value &&
|
||||
selectedCustomerNumber.value !== null &&
|
||||
normalizedRegistrationNumber.value.length > 0 &&
|
||||
normalizedVehicleType.value !== null
|
||||
);
|
||||
});
|
||||
|
||||
const parseErrorMessage = (error) => {
|
||||
return SessionUser.functions.parseErrorMessage(error) || t("vehicles.add_modal.error");
|
||||
};
|
||||
|
||||
const loadVehicleTypes = async () => {
|
||||
isLoadingVehicleTypes.value = true;
|
||||
vehicleTypeError.value = "";
|
||||
|
||||
try {
|
||||
vehicleTypeOptions.value = await SessionUser.objects.vehicles.columns.type.options();
|
||||
} catch (error) {
|
||||
vehicleTypeError.value = parseErrorMessage(error) || t("vehicles.add_modal.type_load_error");
|
||||
} finally {
|
||||
isLoadingVehicleTypes.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const closeModal = () => {
|
||||
if (!isSubmitting.value) {
|
||||
emit("close");
|
||||
}
|
||||
};
|
||||
|
||||
const submitVehicle = async () => {
|
||||
if (!canSubmit.value) {
|
||||
errorMessage.value = t("vehicles.add_modal.validation_error");
|
||||
return;
|
||||
}
|
||||
|
||||
isSubmitting.value = true;
|
||||
errorMessage.value = "";
|
||||
|
||||
try {
|
||||
const response = await SessionUser.objects.vehicles.add(
|
||||
normalizedVehicleType.value,
|
||||
normalizedRegistrationNumber.value,
|
||||
washSubscription.value,
|
||||
selectedCustomerNumber.value,
|
||||
reference.value.trim() || null
|
||||
);
|
||||
|
||||
emit("created", response);
|
||||
} catch (error) {
|
||||
errorMessage.value = parseErrorMessage(error);
|
||||
} finally {
|
||||
isSubmitting.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
await loadVehicleTypes();
|
||||
await nextTick();
|
||||
document.getElementById("superuser-add-vehicle-customer-search")?.focus();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="modal is-active" data-testid="superuser-add-vehicle-modal">
|
||||
<div class="modal-background" @click="closeModal"></div>
|
||||
<div class="modal-card superuser-add-vehicle-modal">
|
||||
<header class="modal-card-head">
|
||||
<p class="modal-card-title">{{ t("vehicles.add_modal.title") }}</p>
|
||||
<button
|
||||
class="delete"
|
||||
type="button"
|
||||
:aria-label="t('common.close')"
|
||||
data-testid="superuser-add-vehicle-close"
|
||||
@click="closeModal"
|
||||
></button>
|
||||
</header>
|
||||
|
||||
<section class="modal-card-body">
|
||||
<div v-if="errorMessage" class="notification is-danger is-light" data-testid="superuser-add-vehicle-error">
|
||||
{{ errorMessage }}
|
||||
</div>
|
||||
|
||||
<CustomerSearchSelect
|
||||
v-model="selectedCustomer"
|
||||
input-id="superuser-add-vehicle-customer-search"
|
||||
test-id-prefix="superuser-add-vehicle-customer"
|
||||
:disabled="isSubmitting"
|
||||
:placeholder="t('vehicles.add_modal.customer_placeholder')"
|
||||
/>
|
||||
|
||||
<div class="field">
|
||||
<label class="label" for="superuser-add-vehicle-registration">{{ t("vehicles.form.license_plate") }}</label>
|
||||
<div class="control">
|
||||
<input
|
||||
id="superuser-add-vehicle-registration"
|
||||
v-model="registrationNumber"
|
||||
class="input"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
:placeholder="t('vehicles.add_modal.registration_placeholder')"
|
||||
:disabled="isSubmitting"
|
||||
data-testid="superuser-add-vehicle-registration"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label" for="superuser-add-vehicle-type">{{ t("vehicles.form.type") }}</label>
|
||||
<div class="control" :class="{ 'is-loading': isLoadingVehicleTypes }">
|
||||
<div class="select is-fullwidth">
|
||||
<select
|
||||
id="superuser-add-vehicle-type"
|
||||
v-model="vehicleType"
|
||||
:disabled="isSubmitting || isLoadingVehicleTypes || vehicleTypeOptions.length === 0"
|
||||
data-testid="superuser-add-vehicle-type"
|
||||
>
|
||||
<option disabled value="">{{ t("vehicles.add_modal.type_placeholder") }}</option>
|
||||
<option v-for="option in vehicleTypeOptions" :key="option.id" :value="option.id">
|
||||
{{ option.name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="vehicleTypeError" class="help is-danger" data-testid="superuser-add-vehicle-type-error">
|
||||
{{ vehicleTypeError }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="checkbox">
|
||||
<input
|
||||
v-model="washSubscription"
|
||||
type="checkbox"
|
||||
:disabled="isSubmitting"
|
||||
data-testid="superuser-add-vehicle-wash-subscription"
|
||||
/>
|
||||
{{ t("objects.vehicles.columns.wash_subscription") }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label" for="superuser-add-vehicle-reference">{{ t("common.reference") }}</label>
|
||||
<div class="control">
|
||||
<input
|
||||
id="superuser-add-vehicle-reference"
|
||||
v-model="reference"
|
||||
class="input"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
:placeholder="t('vehicles.add_modal.reference_placeholder')"
|
||||
:disabled="isSubmitting"
|
||||
data-testid="superuser-add-vehicle-reference"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer class="modal-card-foot is-justify-content-flex-end">
|
||||
<button
|
||||
class="button"
|
||||
type="button"
|
||||
:disabled="isSubmitting"
|
||||
data-testid="superuser-add-vehicle-cancel"
|
||||
@click="closeModal"
|
||||
>
|
||||
{{ t("common.cancel") }}
|
||||
</button>
|
||||
<button
|
||||
class="button is-link"
|
||||
type="button"
|
||||
:class="{ 'is-loading': isSubmitting }"
|
||||
:disabled="!canSubmit"
|
||||
data-testid="superuser-add-vehicle-submit"
|
||||
@click="submitVehicle"
|
||||
>
|
||||
{{ t("vehicles.add_modal.submit") }}
|
||||
</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.superuser-add-vehicle-modal {
|
||||
max-width: min(44rem, calc(100vw - 2rem));
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.modal-card-body {
|
||||
overflow: visible;
|
||||
}
|
||||
</style>
|
||||
@@ -19,17 +19,17 @@ const SENSITIVE_QUERY_KEYS = /authorization|password|passwd|secret|token|api[_-]
|
||||
const FALLBACK_LABELS = {
|
||||
"error_report.button": "Report error",
|
||||
"error_report.title": "Report error",
|
||||
"error_report.subtitle": "Send the current screen and recent error details to support.",
|
||||
"error_report.subtitle": "Send recent error details to support. A screenshot is attached when available.",
|
||||
"error_report.before_error": "What were you doing before the error occurred?",
|
||||
"error_report.expected": "What did you expect would happen?",
|
||||
"error_report.actual": "What actually happened?",
|
||||
"error_report.before_error_placeholder": "Describe the action you were taking, for example opening orders or selecting a customer.",
|
||||
"error_report.expected_placeholder": "Describe the result you expected to see.",
|
||||
"error_report.actual_placeholder": "Describe what you saw instead, including any error text.",
|
||||
"error_report.consent": "I accept that the current app screen, recent request errors, Vue errors, browser details, and my answers are collected for troubleshooting.",
|
||||
"error_report.consent": "I accept that recent request errors, Vue errors, browser details, my answers, and an app screenshot when available are collected for troubleshooting.",
|
||||
"error_report.submit": "Submit report",
|
||||
"error_report.submitted": "Error report submitted.",
|
||||
"error_report.capture_failed": "The screen capture failed. Please try again.",
|
||||
"error_report.capture_failed": "The screen capture failed. The report will be sent without a screenshot.",
|
||||
"error_report.submit_failed": "The error report could not be submitted.",
|
||||
"error_report.required": "All fields and data collection acceptance are required.",
|
||||
};
|
||||
@@ -277,15 +277,18 @@ const submit = async () => {
|
||||
|
||||
isSubmitting.value = true;
|
||||
try {
|
||||
let screenshot = "";
|
||||
let screenshot = null;
|
||||
try {
|
||||
screenshot = await captureScreenshot();
|
||||
} catch {
|
||||
captureError.value = tr("error_report.capture_failed");
|
||||
return;
|
||||
}
|
||||
|
||||
const context = buildContext();
|
||||
context.screenshot_attachment = {
|
||||
status: screenshot ? "stored" : "capture_failed",
|
||||
attached: Boolean(screenshot),
|
||||
};
|
||||
await submitErrorReport({
|
||||
before_error: form.before_error.trim(),
|
||||
expected: form.expected.trim(),
|
||||
@@ -340,7 +343,7 @@ const submit = async () => {
|
||||
<div v-if="submitted" class="notification is-success is-light" data-testid="error-report-submitted">
|
||||
{{ tr("error_report.submitted") }}
|
||||
</div>
|
||||
<div v-if="captureError" class="notification is-danger is-light">
|
||||
<div v-if="captureError" class="notification is-warning is-light" data-testid="error-report-capture-warning">
|
||||
{{ captureError }}
|
||||
</div>
|
||||
<div v-if="submitError" class="notification is-danger is-light">
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ref, watch, onMounted } from "vue";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { isAccessibleVisibleNamedDepartment, sortByDepartmentPriorityOrder } from "@/services/departmentVisibility.js";
|
||||
import { todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
// Get the department ID from the URL
|
||||
const route = useRoute();
|
||||
const department_id = route.params.departmentId || SessionUser.functions.getDepartmentIdFromUrl() || null;
|
||||
@@ -73,9 +74,9 @@ const emphasis = ref({
|
||||
"department:" +
|
||||
department_id +
|
||||
",status:pending,date-date_from:" +
|
||||
new Date().toISOString().split("T")[0] +
|
||||
todayLocalDateOnly() +
|
||||
",date-date_to:" +
|
||||
new Date().toISOString().split("T")[0],
|
||||
todayLocalDateOnly(),
|
||||
limit: 1, // Limit to 1 booking, we only need to know if there are any bookings or not
|
||||
page: 1,
|
||||
})
|
||||
@@ -97,7 +98,7 @@ const emphasis = ref({
|
||||
* Check if the department has a daily report for today
|
||||
*/
|
||||
SessionUser.request(SessionUser.objects.department_daily_reports.meta.endpoint + "/get", "GET", {
|
||||
date: new Date().toISOString().split("T")[0],
|
||||
date: todayLocalDateOnly(),
|
||||
id: department_id, // This refers to the department ID
|
||||
})
|
||||
.then((response) => {
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
<script setup>
|
||||
import { computed, nextTick, onBeforeUnmount, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { isSearching, searchCustomer, searchCustomerResults } from "@/components/search/economic/customerSearch.vue";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
inputId: {
|
||||
type: String,
|
||||
default: "customer-search-select-input",
|
||||
},
|
||||
testIdPrefix: {
|
||||
type: String,
|
||||
default: "customer-search-select",
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "selected", "cleared"]);
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const searchQuery = ref("");
|
||||
const showResults = ref(false);
|
||||
const selectedResultIndex = ref(-1);
|
||||
|
||||
const getCustomerNumber = (customer) => {
|
||||
const parsedValue = Number.parseInt(
|
||||
String(customer?.customerNumber ?? customer?.customer_number ?? customer?.customer_id ?? customer?.id ?? ""),
|
||||
10
|
||||
);
|
||||
|
||||
return Number.isInteger(parsedValue) && parsedValue > 0 ? parsedValue : null;
|
||||
};
|
||||
|
||||
const getCustomerName = (customer) => {
|
||||
return String(customer?.name ?? customer?.customer_name ?? customer?.customerName ?? "").trim();
|
||||
};
|
||||
|
||||
const getCustomerCity = (customer) => {
|
||||
return String(customer?.city ?? customer?.address_city ?? "").trim();
|
||||
};
|
||||
|
||||
const formatCustomer = (customer) => {
|
||||
if (!customer) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const name = getCustomerName(customer);
|
||||
const customerNumber = getCustomerNumber(customer);
|
||||
|
||||
return [name, customerNumber ? `#${customerNumber}` : null].filter(Boolean).join(" - ");
|
||||
};
|
||||
|
||||
const selectedCustomerNumber = computed(() => getCustomerNumber(props.modelValue));
|
||||
const selectedCustomerName = computed(() => getCustomerName(props.modelValue));
|
||||
const selectedCustomerCity = computed(() => getCustomerCity(props.modelValue));
|
||||
const hasResults = computed(() => searchCustomerResults.value.length > 0);
|
||||
const placeholderText = computed(() => props.placeholder || t("vehicles.add_modal.customer_placeholder"));
|
||||
|
||||
const resetSearchResults = () => {
|
||||
searchCustomer(null);
|
||||
selectedResultIndex.value = -1;
|
||||
};
|
||||
|
||||
const setSelectedCustomer = (customer) => {
|
||||
emit("update:modelValue", customer);
|
||||
emit("selected", customer);
|
||||
searchQuery.value = formatCustomer(customer);
|
||||
showResults.value = false;
|
||||
selectedResultIndex.value = -1;
|
||||
};
|
||||
|
||||
const clearSelectedCustomer = async () => {
|
||||
emit("update:modelValue", null);
|
||||
emit("cleared");
|
||||
searchQuery.value = "";
|
||||
showResults.value = false;
|
||||
resetSearchResults();
|
||||
await nextTick();
|
||||
document.getElementById(props.inputId)?.focus();
|
||||
};
|
||||
|
||||
const handleSearchInput = () => {
|
||||
if (props.modelValue) {
|
||||
emit("update:modelValue", null);
|
||||
}
|
||||
|
||||
const query = searchQuery.value.trim();
|
||||
selectedResultIndex.value = -1;
|
||||
|
||||
if (!query) {
|
||||
showResults.value = false;
|
||||
resetSearchResults();
|
||||
return;
|
||||
}
|
||||
|
||||
showResults.value = true;
|
||||
searchCustomer(query);
|
||||
};
|
||||
|
||||
const handleFocus = () => {
|
||||
if (searchQuery.value.trim() && hasResults.value) {
|
||||
showResults.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
const handleBlur = () => {
|
||||
window.setTimeout(() => {
|
||||
showResults.value = false;
|
||||
selectedResultIndex.value = -1;
|
||||
}, 150);
|
||||
};
|
||||
|
||||
const handleKeydown = (event) => {
|
||||
if (!showResults.value || !hasResults.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.key === "ArrowDown") {
|
||||
event.preventDefault();
|
||||
selectedResultIndex.value = Math.min(selectedResultIndex.value + 1, searchCustomerResults.value.length - 1);
|
||||
} else if (event.key === "ArrowUp") {
|
||||
event.preventDefault();
|
||||
selectedResultIndex.value = Math.max(selectedResultIndex.value - 1, 0);
|
||||
} else if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
const selectedCustomer = searchCustomerResults.value[selectedResultIndex.value] || searchCustomerResults.value[0];
|
||||
if (selectedCustomer) {
|
||||
setSelectedCustomer(selectedCustomer);
|
||||
}
|
||||
} else if (event.key === "Escape") {
|
||||
showResults.value = false;
|
||||
selectedResultIndex.value = -1;
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(customer) => {
|
||||
if (customer) {
|
||||
searchQuery.value = formatCustomer(customer);
|
||||
} else if (!document.activeElement || document.activeElement.id !== props.inputId) {
|
||||
searchQuery.value = "";
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
resetSearchResults();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="customer-search-select">
|
||||
<div class="field">
|
||||
<label class="label" :for="inputId">{{ t("vehicles.add_modal.customer_label") }}</label>
|
||||
<div class="control has-icons-left" :class="{ 'is-loading': isSearching }">
|
||||
<input
|
||||
:id="inputId"
|
||||
v-model="searchQuery"
|
||||
class="input"
|
||||
type="text"
|
||||
autocomplete="off"
|
||||
:placeholder="placeholderText"
|
||||
:disabled="disabled"
|
||||
:aria-expanded="showResults && hasResults"
|
||||
:data-testid="`${testIdPrefix}-input`"
|
||||
@input="handleSearchInput"
|
||||
@focus="handleFocus"
|
||||
@blur="handleBlur"
|
||||
@keydown="handleKeydown"
|
||||
/>
|
||||
<span class="icon is-left">
|
||||
<i class="fas fa-search"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="showResults && hasResults"
|
||||
class="dropdown is-active customer-search-select__dropdown"
|
||||
:data-testid="`${testIdPrefix}-results`"
|
||||
>
|
||||
<div class="dropdown-menu customer-search-select__menu" role="listbox">
|
||||
<div class="dropdown-content">
|
||||
<button
|
||||
v-for="(customer, index) in searchCustomerResults"
|
||||
:key="getCustomerNumber(customer) || index"
|
||||
type="button"
|
||||
class="dropdown-item customer-search-select__option"
|
||||
:class="{ 'is-active': selectedResultIndex === index }"
|
||||
:data-testid="`${testIdPrefix}-option-${index}`"
|
||||
@mousedown.prevent="setSelectedCustomer(customer)"
|
||||
>
|
||||
<span class="customer-search-select__option-main">{{ getCustomerName(customer) }}</span>
|
||||
<span class="customer-search-select__option-meta">
|
||||
#{{ getCustomerNumber(customer) }}
|
||||
<template v-if="getCustomerCity(customer)"> · {{ getCustomerCity(customer) }}</template>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="modelValue" class="customer-search-select__selected" :data-testid="`${testIdPrefix}-selected`">
|
||||
<div>
|
||||
<p class="has-text-weight-semibold">{{ t("vehicles.add_modal.selected_customer") }}</p>
|
||||
<p>{{ selectedCustomerName }}</p>
|
||||
<p class="is-size-7 has-text-grey">
|
||||
#{{ selectedCustomerNumber }}
|
||||
<span v-if="selectedCustomerCity"> · {{ selectedCustomerCity }}</span>
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="button is-small is-light"
|
||||
:disabled="disabled"
|
||||
:data-testid="`${testIdPrefix}-clear`"
|
||||
@click="clearSelectedCustomer"
|
||||
>
|
||||
{{ t("common.clear") }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.customer-search-select {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.customer-search-select__dropdown,
|
||||
.customer-search-select__menu {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.customer-search-select__dropdown {
|
||||
left: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 4.75rem;
|
||||
z-index: 40;
|
||||
}
|
||||
|
||||
.customer-search-select__option {
|
||||
align-items: flex-start;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-align: left;
|
||||
white-space: normal;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.customer-search-select__option-main {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.customer-search-select__option-meta {
|
||||
color: #6b7280;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.customer-search-select__selected {
|
||||
align-items: flex-start;
|
||||
background: #f5f8fc;
|
||||
border: 1px solid #d8e2ef;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 1rem;
|
||||
padding: 0.85rem 1rem;
|
||||
}
|
||||
</style>
|
||||
@@ -5,6 +5,7 @@ import { ObjectsGlobal } from "@/components/session/token/SessionUser/Objects/Ob
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import {ref} from "vue";
|
||||
import i18n from '@/i18n';
|
||||
import { todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
const t = (key) => i18n.global.t(key);
|
||||
|
||||
@@ -241,7 +242,7 @@ export const Bookings = {
|
||||
'/bookings',
|
||||
'GET',
|
||||
{
|
||||
filters: `department:${department},status:pending,date-date_from:${new Date().toISOString().split('T')[0]},date-date_to:${new Date().toISOString().split('T')[0]}`,
|
||||
filters: `department:${department},status:pending,date-date_from:${todayLocalDateOnly()},date-date_to:${todayLocalDateOnly()}`,
|
||||
limit: 100,
|
||||
page: 1
|
||||
}
|
||||
@@ -289,4 +290,4 @@ export const Bookings = {
|
||||
);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ObjectsGlobal } from "@/components/session/token/SessionUser/Objects/Ob
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import {ref} from "vue";
|
||||
import i18n from '@/i18n';
|
||||
import { todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
const t = (key) => i18n.global.t(key);
|
||||
|
||||
@@ -80,7 +81,7 @@ const t = (key) => i18n.global.t(key);
|
||||
water_usage_morning: parseInt(water_usage_morning),
|
||||
water_usage: parseInt(water_usage),
|
||||
notes: notes ? notes : 'Daily report',
|
||||
date: date ? date : new Date().toISOString().split('T')[0]
|
||||
date: date ? date : todayLocalDateOnly()
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script>
|
||||
import { ObjectsGlobal } from "@/components/session/token/SessionUser/Objects/ObjectsGlobal.vue";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import { formatLocalDateOnly, todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
/**
|
||||
* The DepartmentTimeBookingsEntries object
|
||||
@@ -230,10 +231,10 @@ export const DepartmentTimeBookingsEntries = {
|
||||
if (!dateFrom) {
|
||||
const lastWeek = new Date();
|
||||
lastWeek.setDate(lastWeek.getDate() - 7);
|
||||
dateFrom = lastWeek.toISOString().split('T')[0]; // Format as YYYY-MM-DD
|
||||
dateFrom = formatLocalDateOnly(lastWeek); // Format as YYYY-MM-DD
|
||||
}
|
||||
if (!dateTo) {
|
||||
dateTo = new Date().toISOString().split('T')[0]; // Format as YYYY-MM-DD
|
||||
dateTo = todayLocalDateOnly(); // Format as YYYY-MM-DD
|
||||
}
|
||||
console.log("Fetching public available times for department:", departmentId, "from", dateFrom, "to", dateTo);
|
||||
// Make the request to fetch public available times for the department
|
||||
@@ -279,4 +280,4 @@ export const DepartmentTimeBookingsEntries = {
|
||||
);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -108,6 +108,14 @@ export const Departments = {
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
custom_pricing_only: {
|
||||
label: t("objects.departments.columns.custom_pricing_only"),
|
||||
type: "boolean",
|
||||
sortable: true,
|
||||
creation: {
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
longitude: {
|
||||
label: t("objects.departments.columns.longitude"),
|
||||
type: "number",
|
||||
@@ -164,6 +172,14 @@ export const Departments = {
|
||||
archived: async (id, archived) => {
|
||||
return ObjectsGlobal.set.column(Departments.meta.endpoint, id, "archived", ObjectsGlobal.parse.boolean(archived));
|
||||
},
|
||||
custom_pricing_only: async (id, custom_pricing_only) => {
|
||||
return ObjectsGlobal.set.column(
|
||||
Departments.meta.endpoint,
|
||||
id,
|
||||
"custom_pricing_only",
|
||||
ObjectsGlobal.parse.boolean(custom_pricing_only)
|
||||
);
|
||||
},
|
||||
longitude: async (id, longitude) => {
|
||||
return ObjectsGlobal.set.column(Departments.meta.endpoint, id, "longitude", parseFloat(longitude));
|
||||
},
|
||||
|
||||
@@ -10,6 +10,10 @@ import { getAttributes } from "@/components/shop/CustomerAttributes.vue";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import { authenticatedRequest } from "@/components/session/authenticatedRequest.vue";
|
||||
import { doesOrderContainWashCertificateProduct } from "@/components/displays/department/pos/utils/washCertificate.js";
|
||||
import {
|
||||
isProductCategoryRestrictedForCustomer,
|
||||
isProductRestrictedForCustomer,
|
||||
} from "@/features/customer/customerProductRules.js";
|
||||
import Swal from "sweetalert2";
|
||||
|
||||
/**
|
||||
@@ -153,6 +157,8 @@ export const nextStep = async (options = { isMobile: false, orderCreation: true
|
||||
clearErrors();
|
||||
// If the current step is 1, create the order
|
||||
if (step.value === 1) {
|
||||
await loadCustomerAttributes(customer_id.value);
|
||||
|
||||
if (normalizedOptions.orderCreation === false) {
|
||||
step.value++;
|
||||
return;
|
||||
@@ -1613,24 +1619,7 @@ export const customerUsesPONumbers = () => {
|
||||
|
||||
/** Check if the product category is allowed */
|
||||
export const productCategoryAllowed = (category) => {
|
||||
// Check if the product category is the addons category
|
||||
if (category === "addons") {
|
||||
// Check if the customer has the attribute restrictAdditionalServices
|
||||
return !hasAttribute("restrictAdditionalServices");
|
||||
}
|
||||
if (category === "spot_free") {
|
||||
// Check if the customer has the attribute restrictSpotFree
|
||||
return !hasAttribute("restrictSpotFree");
|
||||
}
|
||||
if (category === "interior_cleaning") {
|
||||
// Check if the customer has the attribute restrictInteriorCleaning
|
||||
return !hasAttribute("restrictInteriorCleaning");
|
||||
}
|
||||
if (category === "tank_cleaning") {
|
||||
// Check if the customer has the attribute restrictTankCleaning
|
||||
return !hasAttribute("restrictTankCleaning");
|
||||
}
|
||||
return true;
|
||||
return !isProductCategoryRestrictedForCustomer(category, customer_attributes.value);
|
||||
};
|
||||
|
||||
/** Check if the customer should be billed per order, or per billing period */
|
||||
@@ -1676,43 +1665,12 @@ export const hasOnlyTankCleaning = () => {
|
||||
|
||||
/** Check if a product is restricted based on customer attributes */
|
||||
export const isProductRestricted = (product) => {
|
||||
if (!product) return false;
|
||||
const productName = (product.name || "").toLowerCase();
|
||||
|
||||
// Check if the product has "Spot Free" in the name
|
||||
if (!canBuySpotFree() && productName.includes("spot free")) {
|
||||
return true;
|
||||
}
|
||||
// Check if the product has "Indvendig vask" in the name
|
||||
if (!canBuyInteriorCleaning() && productName.includes("indvendig vask")) {
|
||||
return true;
|
||||
}
|
||||
// Check if the product category is 5 (Tank Cleaning)
|
||||
if (product.category === 5) {
|
||||
if (!canBuyTankCleaning()) {
|
||||
return true;
|
||||
}
|
||||
if (!hasOnlyTankCleaning()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return isProductRestrictedForCustomer(product, customer_attributes.value);
|
||||
};
|
||||
|
||||
/** Check if an addon is restricted based on customer attributes */
|
||||
export const isAddonRestricted = (addon) => {
|
||||
if (!addon) return false;
|
||||
const addonName = (addon.name || "").toLowerCase();
|
||||
|
||||
// Check if the addon has "Spot Free" in the name
|
||||
if (!canBuySpotFree() && addonName.includes("spot free")) {
|
||||
return true;
|
||||
}
|
||||
// Check if the addon has "Indvendig vask" in the name
|
||||
if (!canBuyInteriorCleaning() && addonName.includes("indvendig vask")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return isProductRestrictedForCustomer(addon, customer_attributes.value);
|
||||
};
|
||||
|
||||
export function loadOrderDetails(onAfterSuccess = null, options = {}) {
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
const TANK_CLEANING_TERMS = ["tank cleaning", "tankcleaning", "tankrens"];
|
||||
|
||||
const normalizeAttributeName = (attribute) => {
|
||||
if (typeof attribute === "string") {
|
||||
return attribute;
|
||||
}
|
||||
|
||||
return String(attribute?.attribute ?? "");
|
||||
};
|
||||
|
||||
export const hasCustomerAttribute = (attributes, attributeName) => {
|
||||
if (!Array.isArray(attributes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return attributes.some((attribute) => normalizeAttributeName(attribute) === attributeName);
|
||||
};
|
||||
|
||||
const normalizedText = (value) => String(value ?? "").trim().toLowerCase();
|
||||
|
||||
const textContainsAny = (value, terms) => {
|
||||
const text = normalizedText(value);
|
||||
return terms.some((term) => term !== "" && text.includes(term));
|
||||
};
|
||||
|
||||
export const isTankCleaningCategory = (category) => {
|
||||
if (Number(category) === 5) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return textContainsAny(category, ["tank_cleaning", ...TANK_CLEANING_TERMS]);
|
||||
};
|
||||
|
||||
export const isTankCleaningProduct = (product) => {
|
||||
if (!product) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isTankCleaningCategory(product.category ?? product.product_category)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return textContainsAny(
|
||||
[
|
||||
product.name,
|
||||
product.product_name,
|
||||
product.category_name,
|
||||
product.categoryName,
|
||||
].join(" "),
|
||||
TANK_CLEANING_TERMS
|
||||
);
|
||||
};
|
||||
|
||||
export const isProductCategoryRestrictedForCustomer = (category, attributes = []) => {
|
||||
if (category === "addons" && hasCustomerAttribute(attributes, "restrictAdditionalServices")) {
|
||||
return true;
|
||||
}
|
||||
if (category === "spot_free" && hasCustomerAttribute(attributes, "restrictSpotFree")) {
|
||||
return true;
|
||||
}
|
||||
if (category === "interior_cleaning" && hasCustomerAttribute(attributes, "restrictInteriorCleaning")) {
|
||||
return true;
|
||||
}
|
||||
if (isTankCleaningCategory(category) && hasCustomerAttribute(attributes, "restrictTankCleaning")) {
|
||||
return true;
|
||||
}
|
||||
if (hasCustomerAttribute(attributes, "onlyTankCleaning") && !isTankCleaningCategory(category)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
export const isProductRestrictedForCustomer = (product, attributes = []) => {
|
||||
if (!product) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const productName = normalizedText(product.name ?? product.product_name);
|
||||
|
||||
if (hasCustomerAttribute(attributes, "restrictSpotFree") && productName.includes("spot free")) {
|
||||
return true;
|
||||
}
|
||||
if (hasCustomerAttribute(attributes, "restrictInteriorCleaning") && productName.includes("indvendig vask")) {
|
||||
return true;
|
||||
}
|
||||
if (isTankCleaningProduct(product) && hasCustomerAttribute(attributes, "restrictTankCleaning")) {
|
||||
return true;
|
||||
}
|
||||
if (hasCustomerAttribute(attributes, "onlyTankCleaning") && !isTankCleaningProduct(product)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
@@ -1190,6 +1190,14 @@
|
||||
"edit_title": "@:{'templates.generated.compat.limited_backoffice.employees.edit_title'}",
|
||||
"name": "@:{'templates.generated.compat.limited_backoffice.employees.name'}",
|
||||
"email": "@:{'templates.generated.compat.limited_backoffice.employees.email'}",
|
||||
"phone": "@:{'templates.generated.compat.limited_backoffice.employees.phone'}",
|
||||
"phone_validation": "@:{'templates.generated.compat.limited_backoffice.employees.phone_validation'}",
|
||||
"country_codes": {
|
||||
"denmark": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.denmark'}",
|
||||
"sweden": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.sweden'}",
|
||||
"norway": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.norway'}",
|
||||
"finland": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.finland'}"
|
||||
},
|
||||
"password": "@:{'templates.generated.compat.limited_backoffice.employees.password'}",
|
||||
"password_create_help": "@:{'templates.generated.compat.limited_backoffice.employees.password_create_help'}",
|
||||
"password_update_help": "@:{'templates.generated.compat.limited_backoffice.employees.password_update_help'}",
|
||||
@@ -3455,6 +3463,13 @@
|
||||
"opening_hours": {
|
||||
"closed": "Stengt"
|
||||
},
|
||||
"pricing": {
|
||||
"custom_pricing_disabled": "Fallback aktiv",
|
||||
"custom_pricing_enabled": "Kun egne priser",
|
||||
"custom_pricing_missing_price": "Manglende afdelingspriser bliver 999999.",
|
||||
"custom_pricing_only": "Ingen fallback-priser",
|
||||
"effective_department_price": "Effektiv afdelingspris"
|
||||
},
|
||||
"search_placeholder": "@.capitalize:{'words.generated.søg'} @:{'words.generated.efter'} @:{'words.generated.afdelingsnavn'}",
|
||||
"select_department": "@.capitalize:{'words.generated.vælg'} @:{'words.replication.host_definite_suffix'} @:{'words.generated.afdeling'}",
|
||||
"subtitle": "@.capitalize:{'words.generated.administrer'} @:{'words.generated.afdelinger'}",
|
||||
@@ -3478,17 +3493,17 @@
|
||||
"error_report": {
|
||||
"button": "Rapporter fejl",
|
||||
"title": "Rapporter fejl",
|
||||
"subtitle": "Send det aktuelle skærmbillede og de seneste fejldetaljer til support.",
|
||||
"subtitle": "Send de seneste fejldetaljer til support. Et skærmbillede vedhæftes, når det er muligt.",
|
||||
"before_error": "Hvad lavede du, før fejlen opstod?",
|
||||
"expected": "Hvad forventede du, der ville ske?",
|
||||
"actual": "Hvad skete der faktisk?",
|
||||
"before_error_placeholder": "Beskriv handlingen, du var i gang med, for eksempel at åbne ordrer eller vælge en kunde.",
|
||||
"expected_placeholder": "Beskriv det resultat, du forventede at se.",
|
||||
"actual_placeholder": "Beskriv, hvad du så i stedet, inklusive eventuel fejltekst.",
|
||||
"consent": "Jeg accepterer, at det aktuelle app-skærmbillede, de seneste request-fejl, Vue-fejl, browseroplysninger og mine svar indsamles til fejlfinding.",
|
||||
"consent": "Jeg accepterer, at de seneste request-fejl, Vue-fejl, browseroplysninger, mine svar og et app-skærmbillede, når det er muligt, indsamles til fejlfinding.",
|
||||
"submit": "Send rapport",
|
||||
"submitted": "Fejlrapporten er sendt.",
|
||||
"capture_failed": "Skærmbilledet kunne ikke oprettes. Prøv igen.",
|
||||
"capture_failed": "Skærmbilledet kunne ikke oprettes. Rapporten sendes uden skærmbillede.",
|
||||
"submit_failed": "Fejlrapporten kunne ikke sendes.",
|
||||
"required": "Alle felter og accept af dataindsamling er påkrævet.",
|
||||
"page_subtitle": "Rapporterede skærme, request-fejl og Vue-fejl",
|
||||
@@ -4285,6 +4300,7 @@
|
||||
"departments": {
|
||||
"columns": {
|
||||
"archived": "Arkiveret",
|
||||
"custom_pricing_only": "Ingen fallback-priser",
|
||||
"dimension": "Dimension",
|
||||
"economic_department": "@.upper:{'words.generated.e'}-@:{'words.generated.conomic'} @:{'words.generated.afdeling'}",
|
||||
"latitude": "@:{'templates.generated.compat.departments.form.latitude'}",
|
||||
@@ -5932,6 +5948,20 @@
|
||||
},
|
||||
"vehicles": {
|
||||
"add": "@:{'words.generated.tilføj'} @:{'words.generated.køretøj'}",
|
||||
"add_modal": {
|
||||
"customer_label": "Kunde",
|
||||
"customer_placeholder": "Søg efter kundenavn eller kundenummer",
|
||||
"error": "Køretøjet kunne ikke tilføjes.",
|
||||
"no_customer_results": "Ingen kunder fundet",
|
||||
"reference_placeholder": "Valgfri reference",
|
||||
"registration_placeholder": "Registreringsnummer",
|
||||
"selected_customer": "Valgt kunde",
|
||||
"submit": "Tilføj køretøj",
|
||||
"title": "Tilføj køretøj",
|
||||
"type_load_error": "Køretøjstyper kunne ikke indlæses.",
|
||||
"type_placeholder": "Vælg køretøjstype",
|
||||
"validation_error": "Vælg kunde, registreringsnummer og køretøjstype."
|
||||
},
|
||||
"brand": "@:{'templates.generated.compat.admin.pos.make'}",
|
||||
"color": "Farve",
|
||||
"delete_vehicle": "@:{'templates.generated.compat.vehicles.delete'}",
|
||||
@@ -6010,6 +6040,14 @@
|
||||
"edit_title": "@:{'words.generated.rediger'} @:{'words.generated.medarbejder'}",
|
||||
"name": "Navn",
|
||||
"email": "Email",
|
||||
"phone": "Telefon",
|
||||
"phone_validation": "Telefonnummeret skal være 4-15 cifre.",
|
||||
"country_codes": {
|
||||
"denmark": "Danmark",
|
||||
"sweden": "Sverige",
|
||||
"norway": "Norge",
|
||||
"finland": "Finland"
|
||||
},
|
||||
"password": "@.capitalize:{'words.generated.adgangskode'}",
|
||||
"password_create_help": "@.capitalize:{'words.generated.pakrævet'} @:{'words.generated.for'} nye @:{'words.generated.medarbejdere'}. Brug @:{'words.generated.mindst'} 8 tegn.",
|
||||
"password_update_help": "Lad feltet være tomt @:{'words.generated.for'} at beholde den nuværende @:{'words.generated.adgangskode'}.",
|
||||
|
||||
@@ -1301,6 +1301,14 @@
|
||||
"edit_title": "@:{'templates.generated.compat.limited_backoffice.employees.edit_title'}",
|
||||
"name": "@:{'templates.generated.compat.limited_backoffice.employees.name'}",
|
||||
"email": "@:{'templates.generated.compat.limited_backoffice.employees.email'}",
|
||||
"phone": "@:{'templates.generated.compat.limited_backoffice.employees.phone'}",
|
||||
"phone_validation": "@:{'templates.generated.compat.limited_backoffice.employees.phone_validation'}",
|
||||
"country_codes": {
|
||||
"denmark": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.denmark'}",
|
||||
"sweden": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.sweden'}",
|
||||
"norway": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.norway'}",
|
||||
"finland": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.finland'}"
|
||||
},
|
||||
"password": "@:{'templates.generated.compat.limited_backoffice.employees.password'}",
|
||||
"password_create_help": "@:{'templates.generated.compat.limited_backoffice.employees.password_create_help'}",
|
||||
"password_update_help": "@:{'templates.generated.compat.limited_backoffice.employees.password_update_help'}",
|
||||
@@ -3589,17 +3597,17 @@
|
||||
"error_report": {
|
||||
"button": "Fehler melden",
|
||||
"title": "Fehler melden",
|
||||
"subtitle": "Sende den aktuellen Bildschirm und die letzten Fehlerdetails an den Support.",
|
||||
"subtitle": "Sende die letzten Fehlerdetails an den Support. Ein Screenshot wird angehängt, wenn möglich.",
|
||||
"before_error": "Was haben Sie getan, bevor der Fehler auftrat?",
|
||||
"expected": "Was hatten Sie erwartet?",
|
||||
"actual": "Was ist tatsächlich passiert?",
|
||||
"before_error_placeholder": "Beschreiben Sie die Aktion, zum Beispiel Bestellungen öffnen oder einen Kunden auswählen.",
|
||||
"expected_placeholder": "Beschreiben Sie das erwartete Ergebnis.",
|
||||
"actual_placeholder": "Beschreiben Sie, was stattdessen zu sehen war, inklusive Fehlermeldung.",
|
||||
"consent": "Ich akzeptiere, dass der aktuelle App-Bildschirm, letzte Request-Fehler, Vue-Fehler, Browserdetails und meine Antworten zur Fehlersuche erfasst werden.",
|
||||
"consent": "Ich akzeptiere, dass letzte Request-Fehler, Vue-Fehler, Browserdetails, meine Antworten und ein App-Screenshot, wenn möglich, zur Fehlersuche erfasst werden.",
|
||||
"submit": "Bericht senden",
|
||||
"submitted": "Fehlerbericht gesendet.",
|
||||
"capture_failed": "Der Screenshot konnte nicht erstellt werden. Bitte versuchen Sie es erneut.",
|
||||
"capture_failed": "Der Screenshot konnte nicht erstellt werden. Der Bericht wird ohne Screenshot gesendet.",
|
||||
"submit_failed": "Der Fehlerbericht konnte nicht gesendet werden.",
|
||||
"required": "Alle Felder und die Zustimmung zur Datenerfassung sind erforderlich.",
|
||||
"page_subtitle": "Gemeldete Bildschirme, Request-Fehler und Vue-Fehler",
|
||||
@@ -6121,6 +6129,14 @@
|
||||
"edit_title": "@:{'words.generated.mitarbeiter'} @:{'words.generated.bearbeiten'}",
|
||||
"name": "Name",
|
||||
"email": "E-Mail",
|
||||
"phone": "Telefon",
|
||||
"phone_validation": "Die Telefonnummer muss 4-15 Ziffern enthalten.",
|
||||
"country_codes": {
|
||||
"denmark": "Dänemark",
|
||||
"sweden": "Schweden",
|
||||
"norway": "Norwegen",
|
||||
"finland": "Finnland"
|
||||
},
|
||||
"password": "@:{'words.generated.passwort'}",
|
||||
"password_create_help": "@.capitalize:{'words.generated.fur'} neue @:{'words.generated.mitarbeiter'} @:{'words.generated.erforderlich'}. Verwenden @.capitalize:{'words.generated.sie'} @:{'words.generated.mindestens'} 8 Zeichen.",
|
||||
"password_update_help": "Leer lassen, um das vorhandene @:{'words.generated.passwort'} beizubehalten.",
|
||||
|
||||
@@ -1022,6 +1022,14 @@
|
||||
"edit_title": "@:{'templates.generated.compat.limited_backoffice.employees.edit_title'}",
|
||||
"name": "@:{'templates.generated.compat.limited_backoffice.employees.name'}",
|
||||
"email": "@:{'templates.generated.compat.limited_backoffice.employees.email'}",
|
||||
"phone": "@:{'templates.generated.compat.limited_backoffice.employees.phone'}",
|
||||
"phone_validation": "@:{'templates.generated.compat.limited_backoffice.employees.phone_validation'}",
|
||||
"country_codes": {
|
||||
"denmark": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.denmark'}",
|
||||
"sweden": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.sweden'}",
|
||||
"norway": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.norway'}",
|
||||
"finland": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.finland'}"
|
||||
},
|
||||
"password": "@:{'templates.generated.compat.limited_backoffice.employees.password'}",
|
||||
"password_create_help": "@:{'templates.generated.compat.limited_backoffice.employees.password_create_help'}",
|
||||
"password_update_help": "@:{'templates.generated.compat.limited_backoffice.employees.password_update_help'}",
|
||||
@@ -3287,6 +3295,13 @@
|
||||
"opening_hours": {
|
||||
"closed": "@:{'templates.generated.compat.global.closed'}"
|
||||
},
|
||||
"pricing": {
|
||||
"custom_pricing_disabled": "Fallback enabled",
|
||||
"custom_pricing_enabled": "Custom only",
|
||||
"custom_pricing_missing_price": "Missing department prices resolve to 999999.",
|
||||
"custom_pricing_only": "No fallback pricing",
|
||||
"effective_department_price": "Effective department price"
|
||||
},
|
||||
"search_placeholder": "@.capitalize:{'words.generated.search'} @:{'words.generated.by'} @:{'words.generated.department'} @:{'words.generated.name'}",
|
||||
"select_department": "@.capitalize:{'words.generated.select'} @:{'words.generated.a'} @:{'words.generated.department'}",
|
||||
"subtitle": "@.capitalize:{'words.generated.manage'} @:{'words.generated.departments'}",
|
||||
@@ -3310,17 +3325,17 @@
|
||||
"error_report": {
|
||||
"button": "Report error",
|
||||
"title": "Report error",
|
||||
"subtitle": "Send the current screen and recent error details to support.",
|
||||
"subtitle": "Send recent error details to support. A screenshot is attached when available.",
|
||||
"before_error": "What were you doing before the error occurred?",
|
||||
"expected": "What did you expect would happen?",
|
||||
"actual": "What actually happened?",
|
||||
"before_error_placeholder": "Describe the action you were taking, for example opening orders or selecting a customer.",
|
||||
"expected_placeholder": "Describe the result you expected to see.",
|
||||
"actual_placeholder": "Describe what you saw instead, including any error text.",
|
||||
"consent": "I accept that the current app screen, recent request errors, Vue errors, browser details, and my answers are collected for troubleshooting.",
|
||||
"consent": "I accept that recent request errors, Vue errors, browser details, my answers, and an app screenshot when available are collected for troubleshooting.",
|
||||
"submit": "Submit report",
|
||||
"submitted": "Error report submitted.",
|
||||
"capture_failed": "The screen capture failed. Please try again.",
|
||||
"capture_failed": "The screen capture failed. The report will be sent without a screenshot.",
|
||||
"submit_failed": "The error report could not be submitted.",
|
||||
"required": "All fields and data collection acceptance are required.",
|
||||
"page_subtitle": "Reported screens, request failures, and Vue errors",
|
||||
@@ -4117,6 +4132,7 @@
|
||||
"departments": {
|
||||
"columns": {
|
||||
"archived": "@:{'words.generated.archived'}",
|
||||
"custom_pricing_only": "No fallback pricing",
|
||||
"dimension": "Dimension",
|
||||
"economic_department": "@.upper:{'words.generated.e'}-@:{'words.generated.conomic'} @.capitalize:{'words.generated.department'}",
|
||||
"latitude": "@:{'templates.generated.compat.departments.form.latitude'}",
|
||||
@@ -5764,6 +5780,20 @@
|
||||
},
|
||||
"vehicles": {
|
||||
"add": "@.capitalize:{'words.generated.add'} @:{'words.generated.vehicle'}",
|
||||
"add_modal": {
|
||||
"customer_label": "Customer",
|
||||
"customer_placeholder": "Search by customer name or number",
|
||||
"error": "Unable to add vehicle.",
|
||||
"no_customer_results": "No customers found",
|
||||
"reference_placeholder": "Optional reference",
|
||||
"registration_placeholder": "Registration number",
|
||||
"selected_customer": "Selected customer",
|
||||
"submit": "Add vehicle",
|
||||
"title": "Add vehicle",
|
||||
"type_load_error": "Unable to load vehicle types.",
|
||||
"type_placeholder": "Select vehicle type",
|
||||
"validation_error": "Select a customer, registration number, and vehicle type."
|
||||
},
|
||||
"brand": "Brand",
|
||||
"color": "Color",
|
||||
"delete_vehicle": "@:{'templates.generated.compat.vehicles.delete'}",
|
||||
@@ -5842,6 +5872,14 @@
|
||||
"edit_title": "@.capitalize:{'words.generated.edit'} @:{'words.generated.employee'}",
|
||||
"name": "Name",
|
||||
"email": "Email",
|
||||
"phone": "Phone",
|
||||
"phone_validation": "Phone number must be 4-15 digits.",
|
||||
"country_codes": {
|
||||
"denmark": "Denmark",
|
||||
"sweden": "Sweden",
|
||||
"norway": "Norway",
|
||||
"finland": "Finland"
|
||||
},
|
||||
"password": "@.capitalize:{'words.generated.password'}",
|
||||
"password_create_help": "@.capitalize:{'words.generated.required'} @:{'words.generated.for'} new @:{'words.generated.employees'}. Use @:{'words.generated.at'} @:{'words.generated.least'} 8 characters.",
|
||||
"password_update_help": "Leave blank @:{'words.generated.to'} keep @:{'words.replication.article.host_mention'} existing @:{'words.generated.password'}.",
|
||||
|
||||
@@ -2420,6 +2420,13 @@
|
||||
"title": "@:{'templates.generated.compat.departments.tab.opening_hours'}"
|
||||
},
|
||||
"phone": "@:common.phone",
|
||||
"pricing": {
|
||||
"custom_pricing_disabled": "@:{'templates.generated.compat.departments.pricing.custom_pricing_disabled'}",
|
||||
"custom_pricing_enabled": "@:{'templates.generated.compat.departments.pricing.custom_pricing_enabled'}",
|
||||
"custom_pricing_missing_price": "@:{'templates.generated.compat.departments.pricing.custom_pricing_missing_price'}",
|
||||
"custom_pricing_only": "@:{'templates.generated.compat.departments.pricing.custom_pricing_only'}",
|
||||
"effective_department_price": "@:{'templates.generated.compat.departments.pricing.effective_department_price'}"
|
||||
},
|
||||
"products": {
|
||||
"new_product": "@:products.new_product"
|
||||
},
|
||||
@@ -3486,6 +3493,7 @@
|
||||
"departments": {
|
||||
"columns": {
|
||||
"archived": "@:{'templates.generated.compat.objects.departments.columns.archived'}",
|
||||
"custom_pricing_only": "@:{'templates.generated.compat.objects.departments.columns.custom_pricing_only'}",
|
||||
"dimension": "@:{'templates.generated.compat.objects.departments.columns.dimension'}",
|
||||
"economic_department": "@:{'templates.generated.compat.objects.departments.columns.economic_department'}",
|
||||
"latitude": "@:{'templates.generated.compat.objects.departments.columns.latitude'}",
|
||||
@@ -4559,6 +4567,82 @@
|
||||
"subtitle": "@:{'templates.generated.compat.superuser_dashboard.departments.subtitle'}",
|
||||
"title": "@:common.departments"
|
||||
},
|
||||
"department_navigation": {
|
||||
"overview": "Overview",
|
||||
"modules": "Modules",
|
||||
"branding": "Profile & Branding",
|
||||
"gateways": "Gateways",
|
||||
"stripe": "Stripe",
|
||||
"pricing": "Pricing",
|
||||
"categories": "Categories"
|
||||
},
|
||||
"department_overview": {
|
||||
"title": "Department overview",
|
||||
"subtitle": "Operational overview for the selected department",
|
||||
"loading": "Loading department overview",
|
||||
"date_from": "From",
|
||||
"date_to": "To",
|
||||
"range_label": "{from} to {to}",
|
||||
"empty_value": "-",
|
||||
"out_of": "of {total}",
|
||||
"presets": {
|
||||
"today": "Today",
|
||||
"last_seven_days": "Last 7 days"
|
||||
},
|
||||
"metrics": {
|
||||
"bookings": "Bookings",
|
||||
"complaints": "Complaints",
|
||||
"night_washes": "Night washes",
|
||||
"overtime": "Overtime",
|
||||
"products_sold": "Products sold",
|
||||
"revenue": "Revenue",
|
||||
"transactions": "Transactions",
|
||||
"washes": "Washes",
|
||||
"water_usage": "Water"
|
||||
},
|
||||
"units": {
|
||||
"hours": "h",
|
||||
"liters": "L"
|
||||
},
|
||||
"products": {
|
||||
"title": "Product mix",
|
||||
"subtitle": "Tracked wash products in the selected period",
|
||||
"empty": "No product activity for the selected period"
|
||||
},
|
||||
"profile": {
|
||||
"title": "Department profile",
|
||||
"no_description": "No department description",
|
||||
"department_id": "Department ID",
|
||||
"economic_department_id": "Economic department",
|
||||
"branding": "Branding",
|
||||
"created_at": "Created",
|
||||
"updated_at": "Updated"
|
||||
},
|
||||
"hardware": {
|
||||
"title": "Hardware readiness",
|
||||
"subtitle": "Gateway-backed lane and relay state",
|
||||
"gateways": "Gateways online",
|
||||
"lanes": "Lanes",
|
||||
"gates": "Gates",
|
||||
"relays": "Relays",
|
||||
"scanners": "Scanners",
|
||||
"issues": "Issues"
|
||||
},
|
||||
"quick_links": {
|
||||
"title": "Department tools",
|
||||
"subtitle": "Open the focused setup areas for this department",
|
||||
"modules": "Modules",
|
||||
"branding": "Branding",
|
||||
"gateways": "Gateways",
|
||||
"stripe": "Stripe",
|
||||
"pricing": "Pricing",
|
||||
"categories": "Categories"
|
||||
},
|
||||
"errors": {
|
||||
"invalid_department": "A valid department is required",
|
||||
"load": "Unable to load the department overview"
|
||||
}
|
||||
},
|
||||
"employees": {
|
||||
"edit_employee_title": "@:employees.edit_employee",
|
||||
"new_employee_subtitle": "@:{'templates.generated.compat.superuser_dashboard.employees.new_employee_subtitle'}",
|
||||
@@ -5834,6 +5918,20 @@
|
||||
"vehicles": {
|
||||
"actions": "@:common.actions",
|
||||
"add": "@:{'templates.generated.compat.vehicles.add'}",
|
||||
"add_modal": {
|
||||
"customer_label": "@:{'templates.generated.compat.vehicles.add_modal.customer_label'}",
|
||||
"customer_placeholder": "@:{'templates.generated.compat.vehicles.add_modal.customer_placeholder'}",
|
||||
"error": "@:{'templates.generated.compat.vehicles.add_modal.error'}",
|
||||
"no_customer_results": "@:{'templates.generated.compat.vehicles.add_modal.no_customer_results'}",
|
||||
"reference_placeholder": "@:{'templates.generated.compat.vehicles.add_modal.reference_placeholder'}",
|
||||
"registration_placeholder": "@:{'templates.generated.compat.vehicles.add_modal.registration_placeholder'}",
|
||||
"selected_customer": "@:{'templates.generated.compat.vehicles.add_modal.selected_customer'}",
|
||||
"submit": "@:{'templates.generated.compat.vehicles.add_modal.submit'}",
|
||||
"title": "@:{'templates.generated.compat.vehicles.add_modal.title'}",
|
||||
"type_load_error": "@:{'templates.generated.compat.vehicles.add_modal.type_load_error'}",
|
||||
"type_placeholder": "@:{'templates.generated.compat.vehicles.add_modal.type_placeholder'}",
|
||||
"validation_error": "@:{'templates.generated.compat.vehicles.add_modal.validation_error'}"
|
||||
},
|
||||
"brand": "@:{'templates.generated.compat.vehicles.brand'}",
|
||||
"color": "@:{'templates.generated.compat.vehicles.color'}",
|
||||
"created_at": "@:{'templates.generated.compat.global.generated'}",
|
||||
|
||||
@@ -1304,6 +1304,14 @@
|
||||
"edit_title": "@:{'templates.generated.compat.limited_backoffice.employees.edit_title'}",
|
||||
"name": "@:{'templates.generated.compat.limited_backoffice.employees.name'}",
|
||||
"email": "@:{'templates.generated.compat.limited_backoffice.employees.email'}",
|
||||
"phone": "@:{'templates.generated.compat.limited_backoffice.employees.phone'}",
|
||||
"phone_validation": "@:{'templates.generated.compat.limited_backoffice.employees.phone_validation'}",
|
||||
"country_codes": {
|
||||
"denmark": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.denmark'}",
|
||||
"sweden": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.sweden'}",
|
||||
"norway": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.norway'}",
|
||||
"finland": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.finland'}"
|
||||
},
|
||||
"password": "@:{'templates.generated.compat.limited_backoffice.employees.password'}",
|
||||
"password_create_help": "@:{'templates.generated.compat.limited_backoffice.employees.password_create_help'}",
|
||||
"password_update_help": "@:{'templates.generated.compat.limited_backoffice.employees.password_update_help'}",
|
||||
@@ -3592,17 +3600,17 @@
|
||||
"error_report": {
|
||||
"button": "Rapporter feil",
|
||||
"title": "Rapporter feil",
|
||||
"subtitle": "Send gjeldende skjermbilde og de siste feildetaljene til support.",
|
||||
"subtitle": "Send de siste feildetaljene til support. Et skjermbilde legges ved når det er mulig.",
|
||||
"before_error": "Hva gjorde du før feilen oppstod?",
|
||||
"expected": "Hva forventet du at skulle skje?",
|
||||
"actual": "Hva skjedde faktisk?",
|
||||
"before_error_placeholder": "Beskriv handlingen du utførte, for eksempel å åpne ordre eller velge en kunde.",
|
||||
"expected_placeholder": "Beskriv resultatet du forventet å se.",
|
||||
"actual_placeholder": "Beskriv hva du så i stedet, inkludert eventuell feiltekst.",
|
||||
"consent": "Jeg godtar at gjeldende app-skjermbilde, siste request-feil, Vue-feil, nettleserdetaljer og svarene mine samles inn for feilsøking.",
|
||||
"consent": "Jeg godtar at siste request-feil, Vue-feil, nettleserdetaljer, svarene mine og et app-skjermbilde når det er mulig, samles inn for feilsøking.",
|
||||
"submit": "Send rapport",
|
||||
"submitted": "Feilrapport sendt.",
|
||||
"capture_failed": "Skjermbildet kunne ikke tas. Prøv igjen.",
|
||||
"capture_failed": "Skjermbildet kunne ikke tas. Rapporten sendes uten skjermbilde.",
|
||||
"submit_failed": "Feilrapporten kunne ikke sendes.",
|
||||
"required": "Alle felter og godkjenning av datainnsamling er påkrevd.",
|
||||
"page_subtitle": "Rapporterte skjermer, request-feil og Vue-feil",
|
||||
@@ -6124,6 +6132,14 @@
|
||||
"edit_title": "@:{'words.generated.rediger'} @:{'words.generated.medarbeider'}",
|
||||
"name": "Navn",
|
||||
"email": "E-post",
|
||||
"phone": "Telefon",
|
||||
"phone_validation": "Telefonnummeret må være 4-15 sifre.",
|
||||
"country_codes": {
|
||||
"denmark": "Danmark",
|
||||
"sweden": "Sverige",
|
||||
"norway": "Norge",
|
||||
"finland": "Finland"
|
||||
},
|
||||
"password": "@.capitalize:{'words.generated.passord'}",
|
||||
"password_create_help": "@.capitalize:{'words.generated.kreves'} @:{'words.generated.for'} nye @:{'words.generated.medarbeidere'}. Bruk @:{'words.generated.minst'} 8 tegn.",
|
||||
"password_update_help": "La stå tomt @:{'words.generated.for'} å beholde nåværende @:{'words.generated.passord'}.",
|
||||
|
||||
@@ -1354,6 +1354,14 @@
|
||||
"edit_title": "@:{'templates.generated.compat.limited_backoffice.employees.edit_title'}",
|
||||
"name": "@:{'templates.generated.compat.limited_backoffice.employees.name'}",
|
||||
"email": "@:{'templates.generated.compat.limited_backoffice.employees.email'}",
|
||||
"phone": "@:{'templates.generated.compat.limited_backoffice.employees.phone'}",
|
||||
"phone_validation": "@:{'templates.generated.compat.limited_backoffice.employees.phone_validation'}",
|
||||
"country_codes": {
|
||||
"denmark": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.denmark'}",
|
||||
"sweden": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.sweden'}",
|
||||
"norway": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.norway'}",
|
||||
"finland": "@:{'templates.generated.compat.limited_backoffice.employees.country_codes.finland'}"
|
||||
},
|
||||
"password": "@:{'templates.generated.compat.limited_backoffice.employees.password'}",
|
||||
"password_create_help": "@:{'templates.generated.compat.limited_backoffice.employees.password_create_help'}",
|
||||
"password_update_help": "@:{'templates.generated.compat.limited_backoffice.employees.password_update_help'}",
|
||||
@@ -3642,17 +3650,17 @@
|
||||
"error_report": {
|
||||
"button": "Rapportera fel",
|
||||
"title": "Rapportera fel",
|
||||
"subtitle": "Skicka aktuell skärm och de senaste feldetaljerna till support.",
|
||||
"subtitle": "Skicka de senaste feldetaljerna till support. En skärmbild bifogas när det är möjligt.",
|
||||
"before_error": "Vad gjorde du innan felet uppstod?",
|
||||
"expected": "Vad förväntade du dig skulle hända?",
|
||||
"actual": "Vad hände faktiskt?",
|
||||
"before_error_placeholder": "Beskriv åtgärden du gjorde, till exempel att öppna ordrar eller välja en kund.",
|
||||
"expected_placeholder": "Beskriv resultatet du förväntade dig att se.",
|
||||
"actual_placeholder": "Beskriv vad du såg i stället, inklusive eventuell feltext.",
|
||||
"consent": "Jag accepterar att aktuell app-skärm, senaste request-fel, Vue-fel, webbläsardetaljer och mina svar samlas in för felsökning.",
|
||||
"consent": "Jag accepterar att senaste request-fel, Vue-fel, webbläsardetaljer, mina svar och en app-skärmbild när det är möjligt samlas in för felsökning.",
|
||||
"submit": "Skicka rapport",
|
||||
"submitted": "Felrapport skickad.",
|
||||
"capture_failed": "Skärmbilden kunde inte tas. Försök igen.",
|
||||
"capture_failed": "Skärmbilden kunde inte tas. Rapporten skickas utan skärmbild.",
|
||||
"submit_failed": "Felrapporten kunde inte skickas.",
|
||||
"required": "Alla fält och godkännande av datainsamling krävs.",
|
||||
"page_subtitle": "Rapporterade skärmar, request-fel och Vue-fel",
|
||||
@@ -6174,6 +6182,14 @@
|
||||
"edit_title": "@:{'words.generated.redigera'} @:{'words.generated.medarbetare'}",
|
||||
"name": "Namn",
|
||||
"email": "E-post",
|
||||
"phone": "Telefon",
|
||||
"phone_validation": "Telefonnumret måste vara 4-15 siffror.",
|
||||
"country_codes": {
|
||||
"denmark": "Danmark",
|
||||
"sweden": "Sverige",
|
||||
"norway": "Norge",
|
||||
"finland": "Finland"
|
||||
},
|
||||
"password": "@.capitalize:{'words.generated.losenord'}",
|
||||
"password_create_help": "@.capitalize:{'words.generated.kravs'} @:{'words.generated.for'} nya @:{'words.generated.medarbetare'}. Använd @:{'words.generated.minst'} 8 tecken.",
|
||||
"password_update_help": "Lämna tomt @:{'words.generated.for'} att behålla nuvarande @:{'words.generated.losenord'}.",
|
||||
|
||||
@@ -21,6 +21,13 @@
|
||||
"opening_hours": {
|
||||
"closed": "Stengt"
|
||||
},
|
||||
"pricing": {
|
||||
"custom_pricing_disabled": "Fallback aktiv",
|
||||
"custom_pricing_enabled": "Kun egne priser",
|
||||
"custom_pricing_missing_price": "Manglende afdelingspriser bliver 999999.",
|
||||
"custom_pricing_only": "Ingen fallback-priser",
|
||||
"effective_department_price": "Effektiv afdelingspris"
|
||||
},
|
||||
"search_placeholder": "@.capitalize:{'terms.glossary.søg'} @:{'terms.glossary.efter'} @:{'terms.glossary.afdelingsnavn'}",
|
||||
"select_department": "@.capitalize:{'terms.glossary.vælg'} @:{'terms.replication.host_definite_suffix'} @:{'terms.glossary.afdeling'}",
|
||||
"subtitle": "@.capitalize:{'terms.glossary.administrer'} @:{'terms.glossary.afdelinger'}",
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
"error_report": {
|
||||
"button": "Rapporter fejl",
|
||||
"title": "Rapporter fejl",
|
||||
"subtitle": "Send det aktuelle skærmbillede og de seneste fejldetaljer til support.",
|
||||
"subtitle": "Send de seneste fejldetaljer til support. Et skærmbillede vedhæftes, når det er muligt.",
|
||||
"before_error": "Hvad lavede du, før fejlen opstod?",
|
||||
"expected": "Hvad forventede du, der ville ske?",
|
||||
"actual": "Hvad skete der faktisk?",
|
||||
"before_error_placeholder": "Beskriv handlingen, du var i gang med, for eksempel at åbne ordrer eller vælge en kunde.",
|
||||
"expected_placeholder": "Beskriv det resultat, du forventede at se.",
|
||||
"actual_placeholder": "Beskriv, hvad du så i stedet, inklusive eventuel fejltekst.",
|
||||
"consent": "Jeg accepterer, at det aktuelle app-skærmbillede, de seneste request-fejl, Vue-fejl, browseroplysninger og mine svar indsamles til fejlfinding.",
|
||||
"consent": "Jeg accepterer, at de seneste request-fejl, Vue-fejl, browseroplysninger, mine svar og et app-skærmbillede, når det er muligt, indsamles til fejlfinding.",
|
||||
"submit": "Send rapport",
|
||||
"submitted": "Fejlrapporten er sendt.",
|
||||
"capture_failed": "Skærmbilledet kunne ikke oprettes. Prøv igen.",
|
||||
"capture_failed": "Skærmbilledet kunne ikke oprettes. Rapporten sendes uden skærmbillede.",
|
||||
"submit_failed": "Fejlrapporten kunne ikke sendes.",
|
||||
"required": "Alle felter og accept af dataindsamling er påkrævet.",
|
||||
"page_subtitle": "Rapporterede skærme, request-fejl og Vue-fejl",
|
||||
|
||||
@@ -140,6 +140,7 @@
|
||||
"departments": {
|
||||
"columns": {
|
||||
"archived": "Arkiveret",
|
||||
"custom_pricing_only": "Ingen fallback-priser",
|
||||
"dimension": "Dimension",
|
||||
"economic_department": "@.upper:{'terms.glossary.e'}-@:{'terms.glossary.conomic'} @:{'terms.glossary.afdeling'}",
|
||||
"latitude": "@:{'phrases.compat.departments.form.latitude'}",
|
||||
|
||||
@@ -2,6 +2,20 @@
|
||||
"compat": {
|
||||
"vehicles": {
|
||||
"add": "@:{'terms.glossary.tilføj'} @:{'terms.glossary.køretøj'}",
|
||||
"add_modal": {
|
||||
"customer_label": "Kunde",
|
||||
"customer_placeholder": "Søg efter kundenavn eller kundenummer",
|
||||
"error": "Køretøjet kunne ikke tilføjes.",
|
||||
"no_customer_results": "Ingen kunder fundet",
|
||||
"reference_placeholder": "Valgfri reference",
|
||||
"registration_placeholder": "Registreringsnummer",
|
||||
"selected_customer": "Valgt kunde",
|
||||
"submit": "Tilføj køretøj",
|
||||
"title": "Tilføj køretøj",
|
||||
"type_load_error": "Køretøjstyper kunne ikke indlæses.",
|
||||
"type_placeholder": "Vælg køretøjstype",
|
||||
"validation_error": "Vælg kunde, registreringsnummer og køretøjstype."
|
||||
},
|
||||
"brand": "@:{'phrases.compat.admin.pos.make'}",
|
||||
"color": "Farve",
|
||||
"delete_vehicle": "@:{'phrases.compat.vehicles.delete'}",
|
||||
|
||||
@@ -46,6 +46,14 @@
|
||||
"edit_title": "@:{'phrases.compat.limited_backoffice.employees.edit_title'}",
|
||||
"name": "@:{'phrases.compat.limited_backoffice.employees.name'}",
|
||||
"email": "@:{'phrases.compat.limited_backoffice.employees.email'}",
|
||||
"phone": "@:{'phrases.compat.limited_backoffice.employees.phone'}",
|
||||
"phone_validation": "@:{'phrases.compat.limited_backoffice.employees.phone_validation'}",
|
||||
"country_codes": {
|
||||
"denmark": "@:{'phrases.compat.limited_backoffice.employees.country_codes.denmark'}",
|
||||
"sweden": "@:{'phrases.compat.limited_backoffice.employees.country_codes.sweden'}",
|
||||
"norway": "@:{'phrases.compat.limited_backoffice.employees.country_codes.norway'}",
|
||||
"finland": "@:{'phrases.compat.limited_backoffice.employees.country_codes.finland'}"
|
||||
},
|
||||
"password": "@:{'phrases.compat.limited_backoffice.employees.password'}",
|
||||
"password_create_help": "@:{'phrases.compat.limited_backoffice.employees.password_create_help'}",
|
||||
"password_update_help": "@:{'phrases.compat.limited_backoffice.employees.password_update_help'}",
|
||||
@@ -279,6 +287,14 @@
|
||||
"edit_title": "@:{'terms.glossary.rediger'} @:{'terms.glossary.medarbejder'}",
|
||||
"name": "Navn",
|
||||
"email": "Email",
|
||||
"phone": "Telefon",
|
||||
"phone_validation": "Telefonnummeret skal være 4-15 cifre.",
|
||||
"country_codes": {
|
||||
"denmark": "Danmark",
|
||||
"sweden": "Sverige",
|
||||
"norway": "Norge",
|
||||
"finland": "Finland"
|
||||
},
|
||||
"password": "@.capitalize:{'terms.glossary.adgangskode'}",
|
||||
"password_create_help": "@.capitalize:{'terms.glossary.pakrævet'} @:{'terms.glossary.for'} nye @:{'terms.glossary.medarbejdere'}. Brug @:{'terms.glossary.mindst'} 8 tegn.",
|
||||
"password_update_help": "Lad feltet være tomt @:{'terms.glossary.for'} at beholde den nuværende @:{'terms.glossary.adgangskode'}.",
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
"error_report": {
|
||||
"button": "Fehler melden",
|
||||
"title": "Fehler melden",
|
||||
"subtitle": "Sende den aktuellen Bildschirm und die letzten Fehlerdetails an den Support.",
|
||||
"subtitle": "Sende die letzten Fehlerdetails an den Support. Ein Screenshot wird angehängt, wenn möglich.",
|
||||
"before_error": "Was haben Sie getan, bevor der Fehler auftrat?",
|
||||
"expected": "Was hatten Sie erwartet?",
|
||||
"actual": "Was ist tatsächlich passiert?",
|
||||
"before_error_placeholder": "Beschreiben Sie die Aktion, zum Beispiel Bestellungen öffnen oder einen Kunden auswählen.",
|
||||
"expected_placeholder": "Beschreiben Sie das erwartete Ergebnis.",
|
||||
"actual_placeholder": "Beschreiben Sie, was stattdessen zu sehen war, inklusive Fehlermeldung.",
|
||||
"consent": "Ich akzeptiere, dass der aktuelle App-Bildschirm, letzte Request-Fehler, Vue-Fehler, Browserdetails und meine Antworten zur Fehlersuche erfasst werden.",
|
||||
"consent": "Ich akzeptiere, dass letzte Request-Fehler, Vue-Fehler, Browserdetails, meine Antworten und ein App-Screenshot, wenn möglich, zur Fehlersuche erfasst werden.",
|
||||
"submit": "Bericht senden",
|
||||
"submitted": "Fehlerbericht gesendet.",
|
||||
"capture_failed": "Der Screenshot konnte nicht erstellt werden. Bitte versuchen Sie es erneut.",
|
||||
"capture_failed": "Der Screenshot konnte nicht erstellt werden. Der Bericht wird ohne Screenshot gesendet.",
|
||||
"submit_failed": "Der Fehlerbericht konnte nicht gesendet werden.",
|
||||
"required": "Alle Felder und die Zustimmung zur Datenerfassung sind erforderlich.",
|
||||
"page_subtitle": "Gemeldete Bildschirme, Request-Fehler und Vue-Fehler",
|
||||
|
||||
@@ -46,6 +46,14 @@
|
||||
"edit_title": "@:{'phrases.compat.limited_backoffice.employees.edit_title'}",
|
||||
"name": "@:{'phrases.compat.limited_backoffice.employees.name'}",
|
||||
"email": "@:{'phrases.compat.limited_backoffice.employees.email'}",
|
||||
"phone": "@:{'phrases.compat.limited_backoffice.employees.phone'}",
|
||||
"phone_validation": "@:{'phrases.compat.limited_backoffice.employees.phone_validation'}",
|
||||
"country_codes": {
|
||||
"denmark": "@:{'phrases.compat.limited_backoffice.employees.country_codes.denmark'}",
|
||||
"sweden": "@:{'phrases.compat.limited_backoffice.employees.country_codes.sweden'}",
|
||||
"norway": "@:{'phrases.compat.limited_backoffice.employees.country_codes.norway'}",
|
||||
"finland": "@:{'phrases.compat.limited_backoffice.employees.country_codes.finland'}"
|
||||
},
|
||||
"password": "@:{'phrases.compat.limited_backoffice.employees.password'}",
|
||||
"password_create_help": "@:{'phrases.compat.limited_backoffice.employees.password_create_help'}",
|
||||
"password_update_help": "@:{'phrases.compat.limited_backoffice.employees.password_update_help'}",
|
||||
@@ -279,6 +287,14 @@
|
||||
"edit_title": "@:{'terms.glossary.mitarbeiter'} @:{'terms.glossary.bearbeiten'}",
|
||||
"name": "Name",
|
||||
"email": "E-Mail",
|
||||
"phone": "Telefon",
|
||||
"phone_validation": "Die Telefonnummer muss 4-15 Ziffern enthalten.",
|
||||
"country_codes": {
|
||||
"denmark": "Dänemark",
|
||||
"sweden": "Schweden",
|
||||
"norway": "Norwegen",
|
||||
"finland": "Finnland"
|
||||
},
|
||||
"password": "@:{'terms.glossary.passwort'}",
|
||||
"password_create_help": "@.capitalize:{'terms.glossary.fur'} neue @:{'terms.glossary.mitarbeiter'} @:{'terms.glossary.erforderlich'}. Verwenden @.capitalize:{'terms.glossary.sie'} @:{'terms.glossary.mindestens'} 8 Zeichen.",
|
||||
"password_update_help": "Leer lassen, um das vorhandene @:{'terms.glossary.passwort'} beizubehalten.",
|
||||
|
||||
@@ -21,6 +21,13 @@
|
||||
"opening_hours": {
|
||||
"closed": "@:{'phrases.compat.global.closed'}"
|
||||
},
|
||||
"pricing": {
|
||||
"custom_pricing_disabled": "Fallback enabled",
|
||||
"custom_pricing_enabled": "Custom only",
|
||||
"custom_pricing_missing_price": "Missing department prices resolve to 999999.",
|
||||
"custom_pricing_only": "No fallback pricing",
|
||||
"effective_department_price": "Effective department price"
|
||||
},
|
||||
"search_placeholder": "@.capitalize:{'terms.glossary.search'} @:{'terms.glossary.by'} @:{'terms.glossary.department'} @:{'terms.glossary.name'}",
|
||||
"select_department": "@.capitalize:{'terms.glossary.select'} @:{'terms.glossary.a'} @:{'terms.glossary.department'}",
|
||||
"subtitle": "@.capitalize:{'terms.glossary.manage'} @:{'terms.glossary.departments'}",
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
"error_report": {
|
||||
"button": "Report error",
|
||||
"title": "Report error",
|
||||
"subtitle": "Send the current screen and recent error details to support.",
|
||||
"subtitle": "Send recent error details to support. A screenshot is attached when available.",
|
||||
"before_error": "What were you doing before the error occurred?",
|
||||
"expected": "What did you expect would happen?",
|
||||
"actual": "What actually happened?",
|
||||
"before_error_placeholder": "Describe the action you were taking, for example opening orders or selecting a customer.",
|
||||
"expected_placeholder": "Describe the result you expected to see.",
|
||||
"actual_placeholder": "Describe what you saw instead, including any error text.",
|
||||
"consent": "I accept that the current app screen, recent request errors, Vue errors, browser details, and my answers are collected for troubleshooting.",
|
||||
"consent": "I accept that recent request errors, Vue errors, browser details, my answers, and an app screenshot when available are collected for troubleshooting.",
|
||||
"submit": "Submit report",
|
||||
"submitted": "Error report submitted.",
|
||||
"capture_failed": "The screen capture failed. Please try again.",
|
||||
"capture_failed": "The screen capture failed. The report will be sent without a screenshot.",
|
||||
"submit_failed": "The error report could not be submitted.",
|
||||
"required": "All fields and data collection acceptance are required.",
|
||||
"page_subtitle": "Reported screens, request failures, and Vue errors",
|
||||
|
||||
@@ -140,6 +140,7 @@
|
||||
"departments": {
|
||||
"columns": {
|
||||
"archived": "@:{'terms.glossary.archived'}",
|
||||
"custom_pricing_only": "No fallback pricing",
|
||||
"dimension": "Dimension",
|
||||
"economic_department": "@.upper:{'terms.glossary.e'}-@:{'terms.glossary.conomic'} @.capitalize:{'terms.glossary.department'}",
|
||||
"latitude": "@:{'phrases.compat.departments.form.latitude'}",
|
||||
|
||||
@@ -2,6 +2,20 @@
|
||||
"compat": {
|
||||
"vehicles": {
|
||||
"add": "@.capitalize:{'terms.glossary.add'} @:{'terms.glossary.vehicle'}",
|
||||
"add_modal": {
|
||||
"customer_label": "Customer",
|
||||
"customer_placeholder": "Search by customer name or number",
|
||||
"error": "Unable to add vehicle.",
|
||||
"no_customer_results": "No customers found",
|
||||
"reference_placeholder": "Optional reference",
|
||||
"registration_placeholder": "Registration number",
|
||||
"selected_customer": "Selected customer",
|
||||
"submit": "Add vehicle",
|
||||
"title": "Add vehicle",
|
||||
"type_load_error": "Unable to load vehicle types.",
|
||||
"type_placeholder": "Select vehicle type",
|
||||
"validation_error": "Select a customer, registration number, and vehicle type."
|
||||
},
|
||||
"brand": "Brand",
|
||||
"color": "Color",
|
||||
"delete_vehicle": "@:{'phrases.compat.vehicles.delete'}",
|
||||
|
||||
@@ -46,6 +46,14 @@
|
||||
"edit_title": "@:{'phrases.compat.limited_backoffice.employees.edit_title'}",
|
||||
"name": "@:{'phrases.compat.limited_backoffice.employees.name'}",
|
||||
"email": "@:{'phrases.compat.limited_backoffice.employees.email'}",
|
||||
"phone": "@:{'phrases.compat.limited_backoffice.employees.phone'}",
|
||||
"phone_validation": "@:{'phrases.compat.limited_backoffice.employees.phone_validation'}",
|
||||
"country_codes": {
|
||||
"denmark": "@:{'phrases.compat.limited_backoffice.employees.country_codes.denmark'}",
|
||||
"sweden": "@:{'phrases.compat.limited_backoffice.employees.country_codes.sweden'}",
|
||||
"norway": "@:{'phrases.compat.limited_backoffice.employees.country_codes.norway'}",
|
||||
"finland": "@:{'phrases.compat.limited_backoffice.employees.country_codes.finland'}"
|
||||
},
|
||||
"password": "@:{'phrases.compat.limited_backoffice.employees.password'}",
|
||||
"password_create_help": "@:{'phrases.compat.limited_backoffice.employees.password_create_help'}",
|
||||
"password_update_help": "@:{'phrases.compat.limited_backoffice.employees.password_update_help'}",
|
||||
@@ -279,6 +287,14 @@
|
||||
"edit_title": "@.capitalize:{'terms.glossary.edit'} @:{'terms.glossary.employee'}",
|
||||
"name": "Name",
|
||||
"email": "Email",
|
||||
"phone": "Phone",
|
||||
"phone_validation": "Phone number must be 4-15 digits.",
|
||||
"country_codes": {
|
||||
"denmark": "Denmark",
|
||||
"sweden": "Sweden",
|
||||
"norway": "Norway",
|
||||
"finland": "Finland"
|
||||
},
|
||||
"password": "@.capitalize:{'terms.glossary.password'}",
|
||||
"password_create_help": "@.capitalize:{'terms.glossary.required'} @:{'terms.glossary.for'} new @:{'terms.glossary.employees'}. Use @:{'terms.glossary.at'} @:{'terms.glossary.least'} 8 characters.",
|
||||
"password_update_help": "Leave blank @:{'terms.glossary.to'} keep @:{'terms.replication.article.host_mention'} existing @:{'terms.glossary.password'}.",
|
||||
|
||||
@@ -38,6 +38,13 @@
|
||||
"title": "@:{'phrases.compat.departments.tab.opening_hours'}"
|
||||
},
|
||||
"phone": "@:common.phone",
|
||||
"pricing": {
|
||||
"custom_pricing_disabled": "@:{'phrases.compat.departments.pricing.custom_pricing_disabled'}",
|
||||
"custom_pricing_enabled": "@:{'phrases.compat.departments.pricing.custom_pricing_enabled'}",
|
||||
"custom_pricing_missing_price": "@:{'phrases.compat.departments.pricing.custom_pricing_missing_price'}",
|
||||
"custom_pricing_only": "@:{'phrases.compat.departments.pricing.custom_pricing_only'}",
|
||||
"effective_department_price": "@:{'phrases.compat.departments.pricing.effective_department_price'}"
|
||||
},
|
||||
"products": {
|
||||
"new_product": "@:products.new_product"
|
||||
},
|
||||
|
||||
@@ -194,6 +194,7 @@
|
||||
"departments": {
|
||||
"columns": {
|
||||
"archived": "@:{'phrases.compat.objects.departments.columns.archived'}",
|
||||
"custom_pricing_only": "@:{'phrases.compat.objects.departments.columns.custom_pricing_only'}",
|
||||
"dimension": "@:{'phrases.compat.objects.departments.columns.dimension'}",
|
||||
"economic_department": "@:{'phrases.compat.objects.departments.columns.economic_department'}",
|
||||
"latitude": "@:{'phrases.compat.objects.departments.columns.latitude'}",
|
||||
|
||||
@@ -40,6 +40,82 @@
|
||||
"subtitle": "@:{'phrases.compat.superuser_dashboard.departments.subtitle'}",
|
||||
"title": "@:common.departments"
|
||||
},
|
||||
"department_navigation": {
|
||||
"overview": "Overview",
|
||||
"modules": "Modules",
|
||||
"branding": "Profile & Branding",
|
||||
"gateways": "Gateways",
|
||||
"stripe": "Stripe",
|
||||
"pricing": "Pricing",
|
||||
"categories": "Categories"
|
||||
},
|
||||
"department_overview": {
|
||||
"title": "Department overview",
|
||||
"subtitle": "Operational overview for the selected department",
|
||||
"loading": "Loading department overview",
|
||||
"date_from": "From",
|
||||
"date_to": "To",
|
||||
"range_label": "{from} to {to}",
|
||||
"empty_value": "-",
|
||||
"out_of": "of {total}",
|
||||
"presets": {
|
||||
"today": "Today",
|
||||
"last_seven_days": "Last 7 days"
|
||||
},
|
||||
"metrics": {
|
||||
"bookings": "Bookings",
|
||||
"complaints": "Complaints",
|
||||
"night_washes": "Night washes",
|
||||
"overtime": "Overtime",
|
||||
"products_sold": "Products sold",
|
||||
"revenue": "Revenue",
|
||||
"transactions": "Transactions",
|
||||
"washes": "Washes",
|
||||
"water_usage": "Water"
|
||||
},
|
||||
"units": {
|
||||
"hours": "h",
|
||||
"liters": "L"
|
||||
},
|
||||
"products": {
|
||||
"title": "Product mix",
|
||||
"subtitle": "Tracked wash products in the selected period",
|
||||
"empty": "No product activity for the selected period"
|
||||
},
|
||||
"profile": {
|
||||
"title": "Department profile",
|
||||
"no_description": "No department description",
|
||||
"department_id": "Department ID",
|
||||
"economic_department_id": "Economic department",
|
||||
"branding": "Branding",
|
||||
"created_at": "Created",
|
||||
"updated_at": "Updated"
|
||||
},
|
||||
"hardware": {
|
||||
"title": "Hardware readiness",
|
||||
"subtitle": "Gateway-backed lane and relay state",
|
||||
"gateways": "Gateways online",
|
||||
"lanes": "Lanes",
|
||||
"gates": "Gates",
|
||||
"relays": "Relays",
|
||||
"scanners": "Scanners",
|
||||
"issues": "Issues"
|
||||
},
|
||||
"quick_links": {
|
||||
"title": "Department tools",
|
||||
"subtitle": "Open the focused setup areas for this department",
|
||||
"modules": "Modules",
|
||||
"branding": "Branding",
|
||||
"gateways": "Gateways",
|
||||
"stripe": "Stripe",
|
||||
"pricing": "Pricing",
|
||||
"categories": "Categories"
|
||||
},
|
||||
"errors": {
|
||||
"invalid_department": "A valid department is required",
|
||||
"load": "Unable to load the department overview"
|
||||
}
|
||||
},
|
||||
"employees": {
|
||||
"edit_employee_title": "@:employees.edit_employee",
|
||||
"new_employee_subtitle": "@:{'phrases.compat.superuser_dashboard.employees.new_employee_subtitle'}",
|
||||
|
||||
@@ -2,6 +2,20 @@
|
||||
"vehicles": {
|
||||
"actions": "@:common.actions",
|
||||
"add": "@:{'phrases.compat.vehicles.add'}",
|
||||
"add_modal": {
|
||||
"customer_label": "@:{'phrases.compat.vehicles.add_modal.customer_label'}",
|
||||
"customer_placeholder": "@:{'phrases.compat.vehicles.add_modal.customer_placeholder'}",
|
||||
"error": "@:{'phrases.compat.vehicles.add_modal.error'}",
|
||||
"no_customer_results": "@:{'phrases.compat.vehicles.add_modal.no_customer_results'}",
|
||||
"reference_placeholder": "@:{'phrases.compat.vehicles.add_modal.reference_placeholder'}",
|
||||
"registration_placeholder": "@:{'phrases.compat.vehicles.add_modal.registration_placeholder'}",
|
||||
"selected_customer": "@:{'phrases.compat.vehicles.add_modal.selected_customer'}",
|
||||
"submit": "@:{'phrases.compat.vehicles.add_modal.submit'}",
|
||||
"title": "@:{'phrases.compat.vehicles.add_modal.title'}",
|
||||
"type_load_error": "@:{'phrases.compat.vehicles.add_modal.type_load_error'}",
|
||||
"type_placeholder": "@:{'phrases.compat.vehicles.add_modal.type_placeholder'}",
|
||||
"validation_error": "@:{'phrases.compat.vehicles.add_modal.validation_error'}"
|
||||
},
|
||||
"brand": "@:{'phrases.compat.vehicles.brand'}",
|
||||
"color": "@:{'phrases.compat.vehicles.color'}",
|
||||
"created_at": "@:{'phrases.compat.global.generated'}",
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
"error_report": {
|
||||
"button": "Rapporter feil",
|
||||
"title": "Rapporter feil",
|
||||
"subtitle": "Send gjeldende skjermbilde og de siste feildetaljene til support.",
|
||||
"subtitle": "Send de siste feildetaljene til support. Et skjermbilde legges ved når det er mulig.",
|
||||
"before_error": "Hva gjorde du før feilen oppstod?",
|
||||
"expected": "Hva forventet du at skulle skje?",
|
||||
"actual": "Hva skjedde faktisk?",
|
||||
"before_error_placeholder": "Beskriv handlingen du utførte, for eksempel å åpne ordre eller velge en kunde.",
|
||||
"expected_placeholder": "Beskriv resultatet du forventet å se.",
|
||||
"actual_placeholder": "Beskriv hva du så i stedet, inkludert eventuell feiltekst.",
|
||||
"consent": "Jeg godtar at gjeldende app-skjermbilde, siste request-feil, Vue-feil, nettleserdetaljer og svarene mine samles inn for feilsøking.",
|
||||
"consent": "Jeg godtar at siste request-feil, Vue-feil, nettleserdetaljer, svarene mine og et app-skjermbilde når det er mulig, samles inn for feilsøking.",
|
||||
"submit": "Send rapport",
|
||||
"submitted": "Feilrapport sendt.",
|
||||
"capture_failed": "Skjermbildet kunne ikke tas. Prøv igjen.",
|
||||
"capture_failed": "Skjermbildet kunne ikke tas. Rapporten sendes uten skjermbilde.",
|
||||
"submit_failed": "Feilrapporten kunne ikke sendes.",
|
||||
"required": "Alle felter og godkjenning av datainnsamling er påkrevd.",
|
||||
"page_subtitle": "Rapporterte skjermer, request-feil og Vue-feil",
|
||||
|
||||
@@ -46,6 +46,14 @@
|
||||
"edit_title": "@:{'phrases.compat.limited_backoffice.employees.edit_title'}",
|
||||
"name": "@:{'phrases.compat.limited_backoffice.employees.name'}",
|
||||
"email": "@:{'phrases.compat.limited_backoffice.employees.email'}",
|
||||
"phone": "@:{'phrases.compat.limited_backoffice.employees.phone'}",
|
||||
"phone_validation": "@:{'phrases.compat.limited_backoffice.employees.phone_validation'}",
|
||||
"country_codes": {
|
||||
"denmark": "@:{'phrases.compat.limited_backoffice.employees.country_codes.denmark'}",
|
||||
"sweden": "@:{'phrases.compat.limited_backoffice.employees.country_codes.sweden'}",
|
||||
"norway": "@:{'phrases.compat.limited_backoffice.employees.country_codes.norway'}",
|
||||
"finland": "@:{'phrases.compat.limited_backoffice.employees.country_codes.finland'}"
|
||||
},
|
||||
"password": "@:{'phrases.compat.limited_backoffice.employees.password'}",
|
||||
"password_create_help": "@:{'phrases.compat.limited_backoffice.employees.password_create_help'}",
|
||||
"password_update_help": "@:{'phrases.compat.limited_backoffice.employees.password_update_help'}",
|
||||
@@ -279,6 +287,14 @@
|
||||
"edit_title": "@:{'terms.glossary.rediger'} @:{'terms.glossary.medarbeider'}",
|
||||
"name": "Navn",
|
||||
"email": "E-post",
|
||||
"phone": "Telefon",
|
||||
"phone_validation": "Telefonnummeret må være 4-15 sifre.",
|
||||
"country_codes": {
|
||||
"denmark": "Danmark",
|
||||
"sweden": "Sverige",
|
||||
"norway": "Norge",
|
||||
"finland": "Finland"
|
||||
},
|
||||
"password": "@.capitalize:{'terms.glossary.passord'}",
|
||||
"password_create_help": "@.capitalize:{'terms.glossary.kreves'} @:{'terms.glossary.for'} nye @:{'terms.glossary.medarbeidere'}. Bruk @:{'terms.glossary.minst'} 8 tegn.",
|
||||
"password_update_help": "La stå tomt @:{'terms.glossary.for'} å beholde nåværende @:{'terms.glossary.passord'}.",
|
||||
|
||||
@@ -3,17 +3,17 @@
|
||||
"error_report": {
|
||||
"button": "Rapportera fel",
|
||||
"title": "Rapportera fel",
|
||||
"subtitle": "Skicka aktuell skärm och de senaste feldetaljerna till support.",
|
||||
"subtitle": "Skicka de senaste feldetaljerna till support. En skärmbild bifogas när det är möjligt.",
|
||||
"before_error": "Vad gjorde du innan felet uppstod?",
|
||||
"expected": "Vad förväntade du dig skulle hända?",
|
||||
"actual": "Vad hände faktiskt?",
|
||||
"before_error_placeholder": "Beskriv åtgärden du gjorde, till exempel att öppna ordrar eller välja en kund.",
|
||||
"expected_placeholder": "Beskriv resultatet du förväntade dig att se.",
|
||||
"actual_placeholder": "Beskriv vad du såg i stället, inklusive eventuell feltext.",
|
||||
"consent": "Jag accepterar att aktuell app-skärm, senaste request-fel, Vue-fel, webbläsardetaljer och mina svar samlas in för felsökning.",
|
||||
"consent": "Jag accepterar att senaste request-fel, Vue-fel, webbläsardetaljer, mina svar och en app-skärmbild när det är möjligt samlas in för felsökning.",
|
||||
"submit": "Skicka rapport",
|
||||
"submitted": "Felrapport skickad.",
|
||||
"capture_failed": "Skärmbilden kunde inte tas. Försök igen.",
|
||||
"capture_failed": "Skärmbilden kunde inte tas. Rapporten skickas utan skärmbild.",
|
||||
"submit_failed": "Felrapporten kunde inte skickas.",
|
||||
"required": "Alla fält och godkännande av datainsamling krävs.",
|
||||
"page_subtitle": "Rapporterade skärmar, request-fel och Vue-fel",
|
||||
|
||||
@@ -46,6 +46,14 @@
|
||||
"edit_title": "@:{'phrases.compat.limited_backoffice.employees.edit_title'}",
|
||||
"name": "@:{'phrases.compat.limited_backoffice.employees.name'}",
|
||||
"email": "@:{'phrases.compat.limited_backoffice.employees.email'}",
|
||||
"phone": "@:{'phrases.compat.limited_backoffice.employees.phone'}",
|
||||
"phone_validation": "@:{'phrases.compat.limited_backoffice.employees.phone_validation'}",
|
||||
"country_codes": {
|
||||
"denmark": "@:{'phrases.compat.limited_backoffice.employees.country_codes.denmark'}",
|
||||
"sweden": "@:{'phrases.compat.limited_backoffice.employees.country_codes.sweden'}",
|
||||
"norway": "@:{'phrases.compat.limited_backoffice.employees.country_codes.norway'}",
|
||||
"finland": "@:{'phrases.compat.limited_backoffice.employees.country_codes.finland'}"
|
||||
},
|
||||
"password": "@:{'phrases.compat.limited_backoffice.employees.password'}",
|
||||
"password_create_help": "@:{'phrases.compat.limited_backoffice.employees.password_create_help'}",
|
||||
"password_update_help": "@:{'phrases.compat.limited_backoffice.employees.password_update_help'}",
|
||||
@@ -279,6 +287,14 @@
|
||||
"edit_title": "@:{'terms.glossary.redigera'} @:{'terms.glossary.medarbetare'}",
|
||||
"name": "Namn",
|
||||
"email": "E-post",
|
||||
"phone": "Telefon",
|
||||
"phone_validation": "Telefonnumret måste vara 4-15 siffror.",
|
||||
"country_codes": {
|
||||
"denmark": "Danmark",
|
||||
"sweden": "Sverige",
|
||||
"norway": "Norge",
|
||||
"finland": "Finland"
|
||||
},
|
||||
"password": "@.capitalize:{'terms.glossary.losenord'}",
|
||||
"password_create_help": "@.capitalize:{'terms.glossary.kravs'} @:{'terms.glossary.for'} nya @:{'terms.glossary.medarbetare'}. Använd @:{'terms.glossary.minst'} 8 tecken.",
|
||||
"password_update_help": "Lämna tomt @:{'terms.glossary.for'} att behålla nuvarande @:{'terms.glossary.losenord'}.",
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
const DATE_ONLY_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
|
||||
const DATE_ONLY_PREFIX_PATTERN = /^(\d{4}-\d{2}-\d{2})/;
|
||||
|
||||
const padDatePart = (value) => String(value).padStart(2, "0");
|
||||
|
||||
export const isValidDate = (value) => value instanceof Date && !Number.isNaN(value.getTime());
|
||||
|
||||
export const formatLocalDateOnly = (value = new Date()) => {
|
||||
if (typeof value === "string") {
|
||||
const directMatch = value.trim().match(DATE_ONLY_PREFIX_PATTERN);
|
||||
if (directMatch) {
|
||||
return directMatch[1];
|
||||
}
|
||||
}
|
||||
|
||||
const date = value instanceof Date ? value : new Date(value);
|
||||
if (!isValidDate(date)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return [
|
||||
date.getFullYear(),
|
||||
padDatePart(date.getMonth() + 1),
|
||||
padDatePart(date.getDate()),
|
||||
].join("-");
|
||||
};
|
||||
|
||||
export const parseLocalDateOnly = (value) => {
|
||||
if (value instanceof Date) {
|
||||
return isValidDate(value)
|
||||
? new Date(value.getFullYear(), value.getMonth(), value.getDate())
|
||||
: new Date(Number.NaN);
|
||||
}
|
||||
|
||||
const stringValue = String(value ?? "").trim();
|
||||
const match = DATE_ONLY_PATTERN.exec(stringValue);
|
||||
if (match) {
|
||||
const year = Number(match[1]);
|
||||
const month = Number(match[2]);
|
||||
const day = Number(match[3]);
|
||||
const parsed = new Date(year, month - 1, day);
|
||||
|
||||
if (
|
||||
parsed.getFullYear() === year
|
||||
&& parsed.getMonth() === month - 1
|
||||
&& parsed.getDate() === day
|
||||
) {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
return new Date(Number.NaN);
|
||||
}
|
||||
|
||||
const parsed = new Date(stringValue);
|
||||
return isValidDate(parsed)
|
||||
? new Date(parsed.getFullYear(), parsed.getMonth(), parsed.getDate())
|
||||
: parsed;
|
||||
};
|
||||
|
||||
export const todayLocalDateOnly = () => formatLocalDateOnly(new Date());
|
||||
|
||||
export const yesterdayLocalDateOnly = () => {
|
||||
const yesterday = new Date();
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
return formatLocalDateOnly(yesterday);
|
||||
};
|
||||
|
||||
export const startOfLocalDate = (value) => {
|
||||
const date = parseLocalDateOnly(value);
|
||||
if (!isValidDate(date)) {
|
||||
return date;
|
||||
}
|
||||
date.setHours(0, 0, 0, 0);
|
||||
return date;
|
||||
};
|
||||
|
||||
export const endOfLocalDate = (value) => {
|
||||
const date = parseLocalDateOnly(value);
|
||||
if (!isValidDate(date)) {
|
||||
return date;
|
||||
}
|
||||
date.setHours(23, 59, 59, 999);
|
||||
return date;
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
import { authenticatedRequest } from "@/components/session/authenticatedRequest.vue";
|
||||
|
||||
export const getSuperuserDepartmentOverview = (departmentId, { date, dateTo } = {}) => {
|
||||
const normalizedDepartmentId = Number.parseInt(String(departmentId ?? ""), 10);
|
||||
|
||||
if (!Number.isInteger(normalizedDepartmentId) || normalizedDepartmentId <= 0) {
|
||||
return Promise.reject(new Error("A valid department id is required."));
|
||||
}
|
||||
|
||||
const params = {
|
||||
date,
|
||||
};
|
||||
|
||||
if (dateTo) {
|
||||
params.date_to = dateTo;
|
||||
}
|
||||
|
||||
return authenticatedRequest(
|
||||
`/superuser/departments/${encodeURIComponent(String(normalizedDepartmentId))}/overview`,
|
||||
"GET",
|
||||
params
|
||||
);
|
||||
};
|
||||
@@ -16,6 +16,12 @@ import {
|
||||
} from "@/services/limitedBackoffice.js";
|
||||
|
||||
const ROLE_KEYS = ["viewer", "cashier", "booking_coordinator", "operations_lead", "department_admin"];
|
||||
const PHONE_COUNTRY_CODES = [
|
||||
{ value: "45", flag: "🇩🇰", labelKey: "denmark" },
|
||||
{ value: "46", flag: "🇸🇪", labelKey: "sweden" },
|
||||
{ value: "47", flag: "🇳🇴", labelKey: "norway" },
|
||||
{ value: "358", flag: "🇫🇮", labelKey: "finland" },
|
||||
];
|
||||
|
||||
const { t } = useI18n();
|
||||
const departments = ref([]);
|
||||
@@ -32,6 +38,8 @@ const showRolePermissions = ref(false);
|
||||
const form = ref({
|
||||
display_name: "",
|
||||
email: "",
|
||||
phone_country_code: "45",
|
||||
phone: "",
|
||||
password: "",
|
||||
role_key: "viewer",
|
||||
department_ids: [],
|
||||
@@ -212,15 +220,41 @@ const rolePermissionGroups = (role) =>
|
||||
|
||||
const visibleRoles = computed(() => roles.value.filter((role) => ROLE_KEYS.includes(role.key)));
|
||||
const isEditing = computed(() => Boolean(editingEmployee.value));
|
||||
const trimmedEmail = computed(() => String(form.value.email || "").trim());
|
||||
const isEmailValid = computed(() => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(trimmedEmail.value));
|
||||
const normalizedPhone = computed(() => String(form.value.phone || "").replace(/\D/g, ""));
|
||||
const hasPhone = computed(() => normalizedPhone.value.length > 0);
|
||||
const isPhoneValid = computed(() => !hasPhone.value || /^\d{4,15}$/.test(normalizedPhone.value));
|
||||
const isPasswordValid = computed(() => isEditing.value || String(form.value.password || "").length >= 8);
|
||||
const isFormValid = computed(
|
||||
() =>
|
||||
String(form.value.display_name || "").trim().length > 0 &&
|
||||
isEmailValid.value &&
|
||||
isPhoneValid.value &&
|
||||
ROLE_KEYS.includes(form.value.role_key) &&
|
||||
form.value.department_ids.length > 0 &&
|
||||
isPasswordValid.value
|
||||
);
|
||||
|
||||
const countryCodeLabel = (countryCode) => {
|
||||
const option = PHONE_COUNTRY_CODES.find((item) => item.value === String(countryCode || ""));
|
||||
if (!option) {
|
||||
return "";
|
||||
}
|
||||
return `${option.flag} +${option.value} ${t(`templates.limited_backoffice.employees.country_codes.${option.labelKey}`)}`;
|
||||
};
|
||||
|
||||
const formatEmployeePhone = (employee) => {
|
||||
if (!employee?.phone_country_code || !employee?.phone) {
|
||||
return "";
|
||||
}
|
||||
return `+${employee.phone_country_code} ${employee.phone}`;
|
||||
};
|
||||
|
||||
const sanitizePhone = (event) => {
|
||||
form.value.phone = String(event?.target?.value || "").replace(/\D/g, "");
|
||||
};
|
||||
|
||||
const loadEmployees = async () => {
|
||||
const response = await getLimitedBackofficeEmployees({ includeInactive: includeInactive.value });
|
||||
employees.value = unwrapLimitedBackofficeResponse(response) || [];
|
||||
@@ -257,6 +291,8 @@ const resetForm = () => {
|
||||
form.value = {
|
||||
display_name: "",
|
||||
email: "",
|
||||
phone_country_code: "45",
|
||||
phone: "",
|
||||
password: "",
|
||||
role_key: roles.value[0]?.key || "viewer",
|
||||
department_ids: [],
|
||||
@@ -269,6 +305,8 @@ const editEmployee = (employee) => {
|
||||
form.value = {
|
||||
display_name: employee.display_name || "",
|
||||
email: employee.email || "",
|
||||
phone_country_code: employee.phone_country_code ? String(employee.phone_country_code) : "45",
|
||||
phone: employee.phone ? String(employee.phone) : "",
|
||||
password: "",
|
||||
role_key: employee.role?.key || roles.value[0]?.key || "viewer",
|
||||
department_ids: (employee.departments || []).map((department) => Number(department.id)),
|
||||
@@ -291,7 +329,9 @@ const setDepartmentChecked = (departmentId, checked) => {
|
||||
const buildPayload = () => {
|
||||
const payload = {
|
||||
display_name: String(form.value.display_name || "").trim(),
|
||||
email: String(form.value.email || "").trim() || null,
|
||||
email: trimmedEmail.value,
|
||||
phone_country_code: hasPhone.value ? Number.parseInt(form.value.phone_country_code, 10) : null,
|
||||
phone: hasPhone.value ? Number.parseInt(normalizedPhone.value, 10) : null,
|
||||
role_key: form.value.role_key,
|
||||
department_ids: form.value.department_ids,
|
||||
};
|
||||
@@ -416,12 +456,51 @@ onMounted(() => {
|
||||
id="limited-employee-email"
|
||||
v-model="form.email"
|
||||
class="input"
|
||||
:class="{ 'is-danger': formAttempted && !isEmailValid }"
|
||||
type="email"
|
||||
required
|
||||
data-testid="limited-employee-email"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label" for="limited-employee-phone">
|
||||
{{ t("templates.limited_backoffice.employees.phone") }}
|
||||
</label>
|
||||
<div class="limited-employee-phone">
|
||||
<div class="control">
|
||||
<div class="select is-fullwidth">
|
||||
<select
|
||||
id="limited-employee-phone-country-code"
|
||||
v-model="form.phone_country_code"
|
||||
data-testid="limited-employee-phone-country-code"
|
||||
>
|
||||
<option v-for="option in PHONE_COUNTRY_CODES" :key="option.value" :value="option.value">
|
||||
{{ countryCodeLabel(option.value) }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control">
|
||||
<input
|
||||
id="limited-employee-phone"
|
||||
v-model="form.phone"
|
||||
class="input"
|
||||
:class="{ 'is-danger': formAttempted && !isPhoneValid }"
|
||||
type="tel"
|
||||
inputmode="numeric"
|
||||
pattern="[0-9]*"
|
||||
data-testid="limited-employee-phone"
|
||||
@input="sanitizePhone"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="formAttempted && !isPhoneValid" class="help is-danger">
|
||||
{{ t("templates.limited_backoffice.employees.phone_validation") }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label" for="limited-employee-password">
|
||||
{{ t("templates.limited_backoffice.employees.password") }}
|
||||
@@ -488,15 +567,17 @@ onMounted(() => {
|
||||
<div class="field">
|
||||
<label class="label">{{ t("templates.limited_backoffice.employees.departments") }}</label>
|
||||
<div class="limited-employee-departments" data-testid="limited-employee-departments">
|
||||
<label v-for="department in departments" :key="department.id" class="checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="departmentChecked(department.id)"
|
||||
:data-testid="`limited-employee-department-${department.id}`"
|
||||
@change="setDepartmentChecked(department.id, $event.target.checked)"
|
||||
/>
|
||||
<span>{{ department.name }}</span>
|
||||
</label>
|
||||
<b-switch
|
||||
v-for="department in departments"
|
||||
:key="department.id"
|
||||
size="is-small"
|
||||
type="is-link"
|
||||
:model-value="departmentChecked(department.id)"
|
||||
:data-testid="`limited-employee-department-${department.id}`"
|
||||
@update:model-value="setDepartmentChecked(department.id, $event)"
|
||||
>
|
||||
{{ department.name }}
|
||||
</b-switch>
|
||||
</div>
|
||||
<p v-if="formAttempted && form.department_ids.length === 0" class="help is-danger">
|
||||
{{ t("templates.limited_backoffice.employees.department_required") }}
|
||||
@@ -507,12 +588,12 @@ onMounted(() => {
|
||||
{{ t("templates.limited_backoffice.employees.validation") }}
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
<div class="limited-employee-actions">
|
||||
<button
|
||||
type="submit"
|
||||
class="button is-dark"
|
||||
class="button is-dark is-fullwidth"
|
||||
:class="{ 'is-loading': saving }"
|
||||
:disabled="saving"
|
||||
:disabled="saving || !isFormValid"
|
||||
data-testid="limited-employee-save"
|
||||
>
|
||||
<span class="icon is-small"><i class="fas fa-save" aria-hidden="true"></i></span>
|
||||
@@ -521,7 +602,7 @@ onMounted(() => {
|
||||
<button
|
||||
v-if="isEditing"
|
||||
type="button"
|
||||
class="button is-light"
|
||||
class="button is-light is-fullwidth"
|
||||
data-testid="limited-employee-cancel"
|
||||
@click="resetForm"
|
||||
>
|
||||
@@ -582,6 +663,13 @@ onMounted(() => {
|
||||
<td>
|
||||
<strong>{{ employee.display_name }}</strong>
|
||||
<p v-if="employee.email" class="has-text-grey is-size-7">{{ employee.email }}</p>
|
||||
<p
|
||||
v-if="formatEmployeePhone(employee)"
|
||||
class="has-text-grey is-size-7"
|
||||
:data-testid="`limited-employee-phone-${employee.id}`"
|
||||
>
|
||||
{{ formatEmployeePhone(employee) }}
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<strong>{{ roleLabel(employee.role) }}</strong>
|
||||
@@ -733,9 +821,14 @@ onMounted(() => {
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.limited-employee-departments .checkbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.limited-employee-phone {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(9.5rem, 0.75fr) minmax(0, 1fr);
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.limited-employee-actions {
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
@@ -866,6 +959,10 @@ onMounted(() => {
|
||||
.limited-employees-header__inactive {
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.limited-employee-phone {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
|
||||
+4
-3
@@ -19,6 +19,7 @@ import DepartmentDashboardDailyReportNavigation from "@/views/dashboards/departm
|
||||
import DepartmentDashboardDailyReportProductSales from "@/views/dashboards/departmentDashboard/modules/daily-report/displays/DepartmentDashboardDailyReportProductSales.vue";
|
||||
import DepartmentDashboardDailyReportTodayForm from "@/views/dashboards/departmentDashboard/modules/daily-report/displays/DepartmentDashboardDailyReportTodayForm.vue";
|
||||
import DepartmentWeather from "@/views/dashboards/departmentDashboard/modules/daily-report/DepartmentWeather.vue";
|
||||
import { parseLocalDateOnly, todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
import {
|
||||
complaints_metric_state,
|
||||
count_bookings,
|
||||
@@ -131,7 +132,7 @@ onMounted(() => {
|
||||
return [...accessibleDepartmentIds.value];
|
||||
})();
|
||||
|
||||
const initialDateFrom = typeof query.dateFrom === "string" ? query.dateFrom : new Date().toISOString().split("T")[0];
|
||||
const initialDateFrom = typeof query.dateFrom === "string" ? query.dateFrom : todayLocalDateOnly();
|
||||
const initialDateTo = typeof query.dateTo === "string" ? query.dateTo : initialDateFrom;
|
||||
|
||||
initializeDailyReportFilters({
|
||||
@@ -170,7 +171,7 @@ watch(
|
||||
);
|
||||
|
||||
const formatDateShort = (dateString) => {
|
||||
const date = new Date(dateString);
|
||||
const date = parseLocalDateOnly(dateString);
|
||||
const dayName = date.toLocaleDateString("da-DK", { weekday: "long" });
|
||||
const dateValue = date.toLocaleDateString("da-DK", { day: "2-digit", month: "2-digit", year: "2-digit" });
|
||||
return `${dayName} d. ${dateValue}`;
|
||||
@@ -178,7 +179,7 @@ const formatDateShort = (dateString) => {
|
||||
|
||||
const formatDateRangeSubtitle = (startDateString, endDateString) => {
|
||||
const dateOptions = { day: "2-digit", month: "2-digit", year: "2-digit" };
|
||||
return `${new Date(startDateString).toLocaleDateString("da-DK", dateOptions)} - ${new Date(endDateString).toLocaleDateString("da-DK", dateOptions)}`;
|
||||
return `${parseLocalDateOnly(startDateString).toLocaleDateString("da-DK", dateOptions)} - ${parseLocalDateOnly(endDateString).toLocaleDateString("da-DK", dateOptions)}`;
|
||||
};
|
||||
|
||||
const formatSubtitle = (subtitle) => {
|
||||
|
||||
+3
-5
@@ -2,18 +2,16 @@
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import { createEmptyOutsideHours, normalizeOutsideHours } from "@/views/dashboards/departmentDashboard/modules/daily-report/outsideHours.js";
|
||||
import { todayLocalDateOnly, yesterdayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
const GENERATE_UNIQUE_ID = () => Math.random().toString(36).slice(2, 11);
|
||||
|
||||
const DATE_TODAY = () => {
|
||||
const date = new Date();
|
||||
return date.toISOString().split("T")[0];
|
||||
return todayLocalDateOnly();
|
||||
};
|
||||
|
||||
const DATE_YESTERDAY = () => {
|
||||
const date = new Date();
|
||||
date.setDate(date.getDate() - 1);
|
||||
return date.toISOString().split("T")[0];
|
||||
return yesterdayLocalDateOnly();
|
||||
};
|
||||
|
||||
const date_shortcuts = ref({
|
||||
|
||||
+3
-9
@@ -17,6 +17,7 @@ import {
|
||||
isLoading as departmentsStoreLoading,
|
||||
} from "@/components/pagination/departmentTabs.vue";
|
||||
import { isAccessibleVisibleDepartment, sortByDepartmentPriorityOrder } from "@/services/departmentVisibility.js";
|
||||
import { formatLocalDateOnly, parseLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
/**
|
||||
* Props:
|
||||
@@ -141,14 +142,7 @@ const toggleAllDepartments = () => {
|
||||
};
|
||||
|
||||
const formatDateSelectionValue = (date) => {
|
||||
if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
return `${year}-${month}-${day}`;
|
||||
return formatLocalDateOnly(date);
|
||||
};
|
||||
|
||||
const onDateSelectionChange = (startDate, endDate) => {
|
||||
@@ -161,7 +155,7 @@ const onDateSelectionChange = (startDate, endDate) => {
|
||||
<div class="column is-12" data-testid="daily-report-date-controls">
|
||||
<DatePeriodSelector
|
||||
:on-selection-change="onDateSelectionChange"
|
||||
:selection="{ startDate: new Date(selected_date), endDate: new Date(selected_date_to) }"
|
||||
:selection="{ startDate: parseLocalDateOnly(selected_date), endDate: parseLocalDateOnly(selected_date_to) }"
|
||||
:visibility="{
|
||||
showDailySelector: true,
|
||||
showWeeklySelector: true,
|
||||
|
||||
+4
-3
@@ -5,6 +5,7 @@ import { parseError, getError, clearErrors} from "@/components/request/HandleGlo
|
||||
import ShowErrorField from "@/components/global/ShowErrorField.vue";
|
||||
import { selected_date, onChangeCall, selected_department_id} from "@/views/dashboards/departmentDashboard/modules/daily-report/DepartmentDailyReportObject.vue";
|
||||
import Swal from "sweetalert2";
|
||||
import { parseLocalDateOnly, yesterdayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
const props = defineProps({
|
||||
department_id: Number,
|
||||
@@ -23,7 +24,7 @@ const created_at = ref(null);
|
||||
const id = ref(null);
|
||||
const message = ref('');
|
||||
const yesterday = ref({
|
||||
date: new Date(new Date().setDate(new Date().getDate() - 1)).toISOString().split('T')[0],
|
||||
date: yesterdayLocalDateOnly(),
|
||||
water_usage: 0,
|
||||
water_usage_morning: 0,
|
||||
notes: null,
|
||||
@@ -104,7 +105,7 @@ const getDailyReport = async () => {
|
||||
// Check if the date is today
|
||||
const created_at_val = new Date(response.data.data.created_at);
|
||||
const today = new Date();
|
||||
if (created_at_val.toDateString() === (selected_date.value ? new Date(selected_date.value) : today).toDateString()) {
|
||||
if (created_at_val.toDateString() === (selected_date.value ? parseLocalDateOnly(selected_date.value) : today).toDateString()) {
|
||||
// The daily report is today
|
||||
// So we can set the values
|
||||
water_usage.value = parseInt(response.data.data.water_usage);
|
||||
@@ -212,4 +213,4 @@ onChangeCall(() => {
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
+4
-3
@@ -1,10 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue';
|
||||
import { timeBookingsNewScheduler } from '@/views/dashboards/departmentDashboard/modules/time-bookings/book/TimeBookingsNewScheduler.vue';
|
||||
import { formatLocalDateOnly, parseLocalDateOnly } from "@/services/dateOnly.js";
|
||||
const date = ref();
|
||||
// Set the initial date to the current date YYYY-MM-DD format
|
||||
const formatDate = (date_input) => {
|
||||
return date_input.toISOString().split('T')[0];
|
||||
return formatLocalDateOnly(date_input);
|
||||
};
|
||||
date.value = formatDate(new Date());
|
||||
|
||||
@@ -15,7 +16,7 @@ watch(timeBookingsNewScheduler.date.selected, (newDate) => {
|
||||
|
||||
watch(date, (newDate) => {
|
||||
// Update the selected date in the scheduler when the date input changes
|
||||
timeBookingsNewScheduler.date.selected.value = new Date(newDate);
|
||||
timeBookingsNewScheduler.date.selected.value = parseLocalDateOnly(newDate);
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -63,4 +64,4 @@ watch(date, (newDate) => {
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
+2
-2
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { SessionUser } from '@/components/session/token/SessionUser.vue';
|
||||
import { todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
const props = defineProps({
|
||||
department_id: {
|
||||
@@ -68,8 +69,7 @@ const getBookings = async () => {
|
||||
};
|
||||
|
||||
const getDate = () => {
|
||||
const date = new Date();
|
||||
return date.toISOString().split('T')[0];
|
||||
return todayLocalDateOnly();
|
||||
};
|
||||
|
||||
// Get the department
|
||||
|
||||
+4
-3
@@ -2,6 +2,7 @@
|
||||
|
||||
import { selected_date, selected_date_to, selectDate as selectDailyReportDate } from "@/views/dashboards/departmentDashboard/modules/daily-report/DepartmentDailyReportObject.vue";
|
||||
import DatePeriodSelector from "@/components/displays/buttons/DatePeriodSelector.vue";
|
||||
import { formatLocalDateOnly, parseLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
// Emits for parents that want to react to date changes (non-breaking if unused)
|
||||
const emit = defineEmits(['date-change']);
|
||||
@@ -16,12 +17,12 @@ const selectDate = (startIso, endIso) => {
|
||||
|
||||
<template>
|
||||
<DatePeriodSelector
|
||||
:on-selection-change="(startDate, endDate) => selectDate(startDate.toISOString().split('T')[0], endDate.toISOString().split('T')[0])"
|
||||
:selection="{ startDate: new Date(selected_date), endDate: new Date(selected_date_to) }"
|
||||
:on-selection-change="(startDate, endDate) => selectDate(formatLocalDateOnly(startDate), formatLocalDateOnly(endDate))"
|
||||
:selection="{ startDate: parseLocalDateOnly(selected_date), endDate: parseLocalDateOnly(selected_date_to) }"
|
||||
:visibility="{ showDailySelector: true, showWeeklySelector: true, showMultipleMonthWarning: false, showUpdateButton: false }"
|
||||
:reverse-level-order="true"
|
||||
@update:selection="(newSelection) => {
|
||||
selectDate(newSelection.startDate.toISOString().split('T')[0], newSelection.endDate.toISOString().split('T')[0]);
|
||||
selectDate(formatLocalDateOnly(newSelection.startDate), formatLocalDateOnly(newSelection.endDate));
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
|
||||
+4
-3
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import {defineComponent, ref, watch} from 'vue';
|
||||
import { todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
|
||||
type fetch = {
|
||||
@@ -11,8 +12,8 @@ type fetch = {
|
||||
};
|
||||
/** Define the variables */
|
||||
export const show_this_week = ref(false);
|
||||
export const selected_date = ref(new Date().toISOString().split('T')[0]);
|
||||
export const selected_date_to = ref(new Date().toISOString().split('T')[0]);
|
||||
export const selected_date = ref(todayLocalDateOnly());
|
||||
export const selected_date_to = ref(todayLocalDateOnly());
|
||||
export const last_fetch_id = ref(0);
|
||||
export const fetches = ref<fetch[]>([]);
|
||||
/** Define the functions */
|
||||
@@ -53,4 +54,4 @@ watch([selected_date, selected_date_to], () => {
|
||||
export default defineComponent({
|
||||
name: 'DepartmentsOverviewObject'
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,21 +1,53 @@
|
||||
<script setup>
|
||||
import { getOrders } from "@/components/shop/Orders.vue";
|
||||
import { showCreateOrderForm } from "@/components/forms/superUser/createOrderForm.vue";
|
||||
import { ref } from "vue";
|
||||
import SuperUserDashboardNavigation from "@/views/dashboards/superUserDashboard/SuperUserDashboardNavigation.vue";
|
||||
import PageTitle from "@/components/global/PageTitle.vue";
|
||||
import Orders from "@/components/displays/Orders.vue";
|
||||
import RestrictedPageWrapper from "@/components/page/wrappers/RestrictedPageWrapper.vue";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import VehiclesPagination from "@/components/displays/pagination/models/UserDashboard/VehiclesPagination.vue";
|
||||
import SuperuserAddVehicleModal from "@/components/forms/superUser/SuperuserAddVehicleModal.vue";
|
||||
import { loadList } from "@/components/pagination/paginatedList.vue";
|
||||
|
||||
const isAddVehicleModalOpen = ref(false);
|
||||
|
||||
const openAddVehicleModal = () => {
|
||||
isAddVehicleModalOpen.value = true;
|
||||
};
|
||||
|
||||
const closeAddVehicleModal = () => {
|
||||
isAddVehicleModalOpen.value = false;
|
||||
};
|
||||
|
||||
const handleVehicleCreated = async () => {
|
||||
closeAddVehicleModal();
|
||||
await loadList();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RestrictedPageWrapper :hasPermission="SessionUser.canAccessSuperUser()">
|
||||
<SuperUserDashboardNavigation />
|
||||
<VehiclesPagination />
|
||||
<VehiclesPagination>
|
||||
<template #actions>
|
||||
<button
|
||||
class="button is-link button-same-width superuser-vehicles__add-button"
|
||||
type="button"
|
||||
data-testid="superuser-vehicles-add"
|
||||
@click="openAddVehicleModal"
|
||||
>
|
||||
{{ $t("vehicles.add") }}
|
||||
</button>
|
||||
</template>
|
||||
</VehiclesPagination>
|
||||
<SuperuserAddVehicleModal
|
||||
v-if="isAddVehicleModalOpen"
|
||||
@close="closeAddVehicleModal"
|
||||
@created="handleVehicleCreated"
|
||||
/>
|
||||
</RestrictedPageWrapper>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
.superuser-vehicles__add-button {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2,34 +2,871 @@
|
||||
import PageTitle from "@/components/global/PageTitle.vue";
|
||||
import RestrictedPageWrapper from "@/components/page/wrappers/RestrictedPageWrapper.vue";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import { getEdgeGatewayDepartmentWorkspace } from "@/services/edgeGateways.js";
|
||||
import { getSuperuserDepartmentOverview } from "@/services/superuserDepartmentOverview.js";
|
||||
import DepartmentSubPageWrapper from "@/views/dashboards/superUserDashboard/department/DepartmentSubPageWrapper.vue";
|
||||
import { setDepartment, department, departmentId } from "@/views/dashboards/superUserDashboard/department/SuperUserSelectedDepartmentObject.vue";
|
||||
import { useRouter } from 'vue-router'
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
// Get the department from the route
|
||||
const router = useRouter()
|
||||
setDepartment(router.currentRoute.value.params.departmentId);
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
|
||||
const DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
||||
|
||||
const formatDateInput = (value = new Date()) => {
|
||||
const date = value instanceof Date ? value : new Date(value);
|
||||
if (Number.isNaN(date.getTime())) {
|
||||
return formatDateInput(new Date());
|
||||
}
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
|
||||
const addDays = (value, days) => {
|
||||
const date = new Date(`${value}T00:00:00`);
|
||||
date.setDate(date.getDate() + days);
|
||||
return formatDateInput(date);
|
||||
};
|
||||
|
||||
const today = () => formatDateInput(new Date());
|
||||
const isDateValue = (value) => DATE_PATTERN.test(String(value || ""));
|
||||
const normalizeDate = (value, fallback = today()) => (isDateValue(value) ? String(value) : fallback);
|
||||
|
||||
const dateFrom = ref(normalizeDate(route.query.date));
|
||||
const dateTo = ref(normalizeDate(route.query.date_to, dateFrom.value));
|
||||
const department = ref(null);
|
||||
const overview = ref(null);
|
||||
const hardwareWorkspace = ref(null);
|
||||
const loading = ref(false);
|
||||
const hardwareLoading = ref(false);
|
||||
const errorMessage = ref("");
|
||||
|
||||
const departmentId = computed(() => Number.parseInt(String(route.params.departmentId || ""), 10));
|
||||
const hasDepartmentId = computed(() => Number.isInteger(departmentId.value) && departmentId.value > 0);
|
||||
const pageTitle = computed(() => department.value?.name || t("superuser_dashboard.department_overview.title"));
|
||||
const pageSubtitle = computed(() => t("superuser_dashboard.department_overview.subtitle"));
|
||||
const overviewMetrics = computed(() => overview.value?.metrics || {});
|
||||
const productTiles = computed(() => (Array.isArray(overview.value?.products) ? overview.value.products : []));
|
||||
const periodLabel = computed(() =>
|
||||
dateFrom.value === dateTo.value
|
||||
? dateFrom.value
|
||||
: t("superuser_dashboard.department_overview.range_label", {
|
||||
from: dateFrom.value,
|
||||
to: dateTo.value,
|
||||
})
|
||||
);
|
||||
|
||||
const metricDefinitions = computed(() => [
|
||||
{
|
||||
key: "revenue",
|
||||
icon: "fa-sack-dollar",
|
||||
label: t("superuser_dashboard.department_overview.metrics.revenue"),
|
||||
formatter: formatCurrency,
|
||||
},
|
||||
{
|
||||
key: "washes",
|
||||
icon: "fa-truck",
|
||||
label: t("superuser_dashboard.department_overview.metrics.washes"),
|
||||
formatter: formatNumber,
|
||||
},
|
||||
{
|
||||
key: "transactions",
|
||||
icon: "fa-receipt",
|
||||
label: t("superuser_dashboard.department_overview.metrics.transactions"),
|
||||
formatter: formatNumber,
|
||||
},
|
||||
{
|
||||
key: "bookings",
|
||||
icon: "fa-calendar-check",
|
||||
label: t("superuser_dashboard.department_overview.metrics.bookings"),
|
||||
formatter: formatNumber,
|
||||
showOutOf: true,
|
||||
},
|
||||
{
|
||||
key: "products_sold",
|
||||
icon: "fa-boxes-stacked",
|
||||
label: t("superuser_dashboard.department_overview.metrics.products_sold"),
|
||||
formatter: formatNumber,
|
||||
},
|
||||
{
|
||||
key: "water_usage",
|
||||
icon: "fa-droplet",
|
||||
label: t("superuser_dashboard.department_overview.metrics.water_usage"),
|
||||
formatter: formatNumber,
|
||||
suffix: t("superuser_dashboard.department_overview.units.liters"),
|
||||
},
|
||||
{
|
||||
key: "complaints",
|
||||
icon: "fa-triangle-exclamation",
|
||||
label: t("superuser_dashboard.department_overview.metrics.complaints"),
|
||||
formatter: formatNumber,
|
||||
},
|
||||
{
|
||||
key: "night_washes",
|
||||
icon: "fa-moon",
|
||||
label: t("superuser_dashboard.department_overview.metrics.night_washes"),
|
||||
formatter: formatNumber,
|
||||
},
|
||||
{
|
||||
key: "overtime",
|
||||
icon: "fa-clock",
|
||||
label: t("superuser_dashboard.department_overview.metrics.overtime"),
|
||||
formatter: formatDecimal,
|
||||
suffix: t("superuser_dashboard.department_overview.units.hours"),
|
||||
},
|
||||
]);
|
||||
|
||||
const quickLinks = computed(() => [
|
||||
{
|
||||
label: t("superuser_dashboard.department_overview.quick_links.modules"),
|
||||
icon: "fa-toggle-on",
|
||||
path: `/superuser/departments/${departmentId.value}/modules`,
|
||||
},
|
||||
{
|
||||
label: t("superuser_dashboard.department_overview.quick_links.branding"),
|
||||
icon: "fa-palette",
|
||||
path: `/superuser/departments/${departmentId.value}/branding`,
|
||||
},
|
||||
{
|
||||
label: t("superuser_dashboard.department_overview.quick_links.gateways"),
|
||||
icon: "fa-network-wired",
|
||||
path: `/superuser/departments/${departmentId.value}/gateways`,
|
||||
},
|
||||
{
|
||||
label: t("superuser_dashboard.department_overview.quick_links.stripe"),
|
||||
icon: "fa-credit-card",
|
||||
path: `/superuser/departments/${departmentId.value}/stripe/terminals/readers`,
|
||||
},
|
||||
{
|
||||
label: t("superuser_dashboard.department_overview.quick_links.pricing"),
|
||||
icon: "fa-tags",
|
||||
path: `/superuser/departments/${departmentId.value}/pricing`,
|
||||
},
|
||||
{
|
||||
label: t("superuser_dashboard.department_overview.quick_links.categories"),
|
||||
icon: "fa-layer-group",
|
||||
path: `/superuser/departments/${departmentId.value}/categories`,
|
||||
},
|
||||
]);
|
||||
|
||||
function toNumber(value) {
|
||||
const parsed = Number(value);
|
||||
return Number.isFinite(parsed) ? parsed : 0;
|
||||
}
|
||||
|
||||
function formatNumber(value) {
|
||||
return new Intl.NumberFormat("da-DK").format(toNumber(value));
|
||||
}
|
||||
|
||||
function formatDecimal(value) {
|
||||
return new Intl.NumberFormat("da-DK", {
|
||||
maximumFractionDigits: 2,
|
||||
}).format(toNumber(value));
|
||||
}
|
||||
|
||||
function formatCurrency(value) {
|
||||
const amount = toNumber(value);
|
||||
if (SessionUser.functions?.currency?.toLocal) {
|
||||
return SessionUser.functions.currency.toLocal(amount);
|
||||
}
|
||||
|
||||
return new Intl.NumberFormat("da-DK", {
|
||||
style: "currency",
|
||||
currency: "DKK",
|
||||
maximumFractionDigits: 0,
|
||||
}).format(amount);
|
||||
}
|
||||
|
||||
function formatDateTime(value) {
|
||||
if (!value) {
|
||||
return t("superuser_dashboard.department_overview.empty_value");
|
||||
}
|
||||
|
||||
if (SessionUser.functions?.date?.toLocal) {
|
||||
return SessionUser.functions.date.toLocal(value);
|
||||
}
|
||||
|
||||
const date = new Date(String(value).replace(" ", "T"));
|
||||
return Number.isNaN(date.getTime()) ? String(value) : new Intl.DateTimeFormat("da-DK").format(date);
|
||||
}
|
||||
|
||||
function metricPayload(key) {
|
||||
return overviewMetrics.value?.[key] || {
|
||||
state: "unavailable",
|
||||
value: null,
|
||||
};
|
||||
}
|
||||
|
||||
function metricValue(definition) {
|
||||
const metric = metricPayload(definition.key);
|
||||
if (metric.state && metric.state !== "ready") {
|
||||
return t("superuser_dashboard.department_overview.empty_value");
|
||||
}
|
||||
|
||||
const formatted = definition.formatter(metric.value);
|
||||
return definition.suffix ? `${formatted} ${definition.suffix}` : formatted;
|
||||
}
|
||||
|
||||
function metricSecondary(definition) {
|
||||
const metric = metricPayload(definition.key);
|
||||
if (!definition.showOutOf || metric.out_of === undefined || metric.out_of === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return t("superuser_dashboard.department_overview.out_of", {
|
||||
total: formatNumber(metric.out_of),
|
||||
});
|
||||
}
|
||||
|
||||
const asArray = (value) => {
|
||||
if (Array.isArray(value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value && typeof value === "object") {
|
||||
return Object.values(value);
|
||||
}
|
||||
|
||||
return [];
|
||||
};
|
||||
|
||||
const hardwareSummary = computed(() => {
|
||||
const workspace = hardwareWorkspace.value || {};
|
||||
const gateways = asArray(workspace.gateways);
|
||||
const lanes = asArray(workspace.lanes);
|
||||
const gates = asArray(workspace.gates);
|
||||
const relays = asArray(workspace.relays);
|
||||
const scanners = asArray(workspace.scanners || workspace.number_plate_scanners);
|
||||
const issues = asArray(workspace.issues || workspace.diagnostics || workspace.hardware?.issues);
|
||||
const onlineGateways = gateways.filter((gateway) => {
|
||||
const status = String(gateway?.status || gateway?.health || "").toLowerCase();
|
||||
return ["online", "ready", "ok", "healthy"].includes(status);
|
||||
}).length;
|
||||
|
||||
return {
|
||||
gateways: gateways.length,
|
||||
onlineGateways,
|
||||
lanes: lanes.length,
|
||||
gates: gates.length,
|
||||
relays: relays.length,
|
||||
scanners: scanners.length,
|
||||
issues: issues.length,
|
||||
};
|
||||
});
|
||||
|
||||
const hasHardwareSummary = computed(() => hardwareLoading.value || Boolean(hardwareWorkspace.value));
|
||||
const departmentProfileRows = computed(() => [
|
||||
{
|
||||
label: t("superuser_dashboard.department_overview.profile.department_id"),
|
||||
value: department.value?.id ?? t("superuser_dashboard.department_overview.empty_value"),
|
||||
},
|
||||
{
|
||||
label: t("superuser_dashboard.department_overview.profile.economic_department_id"),
|
||||
value: department.value?.economic_department_id ?? t("superuser_dashboard.department_overview.empty_value"),
|
||||
},
|
||||
{
|
||||
label: t("superuser_dashboard.department_overview.profile.branding"),
|
||||
value: department.value?.branding ?? t("superuser_dashboard.department_overview.empty_value"),
|
||||
},
|
||||
{
|
||||
label: t("superuser_dashboard.department_overview.profile.created_at"),
|
||||
value: formatDateTime(department.value?.created_at),
|
||||
},
|
||||
{
|
||||
label: t("superuser_dashboard.department_overview.profile.updated_at"),
|
||||
value: formatDateTime(department.value?.updated_at),
|
||||
},
|
||||
]);
|
||||
|
||||
function normalizeRange(from, to) {
|
||||
const normalizedFrom = normalizeDate(from);
|
||||
let normalizedTo = normalizeDate(to, normalizedFrom);
|
||||
|
||||
if (normalizedTo < normalizedFrom) {
|
||||
normalizedTo = normalizedFrom;
|
||||
}
|
||||
|
||||
return {
|
||||
from: normalizedFrom,
|
||||
to: normalizedTo,
|
||||
};
|
||||
}
|
||||
|
||||
async function replaceRange(from, to) {
|
||||
const normalized = normalizeRange(from, to);
|
||||
dateFrom.value = normalized.from;
|
||||
dateTo.value = normalized.to;
|
||||
|
||||
await router.replace({
|
||||
query: {
|
||||
...route.query,
|
||||
date: normalized.from,
|
||||
date_to: normalized.to === normalized.from ? undefined : normalized.to,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const applyDateInputs = () => replaceRange(dateFrom.value, dateTo.value);
|
||||
const setToday = () => replaceRange(today(), today());
|
||||
const setLastSevenDays = () => replaceRange(addDays(today(), -6), today());
|
||||
|
||||
async function loadOverview() {
|
||||
if (!hasDepartmentId.value) {
|
||||
errorMessage.value = t("superuser_dashboard.department_overview.errors.invalid_department");
|
||||
return;
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
errorMessage.value = "";
|
||||
|
||||
try {
|
||||
const response = await getSuperuserDepartmentOverview(departmentId.value, {
|
||||
date: dateFrom.value,
|
||||
dateTo: dateTo.value,
|
||||
});
|
||||
const payload = response?.data?.data || {};
|
||||
department.value = payload.department || null;
|
||||
overview.value = payload.overview || null;
|
||||
} catch (error) {
|
||||
department.value = null;
|
||||
overview.value = null;
|
||||
errorMessage.value =
|
||||
error?.response?.data?.message || error?.message || t("superuser_dashboard.department_overview.errors.load");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadHardware() {
|
||||
if (!hasDepartmentId.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
hardwareLoading.value = true;
|
||||
hardwareWorkspace.value = null;
|
||||
|
||||
try {
|
||||
const response = await getEdgeGatewayDepartmentWorkspace(departmentId.value);
|
||||
hardwareWorkspace.value = response?.data?.data || null;
|
||||
} catch (_error) {
|
||||
hardwareWorkspace.value = null;
|
||||
} finally {
|
||||
hardwareLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function openQuickLink(path) {
|
||||
router.push(path);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [route.params.departmentId, route.query.date, route.query.date_to],
|
||||
() => {
|
||||
const normalized = normalizeRange(route.query.date, route.query.date_to || route.query.date);
|
||||
dateFrom.value = normalized.from;
|
||||
dateTo.value = normalized.to;
|
||||
loadOverview();
|
||||
loadHardware();
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RestrictedPageWrapper :hasPermission="SessionUser.canAccessSuperUser()">
|
||||
<DepartmentSubPageWrapper>
|
||||
<template #title>
|
||||
<PageTitle title="Department" subtitle="Department data" />
|
||||
<PageTitle :title="pageTitle" :subtitle="pageSubtitle" />
|
||||
</template>
|
||||
<div>
|
||||
Department stuff
|
||||
<code>{{ departmentId }}</code>
|
||||
<code>{{ department.id }}</code>
|
||||
<code>{{ department.name }}</code>
|
||||
<code>{{ department.description }}</code>
|
||||
<code>{{ department.created_at }}</code>
|
||||
<code>{{ department.updated_at }}</code>
|
||||
</div>
|
||||
|
||||
<section class="department-overview" data-testid="superuser-department-overview">
|
||||
<div class="overview-toolbar">
|
||||
<div class="overview-period">
|
||||
<label class="date-field">
|
||||
<span>{{ t("superuser_dashboard.department_overview.date_from") }}</span>
|
||||
<input
|
||||
v-model="dateFrom"
|
||||
class="input"
|
||||
data-testid="department-overview-date-from"
|
||||
type="date"
|
||||
@change="applyDateInputs"
|
||||
/>
|
||||
</label>
|
||||
<label class="date-field">
|
||||
<span>{{ t("superuser_dashboard.department_overview.date_to") }}</span>
|
||||
<input
|
||||
v-model="dateTo"
|
||||
class="input"
|
||||
data-testid="department-overview-date-to"
|
||||
type="date"
|
||||
@change="applyDateInputs"
|
||||
/>
|
||||
</label>
|
||||
<button
|
||||
class="button is-light"
|
||||
data-testid="department-overview-preset-today"
|
||||
type="button"
|
||||
@click="setToday"
|
||||
>
|
||||
<span class="icon"><i class="fa-solid fa-calendar-day" /></span>
|
||||
<span>{{ t("superuser_dashboard.department_overview.presets.today") }}</span>
|
||||
</button>
|
||||
<button
|
||||
class="button is-light"
|
||||
data-testid="department-overview-preset-week"
|
||||
type="button"
|
||||
@click="setLastSevenDays"
|
||||
>
|
||||
<span class="icon"><i class="fa-solid fa-calendar-week" /></span>
|
||||
<span>{{ t("superuser_dashboard.department_overview.presets.last_seven_days") }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="period-chip" data-testid="department-overview-period">
|
||||
<span class="icon"><i class="fa-solid fa-clock-rotate-left" /></span>
|
||||
<span>{{ periodLabel }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="errorMessage" class="notification is-danger is-light" data-testid="department-overview-error">
|
||||
{{ errorMessage }}
|
||||
</div>
|
||||
|
||||
<div v-if="loading && !overview" class="overview-loading" data-testid="department-overview-loading">
|
||||
<span class="icon"><i class="fa-solid fa-spinner fa-spin" /></span>
|
||||
<span>{{ t("superuser_dashboard.department_overview.loading") }}</span>
|
||||
</div>
|
||||
|
||||
<template v-else>
|
||||
<div class="kpi-grid">
|
||||
<article
|
||||
v-for="metric in metricDefinitions"
|
||||
:key="metric.key"
|
||||
class="kpi-card"
|
||||
:data-testid="`department-overview-kpi-${metric.key}`"
|
||||
>
|
||||
<div class="kpi-icon">
|
||||
<i :class="['fa-solid', metric.icon]" />
|
||||
</div>
|
||||
<div class="kpi-content">
|
||||
<span class="kpi-label">{{ metric.label }}</span>
|
||||
<strong class="kpi-value">{{ metricValue(metric) }}</strong>
|
||||
<span v-if="metricSecondary(metric)" class="kpi-secondary">{{ metricSecondary(metric) }}</span>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<div class="overview-main">
|
||||
<section class="overview-panel" data-testid="department-overview-products">
|
||||
<div class="panel-heading-row">
|
||||
<div>
|
||||
<h2>{{ t("superuser_dashboard.department_overview.products.title") }}</h2>
|
||||
<p>{{ t("superuser_dashboard.department_overview.products.subtitle") }}</p>
|
||||
</div>
|
||||
<span class="count-badge">{{ productTiles.length }}</span>
|
||||
</div>
|
||||
<div v-if="productTiles.length" class="product-list">
|
||||
<div v-for="product in productTiles" :key="product.slug || product.product_id" class="product-row">
|
||||
<div class="product-title">
|
||||
<strong>{{ product.title }}</strong>
|
||||
<span>{{ product.slug }}</span>
|
||||
</div>
|
||||
<div class="product-stat">
|
||||
<strong>{{ formatNumber(product.value) }}</strong>
|
||||
<span>
|
||||
{{
|
||||
t("superuser_dashboard.department_overview.out_of", {
|
||||
total: formatNumber(product.out_of),
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="empty-state">
|
||||
{{ t("superuser_dashboard.department_overview.products.empty") }}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="overview-panel" data-testid="department-overview-profile">
|
||||
<div class="panel-heading-row">
|
||||
<div>
|
||||
<h2>{{ t("superuser_dashboard.department_overview.profile.title") }}</h2>
|
||||
<p>{{ department?.description || t("superuser_dashboard.department_overview.profile.no_description") }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<dl class="profile-list">
|
||||
<div v-for="row in departmentProfileRows" :key="row.label" class="profile-row">
|
||||
<dt>{{ row.label }}</dt>
|
||||
<dd>{{ row.value }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section v-if="hasHardwareSummary" class="overview-panel" data-testid="department-overview-hardware">
|
||||
<div class="panel-heading-row">
|
||||
<div>
|
||||
<h2>{{ t("superuser_dashboard.department_overview.hardware.title") }}</h2>
|
||||
<p>{{ t("superuser_dashboard.department_overview.hardware.subtitle") }}</p>
|
||||
</div>
|
||||
<span v-if="hardwareLoading" class="icon"><i class="fa-solid fa-spinner fa-spin" /></span>
|
||||
</div>
|
||||
<div class="hardware-grid">
|
||||
<div class="hardware-stat">
|
||||
<span>{{ t("superuser_dashboard.department_overview.hardware.gateways") }}</span>
|
||||
<strong>{{ formatNumber(hardwareSummary.onlineGateways) }} / {{ formatNumber(hardwareSummary.gateways) }}</strong>
|
||||
</div>
|
||||
<div class="hardware-stat">
|
||||
<span>{{ t("superuser_dashboard.department_overview.hardware.lanes") }}</span>
|
||||
<strong>{{ formatNumber(hardwareSummary.lanes) }}</strong>
|
||||
</div>
|
||||
<div class="hardware-stat">
|
||||
<span>{{ t("superuser_dashboard.department_overview.hardware.gates") }}</span>
|
||||
<strong>{{ formatNumber(hardwareSummary.gates) }}</strong>
|
||||
</div>
|
||||
<div class="hardware-stat">
|
||||
<span>{{ t("superuser_dashboard.department_overview.hardware.relays") }}</span>
|
||||
<strong>{{ formatNumber(hardwareSummary.relays) }}</strong>
|
||||
</div>
|
||||
<div class="hardware-stat">
|
||||
<span>{{ t("superuser_dashboard.department_overview.hardware.scanners") }}</span>
|
||||
<strong>{{ formatNumber(hardwareSummary.scanners) }}</strong>
|
||||
</div>
|
||||
<div class="hardware-stat" :class="{ 'has-issues': hardwareSummary.issues > 0 }">
|
||||
<span>{{ t("superuser_dashboard.department_overview.hardware.issues") }}</span>
|
||||
<strong>{{ formatNumber(hardwareSummary.issues) }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="overview-panel quick-links-panel" data-testid="department-overview-quick-links">
|
||||
<div class="panel-heading-row">
|
||||
<div>
|
||||
<h2>{{ t("superuser_dashboard.department_overview.quick_links.title") }}</h2>
|
||||
<p>{{ t("superuser_dashboard.department_overview.quick_links.subtitle") }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quick-link-grid">
|
||||
<button
|
||||
v-for="link in quickLinks"
|
||||
:key="link.path"
|
||||
class="quick-link"
|
||||
type="button"
|
||||
@click="openQuickLink(link.path)"
|
||||
>
|
||||
<span class="icon"><i :class="['fa-solid', link.icon]" /></span>
|
||||
<span>{{ link.label }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
</DepartmentSubPageWrapper>
|
||||
</RestrictedPageWrapper>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.department-overview {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
</style>
|
||||
.overview-toolbar {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.overview-period {
|
||||
align-items: flex-end;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.date-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
min-width: 10rem;
|
||||
}
|
||||
|
||||
.date-field span,
|
||||
.kpi-label,
|
||||
.kpi-secondary,
|
||||
.panel-heading-row p,
|
||||
.product-title span,
|
||||
.product-stat span,
|
||||
.hardware-stat span,
|
||||
.profile-row dt {
|
||||
color: #64748b;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.period-chip {
|
||||
align-items: center;
|
||||
background: #eef2ff;
|
||||
border: 1px solid #c7d2fe;
|
||||
border-radius: 8px;
|
||||
color: #3730a3;
|
||||
display: inline-flex;
|
||||
font-weight: 700;
|
||||
gap: 0.35rem;
|
||||
min-height: 2.5rem;
|
||||
padding: 0 0.75rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.overview-loading,
|
||||
.empty-state {
|
||||
align-items: center;
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
color: #475569;
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
min-height: 5rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.kpi-grid {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
||||
}
|
||||
|
||||
.kpi-card,
|
||||
.overview-panel {
|
||||
background: #ffffff;
|
||||
border: 1px solid #dbe3ec;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.kpi-card {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
min-height: 6rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.kpi-icon {
|
||||
align-items: center;
|
||||
background: #ecfeff;
|
||||
border-radius: 8px;
|
||||
color: #0f766e;
|
||||
display: inline-flex;
|
||||
height: 2.5rem;
|
||||
justify-content: center;
|
||||
width: 2.5rem;
|
||||
}
|
||||
|
||||
.kpi-content {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.kpi-value {
|
||||
color: #0f172a;
|
||||
font-size: 1.35rem;
|
||||
line-height: 1.25;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.overview-main {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr);
|
||||
}
|
||||
|
||||
.overview-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.panel-heading-row {
|
||||
align-items: flex-start;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.panel-heading-row h2 {
|
||||
color: #0f172a;
|
||||
font-size: 1.05rem;
|
||||
font-weight: 800;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.panel-heading-row p {
|
||||
margin: 0.2rem 0 0;
|
||||
}
|
||||
|
||||
.count-badge {
|
||||
align-items: center;
|
||||
background: #f1f5f9;
|
||||
border: 1px solid #dbe3ec;
|
||||
border-radius: 999px;
|
||||
color: #334155;
|
||||
display: inline-flex;
|
||||
font-weight: 800;
|
||||
justify-content: center;
|
||||
min-width: 2rem;
|
||||
padding: 0.2rem 0.55rem;
|
||||
}
|
||||
|
||||
.product-list,
|
||||
.profile-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.55rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.product-row,
|
||||
.profile-row {
|
||||
align-items: center;
|
||||
border-top: 1px solid #edf2f7;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: space-between;
|
||||
min-height: 3.25rem;
|
||||
padding-top: 0.55rem;
|
||||
}
|
||||
|
||||
.product-title {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.product-title strong {
|
||||
color: #1e293b;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.product-stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 5.5rem;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.product-stat strong,
|
||||
.hardware-stat strong,
|
||||
.profile-row dd {
|
||||
color: #0f172a;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.profile-row dt,
|
||||
.profile-row dd {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.profile-row dd {
|
||||
max-width: 58%;
|
||||
overflow-wrap: anywhere;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.hardware-grid,
|
||||
.quick-link-grid {
|
||||
display: grid;
|
||||
gap: 0.6rem;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.hardware-stat {
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 4.5rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.hardware-stat.has-issues {
|
||||
background: #fff7ed;
|
||||
border-color: #fed7aa;
|
||||
}
|
||||
|
||||
.quick-links-panel {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.quick-link {
|
||||
align-items: center;
|
||||
background: #ffffff;
|
||||
border: 1px solid #dbe3ec;
|
||||
border-radius: 8px;
|
||||
color: #1e293b;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
font-weight: 800;
|
||||
gap: 0.5rem;
|
||||
justify-content: flex-start;
|
||||
min-height: 3rem;
|
||||
padding: 0 0.85rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.quick-link:hover,
|
||||
.quick-link:focus {
|
||||
border-color: #0f766e;
|
||||
color: #0f766e;
|
||||
}
|
||||
|
||||
@media (max-width: 980px) {
|
||||
.overview-toolbar {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.period-chip {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.overview-main {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.date-field,
|
||||
.overview-period .button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.hardware-grid,
|
||||
.quick-link-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.product-row,
|
||||
.profile-row {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.product-stat,
|
||||
.profile-row dd {
|
||||
max-width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -3,7 +3,15 @@ import PageTitle from "@/components/global/PageTitle.vue";
|
||||
import RestrictedPageWrapper from "@/components/page/wrappers/RestrictedPageWrapper.vue";
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import DepartmentSubPageWrapper from "@/views/dashboards/superUserDashboard/department/DepartmentSubPageWrapper.vue";
|
||||
import { setDepartment, department, departmentId, getDepartmentPrice, editDepartmentPrice } from "@/views/dashboards/superUserDashboard/department/SuperUserSelectedDepartmentObject.vue";
|
||||
import {
|
||||
CUSTOM_PRICING_MISSING_PRICE,
|
||||
setDepartment,
|
||||
getDepartmentPrices,
|
||||
getExplicitDepartmentPrice,
|
||||
editDepartmentPrice,
|
||||
isCustomPricingOnly,
|
||||
updateCustomPricingOnly,
|
||||
} from "@/views/dashboards/superUserDashboard/department/SuperUserSelectedDepartmentObject.vue";
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ref } from 'vue';
|
||||
import { getProducts } from "@/components/shop/Products.vue";
|
||||
@@ -11,14 +19,40 @@ import { getProducts } from "@/components/shop/Products.vue";
|
||||
// Get the department from the route
|
||||
const router = useRouter()
|
||||
setDepartment(router.currentRoute.value.params.departmentId);
|
||||
getDepartmentPrices();
|
||||
|
||||
// Set the products
|
||||
const products = ref([]);
|
||||
const isUpdatingCustomPricingOnly = ref(false);
|
||||
|
||||
// Get the products
|
||||
getProducts().then((response) => {
|
||||
products.value = response.data.data;
|
||||
});
|
||||
|
||||
const getDepartmentPriceDisplay = (product) => {
|
||||
const explicitPrice = getExplicitDepartmentPrice(product);
|
||||
if (explicitPrice !== null) {
|
||||
return explicitPrice;
|
||||
}
|
||||
return isCustomPricingOnly() ? CUSTOM_PRICING_MISSING_PRICE : '-';
|
||||
};
|
||||
|
||||
const isMissingCustomPrice = (product) => {
|
||||
return isCustomPricingOnly() && getExplicitDepartmentPrice(product) === null;
|
||||
};
|
||||
|
||||
const toggleCustomPricingOnly = async (event) => {
|
||||
const enabled = event.target.checked;
|
||||
isUpdatingCustomPricingOnly.value = true;
|
||||
try {
|
||||
await updateCustomPricingOnly(enabled);
|
||||
} catch {
|
||||
event.target.checked = isCustomPricingOnly();
|
||||
} finally {
|
||||
isUpdatingCustomPricingOnly.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -28,12 +62,38 @@ getProducts().then((response) => {
|
||||
<PageTitle title="Department" subtitle="Department pricing" />
|
||||
</template>
|
||||
<div>
|
||||
<section class="department-pricing-settings" data-testid="department-custom-pricing-settings">
|
||||
<div>
|
||||
<h2 class="title is-5 mb-1">{{ $t('departments.pricing.custom_pricing_only') }}</h2>
|
||||
<p class="is-size-7 has-text-grey">
|
||||
{{ $t('departments.pricing.custom_pricing_missing_price') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="department-pricing-toggle">
|
||||
<input
|
||||
id="department-custom-pricing-only"
|
||||
class="switch is-rounded is-info"
|
||||
type="checkbox"
|
||||
:checked="isCustomPricingOnly()"
|
||||
:disabled="isUpdatingCustomPricingOnly"
|
||||
data-testid="department-custom-pricing-only-toggle"
|
||||
@change="toggleCustomPricingOnly"
|
||||
/>
|
||||
<label for="department-custom-pricing-only">
|
||||
{{
|
||||
isCustomPricingOnly()
|
||||
? $t('departments.pricing.custom_pricing_enabled')
|
||||
: $t('departments.pricing.custom_pricing_disabled')
|
||||
}}
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
<table class="is-fullwidth table table-striped is-hoverable is-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ $t('common.product') }}</th>
|
||||
<th>{{ $t('tables.common.default_price') }}</th>
|
||||
<th>{{ $t('tables.common.department_price') }}</th>
|
||||
<th>{{ $t('departments.pricing.effective_department_price') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -43,24 +103,45 @@ getProducts().then((response) => {
|
||||
<td
|
||||
@click="editDepartmentPrice(product)"
|
||||
class="is-clickable"
|
||||
>{{ getDepartmentPrice(product) === product.price ? '-' : getDepartmentPrice(product) }}
|
||||
:class="{ 'has-text-danger has-text-weight-semibold': isMissingCustomPrice(product) }"
|
||||
:data-testid="`department-price-cell-${product.id}`"
|
||||
>{{ getDepartmentPriceDisplay(product) }}
|
||||
<i class="is-pulled-right fas fa-edit"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
Department prices...
|
||||
<code>{{ departmentId }}</code>
|
||||
<code>{{ department.id }}</code>
|
||||
<code>{{ department.name }}</code>
|
||||
<code>{{ department.description }}</code>
|
||||
<code>{{ department.created_at }}</code>
|
||||
<code>{{ department.updated_at }}</code>
|
||||
</div>
|
||||
</DepartmentSubPageWrapper>
|
||||
</RestrictedPageWrapper>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.department-pricing-settings {
|
||||
align-items: center;
|
||||
border: 1px solid #dbdbdb;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 1rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
</style>
|
||||
.department-pricing-toggle {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
min-width: 16rem;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.department-pricing-settings {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.department-pricing-toggle {
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+55
-24
@@ -1,31 +1,60 @@
|
||||
<script setup>
|
||||
import { useRouter} from "vue-router";
|
||||
import { ref } from 'vue';
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import { computed } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
// Get the user from the route
|
||||
const departmentId = ref(parseInt(router.currentRoute.value.params.departmentId))
|
||||
const { t } = useI18n();
|
||||
|
||||
const tabs = [
|
||||
{ name: 'Overblik', path: '/superuser/departments/' + departmentId.value },
|
||||
{ name: 'Moduler', path: '/superuser/departments/' + departmentId.value + '/modules' },
|
||||
{ name: 'Profil & Branding', path: '/superuser/departments/' + departmentId.value + '/branding' },
|
||||
{ name: 'Gateways', path: '/superuser/departments/' + departmentId.value + '/gateways' },
|
||||
{ name: 'Stripe', path: '/superuser/departments/' + departmentId.value + '/stripe/terminals/readers' },
|
||||
{ name: 'Priser', path: '/superuser/departments/' + departmentId.value + '/pricing' },
|
||||
{ name: SessionUser.objects.categories.meta.title, path: '/superuser/departments/' + departmentId.value + '/categories' },
|
||||
];
|
||||
const departmentId = computed(() => String(route.params.departmentId || ""));
|
||||
const departmentPath = computed(() => `/superuser/departments/${encodeURIComponent(departmentId.value)}`);
|
||||
|
||||
// Get the current path
|
||||
const currentPath = ref(router.currentRoute.value.path);
|
||||
const tabs = computed(() => [
|
||||
{
|
||||
name: t("superuser_dashboard.department_navigation.overview"),
|
||||
path: departmentPath.value,
|
||||
active: (path) => path === departmentPath.value,
|
||||
},
|
||||
{
|
||||
name: t("superuser_dashboard.department_navigation.modules"),
|
||||
path: `${departmentPath.value}/modules`,
|
||||
active: (path) => path.startsWith(`${departmentPath.value}/modules`),
|
||||
},
|
||||
{
|
||||
name: t("superuser_dashboard.department_navigation.branding"),
|
||||
path: `${departmentPath.value}/branding`,
|
||||
active: (path) => path.startsWith(`${departmentPath.value}/branding`),
|
||||
},
|
||||
{
|
||||
name: t("superuser_dashboard.department_navigation.gateways"),
|
||||
path: `${departmentPath.value}/gateways`,
|
||||
active: (path) => path.startsWith(`${departmentPath.value}/gateways`),
|
||||
},
|
||||
{
|
||||
name: t("superuser_dashboard.department_navigation.stripe"),
|
||||
path: `${departmentPath.value}/stripe/terminals/readers`,
|
||||
active: (path) => path.startsWith(`${departmentPath.value}/stripe`),
|
||||
},
|
||||
{
|
||||
name: t("superuser_dashboard.department_navigation.pricing"),
|
||||
path: `${departmentPath.value}/pricing`,
|
||||
active: (path) => path.startsWith(`${departmentPath.value}/pricing`),
|
||||
},
|
||||
{
|
||||
name: t("superuser_dashboard.department_navigation.categories"),
|
||||
path: `${departmentPath.value}/categories`,
|
||||
active: (path) => path.startsWith(`${departmentPath.value}/categories`),
|
||||
},
|
||||
]);
|
||||
|
||||
// Get the index of the active tab
|
||||
const activeTab = tabs.findIndex(tab => tab.path === currentPath.value);
|
||||
const activeTab = computed(() => tabs.value.findIndex((tab) => tab.active(route.path)));
|
||||
|
||||
// Change the tab
|
||||
const changeTab = (index) => {
|
||||
router.push(tabs[index].path);
|
||||
const tab = tabs.value[index];
|
||||
if (tab) {
|
||||
router.push(tab.path);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -33,13 +62,15 @@ const changeTab = (index) => {
|
||||
<div>
|
||||
<div class="tabs is-right">
|
||||
<ul>
|
||||
<li v-for="(tab, index) in tabs" :key="index" :class="{'is-active': activeTab === index}" @click="changeTab(index)">
|
||||
<li
|
||||
v-for="(tab, index) in tabs"
|
||||
:key="tab.path"
|
||||
:class="{ 'is-active': activeTab === index }"
|
||||
@click="changeTab(index)"
|
||||
>
|
||||
<a>{{ tab.name }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
|
||||
+40
-3
@@ -4,12 +4,14 @@ import { authenticatedRequest } from "@/components/session/authenticatedRequest.
|
||||
import Swal from "sweetalert2";
|
||||
// Define the department id
|
||||
export const departmentId = ref(0);
|
||||
export const CUSTOM_PRICING_MISSING_PRICE = 999999;
|
||||
|
||||
const default_department = {
|
||||
id: null,
|
||||
name: null,
|
||||
description: null,
|
||||
branding: null,
|
||||
custom_pricing_only: false,
|
||||
created_at: null,
|
||||
updated_at: null,
|
||||
prices: []
|
||||
@@ -34,6 +36,7 @@ export const department = {
|
||||
id: ref(''),
|
||||
name: ref(''),
|
||||
description: ref(''),
|
||||
custom_pricing_only: ref(false),
|
||||
created_at: ref(''),
|
||||
updated_at: ref(''),
|
||||
prices: ref([])
|
||||
@@ -49,6 +52,13 @@ const isDepartmentPricesLoaded = ref(false);
|
||||
// Set the department id
|
||||
export const setDepartment = (id) => {
|
||||
departmentId.value = id;
|
||||
isDepartmentPricesLoaded.value = false;
|
||||
department.prices.value = [];
|
||||
department.custom_pricing_only.value = false;
|
||||
departmentAdvanced.value = {
|
||||
...default_department,
|
||||
...default_department_functions
|
||||
};
|
||||
// Load the department data
|
||||
return getDepartmentData();
|
||||
}
|
||||
@@ -60,11 +70,13 @@ export const getDepartmentData = async () => {
|
||||
department.id.value = response.data.data.id;
|
||||
department.name.value = response.data.data.name;
|
||||
department.description.value = response.data.data.description;
|
||||
department.custom_pricing_only.value = Boolean(response.data.data.custom_pricing_only);
|
||||
department.created_at.value = response.data.data.created_at;
|
||||
department.updated_at.value = response.data.data.updated_at;
|
||||
departmentAdvanced.value = {
|
||||
...default_department,
|
||||
...response.data.data,
|
||||
custom_pricing_only: Boolean(response.data.data.custom_pricing_only),
|
||||
...default_department_functions
|
||||
};
|
||||
})
|
||||
@@ -88,17 +100,42 @@ export const getDepartmentPrice = (product) => {
|
||||
getDepartmentPrices();
|
||||
}
|
||||
if (isDepartmentPricesLoaded.value) {
|
||||
const price = department.prices.value.find((price) => price.product_id === product.id);
|
||||
return price ? price.price : product.price;
|
||||
const price = getExplicitDepartmentPrice(product);
|
||||
if (price !== null) {
|
||||
return price;
|
||||
}
|
||||
return isCustomPricingOnly() ? CUSTOM_PRICING_MISSING_PRICE : product.price;
|
||||
}
|
||||
return product.price;
|
||||
}
|
||||
|
||||
export const getExplicitDepartmentPrice = (product) => {
|
||||
const price = department.prices.value.find((price) => price.product_id === product.id);
|
||||
return price ? price.price : null;
|
||||
}
|
||||
|
||||
export const isCustomPricingOnly = () => Boolean(departmentAdvanced.value.custom_pricing_only || department.custom_pricing_only.value);
|
||||
|
||||
export const updateCustomPricingOnly = async (enabled) => {
|
||||
return authenticatedRequest(`/departments`, "PUT", {
|
||||
id: departmentId.value,
|
||||
custom_pricing_only: Boolean(enabled)
|
||||
}).then(async () => {
|
||||
department.custom_pricing_only.value = Boolean(enabled);
|
||||
departmentAdvanced.value = {
|
||||
...departmentAdvanced.value,
|
||||
custom_pricing_only: Boolean(enabled)
|
||||
};
|
||||
await getDepartmentData();
|
||||
});
|
||||
}
|
||||
|
||||
export const editDepartmentPrice = (product) => {
|
||||
const explicitPrice = getExplicitDepartmentPrice(product);
|
||||
Swal.fire({
|
||||
title: product.name + ' ( product: ' + product.id + ' )',
|
||||
input: 'number',
|
||||
inputValue: getDepartmentPrice(product),
|
||||
inputValue: explicitPrice === null ? '' : explicitPrice,
|
||||
inputLabel: 'Price',
|
||||
inputAttributes: {
|
||||
autocapitalize: 'off'
|
||||
|
||||
@@ -13,6 +13,7 @@ import StatisticsDepartmentGoal
|
||||
from "@/views/dashboards/superUserDashboard/statistics/displays/overview/StatisticsDepartmentGoal.vue";
|
||||
import {departments, getDepartments} from "@/components/pagination/departmentTabs.vue";
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -70,7 +71,8 @@ getDepartments()
|
||||
// Get the statistics
|
||||
const getStatistics = async () => {
|
||||
// Get the statistics
|
||||
const response = await authenticatedRequest('/statistics/income/departments?start_date=' + (new Date()).toISOString().split('T')[0] + '&end_date=' + (new Date()).toISOString().split('T')[0])
|
||||
const today = todayLocalDateOnly();
|
||||
const response = await authenticatedRequest('/statistics/income/departments?start_date=' + today + '&end_date=' + today)
|
||||
// Get the sent data
|
||||
statistics_department_today.value = response.data.data
|
||||
// Log the data
|
||||
@@ -131,4 +133,4 @@ getStatistics()
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -4,6 +4,7 @@ import {ref} from 'vue';
|
||||
import { Bar } from 'vue-chartjs';
|
||||
import { Chart as ChartJS, Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale } from 'chart.js'
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import { todayLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
|
||||
ChartJS.register(Title, Tooltip, Legend, BarElement, CategoryScale, LinearScale)
|
||||
@@ -16,7 +17,7 @@ const chartOptions = {
|
||||
// Shortcut to statistics
|
||||
|
||||
// Set the time for the statistics to today
|
||||
SessionUser.adminUser.statistics.set_time((new Date()).toISOString().split('T')[0], (new Date()).toISOString().split('T')[0])
|
||||
SessionUser.adminUser.statistics.set_time(todayLocalDateOnly(), todayLocalDateOnly())
|
||||
|
||||
|
||||
|
||||
@@ -33,4 +34,4 @@ SessionUser.adminUser.statistics.set_time((new Date()).toISOString().split('T')[
|
||||
}"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -109,6 +109,58 @@ async function acceleratePageTimers(page, timerScale = 0.01) {
|
||||
}, timerScale);
|
||||
}
|
||||
|
||||
async function dismissUnexpectedSweetAlert(page) {
|
||||
const overlays = page.locator(".swal2-container.swal2-backdrop-show");
|
||||
|
||||
for (let attempt = 0; attempt < 3; attempt += 1) {
|
||||
const overlay = overlays.first();
|
||||
if (!(await overlay.isVisible().catch(() => false))) {
|
||||
return;
|
||||
}
|
||||
|
||||
let dismissed = false;
|
||||
for (const selector of [".swal2-close", ".swal2-cancel", ".swal2-deny", ".swal2-confirm"]) {
|
||||
const action = overlay.locator(selector).first();
|
||||
if (await action.isVisible().catch(() => false)) {
|
||||
await action.click({ force: true });
|
||||
dismissed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!dismissed) {
|
||||
await page.keyboard.press("Escape");
|
||||
}
|
||||
|
||||
await expect(overlays)
|
||||
.toHaveCount(0, { timeout: 5_000 })
|
||||
.catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
async function generateGatewayInstaller(page) {
|
||||
const button = page.getByTestId("gateway-installer-generate");
|
||||
await expect(button).toBeVisible({ timeout: 15_000 });
|
||||
await expect(button).toBeEnabled({ timeout: 15_000 });
|
||||
|
||||
let lastError;
|
||||
for (let attempt = 0; attempt < 3; attempt += 1) {
|
||||
await dismissUnexpectedSweetAlert(page);
|
||||
|
||||
try {
|
||||
await button.click({ timeout: 15_000 });
|
||||
return;
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
if (!/swal2-container|intercepts pointer events/i.test(error?.message || "")) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw lastError;
|
||||
}
|
||||
|
||||
test.describe("Edge gateway management smoke", () => {
|
||||
test.describe.configure({ mode: "serial" });
|
||||
|
||||
@@ -193,7 +245,7 @@ test.describe("Edge gateway management smoke", () => {
|
||||
|
||||
await page.getByTestId("gateway-installer-department").selectOption("1");
|
||||
await page.getByTestId("gateway-installer-label").fill("Copy Test Pi");
|
||||
await page.getByTestId("gateway-installer-generate").click();
|
||||
await generateGatewayInstaller(page);
|
||||
|
||||
await expect(page.getByTestId("gateway-install-command")).toHaveValue(/install\.sh\?token=edge-install-token/);
|
||||
await page.getByTestId("gateway-installer-copy").click();
|
||||
@@ -246,7 +298,7 @@ test.describe("Edge gateway management smoke", () => {
|
||||
|
||||
await page.getByTestId("gateway-installer-department").selectOption("1");
|
||||
await page.getByTestId("gateway-installer-label").fill("Canary Pi");
|
||||
await page.getByTestId("gateway-installer-generate").click();
|
||||
await generateGatewayInstaller(page);
|
||||
|
||||
await expect(page.getByTestId("gateway-installer-status")).toBeVisible();
|
||||
await expect.poll(() => page.getByTestId("gateway-installer-status-state").textContent()).toContain("Running");
|
||||
@@ -274,7 +326,7 @@ test.describe("Edge gateway management smoke", () => {
|
||||
|
||||
await page.getByTestId("gateway-installer-department").selectOption("1");
|
||||
await page.getByTestId("gateway-installer-label").fill("CPH Edge 01");
|
||||
await page.getByTestId("gateway-installer-generate").click();
|
||||
await generateGatewayInstaller(page);
|
||||
|
||||
await expect(page.getByTestId("gateway-installer-status")).toBeVisible();
|
||||
await expect.poll(() => page.getByTestId("gateway-installer-status-state").textContent()).toContain("Running");
|
||||
@@ -318,7 +370,7 @@ test.describe("Edge gateway management smoke", () => {
|
||||
|
||||
await page.getByTestId("gateway-installer-department").selectOption("1");
|
||||
await page.getByTestId("gateway-installer-label").fill("Broken Pi");
|
||||
await page.getByTestId("gateway-installer-generate").click();
|
||||
await generateGatewayInstaller(page);
|
||||
|
||||
await expect(page.getByTestId("gateway-installer-status")).toBeVisible();
|
||||
await expect
|
||||
@@ -382,7 +434,7 @@ test.describe("Edge gateway management smoke", () => {
|
||||
|
||||
await page.getByTestId("gateway-installer-department").selectOption("1");
|
||||
await page.getByTestId("gateway-installer-label").fill("Canary Pi");
|
||||
await page.getByTestId("gateway-installer-generate").click();
|
||||
await generateGatewayInstaller(page);
|
||||
|
||||
await expect(page.getByTestId("gateway-install-command")).toHaveValue(/install\.sh\?token=edge-install-token/);
|
||||
await expect(page).toHaveURL(/\/superuser\/selfserve\/edge-agents\/703\/overview$/, { timeout: 20_000 });
|
||||
|
||||
@@ -15,16 +15,20 @@ function isApiUrl(url: string) {
|
||||
);
|
||||
}
|
||||
|
||||
async function mockHtml2Canvas(page) {
|
||||
await page.route(/\/node_modules\/html2canvas\/dist\/html2canvas\.esm\.js(?:\?.*)?$/i, async (route) => {
|
||||
const html2CanvasModulePattern = /\/(?:node_modules\/.*)?html2canvas(?:\.[\w-]+)?\.js(?:\?.*)?$/i;
|
||||
|
||||
async function mockHtml2Canvas(page, { alwaysFail = false } = {}) {
|
||||
await page.unroute(html2CanvasModulePattern).catch(() => {});
|
||||
await page.route(html2CanvasModulePattern, async (route) => {
|
||||
await route.fulfill({
|
||||
contentType: "text/javascript",
|
||||
body: `
|
||||
const alwaysFail = ${alwaysFail ? "true" : "false"};
|
||||
let html2canvasAttempts = 0;
|
||||
export default async function html2canvas() {
|
||||
html2canvasAttempts += 1;
|
||||
if (html2canvasAttempts === 1) {
|
||||
throw new Error("Simulated first capture failure");
|
||||
if (alwaysFail || html2canvasAttempts === 1) {
|
||||
throw new Error(alwaysFail ? "Simulated permanent capture failure" : "Simulated first capture failure");
|
||||
}
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = 8;
|
||||
@@ -163,10 +167,68 @@ test.describe("Authenticated error reports", () => {
|
||||
expect(Array.isArray(body.vue_errors)).toBe(true);
|
||||
expect(body.context).toMatchObject({
|
||||
data_collection_policy_version: "error-report-v1",
|
||||
screenshot_attachment: {
|
||||
status: "stored",
|
||||
attached: true,
|
||||
},
|
||||
});
|
||||
await expect(page.getByTestId("error-report-submitted")).toBeVisible();
|
||||
});
|
||||
|
||||
test("submits without a screenshot when capture never succeeds", async ({ page }) => {
|
||||
await mockHtml2Canvas(page, { alwaysFail: true });
|
||||
const submittedBodies: Array<Record<string, unknown>> = [];
|
||||
|
||||
await page.route(/\/error-reports(?:\?.*)?$/i, async (route) => {
|
||||
if (!isApiUrl(route.request().url())) {
|
||||
await route.fallback();
|
||||
return;
|
||||
}
|
||||
if (route.request().method().toUpperCase() !== "POST") {
|
||||
await route.fallback();
|
||||
return;
|
||||
}
|
||||
const body = route.request().postDataJSON() as Record<string, unknown>;
|
||||
submittedBodies.push(body);
|
||||
await route.fulfill(
|
||||
json(
|
||||
{
|
||||
success: true,
|
||||
data: {
|
||||
id: 100,
|
||||
status: "open",
|
||||
screenshot: null,
|
||||
},
|
||||
},
|
||||
201
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
await primeMockSession(page, { token: "error-report-user-token", bootPath: "/admin" });
|
||||
await openErrorReportLauncher(page);
|
||||
|
||||
await page.getByLabel("What were you doing before the error occurred?").fill("Opening the orders page");
|
||||
await page.getByLabel("What did you expect would happen?").fill("The orders should load");
|
||||
await page.getByLabel("What actually happened?").fill("The page showed an error");
|
||||
await page.getByTestId("error-report-consent").check();
|
||||
await page.getByTestId("error-report-submit").click();
|
||||
|
||||
await expect.poll(() => submittedBodies.length).toBe(1);
|
||||
const body = submittedBodies[0];
|
||||
expect(body.screenshot).toBeNull();
|
||||
expect(body.context).toMatchObject({
|
||||
screenshot_attachment: {
|
||||
status: "capture_failed",
|
||||
attached: false,
|
||||
},
|
||||
});
|
||||
await expect(page.getByTestId("error-report-capture-warning")).toContainText(
|
||||
"The screen capture failed. The report will be sent without a screenshot."
|
||||
);
|
||||
await expect(page.getByTestId("error-report-submitted")).toBeVisible();
|
||||
});
|
||||
|
||||
test("lets superusers inspect and resolve submitted reports", async ({ page }) => {
|
||||
const report: Record<string, any> = {
|
||||
id: 12,
|
||||
@@ -277,4 +339,90 @@ test.describe("Authenticated error reports", () => {
|
||||
]);
|
||||
await expect(page.getByTestId("error-report-detail")).toContainText("resolved");
|
||||
});
|
||||
|
||||
test("lets superusers inspect submitted reports without screenshots", async ({ page }) => {
|
||||
const report: Record<string, any> = {
|
||||
id: 13,
|
||||
status: "open",
|
||||
reporter: {
|
||||
type: "user",
|
||||
user_id: 7,
|
||||
customer_number: 12345,
|
||||
name: "Error Reporter",
|
||||
email: "reporter@example.test",
|
||||
},
|
||||
route_path: "/user/orders",
|
||||
page_url: "https://app.example.test/user/orders",
|
||||
release_trace_id: "trace-no-screenshot",
|
||||
frontend_version: "front-1",
|
||||
api_version: "api-1",
|
||||
screenshot: null,
|
||||
answers: {
|
||||
before_error: "Opening the orders page",
|
||||
expected: "Orders should load",
|
||||
actual: "The table stayed empty",
|
||||
},
|
||||
request_error_count: 0,
|
||||
vue_error_count: 0,
|
||||
request_errors: [],
|
||||
vue_errors: [],
|
||||
runtime_context: {
|
||||
screenshot_attachment: {
|
||||
status: "capture_failed",
|
||||
attached: false,
|
||||
mime_type: null,
|
||||
size_bytes: 0,
|
||||
},
|
||||
},
|
||||
created_at: "2026-05-19 08:00:00",
|
||||
updated_at: "2026-05-19 08:00:00",
|
||||
resolved_at: null,
|
||||
resolved_by_user_id: null,
|
||||
resolution_note: null,
|
||||
};
|
||||
|
||||
await page.route(/\/superuser\/error-reports(?:\?.*)?$/i, async (route) => {
|
||||
if (!isApiUrl(route.request().url())) {
|
||||
await route.fallback();
|
||||
return;
|
||||
}
|
||||
if (route.request().method().toUpperCase() !== "GET") {
|
||||
await route.fallback();
|
||||
return;
|
||||
}
|
||||
await route.fulfill(
|
||||
json({
|
||||
success: true,
|
||||
data: {
|
||||
items: [report],
|
||||
counts: {
|
||||
open: 1,
|
||||
resolved: 0,
|
||||
all: 1,
|
||||
},
|
||||
limit: 100,
|
||||
offset: 0,
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
await page.route(/\/superuser\/error-reports\/13$/i, async (route) => {
|
||||
if (!isApiUrl(route.request().url())) {
|
||||
await route.fallback();
|
||||
return;
|
||||
}
|
||||
await route.fulfill(json({ success: true, data: report }));
|
||||
});
|
||||
|
||||
await primeMockSession(page, { token: "error-report-superuser-token", bootPath: "/superuser/error-reports" });
|
||||
await expect(page.getByTestId("error-reports-page")).toBeVisible();
|
||||
await expect(page.getByTestId("error-report-list")).toContainText("/user/orders");
|
||||
|
||||
await page.getByTestId("error-report-view").click();
|
||||
const detail = page.getByTestId("error-report-detail");
|
||||
await expect(detail).toContainText("Opening the orders page");
|
||||
await expect(detail).toContainText("trace-no-screenshot");
|
||||
await expect(detail.locator("img")).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -213,6 +213,8 @@ const employeesPayload = [
|
||||
customer_number: 900000501,
|
||||
display_name: "Casey Clerk",
|
||||
email: "casey@example.com",
|
||||
phone_country_code: 45,
|
||||
phone: 12345678,
|
||||
active: true,
|
||||
role: { key: "cashier", label: "Cashier", description: "Can sell." },
|
||||
departments: [{ id: 1, name: "Assigned Depot" }],
|
||||
@@ -228,10 +230,17 @@ async function seedLimitedBackofficeSession(page, token = "limited-backoffice-to
|
||||
await seedAuthenticatedState(page, token);
|
||||
}
|
||||
|
||||
async function mockLimitedBackofficeApi(page, authSessionData = sessionData) {
|
||||
const cloneJson = <T>(value: T): T => JSON.parse(JSON.stringify(value));
|
||||
|
||||
async function mockLimitedBackofficeApi(page, authSessionData = sessionData, options: any = {}) {
|
||||
const calls: string[] = [];
|
||||
const forbiddenCalls: string[] = [];
|
||||
const priceUpdateCalls: unknown[] = [];
|
||||
const employeeCreateCalls: unknown[] = [];
|
||||
const employeeUpdateCalls: unknown[] = [];
|
||||
const currentEmployees = {
|
||||
value: cloneJson(options.employeesPayload ?? employeesPayload),
|
||||
};
|
||||
|
||||
await page.route(API_HOST, async (route) => {
|
||||
const request = route.request();
|
||||
@@ -298,7 +307,56 @@ async function mockLimitedBackofficeApi(page, authSessionData = sessionData) {
|
||||
}
|
||||
|
||||
if (pathname.endsWith("/limited-backoffice/employees") && method === "GET") {
|
||||
await route.fulfill(json({ data: employeesPayload }));
|
||||
await route.fulfill(json({ data: currentEmployees.value }));
|
||||
return;
|
||||
}
|
||||
|
||||
if (pathname.endsWith("/limited-backoffice/employees") && method === "POST") {
|
||||
const body = request.postDataJSON?.() || {};
|
||||
employeeCreateCalls.push(body);
|
||||
const role = rolesPayload.find((item) => item.key === body.role_key) || rolesPayload[0];
|
||||
const created = {
|
||||
id: 900 + currentEmployees.value.length + 1,
|
||||
customer_number: 900001000 + currentEmployees.value.length + 1,
|
||||
display_name: body.display_name,
|
||||
email: body.email,
|
||||
phone_country_code: body.phone_country_code ?? null,
|
||||
phone: body.phone ?? null,
|
||||
active: true,
|
||||
role,
|
||||
departments: assignedDepartments.filter((department) => body.department_ids?.includes(department.id)),
|
||||
created_at: "2026-01-01 00:00:00",
|
||||
updated_at: "2026-01-01 00:00:00",
|
||||
};
|
||||
currentEmployees.value.unshift(created);
|
||||
await route.fulfill(json({ data: created }));
|
||||
return;
|
||||
}
|
||||
|
||||
const employeeMatch = pathname.match(/\/limited-backoffice\/employees\/(\d+)$/);
|
||||
if (employeeMatch && method === "PUT") {
|
||||
const body = request.postDataJSON?.() || {};
|
||||
employeeUpdateCalls.push(body);
|
||||
const employeeId = Number(employeeMatch[1]);
|
||||
const target = currentEmployees.value.find((employee) => Number(employee.id) === employeeId);
|
||||
if (!target) {
|
||||
await route.fulfill(json({ message: "Employee not found" }, 404));
|
||||
return;
|
||||
}
|
||||
|
||||
const role = rolesPayload.find((item) => item.key === body.role_key) || target.role;
|
||||
Object.assign(target, {
|
||||
display_name: body.display_name ?? target.display_name,
|
||||
email: body.email ?? target.email,
|
||||
phone_country_code: body.phone_country_code ?? null,
|
||||
phone: body.phone ?? null,
|
||||
role,
|
||||
departments: Array.isArray(body.department_ids)
|
||||
? assignedDepartments.filter((department) => body.department_ids.includes(department.id))
|
||||
: target.departments,
|
||||
updated_at: "2026-01-01 01:00:00",
|
||||
});
|
||||
await route.fulfill(json({ data: target }));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -309,6 +367,8 @@ async function mockLimitedBackofficeApi(page, authSessionData = sessionData) {
|
||||
calls,
|
||||
forbiddenCalls,
|
||||
priceUpdateCalls,
|
||||
employeeCreateCalls,
|
||||
employeeUpdateCalls,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -378,6 +438,7 @@ test.describe("Limited backoffice", () => {
|
||||
|
||||
await expect(page.getByTestId("limited-employees-title")).toBeVisible();
|
||||
await expect(page.getByTestId("limited-employee-row-501")).toContainText("Casey Clerk");
|
||||
await expect(page.getByTestId("limited-employee-phone-501")).toHaveText("+45 12345678");
|
||||
await expect(page.locator("#limited-employee-role option")).toHaveCount(5);
|
||||
await expect(page.getByTestId("limited-employee-role")).not.toContainText("Superuser");
|
||||
await expect(page.locator("body")).not.toContainText("department_access_1");
|
||||
@@ -436,6 +497,93 @@ test.describe("Limited backoffice", () => {
|
||||
await expect(page.getByTestId("limited-role-permissions-modal")).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("validates employee fields and submits optional phone details", async ({ page }) => {
|
||||
await seedLimitedBackofficeSession(page);
|
||||
const api = await mockLimitedBackofficeApi(page);
|
||||
|
||||
await page.goto("/backoffice/employees");
|
||||
|
||||
await expect(page.getByTestId("limited-employees-title")).toBeVisible();
|
||||
await expect(page.getByTestId("limited-employee-save")).toBeDisabled();
|
||||
await expect(page.getByTestId("limited-employee-save")).toHaveClass(/is-fullwidth/);
|
||||
await expect(page.getByTestId("limited-employee-departments").locator(".switch")).toHaveCount(1);
|
||||
await expect(page.getByTestId("limited-employee-phone-country-code")).toContainText("+45");
|
||||
|
||||
await page.getByTestId("limited-employee-name").fill("No Phone Worker");
|
||||
await page.getByTestId("limited-employee-email").fill("no-phone@example.com");
|
||||
await page.getByTestId("limited-employee-password").fill("Secret123!");
|
||||
await expect(page.getByTestId("limited-employee-save")).toBeDisabled();
|
||||
|
||||
await page.getByTestId("limited-employee-department-1").click();
|
||||
await expect(page.getByTestId("limited-employee-save")).toBeEnabled();
|
||||
await page.getByTestId("limited-employee-save").click();
|
||||
|
||||
await expect.poll(() => api.employeeCreateCalls.length).toBe(1);
|
||||
expect(api.employeeCreateCalls[0]).toEqual({
|
||||
display_name: "No Phone Worker",
|
||||
email: "no-phone@example.com",
|
||||
phone_country_code: null,
|
||||
phone: null,
|
||||
password: "Secret123!",
|
||||
role_key: "viewer",
|
||||
department_ids: [1],
|
||||
});
|
||||
await expect(page.getByTestId("limited-employee-row-902")).toContainText("No Phone Worker");
|
||||
|
||||
await page.getByTestId("limited-employee-name").fill("Phone Worker");
|
||||
await page.getByTestId("limited-employee-email").fill("phone@example.com");
|
||||
await page.getByTestId("limited-employee-phone-country-code").selectOption("358");
|
||||
await page.getByTestId("limited-employee-phone").fill("87654321");
|
||||
await page.getByTestId("limited-employee-password").fill("Secret123!");
|
||||
await page.getByTestId("limited-employee-department-1").click();
|
||||
await expect(page.getByTestId("limited-employee-save")).toBeEnabled();
|
||||
await page.getByTestId("limited-employee-save").click();
|
||||
|
||||
await expect.poll(() => api.employeeCreateCalls.length).toBe(2);
|
||||
expect(api.employeeCreateCalls[1]).toEqual({
|
||||
display_name: "Phone Worker",
|
||||
email: "phone@example.com",
|
||||
phone_country_code: 358,
|
||||
phone: 87654321,
|
||||
password: "Secret123!",
|
||||
role_key: "viewer",
|
||||
department_ids: [1],
|
||||
});
|
||||
await expect(page.getByTestId("limited-employee-row-903")).toContainText("Phone Worker");
|
||||
await expect(page.getByTestId("limited-employee-phone-903")).toHaveText("+358 87654321");
|
||||
});
|
||||
|
||||
test("edits employee contact details without requiring a new password", async ({ page }) => {
|
||||
await seedLimitedBackofficeSession(page);
|
||||
const api = await mockLimitedBackofficeApi(page);
|
||||
|
||||
await page.goto("/backoffice/employees");
|
||||
|
||||
await expect(page.getByTestId("limited-employee-row-501")).toBeVisible();
|
||||
await page.getByTestId("limited-employee-edit-501").click();
|
||||
|
||||
await expect(page.getByTestId("limited-employee-password")).toHaveValue("");
|
||||
await expect(page.getByTestId("limited-employee-save")).toBeEnabled();
|
||||
await page.getByTestId("limited-employee-name").fill("Casey Lead");
|
||||
await page.getByTestId("limited-employee-email").fill("casey.lead@example.com");
|
||||
await page.getByTestId("limited-employee-phone-country-code").selectOption("358");
|
||||
await page.getByTestId("limited-employee-phone").fill("87654321");
|
||||
await page.getByTestId("limited-employee-save").click();
|
||||
|
||||
await expect.poll(() => api.employeeUpdateCalls.length).toBe(1);
|
||||
expect(api.employeeUpdateCalls[0]).toEqual({
|
||||
display_name: "Casey Lead",
|
||||
email: "casey.lead@example.com",
|
||||
phone_country_code: 358,
|
||||
phone: 87654321,
|
||||
role_key: "cashier",
|
||||
department_ids: [1],
|
||||
});
|
||||
expect(api.employeeUpdateCalls[0]).not.toHaveProperty("password");
|
||||
await expect(page.getByTestId("limited-employee-row-501")).toContainText("Casey Lead");
|
||||
await expect(page.getByTestId("limited-employee-phone-501")).toHaveText("+358 87654321");
|
||||
});
|
||||
|
||||
test("does not render data for a department outside the manager scope", async ({ page }, testInfo) => {
|
||||
test.skip(!isDesktopProject(testInfo), "Desktop only");
|
||||
|
||||
|
||||
@@ -257,3 +257,70 @@ test("customer details renders economic customer mobilePhone object as number on
|
||||
await expect(phoneValue).not.toContainText("country_code");
|
||||
await expect(phoneValue).not.toContainText("number");
|
||||
});
|
||||
|
||||
test("only tankcleaning customers can only add tankcleaning products", async ({ page }, testInfo) => {
|
||||
test.skip(!testInfo.project.name.includes("desktop"), "Desktop only");
|
||||
|
||||
const baseFixture = createPosFixture();
|
||||
const tankCleaningProduct = {
|
||||
id: 66,
|
||||
name: "Tank cleaning 4 spulehoveder",
|
||||
description: "Tankcleaning service",
|
||||
price: 799,
|
||||
subscription_allowed: true,
|
||||
category: 5,
|
||||
piktogram: "truck",
|
||||
apply_category_discount: true,
|
||||
requires_note: false,
|
||||
is_wash: false,
|
||||
display_in_booking_form: true,
|
||||
order_priority: 1,
|
||||
addons: [],
|
||||
};
|
||||
const fixture = createPosFixture({
|
||||
customerAttributesByNumber: {
|
||||
12345679: [{ id: 1, customer_number: 12345679, attribute: "onlyTankCleaning" }],
|
||||
},
|
||||
products: [...baseFixture.products, tankCleaningProduct],
|
||||
departmentCategories: [
|
||||
...baseFixture.departmentCategories,
|
||||
{ id: 13, department_id: 12, category: { id: 5, name: "Tankcleaning", meta: { products: [66] } } },
|
||||
],
|
||||
});
|
||||
|
||||
await mockApi(page, {
|
||||
authenticated: true,
|
||||
permissions: POS_PERMISSIONS,
|
||||
edgeGateways: false,
|
||||
pos: fixture,
|
||||
});
|
||||
await primeOperatorSession(page, "pos-only-tankcleaning-token");
|
||||
|
||||
const customer = fixture.customersByNumber[12345679];
|
||||
const customerAttributesResponse = page.waitForResponse((response) => {
|
||||
return (
|
||||
response.request().method() === "GET" &&
|
||||
response.url().includes(`/customer/attributes?customer_number=${customer.customerNumber}`)
|
||||
);
|
||||
});
|
||||
await openPosAndSelectCustomer(page, customer);
|
||||
await customerAttributesResponse;
|
||||
|
||||
await page.getByTestId("pos-step-1").getByTestId("pos-next-step").click();
|
||||
await expect(page.getByTestId("pos-step-2")).toBeVisible({ timeout: POS_STEP_TIMEOUT });
|
||||
|
||||
await page.getByTestId("pos-product-card-53").first().click();
|
||||
await expect(page.getByTestId("pos-add-to-cart-53").first()).toBeDisabled();
|
||||
|
||||
await page.locator(".tabs li").filter({ hasText: "Tankcleaning" }).click();
|
||||
await expect(page.getByTestId("pos-product-card-66").first()).toBeVisible();
|
||||
await page.getByTestId("pos-product-card-66").first().click();
|
||||
await expect(page.getByTestId("pos-add-to-cart-66").first()).toBeEnabled();
|
||||
|
||||
const addRequest = page.waitForRequest((request) => {
|
||||
return request.method() === "POST" && request.url().includes("/order/items");
|
||||
});
|
||||
await page.getByTestId("pos-add-to-cart-66").first().click();
|
||||
const request = await addRequest;
|
||||
expect(request.postDataJSON().product_id).toBe(66);
|
||||
});
|
||||
|
||||
@@ -3272,6 +3272,66 @@ test.describe("POS mobile order flow", () => {
|
||||
expect(createdProductIds).toEqual([53, 71, 91]);
|
||||
});
|
||||
|
||||
test("manual step 2 blocks additional items when customer restricts additional services", async ({ page }) => {
|
||||
const orderId = 9414;
|
||||
const fixture = createMobilePosFixture({
|
||||
customerAttributesByNumber: {
|
||||
[REGULAR_CUSTOMER_ID]: [
|
||||
{
|
||||
id: 941401,
|
||||
customer_number: REGULAR_CUSTOMER_ID,
|
||||
attribute: "restrictAdditionalServices",
|
||||
},
|
||||
],
|
||||
},
|
||||
ordersById: {
|
||||
[orderId]: buildRegularOrder(orderId, {
|
||||
reference: "STEP2-RESTRICT-ADDITIONAL",
|
||||
reg_1: "ZZ00000",
|
||||
}),
|
||||
},
|
||||
orderItemsByOrderId: {
|
||||
[orderId]: [],
|
||||
},
|
||||
});
|
||||
|
||||
await setupMobilePosPage(page, fixture, {
|
||||
token: "mobile-step2-restrict-additional-token",
|
||||
seedState: {
|
||||
customerId: REGULAR_CUSTOMER_ID,
|
||||
reg: "ZZ00000",
|
||||
reference: "STEP2-RESTRICT-ADDITIONAL",
|
||||
includePrimaryItem: false,
|
||||
vehicleType: null,
|
||||
lastOrderId: null,
|
||||
},
|
||||
route: {
|
||||
step: 2,
|
||||
orderId,
|
||||
customerId: REGULAR_CUSTOMER_ID,
|
||||
},
|
||||
});
|
||||
|
||||
await expect.poll(() => fixture.requestCounters.customerAttributesGet, { timeout: 10_000 }).toBeGreaterThan(0);
|
||||
await selectPrimaryProduct(page, 53);
|
||||
await expect(page.getByTestId("pos-mobile-additional-items-open")).toHaveCount(1);
|
||||
|
||||
await page.getByTestId("pos-mobile-additional-items-open").click();
|
||||
await expect(page.getByTestId("pos-mobile-additional-items-selection")).toHaveCount(0);
|
||||
|
||||
await longPressAdditionalItems(page);
|
||||
await expect(page.getByTestId("pos-mobile-additional-items-selection")).toHaveCount(0);
|
||||
await expect
|
||||
.poll(
|
||||
async () => {
|
||||
const snapshot = await getStoredPosSnapshot(page);
|
||||
return snapshot?.transactionItems?.additionalItems || [];
|
||||
},
|
||||
{ timeout: 10_000 }
|
||||
)
|
||||
.toEqual([]);
|
||||
});
|
||||
|
||||
test("clear all deletes the order and returns to the scanner", async ({ page }) => {
|
||||
const orderId = 9403;
|
||||
const fixture = createMobilePosFixture({
|
||||
|
||||
@@ -124,6 +124,39 @@ async function seedSavedProgress(page, overrides = {}) {
|
||||
await page.addInitScript((savedProgress) => {
|
||||
window.localStorage.setItem("mywash_progress_v6", JSON.stringify(savedProgress));
|
||||
}, payload);
|
||||
|
||||
try {
|
||||
await page.evaluate((savedProgress) => {
|
||||
window.localStorage.setItem("mywash_progress_v6", JSON.stringify(savedProgress));
|
||||
}, payload);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
async function expectFinishingOrCompletedWash(page) {
|
||||
const finishing = page.getByTestId("self-serve-finishing-wash");
|
||||
const completed = page.getByTestId("self-serve-completed-step");
|
||||
|
||||
await expect
|
||||
.poll(
|
||||
async () => {
|
||||
if (await finishing.isVisible().catch(() => false)) {
|
||||
return "finishing";
|
||||
}
|
||||
if (await completed.isVisible().catch(() => false)) {
|
||||
return "completed";
|
||||
}
|
||||
return "pending";
|
||||
},
|
||||
{
|
||||
message: "expected the wash to show the finishing state or complete",
|
||||
timeout: 15_000,
|
||||
}
|
||||
)
|
||||
.toMatch(/^(finishing|completed)$/);
|
||||
|
||||
if (await finishing.isVisible().catch(() => false)) {
|
||||
await expect(finishing).toContainText("Afslutter vask, porten åbnes automatisk");
|
||||
}
|
||||
}
|
||||
|
||||
function captureSelfServeGatewayRequests(page) {
|
||||
@@ -276,9 +309,7 @@ test.describe("Self-serve wash", () => {
|
||||
const stopCommandRequestPromise = waitForLaneCommandRequest(page, "STOP");
|
||||
const exitGateCommandRequestPromise = waitForLaneCommandRequest(page, "OPEN_PROPERTY_EXIT_GATE");
|
||||
await page.getByTestId("self-serve-nav-complete").click();
|
||||
await expect(page.getByTestId("self-serve-finishing-wash")).toContainText(
|
||||
"Afslutter vask, porten åbnes automatisk"
|
||||
);
|
||||
await expectFinishingOrCompletedWash(page);
|
||||
const stopCommandRequest = await stopCommandRequestPromise;
|
||||
const exitGateCommandRequest = await exitGateCommandRequestPromise;
|
||||
expect(stopCommandRequest.postDataJSON?.()).toMatchObject({
|
||||
@@ -660,11 +691,18 @@ test.describe("Self-serve wash", () => {
|
||||
});
|
||||
await page.reload({ waitUntil: "domcontentloaded" });
|
||||
|
||||
await expect(page.getByTestId("self-serve-questions-step")).toBeVisible({ timeout: 10_000 });
|
||||
await expect(page.getByTestId("self-serve-nav-confirm")).toBeDisabled();
|
||||
await page.getByTestId("self-serve-question-21-yes").click();
|
||||
await expect(page.getByTestId("self-serve-nav-confirm")).toBeEnabled({ timeout: 10_000 });
|
||||
await page.getByTestId("self-serve-nav-confirm").click();
|
||||
|
||||
await expect(page.getByTestId("self-serve-lane-step")).toBeVisible({ timeout: 10_000 });
|
||||
await expect(page.getByRole("radio", { name: /Maskine/i })).toBeDisabled();
|
||||
await expect(page.getByTestId("self-serve-lane-option-7")).toContainText("Tilgængelig");
|
||||
await expect(page.getByTestId("self-serve-lane-option-8")).toContainText("Vaskebanen er ikke tilgængelig");
|
||||
await expect(page.getByRole("radio", { name: /Maskine/i })).toBeEnabled();
|
||||
await expect(page.getByTestId("self-serve-machine-unavailable-guidance")).toHaveCount(0);
|
||||
await expect(page.locator("body")).not.toContainText(removedMachineUnavailableGuidanceText);
|
||||
await expect(page.getByTestId("self-serve-nav-confirm")).toBeDisabled();
|
||||
|
||||
await page.getByTestId("self-serve-lane-option-7").click();
|
||||
await page.getByTestId("self-serve-wash-type-manual").click();
|
||||
@@ -1147,9 +1185,7 @@ test.describe("Self-serve wash", () => {
|
||||
const stopCommandRequestPromise = waitForLaneCommandRequest(page, "STOP");
|
||||
const exitGateCommandRequestPromise = waitForLaneCommandRequest(page, "OPEN_PROPERTY_EXIT_GATE");
|
||||
await page.getByTestId("self-serve-nav-complete").click();
|
||||
await expect(page.getByTestId("self-serve-finishing-wash")).toContainText(
|
||||
"Afslutter vask, porten åbnes automatisk"
|
||||
);
|
||||
await expectFinishingOrCompletedWash(page);
|
||||
const stopCommandRequest = await stopCommandRequestPromise;
|
||||
const exitGateCommandRequest = await exitGateCommandRequestPromise;
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import { apiPathPattern, mockApi, seedAuthenticatedState } from "./support/network.js";
|
||||
|
||||
const json = (body, status = 200) => ({
|
||||
status,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
async function installOverviewRoutes(page) {
|
||||
await page.route(apiPathPattern("/superuser/departments/1/overview"), async (route) => {
|
||||
const parsedUrl = new URL(route.request().url());
|
||||
expect(parsedUrl.searchParams.get("date")).toBe("2026-07-06");
|
||||
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
department: {
|
||||
id: 1,
|
||||
name: "Esbjerg",
|
||||
description: "Skagerrakvej 15",
|
||||
economic_department_id: 42,
|
||||
branding: 14,
|
||||
created_at: "2026-01-01 00:00:00",
|
||||
updated_at: "2026-07-06 09:30:00",
|
||||
},
|
||||
overview: {
|
||||
department_ids: [1],
|
||||
date: "2026-07-06",
|
||||
date_to: "2026-07-06",
|
||||
metrics: {
|
||||
bookings: { state: "ready", value: 3, out_of: 4 },
|
||||
complaints: { state: "ready", value: 1 },
|
||||
night_washes: { state: "ready", value: 2 },
|
||||
revenue: { state: "ready", value: 1234 },
|
||||
washes: { state: "ready", value: 11 },
|
||||
products_sold: { state: "ready", value: 18 },
|
||||
transactions: { state: "ready", value: 9 },
|
||||
water_usage: { state: "ready", value: 250 },
|
||||
overtime: { state: "ready", value: 1.5 },
|
||||
},
|
||||
products: [
|
||||
{
|
||||
product_id: 24,
|
||||
slug: "spot-free-lastbil",
|
||||
title: "Spot Free",
|
||||
state: "ready",
|
||||
value: 4,
|
||||
out_of: 11,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
await page.route(apiPathPattern("/modules/edge-gateways/workspace/departments/1"), async (route) => {
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
gateways: [
|
||||
{ id: 1, status: "ONLINE" },
|
||||
{ id: 2, status: "OFFLINE" },
|
||||
],
|
||||
lanes: [{ id: 1 }, { id: 2 }],
|
||||
gates: [{ id: 1 }],
|
||||
relays: [{ id: 1 }, { id: 2 }, { id: 3 }],
|
||||
scanners: [{ id: 1 }],
|
||||
issues: [{ key: "gateway-offline" }],
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
test.describe("superuser department overview", () => {
|
||||
test("renders the operational overview for a selected department", async ({ page }) => {
|
||||
await seedAuthenticatedState(page, "superuser-department-overview-token");
|
||||
await mockApi(page, {
|
||||
authenticated: true,
|
||||
permissions: ["superuser", "user"],
|
||||
});
|
||||
await installOverviewRoutes(page);
|
||||
|
||||
await page.goto("/superuser/departments/1?date=2026-07-06", { waitUntil: "domcontentloaded" });
|
||||
|
||||
await expect(page.getByTestId("superuser-department-overview")).toBeVisible();
|
||||
await expect(page.getByRole("heading", { name: "Esbjerg" })).toBeVisible();
|
||||
await expect(page.getByTestId("department-overview-kpi-revenue")).toContainText("1.234");
|
||||
await expect(page.getByTestId("department-overview-kpi-bookings")).toContainText("of 4");
|
||||
await expect(page.getByTestId("department-overview-products")).toContainText("Spot Free");
|
||||
await expect(page.getByTestId("department-overview-hardware")).toContainText("1 / 2");
|
||||
await expect(page.getByTestId("department-overview-quick-links")).toContainText("Gateways");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,117 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { mockApi, seedAuthenticatedState } from "./support/network.js";
|
||||
import { isDesktopProject } from "./support/projects";
|
||||
|
||||
const json = (body: unknown, status = 200) => ({
|
||||
status,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
const now = "2026-07-06 10:00:00";
|
||||
|
||||
const buildProduct = (product: Record<string, unknown>) => ({
|
||||
description: "E2E product",
|
||||
subscription_allowed: true,
|
||||
category: 1,
|
||||
piktogram: "truck",
|
||||
economic_product_id: 0,
|
||||
apply_category_discount: false,
|
||||
requires_note: false,
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
addons: [],
|
||||
is_wash: true,
|
||||
display_in_booking_form: true,
|
||||
order_priority: 1,
|
||||
...product,
|
||||
});
|
||||
|
||||
test.describe("Superuser department custom-only pricing", () => {
|
||||
test("toggles no-fallback pricing and shows 999999 for missing department prices", async ({ page }, testInfo) => {
|
||||
test.skip(!isDesktopProject(testInfo), "Desktop only");
|
||||
|
||||
let customPricingOnly = false;
|
||||
let receivedToggleBody: Record<string, unknown> | null = null;
|
||||
|
||||
const products = [
|
||||
buildProduct({ id: 10, name: "Fallback Wash", price: 12345 }),
|
||||
buildProduct({ id: 11, name: "Explicit Wash", price: 98765, order_priority: 2 }),
|
||||
];
|
||||
|
||||
await page.setViewportSize({ width: 1280, height: 720 });
|
||||
await seedAuthenticatedState(page, "superuser-department-pricing-token");
|
||||
await mockApi(page, {
|
||||
authenticated: true,
|
||||
permissions: [
|
||||
"superuser",
|
||||
"user",
|
||||
"list_products",
|
||||
"list_departments",
|
||||
"edit_department",
|
||||
"superuser_fetch_department",
|
||||
"superuser_fetch_department_prices",
|
||||
"superuser_set_department_prices",
|
||||
],
|
||||
sessionData: {
|
||||
group_id: 1,
|
||||
},
|
||||
});
|
||||
|
||||
await page.route("**/api/products**", async (route) => {
|
||||
await route.fulfill(json({ data: products }));
|
||||
});
|
||||
|
||||
await page.route("**/api/superuser/department/prices**", async (route) => {
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: [{ id: 100, department_id: 42, product_id: 11, price: 2222 }],
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
await page.route(/\/api\/superuser\/department(?:\?.*)?$/i, async (route) => {
|
||||
await route.fulfill(
|
||||
json({
|
||||
data: {
|
||||
id: 42,
|
||||
name: "Custom Pricing Department",
|
||||
description: "E2E department",
|
||||
custom_pricing_only: customPricingOnly,
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
},
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
await page.route("**/api/departments", async (route) => {
|
||||
const request = route.request();
|
||||
if (request.method() !== "PUT") {
|
||||
await route.fallback();
|
||||
return;
|
||||
}
|
||||
|
||||
receivedToggleBody = request.postDataJSON() as Record<string, unknown>;
|
||||
customPricingOnly = Boolean(receivedToggleBody.custom_pricing_only);
|
||||
await route.fulfill(json({ data: { message: "Department updated successfully" } }));
|
||||
});
|
||||
|
||||
await page.goto("/superuser/departments/42/pricing", { waitUntil: "domcontentloaded" });
|
||||
|
||||
await expect(page.getByTestId("department-custom-pricing-settings")).toBeVisible();
|
||||
await expect(page.getByTestId("department-price-cell-10")).toHaveText(/-/);
|
||||
await expect(page.getByTestId("department-price-cell-11")).toHaveText(/2222/);
|
||||
|
||||
await page.locator('label[for="department-custom-pricing-only"]').click();
|
||||
|
||||
await expect(page.getByTestId("department-custom-pricing-only-toggle")).toBeChecked();
|
||||
await expect(page.getByTestId("department-price-cell-10")).toHaveText(/999999/);
|
||||
await expect(page.getByTestId("department-price-cell-11")).toHaveText(/2222/);
|
||||
expect(receivedToggleBody).toMatchObject({
|
||||
id: "42",
|
||||
custom_pricing_only: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -7,10 +7,13 @@ async function primeSuperuserSession(page) {
|
||||
}
|
||||
|
||||
test.describe("Superuser vehicles smoke", () => {
|
||||
test.describe.configure({ mode: "serial" });
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await mockApi(page, {
|
||||
authenticated: true,
|
||||
permissions: ["superuser", "user"],
|
||||
pos: true,
|
||||
});
|
||||
await primeSuperuserSession(page);
|
||||
});
|
||||
@@ -23,4 +26,51 @@ test.describe("Superuser vehicles smoke", () => {
|
||||
await expect(page.locator("body")).toContainText(/registrerede|registered/i);
|
||||
await expect(page.locator("body")).not.toContainText(/Order ID is required/i);
|
||||
});
|
||||
|
||||
test("superuser can add a vehicle after selecting a customer from searchable results", async ({ page }) => {
|
||||
const createVehiclePayloads = [];
|
||||
|
||||
page.on("request", (request) => {
|
||||
const url = new URL(request.url());
|
||||
if (url.pathname.endsWith("/vehicles") && request.method() === "POST") {
|
||||
createVehiclePayloads.push(request.postDataJSON());
|
||||
}
|
||||
});
|
||||
|
||||
await page.goto("/superuser/vehicles");
|
||||
|
||||
await page.getByTestId("superuser-vehicles-add").click();
|
||||
await expect(page.getByTestId("superuser-add-vehicle-modal")).toBeVisible();
|
||||
|
||||
await page.getByTestId("superuser-add-vehicle-customer-input").fill("12345679");
|
||||
await expect(page.getByTestId("superuser-add-vehicle-customer-option-0")).toBeVisible();
|
||||
await page.getByTestId("superuser-add-vehicle-customer-option-0").click();
|
||||
await expect(page.getByTestId("superuser-add-vehicle-customer-selected")).toContainText("#12345679");
|
||||
|
||||
await page.getByTestId("superuser-add-vehicle-registration").fill("ab12345");
|
||||
await expect(page.getByTestId("superuser-add-vehicle-type")).toBeEnabled();
|
||||
await page.getByTestId("superuser-add-vehicle-type").selectOption("53");
|
||||
await page.getByTestId("superuser-add-vehicle-wash-subscription").check();
|
||||
await page.getByTestId("superuser-add-vehicle-reference").fill("Fleet reference");
|
||||
|
||||
await Promise.all([
|
||||
page.waitForResponse(
|
||||
(response) => response.url().includes("/vehicles") && response.request().method() === "POST"
|
||||
),
|
||||
page.getByTestId("superuser-add-vehicle-submit").click(),
|
||||
]);
|
||||
|
||||
expect(createVehiclePayloads).toEqual([
|
||||
{
|
||||
type: 53,
|
||||
reg: "AB12345",
|
||||
wash_subscription: true,
|
||||
customer_id: 12345679,
|
||||
reference: "Fleet reference",
|
||||
},
|
||||
]);
|
||||
|
||||
await expect(page.getByTestId("superuser-add-vehicle-modal")).toBeHidden();
|
||||
await expect(page.getByTestId("user-vehicles-table")).toContainText("AB12345");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2736,6 +2736,7 @@ export function createPosFixture(overrides = {}) {
|
||||
last_order_id: 54518,
|
||||
},
|
||||
],
|
||||
nextVehicleId: 7002,
|
||||
unknownVehicles: [],
|
||||
orderBookings: [],
|
||||
bookingOrderAssignments: [],
|
||||
@@ -3278,6 +3279,30 @@ async function handlePosRoute({ route, request, parsedUrl, pathname, method, pos
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pathname.endsWith("/vehicles") && method === "POST") {
|
||||
const body = request.postDataJSON?.() || {};
|
||||
const customerId = Number(body.customer_id || 0);
|
||||
const customer = posFixture.customersByNumber[customerId] || null;
|
||||
const vehicle = {
|
||||
id: posFixture.nextVehicleId || 9001,
|
||||
reg: String(body.reg || "").toUpperCase(),
|
||||
customer_id: customerId,
|
||||
customer_name: customer?.name || "",
|
||||
type: Number(body.type || 0),
|
||||
status: "verified",
|
||||
barred: false,
|
||||
wash_subscription: Boolean(body.wash_subscription),
|
||||
addons: { enabled: 0, available: 0, list: [] },
|
||||
reference: body.reference || null,
|
||||
};
|
||||
|
||||
posFixture.nextVehicleId = vehicle.id + 1;
|
||||
posFixture.vehicles = [vehicle, ...(posFixture.vehicles || [])];
|
||||
|
||||
await route.fulfill(json({ success: true, data: vehicle }));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pathname.endsWith("/department/vehicles/unknown-customer") && method === "GET") {
|
||||
await route.fulfill(json({ success: true, data: posFixture.unknownVehicles || [] }));
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
isProductCategoryRestrictedForCustomer,
|
||||
isProductRestrictedForCustomer,
|
||||
isTankCleaningProduct,
|
||||
} from "@/features/customer/customerProductRules.js";
|
||||
|
||||
const onlyTankCleaning = [{ attribute: "onlyTankCleaning" }];
|
||||
const restrictTankCleaning = [{ attribute: "restrictTankCleaning" }];
|
||||
|
||||
describe("customer product rules", () => {
|
||||
it("recognizes tankcleaning products by category and legacy names", () => {
|
||||
expect(isTankCleaningProduct({ category: 5, name: "Saebe/kemi" })).toBe(true);
|
||||
expect(isTankCleaningProduct({ category: 4, name: "Tank cleaning 4 spulehoveder" })).toBe(true);
|
||||
expect(isTankCleaningProduct({ category: 4, name: "Saebe/kemi", category_name: "Tankrens" })).toBe(true);
|
||||
expect(isTankCleaningProduct({ category: 4, name: "Forvogn" })).toBe(false);
|
||||
});
|
||||
|
||||
it("limits only-tankcleaning customers to tankcleaning products", () => {
|
||||
expect(isProductRestrictedForCustomer({ category: 4, name: "Forvogn" }, onlyTankCleaning)).toBe(true);
|
||||
expect(isProductRestrictedForCustomer({ category: 5, name: "Tank cleaning" }, onlyTankCleaning)).toBe(false);
|
||||
expect(isProductRestrictedForCustomer({ category: 4, name: "Forvogn" }, [])).toBe(false);
|
||||
});
|
||||
|
||||
it("does not invert tankcleaning access for regular customers", () => {
|
||||
expect(isProductRestrictedForCustomer({ category: 5, name: "Tank cleaning" }, [])).toBe(false);
|
||||
expect(isProductRestrictedForCustomer({ category: 5, name: "Tank cleaning" }, restrictTankCleaning)).toBe(true);
|
||||
});
|
||||
|
||||
it("applies category restrictions consistently", () => {
|
||||
expect(isProductCategoryRestrictedForCustomer(4, onlyTankCleaning)).toBe(true);
|
||||
expect(isProductCategoryRestrictedForCustomer(5, onlyTankCleaning)).toBe(false);
|
||||
expect(isProductCategoryRestrictedForCustomer("tank_cleaning", restrictTankCleaning)).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,115 @@
|
||||
// @vitest-environment jsdom
|
||||
import { nextTick } from "vue";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { mountWithApp } from "./helpers/mountWithApp.js";
|
||||
|
||||
const searchMocks = vi.hoisted(() => ({
|
||||
isSearchingRef: null,
|
||||
resultsRef: null,
|
||||
searchCustomer: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@/components/search/economic/customerSearch.vue", async () => {
|
||||
const { ref } = await vi.importActual("vue");
|
||||
|
||||
searchMocks.isSearchingRef = ref(false);
|
||||
searchMocks.resultsRef = ref([]);
|
||||
|
||||
return {
|
||||
isSearching: searchMocks.isSearchingRef,
|
||||
searchCustomerResults: searchMocks.resultsRef,
|
||||
searchCustomer: searchMocks.searchCustomer,
|
||||
};
|
||||
});
|
||||
|
||||
import CustomerSearchSelect from "@/components/search/economic/CustomerSearchSelect.vue";
|
||||
|
||||
const customers = [
|
||||
{
|
||||
customerNumber: 12345679,
|
||||
name: "Acme Transport",
|
||||
city: "Taastrup",
|
||||
},
|
||||
{
|
||||
customerNumber: 87654321,
|
||||
name: "Nordic Wash",
|
||||
city: "Copenhagen",
|
||||
},
|
||||
];
|
||||
|
||||
const messages = {
|
||||
en: {
|
||||
vehicles: {
|
||||
add_modal: {
|
||||
customer_label: "Customer",
|
||||
customer_placeholder: "Search customers",
|
||||
selected_customer: "Selected customer",
|
||||
},
|
||||
},
|
||||
common: {
|
||||
clear: "Clear",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const mountComponent = (props = {}) =>
|
||||
mountWithApp(CustomerSearchSelect, {
|
||||
props: {
|
||||
inputId: "test-customer-search",
|
||||
testIdPrefix: "test-customer",
|
||||
...props,
|
||||
},
|
||||
messages,
|
||||
});
|
||||
|
||||
describe("CustomerSearchSelect", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
searchMocks.isSearchingRef.value = false;
|
||||
searchMocks.resultsRef.value = [];
|
||||
searchMocks.searchCustomer.mockImplementation((query) => {
|
||||
searchMocks.resultsRef.value = query ? customers : [];
|
||||
return Promise.resolve(searchMocks.resultsRef.value);
|
||||
});
|
||||
});
|
||||
|
||||
it("searches customers and emits the selected customer", async () => {
|
||||
const wrapper = mountComponent();
|
||||
|
||||
await wrapper.get('[data-testid="test-customer-input"]').setValue("acme");
|
||||
await nextTick();
|
||||
|
||||
expect(searchMocks.searchCustomer).toHaveBeenLastCalledWith("acme");
|
||||
expect(wrapper.get('[data-testid="test-customer-option-0"]').text()).toContain("Acme Transport");
|
||||
|
||||
await wrapper.get('[data-testid="test-customer-option-0"]').trigger("mousedown");
|
||||
await nextTick();
|
||||
|
||||
expect(wrapper.emitted("update:modelValue").at(-1)).toEqual([customers[0]]);
|
||||
expect(wrapper.emitted("selected").at(-1)).toEqual([customers[0]]);
|
||||
await wrapper.setProps({ modelValue: customers[0] });
|
||||
await nextTick();
|
||||
|
||||
expect(wrapper.get('[data-testid="test-customer-selected"]').text()).toContain("Acme Transport");
|
||||
});
|
||||
|
||||
it("supports keyboard selection and clearing", async () => {
|
||||
const wrapper = mountComponent();
|
||||
|
||||
await wrapper.get('[data-testid="test-customer-input"]').setValue("nordic");
|
||||
await wrapper.get('[data-testid="test-customer-input"]').trigger("keydown", { key: "ArrowDown" });
|
||||
await wrapper.get('[data-testid="test-customer-input"]').trigger("keydown", { key: "ArrowDown" });
|
||||
await wrapper.get('[data-testid="test-customer-input"]').trigger("keydown", { key: "Enter" });
|
||||
await nextTick();
|
||||
|
||||
expect(wrapper.emitted("update:modelValue").at(-1)).toEqual([customers[1]]);
|
||||
await wrapper.setProps({ modelValue: customers[1] });
|
||||
await nextTick();
|
||||
|
||||
await wrapper.get('[data-testid="test-customer-clear"]').trigger("click");
|
||||
await nextTick();
|
||||
|
||||
expect(wrapper.emitted("update:modelValue").at(-1)).toEqual([null]);
|
||||
expect(wrapper.emitted("cleared")).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,34 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { endOfLocalDate, formatLocalDateOnly, parseLocalDateOnly, startOfLocalDate } from "@/services/dateOnly.js";
|
||||
|
||||
describe("date-only helpers", () => {
|
||||
it("formats Date objects from their local calendar date", () => {
|
||||
expect(formatLocalDateOnly(new Date(2026, 2, 31, 0, 0, 0, 0))).toBe("2026-03-31");
|
||||
});
|
||||
|
||||
it("parses date input values as local calendar dates", () => {
|
||||
const parsed = parseLocalDateOnly("2026-03-31");
|
||||
|
||||
expect(parsed.getFullYear()).toBe(2026);
|
||||
expect(parsed.getMonth()).toBe(2);
|
||||
expect(parsed.getDate()).toBe(31);
|
||||
expect(formatLocalDateOnly(parsed)).toBe("2026-03-31");
|
||||
});
|
||||
|
||||
it("keeps date-only prefixes from API timestamps without timezone reinterpretation", () => {
|
||||
expect(formatLocalDateOnly("2026-03-31T23:30:00.000Z")).toBe("2026-03-31");
|
||||
});
|
||||
|
||||
it("rejects impossible date input values", () => {
|
||||
expect(Number.isNaN(parseLocalDateOnly("2026-02-31").getTime())).toBe(true);
|
||||
});
|
||||
|
||||
it("builds local day boundaries from the selected date", () => {
|
||||
expect(startOfLocalDate("2026-03-31").getHours()).toBe(0);
|
||||
expect(startOfLocalDate("2026-03-31").getMinutes()).toBe(0);
|
||||
expect(endOfLocalDate("2026-03-31").getHours()).toBe(23);
|
||||
expect(endOfLocalDate("2026-03-31").getMinutes()).toBe(59);
|
||||
expect(formatLocalDateOnly(endOfLocalDate("2026-03-31"))).toBe("2026-03-31");
|
||||
});
|
||||
});
|
||||
@@ -122,6 +122,32 @@ describe("DatePeriodSelector mobile layout", () => {
|
||||
expect(formatLocalDate(onSelectionChange.mock.calls[0][0])).toBe("2026-03-01");
|
||||
expect(formatLocalDate(onSelectionChange.mock.calls[0][1])).toBe("2026-03-05");
|
||||
});
|
||||
|
||||
it("emits the exact clicked date for start and end inputs", async () => {
|
||||
sharedState.width.value = 1024;
|
||||
const onSelectionChange = vi.fn();
|
||||
const wrapper = mount(DatePeriodSelector, {
|
||||
props: {
|
||||
selection: {
|
||||
startDate: new Date(2026, 2, 1, 0, 0, 0, 0),
|
||||
endDate: new Date(2026, 2, 3, 23, 59, 59, 999),
|
||||
},
|
||||
onSelectionChange,
|
||||
visibility: {
|
||||
showUpdateButton: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await wrapper.get("[data-testid='date-period-start']").setValue("2026-03-31");
|
||||
await wrapper.get("[data-testid='date-period-end']").setValue("2026-04-02");
|
||||
|
||||
const emittedSelection = wrapper.emitted("update:selection")?.at(-1)?.[0];
|
||||
expect(formatLocalDate(emittedSelection.startDate)).toBe("2026-03-31");
|
||||
expect(formatLocalDate(emittedSelection.endDate)).toBe("2026-04-02");
|
||||
expect(formatLocalDate(onSelectionChange.mock.calls.at(-1)[0])).toBe("2026-03-31");
|
||||
expect(formatLocalDate(onSelectionChange.mock.calls.at(-1)[1])).toBe("2026-04-02");
|
||||
});
|
||||
});
|
||||
|
||||
describe("DatePeriodSelector month warning", () => {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { defineComponent, nextTick } from "vue";
|
||||
import { mount } from "@vue/test-utils";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { formatLocalDateOnly } from "@/services/dateOnly.js";
|
||||
|
||||
const selectDateMock = vi.hoisted(() => vi.fn());
|
||||
const sharedDateState = vi.hoisted(() => ({
|
||||
@@ -39,10 +40,10 @@ const DatePeriodSelectorStub = defineComponent({
|
||||
emits: ["update:selection"],
|
||||
template: `
|
||||
<div>
|
||||
<button class="trigger-on-selection-change" @click="onSelectionChange(new Date('2026-03-24T00:00:00.000Z'), new Date('2026-03-29T00:00:00.000Z'))">
|
||||
<button class="trigger-on-selection-change" @click="onSelectionChange(new Date(2026, 2, 24), new Date(2026, 2, 29))">
|
||||
onSelectionChange
|
||||
</button>
|
||||
<button class="trigger-update-selection" @click="$emit('update:selection', { startDate: new Date('2026-04-01T00:00:00.000Z'), endDate: new Date('2026-04-30T00:00:00.000Z') })">
|
||||
<button class="trigger-update-selection" @click="$emit('update:selection', { startDate: new Date(2026, 3, 1), endDate: new Date(2026, 3, 30) })">
|
||||
update:selection
|
||||
</button>
|
||||
</div>
|
||||
@@ -105,7 +106,7 @@ describe("DepartmentDashboardOverviewNavigation", () => {
|
||||
});
|
||||
|
||||
const selector = wrapper.findComponent(DatePeriodSelectorStub);
|
||||
expect(selector.props("selection").startDate.toISOString().split("T")[0]).toBe("2026-05-05");
|
||||
expect(selector.props("selection").endDate.toISOString().split("T")[0]).toBe("2026-05-11");
|
||||
expect(formatLocalDateOnly(selector.props("selection").startDate)).toBe("2026-05-05");
|
||||
expect(formatLocalDateOnly(selector.props("selection").endDate)).toBe("2026-05-11");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -579,6 +579,7 @@ describe("MyWashStart", () => {
|
||||
|
||||
afterEach(() => {
|
||||
consoleWarnSpy?.mockRestore();
|
||||
vi.clearAllTimers();
|
||||
vi.useRealTimers();
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
// @vitest-environment jsdom
|
||||
import { defineComponent } from "vue";
|
||||
import { mount } from "@vue/test-utils";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("vue-i18n", async (importOriginal) => {
|
||||
const actual = await importOriginal();
|
||||
|
||||
return {
|
||||
...actual,
|
||||
useI18n: () => ({
|
||||
t: (value) => value,
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("@/components/session/token/SessionUser.vue", () => ({
|
||||
SessionUser: {
|
||||
objects: {
|
||||
global: {
|
||||
language: {
|
||||
date_from: "From",
|
||||
date_to: "To",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
import { formatLocalDateOnly } from "@/services/dateOnly.js";
|
||||
import PaginationDisplayTemplateDate from "@/components/displays/pagination/templates/PaginationDisplayTemplateDate.vue";
|
||||
import PaginationDisplayTemplateDates from "@/components/displays/pagination/templates/PaginationDisplayTemplateDates.vue";
|
||||
import { dateFunctions } from "@/components/displays/pagination/PaginationDisplayDates.vue";
|
||||
|
||||
const PaginationDisplayItemColumnStub = defineComponent({
|
||||
name: "PaginationDisplayItemColumn",
|
||||
props: {
|
||||
label: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
template: "<div><slot name='control' /></div>",
|
||||
});
|
||||
|
||||
describe("pagination date selection", () => {
|
||||
it("renders Date model values as the same local date", () => {
|
||||
const wrapper = mount(PaginationDisplayTemplateDate, {
|
||||
props: {
|
||||
label: "Date",
|
||||
modelValue: new Date(2026, 2, 31, 0, 0, 0, 0),
|
||||
},
|
||||
global: {
|
||||
stubs: {
|
||||
PaginationDisplayItemColumn: PaginationDisplayItemColumnStub,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.get("input[type='date']").element.value).toBe("2026-03-31");
|
||||
});
|
||||
|
||||
it("emits the clicked input date as the same local date", async () => {
|
||||
const wrapper = mount(PaginationDisplayTemplateDate, {
|
||||
props: {
|
||||
label: "Date",
|
||||
modelValue: new Date(2026, 2, 1, 0, 0, 0, 0),
|
||||
},
|
||||
global: {
|
||||
stubs: {
|
||||
PaginationDisplayItemColumn: PaginationDisplayItemColumnStub,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await wrapper.get("input[type='date']").setValue("2026-03-31");
|
||||
|
||||
const emittedDate = wrapper.emitted("update:date")?.at(-1)?.[0];
|
||||
expect(formatLocalDateOnly(emittedDate)).toBe("2026-03-31");
|
||||
});
|
||||
|
||||
it("uses the real first day of the month for month presets", () => {
|
||||
const firstDay = dateFunctions.datePresetFunctions.month.firstDayOfMonth(new Date(2026, 4, 15, 12, 0, 0, 0));
|
||||
|
||||
expect(formatLocalDateOnly(firstDay)).toBe("2026-05-01");
|
||||
expect(firstDay.getHours()).toBe(0);
|
||||
expect(firstDay.getMinutes()).toBe(0);
|
||||
});
|
||||
|
||||
it("emits both start and end updates from the paired date selector", async () => {
|
||||
const wrapper = mount(PaginationDisplayTemplateDates, {
|
||||
props: {
|
||||
startDate: new Date(2026, 2, 1, 0, 0, 0, 0),
|
||||
endDate: new Date(2026, 2, 31, 0, 0, 0, 0),
|
||||
},
|
||||
global: {
|
||||
stubs: {
|
||||
PaginationDisplayItemColumn: PaginationDisplayItemColumnStub,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const inputs = wrapper.findAll("input[type='date']");
|
||||
await inputs[0].setValue("2026-04-01");
|
||||
await inputs[1].setValue("2026-04-30");
|
||||
|
||||
expect(formatLocalDateOnly(wrapper.emitted("update:startDate")?.at(-1)?.[0])).toBe("2026-04-01");
|
||||
expect(formatLocalDateOnly(wrapper.emitted("update:endDate")?.at(-1)?.[0])).toBe("2026-04-30");
|
||||
});
|
||||
});
|
||||
@@ -40,6 +40,16 @@ describe("Playwright full E2E workflow grouping", () => {
|
||||
expect(source).toContain("scripts/ci/runner-diagnostics.sh");
|
||||
});
|
||||
|
||||
it("keeps PR E2E runner pressure bounded and diagnosable", () => {
|
||||
const source = workflowSource();
|
||||
|
||||
expect(source).toMatch(/e2e-pr:[\s\S]*?max-parallel: 4/u);
|
||||
expect(source).toMatch(/e2e-pr:[\s\S]*?PLAYWRIGHT_WORKERS: 1/u);
|
||||
expect(source).toMatch(/e2e-pr:[\s\S]*?PLAYWRIGHT_VIDEO_MODE: on-first-retry/u);
|
||||
expect(source).toMatch(/e2e-pr:[\s\S]*?--env PLAYWRIGHT_WORKERS="\$PLAYWRIGHT_WORKERS"/u);
|
||||
expect(source).toMatch(/e2e-pr:[\s\S]*?--env PLAYWRIGHT_VIDEO_MODE="\$PLAYWRIGHT_VIDEO_MODE"/u);
|
||||
});
|
||||
|
||||
it("allows CI to reduce Playwright video artifact pressure", () => {
|
||||
const source = readFileSync(join(root, "playwright.config.ts"), "utf8");
|
||||
|
||||
|
||||
@@ -15,6 +15,21 @@ describe("Playwright PR mapping", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("maps superuser department pricing changes to custom-only pricing coverage", () => {
|
||||
expect(specsFor("src/views/dashboards/superUserDashboard/department/DepartmentPricing.vue")).toContain(
|
||||
"tests/e2e/superuser-department-pricing-custom-only.spec.ts"
|
||||
);
|
||||
expect(
|
||||
specsFor("src/views/dashboards/superUserDashboard/department/SuperUserSelectedDepartmentObject.vue")
|
||||
).toContain("tests/e2e/superuser-department-pricing-custom-only.spec.ts");
|
||||
expect(specsFor("src/components/session/token/SessionUser/Objects/Departments.vue")).toContain(
|
||||
"tests/e2e/superuser-department-pricing-custom-only.spec.ts"
|
||||
);
|
||||
expect(specsFor("src/components/session/token/SessionUser/Objects/Departments.vue")).not.toContain(
|
||||
"tests/e2e/userAuth.spec.ts"
|
||||
);
|
||||
});
|
||||
|
||||
it("maps department notification table changes to the admin notification E2E coverage", () => {
|
||||
expect(
|
||||
specsFor("src/components/displays/department/notifications/departmentNotificationsPhoneTable.vue")
|
||||
@@ -33,9 +48,20 @@ describe("Playwright PR mapping", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps full-slice ownership metadata out of broad PR smoke fallback", () => {
|
||||
expect(triggersFallback("scripts/run-playwright-pr.mjs")).toBe(true);
|
||||
it("keeps PR runner and full-slice metadata edits out of broad PR smoke fallback", () => {
|
||||
expect(triggersFallback("scripts/run-playwright-pr.mjs")).toBe(false);
|
||||
expect(triggersFallback("scripts/run-playwright-ci-parallel.mjs")).toBe(true);
|
||||
expect(triggersFallback("scripts/run-playwright-full-slice.mjs")).toBe(false);
|
||||
});
|
||||
|
||||
it("maps customer product rule changes to POS customer rule E2E coverage", () => {
|
||||
expect(specsFor("src/features/customer/customerProductRules.js")).toContain("tests/e2e/pos-customer-rules.spec.js");
|
||||
expect(specsFor("src/components/displays/boxes/ProductBox.vue")).toContain("tests/e2e/pos-customer-rules.spec.js");
|
||||
});
|
||||
|
||||
it("maps limited backoffice changes to the limited backoffice E2E coverage", () => {
|
||||
expect(specsFor("src/views/backoffice/LimitedBackofficeEmployees.vue")).toContain(
|
||||
"tests/e2e/limited-backoffice.spec.ts"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -95,6 +95,7 @@ afterEach(async () => {
|
||||
await Promise.resolve();
|
||||
await Promise.resolve();
|
||||
|
||||
vi.clearAllTimers();
|
||||
vi.useRealTimers();
|
||||
vi.clearAllMocks();
|
||||
vi.unstubAllGlobals();
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
// @vitest-environment jsdom
|
||||
import { nextTick } from "vue";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { mountWithApp } from "./helpers/mountWithApp.js";
|
||||
|
||||
const sessionMocks = vi.hoisted(() => ({
|
||||
addVehicle: vi.fn(),
|
||||
parseErrorMessage: vi.fn(),
|
||||
vehicleTypeOptions: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@/components/session/token/SessionUser.vue", () => {
|
||||
const sessionUser = {
|
||||
functions: {
|
||||
parseErrorMessage: sessionMocks.parseErrorMessage,
|
||||
},
|
||||
objects: {
|
||||
vehicles: {
|
||||
add: sessionMocks.addVehicle,
|
||||
columns: {
|
||||
type: {
|
||||
options: sessionMocks.vehicleTypeOptions,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
SessionUser: sessionUser,
|
||||
default: sessionUser,
|
||||
};
|
||||
});
|
||||
|
||||
import SuperuserAddVehicleModal from "@/components/forms/superUser/SuperuserAddVehicleModal.vue";
|
||||
|
||||
const CustomerSearchSelectStub = {
|
||||
props: ["modelValue"],
|
||||
emits: ["update:modelValue"],
|
||||
template: `
|
||||
<button
|
||||
type="button"
|
||||
data-testid="customer-select-stub"
|
||||
@click="$emit('update:modelValue', { customerNumber: 12345679, name: 'Acme Transport' })"
|
||||
>
|
||||
Select customer
|
||||
</button>
|
||||
`,
|
||||
};
|
||||
|
||||
const messages = {
|
||||
en: {
|
||||
vehicles: {
|
||||
add_modal: {
|
||||
customer_label: "Customer",
|
||||
customer_placeholder: "Search customers",
|
||||
error: "Unable to add vehicle.",
|
||||
reference_placeholder: "Optional reference",
|
||||
registration_placeholder: "Registration number",
|
||||
selected_customer: "Selected customer",
|
||||
submit: "Add vehicle",
|
||||
title: "Add vehicle",
|
||||
type_load_error: "Unable to load vehicle types.",
|
||||
type_placeholder: "Select vehicle type",
|
||||
validation_error: "Select required fields.",
|
||||
},
|
||||
form: {
|
||||
license_plate: "Registration",
|
||||
type: "Type",
|
||||
},
|
||||
},
|
||||
objects: {
|
||||
vehicles: {
|
||||
columns: {
|
||||
wash_subscription: "Wash subscription",
|
||||
},
|
||||
},
|
||||
},
|
||||
common: {
|
||||
cancel: "Cancel",
|
||||
close: "Close",
|
||||
reference: "Reference",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const flushAll = async () => {
|
||||
await Promise.resolve();
|
||||
await nextTick();
|
||||
await Promise.resolve();
|
||||
await nextTick();
|
||||
};
|
||||
|
||||
const mountComponent = () =>
|
||||
mountWithApp(SuperuserAddVehicleModal, {
|
||||
messages,
|
||||
global: {
|
||||
stubs: {
|
||||
CustomerSearchSelect: CustomerSearchSelectStub,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
describe("SuperuserAddVehicleModal", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
sessionMocks.vehicleTypeOptions.mockResolvedValue([
|
||||
{
|
||||
id: 53,
|
||||
name: "Forvogn",
|
||||
},
|
||||
]);
|
||||
sessionMocks.addVehicle.mockResolvedValue({
|
||||
data: {
|
||||
data: {
|
||||
id: 7002,
|
||||
},
|
||||
},
|
||||
});
|
||||
sessionMocks.parseErrorMessage.mockReturnValue(null);
|
||||
});
|
||||
|
||||
it("submits the selected customer and vehicle fields through the vehicle API", async () => {
|
||||
const wrapper = mountComponent();
|
||||
await flushAll();
|
||||
|
||||
await wrapper.get('[data-testid="customer-select-stub"]').trigger("click");
|
||||
await wrapper.get('[data-testid="superuser-add-vehicle-registration"]').setValue("ab12345");
|
||||
await wrapper.get('[data-testid="superuser-add-vehicle-type"]').setValue("53");
|
||||
await wrapper.get('[data-testid="superuser-add-vehicle-wash-subscription"]').setValue(true);
|
||||
await wrapper.get('[data-testid="superuser-add-vehicle-reference"]').setValue("Fleet ref");
|
||||
await wrapper.get('[data-testid="superuser-add-vehicle-submit"]').trigger("click");
|
||||
await flushAll();
|
||||
|
||||
expect(sessionMocks.addVehicle).toHaveBeenCalledWith(53, "AB12345", true, 12345679, "Fleet ref");
|
||||
expect(wrapper.emitted("created")).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("keeps submit disabled until required fields are present", async () => {
|
||||
const wrapper = mountComponent();
|
||||
await flushAll();
|
||||
|
||||
expect(wrapper.get('[data-testid="superuser-add-vehicle-submit"]').attributes("disabled")).toBeDefined();
|
||||
|
||||
await wrapper.get('[data-testid="customer-select-stub"]').trigger("click");
|
||||
await wrapper.get('[data-testid="superuser-add-vehicle-registration"]').setValue("AB12345");
|
||||
await wrapper.get('[data-testid="superuser-add-vehicle-type"]').setValue("53");
|
||||
await nextTick();
|
||||
|
||||
expect(wrapper.get('[data-testid="superuser-add-vehicle-submit"]').attributes("disabled")).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,278 @@
|
||||
/* @vitest-environment jsdom */
|
||||
import { nextTick } from "vue";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { mountWithApp } from "./helpers/mountWithApp.js";
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
route: {
|
||||
params: { departmentId: "1" },
|
||||
query: { date: "2026-07-06", date_to: "2026-07-06" },
|
||||
path: "/superuser/departments/1",
|
||||
},
|
||||
router: {
|
||||
replace: vi.fn((nextRoute) => {
|
||||
mocks.route.query = nextRoute.query || {};
|
||||
return Promise.resolve();
|
||||
}),
|
||||
push: vi.fn(),
|
||||
},
|
||||
getSuperuserDepartmentOverview: vi.fn(),
|
||||
getEdgeGatewayDepartmentWorkspace: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("vue-router", () => ({
|
||||
useRoute: () => mocks.route,
|
||||
useRouter: () => mocks.router,
|
||||
}));
|
||||
|
||||
vi.mock("@/services/superuserDepartmentOverview.js", () => ({
|
||||
getSuperuserDepartmentOverview: mocks.getSuperuserDepartmentOverview,
|
||||
}));
|
||||
|
||||
vi.mock("@/services/edgeGateways.js", () => ({
|
||||
getEdgeGatewayDepartmentWorkspace: mocks.getEdgeGatewayDepartmentWorkspace,
|
||||
}));
|
||||
|
||||
vi.mock("@/components/session/token/SessionUser.vue", () => ({
|
||||
SessionUser: {
|
||||
canAccessSuperUser: () => true,
|
||||
functions: {
|
||||
currency: {
|
||||
toLocal: (value) => `${Number(value).toLocaleString("da-DK")} kr.`,
|
||||
},
|
||||
date: {
|
||||
toLocal: (value) => `local:${value}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("@/components/global/PageTitle.vue", () => ({
|
||||
default: {
|
||||
props: ["title", "subtitle"],
|
||||
template: "<header><h1>{{ title }}</h1><p>{{ subtitle }}</p></header>",
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("@/components/page/wrappers/RestrictedPageWrapper.vue", () => ({
|
||||
default: {
|
||||
template: "<div><slot /></div>",
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("@/views/dashboards/superUserDashboard/department/DepartmentSubPageWrapper.vue", () => ({
|
||||
default: {
|
||||
template: "<main><slot name='title' /><slot /></main>",
|
||||
},
|
||||
}));
|
||||
|
||||
import DepartmentOverview from "@/views/dashboards/superUserDashboard/department/Department.vue";
|
||||
import DepartmentNavigation from "@/views/dashboards/superUserDashboard/department/SuperUserDashboardDepartmentNavigation.vue";
|
||||
|
||||
const messages = {
|
||||
en: {
|
||||
superuser_dashboard: {
|
||||
department_navigation: {
|
||||
overview: "Overview",
|
||||
modules: "Modules",
|
||||
branding: "Profile & Branding",
|
||||
gateways: "Gateways",
|
||||
stripe: "Stripe",
|
||||
pricing: "Pricing",
|
||||
categories: "Categories",
|
||||
},
|
||||
department_overview: {
|
||||
title: "Department overview",
|
||||
subtitle: "Operational overview",
|
||||
loading: "Loading department overview",
|
||||
date_from: "From",
|
||||
date_to: "To",
|
||||
range_label: "{from} to {to}",
|
||||
empty_value: "-",
|
||||
out_of: "of {total}",
|
||||
presets: {
|
||||
today: "Today",
|
||||
last_seven_days: "Last 7 days",
|
||||
},
|
||||
metrics: {
|
||||
bookings: "Bookings",
|
||||
complaints: "Complaints",
|
||||
night_washes: "Night washes",
|
||||
overtime: "Overtime",
|
||||
products_sold: "Products sold",
|
||||
revenue: "Revenue",
|
||||
transactions: "Transactions",
|
||||
washes: "Washes",
|
||||
water_usage: "Water",
|
||||
},
|
||||
units: {
|
||||
hours: "h",
|
||||
liters: "L",
|
||||
},
|
||||
products: {
|
||||
title: "Product mix",
|
||||
subtitle: "Tracked wash products",
|
||||
empty: "No product activity",
|
||||
},
|
||||
profile: {
|
||||
title: "Department profile",
|
||||
no_description: "No department description",
|
||||
department_id: "Department ID",
|
||||
economic_department_id: "Economic department",
|
||||
branding: "Branding",
|
||||
created_at: "Created",
|
||||
updated_at: "Updated",
|
||||
},
|
||||
hardware: {
|
||||
title: "Hardware readiness",
|
||||
subtitle: "Gateway-backed state",
|
||||
gateways: "Gateways online",
|
||||
lanes: "Lanes",
|
||||
gates: "Gates",
|
||||
relays: "Relays",
|
||||
scanners: "Scanners",
|
||||
issues: "Issues",
|
||||
},
|
||||
quick_links: {
|
||||
title: "Department tools",
|
||||
subtitle: "Open setup areas",
|
||||
modules: "Modules",
|
||||
branding: "Branding",
|
||||
gateways: "Gateways",
|
||||
stripe: "Stripe",
|
||||
pricing: "Pricing",
|
||||
categories: "Categories",
|
||||
},
|
||||
errors: {
|
||||
invalid_department: "A valid department is required",
|
||||
load: "Unable to load the department overview",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const overviewResponse = {
|
||||
data: {
|
||||
data: {
|
||||
department: {
|
||||
id: 1,
|
||||
name: "Esbjerg",
|
||||
description: "Skagerrakvej 15",
|
||||
economic_department_id: 42,
|
||||
branding: 14,
|
||||
created_at: "2026-01-01 00:00:00",
|
||||
updated_at: "2026-07-06 09:30:00",
|
||||
},
|
||||
overview: {
|
||||
department_ids: [1],
|
||||
date: "2026-07-06",
|
||||
date_to: "2026-07-06",
|
||||
metrics: {
|
||||
bookings: { state: "ready", value: 3, out_of: 4 },
|
||||
complaints: { state: "ready", value: 1 },
|
||||
night_washes: { state: "ready", value: 2 },
|
||||
revenue: { state: "ready", value: 1234 },
|
||||
washes: { state: "ready", value: 11 },
|
||||
products_sold: { state: "ready", value: 18 },
|
||||
transactions: { state: "ready", value: 9 },
|
||||
water_usage: { state: "ready", value: 250 },
|
||||
overtime: { state: "ready", value: 1.5 },
|
||||
},
|
||||
products: [
|
||||
{
|
||||
product_id: 24,
|
||||
slug: "spot-free-lastbil",
|
||||
title: "Spot Free",
|
||||
state: "ready",
|
||||
value: 4,
|
||||
out_of: 11,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const hardwareResponse = {
|
||||
data: {
|
||||
data: {
|
||||
gateways: [
|
||||
{ id: 1, status: "ONLINE" },
|
||||
{ id: 2, status: "OFFLINE" },
|
||||
],
|
||||
lanes: [{ id: 1 }, { id: 2 }],
|
||||
gates: [{ id: 1 }],
|
||||
relays: [{ id: 1 }, { id: 2 }, { id: 3 }],
|
||||
scanners: [{ id: 1 }],
|
||||
issues: [{ key: "gateway-offline" }],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const flushRendering = async () => {
|
||||
await Promise.resolve();
|
||||
await Promise.resolve();
|
||||
await nextTick();
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
mocks.route.params = { departmentId: "1" };
|
||||
mocks.route.query = { date: "2026-07-06", date_to: "2026-07-06" };
|
||||
mocks.route.path = "/superuser/departments/1";
|
||||
mocks.router.replace.mockClear();
|
||||
mocks.router.push.mockClear();
|
||||
mocks.getSuperuserDepartmentOverview.mockReset();
|
||||
mocks.getEdgeGatewayDepartmentWorkspace.mockReset();
|
||||
mocks.getSuperuserDepartmentOverview.mockResolvedValue(overviewResponse);
|
||||
mocks.getEdgeGatewayDepartmentWorkspace.mockResolvedValue(hardwareResponse);
|
||||
});
|
||||
|
||||
describe("Superuser department overview", () => {
|
||||
it("loads the superuser overview endpoint and renders operations data", async () => {
|
||||
const wrapper = mountWithApp(DepartmentOverview, {
|
||||
messages,
|
||||
});
|
||||
|
||||
await flushRendering();
|
||||
|
||||
expect(mocks.getSuperuserDepartmentOverview).toHaveBeenCalledWith(1, {
|
||||
date: "2026-07-06",
|
||||
dateTo: "2026-07-06",
|
||||
});
|
||||
expect(mocks.getEdgeGatewayDepartmentWorkspace).toHaveBeenCalledWith(1);
|
||||
expect(wrapper.find("h1").text()).toBe("Esbjerg");
|
||||
expect(wrapper.get('[data-testid="department-overview-kpi-revenue"]').text()).toContain("1.234 kr.");
|
||||
expect(wrapper.get('[data-testid="department-overview-kpi-bookings"]').text()).toContain("of 4");
|
||||
expect(wrapper.get('[data-testid="department-overview-products"]').text()).toContain("Spot Free");
|
||||
expect(wrapper.get('[data-testid="department-overview-profile"]').text()).toContain("Economic department");
|
||||
expect(wrapper.get('[data-testid="department-overview-hardware"]').text()).toContain("1 / 2");
|
||||
});
|
||||
|
||||
it("keeps the overview visible when the optional hardware summary is unavailable", async () => {
|
||||
mocks.getEdgeGatewayDepartmentWorkspace.mockRejectedValue(new Error("Forbidden"));
|
||||
|
||||
const wrapper = mountWithApp(DepartmentOverview, {
|
||||
messages,
|
||||
});
|
||||
|
||||
await flushRendering();
|
||||
|
||||
expect(wrapper.get('[data-testid="department-overview-kpi-revenue"]').text()).toContain("1.234 kr.");
|
||||
expect(wrapper.find('[data-testid="department-overview-hardware"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it("uses translated reactive department tabs and pushes the selected route", async () => {
|
||||
mocks.route.path = "/superuser/departments/1/gateways";
|
||||
|
||||
const wrapper = mountWithApp(DepartmentNavigation, { messages });
|
||||
const activeTab = wrapper.find(".tabs li.is-active");
|
||||
|
||||
expect(activeTab.text()).toBe("Gateways");
|
||||
|
||||
const tabs = wrapper.findAll(".tabs li");
|
||||
await tabs.find((tab) => tab.text() === "Pricing").trigger("click");
|
||||
|
||||
expect(mocks.router.push).toHaveBeenCalledWith("/superuser/departments/1/pricing");
|
||||
});
|
||||
});
|
||||
@@ -367,6 +367,8 @@ describe("Invoice orders pagination contract", () => {
|
||||
expect(invoiceOrdersPaginationSource).toContain(
|
||||
"const onDateRangeSelected = (newSelectionStartDate, newSelectionToDate) => {"
|
||||
);
|
||||
expect(invoiceOrdersPaginationSource).toContain("formatLocalDateOnly(newSelectionStartDate)");
|
||||
expect(invoiceOrdersPaginationSource).toContain("formatLocalDateOnly(newSelectionToDate)");
|
||||
expect(invoiceOrdersPaginationSource).toContain("date_from.value = formattedStartDate;");
|
||||
expect(invoiceOrdersPaginationSource).toContain("date_to.value = formattedEndDate;");
|
||||
expect(invoiceOrdersPaginationSource).toContain('setFilter("created_at-date_from", formattedStartDate, true);');
|
||||
|
||||
Reference in New Issue
Block a user