diff --git a/src/pages/Zone/Card/ZoneWarehouses.vue b/src/pages/Zone/Card/ZoneWarehouses.vue
index 461b54b8a..87b7ef93e 100644
--- a/src/pages/Zone/Card/ZoneWarehouses.vue
+++ b/src/pages/Zone/Card/ZoneWarehouses.vue
@@ -17,12 +17,11 @@ const { openConfirmationModal } = useVnConfirm();
const paginateRef = ref(null);
const createWarehouseDialogRef = ref(null);
-const arrayData = useArrayData('ZoneWarehouses', {
- url: `Zones/${route.params.id}/warehouses`,
- filter: { include: 'warehouse' },
-});
+const arrayData = useArrayData('ZoneWarehouses');
const store = arrayData.store;
+const data = computed(() => store.data);
+
const urlPath = computed(() => `Zones/${route.params.id}/warehouses`);
const columns = computed(() => [
@@ -34,17 +33,23 @@ const columns = computed(() => [
},
]);
-const deleteWarehouse = async (row, rows, rowIndex) => {
+const deleteWarehouse = async (row) => {
try {
await axios.delete(`${urlPath.value}/${row.id}`);
- if (rowIndex || rowIndex === 0) rows.splice(rowIndex, 1);
+ fetchWarehouses();
} catch (error) {
console.error(error);
}
};
-const openCreateWarehouseForm = () => {
- createWarehouseDialogRef.value.show();
+const createZoneWarehouse = async (ZoneWarehouseFormData) => {
+ console.log(ZoneWarehouseFormData);
+ try {
+ await axios.post(urlPath.value, ZoneWarehouseFormData);
+ fetchWarehouses();
+ } catch (error) {
+ console.error(error);
+ }
};
watch(
@@ -57,6 +62,8 @@ watch(
);
const fetchWarehouses = () => paginateRef.value.fetch();
+
+const openCreateWarehouseForm = () => createWarehouseDialogRef.value.show();
@@ -70,7 +77,7 @@ const fetchWarehouses = () => paginateRef.value.fetch();
auto-load
>
-
+
@@ -101,12 +108,12 @@ const fetchWarehouses = () => paginateRef.value.fetch();
+
+
+
{{ t('warehouses.add') }}
-
-
-