fix: update fixing task ta

This commit is contained in:
hanif salafi 2025-12-02 10:38:33 +07:00
parent ccc1fb3336
commit cacaaefb3b
4 changed files with 41 additions and 46 deletions

View File

@ -1454,6 +1454,24 @@ export default function FormTaskTaDetail() {
)} )}
{isRecording && <p>Recording... {timer} seconds remaining</p>}{" "} {isRecording && <p>Recording... {timer} seconds remaining</p>}{" "}
{/* Display remaining time */} {/* Display remaining time */}
<div className="mt-4">
<Label>Link Url</Label>
{urlInputs.map((url: any, index: any) => (
<Link
key={index}
href={url}
target="_blank"
className="flex items-center gap-2 mt-2"
>
<input
type="url"
className="border rounded p-2 w-full cursor-pointer"
value={url}
placeholder={`Masukkan link berita ${index + 1}`}
/>
</Link>
))}
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -588,7 +588,9 @@ export default function FormTaskTaEdit() {
narration: data.naration, narration: data.naration,
expertCompetencies: Array.from(selectedCompetencies).join(","), expertCompetencies: Array.from(selectedCompetencies).join(","),
title: data.title, title: data.title,
attachmentUrl: links, attachmentUrl: urlInputs
.map((url: any) => url.attachmentUrl || "")
.filter((url: string) => url.trim() !== ""),
}; };
const response = await createTaskTa(requestData); const response = await createTaskTa(requestData);
@ -802,7 +804,7 @@ export default function FormTaskTaEdit() {
isAudioUploadFinish && isAudioUploadFinish &&
isTextUploadFinish isTextUploadFinish
) { ) {
successSubmit("/in/contributor/task"); successSubmit("/in/contributor/task-ta");
} }
} }
@ -841,9 +843,11 @@ export default function FormTaskTaEdit() {
}; };
const handleLinkChange = (index: number, value: string) => { const handleLinkChange = (index: number, value: string) => {
const updatedLinks = [...links]; setUrlInputs((prev: any) =>
updatedLinks[index] = value; prev.map((url: any, idx: any) =>
setLinks(updatedLinks); idx === index ? { ...url, attachmentUrl: value } : url
)
);
}; };
const handleAddLink = () => { const handleAddLink = () => {
@ -1188,7 +1192,9 @@ export default function FormTaskTaEdit() {
{isRecording && <p>Recording... {timer} seconds remaining</p>}{" "} {isRecording && <p>Recording... {timer} seconds remaining</p>}{" "}
{/* Display remaining time */} {/* Display remaining time */}
<div className="mt-4 space-y-2"> <div className="mt-4 space-y-2">
<h2 className="text-lg font-bold">{t("news-links", { defaultValue: "News Links" })}</h2> <h2 className="text-lg font-bold">
{t("news-links", { defaultValue: "News Links" })}
</h2>
{urlInputs.map((url: any, index: any) => ( {urlInputs.map((url: any, index: any) => (
<div <div
key={url.id} key={url.id}
@ -1205,42 +1211,13 @@ export default function FormTaskTaEdit() {
/> />
</div> </div>
))} ))}
<div className="mt-4 space-y-2">
<Label className="">{t("news-links", { defaultValue: "News Links" })}</Label>
{links.map((link, index) => (
<div
key={index}
className="flex items-center gap-2 mt-2"
>
<Input
type="url"
className="border rounded p-2 w-full"
placeholder={`Masukkan link berita ${index + 1}`}
value={link}
onChange={(e) =>
handleLinkChange(index, e.target.value)
}
/>
{links.length > 1 && (
<button <button
type="button" type="button"
className="bg-red-500 text-white px-3 py-1 rounded" className="mt-4 bg-green-500 text-white px-4 py-2 rounded"
onClick={() => handleRemoveRow(index)} onClick={handleAddLink}
>
<Trash2 className="h-4 w-4" />
</button>
)}
</div>
))}
<Button
type="button"
className="mt-2 bg-blue-500 text-white px-4 py-2 rounded"
onClick={handleAddRow}
size="sm"
> >
{t("add-links", { defaultValue: "Add Links" })} {t("add-links", { defaultValue: "Add Links" })}
</Button> </button>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -269,7 +269,7 @@ export default function FormTaskTa() {
narration: string; narration: string;
assignmentType: string; assignmentType: string;
expertCompetencies: string; expertCompetencies: string;
// attachmentUrl: string[]; attachmentUrl: string[];
} = { } = {
...data, ...data,
assignedToUsers: handleExpertChange(), assignedToUsers: handleExpertChange(),
@ -278,7 +278,7 @@ export default function FormTaskTa() {
narration: data.narration, narration: data.narration,
expertCompetencies: Array.from(selectedCompetencies).join(","), expertCompetencies: Array.from(selectedCompetencies).join(","),
title: data.title, title: data.title,
// attachmentUrl: links, attachmentUrl: links,
}; };
const response = await createTaskTa(requestData); const response = await createTaskTa(requestData);

View File

@ -331,10 +331,10 @@ export default function FormTaskTaNew() {
htmlDescription: finalDescription, htmlDescription: finalDescription,
fileTypeId: fileTypeId, fileTypeId: fileTypeId,
categoryId: "235", categoryId: "235",
subCategoryId: selectedCategory, subCategoryId: "171",
uploadedBy: "2b7c8d83-d298-4b19-9f74-b07924506b58", uploadedBy: "2b7c8d83-d298-4b19-9f74-b07924506b58",
statusId: "1", statusId: "1",
publishedFor: publishedFor.join(","), publishedFor: "7",
creatorName: "Penugasan-Ta", creatorName: "Penugasan-Ta",
tags: "penugasan-Ta", tags: "penugasan-Ta",
isYoutube: false, isYoutube: false,