feat: implement submission management service and administration page with filtering and status updates
Build and Release / release (push) Successful in 31s
Build and Release / release (push) Successful in 31s
This commit is contained in:
@@ -15,7 +15,7 @@ import {
|
|||||||
getSubmissionPayload,
|
getSubmissionPayload,
|
||||||
updateSubmissionPayload,
|
updateSubmissionPayload,
|
||||||
} from "@/interface/submission";
|
} from "@/interface/submission";
|
||||||
import { apiGetSubmission, updateProject } from "@/service/submisisonService";
|
import { apiGetSubmission, updateSubmission } from "@/service/submisisonService";
|
||||||
import { LIMIT_ITEM_TABLE } from "../../../../../constant";
|
import { LIMIT_ITEM_TABLE } from "../../../../../constant";
|
||||||
|
|
||||||
const formatDateTimeToISO = (
|
const formatDateTimeToISO = (
|
||||||
@@ -214,7 +214,7 @@ export default function Page() {
|
|||||||
|
|
||||||
setIsSubmitting(true);
|
setIsSubmitting(true);
|
||||||
try {
|
try {
|
||||||
const response = await updateProject(selectedItem.id, updatePayload);
|
const response = await updateSubmission(selectedItem.id, updatePayload);
|
||||||
|
|
||||||
if (response?.status) {
|
if (response?.status) {
|
||||||
toast.success("Cập nhật thành công!");
|
toast.success("Cập nhật thành công!");
|
||||||
@@ -411,12 +411,15 @@ export default function Page() {
|
|||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
value={updatePayload.status}
|
value={updatePayload.status}
|
||||||
onChange={(e) =>
|
onChange={(e) => {
|
||||||
setUpdatePayload({
|
setUpdatePayload((prev) => {
|
||||||
...updatePayload,
|
return {
|
||||||
|
...prev,
|
||||||
status: e.target.value,
|
status: e.target.value,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
className="w-full px-4 py-2 border border-gray-200 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 outline-none focus:ring-2 focus:ring-brand-500 focus:border-transparent transition-all"
|
className="w-full px-4 py-2 border border-gray-200 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 outline-none focus:ring-2 focus:ring-brand-500 focus:border-transparent transition-all"
|
||||||
>
|
>
|
||||||
<option value="APPROVED">APPROVED</option>
|
<option value="APPROVED">APPROVED</option>
|
||||||
@@ -430,12 +433,15 @@ export default function Page() {
|
|||||||
</label>
|
</label>
|
||||||
<textarea
|
<textarea
|
||||||
value={updatePayload.review_note}
|
value={updatePayload.review_note}
|
||||||
onChange={(e) =>
|
onChange={(e) => {
|
||||||
setUpdatePayload({
|
setUpdatePayload((prev) => {
|
||||||
...updatePayload,
|
return {
|
||||||
|
...prev,
|
||||||
review_note: e.target.value,
|
review_note: e.target.value,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
placeholder="Nhập ghi chú phản hồi..."
|
placeholder="Nhập ghi chú phản hồi..."
|
||||||
rows={4}
|
rows={4}
|
||||||
className="w-full px-4 py-3 border border-gray-200 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 outline-none focus:ring-2 focus:ring-brand-500 focus:border-transparent transition-all resize-none"
|
className="w-full px-4 py-3 border border-gray-200 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 outline-none focus:ring-2 focus:ring-brand-500 focus:border-transparent transition-all resize-none"
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ export const apiGetSubmissionDetail = async (id: string) => {
|
|||||||
return response?.data;
|
return response?.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const updateProject = async (id: string, payload: updateSubmissionPayload) => {
|
export const updateSubmission = async (id: string, payload: updateSubmissionPayload) => {
|
||||||
const response = await api.patch(API.Submission.UPDATE_STATUS(id), payload);
|
const response = await api.patch(API.Submission.UPDATE_STATUS(id), payload);
|
||||||
return response?.data;
|
return response?.data;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteProject = async (id: string) => {
|
export const deleteSubmission = async (id: string) => {
|
||||||
const response = await api.delete(API.Submission.DELETE(id));
|
const response = await api.delete(API.Submission.DELETE(id));
|
||||||
return response?.data;
|
return response?.data;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user