fix: task
Deskripsi: - progress error - data tugas kosong - file kosong - anggota kosong - csv dimatiin - modal konfirmasi loading No Issues
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
import { CreateTask, FileSave } from "@/module/task";
|
||||
import { CreateTask } from "@/module/task";
|
||||
|
||||
function Page({ searchParams }: { searchParams: any }) {
|
||||
|
||||
// if (searchParams.page == "file-save")
|
||||
// return <FileSave kategori="task" />
|
||||
|
||||
return <CreateTask />
|
||||
}
|
||||
|
||||
|
||||
@@ -44,14 +44,23 @@ export async function GET(request: Request, context: { params: { id: string } })
|
||||
}
|
||||
})
|
||||
|
||||
const semua = dataProgress.length
|
||||
const selesai = _.filter(dataProgress, { status: 1 }).length
|
||||
const progress = Math.ceil((selesai / semua) * 100)
|
||||
if (dataProgress.length > 0) {
|
||||
const semua = dataProgress.length
|
||||
const selesai = _.filter(dataProgress, { status: 1 }).length
|
||||
const progress = Math.ceil((selesai / semua) * 100)
|
||||
|
||||
allData = {
|
||||
progress: progress,
|
||||
lastUpdate: moment(dataProgress[0].updatedAt).format("DD MMMM YYYY"),
|
||||
allData = {
|
||||
progress: progress,
|
||||
lastUpdate: moment(dataProgress[0]?.updatedAt).format("DD MMMM YYYY"),
|
||||
}
|
||||
} else {
|
||||
allData = {
|
||||
progress: 0,
|
||||
lastUpdate: '1 Januari 1999',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else if (kategori == "task") {
|
||||
const dataProgress = await prisma.divisionProjectTask.findMany({
|
||||
where: {
|
||||
|
||||
@@ -68,6 +68,9 @@ export async function GET(request: Request) {
|
||||
idUser: true
|
||||
}
|
||||
}
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: "desc"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ export default function LayoutModal({ opened, onClose, description, onYes }: { o
|
||||
<Button loading={loading} fullWidth size="lg" radius={'xl'} bg={'green'} onClick={() => {
|
||||
setLoading(true)
|
||||
onYes(true)
|
||||
setLoading(false)
|
||||
}}>YA</Button>
|
||||
<Button fullWidth size="lg" radius={'xl'} bg={'#F1C1CF'} c={'#D30B30'} onClick={() => onYes(false)}>TIDAK</Button>
|
||||
</>
|
||||
@@ -39,6 +40,7 @@ export default function LayoutModal({ opened, onClose, description, onYes }: { o
|
||||
<Button loading={loading} fullWidth size="lg" radius={'xl'} bg={'green'} onClick={() => {
|
||||
setLoading(true)
|
||||
onYes(true)
|
||||
setLoading(false)
|
||||
}}>YA</Button>
|
||||
</>
|
||||
|
||||
|
||||
@@ -98,9 +98,9 @@ export default function AddFileDetailTask() {
|
||||
}}
|
||||
activateOnClick={false}
|
||||
maxSize={3 * 1024 ** 2}
|
||||
accept={['text/csv', 'image/png', 'image/jpeg', 'image/heic', 'application/pdf']}
|
||||
accept={['image/png', 'image/jpeg', 'image/heic', 'application/pdf']}
|
||||
onReject={(files) => {
|
||||
return toast.error('File yang diizinkan: .csv, .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
||||
return toast.error('File yang diizinkan: .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
||||
}}
|
||||
>
|
||||
</Dropzone>
|
||||
|
||||
@@ -304,9 +304,9 @@ export default function CreateTask() {
|
||||
}}
|
||||
activateOnClick={false}
|
||||
maxSize={3 * 1024 ** 2}
|
||||
accept={['text/csv', 'image/png', 'image/jpeg', 'image/heic', 'application/pdf']}
|
||||
accept={['image/png', 'image/jpeg', 'image/heic', 'application/pdf']}
|
||||
onReject={(files) => {
|
||||
return toast.error('File yang diizinkan: .csv, .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
||||
return toast.error('File yang diizinkan: .png, .jpg, .heic, .pdf dengan ukuran maksimal 3 MB')
|
||||
}}
|
||||
></Dropzone>
|
||||
|
||||
|
||||
@@ -100,9 +100,8 @@ export default function ListAnggotaDetailTask() {
|
||||
style={{
|
||||
border: `1px solid ${"#C7D6E8"}`,
|
||||
borderRadius: 10,
|
||||
padding: 20
|
||||
}}
|
||||
px={20}
|
||||
py={10}
|
||||
>
|
||||
{
|
||||
loading ?
|
||||
@@ -114,7 +113,7 @@ export default function ListAnggotaDetailTask() {
|
||||
</Box>
|
||||
))
|
||||
:
|
||||
isData.length === 0 ? <Text>Tidak ada anggota</Text> :
|
||||
isData.length === 0 ? <Text c={"dimmed"} ta={"center"} fs={"italic"}>Tidak ada anggota</Text> :
|
||||
isData.map((v, i) => {
|
||||
return (
|
||||
<Box key={i}>
|
||||
|
||||
@@ -109,7 +109,7 @@ export default function ListFileDetailTask() {
|
||||
</Box>
|
||||
))
|
||||
:
|
||||
isData.length === 0 ? <Text>Tidak ada file</Text> :
|
||||
isData.length === 0 ? <Text c={"dimmed"} ta={"center"} fs={"italic"}>Tidak ada file</Text> :
|
||||
isData.map((item, index) => {
|
||||
return (
|
||||
<Box
|
||||
|
||||
@@ -118,9 +118,8 @@ export default function ListTugasDetailTask() {
|
||||
style={{
|
||||
borderRadius: 10,
|
||||
border: `1px solid ${"#D6D8F6"}`,
|
||||
padding:20
|
||||
}}
|
||||
pl={20}
|
||||
pr={20}
|
||||
>
|
||||
{
|
||||
loading ?
|
||||
@@ -130,7 +129,7 @@ export default function ListTugasDetailTask() {
|
||||
</Box>
|
||||
</>
|
||||
:
|
||||
isData.length === 0 ? <Text>Tidak ada tugas</Text> :
|
||||
isData.length === 0 ? <Text c={"dimmed"} ta={"center"} fs={"italic"}>Tidak ada tugas</Text> :
|
||||
isData.map((item, index) => {
|
||||
return (
|
||||
<Box key={index}>
|
||||
|
||||
Reference in New Issue
Block a user