fix:time stamp
This commit is contained in:
parent
2c94754de2
commit
bd40ceab56
|
|
@ -34,6 +34,7 @@ import {
|
|||
import Swal from "sweetalert2";
|
||||
import withReactContent from "sweetalert2-react-content";
|
||||
import Image from "next/image";
|
||||
import { getUnixTimestamp } from "@/utils/global";
|
||||
|
||||
const categorySchema = z.object({
|
||||
id: z.number(),
|
||||
|
|
@ -104,7 +105,7 @@ export default function MasterCategoryTable() {
|
|||
}, []);
|
||||
|
||||
const fetchCategory = async () => {
|
||||
const res = await getArticleByCategory();
|
||||
const res = await getArticleByCategory(getUnixTimestamp());
|
||||
if (res?.data?.data) {
|
||||
setupCategory(res?.data?.data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,11 @@ import {
|
|||
useDisclosure,
|
||||
} from "@heroui/react";
|
||||
import GenerateSingleArticleForm from "./generate-ai-single-form";
|
||||
import { convertDateFormatNoTime, htmlToString } from "@/utils/global";
|
||||
import {
|
||||
convertDateFormatNoTime,
|
||||
getUnixTimestamp,
|
||||
htmlToString,
|
||||
} from "@/utils/global";
|
||||
import { close, error, loading, successToast } from "@/config/swal";
|
||||
import { useRouter } from "next/navigation";
|
||||
import Link from "next/link";
|
||||
|
|
@ -104,9 +108,9 @@ const createArticleSchema = z.object({
|
|||
description: z.string().min(2, {
|
||||
message: "Deskripsi harus diisi",
|
||||
}),
|
||||
// category: z.array(categorySchema).nonempty({
|
||||
// message: "Kategori harus memiliki setidaknya satu item",
|
||||
// }),
|
||||
category: z.array(categorySchema).nonempty({
|
||||
message: "Kategori harus memiliki setidaknya satu item",
|
||||
}),
|
||||
tags: z.array(z.string()).nonempty({
|
||||
message: "Minimal 1 tag",
|
||||
}),
|
||||
|
|
@ -174,7 +178,7 @@ export default function CreateArticleForm() {
|
|||
}, []);
|
||||
|
||||
const fetchCategory = async () => {
|
||||
const res = await getArticleByCategory();
|
||||
const res = await getArticleByCategory(getUnixTimestamp());
|
||||
if (res?.data?.data) {
|
||||
setupCategory(res?.data?.data);
|
||||
}
|
||||
|
|
@ -701,7 +705,7 @@ export default function CreateArticleForm() {
|
|||
</>
|
||||
)}
|
||||
|
||||
{/* <p className="text-sm mt-3">Kategori</p>
|
||||
<p className="text-sm mt-3">Kategori</p>
|
||||
<Controller
|
||||
control={control}
|
||||
name="category"
|
||||
|
|
@ -729,7 +733,7 @@ export default function CreateArticleForm() {
|
|||
<p className="text-red-400 text-sm mb-3">
|
||||
{errors.category?.message}
|
||||
</p>
|
||||
)} */}
|
||||
)}
|
||||
|
||||
<p className="text-sm">Tags</p>
|
||||
<Controller
|
||||
|
|
|
|||
|
|
@ -39,7 +39,11 @@ import {
|
|||
useDisclosure,
|
||||
} from "@heroui/react";
|
||||
import GenerateSingleArticleForm from "./generate-ai-single-form";
|
||||
import { convertDateFormatNoTime, htmlToString } from "@/utils/global";
|
||||
import {
|
||||
convertDateFormatNoTime,
|
||||
getUnixTimestamp,
|
||||
htmlToString,
|
||||
} from "@/utils/global";
|
||||
import { close, error, loading } from "@/config/swal";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { fromJSON, list } from "postcss";
|
||||
|
|
@ -202,7 +206,7 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
|
|||
}, []);
|
||||
|
||||
const fetchCategory = async () => {
|
||||
const res = await getArticleByCategory();
|
||||
const res = await getArticleByCategory(getUnixTimestamp());
|
||||
if (res?.data?.data) {
|
||||
setupCategory(res?.data?.data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import ReactSelect from "react-select";
|
|||
import makeAnimated from "react-select/animated";
|
||||
import { getAllUserLevels } from "@/services/user-levels/user-levels-service";
|
||||
import { listUserRole } from "@/services/master-user-role";
|
||||
import { getUnixTimestamp } from "@/utils/global";
|
||||
|
||||
const userSchema = z.object({
|
||||
id: z.number(),
|
||||
|
|
@ -153,7 +154,7 @@ export default function FormMasterUserEdit() {
|
|||
};
|
||||
|
||||
const fetchUserLevel = async () => {
|
||||
const res = await getAllUserLevels();
|
||||
const res = await getAllUserLevels({ timeStamp: getUnixTimestamp() });
|
||||
if (res?.data?.data) {
|
||||
return setupParent(res?.data?.data, "level");
|
||||
}
|
||||
|
|
@ -162,6 +163,7 @@ export default function FormMasterUserEdit() {
|
|||
const request = {
|
||||
limit: 100,
|
||||
page: 1,
|
||||
timeStamp: getUnixTimestamp(),
|
||||
};
|
||||
const res = await listUserRole(request);
|
||||
if (res?.data?.data) {
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ export default function FormMasterUserRole() {
|
|||
<p>Menus</p>
|
||||
{fields.map((field, index) => (
|
||||
<div key={field.menuId} className="flex flex-row gap-10">
|
||||
<p>{field.menuTitle}</p>
|
||||
{/* <p>{field.menuTitle}</p> */}
|
||||
<div className="grid grid-cols-6 gap-3">
|
||||
{/* <Checkbox>Option</Checkbox> */}
|
||||
<Controller
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import withReactContent from "sweetalert2-react-content";
|
|||
import { saveActivity } from "@/services/activity-log";
|
||||
import PasswordChecklist from "react-password-checklist";
|
||||
import { Image, InputOtp } from "@heroui/react";
|
||||
import { getUnixTimestamp } from "@/utils/global";
|
||||
|
||||
export default function Login() {
|
||||
const accessToken = Cookies.get("access_token");
|
||||
|
|
@ -148,7 +149,7 @@ export default function Login() {
|
|||
// Cookies.set("email", profile?.data?.data?.email, {
|
||||
// expires: 1,
|
||||
// });
|
||||
// router.push("/admin/dashboard");
|
||||
// router.push(`/admin/dashboard?timestamp=${getUnixTimestamp()}`);
|
||||
// Cookies.set("status", "login", {
|
||||
// expires: 1,
|
||||
// });
|
||||
|
|
@ -266,7 +267,7 @@ export default function Login() {
|
|||
Cookies.set("email", profile?.email, {
|
||||
expires: 1,
|
||||
});
|
||||
router.push("/admin/dashboard");
|
||||
router.push(`/admin/dashboard?timestamp=${getUnixTimestamp()}`);
|
||||
Cookies.set("status", "login", {
|
||||
expires: 1,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export default function HeaderNews() {
|
|||
<Swiper
|
||||
centeredSlides={true}
|
||||
autoplay={{
|
||||
delay: 5000,
|
||||
delay: 7000,
|
||||
disableOnInteraction: false,
|
||||
}}
|
||||
navigation={true}
|
||||
|
|
@ -217,7 +217,7 @@ export default function HeaderNews() {
|
|||
<Swiper
|
||||
centeredSlides={true}
|
||||
autoplay={{
|
||||
delay: 5000,
|
||||
delay: 7000,
|
||||
disableOnInteraction: false,
|
||||
}}
|
||||
navigation={true}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,15 @@ export default function FooterNew(props: { margin?: boolean }) {
|
|||
success("Sukses");
|
||||
};
|
||||
|
||||
const [hasMounted, setHasMounted] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setHasMounted(true);
|
||||
}, []);
|
||||
|
||||
// Render
|
||||
if (!hasMounted) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`${
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import React, { Component, useEffect, useState } from "react";
|
|||
import ReactApexChart from "react-apexcharts";
|
||||
import dummyData from "../../../../const/dummy.json";
|
||||
import { getStatisticMonthly } from "@/services/article";
|
||||
import { getUnixTimestamp } from "@/utils/global";
|
||||
|
||||
type WeekData = {
|
||||
week: number;
|
||||
|
|
@ -62,7 +63,7 @@ const ApexChartColumn = (props: {
|
|||
const initFetch = async () => {
|
||||
const splitDate = date.split(" ");
|
||||
|
||||
const res = await getStatisticMonthly(splitDate[1]);
|
||||
const res = await getStatisticMonthly(splitDate[1], getUnixTimestamp());
|
||||
const data = res?.data?.data;
|
||||
const getDatas = data?.find(
|
||||
(a: any) =>
|
||||
|
|
@ -122,8 +123,6 @@ const ApexChartColumn = (props: {
|
|||
},
|
||||
];
|
||||
|
||||
console.log("temp", temp);
|
||||
|
||||
setSeries(temp);
|
||||
}, [view, seriesShare, seriesView, seriesComment]);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {
|
|||
getStatisticMonthly,
|
||||
getStatisticMonthlyFeedback,
|
||||
} from "@/services/article";
|
||||
import { getUnixTimestamp } from "@/utils/global";
|
||||
|
||||
type WeekData = {
|
||||
week: number;
|
||||
|
|
@ -91,7 +92,10 @@ const SuggestionsChart = (props: {
|
|||
|
||||
const initFetch = async () => {
|
||||
const splitDate = date.split(" ");
|
||||
const res = await getStatisticMonthlyFeedback(splitDate[1]);
|
||||
const res = await getStatisticMonthlyFeedback(
|
||||
splitDate[1],
|
||||
getUnixTimestamp()
|
||||
);
|
||||
const data = res?.data?.data;
|
||||
// const data = dummyData.data;
|
||||
if (type === "monthly") {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import {
|
|||
convertDateFormat,
|
||||
convertDateFormatNoTime,
|
||||
convertDateFormatNoTimeV2,
|
||||
getUnixTimestamp,
|
||||
textEllipsis,
|
||||
} from "@/utils/global";
|
||||
import { parseDate, getLocalTimeZone } from "@internationalized/date";
|
||||
|
|
@ -109,6 +110,7 @@ export default function DashboardContainer() {
|
|||
page: page,
|
||||
search: "",
|
||||
sort: "desc",
|
||||
timeStamp: getUnixTimestamp(),
|
||||
};
|
||||
const res = await getListArticleAdminPage(req);
|
||||
setArticle(res.data?.data);
|
||||
|
|
@ -116,7 +118,7 @@ export default function DashboardContainer() {
|
|||
}
|
||||
|
||||
async function fetchSummary() {
|
||||
const res = await getStatisticSummary();
|
||||
const res = await getStatisticSummary(getUnixTimestamp());
|
||||
setSummary(res?.data?.data);
|
||||
}
|
||||
|
||||
|
|
@ -131,6 +133,7 @@ export default function DashboardContainer() {
|
|||
search: "",
|
||||
sort: "desc",
|
||||
isPublish: true,
|
||||
timeStamp: getUnixTimestamp(),
|
||||
};
|
||||
const res = await getTopArticles(req);
|
||||
setTopPages(getTableNumber(10, res.data?.data));
|
||||
|
|
@ -148,7 +151,8 @@ export default function DashboardContainer() {
|
|||
};
|
||||
const res = await getUserLevelDataStat(
|
||||
getDate(postContentDate.startDate),
|
||||
getDate(postContentDate.endDate)
|
||||
getDate(postContentDate.endDate),
|
||||
getUnixTimestamp()
|
||||
);
|
||||
setPostCount(getTableNumber(10, res?.data?.data));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
getListArticle,
|
||||
} from "@/services/article";
|
||||
import { Article } from "@/types/globals";
|
||||
import { convertDateFormat } from "@/utils/global";
|
||||
import { convertDateFormat, getUnixTimestamp } from "@/utils/global";
|
||||
import { Button } from "@heroui/button";
|
||||
import {
|
||||
Chip,
|
||||
|
|
@ -64,6 +64,7 @@ import {
|
|||
editAdvertise,
|
||||
editAdvertiseIsActive,
|
||||
getAdvertise,
|
||||
getAdvertiseAdmin,
|
||||
} from "@/services/advertisement";
|
||||
|
||||
const columns = [
|
||||
|
|
@ -150,8 +151,9 @@ export default function AdvertiseTable(props: { triggerRefresh: boolean }) {
|
|||
|
||||
sort: "desc",
|
||||
sortBy: "created_at",
|
||||
timeStamp: getUnixTimestamp(),
|
||||
};
|
||||
const res = await getAdvertise(req);
|
||||
const res = await getAdvertiseAdmin(req);
|
||||
getTableNumber(parseInt(showData), res.data?.data);
|
||||
setTotalPage(res?.data?.meta?.totalPage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import {
|
|||
convertDateFormat,
|
||||
convertDateFormatNoTime,
|
||||
convertDateFormatNoTimeV2,
|
||||
getUnixTimestamp,
|
||||
} from "@/utils/global";
|
||||
import { Button } from "@heroui/button";
|
||||
import {
|
||||
|
|
@ -159,7 +160,11 @@ export default function ArticleTable() {
|
|||
};
|
||||
|
||||
async function getUsers() {
|
||||
const res = await listMasterUsers({ page: page, limit: -1 });
|
||||
const res = await listMasterUsers({
|
||||
page: page,
|
||||
limit: -1,
|
||||
timeStamp: getUnixTimestamp(),
|
||||
});
|
||||
setupList(res?.data?.data, "users");
|
||||
}
|
||||
|
||||
|
|
@ -209,6 +214,7 @@ export default function ArticleTable() {
|
|||
createdByIds: getIds(selectedUsers),
|
||||
sort: "desc",
|
||||
sortBy: "created_at",
|
||||
timeStamp: getUnixTimestamp(),
|
||||
};
|
||||
const res = await getListArticleAdminPage(req);
|
||||
await getTableNumber(parseInt(showData), res.data?.data);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import {
|
|||
getListArticle,
|
||||
} from "@/services/article";
|
||||
import { Article } from "@/types/globals";
|
||||
import { convertDateFormat } from "@/utils/global";
|
||||
import { convertDateFormat, getUnixTimestamp } from "@/utils/global";
|
||||
import { Button } from "@heroui/button";
|
||||
import {
|
||||
Chip,
|
||||
|
|
@ -55,7 +55,6 @@ import { Controller, useForm } from "react-hook-form";
|
|||
import Swal from "sweetalert2";
|
||||
import withReactContent from "sweetalert2-react-content";
|
||||
import { useDropzone } from "react-dropzone";
|
||||
import Image from "next/image";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { getComments } from "@/services/comment";
|
||||
|
||||
|
|
@ -92,6 +91,7 @@ export default function CommentTable() {
|
|||
limit: showData,
|
||||
page: page,
|
||||
search: search,
|
||||
timeStamp: getUnixTimestamp(),
|
||||
};
|
||||
const res = await getComments(req);
|
||||
getTableNumber(parseInt(showData), res.data?.data);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
} from "@/services/article";
|
||||
import { deleteMagazine, getListMagazine } from "@/services/magazine";
|
||||
import { Article } from "@/types/globals";
|
||||
import { convertDateFormat } from "@/utils/global";
|
||||
import { convertDateFormat, getUnixTimestamp } from "@/utils/global";
|
||||
import { Button } from "@heroui/button";
|
||||
import {
|
||||
Chip,
|
||||
|
|
@ -35,6 +35,7 @@ import {
|
|||
TableHeader,
|
||||
TableRow,
|
||||
} from "@heroui/react";
|
||||
import { timeStamp } from "console";
|
||||
import Link from "next/link";
|
||||
import { Key, useCallback, useEffect, useState } from "react";
|
||||
import Datepicker from "react-tailwindcss-datepicker";
|
||||
|
|
@ -79,9 +80,8 @@ export default function MagazineTable() {
|
|||
}, []);
|
||||
|
||||
async function getCategories() {
|
||||
const res = await getArticleByCategory();
|
||||
const res = await getArticleByCategory(getUnixTimestamp());
|
||||
const data = res?.data?.data;
|
||||
console.log("datass", res?.data?.data);
|
||||
setCategoies(data);
|
||||
}
|
||||
|
||||
|
|
@ -93,10 +93,10 @@ export default function MagazineTable() {
|
|||
startDate:
|
||||
startDateValue.startDate === null ? "" : startDateValue.startDate,
|
||||
endDate: startDateValue.endDate === null ? "" : startDateValue.endDate,
|
||||
timeStamp: getUnixTimestamp(),
|
||||
};
|
||||
const res = await getListMagazine(req);
|
||||
getTableNumber(parseInt(showData), res.data?.data);
|
||||
console.log("res.data?.data magz", res.data);
|
||||
setTotalPage(res?.data?.meta?.totalPage);
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +109,6 @@ export default function MagazineTable() {
|
|||
value.no = startIndex + iterate;
|
||||
return value;
|
||||
});
|
||||
console.log("daata", data);
|
||||
setArticle(newData);
|
||||
} else {
|
||||
setArticle([]);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import {
|
|||
uploadCategoryThumbnail,
|
||||
} from "@/services/master-categories";
|
||||
import { Article } from "@/types/globals";
|
||||
import { convertDateFormat } from "@/utils/global";
|
||||
import { convertDateFormat, getUnixTimestamp } from "@/utils/global";
|
||||
import { Button } from "@heroui/button";
|
||||
import {
|
||||
Chip,
|
||||
|
|
@ -156,6 +156,7 @@ export default function CategoriesTable(props: { triggerRefresh: boolean }) {
|
|||
limit: showData,
|
||||
page: page,
|
||||
search: search,
|
||||
timeStamp: getUnixTimestamp(),
|
||||
};
|
||||
const res = await getCategoryPagination(req);
|
||||
getTableNumber(parseInt(showData), res.data?.data);
|
||||
|
|
@ -210,7 +211,7 @@ export default function CategoriesTable(props: { triggerRefresh: boolean }) {
|
|||
}, []);
|
||||
|
||||
const fetchCategory = async () => {
|
||||
const res = await getArticleByCategory();
|
||||
const res = await getArticleByCategory(getUnixTimestamp());
|
||||
if (res?.data?.data) {
|
||||
setupCategory(res?.data?.data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import {
|
|||
listUserRole,
|
||||
} from "@/services/master-user-role";
|
||||
import { MasterUser, MasterUserRole } from "@/types/globals";
|
||||
import { getUnixTimestamp } from "@/utils/global";
|
||||
import { Button } from "@heroui/button";
|
||||
import {
|
||||
Chip,
|
||||
|
|
@ -59,7 +60,11 @@ export default function MasterRoleTable() {
|
|||
}, [page]);
|
||||
|
||||
async function initState() {
|
||||
const res = await listUserRole({ page: page, limit: 10 });
|
||||
const res = await listUserRole({
|
||||
page: page,
|
||||
limit: 10,
|
||||
timeStamp: getUnixTimestamp(),
|
||||
});
|
||||
getTableNumber(10, res?.data?.data);
|
||||
setTotalPage(res?.data?.meta?.totalPage);
|
||||
}
|
||||
|
|
@ -132,49 +137,6 @@ export default function MasterRoleTable() {
|
|||
// { name: "Vacation", uid: "vacation" },
|
||||
// ];
|
||||
|
||||
const usersTable = [
|
||||
{
|
||||
id: 1,
|
||||
user: "Olivia Rhya",
|
||||
status: "active",
|
||||
projectName: "Xtreme admin",
|
||||
avatar:
|
||||
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSa8Luglga9J2R3Bxt_PsWZISUHQWODD6_ZTAJ5mIQgxYCAE-YbkY81faTqp-hSA_jVPTs&usqp=CAU",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
user: "Barbara Steele",
|
||||
status: "cancel",
|
||||
projectName: "Adminpro admin",
|
||||
avatar:
|
||||
"https://cdn.icon-icons.com/icons2/2859/PNG/512/avatar_face_man_boy_male_profile_smiley_happy_people_icon_181661.png",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
user: "Leonardo Gordon",
|
||||
status: "pending",
|
||||
projectName: "Monster admin",
|
||||
avatar:
|
||||
"https://cdn.icon-icons.com/icons2/2859/PNG/512/avatar_face_man_boy_male_profile_smiley_happy_people_icon_181657.png",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
user: "Evelyn Pope",
|
||||
status: "cancel",
|
||||
projectName: "Materialpro admin",
|
||||
avatar:
|
||||
"https://cdn.icon-icons.com/icons2/3708/PNG/512/man_person_people_avatar_icon_230017.png",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
user: "Tommy Garza",
|
||||
status: "cancel",
|
||||
projectName: "Elegant admin",
|
||||
avatar:
|
||||
"https://cdn.icon-icons.com/icons2/1736/PNG/512/4043275-avatar-man-person-punk_113271.png",
|
||||
},
|
||||
];
|
||||
|
||||
const renderCell = useCallback((role: MasterUserRole, columnKey: Key) => {
|
||||
const cellValue = role[columnKey as keyof MasterUserRole];
|
||||
const statusColorMap: Record<string, ChipProps["color"]> = {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { error, success } from "@/config/swal";
|
|||
import { deleteArticle, getListArticle } from "@/services/article";
|
||||
import { deleteMasterUser, listMasterUsers } from "@/services/master-user";
|
||||
import { Article, MasterUser } from "@/types/globals";
|
||||
import { getUnixTimestamp } from "@/utils/global";
|
||||
import { Button } from "@heroui/button";
|
||||
import { Input } from "@heroui/input";
|
||||
import {
|
||||
|
|
@ -67,6 +68,7 @@ export default function MasterUserTable() {
|
|||
fullname: searchType === "fullname" ? search : "",
|
||||
username: searchType === "username" ? search : "",
|
||||
email: searchType === "email" ? search : "",
|
||||
timeStamp: getUnixTimestamp(),
|
||||
});
|
||||
getTableNumber(10, res?.data?.data);
|
||||
setTotalPage(res?.data?.meta?.totalPage);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import {
|
|||
} from "@/services/user-levels/user-levels-service";
|
||||
import { close, error, loading } from "@/config/swal";
|
||||
import { stringify } from "querystring";
|
||||
import { getUnixTimestamp } from "@/utils/global";
|
||||
|
||||
type UserObject = {
|
||||
id: number;
|
||||
|
|
@ -99,6 +100,7 @@ export default function MasterUserLevelTable() {
|
|||
page: page,
|
||||
limit: 10,
|
||||
search: search,
|
||||
timeStamp: getUnixTimestamp(),
|
||||
};
|
||||
const res = await getAllUserLevels(request);
|
||||
const data = res?.data?.data;
|
||||
|
|
@ -112,6 +114,7 @@ export default function MasterUserLevelTable() {
|
|||
page: 1,
|
||||
limit: -1,
|
||||
search: "",
|
||||
timeStamp: getUnixTimestamp(),
|
||||
};
|
||||
const res = await getAllUserLevels(request);
|
||||
const data = res?.data?.data;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { error, success } from "@/config/swal";
|
|||
import { deleteArticle, getListArticle } from "@/services/article";
|
||||
import { getCustomStaticPage } from "@/services/static-page-service";
|
||||
import { Article } from "@/types/globals";
|
||||
import { convertDateFormat } from "@/utils/global";
|
||||
import { convertDateFormat, getUnixTimestamp } from "@/utils/global";
|
||||
import { Button } from "@heroui/button";
|
||||
import {
|
||||
Chip,
|
||||
|
|
@ -71,10 +71,10 @@ export default function StaticPageTable() {
|
|||
limit: showData,
|
||||
page: page,
|
||||
search: search,
|
||||
timeStamp: getUnixTimestamp(),
|
||||
};
|
||||
const res = await getCustomStaticPage(req);
|
||||
getTableNumber(parseInt(showData), res.data?.data);
|
||||
console.log("res.data?.data", res.data);
|
||||
setTotalPage(res?.data?.meta?.totalPage);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import {
|
|||
convertDateFormat,
|
||||
convertDateFormatNoTime,
|
||||
convertDateFormatNoTimeV2,
|
||||
getUnixTimestamp,
|
||||
} from "@/utils/global";
|
||||
import { Button } from "@heroui/button";
|
||||
import {
|
||||
|
|
@ -82,6 +83,7 @@ import {
|
|||
TextRun,
|
||||
WidthType,
|
||||
} from "docx";
|
||||
import { timeStamp } from "console";
|
||||
|
||||
interface ExportData {
|
||||
no: string;
|
||||
|
|
@ -166,6 +168,7 @@ export default function SuggestionsTable() {
|
|||
search: search,
|
||||
startDate: getDate(feedbackDate.startDate),
|
||||
endDate: getDate(feedbackDate.endDate),
|
||||
timeStamp: getUnixTimestamp(),
|
||||
});
|
||||
getTableNumber(parseInt(showData), res.data?.data);
|
||||
setTotalPage(res?.data?.meta?.totalPage);
|
||||
|
|
@ -357,7 +360,11 @@ export default function SuggestionsTable() {
|
|||
const [typeDate, setTypeDate] = useState("monthly");
|
||||
|
||||
const doExport = async () => {
|
||||
const res = await getFeedbacks({ limit: showData, search: search });
|
||||
const res = await getFeedbacks({
|
||||
limit: showData,
|
||||
search: search,
|
||||
timeStamp: getUnixTimestamp(),
|
||||
});
|
||||
if (res?.data?.data) {
|
||||
exportRecap(res?.data?.data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import { httpGet, httpPost, httpPut } from "./http-config/axios-base-service";
|
||||
import Cookies from "js-cookie";
|
||||
import {
|
||||
httpDeleteInterceptor,
|
||||
httpGet,
|
||||
httpPost,
|
||||
httpPut,
|
||||
} from "./http-config/axios-base-service";
|
||||
import Cookies from "js-cookie";
|
||||
httpGetInterceptor,
|
||||
} from "./http-config/http-interceptor-services";
|
||||
|
||||
const token = Cookies.get("access_token");
|
||||
|
||||
|
|
@ -30,10 +29,24 @@ export async function getAdvertise(data: any) {
|
|||
};
|
||||
const pathUrl = `/advertisement?page=${data?.page || 1}&limit=${
|
||||
data?.limit || ""
|
||||
}&placement=${data?.placement || ""}&isPublish=${data.isPublish || ""}`;
|
||||
}&placement=${data?.placement || ""}&isPublish=${
|
||||
data.isPublish || ""
|
||||
}&timeStamp=${data.timeStamp || ""}`;
|
||||
return await httpGet(pathUrl, headers);
|
||||
}
|
||||
|
||||
export async function getAdvertiseAdmin(data: any) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
};
|
||||
const pathUrl = `/advertisement?page=${data?.page || 1}&limit=${
|
||||
data?.limit || ""
|
||||
}&placement=${data?.placement || ""}&isPublish=${
|
||||
data.isPublish || ""
|
||||
}&timeStamp=${data.timeStamp || ""}`;
|
||||
return await httpGetInterceptor(pathUrl);
|
||||
}
|
||||
|
||||
export async function createAdvertiseById(id: number) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
|
|
@ -64,5 +77,5 @@ export async function deleteAdvertise(id: number) {
|
|||
"content-type": "application/json",
|
||||
};
|
||||
const pathUrl = `/advertisement/${id}`;
|
||||
return await httpDeleteInterceptor(pathUrl, headers);
|
||||
return await httpDeleteInterceptor(pathUrl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ export async function getListArticle(props: PaginationRequest) {
|
|||
isBanner,
|
||||
categoryIds,
|
||||
createdByIds,
|
||||
timeStamp,
|
||||
} = props;
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
|
|
@ -37,7 +38,7 @@ export async function getListArticle(props: PaginationRequest) {
|
|||
sort || "asc"
|
||||
}&category=${categorySlug || ""}&isBanner=${isBanner || ""}&categoryIds=${
|
||||
categoryIds || ""
|
||||
}&createdByIds=${createdByIds || ""}`,
|
||||
}&createdByIds=${createdByIds || ""}&timeStamp=${timeStamp || ""}`,
|
||||
headers
|
||||
);
|
||||
}
|
||||
|
|
@ -57,6 +58,7 @@ export async function getListArticleAdminPage(props: PaginationRequest) {
|
|||
isBanner,
|
||||
categoryIds,
|
||||
createdByIds,
|
||||
timeStamp,
|
||||
} = props;
|
||||
return await httpGetInterceptor(
|
||||
`/articles?sort=desc&sortBy=created_at&limit=${limit}&page=${page}&isPublish=${
|
||||
|
|
@ -67,19 +69,29 @@ export async function getListArticleAdminPage(props: PaginationRequest) {
|
|||
sort || "asc"
|
||||
}&category=${categorySlug || ""}&isBanner=${isBanner || ""}&categoryIds=${
|
||||
categoryIds || ""
|
||||
}&createdByIds=${createdByIds || ""}`
|
||||
}&createdByIds=${createdByIds || ""}&timeStamp=${timeStamp || ""}`
|
||||
);
|
||||
}
|
||||
|
||||
export async function getTopArticles(props: PaginationRequest) {
|
||||
const { page, limit, search, startDate, endDate, isPublish, category } =
|
||||
props;
|
||||
const {
|
||||
page,
|
||||
limit,
|
||||
search,
|
||||
startDate,
|
||||
endDate,
|
||||
isPublish,
|
||||
category,
|
||||
timeStamp,
|
||||
} = props;
|
||||
return await httpGetInterceptor(
|
||||
`/articles?limit=${limit}&page=${page}&isPublish=${
|
||||
isPublish === undefined ? "" : isPublish
|
||||
}&title=${search}&startDate=${startDate || ""}&endDate=${
|
||||
endDate || ""
|
||||
}&category=${category || ""}&sortBy=view_count&sort=desc`
|
||||
}&category=${category || ""}&sortBy=view_count&sort=desc&timeStamp=${
|
||||
timeStamp || ""
|
||||
}`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -124,12 +136,14 @@ export async function deleteArticle(id: string) {
|
|||
return await httpDeleteInterceptor(`articles/${id}`);
|
||||
}
|
||||
|
||||
export async function getArticleByCategory() {
|
||||
export async function getArticleByCategory(timeStamp: number) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpGet(`/article-categories?limit=1000`, headers);
|
||||
return await httpGetInterceptor(
|
||||
`/article-categories?limit=1000&timeStamp=${timeStamp}`
|
||||
);
|
||||
}
|
||||
export async function getCategoryPagination(data: any) {
|
||||
const headers = {
|
||||
|
|
@ -138,7 +152,7 @@ export async function getCategoryPagination(data: any) {
|
|||
};
|
||||
|
||||
return await httpGetInterceptor(
|
||||
`/article-categories?limit=${data?.limit}&page=${data?.page}&title=${data?.search}`
|
||||
`/article-categories?limit=${data?.limit}&page=${data?.page}&title=${data?.search}&timeStamp=${data.timeStamp}`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -162,36 +176,49 @@ export async function deleteArticleFiles(id: number) {
|
|||
return await httpDeleteInterceptor(`article-files/${id}`);
|
||||
}
|
||||
|
||||
export async function getUserLevelDataStat(startDate: string, endDate: string) {
|
||||
export async function getUserLevelDataStat(
|
||||
startDate: string,
|
||||
endDate: string,
|
||||
timeStamp: number
|
||||
) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpGetInterceptor(
|
||||
`/articles/statistic/user-levels?startDate=${startDate}&endDate=${endDate}&timeStamp=${timeStamp}`
|
||||
);
|
||||
}
|
||||
export async function getStatisticMonthly(year: string, timeStamp: number) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpGetInterceptor(
|
||||
`/articles/statistic/monthly?year=${year}&timeStamp=${timeStamp}`
|
||||
);
|
||||
}
|
||||
export async function getStatisticMonthlyFeedback(
|
||||
year: string,
|
||||
timeStamp: number
|
||||
) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpGet(
|
||||
`/articles/statistic/user-levels?startDate=${startDate}&endDate=${endDate}`,
|
||||
`/feedbacks/statistic/monthly?year=${year}&timeStamp=${timeStamp}`,
|
||||
headers
|
||||
);
|
||||
}
|
||||
export async function getStatisticMonthly(year: string) {
|
||||
export async function getStatisticSummary(timeStamp: number) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpGet(`/articles/statistic/monthly?year=${year}`, headers);
|
||||
}
|
||||
export async function getStatisticMonthlyFeedback(year: string) {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpGet(`/feedbacks/statistic/monthly?year=${year}`, headers);
|
||||
}
|
||||
export async function getStatisticSummary() {
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
};
|
||||
return await httpGetInterceptor(`/articles/statistic/summary`);
|
||||
return await httpGetInterceptor(
|
||||
`/articles/statistic/summary?timeStamp=${timeStamp}`
|
||||
);
|
||||
}
|
||||
|
||||
export async function submitApproval(data: {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
httpPut,
|
||||
} from "./http-config/axios-base-service";
|
||||
import Cookies from "js-cookie";
|
||||
import { httpGetInterceptor } from "./http-config/http-interceptor-services";
|
||||
|
||||
const token = Cookies.get("access_token");
|
||||
|
||||
|
|
@ -14,8 +15,10 @@ export async function getComments(data: any) {
|
|||
};
|
||||
const pathUrl = `/article-comments?page=${data?.page || 1}&limit=${
|
||||
data?.limit || ""
|
||||
}&message=${data?.search || ""}&parentId=0`;
|
||||
return await httpGet(pathUrl, headers);
|
||||
}&message=${data?.search || ""}&parentId=0&timeStamp=${
|
||||
data?.timeStamp || ""
|
||||
}`;
|
||||
return await httpGetInterceptor(pathUrl);
|
||||
}
|
||||
|
||||
export async function deleteComment(id: number) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
httpPut,
|
||||
} from "./http-config/axios-base-service";
|
||||
import Cookies from "js-cookie";
|
||||
import { httpGetInterceptor } from "./http-config/http-interceptor-services";
|
||||
|
||||
const token = Cookies.get("access_token");
|
||||
|
||||
|
|
@ -24,8 +25,8 @@ export async function getFeedbacks(data: any) {
|
|||
data?.limit || ""
|
||||
}&message=${data?.search || ""}&startDate=${data.startDate || ""}&endDate=${
|
||||
data.endDate || ""
|
||||
}`;
|
||||
return await httpGet(pathUrl, headers);
|
||||
}&timeStamp=${data.timeStamp}`;
|
||||
return await httpGetInterceptor(pathUrl);
|
||||
}
|
||||
|
||||
export async function getFeedbacksById(id: number) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
import { PaginationRequest } from "@/types/globals";
|
||||
import {
|
||||
httpDeleteInterceptor,
|
||||
httpGet,
|
||||
httpPost,
|
||||
httpPut,
|
||||
} from "./http-config/axios-base-service";
|
||||
import { httpGet, httpPost, httpPut } from "./http-config/axios-base-service";
|
||||
import Cookies from "js-cookie";
|
||||
import { httpDeleteInterceptor } from "./http-config/http-interceptor-services";
|
||||
|
||||
const token = Cookies.get("access_token");
|
||||
|
||||
|
|
@ -19,14 +15,14 @@ export async function createMagazine(data: any) {
|
|||
}
|
||||
|
||||
export async function getListMagazine(props: PaginationRequest) {
|
||||
const { page, limit, search, startDate, endDate } = props;
|
||||
const { page, limit, search, startDate, endDate, timeStamp } = props;
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
};
|
||||
return await httpGet(
|
||||
`/magazines?limit=${limit}&page=${page}&title=${search}&startDate=${
|
||||
startDate || ""
|
||||
}&endDate=${endDate || ""}`,
|
||||
}&endDate=${endDate || ""}&timeStamp=${timeStamp || ""}`,
|
||||
headers
|
||||
);
|
||||
}
|
||||
|
|
@ -50,7 +46,7 @@ export async function deleteMagazine(id: string) {
|
|||
const headers = {
|
||||
"content-type": "application/json",
|
||||
};
|
||||
return await httpDeleteInterceptor(`magazines/${id}`, headers);
|
||||
return await httpDeleteInterceptor(`magazines/${id}`);
|
||||
}
|
||||
|
||||
export async function uploadMagazineFile(id: string, data: any) {
|
||||
|
|
@ -71,5 +67,5 @@ export async function deleteMagazineFiles(id: number) {
|
|||
const headers = {
|
||||
"content-type": "multipart/form-data",
|
||||
};
|
||||
return await httpDeleteInterceptor(`magazine-files/${id}`, headers);
|
||||
return await httpDeleteInterceptor(`magazine-files/${id}`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
} from "./http-config/axios-base-service";
|
||||
|
||||
import Cookies from "js-cookie";
|
||||
import { httpGetInterceptor } from "./http-config/http-interceptor-services";
|
||||
|
||||
const token = Cookies.get("access_token");
|
||||
|
||||
|
|
@ -12,9 +13,10 @@ export async function listUserRole(data: any) {
|
|||
const headers = {
|
||||
"content-type": "application/json",
|
||||
};
|
||||
return await httpGet(
|
||||
`/user-roles?limit=${data.limit}&page=${data.page}`,
|
||||
headers
|
||||
return await httpGetInterceptor(
|
||||
`/user-roles?limit=${data.limit}&page=${data.page}&timeStamp=${
|
||||
data.timeStamp || ""
|
||||
}`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ export async function listMasterUsers(data: any) {
|
|||
return await httpGet(
|
||||
`/users?page=${data.page}&limit=${data.limit}&username=${
|
||||
data.username || ""
|
||||
}&fullname=${data.fullname || ""}&email=${data.email || ""}`,
|
||||
}&fullname=${data.fullname || ""}&email=${data.email || ""}&timeStamp=${
|
||||
data.timeStamp || ""
|
||||
}`,
|
||||
headers
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
httpPost,
|
||||
httpPut,
|
||||
} from "./http-config/axios-base-service";
|
||||
import { httpGetInterceptor } from "./http-config/http-interceptor-services";
|
||||
|
||||
export async function createCustomStaticPage(data: any) {
|
||||
const headers = {
|
||||
|
|
@ -23,13 +24,12 @@ export async function editCustomStaticPage(data: any) {
|
|||
}
|
||||
|
||||
export async function getCustomStaticPage(props: PaginationRequest) {
|
||||
const { page, limit, search } = props;
|
||||
const { page, limit, search, timeStamp } = props;
|
||||
const headers = {
|
||||
"content-type": "application/json",
|
||||
};
|
||||
return await httpGet(
|
||||
`/custom-static-pages?limit=${limit}&page=${page}&title=${search}`,
|
||||
headers
|
||||
return await httpGetInterceptor(
|
||||
`/custom-static-pages?limit=${limit}&page=${page}&title=${search}&timeStamp=${timeStamp}`
|
||||
);
|
||||
}
|
||||
export async function getCustomStaticDetail(id: string) {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {
|
|||
} from "@/services/http-config/axios-base-service";
|
||||
|
||||
import Cookies from "js-cookie";
|
||||
import { httpGetInterceptor } from "../http-config/http-interceptor-services";
|
||||
|
||||
const token = Cookies.get("access_token");
|
||||
|
||||
|
|
@ -13,11 +14,12 @@ export async function getAllUserLevels(data?: any) {
|
|||
const headers = {
|
||||
"content-type": "application/json",
|
||||
};
|
||||
return await httpGet(
|
||||
return await httpGetInterceptor(
|
||||
`user-levels?limit=${data?.limit || ""}&levelNumber=${
|
||||
data?.levelNumber || ""
|
||||
}&name=${data?.search || ""}&page=${data?.page || "1"}`,
|
||||
headers
|
||||
}&name=${data?.search || ""}&page=${data?.page || "1"}&timeStamp=${
|
||||
data.timeStamp || ""
|
||||
}`
|
||||
);
|
||||
}
|
||||
export async function getUserLevels(id: string) {
|
||||
|
|
|
|||
|
|
@ -69,4 +69,5 @@ export type PaginationRequest = {
|
|||
isBanner?: boolean;
|
||||
categoryIds?: string;
|
||||
createdByIds?: string;
|
||||
timeStamp?: number;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue