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