feat : update revisi
Deskripsi: - update tambah anggota - update list anggota - update tambah kalender - update kalender name indonesia No Issue
This commit is contained in:
@@ -102,22 +102,6 @@ export async function POST(request: Request) {
|
|||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, data tidak ditemukan" }, { status: 404 });
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan divisi, data tidak ditemukan" }, { status: 404 });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeStart > timeEnd) {
|
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan calender, waktu mulai harus lebih kecil dari waktu berakhir" }, { status: 404 });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dateStart > dateEnd) {
|
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan calender, Tanggal mulai harus lebih kecil dari Tanggal berakhir" }, { status: 404 });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dateStart < moment().format("YYYY-MM-DD")) {
|
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan calender, Tanggal mulai harus lebih kecil dari Tanggal sekarang" }, { status: 404 });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dateEnd < moment().format("YYYY-MM-DD")) {
|
|
||||||
return NextResponse.json({ success: false, message: "Gagal mendapatkan calender, Tanggal berakhir harus lebih kecil dari Tanggal sekarang" }, { status: 404 });
|
|
||||||
}
|
|
||||||
|
|
||||||
const statusCalender = 0
|
const statusCalender = 0
|
||||||
|
|
||||||
const y = new Date('1970-01-01 ' + timeStart)
|
const y = new Date('1970-01-01 ' + timeStart)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { funGetDivisionById, IDataMemberDivision } from '@/module/division_new';
|
|||||||
import { useHookstate } from '@hookstate/core';
|
import { useHookstate } from '@hookstate/core';
|
||||||
import toast from 'react-hot-toast';
|
import toast from 'react-hot-toast';
|
||||||
import { useShallowEffect } from '@mantine/hooks';
|
import { useShallowEffect } from '@mantine/hooks';
|
||||||
import { LayoutNavbarNew, WARNA } from '@/module/_global';
|
import { LayoutNavbarNew, SkeletonSingle, WARNA } from '@/module/_global';
|
||||||
import { Avatar, Box, Button, Divider, Flex, Group, Text } from '@mantine/core';
|
import { Avatar, Box, Button, Divider, Flex, Group, Text } from '@mantine/core';
|
||||||
import { FaCheck } from 'react-icons/fa6';
|
import { FaCheck } from 'react-icons/fa6';
|
||||||
|
|
||||||
@@ -16,21 +16,27 @@ export default function CreateUserCalender({ onClose }: { onClose: (val: any) =>
|
|||||||
const [isData, setData] = useState<IDataMemberDivision[]>([])
|
const [isData, setData] = useState<IDataMemberDivision[]>([])
|
||||||
const member = useHookstate(globalCalender)
|
const member = useHookstate(globalCalender)
|
||||||
const [selectAll, setSelectAll] = useState(false)
|
const [selectAll, setSelectAll] = useState(false)
|
||||||
|
const [loading, setLoading] = useState(true)
|
||||||
|
|
||||||
async function getData() {
|
async function getData() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await funGetDivisionById(param.id)
|
const response = await funGetDivisionById(param.id)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setData(response.data.member)
|
setData(response.data.member)
|
||||||
if (member.length > 0) {
|
if (member.length > 0) {
|
||||||
setSelectedFiles(JSON.parse(JSON.stringify(member.get())))
|
setSelectedFiles(JSON.parse(JSON.stringify(member.get())))
|
||||||
}
|
}
|
||||||
|
setLoading(false)
|
||||||
} else {
|
} else {
|
||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +95,16 @@ export default function CreateUserCalender({ onClose }: { onClose: (val: any) =>
|
|||||||
</Text>
|
</Text>
|
||||||
{selectAll ? <FaCheck style={{ marginRight: 10 }} /> : ""}
|
{selectAll ? <FaCheck style={{ marginRight: 10 }} /> : ""}
|
||||||
</Group>
|
</Group>
|
||||||
<Box mt={15}>
|
{loading ?
|
||||||
|
Array(4)
|
||||||
|
.fill(null)
|
||||||
|
.map((_, i) => (
|
||||||
|
<Box key={i}>
|
||||||
|
<SkeletonSingle />
|
||||||
|
</Box>
|
||||||
|
))
|
||||||
|
:
|
||||||
|
<Box mt={20}>
|
||||||
{isData.map((v, i) => {
|
{isData.map((v, i) => {
|
||||||
const isSelected = selectedFiles.some((i: any) => i?.idUser == v.idUser);
|
const isSelected = selectedFiles.some((i: any) => i?.idUser == v.idUser);
|
||||||
return (
|
return (
|
||||||
@@ -121,6 +136,7 @@ export default function CreateUserCalender({ onClose }: { onClose: (val: any) =>
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</Box>
|
</Box>
|
||||||
|
}
|
||||||
<Box mt={"xl"}>
|
<Box mt={"xl"}>
|
||||||
<Button
|
<Button
|
||||||
c={"white"}
|
c={"white"}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import { IDataCalender } from '../lib/type_calender';
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import toast from 'react-hot-toast';
|
import toast from 'react-hot-toast';
|
||||||
|
import 'dayjs/locale/id'
|
||||||
|
import { PiCalendarStarThin } from 'react-icons/pi';
|
||||||
|
|
||||||
|
|
||||||
export default function DateEventDivision() {
|
export default function DateEventDivision() {
|
||||||
@@ -80,7 +82,7 @@ export default function DateEventDivision() {
|
|||||||
const muncul = isListTgl.includes(coba)
|
const muncul = isListTgl.includes(coba)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Indicator size={6} color="red" offset={-5} disabled={!muncul}>
|
<Indicator color="red" offset={-3} disabled={!muncul} position='top-end' inline processing size={10} >
|
||||||
<div>{day}</div>
|
<div>{day}</div>
|
||||||
</Indicator>
|
</Indicator>
|
||||||
);
|
);
|
||||||
@@ -88,6 +90,7 @@ export default function DateEventDivision() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Group
|
<Group
|
||||||
@@ -101,6 +104,7 @@ export default function DateEventDivision() {
|
|||||||
renderDay={dayRenderer}
|
renderDay={dayRenderer}
|
||||||
onChange={(val: any) => { change(val) }}
|
onChange={(val: any) => { change(val) }}
|
||||||
onDateChange={(val) => { changeMonth(val) }}
|
onDateChange={(val) => { changeMonth(val) }}
|
||||||
|
locale='id'
|
||||||
/>
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
<Box>
|
<Box>
|
||||||
|
|||||||
@@ -62,16 +62,6 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
if (response.success) {
|
if (response.success) {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
router.push(`/division/${param.id}/calender`)
|
router.push(`/division/${param.id}/calender`)
|
||||||
setData({
|
|
||||||
...isData,
|
|
||||||
title: "",
|
|
||||||
dateStart: "",
|
|
||||||
timeStart: "",
|
|
||||||
timeEnd: "",
|
|
||||||
linkMeet: "",
|
|
||||||
repeatEventTyper: "1",
|
|
||||||
desc: "",
|
|
||||||
})
|
|
||||||
toast.success(response.message)
|
toast.success(response.message)
|
||||||
memberUser.set([])
|
memberUser.set([])
|
||||||
} else {
|
} else {
|
||||||
@@ -136,7 +126,6 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
}}
|
}}
|
||||||
placeholder="Input Tanggal"
|
placeholder="Input Tanggal"
|
||||||
label="Tanggal"
|
label="Tanggal"
|
||||||
minDate={new Date()}
|
|
||||||
onBlur={() => setTouched({ ...touched, dateStart: true })}
|
onBlur={() => setTouched({ ...touched, dateStart: true })}
|
||||||
error={
|
error={
|
||||||
touched.dateStart && (
|
touched.dateStart && (
|
||||||
@@ -250,7 +239,7 @@ export default function NavbarCreateDivisionCalender() {
|
|||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text>Tambah Anggota *</Text>
|
<Text>Tambah Anggota</Text>
|
||||||
<IoIosArrowDropright size={25} />
|
<IoIosArrowDropright size={25} />
|
||||||
</Group>
|
</Group>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { LayoutNavbarNew, WARNA } from '@/module/_global';
|
import { LayoutNavbarNew, SkeletonSingle, WARNA } from '@/module/_global';
|
||||||
import { funGetDivisionById, IDataMemberDivision } from '@/module/division_new';
|
import { funGetDivisionById, IDataMemberDivision } from '@/module/division_new';
|
||||||
import { useHookstate } from '@hookstate/core';
|
import { useHookstate } from '@hookstate/core';
|
||||||
import { Avatar, Box, Button, Center, Divider, Flex, Group, SimpleGrid, Stack, Text, TextInput } from '@mantine/core';
|
import { Avatar, Box, Button, Center, Divider, Flex, Group, SimpleGrid, Stack, Text, TextInput } from '@mantine/core';
|
||||||
@@ -51,21 +51,26 @@ export default function UpdateListUsers({ onClose }: { onClose: (val: any) => vo
|
|||||||
const [isData, setData] = useState<IDataMemberDivision[]>([])
|
const [isData, setData] = useState<IDataMemberDivision[]>([])
|
||||||
const member = useHookstate(globalCalender)
|
const member = useHookstate(globalCalender)
|
||||||
const [selectAll, setSelectAll] = useState(false)
|
const [selectAll, setSelectAll] = useState(false)
|
||||||
|
const [loading, setLoading] = useState(true)
|
||||||
|
|
||||||
async function getData() {
|
async function getData() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const response = await funGetDivisionById(param.id)
|
const response = await funGetDivisionById(param.id)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setData(response.data.member)
|
setData(response.data.member)
|
||||||
if (member.length > 0) {
|
if (member.length > 0) {
|
||||||
setSelectedFiles(JSON.parse(JSON.stringify(member.get())))
|
setSelectedFiles(JSON.parse(JSON.stringify(member.get())))
|
||||||
}
|
}
|
||||||
|
setLoading(false)
|
||||||
} else {
|
} else {
|
||||||
toast.error(response.message)
|
toast.error(response.message)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
toast.error("Gagal mendapatkan anggota, coba lagi nanti");
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +129,16 @@ export default function UpdateListUsers({ onClose }: { onClose: (val: any) => vo
|
|||||||
</Text>
|
</Text>
|
||||||
{selectAll ? <FaCheck style={{ marginRight: 10 }} /> : ""}
|
{selectAll ? <FaCheck style={{ marginRight: 10 }} /> : ""}
|
||||||
</Group>
|
</Group>
|
||||||
<Box mt={15}>
|
{loading ?
|
||||||
|
Array(4)
|
||||||
|
.fill(null)
|
||||||
|
.map((_, i) => (
|
||||||
|
<Box key={i}>
|
||||||
|
<SkeletonSingle />
|
||||||
|
</Box>
|
||||||
|
))
|
||||||
|
:
|
||||||
|
<Box mt={20}>
|
||||||
{isData.map((v, i) => {
|
{isData.map((v, i) => {
|
||||||
const isSelected = selectedFiles.some((i: any) => i?.idUser == v.idUser);
|
const isSelected = selectedFiles.some((i: any) => i?.idUser == v.idUser);
|
||||||
return (
|
return (
|
||||||
@@ -156,6 +170,7 @@ export default function UpdateListUsers({ onClose }: { onClose: (val: any) => vo
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</Box>
|
</Box>
|
||||||
|
}
|
||||||
<Box mt={"xl"}>
|
<Box mt={"xl"}>
|
||||||
<Button
|
<Button
|
||||||
c={"white"}
|
c={"white"}
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ export default function CreateMember() {
|
|||||||
size="md"
|
size="md"
|
||||||
type="number"
|
type="number"
|
||||||
radius={30}
|
radius={30}
|
||||||
placeholder="87701795778"
|
placeholder="xxx xxxx xxxx"
|
||||||
leftSection={<Text>+62</Text>}
|
leftSection={<Text>+62</Text>}
|
||||||
withAsterisk
|
withAsterisk
|
||||||
label="Nomor Telepon"
|
label="Nomor Telepon"
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ export default function EditMember({ id }: { id: string }) {
|
|||||||
borderColor: WARNA.biruTua,
|
borderColor: WARNA.biruTua,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
placeholder="6287701795778"
|
placeholder="62xxx xxxx xxxx"
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setData({ ...data, phone: e.target.value })
|
setData({ ...data, phone: e.target.value })
|
||||||
setTouched({ ...touched, phone: false })
|
setTouched({ ...touched, phone: false })
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export default function NavbarDetailMember({ id }: IMember) {
|
|||||||
<FaSquarePhone size={28} />
|
<FaSquarePhone size={28} />
|
||||||
<Text fz={18}>No Telepon</Text>
|
<Text fz={18}>No Telepon</Text>
|
||||||
</Group>
|
</Group>
|
||||||
<Text fz={18} fw={'bold'} ta={"right"}>{dataOne?.phone}</Text>
|
<Text fz={18} fw={'bold'} ta={"right"}>+{dataOne?.phone}</Text>
|
||||||
</Group>
|
</Group>
|
||||||
<Group justify="space-between" grow py={5}>
|
<Group justify="space-between" grow py={5}>
|
||||||
<Group>
|
<Group>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
import { SkeletonSingle, WARNA } from "@/module/_global"
|
import { SkeletonSingle, WARNA } from "@/module/_global"
|
||||||
import { Box, Group, ActionIcon, Text, TextInput } from "@mantine/core"
|
import { Box, Group, ActionIcon, Text, TextInput, Divider } from "@mantine/core"
|
||||||
import { useShallowEffect } from "@mantine/hooks"
|
import { useShallowEffect } from "@mantine/hooks"
|
||||||
import { useRouter, useSearchParams } from "next/navigation"
|
import { useRouter, useSearchParams } from "next/navigation"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
@@ -70,11 +70,11 @@ export default function TabListMember() {
|
|||||||
:
|
:
|
||||||
dataMember.map((v, i) => {
|
dataMember.map((v, i) => {
|
||||||
return (
|
return (
|
||||||
<Box pt={20} key={i} onClick={() => {
|
<Box key={i}>
|
||||||
|
<Box onClick={() => {
|
||||||
router.push(`/member/${v.id}`)
|
router.push(`/member/${v.id}`)
|
||||||
}}>
|
}}>
|
||||||
<Group align='center' style={{
|
<Group align='center' style={{
|
||||||
borderBottom: `1px solid #D9D9D9`,
|
|
||||||
padding: 10,
|
padding: 10,
|
||||||
}} >
|
}} >
|
||||||
<Box>
|
<Box>
|
||||||
@@ -88,6 +88,8 @@ export default function TabListMember() {
|
|||||||
</Box>
|
</Box>
|
||||||
</Group>
|
</Group>
|
||||||
</Box>
|
</Box>
|
||||||
|
<Divider my={10}/>
|
||||||
|
</Box>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user