import{q as N,R as T,v as _,j as e,$ as A}from"./app-BGey7YPf.js";import{h as d,A as U}from"./app-layout-mnJEmZ7X.js";import{H as P}from"./header-D0w47C-P.js";import{D as C,a as w,b as F,c as H,d as L,e as M}from"./dialog-OAe1w9Cd.js";import{T as R,a as S,b as B,c as E,d as h,e as t,f as O,g as I,h as r}from"./table-C3FnqSRz.js";import{C as $,A as q,M as z,P as G}from"./page-pagination-D1u9TBBY.js";import{w as J}from"./date-DEC3gYI7.js";import K from"./link-profile-form-D5NyhpmS.js";import{A as Q,a as V,b as W}from"./icons-hx7HvmR4.js";import"./button-D5r5edT8.js";import"./chevron-right-CE_1krjA.js";import"./separator-Di-l93J0.js";import"./input-CGSIKYsG.js";import"./index-BFyaOBDQ.js";import"./index-CwO5dfCw.js";import"./index-Q2wK6uZI.js";import"./theme-provider-NKMbg-kV.js";import"./use-toast-DGElh_6W.js";import"./x-C4WIHhXm.js";import"./select-BqSuhmAT.js";import"./index-BuSoVzfP.js";import"./chevron-down-DOZGaFlM.js";import"./trash-Blc6Iqr5.js";import"./chevron-left-7ssMp1N3.js";import"./textarea-B31u9E-S.js";import"./label-BbSRpehS.js";import"./input-select-DHdS_tES.js";import"./search-CA9JuCC9.js";import"./has-role-XA1xdWi8.js";import"./button-submit-end-BkQSWpq2.js";import"./save-Bm3_KHjE.js";function X(){const{linkProfiles:l,lembagas:j,currentPage:p,perPage:m}=N().props,[u,c]=T.useState(!1),f=a=>{c(!0),n(i=>({...i,id:a.id}))},{data:s,setData:n,post:g,processing:b,errors:k,reset:x,transform:D}=_({id:"",link_profile_npsn:"",display_name:"",bio:"",avatar:null,theme:"",open:!1,isUpdate:!1}),v=a=>{n(i=>({...i,id:a.id??"",link_profile_npsn:a.link_profile_npsn??"",display_name:a.display_name??"",bio:a.bio??"",avatar:a.avatar??"",theme:a.theme??"",open:!0,isUpdate:!0}))};D(a=>({...a,_method:a.isUpdate?"PUT":"POST"}));const y=async a=>{a.preventDefault();const i=s.isUpdate?route("apps.link-profiles.update",s.id):route("apps.link-profiles.store");g(i,{forceFormData:!0,onSuccess:()=>{x(),n(o=>({...o,open:!1,avatar:null,isUpdate:!1}))}})};return e.jsxs(e.Fragment,{children:[e.jsx(A,{title:"Data LinkProfile"}),e.jsx(P,{title:"Data LinkProfile",subtitle:"Halaman ini digunakan untuk mengelola data linkProfiles pengguna",children:e.jsxs(C,{open:s.open,onOpenChange:a=>n({...s,open:a,id:"",link_profile_npsn:"",display_name:"",bio:"",avatar:null,theme:"",isUpdate:!1}),children:[d(["link-profiles-create"])&&e.jsxs(w,{className:"px-4 py-2 flex items-center gap-2 rounded-lg text-sm font-semibold text-gray-700 border hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-900 dark:border-gray-800 focus:outline-none",children:[e.jsx($,{className:"size-4"})," ",e.jsx("span",{className:"hidden sm:inline-flex",children:"Tambah Data LinkProfile"})]}),e.jsxs(F,{className:"p-0",children:[e.jsxs(H,{className:"p-4 border-b",children:[e.jsxs(L,{children:[s.isUpdate?"Ubah":"Tambah"," Data LinkProfile"]}),e.jsxs(M,{className:"text-sm",children:["Form ini digunakan untuk ",s.isUpdate?"mengubah data linkProfiles":"menambahkan data linkProfiles"]})]}),e.jsx(K,{data:s,errors:k,processing:b,setData:n,storeData:y,reset:x,lembagasData:j})]})]})}),e.jsxs("div",{className:"p-6",children:[e.jsx("div",{className:"mb-5",children:e.jsx(R,{withFilterPage:!0,currentPage:p,perPage:m,url:route("apps.link-profiles.index"),placeholder:"Cari data linkProfiles berdasarkan nama linkProfiles"})}),e.jsx(S,{children:e.jsxs(B,{"aria-label":"Daftar Link Profiles",children:[e.jsx(E,{children:e.jsxs(h,{children:[e.jsx(t,{className:"w-[10px] text-center",children:"No"}),e.jsx(t,{children:"Avatar"}),e.jsx(t,{children:"Display Name"}),e.jsx(t,{children:"Bio"}),e.jsx(t,{children:"Token"}),e.jsx(t,{children:"Activity"}),e.jsx(t,{className:"w-[10px] text-center",children:"Aksi"})]})}),e.jsx(O,{children:l.data.length===0?e.jsx(I,{colSpan:8,message:"data linkProfiles"}):l.data.map((a,i)=>{var o;return e.jsxs(h,{children:[e.jsx(r,{className:"text-center",children:i+1+(p-1)*m}),e.jsx(r,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(Q,{children:[e.jsx(V,{src:a.avatar||"logo.svg"}),e.jsx(W,{children:"CN"})]}),e.jsx("div",{className:"flex flex-col",children:e.jsx("span",{className:"font-semibold",children:((o=a.lembaga)==null?void 0:o.name)||"-"})})]})}),e.jsx(r,{children:a.display_name||"-"}),e.jsx(r,{children:a.bio||"-"}),e.jsx(r,{children:a.link_profile_npsn}),e.jsx(r,{children:J(a.created_at)}),e.jsx(r,{className:"text-center",children:(d(["link-profiles-update"])||d(["link-profiles-delete"]))&&e.jsx(q,{permissionPrefix:"link-profiles",isModal:!0,withDetail:!0,actionDetailHref:route("apps.links.show-by-id",{id:a.id}),actionEdit:()=>v(a),actionDelete:()=>f(a)})})]},a.id)})})]})}),e.jsx(z,{open:u,onOpenChange:c,url:route("apps.link-profiles.destroy",s.id)}),e.jsx(G,{data:l.meta})]})]})}X.layout=l=>e.jsx(U,{children:l});export{X as default};
