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 }) {
|
function Page({ searchParams }: { searchParams: any }) {
|
||||||
|
|
||||||
// if (searchParams.page == "file-save")
|
|
||||||
// return <FileSave kategori="task" />
|
|
||||||
|
|
||||||
return <CreateTask />
|
return <CreateTask />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,14 +44,23 @@ export async function GET(request: Request, context: { params: { id: string } })
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const semua = dataProgress.length
|
if (dataProgress.length > 0) {
|
||||||
const selesai = _.filter(dataProgress, { status: 1 }).length
|
const semua = dataProgress.length
|
||||||
const progress = Math.ceil((selesai / semua) * 100)
|
const selesai = _.filter(dataProgress, { status: 1 }).length
|
||||||
|
const progress = Math.ceil((selesai / semua) * 100)
|
||||||
|
|
||||||
allData = {
|
allData = {
|
||||||
progress: progress,
|
progress: progress,
|
||||||
lastUpdate: moment(dataProgress[0].updatedAt).format("DD MMMM YYYY"),
|
lastUpdate: moment(dataProgress[0]?.updatedAt).format("DD MMMM YYYY"),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
allData = {
|
||||||
|
progress: 0,
|
||||||
|
lastUpdate: '1 Januari 1999',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else if (kategori == "task") {
|
} else if (kategori == "task") {
|
||||||
const dataProgress = await prisma.divisionProjectTask.findMany({
|
const dataProgress = await prisma.divisionProjectTask.findMany({
|
||||||
where: {
|
where: {
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ export async function GET(request: Request) {
|
|||||||
idUser: true
|
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={() => {
|
<Button loading={loading} fullWidth size="lg" radius={'xl'} bg={'green'} onClick={() => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
onYes(true)
|
onYes(true)
|
||||||
|
setLoading(false)
|
||||||
}}>YA</Button>
|
}}>YA</Button>
|
||||||
<Button fullWidth size="lg" radius={'xl'} bg={'#F1C1CF'} c={'#D30B30'} onClick={() => onYes(false)}>TIDAK</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={() => {
|
<Button loading={loading} fullWidth size="lg" radius={'xl'} bg={'green'} onClick={() => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
onYes(true)
|
onYes(true)
|
||||||
|
setLoading(false)
|
||||||
}}>YA</Button>
|
}}>YA</Button>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
|
|||||||
@@ -98,9 +98,9 @@ export default function AddFileDetailTask() {
|
|||||||
}}
|
}}
|
||||||
activateOnClick={false}
|
activateOnClick={false}
|
||||||
maxSize={3 * 1024 ** 2}
|
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) => {
|
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>
|
</Dropzone>
|
||||||
|
|||||||
@@ -304,9 +304,9 @@ export default function CreateTask() {
|
|||||||
}}
|
}}
|
||||||
activateOnClick={false}
|
activateOnClick={false}
|
||||||
maxSize={3 * 1024 ** 2}
|
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) => {
|
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>
|
></Dropzone>
|
||||||
|
|
||||||
|
|||||||
@@ -100,9 +100,8 @@ export default function ListAnggotaDetailTask() {
|
|||||||
style={{
|
style={{
|
||||||
border: `1px solid ${"#C7D6E8"}`,
|
border: `1px solid ${"#C7D6E8"}`,
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
|
padding: 20
|
||||||
}}
|
}}
|
||||||
px={20}
|
|
||||||
py={10}
|
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
@@ -114,7 +113,7 @@ export default function ListAnggotaDetailTask() {
|
|||||||
</Box>
|
</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) => {
|
isData.map((v, i) => {
|
||||||
return (
|
return (
|
||||||
<Box key={i}>
|
<Box key={i}>
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export default function ListFileDetailTask() {
|
|||||||
</Box>
|
</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) => {
|
isData.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
|
|||||||
@@ -118,9 +118,8 @@ export default function ListTugasDetailTask() {
|
|||||||
style={{
|
style={{
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
border: `1px solid ${"#D6D8F6"}`,
|
border: `1px solid ${"#D6D8F6"}`,
|
||||||
|
padding:20
|
||||||
}}
|
}}
|
||||||
pl={20}
|
|
||||||
pr={20}
|
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
@@ -130,7 +129,7 @@ export default function ListTugasDetailTask() {
|
|||||||
</Box>
|
</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) => {
|
isData.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<Box key={index}>
|
<Box key={index}>
|
||||||
|
|||||||
Reference in New Issue
Block a user