fix : bloque si bovin superieur a 52
This commit is contained in:
@@ -607,6 +607,15 @@ async function saveBovineEntry(entry: ReceptionBovineTypeData) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTotalBovines() {
|
||||||
|
const totalTypes = bovineEntries.value.reduce(
|
||||||
|
(sum, entry) => sum + (entry.quantity ?? 0),
|
||||||
|
0
|
||||||
|
)
|
||||||
|
return totalTypes +
|
||||||
|
(bovineOtherQuantity.value ?? 0)
|
||||||
|
}
|
||||||
|
|
||||||
async function syncBovineEntries() {
|
async function syncBovineEntries() {
|
||||||
if (!idReception) {
|
if (!idReception) {
|
||||||
return
|
return
|
||||||
@@ -765,9 +774,13 @@ async function validate() {
|
|||||||
})
|
})
|
||||||
await syncMerchandiseEntries()
|
await syncMerchandiseEntries()
|
||||||
} else {
|
} else {
|
||||||
await clearReceptionMerchandise(idReception)
|
if (getTotalBovines() > 52) {
|
||||||
await syncBovineEntries()
|
// toast/erreur UI
|
||||||
await updateReception(idReception, {
|
return
|
||||||
|
}
|
||||||
|
await clearReceptionMerchandise(idReception)
|
||||||
|
await syncBovineEntries()
|
||||||
|
await updateReception(idReception, {
|
||||||
bovineDetail: bovineOtherQuantity.value ? String(bovineOtherQuantity.value) : null
|
bovineDetail: bovineOtherQuantity.value ? String(bovineOtherQuantity.value) : null
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user