fix: task

Deskripsi:
- progress error
- data tugas kosong
- file kosong
- anggota kosong
- csv dimatiin
- modal konfirmasi loading

No Issues
This commit is contained in:
amel
2024-09-26 11:18:19 +08:00
parent 0afde113ac
commit b1a71d3d41
9 changed files with 30 additions and 22 deletions

View File

@@ -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 />
}

View File

@@ -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: {

View File

@@ -68,6 +68,9 @@ export async function GET(request: Request) {
idUser: true
}
}
},
orderBy: {
createdAt: "desc"
}
});

View File

@@ -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>
</>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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}>

View File

@@ -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

View File

@@ -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}>