refactor: modal for updating vehicles; global & modal styles changes

This commit is contained in:
2025-11-27 02:48:06 +01:00
parent 3698552e28
commit f29678a811
9 changed files with 481 additions and 262 deletions
@@ -183,28 +183,28 @@ function sortTableBy(id: string) {
activeSortKey.value = id;
}
// async function editRowPrimitive(row: IVehicleGroupTableRow, editKey: VehicleGroupEditRowKey) {
// if (!(editKey in row.vehicleGroupRef)) return;
async function editRowPrimitive(row: IVehicleGroupTableRow, editKey: VehicleGroupEditRowKey) {
if (!(editKey in row.vehicleGroupRef)) return;
// let rowValue = row.vehicleGroupRef[editKey];
let rowValue = row.vehicleGroupRef[editKey];
// if (typeof rowValue === 'string' || typeof rowValue === 'undefined' || rowValue == null) {
// const promptValue = prompt('Zmień wartość:', rowValue ?? '');
// if (promptValue == null) return;
if (typeof rowValue === 'string' || typeof rowValue === 'undefined' || rowValue == null) {
const promptValue = prompt('Zmień wartość:', rowValue ?? '');
if (promptValue == null) return;
// const updatedData = await vehiclesStore.updateVehicle(row.vehicleGroupRef.id, editKey, promptValue);
const updatedData = await vehiclesStore.updateVehicleGroup(row.vehicleGroupRef.id, editKey, promptValue);
// if (updatedData) {
// (row.vehicleGroupRef[editKey] as any) = updatedData[editKey];
// }
// } else if (typeof rowValue == 'boolean') {
// const updatedData = await vehiclesStore.updateVehicle(row.vehicleGroupRef.id, editKey, !rowValue);
if (updatedData) {
(row.vehicleGroupRef[editKey] as any) = updatedData[editKey];
}
} else if (typeof rowValue == 'boolean') {
const updatedData = await vehiclesStore.updateVehicleGroup(row.vehicleGroupRef.id, editKey, !rowValue);
// if (updatedData) {
// (row.vehicleGroupRef[editKey] as any) = updatedData[editKey];
// }
// }
// }
if (updatedData) {
(row.vehicleGroupRef[editKey] as any) = updatedData[editKey];
}
}
}
async function addVehicleGroupRow() {
const data = await vehiclesStore.createVehicleGroup({