PageSourceSearch

https://app.pickiddo.com/assets/AdminBlogUploadView-Ge_OElFA.js

js pickiddo.com collected 2026-09-24 14:17:34 UTC 8,299 bytes, 1 lines download raw bytes

1import{_ as $,ax as I,ay as R,o as E,c as n,b as e,k as g,q as _,h as P,n as h,w as f,t as r,e as y,s as G,F as B,i as J,Z as K,H as q,bJ as O,E as W,r as d,a as i,L as Y,bK as Z,bL as Q,J as X}from"./index-BhxUyacp.js";const ee={class:"page-root"},te={class:"canvas"},se={class:"outer"},ae={class:"main"},le={class:"w-full px-4 pb-10 pt-6 lg:max-w-5xl"},oe={class:"flex items-center gap-3 mb-6"},re={class:"mb-6 rounded-2xl bg-white p-6 shadow-[0_4px_14px_rgba(15,23,42,0.07)]"},ie={class:"flex flex-col items-center gap-2"},ne={class:"text-sm font-semibold text-slate-600"},de={key:0,class:"mt-4 flex items-center justify-between rounded-xl bg-green-50 px-4 py-3"},ce={class:"flex items-center gap-3"},ue={class:"text-sm font-semibold text-green-900"},pe={class:"text-xs text-green-600"},xe=["disabled"],fe={class:"rounded-2xl bg-white p-6 shadow-[0_4px_14px_rgba(15,23,42,0.07)]"},me={key:1,class:"flex flex-col items-center py-20 text-slate-400"},be={key:2,class:"overflow-x-auto"},ve={class:"w-full"},ge={class:"px-4 py-3 text-sm text-slate-900"},he={class:"px-4 py-3 text-sm text-slate-600"},ke={class:"px-4 py-3 text-sm text-slate-600"},we={class:"px-4 py-3 text-right"},_e={class:"flex justify-end gap-2"},ye=["onClick"],Be=["onClick"],Se={__name:"AdminBlogUploadView",setup(Me){const S=q(),M=I(),{user:A}=R(M),C=[{label:"Dashboard",to:"/admin",icon:"home"},{label:"Blog Upload",to:"/admin/blog-upload",icon:"upload",active:!0}],l=d(null),u=d(!1),p=d(!1),m=d(!0),b=d([]),x=d(null),c=d({show:!1,message:"",type:"success"});function L(){x.value?.click()}function D(s){const t=s.target.files?.[0];t&&k(t)}function F(s){u.value=!1;const t=s.dataTransfer.files?.[0];t&&k(t)}function k(s){if(!s.name.endsWith(".html")){a("Hanya fail HTML sahaja dibenarkan","error");return}if(s.size>5*1024*1024){a("Saiz fail melebihi 5MB","error");return}l.value=s}async function j(){if(l.value){p.value=!0;try{const s=await Z(l.value);s.success?(a("Fail berjaya diupload!","success"),l.value=null,x.value&&(x.value.value=""),await v()):a(s.message||"Upload gagal","error")}catch(s){console.error("Upload error:",s),a(s.response?.data?.message||"Ralat upload. Sila cuba lagi.","error")}finally{p.value=!1}}}async function v(){m.value=!0;try{const s=await O();s.success&&(b.value=s.files||[])}catch(s){console.error("Load articles error:",s),a("Gagal load artikel","error")}finally{m.value=!1}}function z(s){const t=`https://www.pickiddo.com/blog/artikel/${s}`;window.open(t,"_blank")}function T(s){confirm(`Padam artikel "${s.fileName}"?`)&&N(s.fileName)}async function N(s){try{const t=await Q(s);t.success?(a("Artikel berjaya dipadam","success"),await v()):a(t.message||"Gagal padam artikel","error")}catch(t){console.error("Delete error:",t),a("Ralat delete. Sila cuba lagi.","error")}}function w(s){return s<1024?s+" B":s<1024*1024?(s/1024).toFixed(1)+" KB":(s/(1024*1024)).toFixed(1)+" MB"}function U(s){return new Date(s).toLocaleDateString("ms-MY",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function a(s,t="success"){c.value={show:!0,message:s,type:t},setTimeout(()=>{c.value.show=!1},3e3)}return E(async()=>{if(A.value?.email!=="[email protected]"){a("Access denied. Admin only.","error"),S.push("/admin");return}await v()}),(s,t)=>{const V=W("router-link");return i(),n(B,null,[e("div",ee,[e("div",te,[e("div",se,[g(Y,{links:C}),e("div",ae,[e("div",le,[e("header",oe,[g(V,{to:"/admin",class:"flex h-9 w-9 items-center justify-center rounded-full bg-white shadow-[0_4px_12px_rgba(15,23,42,0.08)] text-slate-500"},{default:_(()=>[...t[2]||(t[2]=[e("svg",{class:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e("path",{d:"M15 6l-6 6 6 6"})],-1)])]),_:1}),t[3]||(t[3]=e("div",null,[e("h1",{class:"text-xl font-bold text-slate-900"},"Blog Upload"),e("p",{class:"text-xs text-slate-400"},"Upload dan urus artikel blog HTML ke S3")],-1))]),e("div",re,[t[7]||(t[7]=P('<div class="flex items-center justify-between mb-4" data-v-5d59bba6><h2 class="text-sm font-bold text-slate-900" data-v-5d59bba6>Upload Artikel Baru</h2><div class="flex gap-2" data-v-5d59bba6>
1<a href="https://www.pickiddo.com/admin/sync-trigger.html" target="_blank" class="flex items-center gap-2 rounded-lg bg-green-100 px-4 py-2 text-xs font-semibold text-green-700 hover:bg-green-200 transition" title="Open Server A sync page (direct S3 pull)" data-v-5d59bba6><svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" data-v-5d59bba6><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" data-v-5d59bba6></path></svg> Sync dari Server A </a></div></div>',1)),e("div",{onClick:L,onDragover:t[0]||(t[0]=f(o=>u.value=!0,["prevent"])),onDragleave:t[1]||(t[1]=f(o=>u.value=!1,["prevent"])),onDrop:f(F,["prevent"]),class:h([u.value?"border-blue-500 bg-blue-50":"border-slate-300 bg-slate-50","relative cursor-pointer rounded-xl border-2 border-dashed py-12 text-center transition-colors"])},[e("div",ie,[t[4]||(t[4]=e("svg",{class:"h-12 w-12 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})],-1)),e("p",ne,r(l.value?l.value.name:"Drag & drop fail HTML di sini"),1),t[5]||(t[5]=e("p",{class:"text-xs text-slate-400"},"atau klik untuk pilih fail (Max: 5MB)",-1))]),e("input",{ref_key:"fileInput",ref:x,type:"file",accept:".html",onChange:D,class:"hidden"},null,544)],34),l.value?(i(),n("div",de,[e("div",ce,[t[6]||(t[6]=e("svg",{class:"h-5 w-5 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),e("div",null,[e("p",ue,r(l.value.name),1),e("p",pe,r(w(l.value.size)),1)])]),e("button",{onClick:f(j,["stop"]),disabled:p.value,class:"rounded-xl bg-blue-600 px-5 py-2 text-sm font-semibold text-white hover:bg-blue-700 disabled:bg-slate-300 disabled:cursor-not-allowed transition"},r(p.value?"Uploading...":"Upload Sekarang"),9,xe)])):y("",!0)]),e("div",fe,[t[10]||(t[10]=e("h2",{class:"text-sm font-bold text-slate-900 mb-4"},"Senarai Artikel",-1)),m.value?(i(),G(X,{key:0,label:"Memuatkan senarai artikel...",size:"sm"})):b.value.length===0?(i(),n("div",me,[...t[8]||(t[8]=[e("svg",{class:"h-12 w-12 mb-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.4"},[e("path",{d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1),e("p",{class:"text-sm font-medium"},"Tiada artikel dijumpai",-1)])])):(i(),n("div",be,[e("table",ve,[t[9]||(t[9]=e("thead",null,[e("tr",{class:"border-b border-slate-200"},[e("th",{class:"px-4 py-3 text-left text-xs font-semibold text-slate-600"},"Nama Fail"),e("th",{class:"px-4 py-3 text-left text-xs font-semibold text-slate-600"},"Saiz"),e("th",{class:"px-4 py-3 text-left text-xs font-semibold text-slate-600"},"Tarikh"),e("th",{class:"px-4 py-3 text-right text-xs font-semibold text-slate-600"},"Tindakan")])],-1)),e("tbody",null,[(i(!0),n(B,null,J(b.value,o=>(i(),n("tr",{key:o.fileName,class:"border-b border-slate-100 hover:bg-slate-50"},[e("td",ge,r(o.fileName),1),e("td",he,r(w(o.fileSize)),1),e("td",ke,r(U(o.lastModified)),1),e("td",we,[e("div",_e,[e("button",{onClick:H=>z(o.fileName),class:"rounded-lg bg-blue-100 px-3 py-1.5 text-xs font-semibold text-blue-700 hover:bg-blue-200 transition"}," 👁️ Lihat ",8,ye),e("button",{onClick:H=>T(o),class:"rounded-lg bg-red-100 px-3 py-1.5 text-xs font-semibold text-red-700 hover:bg-red-200 transition"}," 🗑️ Padam ",8,Be)])])]))),128))])])]))])])])])])]),g(K,{name:"fade"},{default:_(()=>[c.value.show?(i(),n("div",{key:0,class:h(["fixed bottom-6 right-6 z-50 rounded-xl bg-white px-5 py-4 shadow-2xl border",c.value.type==="success"?"border-l-4 border-l-green-500":"border-l-4 border-l-red-500"])},[e("p",{class:h(["text-sm font-semibold",c.value.type==="success"?"text-green-900":"text-red-900"])},r(c.value.message),3)],2)):y("",!0)]),_:1})],64)}}},Ce=$(Se,[["__scopeId","data-v-5d59bba6"]]);export{Ce 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.