fixing
This commit is contained in:
parent
80169209a2
commit
76998748b1
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import SiteBreadcrumb from "@/components/site-breadcrumb";
|
import SiteBreadcrumb from "@/components/site-breadcrumb";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { Check, ChevronsUpDown } from "lucide-react";
|
import { Check, ChevronsUpDown, Eye, EyeOff } from "lucide-react";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
|
|
@ -174,7 +174,8 @@ export default function CreateUserForm() {
|
||||||
const MySwal = withReactContent(Swal);
|
const MySwal = withReactContent(Swal);
|
||||||
const levelName = getCookiesDecrypt("ulnae");
|
const levelName = getCookiesDecrypt("ulnae");
|
||||||
const [roleList, setRoleList] = useState<RoleData[]>([]);
|
const [roleList, setRoleList] = useState<RoleData[]>([]);
|
||||||
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
|
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
|
||||||
const [userEducations, setUserEducations] = useState<any>();
|
const [userEducations, setUserEducations] = useState<any>();
|
||||||
const [userSchools, setUserSchools] = useState<any>();
|
const [userSchools, setUserSchools] = useState<any>();
|
||||||
const [userCompetencies, setUserCompetencies] = useState<any>();
|
const [userCompetencies, setUserCompetencies] = useState<any>();
|
||||||
|
|
@ -694,18 +695,26 @@ export default function CreateUserForm() {
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>Password</FormLabel>
|
<FormLabel>Password</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<div className="relative w-1/2">
|
||||||
type="password"
|
<Input
|
||||||
placeholder="Masukkan kata sandi"
|
type={showPassword ? "text" : "password"}
|
||||||
{...field}
|
placeholder="Masukkan kata sandi"
|
||||||
className="w-1/2"
|
{...field}
|
||||||
/>
|
/>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setShowPassword(!showPassword)}
|
||||||
|
className="absolute right-2 top-1/2 -translate-y-1/2 text-gray-500"
|
||||||
|
>
|
||||||
|
{showPassword ? <EyeOff size={18} /> : <Eye size={18} />}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="confirmPassword"
|
name="confirmPassword"
|
||||||
|
|
@ -713,18 +722,32 @@ export default function CreateUserForm() {
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>Konfirmasi Kata Sandi</FormLabel>
|
<FormLabel>Konfirmasi Kata Sandi</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input
|
<div className="relative w-1/2">
|
||||||
type="password"
|
<Input
|
||||||
placeholder="Masukkan kata sandi"
|
type={showConfirmPassword ? "text" : "password"}
|
||||||
{...field}
|
placeholder="Masukkan kata sandi"
|
||||||
className="w-1/2"
|
{...field}
|
||||||
/>
|
/>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() =>
|
||||||
|
setShowConfirmPassword(!showConfirmPassword)
|
||||||
|
}
|
||||||
|
className="absolute right-2 top-1/2 -translate-y-1/2 text-gray-500"
|
||||||
|
>
|
||||||
|
{showConfirmPassword ? (
|
||||||
|
<EyeOff size={18} />
|
||||||
|
) : (
|
||||||
|
<Eye size={18} />
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<PasswordChecklist
|
<PasswordChecklist
|
||||||
rules={["minLength", "specialChar", "number", "capital", "match"]}
|
rules={["minLength", "specialChar", "number", "capital", "match"]}
|
||||||
minLength={8}
|
minLength={8}
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,25 @@ const ContentListBanner = () => {
|
||||||
const [page, setPage] = React.useState(1);
|
const [page, setPage] = React.useState(1);
|
||||||
const [totalPage, setTotalPage] = React.useState(1);
|
const [totalPage, setTotalPage] = React.useState(1);
|
||||||
const [searchQuery, setSearchQuery] = React.useState("");
|
const [searchQuery, setSearchQuery] = React.useState("");
|
||||||
|
const [bannerCount, setBannerCount] = React.useState<number>(0);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
fetchBannerCount();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
async function fetchBannerCount() {
|
||||||
|
try {
|
||||||
|
const res = await listDataMedia(0, "100", "", "", "");
|
||||||
|
const banners = res?.data?.data?.content?.filter(
|
||||||
|
(item: any) => item.isBanner
|
||||||
|
);
|
||||||
|
setBannerCount(banners?.length || 0);
|
||||||
|
|
||||||
|
setBannerCount(data?.length || 0);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error fetching banner count:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const handleKeyUp = () => {
|
const handleKeyUp = () => {
|
||||||
clearTimeout(typingTimer);
|
clearTimeout(typingTimer);
|
||||||
|
|
@ -218,11 +237,26 @@ const ContentListBanner = () => {
|
||||||
|
|
||||||
const handleBanner = async (ids: number[]) => {
|
const handleBanner = async (ids: number[]) => {
|
||||||
try {
|
try {
|
||||||
await Promise.all(ids.map((id) => setBanner(id, true)));
|
// const res = await Promise.all(ids.map((id) => setBanner(id, true)));
|
||||||
toast({
|
|
||||||
title: "Sukses",
|
for (const element of ids) {
|
||||||
description: `${ids.length} item berhasil dijadikan banner.`,
|
loading();
|
||||||
});
|
const res = await setBanner(element, true);
|
||||||
|
close();
|
||||||
|
if (res?.error) {
|
||||||
|
toast({
|
||||||
|
title: "Gagal",
|
||||||
|
description:
|
||||||
|
"Banner sudah melebihi batas maksimum (4 konten). Silahkan di disable banner Lainnya.",
|
||||||
|
variant: "destructive",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toast({
|
||||||
|
title: "Sukses",
|
||||||
|
description: `item berhasil dijadikan banner.`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toast({
|
toast({
|
||||||
title: "Gagal",
|
title: "Gagal",
|
||||||
|
|
|
||||||
|
|
@ -237,13 +237,44 @@ const ContentListPopUp = () => {
|
||||||
|
|
||||||
const { toast } = useToast();
|
const { toast } = useToast();
|
||||||
|
|
||||||
|
// const handlePopUp = async (ids: number[]) => {
|
||||||
|
// try {
|
||||||
|
// await Promise.all(ids.map((id) => setPopUp(id, true)));
|
||||||
|
// toast({
|
||||||
|
// title: "Sukses",
|
||||||
|
// description: `${ids.length} item berhasil dijadikan Popup.`,
|
||||||
|
// });
|
||||||
|
// } catch (err) {
|
||||||
|
// toast({
|
||||||
|
// title: "Gagal",
|
||||||
|
// description: "Terjadi kesalahan saat menjadikan Popup.",
|
||||||
|
// variant: "destructive",
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
const handlePopUp = async (ids: number[]) => {
|
const handlePopUp = async (ids: number[]) => {
|
||||||
try {
|
try {
|
||||||
await Promise.all(ids.map((id) => setPopUp(id, true)));
|
// const res = await Promise.all(ids.map((id) => setBanner(id, true)));
|
||||||
toast({
|
|
||||||
title: "Sukses",
|
for (const element of ids) {
|
||||||
description: `${ids.length} item berhasil dijadikan banner.`,
|
loading();
|
||||||
});
|
const res = await setPopUp(element, true);
|
||||||
|
close();
|
||||||
|
if (res?.error) {
|
||||||
|
toast({
|
||||||
|
title: "Gagal",
|
||||||
|
description:
|
||||||
|
"Banner sudah melebihi batas maksimum (4 konten). Silahkan di disable popup Lainnya.",
|
||||||
|
variant: "destructive",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
toast({
|
||||||
|
title: "Sukses",
|
||||||
|
description: `item berhasil dijadikan banner.`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toast({
|
toast({
|
||||||
title: "Gagal",
|
title: "Gagal",
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,7 @@ const CalendarView = ({ categories }: CalendarViewProps) => {
|
||||||
const [selectedCategory, setSelectedCategory] = useState<string[]>([]);
|
const [selectedCategory, setSelectedCategory] = useState<string[]>([]);
|
||||||
const [selectedEventDate, setSelectedEventDate] = useState<Date | null>(null);
|
const [selectedEventDate, setSelectedEventDate] = useState<Date | null>(null);
|
||||||
const roleId = Number(getCookiesDecrypt("urie")) || 0;
|
const roleId = Number(getCookiesDecrypt("urie")) || 0;
|
||||||
|
console.log("DUARR", roleId)
|
||||||
const userLevelId = Number(getCookiesDecrypt("ulie")) || 0;
|
const userLevelId = Number(getCookiesDecrypt("ulie")) || 0;
|
||||||
const [calendarEvents, setCalendarEvents] = useState<CalendarEvent[]>([]);
|
const [calendarEvents, setCalendarEvents] = useState<CalendarEvent[]>([]);
|
||||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||||
|
|
@ -526,7 +527,7 @@ const CalendarView = ({ categories }: CalendarViewProps) => {
|
||||||
<Card className="col-span-12 lg:col-span-4 2xl:col-span-3 pb-5">
|
<Card className="col-span-12 lg:col-span-4 2xl:col-span-3 pb-5">
|
||||||
<CardContent className="p-0">
|
<CardContent className="p-0">
|
||||||
<CardHeader className="border-none mb-2 pt-5">
|
<CardHeader className="border-none mb-2 pt-5">
|
||||||
{[3, 11, 2, 12].includes(roleId) && (
|
{[3, 11, 2].includes(roleId) && (
|
||||||
<Button
|
<Button
|
||||||
onClick={handleDateClick}
|
onClick={handleDateClick}
|
||||||
className="dark:bg-background dark:text-foreground w-full"
|
className="dark:bg-background dark:text-foreground w-full"
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ const TableVideo = () => {
|
||||||
const [columnVisibility, setColumnVisibility] =
|
const [columnVisibility, setColumnVisibility] =
|
||||||
React.useState<VisibilityState>({});
|
React.useState<VisibilityState>({});
|
||||||
const [rowSelection, setRowSelection] = React.useState({});
|
const [rowSelection, setRowSelection] = React.useState({});
|
||||||
const [showData, setShowData] = React.useState("50");
|
const [showData, setShowData] = React.useState("10");
|
||||||
const [pagination, setPagination] = React.useState<PaginationState>({
|
const [pagination, setPagination] = React.useState<PaginationState>({
|
||||||
pageIndex: 0,
|
pageIndex: 0,
|
||||||
pageSize: Number(showData),
|
pageSize: Number(showData),
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
"use client"; // Error components must be Client Components
|
"use client";
|
||||||
|
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
// components/custom-editor.js
|
|
||||||
|
|
||||||
import React, { useRef, useEffect, useState, useCallback } from "react";
|
import React, { useRef, useEffect, useState, useCallback } from "react";
|
||||||
import { Editor } from "@tinymce/tinymce-react";
|
import { Editor } from "@tinymce/tinymce-react";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ export default function FormVideoDetail() {
|
||||||
|
|
||||||
if (findCategory) {
|
if (findCategory) {
|
||||||
// setValue("categoryId", findCategory.id);
|
// setValue("categoryId", findCategory.id);
|
||||||
setSelectedCategory(findCategory.id); // Set the selected category
|
setSelectedCategory(findCategory.id);
|
||||||
const response = await getTagsBySubCategoryId(findCategory.id);
|
const response = await getTagsBySubCategoryId(findCategory.id);
|
||||||
setTags(response?.data?.data);
|
setTags(response?.data?.data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -512,7 +512,7 @@ export default function FormVideo() {
|
||||||
|
|
||||||
const save = async (data: VideoSchema) => {
|
const save = async (data: VideoSchema) => {
|
||||||
loading();
|
loading();
|
||||||
const finalTags = tags.join(", ");
|
const finalTags = data.tags.join(", ");
|
||||||
const finalTitle = isSwitchOn ? title : data.title;
|
const finalTitle = isSwitchOn ? title : data.title;
|
||||||
// const finalDescription = articleBody || data.description;
|
// const finalDescription = articleBody || data.description;
|
||||||
const finalDescription = isSwitchOn
|
const finalDescription = isSwitchOn
|
||||||
|
|
@ -578,7 +578,7 @@ export default function FormVideo() {
|
||||||
if (thumbnail) {
|
if (thumbnail) {
|
||||||
const formMedia = new FormData();
|
const formMedia = new FormData();
|
||||||
formMedia.append("file", thumbnail);
|
formMedia.append("file", thumbnail);
|
||||||
const responseThumbnail = await uploadThumbnail(formMedia, id);
|
const responseThumbnail = await uploadThumbnail(id, formMedia);
|
||||||
if (responseThumbnail?.error) {
|
if (responseThumbnail?.error) {
|
||||||
error(responseThumbnail.message);
|
error(responseThumbnail.message);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ type Detail = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const ProfileInfo = () => {
|
const ProfileInfo = () => {
|
||||||
const username = Cookies.get("state");
|
const username = Cookies.get("access_token");
|
||||||
const picture = Cookies.get("profile_picture");
|
const picture = Cookies.get("profile_picture");
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [detail, setDetail] = useState<Detail>();
|
const [detail, setDetail] = useState<Detail>();
|
||||||
|
|
@ -52,7 +52,6 @@ const ProfileInfo = () => {
|
||||||
if (!username) {
|
if (!username) {
|
||||||
router.push("/auth");
|
router.push("/auth");
|
||||||
}
|
}
|
||||||
console.log("us", username);
|
|
||||||
}, [username]);
|
}, [username]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ export const useAuth = (): AuthContextType => {
|
||||||
clearAllCookies();
|
clearAllCookies();
|
||||||
warning(
|
warning(
|
||||||
"Akun Anda tidak dapat digunakan untuk masuk ke MediaHub Polri",
|
"Akun Anda tidak dapat digunakan untuk masuk ke MediaHub Polri",
|
||||||
"/auth/login"
|
"/auth"
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export const NAVIGATION_CONFIG: NavigationConfig[] = [
|
||||||
{ roleId: 2, path: "/in/dashboard/executive", label: "Executive Dashboard" },
|
{ roleId: 2, path: "/in/dashboard/executive", label: "Executive Dashboard" },
|
||||||
{ roleId: 3, path: "/in/dashboard", label: "Dashboard" },
|
{ roleId: 3, path: "/in/dashboard", label: "Dashboard" },
|
||||||
{ roleId: 4, path: "/in/dashboard", label: "Dashboard" },
|
{ roleId: 4, path: "/in/dashboard", label: "Dashboard" },
|
||||||
{ roleId: 9, path: "/in/dashboard", label: "Dashboard" },
|
{ roleId: 9, path: "/in/supervisor/ticketing", label: "Ticketing" },
|
||||||
{ roleId: 10, path: "/in/dashboard", label: "Dashboard" },
|
{ roleId: 10, path: "/in/dashboard", label: "Dashboard" },
|
||||||
{ roleId: 11, path: "/in/dashboard", label: "Dashboard" },
|
{ roleId: 11, path: "/in/dashboard", label: "Dashboard" },
|
||||||
{ roleId: 12, path: "/in/dashboard", label: "Dashboard" },
|
{ roleId: 12, path: "/in/dashboard", label: "Dashboard" },
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue