Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
9223122e66 | |
|
|
9e286ffd06 |
|
|
@ -22,8 +22,6 @@ steps:
|
||||||
- mkdir -p /opt/build
|
- mkdir -p /opt/build
|
||||||
- cd /opt/build
|
- cd /opt/build
|
||||||
- git clone http://38.47.180.165:3000/mediahub/mediahub-fe.git
|
- git clone http://38.47.180.165:3000/mediahub/mediahub-fe.git
|
||||||
- cd /opt/build/mediahub-fe
|
|
||||||
- git checkout $DRONE_BRANCH
|
|
||||||
|
|
||||||
- name: build image
|
- name: build image
|
||||||
when:
|
when:
|
||||||
|
|
|
||||||
4
.env
4
.env
|
|
@ -1,3 +1,3 @@
|
||||||
NEXT_PUBLIC_API=https://mediahub.polri.go.id/api/v2
|
NEXT_PUBLIC_API=https://new.netidhub.com/api
|
||||||
NEXT_PUBLIC=https://mediahub.polri.go.id
|
NEXT_PUBLIC=https://new.netidhub.com
|
||||||
NEXT_PUBLIC_TINYMCE_API_KEY=bhteuja26yz5p0aubxry9b95hs33amgn65kjv5km0fd5iuev
|
NEXT_PUBLIC_TINYMCE_API_KEY=bhteuja26yz5p0aubxry9b95hs33amgn65kjv5km0fd5iuev
|
||||||
|
|
@ -2,13 +2,12 @@ stages:
|
||||||
- build
|
- build
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
build-prod:
|
build-dev:
|
||||||
stage: build
|
stage: build
|
||||||
when: on_success
|
when: on_success
|
||||||
only:
|
only:
|
||||||
- main
|
- main
|
||||||
- dev-landing-v2
|
- dev-landing-v2
|
||||||
- prod
|
|
||||||
image:
|
image:
|
||||||
name: docker:25.0.3-cli
|
name: docker:25.0.3-cli
|
||||||
services:
|
services:
|
||||||
|
|
@ -16,11 +15,9 @@ build-prod:
|
||||||
command: ["--insecure-registry=38.47.185.86:8900"]
|
command: ["--insecure-registry=38.47.185.86:8900"]
|
||||||
script:
|
script:
|
||||||
- docker logout
|
- docker logout
|
||||||
- echo "Username:$DEPLOY_USERNAME"
|
- docker login -u $DEPLOY_USERNAME -p $DEPLOY_TOKEN 38.47.185.86:8900
|
||||||
- echo "Token:$DEPLOY_TOKEN"
|
- docker build -t 38.47.185.86:8900/mediahub/new-mediahub-fe:dev .
|
||||||
- echo "$DEPLOY_TOKEN" | docker login 38.47.185.86:8900 --username "$DEPLOY_USERNAME" --password-stdin
|
- docker push 38.47.185.86:8900/mediahub/new-mediahub-fe:dev
|
||||||
- docker build --no-cache -t 38.47.185.86:8900/mediahub/new-mediahub-fe:prod .
|
|
||||||
- docker push 38.47.185.86:8900/mediahub/new-mediahub-fe:prod
|
|
||||||
|
|
||||||
auto-deploy:
|
auto-deploy:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
|
|
@ -29,7 +26,5 @@ auto-deploy:
|
||||||
- main
|
- main
|
||||||
- dev-landing-v2
|
- dev-landing-v2
|
||||||
image: curlimages/curl:latest
|
image: curlimages/curl:latest
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
script:
|
script:
|
||||||
- curl --user admin:$JENKINS_PWD http://38.47.185.86:8080/job/auto-deploy-new-mediahub-fe/build?token=autodeploynewmediahub
|
- curl --user admin:$JENKINS_PWD http://38.47.185.86:8080/job/auto-deploy-new-mediahub-fe/build?token=autodeploynewmediahub
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,7 @@ RUN pnpm install
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Build aplikasi
|
# Build aplikasi
|
||||||
# RUN NODE_OPTIONS="--max-old-space-size=4096"
|
RUN NODE_OPTIONS="--max-old-space-size=4096" pnpm run build
|
||||||
RUN pnpm run build
|
|
||||||
|
|
||||||
# Expose port untuk server
|
# Expose port untuk server
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ const FormSchema = z.object({
|
||||||
.refine((val) => !/\s/.test(val), {
|
.refine((val) => !/\s/.test(val), {
|
||||||
message: "Username tidak boleh mengandung spasi",
|
message: "Username tidak boleh mengandung spasi",
|
||||||
}),
|
}),
|
||||||
// .transform((val) => val.toLowerCase()),
|
// .transform((val) => val.toLowerCase()),
|
||||||
|
|
||||||
password: z
|
password: z
|
||||||
.string({ required_error: "Required" })
|
.string({ required_error: "Required" })
|
||||||
|
|
@ -85,7 +85,6 @@ const FormSchema = z.object({
|
||||||
skills: z.string({ required_error: "Required" }),
|
skills: z.string({ required_error: "Required" }),
|
||||||
experiences: z.string({ required_error: "Required" }),
|
experiences: z.string({ required_error: "Required" }),
|
||||||
company: z.string({ required_error: "Required" }),
|
company: z.string({ required_error: "Required" }),
|
||||||
address: z.string({ required_error: "Required" }),
|
|
||||||
});
|
});
|
||||||
// .refine((data) => data.password === data.confirmPassword, {
|
// .refine((data) => data.password === data.confirmPassword, {
|
||||||
// path: ["confirmPassword"],
|
// path: ["confirmPassword"],
|
||||||
|
|
@ -117,7 +116,7 @@ export default function AddExpertForm() {
|
||||||
|
|
||||||
const togglePasswordType = () => {
|
const togglePasswordType = () => {
|
||||||
setPasswordType((prevType) =>
|
setPasswordType((prevType) =>
|
||||||
prevType === "password" ? "text" : "password",
|
prevType === "password" ? "text" : "password"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -149,14 +148,14 @@ export default function AddExpertForm() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const save = async (data: z.infer<typeof FormSchema>) => {
|
const save = async (data: z.infer<typeof FormSchema>) => {
|
||||||
// console.log("data", data);
|
console.log("data", data);
|
||||||
|
|
||||||
const dataReq = {
|
const dataReq = {
|
||||||
firstName: data.name,
|
firstName: data.name,
|
||||||
username: data.username,
|
username: data.username,
|
||||||
email: data.email,
|
email: data.email,
|
||||||
password: data.password,
|
password: data.password,
|
||||||
address: data.address,
|
address: "",
|
||||||
roleId: "EXP-ID",
|
roleId: "EXP-ID",
|
||||||
phoneNumber: data.phoneNumber,
|
phoneNumber: data.phoneNumber,
|
||||||
userCompetencyId: data.skills,
|
userCompetencyId: data.skills,
|
||||||
|
|
@ -265,20 +264,20 @@ export default function AddExpertForm() {
|
||||||
const handleSelectionChange = (
|
const handleSelectionChange = (
|
||||||
index: number,
|
index: number,
|
||||||
type: "roleId" | "userLevelId",
|
type: "roleId" | "userLevelId",
|
||||||
value: string,
|
value: string
|
||||||
) => {
|
) => {
|
||||||
setPlacementRows((prevRows) =>
|
setPlacementRows((prevRows) =>
|
||||||
prevRows.map((row) =>
|
prevRows.map((row) =>
|
||||||
row.index === index ? { ...row, [type]: value } : row,
|
row.index === index ? { ...row, [type]: value } : row
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRemoveRow = (index: number) => {
|
const handleRemoveRow = (index: number) => {
|
||||||
// console.log(index);
|
console.log(index);
|
||||||
// console.log(placementRows);
|
console.log(placementRows);
|
||||||
const newPlacements = placementRows.filter((row) => row.index != index);
|
const newPlacements = placementRows.filter((row) => row.index != index);
|
||||||
// console.log(newPlacements);
|
console.log(newPlacements);
|
||||||
setPlacementRows(newPlacements);
|
setPlacementRows(newPlacements);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -425,24 +424,6 @@ export default function AddExpertForm() {
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormField
|
|
||||||
control={form.control}
|
|
||||||
name="address"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem>
|
|
||||||
<FormLabel>Alamat</FormLabel>
|
|
||||||
<Input
|
|
||||||
type="text"
|
|
||||||
value={field.value}
|
|
||||||
placeholder="Masukkan Alamat"
|
|
||||||
onChange={field.onChange}
|
|
||||||
/>
|
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="password"
|
name="password"
|
||||||
|
|
@ -481,8 +462,8 @@ export default function AddExpertForm() {
|
||||||
passwordStrength === "weak"
|
passwordStrength === "weak"
|
||||||
? "bg-red-500 w-1/4"
|
? "bg-red-500 w-1/4"
|
||||||
: passwordStrength === "medium"
|
: passwordStrength === "medium"
|
||||||
? "bg-yellow-500 w-2/4"
|
? "bg-yellow-500 w-2/4"
|
||||||
: "bg-green-500 w-full"
|
: "bg-green-500 w-full"
|
||||||
}`}
|
}`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
@ -491,8 +472,8 @@ export default function AddExpertForm() {
|
||||||
passwordStrength === "weak"
|
passwordStrength === "weak"
|
||||||
? "text-red-500"
|
? "text-red-500"
|
||||||
: passwordStrength === "medium"
|
: passwordStrength === "medium"
|
||||||
? "text-yellow-600"
|
? "text-yellow-600"
|
||||||
: "text-green-600"
|
: "text-green-600"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{passwordStrength === "weak" && "Weak Password"}
|
{passwordStrength === "weak" && "Weak Password"}
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ export default function UpdateExpertForm() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const save = async (data: z.infer<typeof FormSchema>) => {
|
const save = async (data: z.infer<typeof FormSchema>) => {
|
||||||
// console.log("data", data);
|
console.log("data", data);
|
||||||
|
|
||||||
const dataReq = {
|
const dataReq = {
|
||||||
id: detail?.id,
|
id: detail?.id,
|
||||||
|
|
@ -310,7 +310,7 @@ export default function UpdateExpertForm() {
|
||||||
|
|
||||||
const resExperiences = await getListExperiences();
|
const resExperiences = await getListExperiences();
|
||||||
setUserExperiences(resExperiences?.data?.data);
|
setUserExperiences(resExperiences?.data?.data);
|
||||||
// console.log("experience", resExperiences?.data?.data);
|
console.log("experience", resExperiences?.data?.data);
|
||||||
|
|
||||||
const resUserLevels = await AdministrationLevelList();
|
const resUserLevels = await AdministrationLevelList();
|
||||||
const data = resUserLevels?.data?.data;
|
const data = resUserLevels?.data?.data;
|
||||||
|
|
@ -353,10 +353,10 @@ export default function UpdateExpertForm() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRemoveRow = (index: number) => {
|
const handleRemoveRow = (index: number) => {
|
||||||
// console.log(index);
|
console.log(index);
|
||||||
// console.log(placementRows);
|
console.log(placementRows);
|
||||||
const newPlacements = placementRows.filter((row) => row.index != index);
|
const newPlacements = placementRows.filter((row) => row.index != index);
|
||||||
// console.log(newPlacements);
|
console.log(newPlacements);
|
||||||
setPlacementRows(newPlacements);
|
setPlacementRows(newPlacements);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ export default function ContentManagement() {
|
||||||
const [ticket6, setTicket6] = useState("");
|
const [ticket6, setTicket6] = useState("");
|
||||||
const [isInternational, setIsInternational] = useState([false, false, false]);
|
const [isInternational, setIsInternational] = useState([false, false, false]);
|
||||||
|
|
||||||
const baseUrl = "https://db-mediahub.polri.go.id/";
|
const baseUrl = "https://analytic.sitani.info/";
|
||||||
const url = "https://db-mediahub.polri.go.id/trusted/";
|
const url = "https://analytic.sitani.info/trusted/";
|
||||||
|
|
||||||
const view1 =
|
const view1 =
|
||||||
levelName == "MABES POLRI"
|
levelName == "MABES POLRI"
|
||||||
|
|
@ -87,7 +87,7 @@ export default function ContentManagement() {
|
||||||
? "views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-intl?"
|
? "views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-intl?"
|
||||||
: "views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-intl?"
|
: "views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-intl?"
|
||||||
: `views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-intl?provinsi-polda=${poldaState}&`;
|
: `views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-intl?provinsi-polda=${poldaState}&`;
|
||||||
const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true";
|
const param = ":embed=yes&:toolbar=no&:iframeSizedToWindow=true";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function initState() {
|
async function initState() {
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ export default function EmergencyIssue() {
|
||||||
const [ticket6, setTicket6] = useState("");
|
const [ticket6, setTicket6] = useState("");
|
||||||
const [isInternational, setIsInternational] = useState([false, false, false]);
|
const [isInternational, setIsInternational] = useState([false, false, false]);
|
||||||
|
|
||||||
const baseUrl = "https://db-mediahub.polri.go.id/";
|
const baseUrl = "https://analytic.sitani.info/";
|
||||||
const url = "https://db-mediahub.polri.go.id/trusted/";
|
const url = "https://analytic.sitani.info/trusted/";
|
||||||
|
|
||||||
const view1 =
|
const view1 =
|
||||||
levelName == "MABES POLRI"
|
levelName == "MABES POLRI"
|
||||||
|
|
@ -53,7 +53,7 @@ export default function EmergencyIssue() {
|
||||||
: "views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue?"
|
: "views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue?"
|
||||||
: `views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue?provinsi-polda=${provState}&`;
|
: `views/2023_08_MediaHUB-KtnMgt_Rev100/db-emg-issue?provinsi-polda=${provState}&`;
|
||||||
|
|
||||||
const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true";
|
const param = ":embed=yes&:toolbar=no&:iframeSizedToWindow=true";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function initState() {
|
async function initState() {
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ export default function FeedbackCenter() {
|
||||||
const [ticket6, setTicket6] = useState("");
|
const [ticket6, setTicket6] = useState("");
|
||||||
const [isInternational, setIsInternational] = useState([false, false, false]);
|
const [isInternational, setIsInternational] = useState([false, false, false]);
|
||||||
|
|
||||||
const baseUrl = "https://db-mediahub.polri.go.id/";
|
const baseUrl = "https://analytic.sitani.info/";
|
||||||
const url = "https://db-mediahub.polri.go.id/trusted/";
|
const url = "https://analytic.sitani.info/trusted/";
|
||||||
|
|
||||||
const view1 =
|
const view1 =
|
||||||
levelName == "MABES POLRI"
|
levelName == "MABES POLRI"
|
||||||
|
|
@ -53,7 +53,7 @@ export default function FeedbackCenter() {
|
||||||
: "views/2023_08_MediaHUB-KtnMgt_Rev100/db-tickets?"
|
: "views/2023_08_MediaHUB-KtnMgt_Rev100/db-tickets?"
|
||||||
: `views/2023_08_MediaHUB-KtnMgt_Rev100/db-tickets?provinsi-polda=${provState}&`;
|
: `views/2023_08_MediaHUB-KtnMgt_Rev100/db-tickets?provinsi-polda=${provState}&`;
|
||||||
|
|
||||||
const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true";
|
const param = ":embed=yes&:toolbar=no&:iframeSizedToWindow=true";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function initState() {
|
async function initState() {
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ export default function ContentManagement() {
|
||||||
const [ticket6, setTicket6] = useState("");
|
const [ticket6, setTicket6] = useState("");
|
||||||
const [isInternational, setIsInternational] = useState([false, false, false]);
|
const [isInternational, setIsInternational] = useState([false, false, false]);
|
||||||
|
|
||||||
const baseUrl = "https://db-mediahub.polri.go.id/";
|
const baseUrl = "https://analytic.sitani.info/";
|
||||||
const url = "https://db-mediahub.polri.go.id/trusted/";
|
const url = "https://analytic.sitani.info/trusted/";
|
||||||
|
|
||||||
const view1 =
|
const view1 =
|
||||||
levelName == "MABES POLRI"
|
levelName == "MABES POLRI"
|
||||||
|
|
@ -69,7 +69,7 @@ export default function ContentManagement() {
|
||||||
: "views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-act-jnl?"
|
: "views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-act-jnl?"
|
||||||
: `views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-act-jnl?provinsi-polda=${poldaState}&`;
|
: `views/2023_08_MediaHUB-KtnMgt_Rev100/db-ktn-act-jnl?provinsi-polda=${poldaState}&`;
|
||||||
|
|
||||||
const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true";
|
const param = ":embed=yes&:toolbar=no&:iframeSizedToWindow=true";
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function initState() {
|
async function initState() {
|
||||||
|
|
|
||||||
|
|
@ -171,11 +171,11 @@ export default function CreateAccountForBroadcast() {
|
||||||
{/* WA */}
|
{/* WA */}
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={field.value?.includes("wa") ?? false}
|
checked={field.value.includes("wa")}
|
||||||
onCheckedChange={(checked) =>
|
onCheckedChange={(checked) =>
|
||||||
checked
|
checked
|
||||||
? field.onChange([...(field.value ?? []), "wa"])
|
? field.onChange([...field.value, "wa"])
|
||||||
: field.onChange((field.value ?? []).filter((v) => v !== "wa"))
|
: field.onChange(field.value.filter((v) => v !== "wa"))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<label>Whatsapp</label>
|
<label>Whatsapp</label>
|
||||||
|
|
@ -184,12 +184,12 @@ export default function CreateAccountForBroadcast() {
|
||||||
{/* EMAIL */}
|
{/* EMAIL */}
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={field.value?.includes("email") ?? false}
|
checked={field.value.includes("email")}
|
||||||
onCheckedChange={(checked) =>
|
onCheckedChange={(checked) =>
|
||||||
checked
|
checked
|
||||||
? field.onChange([...(field.value ?? []), "email"])
|
? field.onChange([...field.value, "email"])
|
||||||
: field.onChange(
|
: field.onChange(
|
||||||
(field.value ?? []).filter((v) => v !== "email")
|
field.value.filter((v) => v !== "email")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
@ -202,7 +202,7 @@ export default function CreateAccountForBroadcast() {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* FORM WHATSAPP */}
|
{/* FORM WHATSAPP */}
|
||||||
{selectedTypes?.includes("wa") && (
|
{selectedTypes.includes("wa") && (
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="whatsapp"
|
name="whatsapp"
|
||||||
|
|
@ -221,7 +221,7 @@ export default function CreateAccountForBroadcast() {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* FORM EMAIL */}
|
{/* FORM EMAIL */}
|
||||||
{selectedTypes?.includes("email") && (
|
{selectedTypes.includes("email") && (
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="email"
|
name="email"
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ export default function EditAccountForBroadcast() {
|
||||||
isDefault: false,
|
isDefault: false,
|
||||||
isAdmin: true,
|
isAdmin: true,
|
||||||
};
|
};
|
||||||
// console.log("data", data);
|
console.log("data", data);
|
||||||
|
|
||||||
const response = await saveUserInternal(reqData);
|
const response = await saveUserInternal(reqData);
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ const CampaignListTable = () => {
|
||||||
item.no = (page - 1) * 10 + index + 1;
|
item.no = (page - 1) * 10 + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", data);
|
console.log("contentData : ", data);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -117,8 +117,8 @@ export default function BroadcastCampaignDetail({
|
||||||
|
|
||||||
async function getListPaginationData() {
|
async function getListPaginationData() {
|
||||||
loading();
|
loading();
|
||||||
// console.log("Type : ", typeFilter);
|
console.log("Type : ", typeFilter);
|
||||||
// console.log("Date : ", startDateString, endDateString);
|
console.log("Date : ", startDateString, endDateString);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await getMediaBlastBroadcastList(
|
const res = await getMediaBlastBroadcastList(
|
||||||
|
|
@ -152,7 +152,7 @@ export default function BroadcastCampaignDetail({
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function setupData(rawData: PaginatedResponse) {
|
function setupData(rawData: PaginatedResponse) {
|
||||||
// console.log("raw", rawData);
|
console.log("raw", rawData);
|
||||||
if (rawData !== undefined) {
|
if (rawData !== undefined) {
|
||||||
const dataContent = rawData?.content;
|
const dataContent = rawData?.content;
|
||||||
const data: CampaignData[] = [];
|
const data: CampaignData[] = [];
|
||||||
|
|
@ -251,7 +251,7 @@ export default function BroadcastCampaignDetail({
|
||||||
setEndDateString(getOnlyDate(endDate));
|
setEndDateString(getOnlyDate(endDate));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// console.log("date range", dateRange);
|
console.log("date range", dateRange);
|
||||||
initState();
|
initState();
|
||||||
}, [calenderState, startDate, endDate]);
|
}, [calenderState, startDate, endDate]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ const BroadcastEmailTable = () => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", data);
|
console.log("contentData : ", data);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ const BroadcastWhatsAppTable = () => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", data);
|
console.log("contentData : ", data);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ export default function EditUserForm() {
|
||||||
const response = await getUserById(String(id));
|
const response = await getUserById(String(id));
|
||||||
const res = response?.data?.data;
|
const res = response?.data?.data;
|
||||||
close();
|
close();
|
||||||
// console.log("res", res);
|
console.log("res", res);
|
||||||
form.setValue("fullname", res?.fullname);
|
form.setValue("fullname", res?.fullname);
|
||||||
form.setValue("username", res?.username);
|
form.setValue("username", res?.username);
|
||||||
form.setValue("phoneNumber", res?.phoneNumber);
|
form.setValue("phoneNumber", res?.phoneNumber);
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ export default function EditUserForm() {
|
||||||
const response = await getUserById(String(id));
|
const response = await getUserById(String(id));
|
||||||
const res = response?.data?.data;
|
const res = response?.data?.data;
|
||||||
close();
|
close();
|
||||||
// console.log("res", res);
|
console.log("res", res);
|
||||||
form.setValue("fullname", res?.fullname);
|
form.setValue("fullname", res?.fullname);
|
||||||
form.setValue("username", res?.username);
|
form.setValue("username", res?.username);
|
||||||
form.setValue("phoneNumber", res?.phoneNumber);
|
form.setValue("phoneNumber", res?.phoneNumber);
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ export default function DetailUserForm() {
|
||||||
const response = await getUserById(String(id));
|
const response = await getUserById(String(id));
|
||||||
const res = response?.data?.data;
|
const res = response?.data?.data;
|
||||||
close();
|
close();
|
||||||
// console.log("res", res);
|
console.log("res", res);
|
||||||
if (Number(res.roleId) > 4) {
|
if (Number(res.roleId) > 4) {
|
||||||
form.setValue("fullname", res?.fullname);
|
form.setValue("fullname", res?.fullname);
|
||||||
form.setValue("username", res?.username);
|
form.setValue("username", res?.username);
|
||||||
|
|
@ -215,7 +215,7 @@ export default function DetailUserForm() {
|
||||||
form.setValue("level", String(res?.userLevelId));
|
form.setValue("level", String(res?.userLevelId));
|
||||||
} else {
|
} else {
|
||||||
initFetch();
|
initFetch();
|
||||||
// console.log("sadad", res?.role?.code);
|
console.log("sadad", res?.role?.code);
|
||||||
form.setValue("fullname", res?.fullname);
|
form.setValue("fullname", res?.fullname);
|
||||||
form.setValue("username", res?.username);
|
form.setValue("username", res?.username);
|
||||||
form.setValue("phoneNumber", res?.phoneNumber);
|
form.setValue("phoneNumber", res?.phoneNumber);
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ export default function EditUserForm() {
|
||||||
const response = await getUserById(String(id));
|
const response = await getUserById(String(id));
|
||||||
const res = response?.data?.data;
|
const res = response?.data?.data;
|
||||||
close();
|
close();
|
||||||
// console.log("res", res);
|
console.log("res", res);
|
||||||
if (Number(res.roleId) > 4) {
|
if (Number(res.roleId) > 4) {
|
||||||
form.setValue("fullname", res?.fullname);
|
form.setValue("fullname", res?.fullname);
|
||||||
form.setValue("username", res?.username);
|
form.setValue("username", res?.username);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export default function TrackingMediaModal(props: { triggerFetch: () => void })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/\s/.test(value)) {
|
if (/\s/.test(value)) {
|
||||||
// console.log("Terdapat spasi dalam input");
|
console.log("Terdapat spasi dalam input");
|
||||||
fecthAll();
|
fecthAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,11 +161,11 @@ const NewsTable = () => {
|
||||||
setCategoryFilter(
|
setCategoryFilter(
|
||||||
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
||||||
);
|
);
|
||||||
// console.log(
|
console.log(
|
||||||
// "Kategori",
|
"Kategori",
|
||||||
// categorie,
|
categorie,
|
||||||
// categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
||||||
// );
|
);
|
||||||
}
|
}
|
||||||
}, [categorie]);
|
}, [categorie]);
|
||||||
|
|
||||||
|
|
@ -177,7 +177,7 @@ const NewsTable = () => {
|
||||||
} else {
|
} else {
|
||||||
filter.splice(categoryFilter.indexOf(id), 1);
|
filter.splice(categoryFilter.indexOf(id), 1);
|
||||||
}
|
}
|
||||||
// console.log("checkbox filter", filter);
|
console.log("checkbox filter", filter);
|
||||||
setCategoryFilter(filter);
|
setCategoryFilter(filter);
|
||||||
router.push(`?category=${filter.join("&")}`);
|
router.push(`?category=${filter.join("&")}`);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -179,11 +179,11 @@ const ResultTable = () => {
|
||||||
setCategoryFilter(
|
setCategoryFilter(
|
||||||
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
||||||
);
|
);
|
||||||
// console.log(
|
console.log(
|
||||||
// "Kategori",
|
"Kategori",
|
||||||
// categorie,
|
categorie,
|
||||||
// categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
||||||
// );
|
);
|
||||||
}
|
}
|
||||||
}, [categorie]);
|
}, [categorie]);
|
||||||
|
|
||||||
|
|
@ -195,7 +195,7 @@ const ResultTable = () => {
|
||||||
} else {
|
} else {
|
||||||
filter.splice(categoryFilter.indexOf(id), 1);
|
filter.splice(categoryFilter.indexOf(id), 1);
|
||||||
}
|
}
|
||||||
// console.log("checkbox filter", filter);
|
console.log("checkbox filter", filter);
|
||||||
setCategoryFilter(filter);
|
setCategoryFilter(filter);
|
||||||
router.push(`?category=${filter.join("&")}`);
|
router.push(`?category=${filter.join("&")}`);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -151,11 +151,11 @@ const NewsTable = () => {
|
||||||
setCategoryFilter(
|
setCategoryFilter(
|
||||||
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
||||||
);
|
);
|
||||||
// console.log(
|
console.log(
|
||||||
// "Kategori",
|
"Kategori",
|
||||||
// categorie,
|
categorie,
|
||||||
// categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
categorie?.split("&")?.length > 1 ? categorie?.split("&") : [categorie]
|
||||||
// );
|
);
|
||||||
}
|
}
|
||||||
}, [categorie]);
|
}, [categorie]);
|
||||||
|
|
||||||
|
|
@ -167,7 +167,7 @@ const NewsTable = () => {
|
||||||
} else {
|
} else {
|
||||||
filter.splice(categoryFilter.indexOf(id), 1);
|
filter.splice(categoryFilter.indexOf(id), 1);
|
||||||
}
|
}
|
||||||
// console.log("checkbox filter", filter);
|
console.log("checkbox filter", filter);
|
||||||
setCategoryFilter(filter);
|
setCategoryFilter(filter);
|
||||||
router.push(`?category=${filter.join("&")}`);
|
router.push(`?category=${filter.join("&")}`);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import CustomPagination from "@/components/table/custom-pagination";
|
||||||
import { close, loading } from "@/config/swal";
|
import { close, loading } from "@/config/swal";
|
||||||
import withReactContent from "sweetalert2-react-content";
|
import withReactContent from "sweetalert2-react-content";
|
||||||
import Swal from "sweetalert2";
|
import Swal from "sweetalert2";
|
||||||
import { getCookiesDecrypt } from "@/lib/utils";
|
|
||||||
|
|
||||||
export default function TrackingBeritaCard() {
|
export default function TrackingBeritaCard() {
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("");
|
||||||
|
|
@ -78,7 +77,7 @@ export default function TrackingBeritaCard() {
|
||||||
|
|
||||||
const handleSelect = (id: number) => {
|
const handleSelect = (id: number) => {
|
||||||
setSelectedItems((prev) =>
|
setSelectedItems((prev) =>
|
||||||
prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id],
|
prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id]
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -87,24 +86,13 @@ export default function TrackingBeritaCard() {
|
||||||
MySwal.fire(
|
MySwal.fire(
|
||||||
"Peringatan",
|
"Peringatan",
|
||||||
"Pilih minimal 1 berita untuk disimpan.",
|
"Pilih minimal 1 berita untuk disimpan.",
|
||||||
"warning",
|
"warning"
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loading();
|
loading();
|
||||||
const levelNumber = Number(getCookiesDecrypt("ulne"));
|
|
||||||
|
|
||||||
const levelLimitMap: Record<number, number> = {
|
|
||||||
1: 5,
|
|
||||||
2: 2,
|
|
||||||
3: 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
const maxLimit = levelLimitMap[levelNumber] || 2;
|
|
||||||
|
|
||||||
const limitMessage = `Limit media tracking per hari sudah tercapai. Maksimal ${maxLimit} tracking per hari.`;
|
|
||||||
|
|
||||||
const promises = selectedItems.map(async (id) => {
|
const promises = selectedItems.map(async (id) => {
|
||||||
const res = await mediaTrackingSave({
|
const res = await mediaTrackingSave({
|
||||||
|
|
@ -113,31 +101,17 @@ export default function TrackingBeritaCard() {
|
||||||
scrapingPeriod: 3,
|
scrapingPeriod: 3,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// cek pesan API
|
||||||
if (!res?.data?.success) {
|
if (!res?.data?.success) {
|
||||||
throw new Error(res?.data?.message || limitMessage);
|
throw new Error(
|
||||||
|
res?.data?.message ||
|
||||||
|
"Limit media tracking per hari sudah tercapai. Maksimal 5 tracking per hari."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
|
|
||||||
// const promises = selectedItems.map(async (id) => {
|
|
||||||
// const res = await mediaTrackingSave({
|
|
||||||
// mediaUploadId: id,
|
|
||||||
// duration: 24,
|
|
||||||
// scrapingPeriod: 3,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // cek pesan API
|
|
||||||
// if (!res?.data?.success) {
|
|
||||||
// throw new Error(
|
|
||||||
// res?.data?.message ||
|
|
||||||
// "Limit media tracking per hari sudah tercapai. Maksimal 5 tracking per hari."
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return res;
|
|
||||||
// });
|
|
||||||
|
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
close();
|
close();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ export default function PerformancePolda() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<SiteBreadcrumb />
|
<SiteBreadcrumb />
|
||||||
{/* <p className="font-semibold">PERFORMANCE KUMULATIF PER POLDA</p> */}
|
<p className="font-semibold">PERFORMANCE KUMULATIF PER POLDA</p>
|
||||||
<PerformancePoldaViz />
|
<PerformancePoldaViz />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ export default function PerformancePolda() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<SiteBreadcrumb />
|
<SiteBreadcrumb />
|
||||||
{/* <p className="font-semibold">PERFORMANCE KUMULATIF PER POLRES</p> */}
|
<p className="font-semibold">PERFORMANCE KUMULATIF PER POLRES</p>
|
||||||
<PerformancePolresViz />
|
<PerformancePolresViz />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ export default function PerformanceSatker() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<SiteBreadcrumb />
|
<SiteBreadcrumb />
|
||||||
|
<p className="font-semibold">PERFORMANCE KUMULATIF PER SATKER</p>
|
||||||
<PerformanceSatkerViz />
|
<PerformanceSatkerViz />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ const BannerListTable = () => {
|
||||||
|
|
||||||
const response = await listBanner();
|
const response = await listBanner();
|
||||||
const data = response?.data?.data?.content;
|
const data = response?.data?.data?.content;
|
||||||
// console.log("banner", data);
|
console.log("banner", data);
|
||||||
setGetData(data);
|
setGetData(data);
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ const ContentListBanner = () => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", data);
|
console.log("contentData : ", data);
|
||||||
|
|
||||||
setData(contentData);
|
setData(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ const columns: ColumnDef<any>[] = [
|
||||||
|
|
||||||
const categoryDelete = async (id: number) => {
|
const categoryDelete = async (id: number) => {
|
||||||
const response = await deleteCategory(id);
|
const response = await deleteCategory(id);
|
||||||
// console.log(response);
|
console.log(response);
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
error(response.message);
|
error(response.message);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -300,11 +300,11 @@ export default function CreateCategoryModal() {
|
||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
return checked
|
return checked
|
||||||
? field.onChange([
|
? field.onChange([
|
||||||
...(field.value ?? []),
|
...field.value,
|
||||||
item.id,
|
item.id,
|
||||||
])
|
])
|
||||||
: field.onChange(
|
: field.onChange(
|
||||||
(field.value ?? []).filter(
|
field.value?.filter(
|
||||||
(value) => value !== item.id
|
(value) => value !== item.id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -371,11 +371,11 @@ export default function CreateCategoryModal() {
|
||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
return checked
|
return checked
|
||||||
? field.onChange([
|
? field.onChange([
|
||||||
...(field.value ?? []),
|
...field.value,
|
||||||
item.id,
|
item.id,
|
||||||
])
|
])
|
||||||
: field.onChange(
|
: field.onChange(
|
||||||
(field.value ?? []).filter(
|
field.value?.filter(
|
||||||
(value) => value !== item.id
|
(value) => value !== item.id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -443,11 +443,11 @@ export default function CreateCategoryModal() {
|
||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
return checked
|
return checked
|
||||||
? field.onChange([
|
? field.onChange([
|
||||||
...(field.value ?? []),
|
...field.value,
|
||||||
item.id,
|
item.id,
|
||||||
])
|
])
|
||||||
: field.onChange(
|
: field.onChange(
|
||||||
(field.value ?? []).filter(
|
field.value?.filter(
|
||||||
(value) => value !== item.id
|
(value) => value !== item.id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -326,11 +326,11 @@ export default function EditCategoryModal(props: {
|
||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
return checked
|
return checked
|
||||||
? field.onChange([
|
? field.onChange([
|
||||||
...(field.value ?? []),
|
...field.value,
|
||||||
item.id,
|
item.id,
|
||||||
])
|
])
|
||||||
: field.onChange(
|
: field.onChange(
|
||||||
(field.value ?? []).filter(
|
field.value?.filter(
|
||||||
(value) => value !== item.id
|
(value) => value !== item.id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -398,11 +398,11 @@ export default function EditCategoryModal(props: {
|
||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
return checked
|
return checked
|
||||||
? field.onChange([
|
? field.onChange([
|
||||||
...(field.value ?? []),
|
...field.value,
|
||||||
item.id,
|
item.id,
|
||||||
])
|
])
|
||||||
: field.onChange(
|
: field.onChange(
|
||||||
(field.value ?? []).filter(
|
field.value?.filter(
|
||||||
(value) => value !== item.id
|
(value) => value !== item.id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -473,11 +473,11 @@ export default function EditCategoryModal(props: {
|
||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
return checked
|
return checked
|
||||||
? field.onChange([
|
? field.onChange([
|
||||||
...(field.value ?? []),
|
...field.value,
|
||||||
item.id,
|
item.id,
|
||||||
])
|
])
|
||||||
: field.onChange(
|
: field.onChange(
|
||||||
(field.value ?? []).filter(
|
field.value?.filter(
|
||||||
(value) => value !== item.id
|
(value) => value !== item.id
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -150,11 +150,11 @@ export function UnitMapping(props: {
|
||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
return checked
|
return checked
|
||||||
? field.onChange([
|
? field.onChange([
|
||||||
...(field.value ?? []),
|
...field.value,
|
||||||
String(item.id),
|
String(item.id),
|
||||||
])
|
])
|
||||||
: field.onChange(
|
: field.onChange(
|
||||||
(field.value ?? []).filter(
|
field.value?.filter(
|
||||||
(value) => value !== String(item.id)
|
(value) => value !== String(item.id)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -223,11 +223,11 @@ export function UnitMapping(props: {
|
||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
return checked
|
return checked
|
||||||
? field.onChange([
|
? field.onChange([
|
||||||
...(field.value ?? []),
|
...field.value,
|
||||||
String(item.id),
|
String(item.id),
|
||||||
])
|
])
|
||||||
: field.onChange(
|
: field.onChange(
|
||||||
(field.value ?? []).filter(
|
field.value?.filter(
|
||||||
(value) => value !== String(item.id)
|
(value) => value !== String(item.id)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ const columns: ColumnDef<any>[] = [
|
||||||
|
|
||||||
const faqDelete = async (id: string) => {
|
const faqDelete = async (id: string) => {
|
||||||
const response = await deleteDataFAQ(id);
|
const response = await deleteDataFAQ(id);
|
||||||
// console.log(response);
|
console.log(response);
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
error(response.message);
|
error(response.message);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ const AdminFAQTable = () => {
|
||||||
loading();
|
loading();
|
||||||
const response = await getListFAQ();
|
const response = await getListFAQ();
|
||||||
const data = response?.data?.data;
|
const data = response?.data?.data;
|
||||||
// console.log("respone", response);
|
console.log("respone", response);
|
||||||
data.forEach((item: any, index: number) => {
|
data.forEach((item: any, index: number) => {
|
||||||
item.no = (page - 1) * 10 + index + 1;
|
item.no = (page - 1) * 10 + index + 1;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ const columns: ColumnDef<any>[] = [
|
||||||
|
|
||||||
const faqDelete = async (id: string) => {
|
const faqDelete = async (id: string) => {
|
||||||
const response = await deleteDataFAQ(id);
|
const response = await deleteDataFAQ(id);
|
||||||
// console.log(response);
|
console.log(response);
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
error(response.message);
|
error(response.message);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ const AdminFeedbackTable = () => {
|
||||||
loading();
|
loading();
|
||||||
const response = await getListFeedback();
|
const response = await getListFeedback();
|
||||||
const data = response?.data?.data;
|
const data = response?.data?.data;
|
||||||
// console.log("respone", response);
|
console.log("respone", response);
|
||||||
data.forEach((item: any, index: number) => {
|
data.forEach((item: any, index: number) => {
|
||||||
item.no = (page - 1) * 10 + index + 1;
|
item.no = (page - 1) * 10 + index + 1;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ const IklanListTable = () => {
|
||||||
|
|
||||||
const response = await listBanner();
|
const response = await listBanner();
|
||||||
const data = response?.data?.data?.content;
|
const data = response?.data?.data?.content;
|
||||||
// console.log("banner", data);
|
console.log("banner", data);
|
||||||
setGetData(data);
|
setGetData(data);
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ const AdvertisementsList = () => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", data);
|
console.log("contentData : ", data);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -1,255 +0,0 @@
|
||||||
"use client";
|
|
||||||
|
|
||||||
import * as React from "react";
|
|
||||||
import {
|
|
||||||
ColumnDef,
|
|
||||||
flexRender,
|
|
||||||
getCoreRowModel,
|
|
||||||
useReactTable,
|
|
||||||
} from "@tanstack/react-table";
|
|
||||||
|
|
||||||
import {
|
|
||||||
Table,
|
|
||||||
TableBody,
|
|
||||||
TableCell,
|
|
||||||
TableHead,
|
|
||||||
TableHeader,
|
|
||||||
TableRow,
|
|
||||||
} from "@/components/ui/table";
|
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
||||||
import { useTranslations } from "next-intl";
|
|
||||||
import { Icon } from "@iconify/react";
|
|
||||||
|
|
||||||
interface LicenseComponent {
|
|
||||||
id: string;
|
|
||||||
serialNumber: string;
|
|
||||||
licensor: string;
|
|
||||||
product: string;
|
|
||||||
customer: string;
|
|
||||||
capacity: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const LicenseTable = () => {
|
|
||||||
const t = useTranslations("Menu");
|
|
||||||
const [licenseData, setLicenseData] = React.useState<LicenseComponent[]>([]);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
// Static license data from XML file
|
|
||||||
const licenseComponents: LicenseComponent[] = [
|
|
||||||
{
|
|
||||||
id: "1",
|
|
||||||
serialNumber: "IDC-ML-134360021025",
|
|
||||||
licensor: "SmartFace Tech Private Limited",
|
|
||||||
product: "Intelligent Digital Content",
|
|
||||||
customer: "HUMAS POLRI Indonesia",
|
|
||||||
capacity: "Unlimited"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "2",
|
|
||||||
serialNumber: "ANV-ML-90370021025",
|
|
||||||
licensor: "SmartFace Tech Private Limited",
|
|
||||||
product: "Analytics and Visualization",
|
|
||||||
customer: "HUMAS POLRI Indonesia",
|
|
||||||
capacity: "Unlimited"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "3",
|
|
||||||
serialNumber: "CORA-L1.1-134400021025",
|
|
||||||
licensor: "SmartFace Tech Private Limited",
|
|
||||||
product: "Content Curation",
|
|
||||||
customer: "HUMAS POLRI Indonesia",
|
|
||||||
capacity: "Unlimited"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "4",
|
|
||||||
serialNumber: "TEMA-ML-134500021025",
|
|
||||||
licensor: "SmartFace Tech Private Limited",
|
|
||||||
product: "Content Management",
|
|
||||||
customer: "HUMAS POLRI Indonesia",
|
|
||||||
capacity: "Unlimited"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "5",
|
|
||||||
serialNumber: "ERI-L1.1-134900021025",
|
|
||||||
licensor: "SmartFace Tech Private Limited",
|
|
||||||
product: "Emergency Issue",
|
|
||||||
customer: "HUMAS POLRI Indonesia",
|
|
||||||
capacity: "Unlimited"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "6",
|
|
||||||
serialNumber: "FEC-L1.1-134800021025",
|
|
||||||
licensor: "SmartFace Tech Private Limited",
|
|
||||||
product: "Feedback Center",
|
|
||||||
customer: "HUMAS POLRI Indonesia",
|
|
||||||
capacity: "Unlimited"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "7",
|
|
||||||
serialNumber: "OPTIC-L.1.1-134600021025",
|
|
||||||
licensor: "SmartFace Tech Private Limited",
|
|
||||||
product: "Optimization Content",
|
|
||||||
customer: "HUMAS POLRI Indonesia",
|
|
||||||
capacity: "Unlimited"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "8",
|
|
||||||
serialNumber: "PREC-L1.1-134700021025",
|
|
||||||
licensor: "SmartFace Tech Private Limited",
|
|
||||||
product: "Press Conference",
|
|
||||||
customer: "HUMAS POLRI Indonesia",
|
|
||||||
capacity: "Unlimited"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
setLicenseData(licenseComponents);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const columns: ColumnDef<LicenseComponent>[] = [
|
|
||||||
{
|
|
||||||
accessorKey: "id",
|
|
||||||
header: "No",
|
|
||||||
cell: ({ row }) => (
|
|
||||||
<div className="font-medium">{row.getValue("id")}</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: "product",
|
|
||||||
header: "Product",
|
|
||||||
cell: ({ row }) => (
|
|
||||||
<div className="font-medium">{row.getValue("product")}</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: "serialNumber",
|
|
||||||
header: "Serial Number",
|
|
||||||
cell: ({ row }) => (
|
|
||||||
<div className="font-mono text-sm">{row.getValue("serialNumber")}</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: "licensor",
|
|
||||||
header: "Licensor",
|
|
||||||
cell: ({ row }) => <div>{row.getValue("licensor")}</div>,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: "customer",
|
|
||||||
header: "Customer",
|
|
||||||
cell: ({ row }) => <div>{row.getValue("customer")}</div>,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accessorKey: "capacity",
|
|
||||||
header: "Capacity",
|
|
||||||
cell: ({ row }) => (
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
|
|
||||||
{row.getValue("capacity")}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const table = useReactTable({
|
|
||||||
data: licenseData,
|
|
||||||
columns,
|
|
||||||
getCoreRowModel: getCoreRowModel(),
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Card>
|
|
||||||
<CardHeader>
|
|
||||||
<div className="flex items-center justify-between">
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Icon icon="heroicons:key" className="w-6 h-6 text-primary" />
|
|
||||||
<CardTitle>{t("license")} Information</CardTitle>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p className="text-sm text-muted-foreground mt-2">
|
|
||||||
License details for SmartFace Tech products - Valid start from 2025
|
|
||||||
</p>
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent>
|
|
||||||
<div className="rounded-md border">
|
|
||||||
<Table>
|
|
||||||
<TableHeader>
|
|
||||||
{table.getHeaderGroups().map((headerGroup) => (
|
|
||||||
<TableRow key={headerGroup.id}>
|
|
||||||
{headerGroup.headers.map((header) => (
|
|
||||||
<TableHead key={header.id}>
|
|
||||||
{header.isPlaceholder
|
|
||||||
? null
|
|
||||||
: flexRender(
|
|
||||||
header.column.columnDef.header,
|
|
||||||
header.getContext()
|
|
||||||
)}
|
|
||||||
</TableHead>
|
|
||||||
))}
|
|
||||||
</TableRow>
|
|
||||||
))}
|
|
||||||
</TableHeader>
|
|
||||||
<TableBody>
|
|
||||||
{table.getRowModel().rows?.length ? (
|
|
||||||
table.getRowModel().rows.map((row) => (
|
|
||||||
<TableRow
|
|
||||||
key={row.id}
|
|
||||||
data-state={row.getIsSelected() && "selected"}
|
|
||||||
>
|
|
||||||
{row.getVisibleCells().map((cell) => (
|
|
||||||
<TableCell key={cell.id}>
|
|
||||||
{flexRender(
|
|
||||||
cell.column.columnDef.cell,
|
|
||||||
cell.getContext()
|
|
||||||
)}
|
|
||||||
</TableCell>
|
|
||||||
))}
|
|
||||||
</TableRow>
|
|
||||||
))
|
|
||||||
) : (
|
|
||||||
<TableRow>
|
|
||||||
<TableCell
|
|
||||||
colSpan={columns.length}
|
|
||||||
className="h-24 text-center"
|
|
||||||
>
|
|
||||||
No license data available.
|
|
||||||
</TableCell>
|
|
||||||
</TableRow>
|
|
||||||
)}
|
|
||||||
</TableBody>
|
|
||||||
</Table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{licenseData.length > 0 && (
|
|
||||||
<div className="mt-4 p-4 bg-muted/50 rounded-lg">
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Icon icon="heroicons:building-office" className="w-5 h-5 text-primary" />
|
|
||||||
<div>
|
|
||||||
<p className="text-sm font-medium">Customer</p>
|
|
||||||
<p className="text-sm text-muted-foreground">{licenseData[0]?.customer}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Icon icon="heroicons:building-library" className="w-5 h-5 text-primary" />
|
|
||||||
<div>
|
|
||||||
<p className="text-sm font-medium">Licensor</p>
|
|
||||||
<p className="text-sm text-muted-foreground">{licenseData[0]?.licensor}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Icon icon="heroicons:cube" className="w-5 h-5 text-primary" />
|
|
||||||
<div>
|
|
||||||
<p className="text-sm font-medium">Total Components</p>
|
|
||||||
<p className="text-sm text-muted-foreground">{licenseData.length} Products Licensed</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default LicenseTable;
|
|
||||||
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
"use client";
|
|
||||||
import SiteBreadcrumb from "@/components/site-breadcrumb";
|
|
||||||
import LicenseTable from "./component/table";
|
|
||||||
|
|
||||||
export default function LicensePage() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<SiteBreadcrumb />
|
|
||||||
<LicenseTable />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ const PopUpListTable = () => {
|
||||||
|
|
||||||
const response = await getListPopUp();
|
const response = await getListPopUp();
|
||||||
const data = response?.data?.data?.content;
|
const data = response?.data?.data?.content;
|
||||||
// console.log("banner", data);
|
console.log("banner", data);
|
||||||
setGetData(data);
|
setGetData(data);
|
||||||
|
|
||||||
close();
|
close();
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ const ContentListPopUp = () => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", data);
|
console.log("contentData : ", data);
|
||||||
|
|
||||||
setData(contentData);
|
setData(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ export default function DetailSettingTracking(props: {
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSubmit = (values: any) => {
|
const onSubmit = (values: any) => {
|
||||||
// console.log("Submitted values:", values);
|
console.log("Submitted values:", values);
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -98,11 +98,11 @@ export default function DetailSettingTracking(props: {
|
||||||
{wilayahList.map((item) => (
|
{wilayahList.map((item) => (
|
||||||
<div key={item.id} className="flex items-center gap-2">
|
<div key={item.id} className="flex items-center gap-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={field.value?.includes(item.id) ?? false}
|
checked={field.value.includes(item.id)}
|
||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
const updated = checked
|
const updated = checked
|
||||||
? [...(field.value ?? []), item.id]
|
? [...field.value, item.id]
|
||||||
: (field.value ?? []).filter((val) => val !== item.id);
|
: field.value.filter((val) => val !== item.id);
|
||||||
field.onChange(updated);
|
field.onChange(updated);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
@ -124,11 +124,11 @@ export default function DetailSettingTracking(props: {
|
||||||
{jumlahList.map((num) => (
|
{jumlahList.map((num) => (
|
||||||
<div key={num} className="flex items-center gap-2">
|
<div key={num} className="flex items-center gap-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={field.value?.includes(num) ?? false}
|
checked={field.value.includes(num)}
|
||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
const updated = checked
|
const updated = checked
|
||||||
? [...(field.value ?? []), num]
|
? [...field.value, num]
|
||||||
: (field.value ?? []).filter((val) => val !== num);
|
: field.value.filter((val) => val !== num);
|
||||||
field.onChange(updated);
|
field.onChange(updated);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ export default function UpdateSettingTracking(props: {
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSubmit = (values: any) => {
|
const onSubmit = (values: any) => {
|
||||||
// console.log("Submitted values:", values);
|
console.log("Submitted values:", values);
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -98,11 +98,11 @@ export default function UpdateSettingTracking(props: {
|
||||||
{wilayahList.map((item) => (
|
{wilayahList.map((item) => (
|
||||||
<div key={item.id} className="flex items-center gap-2">
|
<div key={item.id} className="flex items-center gap-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={field.value?.includes(item.id) ?? false}
|
checked={field.value.includes(item.id)}
|
||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
const updated = checked
|
const updated = checked
|
||||||
? [...(field.value ?? []), item.id]
|
? [...field.value, item.id]
|
||||||
: (field.value ?? []).filter((val) => val !== item.id);
|
: field.value.filter((val) => val !== item.id);
|
||||||
field.onChange(updated);
|
field.onChange(updated);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
@ -124,11 +124,11 @@ export default function UpdateSettingTracking(props: {
|
||||||
{jumlahList.map((num) => (
|
{jumlahList.map((num) => (
|
||||||
<div key={num} className="flex items-center gap-2">
|
<div key={num} className="flex items-center gap-2">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={field.value?.includes(num) ?? false}
|
checked={field.value.includes(num)}
|
||||||
onCheckedChange={(checked) => {
|
onCheckedChange={(checked) => {
|
||||||
const updated = checked
|
const updated = checked
|
||||||
? [...(field.value ?? []), num]
|
? [...field.value, num]
|
||||||
: (field.value ?? []).filter((val) => val !== num);
|
: field.value.filter((val) => val !== num);
|
||||||
field.onChange(updated);
|
field.onChange(updated);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ export default function CreateTagModal() {
|
||||||
categoryId: Number(data.category),
|
categoryId: Number(data.category),
|
||||||
isActive: true,
|
isActive: true,
|
||||||
};
|
};
|
||||||
// console.log("reqqq", request);
|
console.log("reqqq", request);
|
||||||
// const response = await postDataFeedback(request);
|
// const response = await postDataFeedback(request);
|
||||||
// close();
|
// close();
|
||||||
// if (response?.error) {
|
// if (response?.error) {
|
||||||
|
|
@ -93,7 +93,7 @@ export default function CreateTagModal() {
|
||||||
async function getCategoryParent() {
|
async function getCategoryParent() {
|
||||||
const response = await getCategoriesAll();
|
const response = await getCategoriesAll();
|
||||||
const res = response?.data?.data.content;
|
const res = response?.data?.data.content;
|
||||||
// console.log("res", res);
|
console.log("res", res);
|
||||||
var levelsArr: { id: number; label: string; value: string }[] = [];
|
var levelsArr: { id: number; label: string; value: string }[] = [];
|
||||||
res.forEach((levels: { id: number; name: string }) => {
|
res.forEach((levels: { id: number; name: string }) => {
|
||||||
levelsArr.push({
|
levelsArr.push({
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ export default function EditTagModal(props: {
|
||||||
async function getCategoryParent() {
|
async function getCategoryParent() {
|
||||||
const response = await getCategoriesAll();
|
const response = await getCategoriesAll();
|
||||||
const res = response?.data?.data.content;
|
const res = response?.data?.data.content;
|
||||||
// console.log("res", res);
|
console.log("res", res);
|
||||||
var levelsArr: { id: number; label: string; value: string }[] = [];
|
var levelsArr: { id: number; label: string; value: string }[] = [];
|
||||||
res.forEach((levels: { id: number; name: string }) => {
|
res.forEach((levels: { id: number; name: string }) => {
|
||||||
levelsArr.push({
|
levelsArr.push({
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ const SurveyListTable = () => {
|
||||||
item.no = (page - 1) * 10 + index + 1;
|
item.no = (page - 1) * 10 + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", data);
|
console.log("contentData : ", data);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ const CalendarView = ({ categories }: CalendarViewProps) => {
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// console.log("Event Data : ", events);
|
console.log("Event Data : ", events);
|
||||||
setCalendarEvents(events);
|
setCalendarEvents(events);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
@ -217,7 +217,7 @@ const CalendarView = ({ categories }: CalendarViewProps) => {
|
||||||
|
|
||||||
const filteredEvents = calendarEvents.filter((event) => {
|
const filteredEvents = calendarEvents.filter((event) => {
|
||||||
if (!selectedCategory.length) return false;
|
if (!selectedCategory.length) return false;
|
||||||
// console.log("Event category : ", selectedCategory);
|
console.log("Event category : ", selectedCategory);
|
||||||
|
|
||||||
const eventCategories = event.extendedProps.calendar
|
const eventCategories = event.extendedProps.calendar
|
||||||
?.split(",")
|
?.split(",")
|
||||||
|
|
|
||||||
|
|
@ -726,7 +726,7 @@ const EventModal = ({
|
||||||
endDate: date?.to ? format(date.to, "yyyy-MM-dd") : null,
|
endDate: date?.to ? format(date.to, "yyyy-MM-dd") : null,
|
||||||
};
|
};
|
||||||
|
|
||||||
// console.log("Submitted Data:", reqData);
|
console.log("Submitted Data:", reqData);
|
||||||
|
|
||||||
const response = await saveAgendaSettings(reqData);
|
const response = await saveAgendaSettings(reqData);
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
@ -794,6 +794,9 @@ const EventModal = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log("Event data:", event);
|
||||||
|
console.log("Selected date:", selectedDate);
|
||||||
|
|
||||||
if (selectedDate) {
|
if (selectedDate) {
|
||||||
setDate({
|
setDate({
|
||||||
from: selectedDate.date,
|
from: selectedDate.date,
|
||||||
|
|
@ -826,7 +829,7 @@ const EventModal = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleExpand = (poldaId: any) => {
|
const toggleExpand = (poldaId: any) => {
|
||||||
// console.log("Toogle : ", expandedPolda);
|
console.log("Toogle : ", expandedPolda);
|
||||||
setExpandedPolda((prev: any) => ({
|
setExpandedPolda((prev: any) => ({
|
||||||
...prev,
|
...prev,
|
||||||
[poldaId]: !prev[poldaId],
|
[poldaId]: !prev[poldaId],
|
||||||
|
|
@ -887,7 +890,7 @@ const EventModal = ({
|
||||||
fileTypeId: string,
|
fileTypeId: string,
|
||||||
duration: string
|
duration: string
|
||||||
) {
|
) {
|
||||||
// console.log(idx, id, file, fileTypeId, duration);
|
console.log(idx, id, file, fileTypeId, duration);
|
||||||
|
|
||||||
const resCsrf = await getCsrfToken();
|
const resCsrf = await getCsrfToken();
|
||||||
const csrfToken = resCsrf?.data?.token;
|
const csrfToken = resCsrf?.data?.token;
|
||||||
|
|
@ -912,7 +915,7 @@ const EventModal = ({
|
||||||
xhr.withCredentials = true;
|
xhr.withCredentials = true;
|
||||||
},
|
},
|
||||||
onError: async (e: any) => {
|
onError: async (e: any) => {
|
||||||
// console.log("Error upload :", e);
|
console.log("Error upload :", e);
|
||||||
error(e);
|
error(e);
|
||||||
},
|
},
|
||||||
onChunkComplete: (
|
onChunkComplete: (
|
||||||
|
|
@ -1034,7 +1037,7 @@ const EventModal = ({
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
if (redirect === window.location.pathname) {
|
if (redirect === window.location.pathname) {
|
||||||
fetch(redirect, { method: "GET", cache: "reload" }).then(() => {
|
fetch(redirect, { method: "GET", cache: "reload" }).then(() => {
|
||||||
// console.log("Data diperbarui.");
|
console.log("Data diperbarui.");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
window.location.href = redirect;
|
window.location.href = redirect;
|
||||||
|
|
@ -1136,7 +1139,7 @@ const EventModal = ({
|
||||||
defaultMonth={date?.from}
|
defaultMonth={date?.from}
|
||||||
selected={date}
|
selected={date}
|
||||||
onSelect={(newDate) => {
|
onSelect={(newDate) => {
|
||||||
// console.log("Date selected:", newDate);
|
console.log("Date selected:", newDate);
|
||||||
setDate(newDate);
|
setDate(newDate);
|
||||||
if (newDate?.from && newDate?.to) {
|
if (newDate?.from && newDate?.to) {
|
||||||
setIsDatePickerOpen(false);
|
setIsDatePickerOpen(false);
|
||||||
|
|
|
||||||
|
|
@ -22,14 +22,14 @@ const CalenderPage = () => {
|
||||||
let valueShowed: string[] = [];
|
let valueShowed: string[] = [];
|
||||||
if (userLevelNumber == 1) {
|
if (userLevelNumber == 1) {
|
||||||
valueShowed = ["0", "1", "2", "3", "4", "5"];
|
valueShowed = ["0", "1", "2", "3", "4", "5"];
|
||||||
} else if (userLevelNumber == 2 && userLevelId != 771) {
|
} else if (userLevelNumber == 2 && userLevelId != 761) {
|
||||||
valueShowed = ["2", "3"];
|
valueShowed = ["2", "3"];
|
||||||
} else if (
|
} else if (
|
||||||
(userLevelNumber == 2 && userLevelId == 771) ||
|
(userLevelNumber == 2 && userLevelId == 761) ||
|
||||||
(userLevelNumber == 3 && userParentLevelId == 771)
|
(userLevelNumber == 3 && userParentLevelId == 761)
|
||||||
) {
|
) {
|
||||||
valueShowed = ["4"];
|
valueShowed = ["4"];
|
||||||
} else if (userLevelNumber == 3 && userParentLevelId != 771) {
|
} else if (userLevelNumber == 3 && userParentLevelId != 761) {
|
||||||
valueShowed = ["3"];
|
valueShowed = ["3"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ const CalenderPage = () => {
|
||||||
...category,
|
...category,
|
||||||
activeClass: "",
|
activeClass: "",
|
||||||
}));
|
}));
|
||||||
// console.log(formattedCategories);
|
console.log(formattedCategories);
|
||||||
setCategories(formattedCategories);
|
setCategories(formattedCategories);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ const BlogTable = () => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", contentData);
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -105,13 +105,13 @@ const useTableColumns = () => {
|
||||||
if (isPublish && !isPublishOnPolda) {
|
if (isPublish && !isPublishOnPolda) {
|
||||||
displayText = "Mabes";
|
displayText = "Mabes";
|
||||||
} else if (isPublish && isPublishOnPolda) {
|
} else if (isPublish && isPublishOnPolda) {
|
||||||
if (Number(creatorGroupParentLevelId) == 771) {
|
if (Number(creatorGroupParentLevelId) == 761) {
|
||||||
displayText = "Mabes & Satker";
|
displayText = "Mabes & Satker";
|
||||||
} else {
|
} else {
|
||||||
displayText = "Mabes & Polda";
|
displayText = "Mabes & Polda";
|
||||||
}
|
}
|
||||||
} else if (!isPublish && isPublishOnPolda) {
|
} else if (!isPublish && isPublishOnPolda) {
|
||||||
if (Number(creatorGroupParentLevelId) == 771) {
|
if (Number(creatorGroupParentLevelId) == 761) {
|
||||||
displayText = "Satker";
|
displayText = "Satker";
|
||||||
} else {
|
} else {
|
||||||
displayText = "Polda";
|
displayText = "Polda";
|
||||||
|
|
|
||||||
|
|
@ -107,13 +107,13 @@ const useTableColumns = () => {
|
||||||
if (isPublish && !isPublishOnPolda) {
|
if (isPublish && !isPublishOnPolda) {
|
||||||
displayText = "Mabes";
|
displayText = "Mabes";
|
||||||
} else if (isPublish && isPublishOnPolda) {
|
} else if (isPublish && isPublishOnPolda) {
|
||||||
if (Number(creatorGroupParentLevelId) == 771) {
|
if (Number(creatorGroupParentLevelId) == 761) {
|
||||||
displayText = "Mabes & Satker";
|
displayText = "Mabes & Satker";
|
||||||
} else {
|
} else {
|
||||||
displayText = "Mabes & Polda";
|
displayText = "Mabes & Polda";
|
||||||
}
|
}
|
||||||
} else if (!isPublish && isPublishOnPolda) {
|
} else if (!isPublish && isPublishOnPolda) {
|
||||||
if (Number(creatorGroupParentLevelId) == 771) {
|
if (Number(creatorGroupParentLevelId) == 761) {
|
||||||
displayText = "Satker";
|
displayText = "Satker";
|
||||||
} else {
|
} else {
|
||||||
displayText = "Polda";
|
displayText = "Polda";
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ const TableImage = () => {
|
||||||
const [totalPage, setTotalPage] = React.useState(1);
|
const [totalPage, setTotalPage] = React.useState(1);
|
||||||
const [sorting, setSorting] = React.useState<SortingState>([]);
|
const [sorting, setSorting] = React.useState<SortingState>([]);
|
||||||
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
|
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
|
||||||
[],
|
[]
|
||||||
);
|
);
|
||||||
const [columnVisibility, setColumnVisibility] =
|
const [columnVisibility, setColumnVisibility] =
|
||||||
React.useState<VisibilityState>({});
|
React.useState<VisibilityState>({});
|
||||||
|
|
@ -64,7 +64,7 @@ const TableImage = () => {
|
||||||
const [searchTimeout, setSearchTimeout] = React.useState<any>(null);
|
const [searchTimeout, setSearchTimeout] = React.useState<any>(null);
|
||||||
const [categories, setCategories] = React.useState<any[]>([]);
|
const [categories, setCategories] = React.useState<any[]>([]);
|
||||||
const [selectedCategories, setSelectedCategories] = React.useState<number[]>(
|
const [selectedCategories, setSelectedCategories] = React.useState<number[]>(
|
||||||
[],
|
[]
|
||||||
);
|
);
|
||||||
const [categoryFilter, setCategoryFilter] = React.useState<string>("");
|
const [categoryFilter, setCategoryFilter] = React.useState<string>("");
|
||||||
const [statusFilter, setStatusFilter] = React.useState<any[]>([]);
|
const [statusFilter, setStatusFilter] = React.useState<any[]>([]);
|
||||||
|
|
@ -170,10 +170,6 @@ const TableImage = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const isForSelf = Number(roleId) === 4;
|
const isForSelf = Number(roleId) === 4;
|
||||||
|
|
||||||
const isNeedApproval = statusFilter.includes(1);
|
|
||||||
const needApprovalFrom = isNeedApproval ? userLevelId : "";
|
|
||||||
|
|
||||||
const res = await listDataImage(
|
const res = await listDataImage(
|
||||||
parseInt(showData) || 10,
|
parseInt(showData) || 10,
|
||||||
page - 1,
|
page - 1,
|
||||||
|
|
@ -181,33 +177,16 @@ const TableImage = () => {
|
||||||
!isForSelf,
|
!isForSelf,
|
||||||
categoryFilter,
|
categoryFilter,
|
||||||
statusFilter,
|
statusFilter,
|
||||||
needApprovalFrom,
|
statusFilter?.sort().join(",").includes("1") ? userLevelId : "",
|
||||||
filterByCreator,
|
filterByCreator,
|
||||||
filterBySource,
|
filterBySource,
|
||||||
formattedStartDate,
|
formattedStartDate,
|
||||||
formattedEndDate,
|
formattedEndDate,
|
||||||
customSearch ?? search,
|
customSearch ?? search,
|
||||||
filterByCreatorGroup,
|
filterByCreatorGroup,
|
||||||
locale == "en",
|
locale == "en"
|
||||||
);
|
);
|
||||||
|
|
||||||
// const res = await listDataImage(
|
|
||||||
// parseInt(showData) || 10,
|
|
||||||
// page - 1,
|
|
||||||
// isForSelf,
|
|
||||||
// !isForSelf,
|
|
||||||
// categoryFilter,
|
|
||||||
// statusFilter,
|
|
||||||
// statusFilter?.sort().join(",").includes("1") ? userLevelId : "",
|
|
||||||
// filterByCreator,
|
|
||||||
// filterBySource,
|
|
||||||
// formattedStartDate,
|
|
||||||
// formattedEndDate,
|
|
||||||
// customSearch ?? search,
|
|
||||||
// filterByCreatorGroup,
|
|
||||||
// locale == "en"
|
|
||||||
// );
|
|
||||||
|
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
const contentData = data?.content || [];
|
const contentData = data?.content || [];
|
||||||
const newData = contentData.map((item: any, index: number) => ({
|
const newData = contentData.map((item: any, index: number) => ({
|
||||||
|
|
@ -230,7 +209,7 @@ const TableImage = () => {
|
||||||
setSelectedCategories((prev) =>
|
setSelectedCategories((prev) =>
|
||||||
prev.includes(categoryId)
|
prev.includes(categoryId)
|
||||||
? prev.filter((id) => id !== categoryId)
|
? prev.filter((id) => id !== categoryId)
|
||||||
: [...prev, categoryId],
|
: [...prev, categoryId]
|
||||||
);
|
);
|
||||||
|
|
||||||
setCategoryFilter((prev) => {
|
setCategoryFilter((prev) => {
|
||||||
|
|
@ -246,7 +225,7 @@ const TableImage = () => {
|
||||||
setStatusFilter((prev: any) =>
|
setStatusFilter((prev: any) =>
|
||||||
prev.includes(value)
|
prev.includes(value)
|
||||||
? prev.filter((status: any) => status !== value)
|
? prev.filter((status: any) => status !== value)
|
||||||
: [...prev, value],
|
: [...prev, value]
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -274,14 +253,14 @@ const TableImage = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSearchFilterByCreator = (
|
const handleSearchFilterByCreator = (
|
||||||
e: React.ChangeEvent<HTMLInputElement>,
|
e: React.ChangeEvent<HTMLInputElement>
|
||||||
) => {
|
) => {
|
||||||
setFilterByCreator(e.target.value);
|
setFilterByCreator(e.target.value);
|
||||||
fetchData();
|
fetchData();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSearchFilterBySource = (
|
const handleSearchFilterBySource = (
|
||||||
e: React.ChangeEvent<HTMLInputElement>,
|
e: React.ChangeEvent<HTMLInputElement>
|
||||||
) => {
|
) => {
|
||||||
setFilterBySource(e.target.value);
|
setFilterBySource(e.target.value);
|
||||||
fetchData();
|
fetchData();
|
||||||
|
|
@ -451,10 +430,10 @@ const TableImage = () => {
|
||||||
id === 1
|
id === 1
|
||||||
? "Menunggu Review"
|
? "Menunggu Review"
|
||||||
: id === 2
|
: id === 2
|
||||||
? "Diterima"
|
? "Diterima"
|
||||||
: id === 3
|
: id === 3
|
||||||
? "Minta Update"
|
? "Minta Update"
|
||||||
: "Ditolak";
|
: "Ditolak";
|
||||||
return (
|
return (
|
||||||
<div key={id} className="flex items-center px-4 py-1">
|
<div key={id} className="flex items-center px-4 py-1">
|
||||||
<input
|
<input
|
||||||
|
|
@ -512,7 +491,7 @@ const TableImage = () => {
|
||||||
? null
|
? null
|
||||||
: flexRender(
|
: flexRender(
|
||||||
header.column.columnDef.header,
|
header.column.columnDef.header,
|
||||||
header.getContext(),
|
header.getContext()
|
||||||
)}
|
)}
|
||||||
</TableHead>
|
</TableHead>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ const TableTeks = () => {
|
||||||
item.no = (page - 1) * limit + index + 1;
|
item.no = (page - 1) * limit + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", contentData);
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import {
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
import { format, parseISO } from "date-fns";
|
import { format } from "date-fns";
|
||||||
import { Link } from "@/components/navigation";
|
import { Link } from "@/components/navigation";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import withReactContent from "sweetalert2-react-content";
|
import withReactContent from "sweetalert2-react-content";
|
||||||
|
|
@ -118,43 +118,21 @@ const useTableColumns = () => {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// accessorKey: "contentCreatedDate",
|
|
||||||
// header: t("upload-date", { defaultValue: "Upload Date" }),
|
|
||||||
// cell: ({ row }) => {
|
|
||||||
// const createdAt = row.getValue("contentCreatedDate") as
|
|
||||||
// | string
|
|
||||||
// | number
|
|
||||||
// | undefined;
|
|
||||||
// const formattedDate =
|
|
||||||
// createdAt && !isNaN(new Date(createdAt).getTime())
|
|
||||||
// ? format(new Date(createdAt), "dd-MM-yyyy HH:mm:ss")
|
|
||||||
// : "-";
|
|
||||||
// return <span className="whitespace-nowrap">{formattedDate}</span>;
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
accessorKey: "contentCreatedDate",
|
accessorKey: "contentCreatedDate",
|
||||||
header: t("upload-date", { defaultValue: "Upload Date" }),
|
header: t("upload-date", { defaultValue: "Upload Date" }),
|
||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
const createdAt = row.getValue("contentCreatedDate") as string | null;
|
const createdAt = row.getValue("contentCreatedDate") as
|
||||||
|
| string
|
||||||
if (!createdAt) return <span>-</span>;
|
| number
|
||||||
|
| undefined;
|
||||||
// parse ISO string dari API (UTC)
|
const formattedDate =
|
||||||
const date = parseISO(createdAt);
|
createdAt && !isNaN(new Date(createdAt).getTime())
|
||||||
|
? format(new Date(createdAt), "dd-MM-yyyy HH:mm:ss")
|
||||||
// geser balik dengan timezoneOffset supaya yang tampil = UTC
|
: "-";
|
||||||
const utcDate = new Date(
|
|
||||||
date.getTime() + date.getTimezoneOffset() * 60000
|
|
||||||
);
|
|
||||||
|
|
||||||
const formattedDate = format(utcDate, "dd-MM-yyyy HH:mm:ss");
|
|
||||||
|
|
||||||
return <span className="whitespace-nowrap">{formattedDate}</span>;
|
return <span className="whitespace-nowrap">{formattedDate}</span>;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
id: "actions",
|
id: "actions",
|
||||||
accessorKey: "action",
|
accessorKey: "action",
|
||||||
|
|
@ -166,7 +144,7 @@ const useTableColumns = () => {
|
||||||
|
|
||||||
const handleClick = (e: React.MouseEvent) => {
|
const handleClick = (e: React.MouseEvent) => {
|
||||||
if (e.ctrlKey) {
|
if (e.ctrlKey) {
|
||||||
// console.log("Ctrl + Click detected");
|
console.log("Ctrl + Click detected");
|
||||||
}
|
}
|
||||||
// Paksa buka menu meskipun ctrl ditekan
|
// Paksa buka menu meskipun ctrl ditekan
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ const TableSPIT = () => {
|
||||||
const userId = getCookiesDecrypt("uie");
|
const userId = getCookiesDecrypt("uie");
|
||||||
const userLevelId = getCookiesDecrypt("ulie");
|
const userLevelId = getCookiesDecrypt("ulie");
|
||||||
const t = useTranslations("AnalyticsDashboard");
|
const t = useTranslations("AnalyticsDashboard");
|
||||||
// const [dateFilter, setDateFilter] = React.useState("");
|
const [dateFilter, setDateFilter] = React.useState("");
|
||||||
const [totalData, setTotalData] = React.useState<number>(1);
|
const [totalData, setTotalData] = React.useState<number>(1);
|
||||||
const [sorting, setSorting] = React.useState<SortingState>([]);
|
const [sorting, setSorting] = React.useState<SortingState>([]);
|
||||||
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
|
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(
|
||||||
|
|
@ -106,9 +106,6 @@ const TableSPIT = () => {
|
||||||
});
|
});
|
||||||
const [categories, setCategories] = React.useState<any[]>([]);
|
const [categories, setCategories] = React.useState<any[]>([]);
|
||||||
const roleId = getCookiesDecrypt("urie");
|
const roleId = getCookiesDecrypt("urie");
|
||||||
const [startDate, setStartDate] = React.useState("");
|
|
||||||
const [endDate, setEndDate] = React.useState("");
|
|
||||||
|
|
||||||
const columns = useTableColumns();
|
const columns = useTableColumns();
|
||||||
const table = useReactTable({
|
const table = useReactTable({
|
||||||
data: spitTable,
|
data: spitTable,
|
||||||
|
|
@ -162,15 +159,6 @@ const TableSPIT = () => {
|
||||||
}
|
}
|
||||||
}, [searchParams]);
|
}, [searchParams]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
setPage(1);
|
|
||||||
setPagination({
|
|
||||||
pageIndex: 0,
|
|
||||||
pageSize: Number(showData),
|
|
||||||
});
|
|
||||||
fetchData();
|
|
||||||
}, [startDate, endDate]);
|
|
||||||
|
|
||||||
// React.useEffect(() => {
|
// React.useEffect(() => {
|
||||||
// fetchData();
|
// fetchData();
|
||||||
// }, [showData, page, search, statusFilter, dateFilter]);
|
// }, [showData, page, search, statusFilter, dateFilter]);
|
||||||
|
|
@ -188,38 +176,10 @@ const TableSPIT = () => {
|
||||||
// // endDate,
|
// // endDate,
|
||||||
// ]);
|
// ]);
|
||||||
|
|
||||||
const handleResetFilter = () => {
|
|
||||||
setSearch("");
|
|
||||||
setStatusFilter([]);
|
|
||||||
setStartDate("");
|
|
||||||
setEndDate("");
|
|
||||||
setShowData("10");
|
|
||||||
setPage(1);
|
|
||||||
|
|
||||||
// kalau pakai tanstack pagination
|
|
||||||
setPagination({
|
|
||||||
pageIndex: 0,
|
|
||||||
pageSize: 10,
|
|
||||||
});
|
|
||||||
|
|
||||||
table.resetRowSelection();
|
|
||||||
|
|
||||||
fetchData();
|
|
||||||
};
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
fetchData();
|
fetchData();
|
||||||
getCategories();
|
getCategories();
|
||||||
}, [
|
}, [statusFilter, page, showData, search, dateFilter]);
|
||||||
startDate,
|
|
||||||
endDate,
|
|
||||||
statusFilter,
|
|
||||||
showData,
|
|
||||||
page,
|
|
||||||
search,
|
|
||||||
pagination.pageIndex,
|
|
||||||
pagination.pageSize,
|
|
||||||
]);
|
|
||||||
|
|
||||||
async function getCategories() {
|
async function getCategories() {
|
||||||
const category = await listEnableCategory("4");
|
const category = await listEnableCategory("4");
|
||||||
|
|
@ -228,11 +188,11 @@ const TableSPIT = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Panggil fetchData otomatis ketika dateFilter berubah
|
// Panggil fetchData otomatis ketika dateFilter berubah
|
||||||
// React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
// if (dateFilter) {
|
if (dateFilter) {
|
||||||
// fetchData();
|
fetchData();
|
||||||
// }
|
}
|
||||||
// }, [dateFilter]);
|
}, [dateFilter]);
|
||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
let isPublish;
|
let isPublish;
|
||||||
|
|
@ -243,27 +203,18 @@ const TableSPIT = () => {
|
||||||
} else {
|
} else {
|
||||||
isPublish = statusFilter.includes(1) ? false : true;
|
isPublish = statusFilter.includes(1) ? false : true;
|
||||||
}
|
}
|
||||||
const formattedStartDate = startDate
|
|
||||||
? format(new Date(startDate), "yyyy-MM-dd")
|
|
||||||
: "";
|
|
||||||
|
|
||||||
const formattedEndDate = endDate
|
const formattedStartDate = dateFilter
|
||||||
? format(new Date(endDate), "yyyy-MM-dd")
|
? format(new Date(dateFilter + "T00:00:00"), "yyyy-MM-dd")
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await listSPIT(
|
const res = await listSPIT(
|
||||||
// showData,
|
|
||||||
// page - 1,
|
|
||||||
// // limit,
|
|
||||||
// search,
|
|
||||||
// formattedStartDate,
|
|
||||||
// isPublish
|
|
||||||
showData,
|
showData,
|
||||||
page - 1,
|
page - 1,
|
||||||
|
// limit,
|
||||||
search,
|
search,
|
||||||
formattedStartDate,
|
formattedStartDate,
|
||||||
formattedEndDate,
|
|
||||||
isPublish
|
isPublish
|
||||||
);
|
);
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
|
|
@ -280,78 +231,6 @@ const TableSPIT = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// async function fetchData() {
|
|
||||||
// let isPublish;
|
|
||||||
// if (statusFilter.length === 0) {
|
|
||||||
// isPublish = "";
|
|
||||||
// } else if (statusFilter.length > 1) {
|
|
||||||
// isPublish = "";
|
|
||||||
// } else {
|
|
||||||
// isPublish = statusFilter.includes(1) ? false : true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // ✳️ format tanggal dari input (YYYY-MM-DD)
|
|
||||||
// const formattedStartDate = startDate
|
|
||||||
// ? format(new Date(startDate), "yyyy-MM-dd")
|
|
||||||
// : "";
|
|
||||||
|
|
||||||
// const formattedEndDate = endDate
|
|
||||||
// ? format(new Date(endDate), "yyyy-MM-dd")
|
|
||||||
// : "";
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// const res = await listSPIT(
|
|
||||||
// showData,
|
|
||||||
// page - 1,
|
|
||||||
// search,
|
|
||||||
// formattedStartDate,
|
|
||||||
// formattedEndDate,
|
|
||||||
// isPublish
|
|
||||||
// );
|
|
||||||
|
|
||||||
// const data = res?.data?.data;
|
|
||||||
// let contentData: any[] = data?.content || [];
|
|
||||||
|
|
||||||
// // 🔒 FRONTEND RANGE FILTER TAMBAHAN (anti bocor November)
|
|
||||||
// if (formattedStartDate || formattedEndDate) {
|
|
||||||
// contentData = contentData.filter((item) => {
|
|
||||||
// if (!item.contentCreatedDate) return false;
|
|
||||||
|
|
||||||
// // jadikan string tanggal lokal 'yyyy-MM-dd'
|
|
||||||
// const createdDateStr = format(
|
|
||||||
// new Date(item.contentCreatedDate),
|
|
||||||
// "yyyy-MM-dd"
|
|
||||||
// );
|
|
||||||
|
|
||||||
// if (formattedStartDate && createdDateStr < formattedStartDate) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (formattedEndDate && createdDateStr > formattedEndDate) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return true;
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // kasih nomor urut
|
|
||||||
// const newData = contentData.map((item: any, index: number) => ({
|
|
||||||
// ...item,
|
|
||||||
// no: (page - 1) * Number(showData) + index + 1,
|
|
||||||
// }));
|
|
||||||
|
|
||||||
// setSpitTable(newData);
|
|
||||||
// setTotalData(data?.totalElements || 0);
|
|
||||||
// setTotalPage(data?.totalPages || 1);
|
|
||||||
|
|
||||||
// // optional: bersihkan selection
|
|
||||||
// table.resetRowSelection();
|
|
||||||
// } catch (error) {
|
|
||||||
// console.error("Error fetching tasks:", error);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
const handleSearch = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleSearch = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setSearch(e.target.value);
|
setSearch(e.target.value);
|
||||||
table.getColumn("judul")?.setFilterValue(e.target.value);
|
table.getColumn("judul")?.setFilterValue(e.target.value);
|
||||||
|
|
@ -433,17 +312,6 @@ const TableSPIT = () => {
|
||||||
<div className="flex flex-row justify-between my-1 mx-1">
|
<div className="flex flex-row justify-between my-1 mx-1">
|
||||||
<p>Filter</p>
|
<p>Filter</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-center px-3 pt-2 pb-1">
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
|
||||||
className="text-xs text-gray-700 hover:bg-red-400 dark:text-white"
|
|
||||||
onClick={handleResetFilter}
|
|
||||||
>
|
|
||||||
Reset Semua Filter
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* <div className="mx-2 my-1">
|
{/* <div className="mx-2 my-1">
|
||||||
<Label>{t("date", { defaultValue: "Date" })}</Label>
|
<Label>{t("date", { defaultValue: "Date" })}</Label>
|
||||||
<Input
|
<Input
|
||||||
|
|
@ -453,7 +321,7 @@ const TableSPIT = () => {
|
||||||
className="max-w-sm"
|
className="max-w-sm"
|
||||||
/>
|
/>
|
||||||
</div> */}
|
</div> */}
|
||||||
{/* <div className="mx-2 my-1">
|
<div className="mx-2 my-1">
|
||||||
<Label>{t("date", { defaultValue: "Tanggal" })}</Label>
|
<Label>{t("date", { defaultValue: "Tanggal" })}</Label>
|
||||||
<Input
|
<Input
|
||||||
type="date"
|
type="date"
|
||||||
|
|
@ -465,23 +333,6 @@ const TableSPIT = () => {
|
||||||
}}
|
}}
|
||||||
className="max-w-sm"
|
className="max-w-sm"
|
||||||
/>
|
/>
|
||||||
</div> */}
|
|
||||||
|
|
||||||
<div className="mx-2 my-1">
|
|
||||||
<Label>Tanggal Awal</Label>
|
|
||||||
<Input
|
|
||||||
type="date"
|
|
||||||
value={startDate}
|
|
||||||
onChange={(e) => setStartDate(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="mx-2 my-1">
|
|
||||||
<Label>Tanggal Akhir</Label>
|
|
||||||
<Input
|
|
||||||
type="date"
|
|
||||||
value={endDate}
|
|
||||||
onChange={(e) => setEndDate(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Label className="ml-2 mt-2">Status</Label>
|
<Label className="ml-2 mt-2">Status</Label>
|
||||||
|
|
|
||||||
|
|
@ -105,13 +105,13 @@ const useTableColumns = () => {
|
||||||
if (isPublish && !isPublishOnPolda) {
|
if (isPublish && !isPublishOnPolda) {
|
||||||
displayText = "Mabes";
|
displayText = "Mabes";
|
||||||
} else if (isPublish && isPublishOnPolda) {
|
} else if (isPublish && isPublishOnPolda) {
|
||||||
if (Number(creatorGroupParentLevelId) == 771) {
|
if (Number(creatorGroupParentLevelId) == 761) {
|
||||||
displayText = "Mabes & Satker";
|
displayText = "Mabes & Satker";
|
||||||
} else {
|
} else {
|
||||||
displayText = "Mabes & Polda";
|
displayText = "Mabes & Polda";
|
||||||
}
|
}
|
||||||
} else if (!isPublish && isPublishOnPolda) {
|
} else if (!isPublish && isPublishOnPolda) {
|
||||||
if (Number(creatorGroupParentLevelId) == 771) {
|
if (Number(creatorGroupParentLevelId) == 761) {
|
||||||
displayText = "Satker";
|
displayText = "Satker";
|
||||||
} else {
|
} else {
|
||||||
displayText = "Polda";
|
displayText = "Polda";
|
||||||
|
|
|
||||||
|
|
@ -105,13 +105,13 @@ const useTableColumns = () => {
|
||||||
if (isPublish && !isPublishOnPolda) {
|
if (isPublish && !isPublishOnPolda) {
|
||||||
displayText = "Mabes";
|
displayText = "Mabes";
|
||||||
} else if (isPublish && isPublishOnPolda) {
|
} else if (isPublish && isPublishOnPolda) {
|
||||||
if (Number(creatorGroupParentLevelId) == 771) {
|
if (Number(creatorGroupParentLevelId) == 761) {
|
||||||
displayText = "Mabes & Satker";
|
displayText = "Mabes & Satker";
|
||||||
} else {
|
} else {
|
||||||
displayText = "Mabes & Polda";
|
displayText = "Mabes & Polda";
|
||||||
}
|
}
|
||||||
} else if (!isPublish && isPublishOnPolda) {
|
} else if (!isPublish && isPublishOnPolda) {
|
||||||
if (Number(creatorGroupParentLevelId) == 771) {
|
if (Number(creatorGroupParentLevelId) == 761) {
|
||||||
displayText = "Satker";
|
displayText = "Satker";
|
||||||
} else {
|
} else {
|
||||||
displayText = "Polda";
|
displayText = "Polda";
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ const useTableColumns = () => {
|
||||||
header: "Status",
|
header: "Status",
|
||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
const isActive = row.getValue<boolean>("isActive");
|
const isActive = row.getValue<boolean>("isActive");
|
||||||
|
console.log("isActive value:", isActive); // TypeScript type is inferred correctly
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{isActive ? (
|
{isActive ? (
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,9 @@ const MediahubTable = () => {
|
||||||
contentData.forEach((item: any, index: number) => {
|
contentData.forEach((item: any, index: number) => {
|
||||||
item.no = (page - 1) * limit + index + 1;
|
item.no = (page - 1) * limit + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
setTotalPage(data?.totalPages);
|
setTotalPage(data?.totalPages);
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ const useTableColumns = () => {
|
||||||
header: "Status",
|
header: "Status",
|
||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
const isActive = row.getValue<boolean>("isActive");
|
const isActive = row.getValue<boolean>("isActive");
|
||||||
|
console.log("isActive value:", isActive); // TypeScript type is inferred correctly
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{isActive ? (
|
{isActive ? (
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,9 @@ const MedsosTable = () => {
|
||||||
contentData.forEach((item: any, index: number) => {
|
contentData.forEach((item: any, index: number) => {
|
||||||
item.no = (page - 1) * limit + index + 1;
|
item.no = (page - 1) * limit + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
setTotalPage(data?.totalPages);
|
setTotalPage(data?.totalPages);
|
||||||
|
|
|
||||||
|
|
@ -73,22 +73,7 @@ const useTableColumns = ({
|
||||||
{
|
{
|
||||||
accessorKey: "status",
|
accessorKey: "status",
|
||||||
header: t("status", { defaultValue: "Status" }),
|
header: t("status", { defaultValue: "Status" }),
|
||||||
cell: ({ row }) => {
|
cell: ({ row }) => <span className="">{row.getValue("status")}</span>,
|
||||||
const version = Number(row.original.version); // pastikan number
|
|
||||||
|
|
||||||
const isProcess = version === 0;
|
|
||||||
const status = isProcess ? "Proses" : "Selesai";
|
|
||||||
|
|
||||||
return (
|
|
||||||
<span
|
|
||||||
className={`px-2 py-1 rounded-full text-white text-xs font-semibold ${
|
|
||||||
isProcess ? "bg-yellow-500" : "bg-green-600"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{status}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -146,9 +131,7 @@ const useTableColumns = ({
|
||||||
|
|
||||||
const response = await downloadReport(id);
|
const response = await downloadReport(id);
|
||||||
console.log(response?.data);
|
console.log(response?.data);
|
||||||
const url = window.URL.createObjectURL(
|
const url = window.URL.createObjectURL(new Blob([response?.data], { type : "application/pdf"}));
|
||||||
new Blob([response?.data], { type: "application/pdf" })
|
|
||||||
);
|
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.setAttribute("download", `report-${id}.pdf`);
|
link.setAttribute("download", `report-${id}.pdf`);
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ const ReportTable = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePreview = (id: string) => {
|
const handlePreview = (id: string) => {
|
||||||
const url = `https://mediahub.polri.go.id/api/v2/media/report/view?id=${id}`;
|
const url = `https://new.netidhub.com/api/media/report/view?id=${id}`;
|
||||||
setPreviewData({ url });
|
setPreviewData({ url });
|
||||||
setOpenPreview(true);
|
setOpenPreview(true);
|
||||||
};
|
};
|
||||||
|
|
@ -223,6 +223,9 @@ const ReportTable = () => {
|
||||||
contentData.forEach((item: any, index: number) => {
|
contentData.forEach((item: any, index: number) => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
setTotalPage(data?.totalPages);
|
setTotalPage(data?.totalPages);
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,9 @@ const CalendarPolriTable = () => {
|
||||||
contentData.forEach((item: any, index: number) => {
|
contentData.forEach((item: any, index: number) => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
setTotalPage(data?.totalPages);
|
setTotalPage(data?.totalPages);
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ const useTableColumns = () => {
|
||||||
accessorKey: "time",
|
accessorKey: "time",
|
||||||
header: t("time", { defaultValue: "Time" }),
|
header: t("time", { defaultValue: "Time" }),
|
||||||
cell: ({ row }: { row: { original: any } }) => {
|
cell: ({ row }: { row: { original: any } }) => {
|
||||||
|
console.log("Row Original Data:", row.original);
|
||||||
const { startTime, endTime } = row.original;
|
const { startTime, endTime } = row.original;
|
||||||
return (
|
return (
|
||||||
<span className="whitespace-nowrap">
|
<span className="whitespace-nowrap">
|
||||||
|
|
@ -112,6 +113,7 @@ const useTableColumns = () => {
|
||||||
accessorKey: "speaker",
|
accessorKey: "speaker",
|
||||||
header: t("speaker", { defaultValue: "Speaker" }),
|
header: t("speaker", { defaultValue: "Speaker" }),
|
||||||
cell: ({ row }: { row: { original: any } }) => {
|
cell: ({ row }: { row: { original: any } }) => {
|
||||||
|
console.log("Row Original Data:", row.original);
|
||||||
const { speakerTitle, speakerName } = row.original;
|
const { speakerTitle, speakerName } = row.original;
|
||||||
return (
|
return (
|
||||||
<span className="whitespace-nowrap">
|
<span className="whitespace-nowrap">
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,9 @@ const EventTable = () => {
|
||||||
contentData.forEach((item: any, index: number) => {
|
contentData.forEach((item: any, index: number) => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
setTotalPage(data?.totalPages);
|
setTotalPage(data?.totalPages);
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ const useTableColumns = (props: { selectedTypeSchedule: string }) => {
|
||||||
accessorKey: "time",
|
accessorKey: "time",
|
||||||
header: t("time", { defaultValue: "Time" }),
|
header: t("time", { defaultValue: "Time" }),
|
||||||
cell: ({ row }: { row: { original: any } }) => {
|
cell: ({ row }: { row: { original: any } }) => {
|
||||||
// console.log("Row Original Data:", row.original);
|
console.log("Row Original Data:", row.original);
|
||||||
const { startTime, endTime } = row.original;
|
const { startTime, endTime } = row.original;
|
||||||
return (
|
return (
|
||||||
<span className="whitespace-nowrap">
|
<span className="whitespace-nowrap">
|
||||||
|
|
@ -117,7 +117,7 @@ const useTableColumns = (props: { selectedTypeSchedule: string }) => {
|
||||||
accessorKey: "speaker",
|
accessorKey: "speaker",
|
||||||
header: t("speaker", { defaultValue: "Speaker" }),
|
header: t("speaker", { defaultValue: "Speaker" }),
|
||||||
cell: ({ row }: { row: { original: any } }) => {
|
cell: ({ row }: { row: { original: any } }) => {
|
||||||
// console.log("Row Original Data:", row.original);
|
console.log("Row Original Data:", row.original);
|
||||||
const { speakerTitle, speakerName } = row.original;
|
const { speakerTitle, speakerName } = row.original;
|
||||||
return (
|
return (
|
||||||
<span className="whitespace-nowrap">
|
<span className="whitespace-nowrap">
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ const LiveReportTable = () => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", contentData);
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ const useTableColumns = () => {
|
||||||
accessorKey: "time",
|
accessorKey: "time",
|
||||||
header: t("time", { defaultValue: "Time" }),
|
header: t("time", { defaultValue: "Time" }),
|
||||||
cell: ({ row }: { row: { original: any } }) => {
|
cell: ({ row }: { row: { original: any } }) => {
|
||||||
// console.log("Row Original Data:", row.original);
|
console.log("Row Original Data:", row.original);
|
||||||
const { startTime, endTime } = row.original;
|
const { startTime, endTime } = row.original;
|
||||||
return (
|
return (
|
||||||
<span className="whitespace-nowrap">
|
<span className="whitespace-nowrap">
|
||||||
|
|
@ -113,7 +113,7 @@ const useTableColumns = () => {
|
||||||
accessorKey: "speaker",
|
accessorKey: "speaker",
|
||||||
header: t("speaker", { defaultValue: "Speaker" }),
|
header: t("speaker", { defaultValue: "Speaker" }),
|
||||||
cell: ({ row }: { row: { original: any } }) => {
|
cell: ({ row }: { row: { original: any } }) => {
|
||||||
// console.log("Row Original Data:", row.original);
|
console.log("Row Original Data:", row.original);
|
||||||
const { speakerTitle, speakerName } = row.original;
|
const { speakerTitle, speakerName } = row.original;
|
||||||
return (
|
return (
|
||||||
<span className="whitespace-nowrap">
|
<span className="whitespace-nowrap">
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ const PressConferenceTable = () => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", contentData);
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ const useTableColumns = () => {
|
||||||
accessorKey: "time",
|
accessorKey: "time",
|
||||||
header: t("time", { defaultValue: "Time" }),
|
header: t("time", { defaultValue: "Time" }),
|
||||||
cell: ({ row }: { row: { original: any } }) => {
|
cell: ({ row }: { row: { original: any } }) => {
|
||||||
// console.log("Row Original Data:", row.original);
|
console.log("Row Original Data:", row.original);
|
||||||
const { startTime, endTime } = row.original;
|
const { startTime, endTime } = row.original;
|
||||||
return (
|
return (
|
||||||
<span className="whitespace-nowrap">
|
<span className="whitespace-nowrap">
|
||||||
|
|
@ -113,7 +113,7 @@ const useTableColumns = () => {
|
||||||
accessorKey: "speaker",
|
accessorKey: "speaker",
|
||||||
header: t("speaker", { defaultValue: "Speaker" }),
|
header: t("speaker", { defaultValue: "Speaker" }),
|
||||||
cell: ({ row }: { row: { original: any } }) => {
|
cell: ({ row }: { row: { original: any } }) => {
|
||||||
// console.log("Row Original Data:", row.original);
|
console.log("Row Original Data:", row.original);
|
||||||
const { speakerTitle, speakerName } = row.original;
|
const { speakerTitle, speakerName } = row.original;
|
||||||
return (
|
return (
|
||||||
<span className="whitespace-nowrap">
|
<span className="whitespace-nowrap">
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ const PressReleaseTable = () => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", contentData);
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -112,21 +112,33 @@ const useTableColumns = (
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const createdById = row.original?.createdBy?.id;
|
|
||||||
const userId = Number(getCookiesDecrypt("uie"));
|
|
||||||
const MySwal = withReactContent(Swal);
|
const MySwal = withReactContent(Swal);
|
||||||
const roleId = Number(getCookiesDecrypt("urie")) || 0;
|
const roleId = Number(getCookiesDecrypt("urie")) || 0;
|
||||||
const isTabTA = activeTab === "ta";
|
|
||||||
const isTabMabesKoor = activeTab === "mabes-koor";
|
|
||||||
|
|
||||||
const isCreator = Number(createdById) === Number(userId);
|
// ❗ jika tab = "special"
|
||||||
const canView = true;
|
if (activeTab === "special") {
|
||||||
|
return (
|
||||||
|
<DropdownMenu>
|
||||||
|
<DropdownMenuTrigger asChild>
|
||||||
|
<Button
|
||||||
|
size="icon"
|
||||||
|
className="bg-transparent ring-offset-transparent hover:bg-transparent hover:ring-0 hover:ring-transparent"
|
||||||
|
>
|
||||||
|
<MoreVertical className="h-4 w-4 text-default-800" />
|
||||||
|
</Button>
|
||||||
|
</DropdownMenuTrigger>
|
||||||
|
|
||||||
const canEdit = (isTabTA || isTabMabesKoor) && isCreator;
|
<DropdownMenuContent className="p-0" align="end">
|
||||||
|
<Link href={`/contributor/task/detail/${row.original.id}`}>
|
||||||
const canDelete = (isTabTA || isTabMabesKoor) && isCreator;
|
<DropdownMenuItem className="p-2 text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
||||||
|
<Eye className="w-4 h-4 me-1.5" />
|
||||||
const canUpload = activeTab === "mabes-koor";
|
View
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</Link>
|
||||||
|
</DropdownMenuContent>
|
||||||
|
</DropdownMenu>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async function deleteProcess(id: any) {
|
async function deleteProcess(id: any) {
|
||||||
loading();
|
loading();
|
||||||
|
|
@ -169,92 +181,39 @@ const useTableColumns = (
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// <DropdownMenu>
|
|
||||||
// <DropdownMenuTrigger asChild>
|
|
||||||
// <Button
|
|
||||||
// size="icon"
|
|
||||||
// className="bg-transparent ring-offset-transparent hover:bg-transparent hover:ring-0 hover:ring-transparent"
|
|
||||||
// >
|
|
||||||
// <span className="sr-only">Open menu</span>
|
|
||||||
// <MoreVertical className="h-4 w-4 text-default-800" />
|
|
||||||
// </Button>
|
|
||||||
// </DropdownMenuTrigger>
|
|
||||||
// <DropdownMenuContent className="p-0" align="end">
|
|
||||||
// {/* {(roleId == 11 || roleId == 12 || roleId == 19) && ( */}
|
|
||||||
// {(roleId == 11 ||
|
|
||||||
// roleId == 12 ||
|
|
||||||
// roleId == 19 ||
|
|
||||||
// roleId == 3) && (
|
|
||||||
// <Link href={`/contributor/task-ta/detail/${row.original.id}`}>
|
|
||||||
// <DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
|
||||||
// <Eye className="w-4 h-4 me-1.5" />
|
|
||||||
// View
|
|
||||||
// </DropdownMenuItem>
|
|
||||||
// </Link>
|
|
||||||
// )}
|
|
||||||
// {roleId == 11 ||
|
|
||||||
// (roleId == 3 && (
|
|
||||||
// <Link href={`/contributor/task-ta/update/${row.original.id}`}>
|
|
||||||
// <DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
|
||||||
// <SquarePen className="w-4 h-4 me-1.5" />
|
|
||||||
// Edit
|
|
||||||
// </DropdownMenuItem>
|
|
||||||
// </Link>
|
|
||||||
// ))}
|
|
||||||
// {(roleId == 12 || roleId == 19) && (
|
|
||||||
// <Link
|
|
||||||
// href={`/contributor/task-ta/upload-task/${row.original.id}`}
|
|
||||||
// >
|
|
||||||
// <DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
|
||||||
// <Upload className="w-4 h-4 me-1.5" />
|
|
||||||
// Upload Tugas
|
|
||||||
// </DropdownMenuItem>
|
|
||||||
// </Link>
|
|
||||||
// )}
|
|
||||||
// {roleId == 11 ||
|
|
||||||
// (roleId == 3 && (
|
|
||||||
// <DropdownMenuItem
|
|
||||||
// onClick={() => TaskDelete(row.original.id)}
|
|
||||||
// className="p-2 border-b text-destructive bg-destructive/30 focus:bg-destructive focus:text-destructive-foreground rounded-none"
|
|
||||||
// >
|
|
||||||
// <Trash2 className="w-4 h-4 me-1.5" />
|
|
||||||
// Delete
|
|
||||||
// </DropdownMenuItem>
|
|
||||||
// ))}
|
|
||||||
// </DropdownMenuContent>
|
|
||||||
// </DropdownMenu>
|
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
size="icon"
|
size="icon"
|
||||||
className="bg-transparent ring-offset-transparent hover:bg-transparent hover:ring-0 hover:ring-transparent"
|
className="bg-transparent ring-offset-transparent hover:bg-transparent hover:ring-0 hover:ring-transparent"
|
||||||
>
|
>
|
||||||
|
<span className="sr-only">Open menu</span>
|
||||||
<MoreVertical className="h-4 w-4 text-default-800" />
|
<MoreVertical className="h-4 w-4 text-default-800" />
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
|
<DropdownMenuContent className="p-0" align="end">
|
||||||
<DropdownMenuContent align="end" className="p-0">
|
{/* {(roleId == 11 || roleId == 12 || roleId == 19) && ( */}
|
||||||
{/* VIEW */}
|
{(roleId == 11 ||
|
||||||
{/* <Link href={`/contributor/task-ta/detail/${row.original.id}`}>
|
roleId == 12 ||
|
||||||
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
roleId == 19 ||
|
||||||
<Eye className="w-4 h-4 me-1.5" />
|
roleId == 3) && (
|
||||||
View
|
<Link href={`/contributor/task-ta/detail/${row.original.id}`}>
|
||||||
</DropdownMenuItem>
|
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
||||||
</Link> */}
|
<Eye className="w-4 h-4 me-1.5" />
|
||||||
{/* VIEW */}
|
View
|
||||||
<Link
|
</DropdownMenuItem>
|
||||||
href={
|
</Link>
|
||||||
activeTab === "special"
|
)}
|
||||||
? `/contributor/task/detail/${row.original.id}`
|
{roleId == 11 ||
|
||||||
: `/contributor/task-ta/detail/${row.original.id}`
|
(roleId == 3 && (
|
||||||
}
|
<Link href={`/contributor/task-ta/update/${row.original.id}`}>
|
||||||
>
|
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
||||||
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
<SquarePen className="w-4 h-4 me-1.5" />
|
||||||
<Eye className="w-4 h-4 me-1.5" />
|
Edit
|
||||||
View
|
</DropdownMenuItem>
|
||||||
</DropdownMenuItem>
|
</Link>
|
||||||
</Link>
|
))}
|
||||||
{roleId === 19 && (
|
{(roleId == 12 || roleId == 19) && (
|
||||||
<Link
|
<Link
|
||||||
href={`/contributor/task-ta/upload-task/${row.original.id}`}
|
href={`/contributor/task-ta/upload-task/${row.original.id}`}
|
||||||
>
|
>
|
||||||
|
|
@ -264,39 +223,16 @@ const useTableColumns = (
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
{roleId == 11 ||
|
||||||
{/* UPLOAD (MABES → KOOR TAB) */}
|
(roleId == 3 && (
|
||||||
{activeTab === "mabes-koor" && roleId === 11 && (
|
<DropdownMenuItem
|
||||||
<Link
|
onClick={() => TaskDelete(row.original.id)}
|
||||||
href={`/contributor/task-ta/upload-task/${row.original.id}`}
|
className="p-2 border-b text-destructive bg-destructive/30 focus:bg-destructive focus:text-destructive-foreground rounded-none"
|
||||||
>
|
>
|
||||||
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
<Trash2 className="w-4 h-4 me-1.5" />
|
||||||
<Upload className="w-4 h-4 me-1.5" />
|
Delete
|
||||||
Upload Tugas
|
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</Link>
|
))}
|
||||||
)}
|
|
||||||
|
|
||||||
{/* EDIT (TAB TA & CREATOR ONLY) */}
|
|
||||||
{canEdit && (
|
|
||||||
<Link href={`/contributor/task-ta/update/${row.original.id}`}>
|
|
||||||
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
|
|
||||||
<SquarePen className="w-4 h-4 me-1.5" />
|
|
||||||
Edit
|
|
||||||
</DropdownMenuItem>
|
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* DELETE (TAB TA & CREATOR ONLY) */}
|
|
||||||
{canDelete && (
|
|
||||||
<DropdownMenuItem
|
|
||||||
onClick={() => TaskDelete(row.original.id)}
|
|
||||||
className="p-2 border-b text-destructive bg-destructive/30 focus:bg-destructive focus:text-destructive-foreground rounded-none"
|
|
||||||
>
|
|
||||||
<Trash2 className="w-4 h-4 me-1.5" />
|
|
||||||
Delete
|
|
||||||
</DropdownMenuItem>
|
|
||||||
)}
|
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,7 @@ export default function TaskTaTable() {
|
||||||
const userLevelId = Number(getCookiesDecrypt("ulie"));
|
const userLevelId = Number(getCookiesDecrypt("ulie"));
|
||||||
const roleId = Number(getCookiesDecrypt("urie"));
|
const roleId = Number(getCookiesDecrypt("urie"));
|
||||||
const userId = Number(getCookiesDecrypt("uie"));
|
const userId = Number(getCookiesDecrypt("uie"));
|
||||||
const isKoorKuratorRole11 = roleId === 11;
|
|
||||||
const isRole19 = roleId === 19;
|
|
||||||
const isMabesApprover =
|
const isMabesApprover =
|
||||||
userLevelId === MABES_LEVEL_ID && roleId === APPROVER_ROLE_ID;
|
userLevelId === MABES_LEVEL_ID && roleId === APPROVER_ROLE_ID;
|
||||||
|
|
||||||
|
|
@ -93,7 +92,7 @@ export default function TaskTaTable() {
|
||||||
const [totalPage, setTotalPage] = React.useState(1);
|
const [totalPage, setTotalPage] = React.useState(1);
|
||||||
|
|
||||||
// const KOOR_KURATOR_USER_ID = "464";
|
// const KOOR_KURATOR_USER_ID = "464";
|
||||||
const KOOR_KURATOR_USER_IDS = ["464", "8258", "11", "216"];
|
const KOOR_KURATOR_USER_IDS = ["464", "8258"];
|
||||||
|
|
||||||
// ✅ columns based on tab
|
// ✅ columns based on tab
|
||||||
const columns = useTableColumns(activeTab);
|
const columns = useTableColumns(activeTab);
|
||||||
|
|
@ -302,7 +301,7 @@ export default function TaskTaTable() {
|
||||||
<label className="inline-flex text-md cursor-pointer">
|
<label className="inline-flex text-md cursor-pointer">
|
||||||
<div className="flex mb-6 flex-wrap gap-2">
|
<div className="flex mb-6 flex-wrap gap-2">
|
||||||
{/* ❗ JIKA MABES APPROVER → HANYA 1 TAB */}
|
{/* ❗ JIKA MABES APPROVER → HANYA 1 TAB */}
|
||||||
{/* {isMabesApprover ? (
|
{isMabesApprover ? (
|
||||||
<button
|
<button
|
||||||
onClick={() => setActiveTab("mabes-koor")}
|
onClick={() => setActiveTab("mabes-koor")}
|
||||||
className={`px-4 py-1 rounded transition ${
|
className={`px-4 py-1 rounded transition ${
|
||||||
|
|
@ -315,6 +314,7 @@ export default function TaskTaTable() {
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
{/* 👇 USER SELAIN MABES APPROVER */}
|
||||||
<button
|
<button
|
||||||
onClick={() => setActiveTab("special")}
|
onClick={() => setActiveTab("special")}
|
||||||
className={`px-4 py-1 rounded transition ${
|
className={`px-4 py-1 rounded transition ${
|
||||||
|
|
@ -348,85 +348,16 @@ export default function TaskTaTable() {
|
||||||
Atensi Khusus TA
|
Atensi Khusus TA
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{!isKoorKuratorRole11 && (
|
|
||||||
<button
|
|
||||||
onClick={() => setActiveTab("daily")}
|
|
||||||
className={`px-4 py-1 rounded transition ${
|
|
||||||
activeTab === "daily"
|
|
||||||
? "bg-default-900 text-white dark:text-black"
|
|
||||||
: "border dark:text-default-700"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{t("daily-tasks", { defaultValue: "Daily Tasks" })}
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)} */}
|
|
||||||
{isMabesApprover ? (
|
|
||||||
<button
|
|
||||||
onClick={() => setActiveTab("mabes-koor")}
|
|
||||||
className={`px-4 py-1 rounded transition ${
|
|
||||||
activeTab === "mabes-koor"
|
|
||||||
? "bg-default-900 text-white dark:text-black"
|
|
||||||
: "border dark:text-default-700"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
Atensi Khusus Mabes → Koor Kurator
|
|
||||||
</button>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
{/* ❗ HIDE untuk role 19 */}
|
|
||||||
{!isRole19 && (
|
|
||||||
<>
|
|
||||||
<button
|
|
||||||
onClick={() => setActiveTab("special")}
|
|
||||||
className={`px-4 py-1 rounded transition ${
|
|
||||||
activeTab === "special"
|
|
||||||
? "bg-default-900 text-white dark:text-black"
|
|
||||||
: "border dark:text-default-700"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
Atensi Khusus Mabes
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
|
||||||
onClick={() => setActiveTab("mabes-koor")}
|
|
||||||
className={`px-4 py-1 rounded transition ${
|
|
||||||
activeTab === "mabes-koor"
|
|
||||||
? "bg-default-900 text-white dark:text-black"
|
|
||||||
: "border dark:text-default-700"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
Atensi Khusus Mabes → Koor Kurator
|
|
||||||
</button>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* ✅ TA tetap tampil untuk semua */}
|
|
||||||
<button
|
<button
|
||||||
onClick={() => setActiveTab("ta")}
|
onClick={() => setActiveTab("daily")}
|
||||||
className={`px-4 py-1 rounded transition ${
|
className={`px-4 py-1 rounded transition ${
|
||||||
activeTab === "ta"
|
activeTab === "daily"
|
||||||
? "bg-default-900 text-white dark:text-black"
|
? "bg-default-900 text-white dark:text-black"
|
||||||
: "border dark:text-default-700"
|
: "border dark:text-default-700"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
Atensi Khusus TA
|
{t("daily-tasks", { defaultValue: "Daily Tasks" })}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{/* ❗ Daily juga hide untuk role 19 */}
|
|
||||||
{!isKoorKuratorRole11 && !isRole19 && (
|
|
||||||
<button
|
|
||||||
onClick={() => setActiveTab("daily")}
|
|
||||||
className={`px-4 py-1 rounded transition ${
|
|
||||||
activeTab === "daily"
|
|
||||||
? "bg-default-900 text-white dark:text-black"
|
|
||||||
: "border dark:text-default-700"
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{t("daily-tasks", { defaultValue: "Daily Tasks" })}
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ const TaskTable = () => {
|
||||||
item.no = (page - 1) * Number(showData) + index + 1;
|
item.no = (page - 1) * Number(showData) + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", contentData);
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export default function UserFeedback() {
|
||||||
}, []);
|
}, []);
|
||||||
async function initState() {
|
async function initState() {
|
||||||
const response = await getUserFeedbacks();
|
const response = await getUserFeedbacks();
|
||||||
// console.log("ssss", response?.data?.data);
|
console.log("ssss", response?.data?.data);
|
||||||
setListData(response?.data?.data);
|
setListData(response?.data?.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ const MediaTrackingTable = () => {
|
||||||
item.no = (page - 1) * limit + index + 1;
|
item.no = (page - 1) * limit + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", data);
|
console.log("contentData : ", data);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
setTotalData(data?.totalElements);
|
setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -113,12 +113,13 @@ const TaskPlanMediahubTable = (props: {
|
||||||
// try {
|
// try {
|
||||||
// const res = await ticketingPagination("", limit, page - 1);
|
// const res = await ticketingPagination("", limit, page - 1);
|
||||||
// const data = res?.data?.data;
|
// const data = res?.data?.data;
|
||||||
|
console.log("datgaa", data);
|
||||||
const contentData = data;
|
const contentData = data;
|
||||||
contentData.forEach((item: any, index: number) => {
|
contentData.forEach((item: any, index: number) => {
|
||||||
item.no = (page - 1) * limit + index + 1;
|
item.no = (page - 1) * limit + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", contentData);
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
// setTotalData(data?.totalElements);
|
// setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,8 @@ export default function DetailDaily() {
|
||||||
|
|
||||||
if (res?.data?.data != undefined) {
|
if (res?.data?.data != undefined) {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
|
console.log("data");
|
||||||
|
console.log("Data :", data);
|
||||||
form.setValue("title", data.title);
|
form.setValue("title", data.title);
|
||||||
form.setValue("detail", data.description);
|
form.setValue("detail", data.description);
|
||||||
form.setValue("date", new Date(data.date));
|
form.setValue("date", new Date(data.date));
|
||||||
|
|
@ -203,7 +205,7 @@ export default function DetailDaily() {
|
||||||
const editor = useRef(null);
|
const editor = useRef(null);
|
||||||
|
|
||||||
const onSubmit = async (data: z.infer<typeof FormSchema>) => {
|
const onSubmit = async (data: z.infer<typeof FormSchema>) => {
|
||||||
// console.log("data", data);
|
console.log("data", data);
|
||||||
if (form.getValues("detail") == "") {
|
if (form.getValues("detail") == "") {
|
||||||
form.setError("detail", {
|
form.setError("detail", {
|
||||||
type: "manual",
|
type: "manual",
|
||||||
|
|
@ -232,7 +234,7 @@ export default function DetailDaily() {
|
||||||
.filter((key) => selected[key])
|
.filter((key) => selected[key])
|
||||||
.join(", ");
|
.join(", ");
|
||||||
};
|
};
|
||||||
// console.log("data", data, selected);
|
console.log("data", data, selected);
|
||||||
loading();
|
loading();
|
||||||
|
|
||||||
const reqData = {
|
const reqData = {
|
||||||
|
|
@ -256,7 +258,7 @@ export default function DetailDaily() {
|
||||||
assignmentMainTypeId: 1,
|
assignmentMainTypeId: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
// console.log("req =>", reqData);
|
console.log("req =>", reqData);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
|
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,8 @@ export default function EditDaily() {
|
||||||
|
|
||||||
if (res?.data?.data != undefined) {
|
if (res?.data?.data != undefined) {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
|
console.log("data");
|
||||||
|
console.log("Data :", data);
|
||||||
form.setValue("title", data.title);
|
form.setValue("title", data.title);
|
||||||
form.setValue("detail", data.description);
|
form.setValue("detail", data.description);
|
||||||
form.setValue("date", new Date(data.date));
|
form.setValue("date", new Date(data.date));
|
||||||
|
|
@ -216,7 +218,7 @@ export default function EditDaily() {
|
||||||
const editor = useRef(null);
|
const editor = useRef(null);
|
||||||
|
|
||||||
const onSubmit = async (data: z.infer<typeof FormSchema>) => {
|
const onSubmit = async (data: z.infer<typeof FormSchema>) => {
|
||||||
// console.log("data", data);
|
console.log("data", data);
|
||||||
if (form.getValues("detail") == "") {
|
if (form.getValues("detail") == "") {
|
||||||
form.setError("detail", {
|
form.setError("detail", {
|
||||||
type: "manual",
|
type: "manual",
|
||||||
|
|
@ -245,7 +247,7 @@ export default function EditDaily() {
|
||||||
.filter((key) => selected[key])
|
.filter((key) => selected[key])
|
||||||
.join(", ");
|
.join(", ");
|
||||||
};
|
};
|
||||||
// console.log("data", data, selected);
|
console.log("data", data, selected);
|
||||||
loading();
|
loading();
|
||||||
|
|
||||||
const reqData = {
|
const reqData = {
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ export default function CreateDaily() {
|
||||||
const editor = useRef(null);
|
const editor = useRef(null);
|
||||||
|
|
||||||
const onSubmit = async (data: z.infer<typeof FormSchema>) => {
|
const onSubmit = async (data: z.infer<typeof FormSchema>) => {
|
||||||
// console.log("data", data);
|
console.log("data", data);
|
||||||
if (form.getValues("detail") == "") {
|
if (form.getValues("detail") == "") {
|
||||||
form.setError("detail", {
|
form.setError("detail", {
|
||||||
type: "manual",
|
type: "manual",
|
||||||
|
|
@ -195,7 +195,7 @@ export default function CreateDaily() {
|
||||||
.filter((key) => selected[key])
|
.filter((key) => selected[key])
|
||||||
.join(", ");
|
.join(", ");
|
||||||
};
|
};
|
||||||
// console.log("data", data, selected);
|
console.log("data", data, selected);
|
||||||
loading();
|
loading();
|
||||||
|
|
||||||
const reqData = {
|
const reqData = {
|
||||||
|
|
@ -219,7 +219,7 @@ export default function CreateDaily() {
|
||||||
assignmentMainTypeId: 1,
|
assignmentMainTypeId: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
// console.log("req =>", reqData);
|
console.log("req =>", reqData);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
|
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,11 @@ export default function DetailMonthly() {
|
||||||
close();
|
close();
|
||||||
if (res?.data?.data != undefined) {
|
if (res?.data?.data != undefined) {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
|
console.log("Data :", data);
|
||||||
form.setValue("title", data?.title);
|
form.setValue("title", data?.title);
|
||||||
form.setValue("detail", data.description);
|
form.setValue("detail", data.description);
|
||||||
const date = parseDate(data.date);
|
const date = parseDate(data.date);
|
||||||
|
console.log("date", date);
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"month",
|
"month",
|
||||||
new Date(date.getFullYear(), date.getMonth(), 1)
|
new Date(date.getFullYear(), date.getMonth(), 1)
|
||||||
|
|
@ -125,7 +127,7 @@ export default function DetailMonthly() {
|
||||||
).getFullYear()}`,
|
).getFullYear()}`,
|
||||||
status: "Open",
|
status: "Open",
|
||||||
};
|
};
|
||||||
// console.log("req", reqData, data.month);
|
console.log("req", reqData, data.month);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
close();
|
close();
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
@ -152,7 +154,7 @@ export default function DetailMonthly() {
|
||||||
selectedDate.getMonth(),
|
selectedDate.getMonth(),
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
// console.log("newDate", newDate, selectedDate);
|
console.log("newDate", newDate, selectedDate);
|
||||||
form.setValue("month", newDate);
|
form.setValue("month", newDate);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -77,9 +77,11 @@ export default function EditMonthly() {
|
||||||
close();
|
close();
|
||||||
if (res?.data?.data != undefined) {
|
if (res?.data?.data != undefined) {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
|
console.log("Data :", data);
|
||||||
form.setValue("title", data?.title);
|
form.setValue("title", data?.title);
|
||||||
form.setValue("detail", data.description);
|
form.setValue("detail", data.description);
|
||||||
const date = parseDate(data.date);
|
const date = parseDate(data.date);
|
||||||
|
console.log("date", date);
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"month",
|
"month",
|
||||||
new Date(date.getFullYear(), date.getMonth(), 1)
|
new Date(date.getFullYear(), date.getMonth(), 1)
|
||||||
|
|
@ -127,7 +129,7 @@ export default function EditMonthly() {
|
||||||
date: `${month.toString().padStart(2, "0")}/${year}`,
|
date: `${month.toString().padStart(2, "0")}/${year}`,
|
||||||
status: "Open",
|
status: "Open",
|
||||||
};
|
};
|
||||||
// console.log("req", reqData, data.month);
|
console.log("req", reqData, data.month);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
close();
|
close();
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
@ -154,7 +156,7 @@ export default function EditMonthly() {
|
||||||
selectedDate.getMonth(),
|
selectedDate.getMonth(),
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
// console.log("newDate", newDate, selectedDate);
|
console.log("newDate", newDate, selectedDate);
|
||||||
form.setValue("month", newDate);
|
form.setValue("month", newDate);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ export default function CreateMonthly() {
|
||||||
date: `${month.toString().padStart(2, "0")}/${year}`,
|
date: `${month.toString().padStart(2, "0")}/${year}`,
|
||||||
status: "Open",
|
status: "Open",
|
||||||
};
|
};
|
||||||
// console.log("req", reqData, data.month);
|
console.log("req", reqData, data.month);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
close();
|
close();
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ export default function DetailWeekly() {
|
||||||
status: "Open",
|
status: "Open",
|
||||||
parentId: parentId,
|
parentId: parentId,
|
||||||
};
|
};
|
||||||
// console.log("req", reqData);
|
console.log("req", reqData);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
close();
|
close();
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
@ -147,7 +147,7 @@ export default function DetailWeekly() {
|
||||||
close();
|
close();
|
||||||
if (res?.data?.data != undefined) {
|
if (res?.data?.data != undefined) {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
// console.log("Data :", data);
|
console.log("Data :", data);
|
||||||
form.setValue("title", data?.title);
|
form.setValue("title", data?.title);
|
||||||
form.setValue("week", {
|
form.setValue("week", {
|
||||||
from: new Date(data?.startDate),
|
from: new Date(data?.startDate),
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ export default function EditWeekly() {
|
||||||
status: "Open",
|
status: "Open",
|
||||||
parentId: parentId,
|
parentId: parentId,
|
||||||
};
|
};
|
||||||
// console.log("req", reqData);
|
console.log("req", reqData);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
close();
|
close();
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
@ -146,7 +146,7 @@ export default function EditWeekly() {
|
||||||
close();
|
close();
|
||||||
if (res?.data?.data != undefined) {
|
if (res?.data?.data != undefined) {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
// console.log("Data :", data);
|
console.log("Data :", data);
|
||||||
form.setValue("title", data?.title);
|
form.setValue("title", data?.title);
|
||||||
form.setValue("week", {
|
form.setValue("week", {
|
||||||
from: new Date(data?.startDate),
|
from: new Date(data?.startDate),
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ export default function CreateMonthly() {
|
||||||
status: "Open",
|
status: "Open",
|
||||||
parentId: Number(data.parentId),
|
parentId: Number(data.parentId),
|
||||||
};
|
};
|
||||||
// console.log("req", reqData);
|
console.log("req", reqData);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
close();
|
close();
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ export default function DetailTaskPlanMediahub() {
|
||||||
|
|
||||||
if (res?.data?.data != undefined) {
|
if (res?.data?.data != undefined) {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
// console.log("Data :", data);
|
console.log("Data :", data);
|
||||||
setPlanningData(data);
|
setPlanningData(data);
|
||||||
setAssignedTopLevel(data?.assignedToTopLevel);
|
setAssignedTopLevel(data?.assignedToTopLevel);
|
||||||
setArrayDestination(data?.assignedToLevel);
|
setArrayDestination(data?.assignedToLevel);
|
||||||
|
|
@ -112,7 +112,7 @@ export default function DetailTaskPlanMediahub() {
|
||||||
label: option.title,
|
label: option.title,
|
||||||
value: option.id,
|
value: option.id,
|
||||||
}));
|
}));
|
||||||
// console.log("res", optionArr);
|
console.log("res", optionArr);
|
||||||
|
|
||||||
setWeeklyList(optionArr);
|
setWeeklyList(optionArr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,13 +113,13 @@ const TaskPlanMediahubTable = (props: {
|
||||||
// try {
|
// try {
|
||||||
// const res = await ticketingPagination("", limit, page - 1);
|
// const res = await ticketingPagination("", limit, page - 1);
|
||||||
// const data = res?.data?.data;
|
// const data = res?.data?.data;
|
||||||
// console.log("datgaa", data);
|
console.log("datgaa", data);
|
||||||
const contentData = data;
|
const contentData = data;
|
||||||
contentData.forEach((item: any, index: number) => {
|
contentData.forEach((item: any, index: number) => {
|
||||||
item.no = (page - 1) * limit + index + 1;
|
item.no = (page - 1) * limit + index + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log("contentData : ", contentData);
|
console.log("contentData : ", contentData);
|
||||||
|
|
||||||
setDataTable(contentData);
|
setDataTable(contentData);
|
||||||
// setTotalData(data?.totalElements);
|
// setTotalData(data?.totalElements);
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,8 @@ export default function DetailDaily() {
|
||||||
|
|
||||||
if (res?.data?.data != undefined) {
|
if (res?.data?.data != undefined) {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
|
console.log("data");
|
||||||
|
console.log("Data :", data);
|
||||||
form.setValue("title", data.title);
|
form.setValue("title", data.title);
|
||||||
form.setValue("detail", data.description);
|
form.setValue("detail", data.description);
|
||||||
form.setValue("date", new Date(data.date));
|
form.setValue("date", new Date(data.date));
|
||||||
|
|
@ -203,7 +205,7 @@ export default function DetailDaily() {
|
||||||
const editor = useRef(null);
|
const editor = useRef(null);
|
||||||
|
|
||||||
const onSubmit = async (data: z.infer<typeof FormSchema>) => {
|
const onSubmit = async (data: z.infer<typeof FormSchema>) => {
|
||||||
// console.log("data", data);
|
console.log("data", data);
|
||||||
if (form.getValues("detail") == "") {
|
if (form.getValues("detail") == "") {
|
||||||
form.setError("detail", {
|
form.setError("detail", {
|
||||||
type: "manual",
|
type: "manual",
|
||||||
|
|
@ -232,7 +234,7 @@ export default function DetailDaily() {
|
||||||
.filter((key) => selected[key])
|
.filter((key) => selected[key])
|
||||||
.join(", ");
|
.join(", ");
|
||||||
};
|
};
|
||||||
// console.log("data", data, selected);
|
console.log("data", data, selected);
|
||||||
loading();
|
loading();
|
||||||
|
|
||||||
const reqData = {
|
const reqData = {
|
||||||
|
|
@ -256,7 +258,7 @@ export default function DetailDaily() {
|
||||||
assignmentMainTypeId: 1,
|
assignmentMainTypeId: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
// console.log("req =>", reqData);
|
console.log("req =>", reqData);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
|
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,8 @@ export default function EditDaily() {
|
||||||
|
|
||||||
if (res?.data?.data != undefined) {
|
if (res?.data?.data != undefined) {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
|
console.log("data");
|
||||||
|
console.log("Data :", data);
|
||||||
form.setValue("title", data.title);
|
form.setValue("title", data.title);
|
||||||
form.setValue("detail", data.description);
|
form.setValue("detail", data.description);
|
||||||
form.setValue("date", new Date(data.date));
|
form.setValue("date", new Date(data.date));
|
||||||
|
|
@ -216,7 +218,7 @@ export default function EditDaily() {
|
||||||
const editor = useRef(null);
|
const editor = useRef(null);
|
||||||
|
|
||||||
const onSubmit = async (data: z.infer<typeof FormSchema>) => {
|
const onSubmit = async (data: z.infer<typeof FormSchema>) => {
|
||||||
// console.log("data", data);
|
console.log("data", data);
|
||||||
if (form.getValues("detail") == "") {
|
if (form.getValues("detail") == "") {
|
||||||
form.setError("detail", {
|
form.setError("detail", {
|
||||||
type: "manual",
|
type: "manual",
|
||||||
|
|
@ -245,7 +247,7 @@ export default function EditDaily() {
|
||||||
.filter((key) => selected[key])
|
.filter((key) => selected[key])
|
||||||
.join(", ");
|
.join(", ");
|
||||||
};
|
};
|
||||||
// console.log("data", data, selected);
|
console.log("data", data, selected);
|
||||||
loading();
|
loading();
|
||||||
|
|
||||||
const reqData = {
|
const reqData = {
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ export default function CreateDaily() {
|
||||||
assignmentMainTypeId: 2,
|
assignmentMainTypeId: 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
// console.log("req =>", reqData);
|
console.log("req =>", reqData);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
|
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
|
||||||
|
|
@ -76,11 +76,11 @@ export default function DetailMonthly() {
|
||||||
close();
|
close();
|
||||||
if (res?.data?.data != undefined) {
|
if (res?.data?.data != undefined) {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
// console.log("Data :", data);
|
console.log("Data :", data);
|
||||||
form.setValue("title", data?.title);
|
form.setValue("title", data?.title);
|
||||||
form.setValue("detail", data.description);
|
form.setValue("detail", data.description);
|
||||||
const date = parseDate(data.date);
|
const date = parseDate(data.date);
|
||||||
// console.log("date", date);
|
console.log("date", date);
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"month",
|
"month",
|
||||||
new Date(date.getFullYear(), date.getMonth(), 1)
|
new Date(date.getFullYear(), date.getMonth(), 1)
|
||||||
|
|
@ -127,7 +127,7 @@ export default function DetailMonthly() {
|
||||||
date: `${month.toString().padStart(2, "0")}/${year}`,
|
date: `${month.toString().padStart(2, "0")}/${year}`,
|
||||||
status: "Open",
|
status: "Open",
|
||||||
};
|
};
|
||||||
// console.log("req", reqData, data.month);
|
console.log("req", reqData, data.month);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
close();
|
close();
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
@ -154,7 +154,7 @@ export default function DetailMonthly() {
|
||||||
selectedDate.getMonth(),
|
selectedDate.getMonth(),
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
// console.log("newDate", newDate, selectedDate);
|
console.log("newDate", newDate, selectedDate);
|
||||||
form.setValue("month", newDate);
|
form.setValue("month", newDate);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -76,11 +76,11 @@ export default function EditMonthly() {
|
||||||
close();
|
close();
|
||||||
if (res?.data?.data != undefined) {
|
if (res?.data?.data != undefined) {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
// console.log("Data :", data);
|
console.log("Data :", data);
|
||||||
form.setValue("title", data?.title);
|
form.setValue("title", data?.title);
|
||||||
form.setValue("detail", data.description);
|
form.setValue("detail", data.description);
|
||||||
const date = parseDate(data.date);
|
const date = parseDate(data.date);
|
||||||
// console.log("date", date);
|
console.log("date", date);
|
||||||
form.setValue(
|
form.setValue(
|
||||||
"month",
|
"month",
|
||||||
new Date(date.getFullYear(), date.getMonth(), 1)
|
new Date(date.getFullYear(), date.getMonth(), 1)
|
||||||
|
|
@ -128,7 +128,7 @@ export default function EditMonthly() {
|
||||||
date: `${month.toString().padStart(2, "0")}/${year}`,
|
date: `${month.toString().padStart(2, "0")}/${year}`,
|
||||||
status: "Open",
|
status: "Open",
|
||||||
};
|
};
|
||||||
// console.log("req", reqData, data.month);
|
console.log("req", reqData, data.month);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
close();
|
close();
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
@ -155,7 +155,7 @@ export default function EditMonthly() {
|
||||||
selectedDate.getMonth(),
|
selectedDate.getMonth(),
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
// console.log("newDate", newDate, selectedDate);
|
console.log("newDate", newDate, selectedDate);
|
||||||
form.setValue("month", newDate);
|
form.setValue("month", newDate);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ export default function CreateMonthly() {
|
||||||
date: `${month.toString().padStart(2, "0")}/${year}`,
|
date: `${month.toString().padStart(2, "0")}/${year}`,
|
||||||
status: "Open",
|
status: "Open",
|
||||||
};
|
};
|
||||||
// console.log("req", reqData, data.month);
|
console.log("req", reqData, data.month);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
close();
|
close();
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ export default function DetailWeekly() {
|
||||||
status: "Open",
|
status: "Open",
|
||||||
parentId: parentId,
|
parentId: parentId,
|
||||||
};
|
};
|
||||||
// console.log("req", reqData);
|
console.log("req", reqData);
|
||||||
const response = await savePlanning(reqData);
|
const response = await savePlanning(reqData);
|
||||||
close();
|
close();
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
|
|
@ -147,7 +147,7 @@ export default function DetailWeekly() {
|
||||||
close();
|
close();
|
||||||
if (res?.data?.data != undefined) {
|
if (res?.data?.data != undefined) {
|
||||||
const data = res?.data?.data;
|
const data = res?.data?.data;
|
||||||
// console.log("Data :", data);
|
console.log("Data :", data);
|
||||||
form.setValue("title", data?.title);
|
form.setValue("title", data?.title);
|
||||||
form.setValue("week", {
|
form.setValue("week", {
|
||||||
from: new Date(data?.startDate),
|
from: new Date(data?.startDate),
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue