fix: correctly pass client.id when creating target in ClientTargetPanel
The ClientTargetPanel component now properly uses the client prop to access client.id when creating a new target, instead of trying to access target?.clientId which would be undefined during creation. This ensures new targets are properly associated with the correct client.
This commit is contained in:
@@ -66,6 +66,7 @@ const WEEKDAY_FULL_NAMES = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Frida
|
|||||||
|
|
||||||
// Inline target panel shown inside each client card
|
// Inline target panel shown inside each client card
|
||||||
function ClientTargetPanel({
|
function ClientTargetPanel({
|
||||||
|
client,
|
||||||
target,
|
target,
|
||||||
onCreated,
|
onCreated,
|
||||||
onDeleted,
|
onDeleted,
|
||||||
@@ -159,7 +160,7 @@ function ClientTargetPanel({
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await onCreated({
|
await onCreated({
|
||||||
clientId: target?.clientId || '',
|
clientId: client.id,
|
||||||
periodType: formPeriodType,
|
periodType: formPeriodType,
|
||||||
targetHours: hours,
|
targetHours: hours,
|
||||||
startDate: formStartDate,
|
startDate: formStartDate,
|
||||||
|
|||||||
Reference in New Issue
Block a user