change container using label

This commit is contained in:
faiztyanirh 2026-04-16 14:08:33 +07:00
parent 7f052986b3
commit 32c20ccd16
3 changed files with 20 additions and 13 deletions

View File

@ -117,16 +117,16 @@
tempMap,
});
console.log(payload)
const result = await formState.save(masterDetail.mode, payload);
// const result = await formState.save(masterDetail.mode, payload);
if (result.status === 'success') {
toast('Test Map Created!');
masterDetail?.exitForm(true);
} else {
console.error('Failed to save test map');
const errorMessages = result.messages ? Object.values(result.messages).join('\n') : 'Failed to save test map';
toast.error(errorMessages)
}
// if (result.status === 'success') {
// toast('Test Map Created!');
// masterDetail?.exitForm(true);
// } else {
// console.error('Failed to save test map');
// const errorMessages = result.messages ? Object.values(result.messages).join('\n') : 'Failed to save test map';
// toast.error(errorMessages)
// }
}
const primaryAction = $derived({
@ -262,6 +262,12 @@
}))
})
function getLabel(fieldKey, value) {
const opts = testMapDetailFormState.selectOptions[fieldKey] ?? [];
const found = opts.find((o) => o.value == value);
return found ? found.rawItem.ConName : value;
}
onMount(() => {
masterDetail.registerExtraState({
key: 'tempMap',
@ -269,7 +275,7 @@
reset: () => { tempMap = []; idCounter = 0; editingId = null; },
});
});
$inspect(testMapDetailFormState.errors)
$inspect(testMapDetailFormState.selectOptions)
</script>
<FormPageContainer title="Create Test Map" {primaryAction} {secondaryActions} {actions}>
@ -331,7 +337,7 @@
<Table.Cell>{row.HostTestName}</Table.Cell>
<Table.Cell>{row.ClientTestCode}</Table.Cell>
<Table.Cell>{row.ClientTestName}</Table.Cell>
<Table.Cell>{row.ConDefID}</Table.Cell>
<Table.Cell>{row.ConDefID ? getLabel('ConDefID', row.ConDefID) : '-'}</Table.Cell>
<Table.Cell>
<div class="flex gap-1">
<Tooltip.Provider>

View File

@ -379,6 +379,7 @@
reset: () => { tempMap = []; idCounter = 0; editingId = null; },
});
});
$inspect(tempMap)
</script>
<FormPageContainer title="Edit Test Map" {primaryAction} {secondaryActions}>
@ -438,7 +439,7 @@
<Table.Cell>{row.HostTestName}</Table.Cell>
<Table.Cell>{row.ClientTestCode}</Table.Cell>
<Table.Cell>{row.ClientTestName}</Table.Cell>
<Table.Cell>{row.ConDefID}</Table.Cell>
<Table.Cell>{row.ContainerLabel}</Table.Cell>
<Table.Cell>
<div class="flex gap-1">
<Tooltip.Provider>

View File

@ -61,7 +61,7 @@
<Table.Cell>{row.HostTestName ?? '-'}</Table.Cell>
<Table.Cell>{row.ClientTestCode ?? '-'}</Table.Cell>
<Table.Cell>{row.ClientTestName ?? '-'}</Table.Cell>
<Table.Cell>{row.ConDefID ?? '-'}</Table.Cell>
<Table.Cell>{row.ContainerLabel ?? '-'}</Table.Cell>
</Table.Row>
{/each}
</Table.Body>