690329:1250 Fixing bugs uuid by Kimi K2.5 #04
This commit is contained in:
@@ -24,7 +24,7 @@ export default function TagsPage() {
|
||||
|
||||
const columns: ColumnDef<Tag>[] = [
|
||||
{
|
||||
accessorKey: 'project_id',
|
||||
accessorKey: 'projectId',
|
||||
header: 'Project',
|
||||
cell: ({ row }) => {
|
||||
const item = row.original as Tag & { project?: { id?: number | string; publicId?: string; projectName?: string; projectCode?: string } };
|
||||
@@ -34,7 +34,7 @@ export default function TagsPage() {
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: 'tag_name',
|
||||
accessorKey: 'tagName',
|
||||
header: 'Tag Name',
|
||||
cell: ({ row }) => {
|
||||
const color = String(row.original.colorCode || 'default');
|
||||
@@ -58,9 +58,9 @@ export default function TagsPage() {
|
||||
|
||||
const formatPayload = (data: Record<string, unknown>) => {
|
||||
const payload = { ...data };
|
||||
// ADR-019: project_id is now a UUID string or '__none__' for global
|
||||
if (!payload.project_id || payload.project_id === '__none__') {
|
||||
payload.project_id = null;
|
||||
// ADR-019: projectId is now a UUID string or '__none__' for global
|
||||
if (!payload.projectId || payload.projectId === '__none__') {
|
||||
payload.projectId = null;
|
||||
}
|
||||
return payload;
|
||||
};
|
||||
@@ -73,12 +73,12 @@ export default function TagsPage() {
|
||||
queryKey={['tags']}
|
||||
fetchFn={async () => {
|
||||
const items = await masterDataService.getTags();
|
||||
// ADR-019: Map project_id INT → project UUID for edit mode select matching
|
||||
// ADR-019: Map projectId INT → project UUID for edit mode select matching
|
||||
return items.map((item) => {
|
||||
const rec = item as Tag & { project?: { id?: number | string; publicId?: string }; project_id?: number | string };
|
||||
const rec = item as Tag & { project?: { id?: number | string; publicId?: string }; projectId?: number | string };
|
||||
return {
|
||||
...item,
|
||||
project_id: rec.project?.publicId || rec.project?.id || (rec.project_id ? String(rec.project_id) : null),
|
||||
projectId: rec.project?.publicId || rec.project?.id || (rec.projectId ? String(rec.projectId) : null),
|
||||
} as Tag;
|
||||
});
|
||||
}}
|
||||
@@ -90,7 +90,7 @@ export default function TagsPage() {
|
||||
columns={columns}
|
||||
fields={[
|
||||
{
|
||||
name: 'project_id',
|
||||
name: 'projectId',
|
||||
label: 'Project Scope',
|
||||
type: 'select',
|
||||
options: projectOptions,
|
||||
|
||||
@@ -439,81 +439,6 @@ export function CorrespondenceForm({ initialData, uuid }: { initialData?: Initia
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Subject */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="subject">Subject *</Label>
|
||||
<Input id="subject" {...register('subject')} placeholder="Enter subject" />
|
||||
{errors.subject && <p className="text-sm text-destructive">{errors.subject.message}</p>}
|
||||
</div>
|
||||
|
||||
{/* Body */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="body">Body (Content)</Label>
|
||||
<Textarea id="body" {...register('body')} rows={6} placeholder="Enter letter content..." />
|
||||
</div>
|
||||
|
||||
{/* Date Fields */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="documentDate">Document Date</Label>
|
||||
<Input
|
||||
id="documentDate"
|
||||
type="date"
|
||||
{...register('documentDate')}
|
||||
onChange={(e) => {
|
||||
const val = e.target.value;
|
||||
setValue('documentDate', val, { shouldValidate: true, shouldDirty: true });
|
||||
if (val) {
|
||||
setValue('issuedDate', val, { shouldValidate: true, shouldDirty: true });
|
||||
setValue('receivedDate', val, { shouldValidate: true, shouldDirty: true });
|
||||
const d = new Date(val);
|
||||
d.setDate(d.getDate() + 7);
|
||||
setValue('dueDate', d.toISOString().split('T')[0], { shouldValidate: true, shouldDirty: true });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="issuedDate">Issued Date</Label>
|
||||
<Input id="issuedDate" type="date" {...register('issuedDate')} />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="receivedDate">Received Date</Label>
|
||||
<Input
|
||||
id="receivedDate"
|
||||
type="date"
|
||||
{...register('receivedDate')}
|
||||
onChange={(e) => {
|
||||
const val = e.target.value;
|
||||
setValue('receivedDate', val, { shouldValidate: true, shouldDirty: true });
|
||||
if (val) {
|
||||
const d = new Date(val);
|
||||
d.setDate(d.getDate() + 7);
|
||||
setValue('dueDate', d.toISOString().split('T')[0], { shouldValidate: true, shouldDirty: true });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="dueDate">Due Date</Label>
|
||||
<Input id="dueDate" type="date" {...register('dueDate')} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Remarks */}
|
||||
<div className="grid grid-cols-1 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="remarks">Remarks</Label>
|
||||
<Input id="remarks" {...register('remarks')} placeholder="Optional remarks" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Description */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="description">Description (Internal Note)</Label>
|
||||
<Textarea id="description" {...register('description')} rows={2} placeholder="Enter description..." />
|
||||
</div>
|
||||
|
||||
{/* Organizations */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div className="space-y-2">
|
||||
@@ -589,6 +514,81 @@ export function CorrespondenceForm({ initialData, uuid }: { initialData?: Initia
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Subject */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="subject">Subject *</Label>
|
||||
<Input id="subject" {...register('subject')} placeholder="Enter subject" />
|
||||
{errors.subject && <p className="text-sm text-destructive">{errors.subject.message}</p>}
|
||||
</div>
|
||||
|
||||
{/* Body */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="body">Body (Content)</Label>
|
||||
<Textarea id="body" {...register('body')} rows={6} placeholder="Enter letter content..." />
|
||||
</div>
|
||||
|
||||
{/* Date Fields */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="documentDate">Document Date</Label>
|
||||
<Input
|
||||
id="documentDate"
|
||||
type="date"
|
||||
{...register('documentDate')}
|
||||
onChange={(e) => {
|
||||
const val = e.target.value;
|
||||
setValue('documentDate', val, { shouldValidate: true, shouldDirty: true });
|
||||
if (val) {
|
||||
setValue('issuedDate', val, { shouldValidate: true, shouldDirty: true });
|
||||
setValue('receivedDate', val, { shouldValidate: true, shouldDirty: true });
|
||||
const d = new Date(val);
|
||||
d.setDate(d.getDate() + 7);
|
||||
setValue('dueDate', d.toISOString().split('T')[0], { shouldValidate: true, shouldDirty: true });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="issuedDate">Issued Date</Label>
|
||||
<Input id="issuedDate" type="date" {...register('issuedDate')} />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="receivedDate">Received Date</Label>
|
||||
<Input
|
||||
id="receivedDate"
|
||||
type="date"
|
||||
{...register('receivedDate')}
|
||||
onChange={(e) => {
|
||||
const val = e.target.value;
|
||||
setValue('receivedDate', val, { shouldValidate: true, shouldDirty: true });
|
||||
if (val) {
|
||||
const d = new Date(val);
|
||||
d.setDate(d.getDate() + 7);
|
||||
setValue('dueDate', d.toISOString().split('T')[0], { shouldValidate: true, shouldDirty: true });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="dueDate">Due Date</Label>
|
||||
<Input id="dueDate" type="date" {...register('dueDate')} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Remarks */}
|
||||
<div className="grid grid-cols-1 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="remarks">Remarks</Label>
|
||||
<Input id="remarks" {...register('remarks')} placeholder="Optional remarks" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Description */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="description">Description (Internal Note)</Label>
|
||||
<Textarea id="description" {...register('description')} rows={2} placeholder="Enter description..." />
|
||||
</div>
|
||||
|
||||
{/* Importance */}
|
||||
<div className="space-y-2">
|
||||
<Label>Importance</Label>
|
||||
|
||||
@@ -345,28 +345,7 @@ export function RFAForm() {
|
||||
<h3 className="text-lg font-semibold mb-4">RFA Information</h3>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<Label htmlFor="subject">Subject *</Label>
|
||||
<Input id="subject" {...register('subject')} placeholder="Enter subject" />
|
||||
{errors.subject && <p className="text-sm text-destructive mt-1">{errors.subject.message}</p>}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="body">Body (Content)</Label>
|
||||
<Textarea id="body" {...register('body')} rows={4} placeholder="Enter content..." />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="remarks">Remarks</Label>
|
||||
<Input id="remarks" {...register('remarks')} placeholder="Optional remarks" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="description">Description</Label>
|
||||
<Input id="description" {...register('description')} placeholder="Enter key description" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<Label>Project *</Label>
|
||||
<Select
|
||||
value={selectedProjectId || undefined}
|
||||
@@ -540,6 +519,28 @@ export function RFAForm() {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<Label htmlFor="subject">Subject *</Label>
|
||||
<Input id="subject" {...register('subject')} placeholder="Enter subject" />
|
||||
{errors.subject && <p className="text-sm text-destructive mt-1">{errors.subject.message}</p>}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="body">Body (Content)</Label>
|
||||
<Textarea id="body" {...register('body')} rows={4} placeholder="Enter content..." />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="remarks">Remarks</Label>
|
||||
<Input id="remarks" {...register('remarks')} placeholder="Optional remarks" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label htmlFor="description">Description</Label>
|
||||
<Input id="description" {...register('description')} placeholder="Enter key description" />
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user