diff --git a/app/[locale]/(public)/content-management/galery/page.tsx b/app/[locale]/(public)/content-management/galery/page.tsx index ee538a07..18e2295e 100644 --- a/app/[locale]/(public)/content-management/galery/page.tsx +++ b/app/[locale]/(public)/content-management/galery/page.tsx @@ -13,6 +13,9 @@ import withReactContent from "sweetalert2-react-content"; import { getCookiesDecrypt } from "@/lib/utils"; import Swal from "sweetalert2"; import { useToast } from "@/components/ui/use-toast"; +import { Icon } from "@iconify/react/dist/iconify.js"; +import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; +import { Button } from "@/components/ui/button"; const Galery = (props: any) => { const [profile, setProfile] = useState(); @@ -28,7 +31,7 @@ const Galery = (props: any) => { const { isInstitute, instituteId } = props; const userId = getCookiesDecrypt("uie"); const userRoleId = getCookiesDecrypt("urie"); - + const { toast } = useToast(); const [totalContent, setTotalContent] = useState(); const [categoryFilter] = useState([]); const [formatFilter] = useState([]); @@ -217,6 +220,9 @@ const Galery = (props: any) => { await navigator.clipboard.writeText(`https://mediahub.polri.go.id/video/detail/${url}`); setCopySuccess("Copied"); // toast.success("Link Berhasil Di Copy"); + toast({ + title: "Link Berhasil Di Copy", + }); }; const [hasMounted, setHasMounted] = useState(false); @@ -277,12 +283,44 @@ const Galery = (props: any) => { contentVideo?.length > 0 ? (
{contentVideo?.map((video: any) => ( - + - - +
+ + + +
{video?.mediaUpload?.title}
- + + + + + + + + + + + + + +

Content Rewrite

+ +
+ +
+ +
+
+
+
+
))} diff --git a/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx b/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx new file mode 100644 index 00000000..0237434c --- /dev/null +++ b/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx @@ -0,0 +1,145 @@ +"use client"; + +import HeaderManagement from "@/components/landing-page/header-management"; +import SidebarManagement from "@/components/landing-page/sidebar-management"; +import { useRouter } from "@/i18n/routing"; +import { getCookiesDecrypt } from "@/lib/utils"; +import { useSearchParams } from "next/navigation"; +import React, { useState } from "react"; +import Swal from "sweetalert2"; +import withReactContent from "sweetalert2-react-content"; +import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue } from "@/components/ui/select"; + +const page = () => { + // const { states } = props; + const [profile, setProfile] = useState(); + const MySwal = withReactContent(Swal); + const router = useRouter(); + const [, setLoadingState] = useState(false); + const searchParams = useSearchParams(); + const id: any = searchParams?.get("title"); + const [content, setContent] = useState([]); + const [isFromSPIT, setIsFromSPIT] = useState(false); + const [listSuggestion, setListSuggestion] = useState(); + const [main, setMain] = useState(); + const userId = getCookiesDecrypt("uie"); + const userRoleId = getCookiesDecrypt("urie"); + const [articleIds, setArticleIds] = useState([]); + const [isGeneratedArticle, setIsGeneratedArticle] = useState(false); + const [selectedArticleId, setSelectedArticleId] = useState(null); + const [articleBody, setArticleBody] = useState(""); + const [selectedAdvConfig, setSelectedAdvConfig] = useState(""); + const [selectedWritingStyle, setSelectedWritingStyle] = useState(""); + const [selectedContextType, setSelectedContextType] = useState(""); + const [selectedLanguage, setSelectedLanguage] = useState(""); + const [selectedTitle, setSelectedTitle] = useState(""); + const [selectedMainKeyword, setSelectedMainKeyword] = useState(""); + const [selectedSEO, setSelectedSEO] = useState(""); + const [selectedSize, setSelectedSize] = useState(""); + const [detailArticle, setDetailArticle] = useState(null); + const [contentType, setContentType] = useState("all"); + + const userLevelId = getCookiesDecrypt("ulie"); + const roleId = getCookiesDecrypt("urie"); + return ( + <> + + +
+ +
+
+
Content Rewrite
+
+
+
+
+

Bahasa

+ +
+
+

Context Type

+ +
+
+

Writing Style

+ +
+
+

Article Size

+ +
+
+
+

Judul

+ setSelectedTitle(e.target.value)} + /> +
+
+
+
+
+
+ + ); +}; + +export default page; diff --git a/app/[locale]/(public)/content-management/rewrite/detail/[id]/page.tsx b/app/[locale]/(public)/content-management/rewrite/detail/[id]/page.tsx index 910fa8fe..fb0f6b34 100644 --- a/app/[locale]/(public)/content-management/rewrite/detail/[id]/page.tsx +++ b/app/[locale]/(public)/content-management/rewrite/detail/[id]/page.tsx @@ -78,8 +78,6 @@ const page = (props: any) => { getInitData(); }, []); - let componentMounted = true; - const validationSchema = Yup.object().shape({ title: Yup.string().required("Judul tidak boleh kosong"), }); @@ -288,12 +286,11 @@ const page = (props: any) => {
- {/* setArticleBody(event.editor?.getData())} /> */} {/* */} {articleBody === null || articleBody === "" ?
Deskripsi tidak boleh kosong
: ""}
- {/* )} */} + {/* )} */} diff --git a/app/[locale]/(public)/content-management/users/page.tsx b/app/[locale]/(public)/content-management/users/page.tsx index 7ae41b9d..c5942206 100644 --- a/app/[locale]/(public)/content-management/users/page.tsx +++ b/app/[locale]/(public)/content-management/users/page.tsx @@ -154,9 +154,6 @@ const page = () => { - {/* */} diff --git a/components/form/content/image-form.tsx b/components/form/content/image-form.tsx index 3bd4a3d5..4d216f4b 100644 --- a/components/form/content/image-form.tsx +++ b/components/form/content/image-form.tsx @@ -912,22 +912,7 @@ export default function FormImage() { )}
- ( - // - - )} - /> + รง {errors.description?.message && (

{errors.description.message} diff --git a/components/landing-page/navbar.tsx b/components/landing-page/navbar.tsx index 2e8a6cd6..e6d84a41 100644 --- a/components/landing-page/navbar.tsx +++ b/components/landing-page/navbar.tsx @@ -15,7 +15,10 @@ import Cookies from "js-cookie"; import { getInfoProfile } from "@/service/auth"; import { useTranslations } from "next-intl"; import { useRouter } from "@/i18n/routing"; +import { Button } from "@/components/ui/button"; import LocalSwitcher from "../partials/header/locale-switcher"; +import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"; +import { listRole } from "@/service/landing/landing"; type Detail = { id: number; @@ -45,6 +48,12 @@ const Navbar = () => { const [search, setSearch] = useState(""); const [onSearch, setOnSearch] = useState(""); const pathname = usePathname(); + const [role, setRole] = useState(); + const [menuActive, setMenuActive] = useState(); + const [category, setCategory] = useState(); + + let active = ""; + let menu = ""; const onLogout = () => { Object.keys(Cookies.get()).forEach((cookieName) => { @@ -77,6 +86,39 @@ const Navbar = () => { initState(); }, []); + useEffect(() => { + async function initState() { + setMenuActive(menu); + const res = await listRole(); + setRole(res?.data?.data); + } + + // async function getNotif() { + // if (roleId != undefined) { + // const response = await getUserNotifications(0, 2); + // setNotifications(response?.data?.data?.content); + // console.log("respon:", response); + // } + // } + + // async function getNotifUpdate() { + // if (roleId != undefined) { + // const response = await getUserNotifications(0, 3); + // setNotificationsUpdate(response?.data?.data?.content); // console.log("respon:", response); + // } + // } + + // async function getPolritvStatus() { + // const response = await getYtPolritvStatus(); + // console.log("Polritv status :", response?.data?.message); + // setIsPolriTvOnline(response.data?.message == "Online"); + // } + + initState(); + // getNotif(); + // getNotifUpdate(); + }, []); + const handleChange = (e: any) => { setSearch(e.target.value); }; @@ -396,12 +438,36 @@ const Navbar = () => { ) : ( // Masuk and Daftar buttons for roleId === null

- + {t("logIn")} - - {t("register")} - + + + + + +
+

Kategori Registrasi

+

Silahkan pilih salah satu

+
+
+ {role?.map((row: any) => ( +
+ setCategory(event.target.value)} /> + +
+ ))} +
+
+ + + Selanjutnya{" "} + + +
+
)}
@@ -570,12 +636,36 @@ const Navbar = () => { ) : ( <> - + {t("logIn")} - - {t("register")} - {" "} + + + + + +
+

Kategori Registrasi

+

Silahkan pilih salah satu

+
+
+ {role?.map((row: any) => ( +
+ setCategory(event.target.value)} /> + +
+ ))} +
+
+ + + Selanjutnya{" "} + + +
+
)} diff --git a/components/landing-page/sidebar-management.tsx b/components/landing-page/sidebar-management.tsx index fdfa3194..63846867 100644 --- a/components/landing-page/sidebar-management.tsx +++ b/components/landing-page/sidebar-management.tsx @@ -96,7 +96,7 @@ const SidebarManagement = () => {
-
+

Galeri {profile?.institute?.name}

@@ -107,7 +107,7 @@ const SidebarManagement = () => {
-
+

Galeri Saya

@@ -118,7 +118,7 @@ const SidebarManagement = () => {
-
+

Galeri Rewrite

@@ -129,7 +129,7 @@ const SidebarManagement = () => {
-
+

Tim Pengguna

diff --git a/service/landing/landing.ts b/service/landing/landing.ts index d3c05670..822a395a 100644 --- a/service/landing/landing.ts +++ b/service/landing/landing.ts @@ -1,26 +1,16 @@ -import { - httpDeleteInterceptor, - httpGetInterceptor, - httpPostInterceptor, -} from "../http-config/http-interceptor-service"; +import { httpDeleteInterceptor, httpGetInterceptor, httpPostInterceptor } from "../http-config/http-interceptor-service"; export async function getHeroData() { - return await httpGetInterceptor( - `media/public/list?enablePage=1&sort=desc&sortBy=createdAt&size=5&page=0&typeId=1&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=` - ); + return await httpGetInterceptor(`media/public/list?enablePage=1&sort=desc&sortBy=createdAt&size=5&page=0&typeId=1&title=&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=`); } export async function getCategoryData() { - return await httpGetInterceptor( - `media/categories/list/publish?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=` - ); + return await httpGetInterceptor(`media/categories/list/publish?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=`); } export async function getListContent(props: any) { return await httpGetInterceptor( - `media/public/list?enablePage=1&sort=desc&sortBy=${props.sortBy}&size=${ - props.size - }&page=${props.page}&typeId=${props.contentTypeId}&title=${ + `media/public/list?enablePage=1&sort=desc&sortBy=${props.sortBy}&size=${props.size}&page=${props.page}&typeId=${props.contentTypeId}&title=${ props.title ? props.title : "" }&categoryId=&fileFormats=&tags=&group=&startDate=&endDate=&month=&year=` ); @@ -31,9 +21,7 @@ export async function getPrivacy() { } export async function getIndeksData() { - return await httpGetInterceptor( - `blog/public/pagination?enablePage=1&page=0&size=20` - ); + return await httpGetInterceptor(`blog/public/pagination?enablePage=1&page=0&size=20`); } export async function getDetail(slug: string) { @@ -41,9 +29,7 @@ export async function getDetail(slug: string) { } export async function getDetailIndeks() { - return await httpGetInterceptor( - `blog/public/pagination?enablePage=1&page=0&size=6` - ); + return await httpGetInterceptor(`blog/public/pagination?enablePage=1&page=0&size=6`); } export async function getFeedback() { @@ -55,49 +41,20 @@ export async function postUserFeedback() { } export async function listCategory(type = "") { - return await httpGetInterceptor( - `media/categories/list/enable?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=${type}` - ); + return await httpGetInterceptor(`media/categories/list/enable?enablePage=1&sort=desc&sortBy=updatedAt&size=12&type=${type}`); } export async function publicDetailBlog(slug: any) { return await httpGetInterceptor(`blog/public/read/${slug}`); } -export async function listData( - type: string, - search: string, - category: string, - size = 10, - page = 0, - sortBy = "createdAt", - format = "", - tag = "", - group = "", - startDate = "", - endDate = "", - month = "", - year = "" -) { +export async function listData(type: string, search: string, category: string, size = 10, page = 0, sortBy = "createdAt", format = "", tag = "", group = "", startDate = "", endDate = "", month = "", year = "") { return await httpGetInterceptor( `media/public/list?enablePage=1&sort=desc&sortBy=${sortBy}&size=${size}&page=${page}&typeId=${type}&title=${search}&categoryId=${category}&fileFormats=${format}&tags=${tag}&group=${group}&startDate=${startDate}&endDate=${endDate}&month=${month}&year=${year}` ); } -export async function listDataRegional( - type: string, - search: string, - category: string, - format = "", - tag = "", - startDate = "", - endDate = "", - month = "", - year = "", - size = 10, - page = 0, - sortBy = "createdAt" -) { +export async function listDataRegional(type: string, search: string, category: string, format = "", tag = "", startDate = "", endDate = "", month = "", year = "", size = 10, page = 0, sortBy = "createdAt") { return await httpGetInterceptor( `media/public/regional-list?enablePage=1&size=${size}&page=${page}&sort=desc&sortBy=${sortBy}&typeId=${type}&title=${search}&categoryId=${category}&fileFormats=${format}&tags=${tag}&startDate=${startDate}&endDate=${endDate}&month=${month}&year=${year}` ); @@ -118,51 +75,32 @@ export async function getListPorvinces() { export async function getUsersTeams(id: any) { return await httpGetInterceptor(`users?instituteId=${id}`); } -export async function mediaWishlist( - type: any, - instituteId: any, - search: any, - category: any, - size: string, - page: number, - sortBy: undefined, - format: string -) { - return await httpGetInterceptor( - `/media/wishlist/list?enablePage=1&size=${size}&page=${page}&typeId=${type}&instituteId=${instituteId}` - ); +export async function mediaWishlist(type: any, instituteId: any, search: any, category: any, size: string, page: number, sortBy: undefined, format: string) { + return await httpGetInterceptor(`/media/wishlist/list?enablePage=1&size=${size}&page=${page}&typeId=${type}&instituteId=${instituteId}`); } export async function checkWishlistStatus(mediaId: any) { return await httpGetInterceptor(`/media/wishlist/status?mediaId=${mediaId}`); } +export async function listRole() { + const url = "public/users/roles"; + return httpGetInterceptor(url); +} + export async function deleteWishlist(id: any) { return await httpDeleteInterceptor(`media/wishlist?id=${id}`); } export async function getContentRewritePagination(page = 0, size = 10) { - return await httpGetInterceptor( - `media/rewrite/pagination?size=${size}&page=${page}` - ); + return await httpGetInterceptor(`media/rewrite/pagination?size=${size}&page=${page}`); } export async function getContentRewrite(id: any) { return await httpGetInterceptor(`media/rewrite?id=${id}`); } -export async function listDataAll( - type: any, - search: any, - category: any, - format = "", - tag = "", - group = "", - startDate = "", - endDate = "", - month = "", - year = "" -) { +export async function listDataAll(type: any, search: any, category: any, format = "", tag = "", group = "", startDate = "", endDate = "", month = "", year = "") { return await httpGetInterceptor( `media/public/list?enablePage=1&size=20&sort=desc&typeId=${type}&title=${search}&categoryId=${category}&fileFormats=${format}&tags=${tag}&group=${group}&startDate=${startDate}&endDate=${endDate}&month=${month}&year=${year}` );