From dce8e294c52a6b695919af1defc8238ad8a71fd0 Mon Sep 17 00:00:00 2001 From: patrykb Date: Thu, 27 Jun 2024 13:05:14 +0200 Subject: [PATCH] New order button --- index.html | 2 +- src/components/NavBar.vue | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index a888544..051bf80 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Vite App + Mleczarnia Kuzma
diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index 82c4a1f..ffcd469 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -2,10 +2,18 @@ import { ref } from 'vue' import { useSiteControlStore } from '@/stores/siteControl.store' import { router } from '@/router/router' +import { useOrdersStore } from '@/stores/orders.store' +import { useContractorsStore } from '@/stores/contractors.store' +import { useCategoriesStore } from '@/stores/categories.store' +import { storeToRefs } from 'pinia' const activator = ref(false); const siteControlStore = useSiteControlStore(); +const ordersStore = useOrdersStore(); +const contractorsStore = useContractorsStore(); +const categoriesStore = useCategoriesStore(); + function makeBurger() { activator.value = !activator.value @@ -29,6 +37,19 @@ function clickOrders() { function routeLogin() { router.push("/login"); } + +function newOrder() { + const {order, uuid, deliveryDate, orderDate } = storeToRefs(ordersStore); + const { contractor } = storeToRefs(contractorsStore); + contractor.value = undefined; + order.value = undefined; + uuid.value = undefined; + deliveryDate.value = undefined; + orderDate.value = undefined; + categoriesStore.fetchCategories(); + siteControlStore.switchToFrom(); + window.scrollTo(0, 0); +}