diff --git a/src/views/Home.vue b/src/views/Home.vue index 049a50f..21259e6 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -25,7 +25,7 @@ const productQuantity = ref(''); const productAlert = ref(false); const productStockLimit = ref(null); const registerErrors = ref({name:'',description:'',quantity:'',alert_enabled:'',stock_limit:'',}); - +const editingRows = ref([]); async function create_product() { registerErrors.value = {name:'',description:'',quantity:'',alert_enabled:'',stock_limit:'',}; if (productAlert.value && !productStockLimit.value) { @@ -68,14 +68,20 @@ async function create_product() { } } } -async function editProduct(product){ - console.log(product); +async function onRowEditSave(event) { + if (event && event.data) { + const editedRow = event.data; + console.log(editedRow); + } else { + console.error("Event or event.data is undefined."); + toast.add({ severity: 'error', life: 2500, summary: 'Error', detail: 'Aucune donnée n\'a été modifiée.' }); + } } const stockSeverity = (data) => { if (!data) return 'info'; const quantity = data.quantity; - + if (quantity <= 5) { return 'danger'; } else if (quantity > 5 && quantity <= 20) { @@ -151,11 +157,11 @@ try { {{ registerErrors.stock_limit }} - - + + @@ -166,18 +172,25 @@ try { - - + + + + + + + + + + - - - - + + + \ No newline at end of file