Update order handling to include closed status and improve UI

Added support for 'closed_at' field to determine order editability and updated related logic. Enhanced UI to show invoice collection ID in tags and adjusted navigation paths for better context. Minor formatting improvements included.
This commit is contained in:
Jepp9350
2025-03-03 17:23:49 +01:00
parent c13c08ad87
commit 2851d768db
3 changed files with 7 additions and 4 deletions
@@ -84,7 +84,7 @@ const redirect = (path) => {
<template #actions>
<ActionSettingsWheelItem
icon="fas fa-eye"
@click="redirect('/superuser/invoices/' + object.id)"
@click="redirect('/admin/' + object.department_id + '/modules/pos/orders/' + object.id)"
label="Vis"
/>
</template>
@@ -355,6 +355,7 @@ const unselectProduct = () => {
selectedProduct.value = null;
}, 100);
};
</script>
<template>
@@ -39,6 +39,7 @@ const stripeModule = ref([]);
const AddOrderItemsVisible = ref(false);
const draftInvoice = ref([]);
const errors = ref([]);
const closed_at = ref(null);
const loadOrder = async () => {
isLoading.value = true;
@@ -52,6 +53,7 @@ const loadOrder = async () => {
cashier.value = response.data.includes.cashier; // Get the cashier
economicModule.value = response.data.includes.economicModuleOrders; // Get the economic module orders
stripeModule.value = response.data.includes.stripeModuleOrders; // Get the stripe module orders
closed_at.value = response.data.data.closed_at;
isLoading.value = false;
setOrderId(orderId.value);
selectCustomer(customer.value.economic_customer);
@@ -128,7 +130,7 @@ loadOrder();
// Make sure the order isn't invoiced, and the user has permission to edit the order items
const isEditPossible = () => {
return !isInvoicedWithEconomic() && !isInvoicedWithStripe() && SessionUser.hasPermission('edit_order_items');
return !isInvoicedWithEconomic() && !isInvoicedWithStripe() && SessionUser.hasPermission('edit_order_items') && !closed_at.value;
};
const isInvoiced = () => {
@@ -178,7 +180,7 @@ const isBookedWithEconomic = () => {
<div class="tag is-warning"> Ikke faktureret </div>
</div>
<div v-else>
<div class="tag is-dark"> Gemt til samlet fakturering </div>
<div class="tag is-dark"> Gemt til fakturering #{{ order.invoice_collection_id }} </div>
</div>
</div>
<!-- Heading center slot -->
@@ -312,7 +314,7 @@ const isBookedWithEconomic = () => {
</template>
<!-- Bottom order items slot -->
<template #bottom-order-items>
<tr v-if="!isInvoiced() && !AddOrderItemsVisible">
<tr v-if="!isInvoiced() && !AddOrderItemsVisible && isEditPossible()">
<td colspan="3">
<div class="button is-text is-small"
@click="showAddOrderItemsDisplay(true)"