fix: kegiatan
Deskripsi: - edit tahapan - hapus console log No Issues
This commit is contained in:
@@ -206,7 +206,9 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { id } = context.params;
|
const { id } = context.params;
|
||||||
const { name, dateStart, dateEnd } = (await request.json());
|
const { title, dateStart, dateEnd } = (await request.json());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const dataTask = await prisma.projectTask.count({
|
const dataTask = await prisma.projectTask.count({
|
||||||
where: {
|
where: {
|
||||||
@@ -228,7 +230,7 @@ export async function POST(request: Request, context: { params: { id: string } }
|
|||||||
id
|
id
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
title: name,
|
title,
|
||||||
dateStart: new Date(moment(dateStart).format('YYYY-MM-DD')),
|
dateStart: new Date(moment(dateStart).format('YYYY-MM-DD')),
|
||||||
dateEnd: new Date(moment(dateEnd).format('YYYY-MM-DD')),
|
dateEnd: new Date(moment(dateEnd).format('YYYY-MM-DD')),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useParams } from 'next/navigation';
|
import { useParams, useRouter } from 'next/navigation';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import toast from 'react-hot-toast';
|
import toast from 'react-hot-toast';
|
||||||
import { funEditDetailProject, funGetDetailProject } from '../lib/api_project';
|
import { funEditDetailProject, funGetDetailProject } from '../lib/api_project';
|
||||||
@@ -14,6 +14,7 @@ import { useHookstate } from '@hookstate/core';
|
|||||||
export default function EditDetailTaskProject() {
|
export default function EditDetailTaskProject() {
|
||||||
const [value, setValue] = useState<[Date | null, Date | null]>([null, null]);
|
const [value, setValue] = useState<[Date | null, Date | null]>([null, null]);
|
||||||
const [name, setName] = useState("")
|
const [name, setName] = useState("")
|
||||||
|
const [idProject, setIdProject] = useState("")
|
||||||
const param = useParams<{ id: string }>()
|
const param = useParams<{ id: string }>()
|
||||||
const [openModal, setOpenModal] = useState(false)
|
const [openModal, setOpenModal] = useState(false)
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
@@ -21,6 +22,7 @@ export default function EditDetailTaskProject() {
|
|||||||
const [touched, setTouched] = useState({
|
const [touched, setTouched] = useState({
|
||||||
title: false,
|
title: false,
|
||||||
});
|
});
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
if (value[0] == null || value[1] == null)
|
if (value[0] == null || value[1] == null)
|
||||||
@@ -39,6 +41,7 @@ export default function EditDetailTaskProject() {
|
|||||||
|
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
toast.success(res.message);
|
toast.success(res.message);
|
||||||
|
router.push('/project/' + idProject)
|
||||||
} else {
|
} else {
|
||||||
toast.error(res.message);
|
toast.error(res.message);
|
||||||
}
|
}
|
||||||
@@ -53,6 +56,7 @@ export default function EditDetailTaskProject() {
|
|||||||
setLoading(true)
|
setLoading(true)
|
||||||
const res = await funGetDetailProject(param.id);
|
const res = await funGetDetailProject(param.id);
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
setIdProject(res.data.idProject)
|
||||||
setName(res.data.title)
|
setName(res.data.title)
|
||||||
setValue([
|
setValue([
|
||||||
new Date(moment(res.data.dateStart).format('YYYY-MM-DD')),
|
new Date(moment(res.data.dateStart).format('YYYY-MM-DD')),
|
||||||
@@ -99,15 +103,15 @@ export default function EditDetailTaskProject() {
|
|||||||
<Skeleton height={45} mt={20} radius={10} />
|
<Skeleton height={45} mt={20} radius={10} />
|
||||||
:
|
:
|
||||||
<>
|
<>
|
||||||
<Text>Tanggal Mulai</Text>
|
<Text>Tanggal Mulai</Text>
|
||||||
<Group
|
<Group
|
||||||
justify="center"
|
justify="center"
|
||||||
bg={"white"}
|
bg={"white"}
|
||||||
h={45}
|
h={45}
|
||||||
style={{ borderRadius: 10, border: `1px solid ${"#D6D8F6"}` }}
|
style={{ borderRadius: 10, border: `1px solid ${"#D6D8F6"}` }}
|
||||||
>
|
>
|
||||||
<Text>{value[0] ? `${moment(value[0]).format('DD-MM-YYYY')}` : ""}</Text>
|
<Text>{value[0] ? `${moment(value[0]).format('DD-MM-YYYY')}` : ""}</Text>
|
||||||
</Group>
|
</Group>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
</Box>
|
</Box>
|
||||||
@@ -164,24 +168,24 @@ export default function EditDetailTaskProject() {
|
|||||||
{loading ?
|
{loading ?
|
||||||
<Skeleton height={50} radius={30} />
|
<Skeleton height={50} radius={30} />
|
||||||
:
|
:
|
||||||
<Button
|
<Button
|
||||||
c={"white"}
|
c={"white"}
|
||||||
bg={tema.get().utama}
|
bg={tema.get().utama}
|
||||||
size="lg"
|
size="lg"
|
||||||
radius={30}
|
radius={30}
|
||||||
fullWidth
|
fullWidth
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (
|
if (
|
||||||
name !== ""
|
name !== ""
|
||||||
) {
|
) {
|
||||||
setOpenModal(true)
|
setOpenModal(true)
|
||||||
} else {
|
} else {
|
||||||
toast.error("Judul Tidak Boleh Kosong")
|
toast.error("Judul Tidak Boleh Kosong")
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Simpan
|
Simpan
|
||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ export default function ListAnggotaDetailProject() {
|
|||||||
async function getOneDataCancel() {
|
async function getOneDataCancel() {
|
||||||
try {
|
try {
|
||||||
const res = await funGetOneProjectById(param.id, 'data');
|
const res = await funGetOneProjectById(param.id, 'data');
|
||||||
console.log(res.data)
|
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setReason(res.data.reason);
|
setReason(res.data.reason);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ export default function ListFileDetailProject() {
|
|||||||
async function getOneDataCancel() {
|
async function getOneDataCancel() {
|
||||||
try {
|
try {
|
||||||
const res = await funGetOneProjectById(param.id, 'data');
|
const res = await funGetOneProjectById(param.id, 'data');
|
||||||
console.log(res.data)
|
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setReason(res.data.reason);
|
setReason(res.data.reason);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ export default function ListTugasDetailProject() {
|
|||||||
async function getOneDataCancel() {
|
async function getOneDataCancel() {
|
||||||
try {
|
try {
|
||||||
const res = await funGetOneProjectById(param.id, 'data');
|
const res = await funGetOneProjectById(param.id, 'data');
|
||||||
console.log(res.data)
|
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setReason(res.data.reason);
|
setReason(res.data.reason);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export default function ProgressDetailProject() {
|
|||||||
async function getOneDataCancel() {
|
async function getOneDataCancel() {
|
||||||
try {
|
try {
|
||||||
const res = await funGetOneProjectById(param.id, 'data');
|
const res = await funGetOneProjectById(param.id, 'data');
|
||||||
console.log(res.data)
|
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
setReason(res.data.reason);
|
setReason(res.data.reason);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user