feat:pull
This commit is contained in:
parent
e514cee3b0
commit
8bff567d55
|
|
@ -499,94 +499,92 @@ export default function FormConvertSPIT() {
|
|||
</Label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div className="py-3">
|
||||
<Label>Deskripsi</Label>
|
||||
<Controller
|
||||
control={control}
|
||||
name="contentDescription"
|
||||
render={({ field: { onChange, value } }) => (
|
||||
// <JoditEditor
|
||||
// ref={editor}
|
||||
// value={detail?.contentDescription}
|
||||
// onChange={onChange}
|
||||
// className="dark:text-black"
|
||||
// />
|
||||
<CustomEditor
|
||||
onChange={onChange}
|
||||
initialData={detail?.contentDescription}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
{errors.contentDescription?.message && (
|
||||
<p className="text-red-400 text-sm">
|
||||
{errors.contentDescription.message}
|
||||
</p>
|
||||
<div className="py-3">
|
||||
<Label>Deskripsi</Label>
|
||||
<Controller
|
||||
control={control}
|
||||
name="contentDescription"
|
||||
render={({ field: { onChange, value } }) => (
|
||||
// <JoditEditor
|
||||
// ref={editor}
|
||||
// value={detail?.contentDescription}
|
||||
// onChange={onChange}
|
||||
// className="dark:text-black"
|
||||
// />
|
||||
<CustomEditor
|
||||
onChange={onChange}
|
||||
initialData={detail?.contentDescription}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className="my-2">
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={handleRewriteClick}
|
||||
className="bg-blue-500 text-white py-2 px-4 rounded"
|
||||
>
|
||||
Content Rewrite
|
||||
</Button>
|
||||
</div>
|
||||
{showRewriteEditor && (
|
||||
<div>
|
||||
{isGeneratedArticle && (
|
||||
<div className="mt-3 pb-0 flex flex-row ">
|
||||
{articleIds.map((id: string, index: number) => (
|
||||
<button
|
||||
key={index}
|
||||
className={`mr-3 px-3 py-2 rounded-md ${
|
||||
selectedArticleId === id
|
||||
? "bg-green-500 text-white"
|
||||
: "border-2 border-green-500 text-green-500"
|
||||
}`}
|
||||
onClick={() => handleArticleIdClick(id)}
|
||||
>
|
||||
{id}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-center space-x-2 mt-3">
|
||||
<RadioGroupItem value="rewrite" id="rewrite-file" />
|
||||
<Label htmlFor="rewrite-file">
|
||||
Select File Hasil Rewrite
|
||||
</Label>
|
||||
</div>
|
||||
<div className="py-3">
|
||||
<Label>File hasil Rewrite</Label>
|
||||
<Controller
|
||||
control={control}
|
||||
name="contentRewriteDescription"
|
||||
render={({ field: { onChange, value } }) =>
|
||||
isLoadingData ? (
|
||||
<div className="flex justify-center items-center h-40">
|
||||
<p className="text-gray-500">
|
||||
Loading Proses Data...
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<CustomEditor
|
||||
onChange={onChange}
|
||||
initialData={articleBody || value}
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
{errors.contentRewriteDescription?.message && (
|
||||
<p className="text-red-400 text-sm">
|
||||
{errors.contentRewriteDescription.message}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
/>
|
||||
{errors.contentDescription?.message && (
|
||||
<p className="text-red-400 text-sm">
|
||||
{errors.contentDescription.message}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="my-2">
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={handleRewriteClick}
|
||||
className="bg-blue-500 text-white py-2 px-4 rounded"
|
||||
>
|
||||
Content Rewrite
|
||||
</Button>
|
||||
</div>
|
||||
{showRewriteEditor && (
|
||||
<div>
|
||||
{isGeneratedArticle && (
|
||||
<div className="mt-3 pb-0 flex flex-row ">
|
||||
{articleIds.map((id: string, index: number) => (
|
||||
<button
|
||||
key={index}
|
||||
className={`mr-3 px-3 py-2 rounded-md ${
|
||||
selectedArticleId === id
|
||||
? "bg-green-500 text-white"
|
||||
: "border-2 border-green-500 text-green-500"
|
||||
}`}
|
||||
onClick={() => handleArticleIdClick(id)}
|
||||
>
|
||||
{id}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<div className="flex items-center space-x-2 mt-3">
|
||||
<RadioGroupItem value="rewrite" id="rewrite-file" />
|
||||
<Label htmlFor="rewrite-file">
|
||||
Select File Hasil Rewrite
|
||||
</Label>
|
||||
</div>
|
||||
<div className="py-3">
|
||||
<Label>File hasil Rewrite</Label>
|
||||
<Controller
|
||||
control={control}
|
||||
name="contentRewriteDescription"
|
||||
render={({ field: { onChange, value } }) =>
|
||||
isLoadingData ? (
|
||||
<div className="flex justify-center items-center h-40">
|
||||
<p className="text-gray-500">
|
||||
Loading Proses Data...
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<CustomEditor
|
||||
onChange={onChange}
|
||||
initialData={articleBody || value}
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
{errors.contentRewriteDescription?.message && (
|
||||
<p className="text-red-400 text-sm">
|
||||
{errors.contentRewriteDescription.message}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</RadioGroup>
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -150,7 +150,24 @@ export default function FormVideo() {
|
|||
|
||||
const { getRootProps, getInputProps } = useDropzone({
|
||||
onDrop: (acceptedFiles) => {
|
||||
setFiles(acceptedFiles.map((file) => Object.assign(file)));
|
||||
const validFiles = acceptedFiles.filter((file) => {
|
||||
const isValidType = ["video/mp4", "video/mov"].includes(file.type);
|
||||
const isValidSize = file.size <= 100 * 1024 * 1024; // 100MB
|
||||
return isValidType && isValidSize;
|
||||
});
|
||||
|
||||
if (!validFiles.length) {
|
||||
alert("Format file harus mp4/mov dan ukuran maksimal 100MB");
|
||||
return;
|
||||
}
|
||||
|
||||
setFiles(
|
||||
validFiles.map((file) =>
|
||||
Object.assign(file, {
|
||||
preview: URL.createObjectURL(file),
|
||||
})
|
||||
)
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -1024,10 +1041,10 @@ export default function FormVideo() {
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-3 py-3">
|
||||
{/* <div className="px-3 py-3">
|
||||
<Label htmlFor="fileInput">Gambar Utama</Label>
|
||||
<Input id="fileInput" type="file" onChange={handleImageChange} />
|
||||
</div>
|
||||
</div> */}
|
||||
{preview && (
|
||||
<div className="mt-3 px-3">
|
||||
<img
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ import {
|
|||
DialogTrigger,
|
||||
} from "@/components/ui/dialog";
|
||||
import { ChevronDown, ChevronUp } from "lucide-react";
|
||||
import dynamic from "next/dynamic";
|
||||
import { Link } from "@/components/navigation";
|
||||
|
||||
const taskSchema = z.object({
|
||||
uniqueCode: z.string().min(1, { message: "Judul diperlukan" }),
|
||||
|
|
@ -63,6 +65,13 @@ export type taskDetail = {
|
|||
is_active: string;
|
||||
};
|
||||
|
||||
const ViewEditor = dynamic(
|
||||
() => {
|
||||
return import("@/components/editor/view-editor");
|
||||
},
|
||||
{ ssr: false }
|
||||
);
|
||||
|
||||
export default function FormTaskDetail() {
|
||||
const MySwal = withReactContent(Swal);
|
||||
const router = useRouter();
|
||||
|
|
@ -342,6 +351,7 @@ export default function FormTaskDetail() {
|
|||
<div className="flex items-center gap-2" key={key}>
|
||||
<Checkbox
|
||||
id={key}
|
||||
disabled
|
||||
checked={
|
||||
unitSelection[key as keyof typeof unitSelection]
|
||||
}
|
||||
|
|
@ -373,6 +383,7 @@ export default function FormTaskDetail() {
|
|||
<div key={polda.id} className="border p-2">
|
||||
<Label className="flex items-center">
|
||||
<Checkbox
|
||||
disabled
|
||||
checked={checkedLevels.has(polda.id)}
|
||||
onCheckedChange={() =>
|
||||
handleCheckboxChange(polda.id)
|
||||
|
|
@ -395,6 +406,7 @@ export default function FormTaskDetail() {
|
|||
<div className="ml-6 mt-2">
|
||||
<Label className="block">
|
||||
<Checkbox
|
||||
disabled
|
||||
checked={polda?.subDestination?.every(
|
||||
(polres: any) =>
|
||||
checkedLevels.has(polres.id)
|
||||
|
|
@ -421,6 +433,7 @@ export default function FormTaskDetail() {
|
|||
{polda?.subDestination?.map((polres: any) => (
|
||||
<Label key={polres.id} className="block mt-1">
|
||||
<Checkbox
|
||||
disabled
|
||||
checked={checkedLevels.has(polres.id)}
|
||||
onCheckedChange={() =>
|
||||
handleCheckboxChange(polres.id)
|
||||
|
|
@ -496,6 +509,7 @@ export default function FormTaskDetail() {
|
|||
<div className="flex items-center gap-2" key={key}>
|
||||
<Checkbox
|
||||
id={key}
|
||||
disabled
|
||||
checked={taskOutput[key as keyof typeof taskOutput]}
|
||||
onCheckedChange={(value) =>
|
||||
setTaskOutput({ ...taskOutput, [key]: value })
|
||||
|
|
@ -508,11 +522,11 @@ export default function FormTaskDetail() {
|
|||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-6">
|
||||
{/* <div className="mt-6">
|
||||
<Label>Broadcast </Label>
|
||||
<RadioGroup
|
||||
value={broadcastType} // Nilai terpilih diambil dari state broadcastType
|
||||
onValueChange={(value) => setBroadcastType(value)} // Mengatur nilai saat radio berubah
|
||||
value={broadcastType}
|
||||
onValueChange={(value) => setBroadcastType(value)}
|
||||
className="flex flex-wrap gap-3"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
|
|
@ -528,19 +542,14 @@ export default function FormTaskDetail() {
|
|||
<Label htmlFor="whatsapp">WhatsApp Blast</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
</div> */}
|
||||
<div className="mt-6">
|
||||
<Label>Narasi Penugasan</Label>
|
||||
<Controller
|
||||
control={control}
|
||||
name="naration"
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<JoditEditor
|
||||
ref={editor}
|
||||
value={detail?.narration}
|
||||
onChange={onChange}
|
||||
className="dark:text-black"
|
||||
/>
|
||||
<ViewEditor initialData={detail?.narration} />
|
||||
)}
|
||||
/>
|
||||
{errors.naration?.message && (
|
||||
|
|
@ -551,11 +560,12 @@ export default function FormTaskDetail() {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{/* Submit Button */}
|
||||
<div className="mt-4">
|
||||
<Button type="submit" color="primary">
|
||||
Submit
|
||||
</Button>
|
||||
<Link href={"/contributor/task"}>
|
||||
<Button color="primary" variant={"outline"}>
|
||||
Cancel
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</form>
|
||||
) : (
|
||||
|
|
|
|||
Loading…
Reference in New Issue