fix collaboration
deskripsi: - create & edit di tambah text editor - tampilan khusus untuk html
This commit is contained in:
@@ -6,6 +6,8 @@ import { useRouter } from "next/navigation";
|
|||||||
import { MODEL_COLLABORATION } from "../../model/interface";
|
import { MODEL_COLLABORATION } from "../../model/interface";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component";
|
||||||
|
import { Component_V3_GridDetailData } from "@/app_modules/_global/component/new/comp_V3_grid_detail_data";
|
||||||
|
import { MainColor } from "@/app_modules/_global/color";
|
||||||
|
|
||||||
export default function ComponentColab_CardSectionData({
|
export default function ComponentColab_CardSectionData({
|
||||||
colabId,
|
colabId,
|
||||||
@@ -19,10 +21,25 @@ export default function ComponentColab_CardSectionData({
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
|
|
||||||
|
const listData = [
|
||||||
|
{
|
||||||
|
title: "Industri",
|
||||||
|
value: data?.ProjectCollaborationMaster_Industri.name
|
||||||
|
? data.ProjectCollaborationMaster_Industri.name
|
||||||
|
: "Industri",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Lokasi",
|
||||||
|
value: data?.lokasi ? data.lokasi : "-",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Card.Section
|
<Card.Section
|
||||||
px={"md"}
|
mt={0}
|
||||||
|
bg={MainColor.soft_darkblue}
|
||||||
|
p={"sm"}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (path) {
|
if (path) {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
@@ -37,51 +54,10 @@ export default function ComponentColab_CardSectionData({
|
|||||||
{data?.title ? data.title : "Judul Proyek"}
|
{data?.title ? data.title : "Judul Proyek"}
|
||||||
</Title>
|
</Title>
|
||||||
</Center>
|
</Center>
|
||||||
<Stack spacing={"xs"}>
|
<Stack spacing={5}>
|
||||||
<Grid>
|
{listData.map((e, i) => (
|
||||||
<Grid.Col span={2}>
|
<Component_V3_GridDetailData item={e} key={i} />
|
||||||
<Text fw={"bold"} >
|
))}
|
||||||
Industri
|
|
||||||
</Text>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col span={1}>
|
|
||||||
<Text >:</Text>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col span={"auto"}>
|
|
||||||
<Text lineClamp={1}>
|
|
||||||
{data?.ProjectCollaborationMaster_Industri.name
|
|
||||||
? data?.ProjectCollaborationMaster_Industri?.name
|
|
||||||
: "Industri"}
|
|
||||||
</Text>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid>
|
|
||||||
<Grid.Col span={2}>
|
|
||||||
<Text fw={"bold"} >
|
|
||||||
Lokasi
|
|
||||||
</Text>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col span={1}>
|
|
||||||
<Text >:</Text>
|
|
||||||
</Grid.Col>
|
|
||||||
<Grid.Col span={"auto"}>
|
|
||||||
<Text lineClamp={1}>
|
|
||||||
{data?.lokasi ? data?.lokasi : "Lokasi dari proyek"}
|
|
||||||
</Text>
|
|
||||||
</Grid.Col>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Stack spacing={5}>
|
|
||||||
<Text fw={"bold"} >
|
|
||||||
Tujuan proyek
|
|
||||||
</Text>
|
|
||||||
<Text lineClamp={2} >
|
|
||||||
{data?.purpose
|
|
||||||
? data?.purpose
|
|
||||||
: "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maiores odio nihil in animi expedita, suscipit excepturi pariatur totam esse officiis enim cumque. Quidem, facere aliquam. Sunt laboriosam incidunt iste amet"}
|
|
||||||
</Text>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
{visible && <ComponentGlobal_CardLoadingOverlay />}
|
{visible && <ComponentGlobal_CardLoadingOverlay />}
|
||||||
</Card.Section>
|
</Card.Section>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default function ComponentColab_JumlahPartisipan({
|
|||||||
<>
|
<>
|
||||||
<Card.Section px={"md"} >
|
<Card.Section px={"md"} >
|
||||||
<Stack>
|
<Stack>
|
||||||
<Divider />
|
{/* <Divider /> */}
|
||||||
<Center>
|
<Center>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={"content"}>
|
<Grid.Col span={"content"}>
|
||||||
|
|||||||
@@ -3,31 +3,60 @@
|
|||||||
import { Stack, Box, Center, Title, Grid, Text } from "@mantine/core";
|
import { Stack, Box, Center, Title, Grid, Text } from "@mantine/core";
|
||||||
import ComponentColab_AuthorNameOnHeader from "../header_author_name";
|
import ComponentColab_AuthorNameOnHeader from "../header_author_name";
|
||||||
import { MODEL_COLLABORATION } from "../../model/interface";
|
import { MODEL_COLLABORATION } from "../../model/interface";
|
||||||
|
import { Comp_V3_SetInnerHTML } from "@/app_modules/_global/component/new/comp_V3_set_html_with_stiker";
|
||||||
|
import { Component_V3_GridDetailData } from "@/app_modules/_global/component/new/comp_V3_grid_detail_data";
|
||||||
|
|
||||||
export default function ComponentColab_DetailData({
|
export default function ComponentColab_DetailData({
|
||||||
data,
|
data,
|
||||||
}: {
|
}: {
|
||||||
data?: MODEL_COLLABORATION;
|
data?: MODEL_COLLABORATION;
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
|
const listData = [
|
||||||
|
{
|
||||||
|
title: "Industri",
|
||||||
|
value: data?.ProjectCollaborationMaster_Industri.name
|
||||||
|
? data.ProjectCollaborationMaster_Industri.name
|
||||||
|
: "Industri",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Lokasi",
|
||||||
|
value: data?.lokasi ? data.lokasi : "-",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Tujuan Proyek",
|
||||||
|
value: <Comp_V3_SetInnerHTML props={data?.purpose} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Keuntungan Proyek",
|
||||||
|
value: <Comp_V3_SetInnerHTML props={data?.benefit} />,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack>
|
<Box>
|
||||||
<Box>
|
<Center px={"md"} mb={"lg"}>
|
||||||
<Center px={"md"} mb={"lg"}>
|
<Title order={3}>{data?.title ? data.title : "Judul Proyek"}</Title>
|
||||||
<Title order={4}>{data?.title ? data.title : "Judul Proyek"}</Title>
|
</Center>
|
||||||
</Center>
|
|
||||||
<Stack spacing={"sm"}>
|
<Stack>
|
||||||
|
{listData.map((e, i) => (
|
||||||
|
<Component_V3_GridDetailData item={e} key={i} />
|
||||||
|
))}
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
{/* <Stack spacing={"sm"}>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={2}>
|
<Grid.Col span={2}>
|
||||||
<Text fw={"bold"} >
|
<Text fw={"bold"}>Industri</Text>
|
||||||
Industri
|
|
||||||
</Text>
|
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={1}>
|
<Grid.Col span={1}>
|
||||||
<Text >:</Text>
|
<Text>:</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text >
|
<Text>
|
||||||
{data?.ProjectCollaborationMaster_Industri.name
|
{data?.ProjectCollaborationMaster_Industri.name
|
||||||
? data.ProjectCollaborationMaster_Industri.name
|
? data.ProjectCollaborationMaster_Industri.name
|
||||||
: "Industri"}
|
: "Industri"}
|
||||||
@@ -37,35 +66,32 @@ export default function ComponentColab_DetailData({
|
|||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.Col span={2}>
|
<Grid.Col span={2}>
|
||||||
<Text fw={"bold"} >
|
<Text fw={"bold"}>Lokasi</Text>
|
||||||
Lokasi
|
|
||||||
</Text>
|
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={1}>
|
<Grid.Col span={1}>
|
||||||
<Text >:</Text>
|
<Text>:</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
<Grid.Col span={"auto"}>
|
<Grid.Col span={"auto"}>
|
||||||
<Text lineClamp={1}>
|
<Text lineClamp={1}>
|
||||||
{data?.lokasi ? data.lokasi : " Lokasi dari proyek"}
|
{data?.lokasi ? data.lokasi : " Lokasi dari proyek"}
|
||||||
</Text>
|
</Text>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
<Text fw={"bold"} >
|
<Text fw={"bold"}>Tujuan proyek</Text>
|
||||||
Tujuan proyek
|
<Comp_V3_SetInnerHTML
|
||||||
</Text>
|
props={data?.purpose}
|
||||||
<Text >{data?.purpose ? data?.purpose : "-"}</Text>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
<Text fw={"bold"} >
|
<Text fw={"bold"}>Keuntungan</Text>
|
||||||
Keuntungan
|
<Comp_V3_SetInnerHTML
|
||||||
</Text>
|
props={data?.benefit}
|
||||||
<Text >{data?.benefit ? data?.benefit : "-"}</Text>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack> */}
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,16 @@
|
|||||||
|
|
||||||
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
import { MainColor } from "@/app_modules/_global/color/color_pallet";
|
||||||
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown";
|
||||||
|
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";
|
||||||
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 { clientLogger } from "@/util/clientLogger";
|
import { clientLogger } from "@/util/clientLogger";
|
||||||
import mqtt_client from "@/util/mqtt_client";
|
import mqtt_client from "@/util/mqtt_client";
|
||||||
import { Button, Select, Stack, TextInput, Textarea } from "@mantine/core";
|
import { Button, Select, Stack, TextInput } from "@mantine/core";
|
||||||
import { useShallowEffect } from "@mantine/hooks";
|
import { useShallowEffect } from "@mantine/hooks";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -16,14 +20,21 @@ import { apiGetMasterCollaboration } from "../component/lib/api_collaboration";
|
|||||||
import colab_funCreateProyek from "../fun/create/fun_create_proyek";
|
import colab_funCreateProyek from "../fun/create/fun_create_proyek";
|
||||||
import { MODEL_COLLABORATION_MASTER } from "../model/interface";
|
import { MODEL_COLLABORATION_MASTER } from "../model/interface";
|
||||||
|
|
||||||
|
interface IValue {
|
||||||
|
title: string;
|
||||||
|
lokasi: string;
|
||||||
|
purpose: string;
|
||||||
|
benefit: string;
|
||||||
|
projectCollaborationMaster_IndustriId: number;
|
||||||
|
}
|
||||||
|
|
||||||
export default function Colab_Create() {
|
export default function Colab_Create() {
|
||||||
const [value, setValue] = useState({
|
const [value, setValue] = useState<IValue>({
|
||||||
title: "",
|
title: "",
|
||||||
lokasi: "",
|
lokasi: "",
|
||||||
purpose: "",
|
purpose: "",
|
||||||
benefit: "",
|
benefit: "",
|
||||||
projectCollaborationMaster_IndustriId: 0,
|
projectCollaborationMaster_IndustriId: 0,
|
||||||
// jumlah_partisipan: 0,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const [listIndustri, setListIndustri] = useState<
|
const [listIndustri, setListIndustri] = useState<
|
||||||
@@ -55,7 +66,7 @@ export default function Colab_Create() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack px={"xl"} pb={"md"}>
|
<Stack px={"xs"} pb={"md"}>
|
||||||
<TextInput
|
<TextInput
|
||||||
maxLength={100}
|
maxLength={100}
|
||||||
styles={{
|
styles={{
|
||||||
@@ -115,6 +126,44 @@ export default function Colab_Create() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
|
<Component_V3_Label_TextInput text="Tujuan Proyek" />
|
||||||
|
|
||||||
|
<Component_V3_TextEditor
|
||||||
|
data={value.purpose}
|
||||||
|
onSetData={(val) => {
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
purpose: val,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ComponentGlobal_InputCountDown
|
||||||
|
lengthInput={funReplaceHtml({ html: value.purpose }).length}
|
||||||
|
maxInput={maxInputLength}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
<Stack spacing={5}>
|
||||||
|
<Component_V3_Label_TextInput text="Keuntungan" />
|
||||||
|
|
||||||
|
<Component_V3_TextEditor
|
||||||
|
data={value.benefit}
|
||||||
|
onSetData={(val) => {
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
benefit: val,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ComponentGlobal_InputCountDown
|
||||||
|
lengthInput={funReplaceHtml({ html: value.benefit }).length}
|
||||||
|
maxInput={maxInputLength}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
{/* <Stack spacing={5}>
|
||||||
<Textarea
|
<Textarea
|
||||||
styles={{
|
styles={{
|
||||||
label: { color: MainColor.white },
|
label: { color: MainColor.white },
|
||||||
@@ -137,9 +186,9 @@ export default function Colab_Create() {
|
|||||||
lengthInput={value.purpose.length}
|
lengthInput={value.purpose.length}
|
||||||
maxInput={500}
|
maxInput={500}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack> */}
|
||||||
|
|
||||||
<Stack spacing={5}>
|
{/* <Stack spacing={5}>
|
||||||
<Textarea
|
<Textarea
|
||||||
styles={{
|
styles={{
|
||||||
label: { color: MainColor.white },
|
label: { color: MainColor.white },
|
||||||
@@ -160,7 +209,7 @@ export default function Colab_Create() {
|
|||||||
lengthInput={value.benefit.length}
|
lengthInput={value.benefit.length}
|
||||||
maxInput={500}
|
maxInput={500}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack> */}
|
||||||
|
|
||||||
<ButtonAction value={value as any} />
|
<ButtonAction value={value as any} />
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -168,7 +217,7 @@ export default function Colab_Create() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ButtonAction({ value }: { value: any }) {
|
function ButtonAction({ value }: { value: IValue }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
@@ -190,7 +239,7 @@ function ButtonAction({ value }: { value: any }) {
|
|||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
||||||
const res = await colab_funCreateProyek(value);
|
const res = await colab_funCreateProyek(value as any);
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
router.back();
|
router.back();
|
||||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
@@ -210,11 +259,13 @@ function ButtonAction({ value }: { value: any }) {
|
|||||||
disabled={
|
disabled={
|
||||||
!value.title ||
|
!value.title ||
|
||||||
!value.lokasi ||
|
!value.lokasi ||
|
||||||
!value.purpose ||
|
value.projectCollaborationMaster_IndustriId === 0 ||
|
||||||
!value.benefit ||
|
// value.purpose
|
||||||
value.projectCollaborationMaster_IndustriId === 0
|
// value.benefit
|
||||||
? true
|
funReplaceHtml({ html: value.purpose }).length > maxInputLength ||
|
||||||
: false
|
funReplaceHtml({ html: value.purpose }).length === 0 ||
|
||||||
|
funReplaceHtml({ html: value.benefit }).length > maxInputLength ||
|
||||||
|
funReplaceHtml({ html: value.benefit }).length === 0
|
||||||
}
|
}
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
loading={loading ? true : false}
|
loading={loading ? true : false}
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ import {
|
|||||||
MODEL_COLLABORATION_MASTER,
|
MODEL_COLLABORATION_MASTER,
|
||||||
} 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 Colab_Edit({
|
export default function Colab_Edit({
|
||||||
selectedData,
|
selectedData,
|
||||||
@@ -25,8 +29,7 @@ export default function Colab_Edit({
|
|||||||
const [value, setValue] = useState(selectedData);
|
const [value, setValue] = useState(selectedData);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack px={"xl"} py={"md"}>
|
<Stack px={"xs"} py={"md"}>
|
||||||
{/* <pre>{JSON.stringify(value, null, 2)}</pre> */}
|
|
||||||
<TextInput
|
<TextInput
|
||||||
maxLength={100}
|
maxLength={100}
|
||||||
styles={{
|
styles={{
|
||||||
@@ -38,7 +41,7 @@ export default function Colab_Edit({
|
|||||||
},
|
},
|
||||||
required: {
|
required: {
|
||||||
color: MainColor.red,
|
color: MainColor.red,
|
||||||
}
|
},
|
||||||
}}
|
}}
|
||||||
label="Judul"
|
label="Judul"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
@@ -63,7 +66,7 @@ export default function Colab_Edit({
|
|||||||
},
|
},
|
||||||
required: {
|
required: {
|
||||||
color: MainColor.red,
|
color: MainColor.red,
|
||||||
}
|
},
|
||||||
}}
|
}}
|
||||||
label="Lokasi"
|
label="Lokasi"
|
||||||
withAsterisk
|
withAsterisk
|
||||||
@@ -90,7 +93,7 @@ export default function Colab_Edit({
|
|||||||
},
|
},
|
||||||
dropdown: {
|
dropdown: {
|
||||||
backgroundColor: MainColor.white,
|
backgroundColor: MainColor.white,
|
||||||
}
|
},
|
||||||
}}
|
}}
|
||||||
placeholder="Pilih kategori industri"
|
placeholder="Pilih kategori industri"
|
||||||
label="Pilih Industri"
|
label="Pilih Industri"
|
||||||
@@ -112,26 +115,45 @@ export default function Colab_Edit({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* <TextInput
|
<Stack spacing={5}>
|
||||||
description={
|
<Component_V3_Label_TextInput text="Tujuan Proyek" />
|
||||||
<Text fz={10}>
|
|
||||||
minimal partisipan yang akan di pilih untuk mendiskusikan proyek
|
<Component_V3_TextEditor
|
||||||
</Text>
|
data={value.purpose}
|
||||||
}
|
onSetData={(val) => {
|
||||||
type="number"
|
setValue({
|
||||||
withAsterisk
|
...value,
|
||||||
label="Jumlah Partisipan"
|
purpose: val,
|
||||||
placeholder={"2"}
|
});
|
||||||
value={value.jumlah_partisipan ? value.jumlah_partisipan : ""}
|
}}
|
||||||
onChange={(val) => {
|
/>
|
||||||
setValue({
|
|
||||||
...value,
|
<ComponentGlobal_InputCountDown
|
||||||
jumlah_partisipan: + val.currentTarget.value
|
lengthInput={funReplaceHtml({ html: value.purpose }).length}
|
||||||
});
|
maxInput={maxInputLength}
|
||||||
}}
|
/>
|
||||||
/> */}
|
</Stack>
|
||||||
|
|
||||||
<Stack spacing={5}>
|
<Stack spacing={5}>
|
||||||
|
<Component_V3_Label_TextInput text="Keuntungan" />
|
||||||
|
|
||||||
|
<Component_V3_TextEditor
|
||||||
|
data={value.benefit}
|
||||||
|
onSetData={(val) => {
|
||||||
|
setValue({
|
||||||
|
...value,
|
||||||
|
benefit: val,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ComponentGlobal_InputCountDown
|
||||||
|
lengthInput={funReplaceHtml({ html: value.benefit }).length}
|
||||||
|
maxInput={maxInputLength}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
{/* <Stack spacing={5}>
|
||||||
<Textarea
|
<Textarea
|
||||||
styles={{
|
styles={{
|
||||||
label: {
|
label: {
|
||||||
@@ -160,9 +182,9 @@ export default function Colab_Edit({
|
|||||||
lengthInput={value.purpose.length}
|
lengthInput={value.purpose.length}
|
||||||
maxInput={500}
|
maxInput={500}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack> */}
|
||||||
|
|
||||||
<Stack spacing={5}>
|
{/* <Stack spacing={5}>
|
||||||
<Textarea
|
<Textarea
|
||||||
styles={{
|
styles={{
|
||||||
label: {
|
label: {
|
||||||
@@ -187,7 +209,7 @@ export default function Colab_Edit({
|
|||||||
lengthInput={value.benefit.length}
|
lengthInput={value.benefit.length}
|
||||||
maxInput={500}
|
maxInput={500}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack> */}
|
||||||
|
|
||||||
<ButtonAction value={value as any} />
|
<ButtonAction value={value as any} />
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -211,18 +233,18 @@ function ButtonAction({ value }: { value: any }) {
|
|||||||
// if (value.jumlah_partisipan < 2)
|
// if (value.jumlah_partisipan < 2)
|
||||||
// return ComponentGlobal_NotifikasiPeringatan("Minimal Ada 2 Partisipan");
|
// return ComponentGlobal_NotifikasiPeringatan("Minimal Ada 2 Partisipan");
|
||||||
|
|
||||||
|
setLoading(true);
|
||||||
await colab_funEditById(value as any).then((res) => {
|
await colab_funEditById(value as any).then((res) => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
router.back();
|
router.back();
|
||||||
ComponentGlobal_NotifikasiBerhasil(res.message);
|
ComponentGlobal_NotifikasiBerhasil(res.message);
|
||||||
} else {
|
} else {
|
||||||
setLoading(false)
|
setLoading(false);
|
||||||
ComponentGlobal_NotifikasiGagal(res.message);
|
ComponentGlobal_NotifikasiGagal(res.message);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLoading(false)
|
setLoading(false);
|
||||||
clientLogger.error("Error update proyek", error);
|
clientLogger.error("Error update proyek", error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -234,11 +256,11 @@ function ButtonAction({ value }: { value: any }) {
|
|||||||
disabled={
|
disabled={
|
||||||
!value.title ||
|
!value.title ||
|
||||||
!value.lokasi ||
|
!value.lokasi ||
|
||||||
!value.purpose ||
|
value.projectCollaborationMaster_IndustriId === 0 ||
|
||||||
!value.benefit ||
|
funReplaceHtml({ html: value.purpose }).length > maxInputLength ||
|
||||||
value.projectCollaborationMaster_IndustriId === 0
|
funReplaceHtml({ html: value.purpose }).length === 0 ||
|
||||||
? true
|
funReplaceHtml({ html: value.benefit }).length > maxInputLength ||
|
||||||
: false
|
funReplaceHtml({ html: value.benefit }).length === 0
|
||||||
}
|
}
|
||||||
loaderPosition="center"
|
loaderPosition="center"
|
||||||
loading={loading ? true : false}
|
loading={loading ? true : false}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { revalidatePath } from "next/cache";
|
|||||||
import { RouterColab } from "@/lib/router_hipmi/router_colab";
|
import { RouterColab } from "@/lib/router_hipmi/router_colab";
|
||||||
|
|
||||||
export default async function colab_funEditById(value: MODEL_COLLABORATION) {
|
export default async function colab_funEditById(value: MODEL_COLLABORATION) {
|
||||||
console.log(value);
|
|
||||||
const updt = await prisma.projectCollaboration.update({
|
const updt = await prisma.projectCollaboration.update({
|
||||||
where: {
|
where: {
|
||||||
id: value.id,
|
id: value.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user