upd: fitur baru project
Deskripsi: - tampilan list detail tugas project - tampilan tambah detail tugas project - tampilan edit detail tugas project - tampilan form tambah data project > detail tugas - integrasi api get list detail tugas project - integrasi api tambah detail tugas project - integrasi api edit detail tugas project - integrasi api tambah data project > detail tugas No Issues
This commit is contained in:
@@ -281,7 +281,7 @@ export const apiReportProject = async (data: { report: string, user: string }, i
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiCreateProjectTask = async ({ data, id }: { data: { name: string, dateStart: string, user: string, dateEnd: string }, id: string }) => {
|
||||
export const apiCreateProjectTask = async ({ data, id }: { data: { name: string, dateStart: string, user: string, dateEnd: string, dataDetail: any[] }, id: string }) => {
|
||||
const response = await api.post(`/mobile/project/${id}`, data)
|
||||
return response.data;
|
||||
};
|
||||
@@ -306,7 +306,7 @@ export const apiGetProjectTask = async ({ user, id, cat }: { user: string, id: s
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiEditProjectTask = async ({ data, id }: { data: { title: string, dateStart: string, user: string, dateEnd: string }, id: string }) => {
|
||||
export const apiEditProjectTask = async ({ data, id }: { data: { title: string, dateStart: string, user: string, dateEnd: string, dataDetail: any[] }, id: string }) => {
|
||||
const response = await api.post(`/mobile/project/detail/${id}`, data)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
9
lib/fun_formatDateOnly.ts
Normal file
9
lib/fun_formatDateOnly.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import dayjs from 'dayjs';
|
||||
import { DateType } from "react-native-ui-datepicker";
|
||||
|
||||
export function formatDateOnly(date?: DateType, format?: "DD-MM-YYYY" | "YYYY-MM-DD") {
|
||||
if (!date) return "";
|
||||
const dateObj = dayjs.isDayjs(date) ? date.toDate() : date;
|
||||
const iso = new Date(dateObj).toISOString().split("T")[0];
|
||||
return dayjs(iso).format(format || "DD-MM-YYYY");
|
||||
}
|
||||
14
lib/fun_getDatesInRange.ts
Normal file
14
lib/fun_getDatesInRange.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export function getDatesInRange(startDate: string, endDate: string) {
|
||||
const dates = [];
|
||||
const currentDate = new Date(startDate);
|
||||
const endDateNew = new Date(endDate);
|
||||
|
||||
while (currentDate <= endDateNew) {
|
||||
dates.push(dayjs(new Date(currentDate)).format("DD-MM-YYYY"));
|
||||
currentDate.setDate(currentDate.getDate() + 1);
|
||||
}
|
||||
|
||||
return dates;
|
||||
}
|
||||
Reference in New Issue
Block a user