Fixed page layout and edit delivery
This commit is contained in:
37
src/App.vue
37
src/App.vue
@@ -1,38 +1,3 @@
|
||||
<!-- App.vue -->
|
||||
<template>
|
||||
<div class="drawer lg:drawer-open">
|
||||
<input id="my-drawer-2" type="checkbox" class="drawer-toggle" />
|
||||
|
||||
<!--
|
||||
DRAWER CONTENT: Main page content area.
|
||||
FIX: Added `relative` so the absolutely positioned search results are contained within it.
|
||||
-->
|
||||
<div class="drawer-content flex flex-col relative">
|
||||
<HeaderAuth />
|
||||
<main class="flex-1 p-4 md:p-8 bg-base-200">
|
||||
<router-view />
|
||||
</main>
|
||||
|
||||
<!-- The SearchResults component now lives here and will appear as an overlay -->
|
||||
<SearchResults v-if="searchStore.showResults" />
|
||||
|
||||
<notifications position="top center" />
|
||||
</div>
|
||||
|
||||
<!-- DRAWER SIDE: This is your main navigation sidebar. It is no longer conditional. -->
|
||||
<div class="drawer-side">
|
||||
<label for="my-drawer-2" class="drawer-overlay"></label>
|
||||
<SideBar />
|
||||
</div>
|
||||
</div>
|
||||
<router-view />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchStore } from './stores/search';
|
||||
import HeaderAuth from './layouts/headers/headerauth.vue';
|
||||
import SideBar from './layouts/sidebar/sidebar.vue';
|
||||
// Make sure this path and component name are correct
|
||||
import SearchResults from './components/SearchResults.vue';
|
||||
|
||||
const searchStore = useSearchStore();
|
||||
</script>
|
||||
10
src/layouts/BlankLayout.vue
Normal file
10
src/layouts/BlankLayout.vue
Normal file
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<!-- This will render the page component directly without any wrappers -->
|
||||
<router-view />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'BlankLayout'
|
||||
}
|
||||
</script>
|
||||
37
src/layouts/DefaultLayout.vue
Normal file
37
src/layouts/DefaultLayout.vue
Normal file
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<div class="drawer lg:drawer-open">
|
||||
<input id="my-drawer-2" type="checkbox" class="drawer-toggle" />
|
||||
|
||||
<!--
|
||||
DRAWER CONTENT: Main page content area.
|
||||
FIX: Added `relative` so the absolutely positioned search results are contained within it.
|
||||
-->
|
||||
<div class="drawer-content flex flex-col relative">
|
||||
<HeaderAuth />
|
||||
<main class="flex-1 p-4 md:p-8 bg-base-200">
|
||||
<router-view />
|
||||
</main>
|
||||
|
||||
<!-- The SearchResults component now lives here and will appear as an overlay -->
|
||||
<SearchResults v-if="searchStore.showResults" />
|
||||
|
||||
<notifications position="top center" />
|
||||
</div>
|
||||
|
||||
<!-- DRAWER SIDE: This is your main navigation sidebar. It is no longer conditional. -->
|
||||
<div class="drawer-side">
|
||||
<label for="my-drawer-2" class="drawer-overlay"></label>
|
||||
<SideBar />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSearchStore } from '../stores/search';
|
||||
import HeaderAuth from './headers/headerauth.vue';
|
||||
import SideBar from './sidebar/sidebar.vue';
|
||||
// Make sure this path and component name are correct
|
||||
import SearchResults from '../components/SearchResults.vue';
|
||||
|
||||
const searchStore = useSearchStore();
|
||||
</script>
|
||||
@@ -413,8 +413,8 @@ export default defineComponent({
|
||||
headers: authHeader(),
|
||||
})
|
||||
.then((response: any) => {
|
||||
if (response.data) {
|
||||
this.deliveryOrder = response.data
|
||||
if (response.data && response.data.ok) {
|
||||
this.deliveryOrder = response.data.delivery
|
||||
this.getCustomer(this.deliveryOrder.customer_id)
|
||||
|
||||
if (this.deliveryOrder.payment_type === 1) {
|
||||
@@ -427,14 +427,15 @@ export default defineComponent({
|
||||
this.getPaymentCard(this.deliveryOrder.payment_card_id);
|
||||
}
|
||||
|
||||
this.FinalizeOilOrderForm.cash_recieved = response.data.cash_recieved;
|
||||
this.FinalizeOilOrderForm.check_number = response.data.check_number;
|
||||
this.FinalizeOilOrderForm.credit_card_id = response.data.payment_card_id;
|
||||
this.FinalizeOilOrderForm.cash_recieved = response.data.delivery.cash_recieved;
|
||||
this.FinalizeOilOrderForm.check_number = response.data.delivery.check_number;
|
||||
this.FinalizeOilOrderForm.credit_card_id = response.data.delivery.payment_card_id;
|
||||
|
||||
if (response.data.customer_filled == 1) {
|
||||
if (response.data.delivery.customer_filled == 1) {
|
||||
this.FinalizeOilOrderForm.customer_filled = true
|
||||
}
|
||||
|
||||
} else {
|
||||
console.error("API Error:", response.data.error || "Failed to fetch delivery data.");
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -698,4 +699,4 @@ export default defineComponent({
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
<style scoped></style>
|
||||
|
||||
@@ -397,13 +397,17 @@ export default defineComponent({
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.delivery = response.data;
|
||||
this.getCustomer(this.delivery.customer_id)
|
||||
this.getCreditCards(this.delivery.customer_id)
|
||||
if (this.delivery.promo_id != null) {
|
||||
this.getPromo(this.delivery.promo_id);
|
||||
this.promo_active = true;
|
||||
}
|
||||
if (response.data && response.data.ok) {
|
||||
this.delivery = response.data.delivery;
|
||||
this.getCustomer(this.delivery.customer_id)
|
||||
this.getCreditCards(this.delivery.customer_id)
|
||||
if (this.delivery.promo_id != null) {
|
||||
this.getPromo(this.delivery.promo_id);
|
||||
this.promo_active = true;
|
||||
}
|
||||
} else {
|
||||
console.error("API Error:", response.data.error || "Failed to fetch delivery data.");
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
notify({
|
||||
@@ -489,4 +493,4 @@ export default defineComponent({
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
<style scoped></style>
|
||||
|
||||
@@ -5,19 +5,19 @@ import Ticket from "../ticket/ticket.vue";
|
||||
import TicketAuto from "../ticket/ticketauto.vue";
|
||||
|
||||
|
||||
const payRoutes = [
|
||||
const ticketRoutes = [
|
||||
{
|
||||
path: '/ticket/:id',
|
||||
path: ':id',
|
||||
name: 'Ticket',
|
||||
component: Ticket,
|
||||
},
|
||||
{
|
||||
path: '/ticket/auto/:id',
|
||||
path: 'auto/:id',
|
||||
name: 'TicketAuto',
|
||||
component: TicketAuto,
|
||||
},
|
||||
|
||||
|
||||
]
|
||||
|
||||
export default payRoutes
|
||||
export default ticketRoutes
|
||||
//sourceMappingURL=index.ts.map
|
||||
|
||||
@@ -285,14 +285,17 @@ export default defineComponent({
|
||||
withCredentials: true,
|
||||
})
|
||||
.then((response: any) => {
|
||||
this.delivery = response.data;
|
||||
this.getCustomer(this.delivery.customer_id)
|
||||
if (this.delivery.promo_id != null) {
|
||||
this.getPromo(this.delivery.promo_id);
|
||||
this.promo_active = true;
|
||||
this.getPrice(delivery_id)
|
||||
if (response.data && response.data.ok) {
|
||||
this.delivery = response.data.delivery;
|
||||
this.getCustomer(this.delivery.customer_id)
|
||||
if (this.delivery.promo_id != null) {
|
||||
this.getPromo(this.delivery.promo_id);
|
||||
this.promo_active = true;
|
||||
this.getPrice(delivery_id)
|
||||
}
|
||||
} else {
|
||||
console.error("API Error:", response.data.error || "Failed to fetch delivery data.");
|
||||
}
|
||||
|
||||
})
|
||||
.catch(() => {
|
||||
notify({
|
||||
|
||||
@@ -17,6 +17,10 @@ import serviceRoutes from "../pages/service/routes.ts";
|
||||
import Home from '../pages/Index.vue';
|
||||
import Error404 from '../pages/error/Error404.vue';
|
||||
|
||||
// Import layouts
|
||||
import DefaultLayout from '../layouts/DefaultLayout.vue';
|
||||
import BlankLayout from '../layouts/BlankLayout.vue';
|
||||
|
||||
// Import the Pinia Stores
|
||||
import { useAuthStore } from '../stores/auth.ts';
|
||||
import { useCountsStore } from '../stores/counts.ts';
|
||||
@@ -33,30 +37,44 @@ const protectRoutes = (routes: any[]) => {
|
||||
};
|
||||
|
||||
const routes = [
|
||||
// ... routes are unchanged
|
||||
// Auth routes (no layout needed, they handle their own)
|
||||
...authRoutes,
|
||||
...protectRoutes(moneyRoutes),
|
||||
...protectRoutes(cardRoutes),
|
||||
...protectRoutes(payRoutes),
|
||||
...protectRoutes(employeeRoutes),
|
||||
...protectRoutes(customerRoutes),
|
||||
...protectRoutes(oilRoutes),
|
||||
...protectRoutes(autoRoutes),
|
||||
...protectRoutes(adminRoutes),
|
||||
...protectRoutes(tickerRoutes),
|
||||
...protectRoutes(serviceRoutes),
|
||||
|
||||
// Default layout routes
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: Home,
|
||||
meta: { requiresAuth: true }
|
||||
component: DefaultLayout,
|
||||
children: [
|
||||
...protectRoutes(moneyRoutes),
|
||||
...protectRoutes(cardRoutes),
|
||||
...protectRoutes(payRoutes),
|
||||
...protectRoutes(employeeRoutes),
|
||||
...protectRoutes(customerRoutes),
|
||||
...protectRoutes(oilRoutes),
|
||||
...protectRoutes(autoRoutes),
|
||||
...protectRoutes(adminRoutes),
|
||||
...protectRoutes(serviceRoutes),
|
||||
|
||||
{
|
||||
path: '',
|
||||
name: 'home',
|
||||
component: Home,
|
||||
meta: { requiresAuth: true }
|
||||
},
|
||||
{
|
||||
path: '/error404',
|
||||
name: 'Error404',
|
||||
component: Error404,
|
||||
meta: { requiresAuth: false }
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
// Blank layout for ticket pages
|
||||
{
|
||||
path: '/:catchAll(.*)*',
|
||||
name: 'Error404',
|
||||
component: Error404,
|
||||
meta: { requiresAuth: false }
|
||||
path: '/ticket',
|
||||
component: BlankLayout,
|
||||
children: protectRoutes(tickerRoutes)
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user