style: update skelaton
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { WARNA } from '@/module/_global';
|
import { WARNA } from '@/module/_global';
|
||||||
import { Box, Divider, Group, Indicator, Text } from '@mantine/core';
|
import { Box, Divider, Group, Indicator, Skeleton, Text } from '@mantine/core';
|
||||||
import { DatePicker, DatePickerProps } from '@mantine/dates';
|
import { DatePicker, DatePickerProps } from '@mantine/dates';
|
||||||
import { useParams, useRouter } from 'next/navigation';
|
import { useParams, useRouter } from 'next/navigation';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
@@ -7,6 +7,7 @@ import { funGetAllCalender } from '../lib/api_calender';
|
|||||||
import { useSetState, useShallowEffect } from '@mantine/hooks';
|
import { useSetState, useShallowEffect } from '@mantine/hooks';
|
||||||
import { IDataCalender } from '../lib/type_calender';
|
import { IDataCalender } from '../lib/type_calender';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
|
||||||
export default function DateEventDivision() {
|
export default function DateEventDivision() {
|
||||||
@@ -14,13 +15,18 @@ export default function DateEventDivision() {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const param = useParams<{ id: string, detail: string }>()
|
const param = useParams<{ id: string, detail: string }>()
|
||||||
const [isDate, setDate] = useSetState<any>(moment().format('YYYY-MM-DD'))
|
const [isDate, setDate] = useSetState<any>(moment().format('YYYY-MM-DD'))
|
||||||
|
const [loading, setLoading] = useState(true)
|
||||||
|
|
||||||
const getData = async (tgl: any) => {
|
const getData = async (tgl: any) => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await funGetAllCalender('?division=' + param.id + '&date=' + tgl)
|
const response = await funGetAllCalender('?division=' + param.id + '&date=' + tgl)
|
||||||
setData(response.data)
|
setData(response.data)
|
||||||
|
setLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +66,21 @@ export default function DateEventDivision() {
|
|||||||
<Text mb={10} mt={20} fw={"bold"}>
|
<Text mb={10} mt={20} fw={"bold"}>
|
||||||
Event
|
Event
|
||||||
</Text>
|
</Text>
|
||||||
{isData.length > 0 ? (
|
{loading ?
|
||||||
|
Array(6)
|
||||||
|
.fill(null)
|
||||||
|
.map((_, i) => (
|
||||||
|
<Box key={i} mb={10}>
|
||||||
|
<Skeleton height={100} width={"100%"} radius={"md"} />
|
||||||
|
</Box>
|
||||||
|
))
|
||||||
|
:
|
||||||
|
_.isEmpty(isData)
|
||||||
|
?
|
||||||
|
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '20vh' }}>
|
||||||
|
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada event</Text>
|
||||||
|
</Box>
|
||||||
|
:
|
||||||
isData.map((event, index) => {
|
isData.map((event, index) => {
|
||||||
const bgColor = ['#D8D8F1', '#FED6C5'][index % 2]
|
const bgColor = ['#D8D8F1', '#FED6C5'][index % 2]
|
||||||
const colorDivider = ['#535FCA', '#A7A7A7'][index % 2]
|
const colorDivider = ['#535FCA', '#A7A7A7'][index % 2]
|
||||||
@@ -81,9 +101,7 @@ export default function DateEventDivision() {
|
|||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
) : (
|
}
|
||||||
<Text c={WARNA.biruTua}>Tidak ada event</Text>
|
|
||||||
)}
|
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { LayoutNavbarNew, WARNA } from '@/module/_global';
|
import { LayoutNavbarNew, WARNA } from '@/module/_global';
|
||||||
import { Box, Center, Flex, Grid, Group, Text, TextInput } from '@mantine/core';
|
import { Box, Center, Flex, Grid, Group, Skeleton, Text, TextInput } from '@mantine/core';
|
||||||
import { useParams, useRouter } from 'next/navigation';
|
import { useParams, useRouter } from 'next/navigation';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { HiMagnifyingGlass } from 'react-icons/hi2';
|
import { HiMagnifyingGlass } from 'react-icons/hi2';
|
||||||
@@ -9,63 +9,25 @@ import { funGetAllCalender, funGetHostory } from '../lib/api_calender';
|
|||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import "moment/locale/id";
|
import "moment/locale/id";
|
||||||
|
import _ from 'lodash';
|
||||||
const history = [
|
|
||||||
{
|
|
||||||
dateStart: "21",
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
title: "Pembahasan Mengenai Darmasaba",
|
|
||||||
timeEnd: "10:00",
|
|
||||||
timeStart: "10.00",
|
|
||||||
status: "Selesai",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
title: "Pembahasan Mengenai Darmasaba",
|
|
||||||
timeEnd: "10:00",
|
|
||||||
timeStart: "13.00 - 14.00",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
dateStart: "21",
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
title: "Pembahasan Mengenai Darmasaba",
|
|
||||||
timeEnd: "10:00",
|
|
||||||
timeStart: "10.00",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
title: "Pembahasan Mengenai Darmasaba",
|
|
||||||
timeEnd: "10:00",
|
|
||||||
timeStart: "13.00",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
title: "Pembahasan Mengenai Darmasaba",
|
|
||||||
timeEnd: "10:00",
|
|
||||||
timeStart: "15.00",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
export default function HistoryDivisionCalender() {
|
export default function HistoryDivisionCalender() {
|
||||||
const [isData, setData] = useState<IHistoryCalender[]>([])
|
const [isData, setData] = useState<IHistoryCalender[]>([])
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const param = useParams<{ id: string, detail: string }>()
|
const param = useParams<{ id: string, detail: string }>()
|
||||||
const [searchQuery, setSearchQuery] = useState('')
|
const [searchQuery, setSearchQuery] = useState('')
|
||||||
|
const [loading, setLoading] = useState(true)
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await funGetHostory('?division=' + param.id + '&search=' + searchQuery)
|
const response = await funGetHostory('?division=' + param.id + '&search=' + searchQuery)
|
||||||
setData(response.data)
|
setData(response.data)
|
||||||
|
setLoading(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +36,7 @@ export default function HistoryDivisionCalender() {
|
|||||||
}, [searchQuery])
|
}, [searchQuery])
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<LayoutNavbarNew back="/calender" title="Riwayat kalender" menu />
|
<LayoutNavbarNew back={`/division/${param.id}/calender/`} title="Riwayat kalender" menu />
|
||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
<TextInput
|
<TextInput
|
||||||
styles={{
|
styles={{
|
||||||
@@ -96,7 +58,37 @@ export default function HistoryDivisionCalender() {
|
|||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
padding: 20
|
padding: 20
|
||||||
}}>
|
}}>
|
||||||
{isData.map((v, i) => {
|
{loading ?
|
||||||
|
Array(6)
|
||||||
|
.fill(null)
|
||||||
|
.map((_, i) => (
|
||||||
|
<Box key={i} mb={10}>
|
||||||
|
<Grid >
|
||||||
|
<Grid.Col span={2}>
|
||||||
|
<Flex justify={"center"} direction={'column'}>
|
||||||
|
<Skeleton height={30} width={"100%"} radius={"md"} />
|
||||||
|
<Skeleton height={20} width={"100%"} radius={"md"} mt={10} />
|
||||||
|
</Flex>
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={'auto'}>
|
||||||
|
{[...Array(1)].map((_, x) => (
|
||||||
|
<Box mb={10} key={x}>
|
||||||
|
<Skeleton height={20} width={"100%"} radius={"md"} />
|
||||||
|
<Skeleton height={20} width={"100%"} radius={"md"} mt={10} />
|
||||||
|
</Box>
|
||||||
|
))}
|
||||||
|
</Grid.Col>
|
||||||
|
</Grid>
|
||||||
|
</Box>
|
||||||
|
))
|
||||||
|
:
|
||||||
|
_.isEmpty(isData)
|
||||||
|
?
|
||||||
|
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '60vh' }}>
|
||||||
|
<Text c="dimmed" ta={"center"} fs={"italic"}>Tidak ada history</Text>
|
||||||
|
</Box>
|
||||||
|
:
|
||||||
|
isData.map((v, i) => {
|
||||||
return (
|
return (
|
||||||
<Grid key={i}>
|
<Grid key={i}>
|
||||||
<Grid.Col span={2}>
|
<Grid.Col span={2}>
|
||||||
@@ -117,7 +109,8 @@ export default function HistoryDivisionCalender() {
|
|||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
)
|
)
|
||||||
})}
|
})
|
||||||
|
}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -22,6 +22,15 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
const memberValue = memberUser.get() as IFormMemberCalender[]
|
const memberValue = memberUser.get() as IFormMemberCalender[]
|
||||||
const [openMember, setOpenMember] = useState(false)
|
const [openMember, setOpenMember] = useState(false)
|
||||||
const param = useParams<{ id: string, detail: string }>()
|
const param = useParams<{ id: string, detail: string }>()
|
||||||
|
const [touched, setTouched] = useState({
|
||||||
|
title: false,
|
||||||
|
dateStart: false,
|
||||||
|
timeStart: false,
|
||||||
|
timeEnd: false,
|
||||||
|
linkMeet: false,
|
||||||
|
repeatEventTyper: false,
|
||||||
|
desc: false
|
||||||
|
})
|
||||||
const [isData, setData] = useState({
|
const [isData, setData] = useState({
|
||||||
idDivision: "",
|
idDivision: "",
|
||||||
title: "",
|
title: "",
|
||||||
@@ -89,6 +98,7 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
<Stack>
|
<Stack>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
required
|
||||||
styles={{
|
styles={{
|
||||||
input: {
|
input: {
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
@@ -96,12 +106,19 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
size="md"
|
size="md"
|
||||||
placeholder="Event Nama"
|
placeholder="Nama Acara"
|
||||||
label="Event Nama"
|
label="Nama Acara"
|
||||||
value={isData.title}
|
value={isData.title}
|
||||||
onChange={(event) => setData({ ...isData, title: event.target.value })}
|
onChange={(event) => setData({ ...isData, title: event.target.value })}
|
||||||
|
onBlur={() => setTouched({ ...touched, title: true })}
|
||||||
|
error={
|
||||||
|
touched.title && (
|
||||||
|
isData.title == "" ? "Nama Acara Tidak Boleh Kosong" : null
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<DateInput
|
<DateInput
|
||||||
|
required
|
||||||
styles={{
|
styles={{
|
||||||
input: {
|
input: {
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
@@ -117,11 +134,18 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
placeholder="Input Tanggal"
|
placeholder="Input Tanggal"
|
||||||
label="Tanggal"
|
label="Tanggal"
|
||||||
minDate={new Date()}
|
minDate={new Date()}
|
||||||
|
onBlur={() => setTouched({ ...touched, dateStart: true })}
|
||||||
|
error={
|
||||||
|
touched.dateStart && (
|
||||||
|
isData.dateStart == "" ? "Tanggal Tidak Boleh Kosong" : null
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<SimpleGrid
|
<SimpleGrid
|
||||||
cols={{ base: 2, sm: 2, lg: 2 }}
|
cols={{ base: 2, sm: 2, lg: 2 }}
|
||||||
>
|
>
|
||||||
<TimeInput
|
<TimeInput
|
||||||
|
required
|
||||||
styles={{
|
styles={{
|
||||||
input: {
|
input: {
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
@@ -132,8 +156,15 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
label="Waktu Awal"
|
label="Waktu Awal"
|
||||||
value={isData.timeStart}
|
value={isData.timeStart}
|
||||||
onChange={(event) => setData({ ...isData, timeStart: event.target.value })}
|
onChange={(event) => setData({ ...isData, timeStart: event.target.value })}
|
||||||
|
onBlur={() => setTouched({ ...touched, timeStart: true })}
|
||||||
|
error={
|
||||||
|
touched.timeStart && (
|
||||||
|
isData.timeStart == "" ? "Waktu Awal Tidak Boleh Kosong" : null
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<TimeInput
|
<TimeInput
|
||||||
|
required
|
||||||
styles={{
|
styles={{
|
||||||
input: {
|
input: {
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
@@ -144,9 +175,16 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
label="Waktu Akhir"
|
label="Waktu Akhir"
|
||||||
value={isData.timeEnd}
|
value={isData.timeEnd}
|
||||||
onChange={(event) => setData({ ...isData, timeEnd: event.target.value })}
|
onChange={(event) => setData({ ...isData, timeEnd: event.target.value })}
|
||||||
|
onBlur={() => setTouched({ ...touched, timeEnd: true })}
|
||||||
|
error={
|
||||||
|
touched.timeEnd && (
|
||||||
|
isData.timeEnd == "" ? "Waktu Akhir Tidak Boleh Kosong" : null
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
required
|
||||||
styles={{
|
styles={{
|
||||||
input: {
|
input: {
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
@@ -158,8 +196,15 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
label="Link Meet"
|
label="Link Meet"
|
||||||
value={isData.linkMeet}
|
value={isData.linkMeet}
|
||||||
onChange={(event) => setData({ ...isData, linkMeet: event.target.value })}
|
onChange={(event) => setData({ ...isData, linkMeet: event.target.value })}
|
||||||
|
onBlur={() => setTouched({ ...touched, linkMeet: true })}
|
||||||
|
error={
|
||||||
|
touched.linkMeet && (
|
||||||
|
isData.linkMeet == "" ? "Link Meet Tidak Boleh Kosong" : null
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Select
|
<Select
|
||||||
|
required
|
||||||
styles={{
|
styles={{
|
||||||
input: {
|
input: {
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
@@ -180,20 +225,13 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
onChange={(val: any) =>
|
onChange={(val: any) =>
|
||||||
setData({ ...isData, repeatEventTyper: val })
|
setData({ ...isData, repeatEventTyper: val })
|
||||||
}
|
}
|
||||||
|
onBlur={() => setTouched({ ...touched, repeatEventTyper: true })}
|
||||||
|
error={
|
||||||
|
touched.repeatEventTyper && (
|
||||||
|
isData.repeatEventTyper == "" ? "Ulangi Event Tidak Boleh Kosong" : null
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
<Box mt={5} onClick={() => setOpenMember(true)}>
|
|
||||||
<Group
|
|
||||||
justify="space-between"
|
|
||||||
p={10}
|
|
||||||
style={{
|
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
|
||||||
borderRadius: 10,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Text>Tambah Anggota</Text>
|
|
||||||
<IoIosArrowDropright size={25} />
|
|
||||||
</Group>
|
|
||||||
</Box>
|
|
||||||
<Textarea styles={{
|
<Textarea styles={{
|
||||||
input: {
|
input: {
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
@@ -204,6 +242,19 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
size="md" placeholder='Deskripsi' label="Deskripsi"
|
size="md" placeholder='Deskripsi' label="Deskripsi"
|
||||||
onChange={(event) => setData({ ...isData, desc: event.target.value })}
|
onChange={(event) => setData({ ...isData, desc: event.target.value })}
|
||||||
/>
|
/>
|
||||||
|
<Box mt={5} onClick={() => setOpenMember(true)}>
|
||||||
|
<Group
|
||||||
|
justify="space-between"
|
||||||
|
p={10}
|
||||||
|
style={{
|
||||||
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
|
borderRadius: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text>Tambah Anggota *</Text>
|
||||||
|
<IoIosArrowDropright size={25} />
|
||||||
|
</Group>
|
||||||
|
</Box>
|
||||||
{
|
{
|
||||||
memberUser.length > 0 &&
|
memberUser.length > 0 &&
|
||||||
<Box pt={30}>
|
<Box pt={30}>
|
||||||
@@ -248,7 +299,6 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
}
|
}
|
||||||
|
|
||||||
<Box mt={"xl"}>
|
<Box mt={"xl"}>
|
||||||
<Button
|
<Button
|
||||||
c={"white"}
|
c={"white"}
|
||||||
@@ -256,7 +306,20 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
size="lg"
|
size="lg"
|
||||||
radius={30}
|
radius={30}
|
||||||
fullWidth
|
fullWidth
|
||||||
onClick={() => setModal(true)}
|
onClick={() => {
|
||||||
|
if (
|
||||||
|
isData.title !== "" &&
|
||||||
|
isData.dateStart !== " " &&
|
||||||
|
isData.timeStart !== "" &&
|
||||||
|
isData.timeEnd !== "" &&
|
||||||
|
isData.linkMeet !== "" &&
|
||||||
|
isData.repeatEventTyper !== ""
|
||||||
|
) {
|
||||||
|
setModal(true);
|
||||||
|
} else {
|
||||||
|
toast.error("Mohon lengkapi semua form");
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Simpan
|
Simpan
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { ActionIcon, Avatar, Badge, Box, Center, Divider, Flex, Grid, Group, Skeleton, Text, TextInput } from "@mantine/core";
|
import { ActionIcon, Avatar, Badge, Box, Center, Divider, Flex, Grid, Group, Skeleton, Spoiler, Text, TextInput } from "@mantine/core";
|
||||||
import { SkeletonDetailDiscussionComment, SkeletonDetailDiscussionMember, SkeletonSingle, WARNA } from "@/module/_global";
|
import { SkeletonDetailDiscussionComment, SkeletonDetailDiscussionMember, SkeletonSingle, WARNA } from "@/module/_global";
|
||||||
import { GrChatOption } from "react-icons/gr";
|
import { GrChatOption } from "react-icons/gr";
|
||||||
import { LuSendHorizonal } from "react-icons/lu";
|
import { LuSendHorizonal } from "react-icons/lu";
|
||||||
@@ -10,7 +10,7 @@ import { useShallowEffect } from "@mantine/hooks";
|
|||||||
import { IDetailDiscussion } from "../lib/type_discussion";
|
import { IDetailDiscussion } from "../lib/type_discussion";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import "moment/locale/id";
|
import "moment/locale/id";
|
||||||
import { useParams } from "next/navigation";
|
import { useParams, useRouter } from "next/navigation";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
|
|
||||||
export default function DetailDiscussion({ id, idDivision }: { id: string, idDivision: string }) {
|
export default function DetailDiscussion({ id, idDivision }: { id: string, idDivision: string }) {
|
||||||
@@ -18,6 +18,7 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
|||||||
const [isComent, setIsComent] = useState("")
|
const [isComent, setIsComent] = useState("")
|
||||||
const param = useParams<{ id: string, detail: string }>()
|
const param = useParams<{ id: string, detail: string }>()
|
||||||
const [isLoad, setIsLoad] = useState(true)
|
const [isLoad, setIsLoad] = useState(true)
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -77,8 +78,8 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
|||||||
<Group>
|
<Group>
|
||||||
<Skeleton width={60} height={60} radius={100} />
|
<Skeleton width={60} height={60} radius={100} />
|
||||||
<Box>
|
<Box>
|
||||||
<Skeleton width={"50%"} height={20} radius={"md"} />
|
<Skeleton width={100} height={20} radius={"md"} />
|
||||||
<Skeleton width={"50%"} height={20} radius={"md"} />
|
<Skeleton mt={8} width={60} height={20} radius={"md"} />
|
||||||
</Box>
|
</Box>
|
||||||
</Group>
|
</Group>
|
||||||
<Skeleton width={"50%"} height={20} radius={"md"} />
|
<Skeleton width={"50%"} height={20} radius={"md"} />
|
||||||
@@ -109,7 +110,16 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
|||||||
<Text c={"grey"} fz={13}>{isData?.createdAt}</Text>
|
<Text c={"grey"} fz={13}>{isData?.createdAt}</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Box mt={10}>
|
<Box mt={10}>
|
||||||
<Text fw={"bold"}>{isData?.desc}</Text>
|
<Spoiler maxHeight={50} showLabel="Lebih banyak" hideLabel="Lebih sedikit">
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
overflowWrap: "break-word"
|
||||||
|
}}
|
||||||
|
fw={"bold"}
|
||||||
|
>
|
||||||
|
{isData?.desc}
|
||||||
|
</Text>
|
||||||
|
</Spoiler>
|
||||||
</Box>
|
</Box>
|
||||||
<Group justify="space-between" mt={20} c={'#8C8C8C'}>
|
<Group justify="space-between" mt={20} c={'#8C8C8C'}>
|
||||||
{isData?.totalComments ? <Group gap={5} align="center">
|
{isData?.totalComments ? <Group gap={5} align="center">
|
||||||
@@ -135,8 +145,7 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
|||||||
<Group>
|
<Group>
|
||||||
<Skeleton width={40} height={40} radius={100} />
|
<Skeleton width={40} height={40} radius={100} />
|
||||||
<Box>
|
<Box>
|
||||||
<Skeleton width={"50%"} height={20} radius={"md"} />
|
<Skeleton width={60} height={20} radius={"md"} />
|
||||||
<Skeleton width={"50%"} height={20} radius={"md"} />
|
|
||||||
</Box>
|
</Box>
|
||||||
</Group>
|
</Group>
|
||||||
<Skeleton width={"50%"} height={20} radius={"md"} />
|
<Skeleton width={"50%"} height={20} radius={"md"} />
|
||||||
@@ -170,7 +179,17 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
|||||||
</Group>
|
</Group>
|
||||||
<Text c={"grey"} fz={13}>{moment(v.createdAt).format("LL")}</Text>
|
<Text c={"grey"} fz={13}>{moment(v.createdAt).format("LL")}</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Box mt={10}>{v.comment}</Box>
|
<Box mt={10}>
|
||||||
|
<Spoiler maxHeight={50} showLabel="Lebih banyak" hideLabel="Lebih sedikit">
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
overflowWrap: "break-word"
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v.comment}
|
||||||
|
</Text>
|
||||||
|
</Spoiler>
|
||||||
|
</Box>
|
||||||
<Box mt={20}>
|
<Box mt={20}>
|
||||||
<Divider size={"xs"} />
|
<Divider size={"xs"} />
|
||||||
</Box>
|
</Box>
|
||||||
@@ -182,12 +201,14 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
|||||||
{isLoad ?
|
{isLoad ?
|
||||||
<Skeleton width={"100%"} height={50} radius={100} />
|
<Skeleton width={"100%"} height={50} radius={100} />
|
||||||
:
|
:
|
||||||
<Box h={60} pos={"fixed"} bottom={20} w={{ base: "90%", md: "35.5%" }} style={{
|
<Box pos={"fixed"} bottom={0} w={{ base: "90%", md: "35.5%" }} style={{
|
||||||
zIndex: 999
|
zIndex: 999
|
||||||
}}>
|
}} bg={WARNA.bgWhite}>
|
||||||
|
<Box bg={WARNA.bgWhite} >
|
||||||
<Group justify="flex-end">
|
<Group justify="flex-end">
|
||||||
<Text fz={13}>{300 - isComent.length} karakter tersisa</Text>
|
<Text fz={13}>{300 - isComent.length} karakter tersisa</Text>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Box mb={20} bg={WARNA.bgWhite}>
|
||||||
<Grid bg={"white"} style={{
|
<Grid bg={"white"} style={{
|
||||||
border: '1px solid gray',
|
border: '1px solid gray',
|
||||||
borderRadius: 40
|
borderRadius: 40
|
||||||
@@ -221,6 +242,8 @@ export default function DetailDiscussion({ id, idDivision }: { id: string, idDiv
|
|||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Box>
|
</Box>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
}
|
}
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ export default function DrawerDetailDiscussion({ onSuccess, id, status, idDivisi
|
|||||||
<Stack pt={10}>
|
<Stack pt={10}>
|
||||||
<SimpleGrid
|
<SimpleGrid
|
||||||
cols={{ base: 3, sm: 3, lg: 3 }}
|
cols={{ base: 3, sm: 3, lg: 3 }}
|
||||||
|
spacing={{ base: 10, sm: 'xl' }}
|
||||||
|
verticalSpacing={{ base: 'md', sm: 'xl' }}
|
||||||
>
|
>
|
||||||
<Flex onClick={() => setValModal(true)} justify={'center'} align={'center'} direction={'column'} >
|
<Flex onClick={() => setValModal(true)} justify={'center'} align={'center'} direction={'column'} >
|
||||||
<Box>
|
<Box>
|
||||||
|
|||||||
@@ -5,24 +5,20 @@ import { Avatar, Box, Button, Center, Grid, Group, Text, Textarea } from "@manti
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { funCreateDiscussion } from "../lib/api_discussion";
|
import { funCreateDiscussion } from "../lib/api_discussion";
|
||||||
|
import { useParams, useRouter } from "next/navigation";
|
||||||
|
|
||||||
export default function FormCreateDiscussion({id}: {id: string}) {
|
export default function FormCreateDiscussion({ id }: { id: string }) {
|
||||||
const [isValModal, setValModal] = useState(false)
|
const [isValModal, setValModal] = useState(false)
|
||||||
|
const router = useRouter()
|
||||||
|
const param = useParams<{ id: string }>()
|
||||||
const [isData, setData] = useState({
|
const [isData, setData] = useState({
|
||||||
desc: "",
|
desc: "",
|
||||||
idDivision: id
|
idDivision: id
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
function onTrue(val: boolean) {
|
|
||||||
if (val) {
|
|
||||||
toast.success("Sukses! Data tersimpan");
|
|
||||||
}
|
|
||||||
setValModal(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function createDiscussion(val: boolean) {
|
async function createDiscussion(val: boolean) {
|
||||||
try {
|
try {
|
||||||
|
if (val) {
|
||||||
const response = await funCreateDiscussion({
|
const response = await funCreateDiscussion({
|
||||||
desc: isData.desc,
|
desc: isData.desc,
|
||||||
idDivision: id
|
idDivision: id
|
||||||
@@ -30,10 +26,12 @@ export default function FormCreateDiscussion({id}: {id: string}) {
|
|||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
toast.success(response.message)
|
toast.success(response.message)
|
||||||
onTrue(true)
|
router.push(`/division/${response.data.id}/discussion/`)
|
||||||
|
setValModal(false)
|
||||||
} else {
|
} else {
|
||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
toast.error("Gagal menambahkan diskusi, coba lagi nanti");
|
toast.error("Gagal menambahkan diskusi, coba lagi nanti");
|
||||||
@@ -45,25 +43,30 @@ export default function FormCreateDiscussion({id}: {id: string}) {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box pos={"relative"} h={"89vh"}>
|
||||||
<Box p={20}>
|
<Box p={20} >
|
||||||
<Group>
|
<Grid gutter={0} pt={10}>
|
||||||
|
<Grid.Col span={"auto"}>
|
||||||
<Avatar src={'https://i.pravatar.cc/1000?img=32'} alt="it's me" size="lg" />
|
<Avatar src={'https://i.pravatar.cc/1000?img=32'} alt="it's me" size="lg" />
|
||||||
|
</Grid.Col>
|
||||||
|
<Grid.Col span={10}>
|
||||||
<Box>
|
<Box>
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder="Tuliskan apa yang ingin anda diskusikan"
|
placeholder="Tuliskan apa yang ingin anda diskusikan"
|
||||||
w={"100%"}
|
|
||||||
styles={{
|
styles={{
|
||||||
input: {
|
input: {
|
||||||
border: 'none',
|
border: 'none',
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
|
height: "60vh"
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
value={isData.desc}
|
||||||
onChange={(e) => setData({ ...isData, desc: e.target.value })}
|
onChange={(e) => setData({ ...isData, desc: e.target.value })}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</Group>
|
</Grid.Col>
|
||||||
<Box mt="xl">
|
</Grid>
|
||||||
|
<Box pos={"absolute"} bottom={10} left={0} right={0} p={20}>
|
||||||
<Button
|
<Button
|
||||||
color="white"
|
color="white"
|
||||||
bg={WARNA.biruTua}
|
bg={WARNA.biruTua}
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ export default function FormEditDiscussion() {
|
|||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</Grid.Col>
|
</Grid.Col>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Box mt="xl">
|
<Box mt="xl">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { WARNA } from "@/module/_global";
|
import { WARNA } from "@/module/_global";
|
||||||
import { Avatar, Badge, Box, Divider, Flex, Group, Skeleton, Text, TextInput } from "@mantine/core";
|
import { Avatar, Badge, Box, Divider, Flex, Group, Skeleton, Spoiler, Text, TextInput } from "@mantine/core";
|
||||||
import { useParams, useRouter, useSearchParams } from "next/navigation";
|
import { useParams, useRouter, useSearchParams } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { GrChatOption } from "react-icons/gr";
|
import { GrChatOption } from "react-icons/gr";
|
||||||
@@ -62,20 +62,20 @@ export default function ListDiscussion({ id }: { id: string }) {
|
|||||||
mt={20}
|
mt={20}
|
||||||
>
|
>
|
||||||
<Group>
|
<Group>
|
||||||
<Skeleton width={40} height={40} radius={"md"} />
|
<Skeleton width={60} height={60} radius={100} />
|
||||||
<Box>
|
<Box>
|
||||||
<Skeleton width={"50%"} height={20} radius={"md"} />
|
<Skeleton width={100} height={20} radius={"md"} />
|
||||||
<Skeleton width={"50%"} height={20} radius={"md"} />
|
<Skeleton mt={8} width={60} height={20} radius={"md"} />
|
||||||
</Box>
|
</Box>
|
||||||
</Group>
|
</Group>
|
||||||
<Skeleton width={"50%"} height={20} radius={"md"} />
|
<Skeleton width={"40%"} height={20} radius={"md"} />
|
||||||
</Flex>
|
</Flex>
|
||||||
<Box mt={10}>
|
<Box mt={10}>
|
||||||
<Skeleton width={"100%"} height={100} radius={"md"} />
|
<Skeleton width={"100%"} height={100} radius={"md"} />
|
||||||
</Box>
|
</Box>
|
||||||
<Group justify="space-between" mt={20} c={'#8C8C8C'}>
|
<Group justify="space-between" mt={20} c={'#8C8C8C'}>
|
||||||
<Skeleton width={"30%"} height={20} radius={"md"} />
|
<Skeleton width={"20%"} height={20} radius={"md"} />
|
||||||
<Skeleton width={"30%"} height={20} radius={"md"} />
|
<Skeleton width={"20%"} height={20} radius={"md"} />
|
||||||
</Group>
|
</Group>
|
||||||
<Box mt={20}>
|
<Box mt={20}>
|
||||||
<Skeleton width={"100%"} height={1} radius={"md"} />
|
<Skeleton width={"100%"} height={1} radius={"md"} />
|
||||||
@@ -86,15 +86,14 @@ export default function ListDiscussion({ id }: { id: string }) {
|
|||||||
:
|
:
|
||||||
isData.map((v, i) => {
|
isData.map((v, i) => {
|
||||||
return (
|
return (
|
||||||
<Box key={i} pl={10} pr={10}
|
<Box key={i} pl={10} pr={10}>
|
||||||
onClick={() => {
|
|
||||||
router.push(`/division/${param.id}/discussion/${v.id}`)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Flex
|
<Flex
|
||||||
justify={"space-between"}
|
justify={"space-between"}
|
||||||
align={"center"}
|
align={"center"}
|
||||||
mt={20}
|
mt={20}
|
||||||
|
onClick={() => {
|
||||||
|
router.push(`/division/${param.id}/discussion/${v.id}`)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Group>
|
<Group>
|
||||||
<Avatar alt="it's me" size="lg" />
|
<Avatar alt="it's me" size="lg" />
|
||||||
@@ -107,8 +106,21 @@ export default function ListDiscussion({ id }: { id: string }) {
|
|||||||
</Group>
|
</Group>
|
||||||
<Text c={"grey"} fz={13}>{v.createdAt}</Text>
|
<Text c={"grey"} fz={13}>{v.createdAt}</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
<Box mt={10}>{v.desc}</Box>
|
<Box mt={10}>
|
||||||
<Group justify="space-between" mt={20} c={'#8C8C8C'}>
|
<Spoiler maxHeight={50} showLabel="Lebih banyak" hideLabel="Lebih sedikit">
|
||||||
|
<Text
|
||||||
|
style={{
|
||||||
|
overflowWrap: "break-word"
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
router.push(`/division/${param.id}/discussion/${v.id}`)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{v.desc}
|
||||||
|
</Text>
|
||||||
|
</Spoiler>
|
||||||
|
</Box>
|
||||||
|
<Group justify="space-between" mt={40} c={'#8C8C8C'}>
|
||||||
<Group gap={5} align="center">
|
<Group gap={5} align="center">
|
||||||
<GrChatOption size={18} />
|
<GrChatOption size={18} />
|
||||||
<Text fz={13}>Diskusikan</Text>
|
<Text fz={13}>Diskusikan</Text>
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import { ActionIcon } from "@mantine/core";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { HiMenu } from "react-icons/hi";
|
import { HiMenu } from "react-icons/hi";
|
||||||
import DrawerDetailDiscussion from "./drawer_detail_discussion";
|
import DrawerDetailDiscussion from "./drawer_detail_discussion";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
|
|
||||||
export default function NavbarDetailDiscussion({id, status, idDivision}: {id: string, status: number, idDivision:string}) {
|
export default function NavbarDetailDiscussion({id, status, idDivision}: {id: string, status: number, idDivision:string}) {
|
||||||
const [openDrawer, setOpenDrawer] = useState(false)
|
const [openDrawer, setOpenDrawer] = useState(false)
|
||||||
|
const param = useParams<{ id: string }>()
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LayoutNavbarNew back="" title="Diskusi "
|
<LayoutNavbarNew back={`/division/${param.id}/discussion/`} title="Diskusi "
|
||||||
menu={
|
menu={
|
||||||
<ActionIcon variant="light" onClick={() => setOpenDrawer(true)} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
|
<ActionIcon variant="light" onClick={() => setOpenDrawer(true)} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
|
||||||
<HiMenu size={20} color='white' />
|
<HiMenu size={20} color='white' />
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import { ActionIcon } from "@mantine/core";
|
|||||||
import { HiMenu } from "react-icons/hi";
|
import { HiMenu } from "react-icons/hi";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import DrawerListDiscussion from "./drawer_list_discussion";
|
import DrawerListDiscussion from "./drawer_list_discussion";
|
||||||
|
import { useParams } from "next/navigation";
|
||||||
|
|
||||||
export default function NavbarListDiscussion() {
|
export default function NavbarListDiscussion() {
|
||||||
const [openDrawer, setOpenDrawer] = useState(false)
|
const [openDrawer, setOpenDrawer] = useState(false)
|
||||||
|
const param = useParams<{ id: string }>()
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LayoutNavbarNew back="" title="Diskusi"
|
<LayoutNavbarNew back={`/division/${param.id}`} title="Diskusi"
|
||||||
menu={
|
menu={
|
||||||
<ActionIcon variant="light" onClick={() => setOpenDrawer(true)} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
|
<ActionIcon variant="light" onClick={() => setOpenDrawer(true)} bg={WARNA.bgIcon} size="lg" radius="lg" aria-label="Settings">
|
||||||
<HiMenu size={20} color='white' />
|
<HiMenu size={20} color='white' />
|
||||||
|
|||||||
@@ -77,18 +77,10 @@ export default function EditDivision() {
|
|||||||
}, [param.id])
|
}, [param.id])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box pos={"relative"} h={"100vh"}>
|
||||||
<LayoutNavbarNew back="" title="Edit Divisi" menu />
|
<LayoutNavbarNew back="" title="Edit Divisi" menu />
|
||||||
<Box p={20}>
|
<Box p={20}>
|
||||||
|
|
||||||
<Stack>
|
<Stack>
|
||||||
{/* <Select
|
|
||||||
placeholder="Grup"
|
|
||||||
label="Grup"
|
|
||||||
size="md"
|
|
||||||
required
|
|
||||||
radius={40}
|
|
||||||
/> */}
|
|
||||||
<TextInput
|
<TextInput
|
||||||
placeholder="Judul"
|
placeholder="Judul"
|
||||||
label="Judul"
|
label="Judul"
|
||||||
@@ -101,8 +93,14 @@ export default function EditDivision() {
|
|||||||
<Textarea placeholder="Deskripsi" label="Deskripsi" size="md" radius={10}
|
<Textarea placeholder="Deskripsi" label="Deskripsi" size="md" radius={10}
|
||||||
value={body.desc}
|
value={body.desc}
|
||||||
onChange={(e) => { setBody({ ...body, desc: e.currentTarget.value }) }}
|
onChange={(e) => { setBody({ ...body, desc: e.currentTarget.value }) }}
|
||||||
|
styles={{
|
||||||
|
input: {
|
||||||
|
height: "40vh"
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<Box mt="xl">
|
</Stack>
|
||||||
|
<Box pos={"absolute"} bottom={10} left={0} right={0} p={20}>
|
||||||
<Button
|
<Button
|
||||||
color="white"
|
color="white"
|
||||||
bg={WARNA.biruTua}
|
bg={WARNA.biruTua}
|
||||||
@@ -114,7 +112,6 @@ export default function EditDivision() {
|
|||||||
Simpan
|
Simpan
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
|
||||||
</Box>
|
</Box>
|
||||||
<LayoutModal opened={openModal} onClose={() => setOpenModal(false)} description='Apakah Anda yakin ingin edit data'
|
<LayoutModal opened={openModal} onClose={() => setOpenModal(false)} description='Apakah Anda yakin ingin edit data'
|
||||||
onYes={(val) => {
|
onYes={(val) => {
|
||||||
|
|||||||
@@ -141,7 +141,10 @@ export default function InformationDivision() {
|
|||||||
<Group
|
<Group
|
||||||
align="center"
|
align="center"
|
||||||
style={{
|
style={{
|
||||||
|
border: `1px solid ${"#DCEED8"}`,
|
||||||
padding: 10,
|
padding: 10,
|
||||||
|
borderRadius: 10,
|
||||||
|
cursor: "pointer",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box>
|
<Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user