PageSourceSearch

https://go-nanny.id/_nuxt/index.c1421b4a.js

js go-nanny.id collected 2026-10-02 01:03:16 UTC 4,328 bytes, 1 lines download raw bytes

1import{_ as U}from"./ImageUploader.813e67df.js";import{_ as M}from"./Group.vue.a955ec46.js";import{u as T}from"./useToast.acdd6c2f.js";import{e as $,a as j,u as B,f as K,d as L,b as O}from"./entry.036824a3.js";import{u as q}from"./useImagesForm.b3c6e88b.js";import{m as G,a as g,an as H,b as k,p as A,k as W,N as y,W as J,V as Q,O as l,u as n,_ as C,R as V,a4 as X,P as Y,M as p,K as Z,j as D,n as ee}from"./swiper-vue.9554298b.js";import"./Icon.835a50bf.js";import"./config.aec7d9fd.js";const ae=l("div",{class:"flex flex-col md:flex-row md:items-center md:justify-between mb-6 gap-4"},[l("div",null,[l("h1",{class:"text-2xl font-bold text-gray-800"},"Image partners Management"),l("p",{class:"text-sm text-gray-500 mt-1"},"Manage image partners on your landing page.")])],-1),te=l("div",{class:"pt-2"},null,-1),se={class:"flex items-center justify-end gap-3 mt-4"},re={key:0,class:"text-blue-500 text-sm"},oe=["disabled"],ne={key:0,class:"loading loading-spinner loading-sm"},_e=G({__name:"index",async setup(le){let c,I;const i=T();$();const{requestOptions:F}=j(),o=g([]),d=g([]),u=g(!1),f=g(0),{data:m,pending:x,refresh:b,error:ie}=([c,I]=H(async()=>O("admin-gallery-images",async()=>{try{const e=await $fetch("/admin/partners",{headers:{accept:"application/json"},method:"GET",...F});return console.log("✅ API Response:",e),e}catch(e){throw console.error("❌ Failed to fetch gallery data:",e),i.error("Failed to load gallery images"),e}},{server:!1,lazy:!1,immediate:!0})),c=await c,I(),c),{saveImagesChangePosition:z,saveImagesPositionOnly:N,loading:v,uploadLoading:h,selectedItem:ue,setSelectedItem:P,syncImages:_}=q([],{apiName:"partners",identifierKey:"",customEndpoint:"/admin/partners",customEndpointSaveImages:"/admin/save-partners",callback:()=>{i.success("Saved successfully"),b()}});function w(e){if(console.log("🎨 Initializing images...",e),!(e!=null&&e.data)||!Array.isArray(e.data)){console.warn("⚠️ No valid data array found"),o.value=[],d.value=[],_([]);return}const t=e.data.map(a=>({id:a.id,image:a.image||a.url,url:a.image||a.url,name:a.name||`image-${a.id}`,fromServer:!0,file:null,size:0,link:a.url||""}));console.log("✨ Formatted images:",t),o.value=[...t],d.value=[...t],_([...t]),t.length>0&&P({id:t[0].id}),u.value=!0,f.value++}k(()=>m.value,e=>{console.log("👀 Data watcher triggered:",e),e&&!u.value&&ee(()=>{w(e)})},{immediate:!0,deep:!0}),A(()=>
1{console.log("🏗️ Component mounted"),setTimeout(()=>{m.value&&!u.value&&(console.log("🔧 Force initialize on mount"),w(m.value))},100)}),k(o,e=>{console.log("📸 Images array changed:",e.length),u.value&&_([...e])},{deep:!0});async function S(){var e,t;try{const a=o.value.filter(r=>!r.fromServer&&r.file instanceof File).map(r=>({file:r.file,link:r.link||""}));let s;if(a.length>0?s=await z(a):s=await N(),s!=null&&s.error)throw s.error;i.success("Changes saved successfully!"),await b()}catch(a){console.error("❌ Save error:",a);const s=((t=(e=a.response)==null?void 0:e._data)==null?void 0:t.error)||a;s.errors&&Array.isArray(s.errors)?s.errors.forEach(r=>{i.error(`${r.title}: ${r.message}`)}):i.error(s.title||"An unexpected error occurred.")}}W(()=>{var e,t;return{totalImages:o.value.length,initialImagesLength:d.value.length,serverImages:o.value.filter(a=>a.fromServer).length,newImages:o.value.filter(a=>!a.fromServer).length,hasData:!!m.value,isPending:x.value,isInitialized:u.value,dataLength:((t=(e=m.value)==null?void 0:e.data)==null?void 0:t.length)||0,uploaderKey:f.value}}),B({title:"Images partners"});const{hasPermissionVisit:E}=K(),R=L();return A(()=>{E("landing_page")||R.push("/")}),(e,t)=>{const a=U,s=M;return p(),y(Y,null,[ae,J(s,{label:"",name:"image",classCustomLabel:"text-white",required:!0},{default:Q(()=>[te,(p(),Z(a,{key:n(f),modelValue:n(o),"onUpdate:modelValue":t[0]||(t[0]=r=>D(o)?o.value=r:null),name:"image",multiple:!0,cropEnabled:!1,"initial-images":n(d),onSubmit:S,allowInputUrl:!0},null,8,["modelValue","initial-images"]))]),_:1}),l("div",se,[n(h)?(p(),y("div",re," Uploading "+C(n(o).filter(r=>!r.fromServer).length)+" images... ",1)):V("",!0),l("button",{onClick:S,type:"button",class:"btn text-white btn-primary",disabled:n(v)||n(h)||n(x)},[n(v)?(p(),y("span",ne)):V("",!0),X(" "+C(n(v)?"Saving...":n(h)?"Uploading...":"Save All Images"),1)],8,oe)])],64)}}});export{_e as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.