Some changes

This commit is contained in:
2024-07-01 17:29:57 +02:00
parent 15271a873b
commit 673eb10b7b
7 changed files with 53 additions and 11 deletions

View File

@@ -11,6 +11,7 @@ const searchOrderDate = ref<Date>();
const isOutOfBuffer = ref<boolean>(false);
const isInBufor = ref<boolean>(false);
const { orders } = storeToRefs(ordersStore);
const areOrdersLoading = ref<boolean>(false);
watch(isInBufor, (val) => {
if(val && val == isOutOfBuffer.value) {
@@ -34,11 +35,13 @@ function viewOrder(uuid : string) {
async function fetchOrders(event : Event) {
event.preventDefault();
areOrdersLoading.value = true;
if(isInBufor.value) {
orders.value = await ordersStore.fetchOrdersInBuffer();
} else if (isOutOfBuffer.value) {
orders.value = await ordersStore.fetchOrdersOutOfBuffer();
}
areOrdersLoading.value = false;
}
</script>
@@ -70,7 +73,7 @@ async function fetchOrders(event : Event) {
</label>
</div>
</div>
<button class="button is-primary is-small is-expanded" @click="fetchOrders">Pobierz zamówienia</button>
<button class="button is-primary is-small is-expanded" @click="fetchOrders" :class="{ 'is-loading': areOrdersLoading }">Pobierz zamówienia</button>
</div>
</form>
<div class="box">