fix text editor voting
deskripsi: - fix on create & edit - fix tampilan html di detail
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
import { Text } from "@mantine/core";
|
||||||
|
import { MainColor } from "../../color";
|
||||||
|
|
||||||
|
export default function Component_V3_Label_TextInput({
|
||||||
|
text,
|
||||||
|
}: {
|
||||||
|
text: string;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Text c={MainColor.white} fz={"sm"} fw={500}>
|
||||||
|
{text}
|
||||||
|
<Text inherit span c={"red"} px={5}>
|
||||||
|
*
|
||||||
|
</Text>
|
||||||
|
</Text>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ import { MainColor } from "../../color";
|
|||||||
export const Comp_DangerouslySetInnerHTML = ({
|
export const Comp_DangerouslySetInnerHTML = ({
|
||||||
props,
|
props,
|
||||||
color,
|
color,
|
||||||
style,
|
style: styleInput,
|
||||||
}: {
|
}: {
|
||||||
props: string | undefined;
|
props: string | undefined;
|
||||||
color?: string;
|
color?: string;
|
||||||
@@ -11,6 +11,8 @@ export const Comp_DangerouslySetInnerHTML = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const baseStyle: React.CSSProperties = {
|
const baseStyle: React.CSSProperties = {
|
||||||
color: color ?? MainColor.white,
|
color: color ?? MainColor.white,
|
||||||
|
wordBreak: "break-word",
|
||||||
|
overflow: "hidden",
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -18,13 +20,34 @@ export const Comp_DangerouslySetInnerHTML = ({
|
|||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
...baseStyle,
|
...baseStyle,
|
||||||
...style,
|
...styleInput,
|
||||||
// wordBreak: "break-word",
|
|
||||||
}}
|
}}
|
||||||
|
className="rich-html-content"
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: props ?? "",
|
__html: props ?? "",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
{`
|
||||||
|
div p {
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div ul, div ol {
|
||||||
|
margin: 0 0 8px 20px;
|
||||||
|
padding-left: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div h1, div h2, div h3 {
|
||||||
|
margin: 0 0 12px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div li {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
</style>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import { MainColor } from "@/app_modules/_global/color";
|
|||||||
import { Component_V3_TextEditor } from "@/app_modules/_global/component/new/comp_V3_text_editor";
|
import { Component_V3_TextEditor } from "@/app_modules/_global/component/new/comp_V3_text_editor";
|
||||||
import { maxInputLength } from "@/app_modules/_global/lib/maximal_setting";
|
import { maxInputLength } from "@/app_modules/_global/lib/maximal_setting";
|
||||||
import { funReplaceHtml } from "@/app_modules/_global/fun/fun_replace_html";
|
import { funReplaceHtml } from "@/app_modules/_global/fun/fun_replace_html";
|
||||||
|
import Component_V3_Label_TextInput from "@/app_modules/_global/component/new/comp_V3_label_text_input";
|
||||||
|
|
||||||
export default function Event_Create({
|
export default function Event_Create({
|
||||||
listTipeAcara,
|
listTipeAcara,
|
||||||
@@ -220,12 +221,7 @@ export default function Event_Create({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
<Text c={MainColor.white} fz={"sm"}>
|
<Component_V3_Label_TextInput text="Deskripsi" />
|
||||||
Deskripsi
|
|
||||||
<Text inherit span c={"red"} px={5}>
|
|
||||||
*
|
|
||||||
</Text>
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<Component_V3_TextEditor
|
<Component_V3_TextEditor
|
||||||
data={value.deskripsi}
|
data={value.deskripsi}
|
||||||
|
|||||||
@@ -3,17 +3,20 @@
|
|||||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input";
|
||||||
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
||||||
|
import { Component_V3_TextEditor } from "@/app_modules/_global/component/new/comp_V3_text_editor";
|
||||||
|
import { funReplaceHtml } from "@/app_modules/_global/fun/fun_replace_html";
|
||||||
|
import { maxInputLength } from "@/app_modules/_global/lib/maximal_setting";
|
||||||
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil";
|
||||||
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal";
|
||||||
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
|
||||||
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
import { MODEL_DEFAULT_MASTER_OLD } from "@/app_modules/model_global/interface";
|
||||||
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Select,
|
Select,
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
TextInput,
|
TextInput
|
||||||
Textarea,
|
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { DateTimePicker } from "@mantine/dates";
|
import { DateTimePicker } from "@mantine/dates";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
@@ -21,13 +24,10 @@ import moment from "moment";
|
|||||||
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Event_funEditById } from "../fun/edit/fun_edit_by_id";
|
|
||||||
import { MODEL_EVENT } from "../_lib/interface";
|
import { MODEL_EVENT } from "../_lib/interface";
|
||||||
import ComponentEvent_ErrorMaximalInput from "../component/error_maksimal_input";
|
import ComponentEvent_ErrorMaximalInput from "../component/error_maksimal_input";
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
import { Event_funEditById } from "../fun/edit/fun_edit_by_id";
|
||||||
import { Component_V3_TextEditor } from "@/app_modules/_global/component/new/comp_V3_text_editor";
|
import Component_V3_Label_TextInput from "@/app_modules/_global/component/new/comp_V3_label_text_input";
|
||||||
import { funReplaceHtml } from "@/app_modules/_global/fun/fun_replace_html";
|
|
||||||
import { maxInputLength } from "@/app_modules/_global/lib/maximal_setting";
|
|
||||||
|
|
||||||
export default function Event_Edit({
|
export default function Event_Edit({
|
||||||
dataEvent,
|
dataEvent,
|
||||||
@@ -250,12 +250,7 @@ export default function Event_Edit({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
<Text c={MainColor.white} fz={"sm"}>
|
<Component_V3_Label_TextInput text="Deskripsi" />
|
||||||
Deskripsi
|
|
||||||
<Text inherit span c={"red"} px={5}>
|
|
||||||
*
|
|
||||||
</Text>
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<Component_V3_TextEditor
|
<Component_V3_TextEditor
|
||||||
data={value.deskripsi}
|
data={value.deskripsi}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import { MODEL_VOTING } from "../../model/interface";
|
|||||||
import { voting_funGetOneVotingbyId } from "../../fun/get/fun_get_one_by_id";
|
import { voting_funGetOneVotingbyId } from "../../fun/get/fun_get_one_by_id";
|
||||||
import { Component_Header } from "@/app_modules/_global/component/new/component_header";
|
import { Component_Header } from "@/app_modules/_global/component/new/component_header";
|
||||||
|
|
||||||
|
|
||||||
export function Voting_ComponentLayoutHeaderDetailPublish({
|
export function Voting_ComponentLayoutHeaderDetailPublish({
|
||||||
votingId,
|
votingId,
|
||||||
title,
|
title,
|
||||||
@@ -42,8 +41,10 @@ export function Voting_ComponentLayoutHeaderDetailPublish({
|
|||||||
const [data, setData] = useState<MODEL_VOTING>(dataVoting);
|
const [data, setData] = useState<MODEL_VOTING>(dataVoting);
|
||||||
const [openDrawer, setOpenDrawer] = useState(false);
|
const [openDrawer, setOpenDrawer] = useState(false);
|
||||||
const [openModal, setOpenModal] = useState(false);
|
const [openModal, setOpenModal] = useState(false);
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
async function onUpdateStatusArsip({ isArsip }: { isArsip: boolean }) {
|
async function onUpdateStatusArsip({ isArsip }: { isArsip: boolean }) {
|
||||||
|
setIsLoading(true);
|
||||||
const res = await voting_funUpdateIsArsipById({
|
const res = await voting_funUpdateIsArsipById({
|
||||||
votingId,
|
votingId,
|
||||||
isArsip: isArsip,
|
isArsip: isArsip,
|
||||||
@@ -57,9 +58,11 @@ export function Voting_ComponentLayoutHeaderDetailPublish({
|
|||||||
} finally {
|
} finally {
|
||||||
setOpenModal(false);
|
setOpenModal(false);
|
||||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ComponentGlobal_NotifikasiGagal(res.message);
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +142,8 @@ export function Voting_ComponentLayoutHeaderDetailPublish({
|
|||||||
title={`Anda yakin ingin ${data?.isArsip ? "mempublish" : "mengarsipkan"} voting?`}
|
title={`Anda yakin ingin ${data?.isArsip ? "mempublish" : "mengarsipkan"} voting?`}
|
||||||
buttonKanan={
|
buttonKanan={
|
||||||
<Button
|
<Button
|
||||||
|
loading={isLoading}
|
||||||
|
loaderPosition="center"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
data?.isArsip
|
data?.isArsip
|
||||||
? onUpdateStatusArsip({ isArsip: false })
|
? onUpdateStatusArsip({ isArsip: false })
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
import { IconCircle } from "@tabler/icons-react";
|
import { IconCircle } from "@tabler/icons-react";
|
||||||
import { MODEL_VOTING } from "../../model/interface";
|
import { MODEL_VOTING } from "../../model/interface";
|
||||||
import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet";
|
import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
|
import { Comp_DangerouslySetInnerHTML } from "@/app_modules/_global/component/new/comp_set_inner_html";
|
||||||
|
|
||||||
export default function ComponentVote_DetailDataSebelumPublish
|
export default function ComponentVote_DetailDataSebelumPublish
|
||||||
({
|
({
|
||||||
@@ -36,7 +37,7 @@ export default function ComponentVote_DetailDataSebelumPublish
|
|||||||
{data?.title}
|
{data?.title}
|
||||||
</Title>
|
</Title>
|
||||||
</Center>
|
</Center>
|
||||||
<Text>{data?.deskripsi}</Text>
|
<Comp_DangerouslySetInnerHTML props={data?.deskripsi} />
|
||||||
|
|
||||||
<Stack spacing={0} align="center">
|
<Stack spacing={0} align="center">
|
||||||
<Center>
|
<Center>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { Badge, Center, Group, Stack, Text, Title } from "@mantine/core";
|
|||||||
import { MODEL_VOTING } from "../../model/interface";
|
import { MODEL_VOTING } from "../../model/interface";
|
||||||
import moment from "moment"
|
import moment from "moment"
|
||||||
import "moment/locale/id"
|
import "moment/locale/id"
|
||||||
|
import { Comp_DangerouslySetInnerHTML } from "@/app_modules/_global/component/new/comp_set_inner_html";
|
||||||
|
|
||||||
export default function ComponentVote_DetailDataSetelahPublish({
|
export default function ComponentVote_DetailDataSetelahPublish({
|
||||||
data,
|
data,
|
||||||
@@ -33,7 +34,7 @@ export default function ComponentVote_DetailDataSetelahPublish({
|
|||||||
{data?.title}
|
{data?.title}
|
||||||
</Title>
|
</Title>
|
||||||
</Center>
|
</Center>
|
||||||
<Text>{data?.deskripsi}</Text>
|
<Comp_DangerouslySetInnerHTML props={data?.deskripsi} />
|
||||||
|
|
||||||
<Stack spacing={0} pb={authorName ? 0 : "xs"}>
|
<Stack spacing={0} pb={authorName ? 0 : "xs"}>
|
||||||
<Stack align="center" spacing={"xs"}>
|
<Stack align="center" spacing={"xs"}>
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ import { WibuRealtime } from "wibu-pkg";
|
|||||||
import { Vote_funCreate } from "../fun/create/create_vote";
|
import { Vote_funCreate } from "../fun/create/create_vote";
|
||||||
import { gs_vote_hotMenu } from "../global_state";
|
import { gs_vote_hotMenu } from "../global_state";
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
import { Component_V3_TextEditor } from "@/app_modules/_global/component/new/comp_V3_text_editor";
|
||||||
|
import { funReplaceHtml } from "@/app_modules/_global/fun/fun_replace_html";
|
||||||
|
import { maxInputLength } from "@/app_modules/_global/lib/maximal_setting";
|
||||||
|
import Component_V3_Label_TextInput from "@/app_modules/_global/component/new/comp_V3_label_text_input";
|
||||||
|
|
||||||
export default function Vote_Create() {
|
export default function Vote_Create() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -102,17 +106,14 @@ export default function Vote_Create() {
|
|||||||
setHotMenu(2);
|
setHotMenu(2);
|
||||||
router.replace(RouterVote.status({ id: "2" }));
|
router.replace(RouterVote.status({ id: "2" }));
|
||||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
ComponentGlobal_NotifikasiGagal(res.message);
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
clientLogger.error("Error create voting", error);
|
clientLogger.error("Error create voting", error);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +131,7 @@ export default function Vote_Create() {
|
|||||||
},
|
},
|
||||||
required: {
|
required: {
|
||||||
color: MainColor.red,
|
color: MainColor.red,
|
||||||
}
|
},
|
||||||
}}
|
}}
|
||||||
label="Judul"
|
label="Judul"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
@@ -143,7 +144,27 @@ export default function Vote_Create() {
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
|
<Component_V3_Label_TextInput text="Deskripsi" />
|
||||||
|
|
||||||
|
<Component_V3_TextEditor
|
||||||
|
data={data.deskripsi}
|
||||||
|
onSetData={(val) => {
|
||||||
|
setData({
|
||||||
|
...data,
|
||||||
|
deskripsi: val,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ComponentGlobal_InputCountDown
|
||||||
|
lengthInput={funReplaceHtml({ html: data.deskripsi }).length}
|
||||||
|
maxInput={maxInputLength}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
{/* <Stack spacing={5}>
|
||||||
<Textarea
|
<Textarea
|
||||||
styles={{
|
styles={{
|
||||||
label: {
|
label: {
|
||||||
@@ -174,7 +195,7 @@ export default function Vote_Create() {
|
|||||||
maxInput={300}
|
maxInput={300}
|
||||||
lengthInput={data.deskripsi.length}
|
lengthInput={data.deskripsi.length}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack> */}
|
||||||
|
|
||||||
<DatePickerInput
|
<DatePickerInput
|
||||||
styles={{
|
styles={{
|
||||||
@@ -186,7 +207,7 @@ export default function Vote_Create() {
|
|||||||
},
|
},
|
||||||
required: {
|
required: {
|
||||||
color: MainColor.red,
|
color: MainColor.red,
|
||||||
}
|
},
|
||||||
}}
|
}}
|
||||||
label="Jangka Waktu"
|
label="Jangka Waktu"
|
||||||
placeholder="Masukan jangka waktu voting"
|
placeholder="Masukan jangka waktu voting"
|
||||||
@@ -227,7 +248,7 @@ export default function Vote_Create() {
|
|||||||
},
|
},
|
||||||
required: {
|
required: {
|
||||||
color: MainColor.red,
|
color: MainColor.red,
|
||||||
}
|
},
|
||||||
}}
|
}}
|
||||||
label={e.name}
|
label={e.name}
|
||||||
withAsterisk
|
withAsterisk
|
||||||
@@ -283,12 +304,11 @@ export default function Vote_Create() {
|
|||||||
<Button
|
<Button
|
||||||
disabled={
|
disabled={
|
||||||
!data.title ||
|
!data.title ||
|
||||||
!data.deskripsi ||
|
|
||||||
!data.awalVote ||
|
!data.awalVote ||
|
||||||
!data.akhirVote ||
|
!data.akhirVote ||
|
||||||
listVote.map((e, i) => e.value).includes("")
|
listVote.map((e, i) => e.value).includes("") ||
|
||||||
? true
|
funReplaceHtml({ html: data.deskripsi }).length > maxInputLength ||
|
||||||
: false
|
funReplaceHtml({ html: data.deskripsi }).length === 0
|
||||||
}
|
}
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
loading={isLoading ? true : false}
|
loading={isLoading ? true : false}
|
||||||
|
|||||||
@@ -70,49 +70,6 @@ export default function Vote_DetailKontribusi() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack pb={"md"}>
|
<Stack pb={"md"}>
|
||||||
{/* <ComponentGlobal_CardStyles marginBottom={"0px"}>
|
|
||||||
<Stack>
|
|
||||||
<ComponentGlobal_AvatarAndUsername
|
|
||||||
profile={data?.Author.Profile as any}
|
|
||||||
/>
|
|
||||||
<Stack spacing={"lg"}>
|
|
||||||
<Center>
|
|
||||||
<Title order={4} align="center">
|
|
||||||
{data?.title}
|
|
||||||
</Title>
|
|
||||||
</Center>
|
|
||||||
<Text>{data?.deskripsi}</Text>
|
|
||||||
|
|
||||||
<Stack spacing={0} pb={"xs"}>
|
|
||||||
<Stack align="center" spacing={"xs"}>
|
|
||||||
<Text fz={10} fw={"bold"}>
|
|
||||||
Batas Voting
|
|
||||||
</Text>
|
|
||||||
<Badge
|
|
||||||
styles={{
|
|
||||||
root: {
|
|
||||||
backgroundColor: AccentColor.blue,
|
|
||||||
border: `1px solid ${AccentColor.skyblue}`,
|
|
||||||
color: "white",
|
|
||||||
width: "80%",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Text>
|
|
||||||
{data
|
|
||||||
? moment(data.awalVote).format("ll")
|
|
||||||
: "tgl awal voting"}{" "}
|
|
||||||
-{" "}
|
|
||||||
{data
|
|
||||||
? moment(data.akhirVote).format("ll")
|
|
||||||
: "tgl akhir voting"}
|
|
||||||
</Text>
|
|
||||||
</Badge>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
</ComponentGlobal_CardStyles> */}
|
|
||||||
<ComponentVote_DetailDataSetelahPublish
|
<ComponentVote_DetailDataSetelahPublish
|
||||||
data={data as any}
|
data={data as any}
|
||||||
authorName={true}
|
authorName={true}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import { Voting_ComponentSkeletonDetail } from "../../component/skeleton_view";
|
|||||||
import { Vote_funCreateHasil } from "../../fun/create/create_hasil";
|
import { Vote_funCreateHasil } from "../../fun/create/create_hasil";
|
||||||
import { MODEL_VOTING } from "../../model/interface";
|
import { MODEL_VOTING } from "../../model/interface";
|
||||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||||
|
import { Comp_DangerouslySetInnerHTML } from "@/app_modules/_global/component/new/comp_set_inner_html";
|
||||||
|
|
||||||
export default function Vote_MainDetail({
|
export default function Vote_MainDetail({
|
||||||
userLoginId,
|
userLoginId,
|
||||||
@@ -222,7 +223,7 @@ export default function Vote_MainDetail({
|
|||||||
{data?.title}
|
{data?.title}
|
||||||
</Title>
|
</Title>
|
||||||
</Center>
|
</Center>
|
||||||
<Text>{data?.deskripsi}</Text>
|
<Comp_DangerouslySetInnerHTML props={data?.deskripsi} />
|
||||||
|
|
||||||
<Stack spacing={0}>
|
<Stack spacing={0}>
|
||||||
<Stack align="center" spacing={"xs"}>
|
<Stack align="center" spacing={"xs"}>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
TextInput,
|
TextInput,
|
||||||
Textarea
|
Textarea,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { DatePickerInput } from "@mantine/dates";
|
import { DatePickerInput } from "@mantine/dates";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
@@ -32,6 +32,10 @@ import {
|
|||||||
MODEL_VOTING_DAFTAR_NAMA_VOTE,
|
MODEL_VOTING_DAFTAR_NAMA_VOTE,
|
||||||
} from "../model/interface";
|
} from "../model/interface";
|
||||||
import { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
|
import Component_V3_Label_TextInput from "@/app_modules/_global/component/new/comp_V3_label_text_input";
|
||||||
|
import { Component_V3_TextEditor } from "@/app_modules/_global/component/new/comp_V3_text_editor";
|
||||||
|
import { funReplaceHtml } from "@/app_modules/_global/fun/fun_replace_html";
|
||||||
|
import { maxInputLength } from "@/app_modules/_global/lib/maximal_setting";
|
||||||
|
|
||||||
export default function Vote_Edit({
|
export default function Vote_Edit({
|
||||||
dataVote,
|
dataVote,
|
||||||
@@ -88,6 +92,28 @@ export default function Vote_Edit({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
|
<Component_V3_Label_TextInput text="Deskripsi" />
|
||||||
|
|
||||||
|
<Component_V3_TextEditor
|
||||||
|
data={data.deskripsi}
|
||||||
|
onSetData={(val) => {
|
||||||
|
setData({
|
||||||
|
...data,
|
||||||
|
deskripsi: val,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{funReplaceHtml({ html: data.deskripsi }).length === 0 && (
|
||||||
|
<ComponentGlobal_ErrorInput text="Masukan deskripsi" />
|
||||||
|
)}
|
||||||
|
|
||||||
|
<ComponentGlobal_InputCountDown
|
||||||
|
lengthInput={funReplaceHtml({ html: data.deskripsi }).length}
|
||||||
|
maxInput={maxInputLength}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
{/* <Stack spacing={5}>
|
||||||
<Textarea
|
<Textarea
|
||||||
styles={{
|
styles={{
|
||||||
label: {
|
label: {
|
||||||
@@ -126,7 +152,7 @@ export default function Vote_Edit({
|
|||||||
lengthInput={data.deskripsi.length}
|
lengthInput={data.deskripsi.length}
|
||||||
maxInput={300}
|
maxInput={300}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack> */}
|
||||||
|
|
||||||
<DatePickerInput
|
<DatePickerInput
|
||||||
styles={{
|
styles={{
|
||||||
@@ -284,7 +310,6 @@ function ButtonAction({
|
|||||||
ComponentGlobal_NotifikasiGagal(res.message);
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
clientLogger.error("Error update voting", error);
|
clientLogger.error("Error update voting", error);
|
||||||
@@ -294,7 +319,11 @@ function ButtonAction({
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
disabled={!data.title || !data.deskripsi ? true : false}
|
disabled={
|
||||||
|
!data.title ||
|
||||||
|
funReplaceHtml({ html: data.deskripsi }).length > maxInputLength ||
|
||||||
|
funReplaceHtml({ html: data.deskripsi }).length === 0
|
||||||
|
}
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
loading={isLoading ? true : false}
|
loading={isLoading ? true : false}
|
||||||
mt={"lg"}
|
mt={"lg"}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export async function Vote_funEditById(
|
|||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
deskripsi: data.deskripsi,
|
deskripsi: data.deskripsi.trim(),
|
||||||
awalVote: data.awalVote,
|
awalVote: data.awalVote,
|
||||||
akhirVote: data.akhirVote,
|
akhirVote: data.akhirVote,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user