feat: reimport pdf
This commit is contained in:
@@ -327,13 +327,32 @@ function updateOperationsGroup(categorie, updatedGroupOperations) {
|
||||
if (!updated.data) updated.data = {}
|
||||
if (!updated.data.recapitulatif_operations) updated.data.recapitulatif_operations = []
|
||||
|
||||
// Reconstruire la liste complete des operations
|
||||
// 1. Filtrer toutes les operations de cette categorie
|
||||
const otherOperations = updated.data.recapitulatif_operations.filter(op => op.categorie !== categorie)
|
||||
// Reconstruire la liste en preservant l'ordre original
|
||||
const newOperations = []
|
||||
let updatedIndex = 0
|
||||
|
||||
// 2. Combiner avec les operations mises a jour
|
||||
updated.data.recapitulatif_operations = [...otherOperations, ...updatedGroupOperations]
|
||||
// Parcourir les operations originales et remplacer celles de la categorie modifiee
|
||||
for (const op of updated.data.recapitulatif_operations) {
|
||||
if (op.categorie === categorie) {
|
||||
// Remplacer par les operations mises a jour (dans l'ordre)
|
||||
if (updatedIndex < updatedGroupOperations.length) {
|
||||
newOperations.push(updatedGroupOperations[updatedIndex])
|
||||
updatedIndex++
|
||||
}
|
||||
// Si on a supprime des operations, on ne les ajoute pas
|
||||
} else {
|
||||
// Garder les operations des autres categories telles quelles
|
||||
newOperations.push(op)
|
||||
}
|
||||
}
|
||||
|
||||
// Ajouter les nouvelles operations si on en a ajoute
|
||||
while (updatedIndex < updatedGroupOperations.length) {
|
||||
newOperations.push(updatedGroupOperations[updatedIndex])
|
||||
updatedIndex++
|
||||
}
|
||||
|
||||
updated.data.recapitulatif_operations = newOperations
|
||||
emit('update:data', updated)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user