PageSourceSearch

https://mbstu.ac.bd/build/assets/Index-BV9ytLt5.js

js mbstu.ac.bd collected 2026-09-24 21:23:50 UTC 9,645 bytes, 1 lines download raw bytes

1import{d as z,r as v,w as J,h as H,a as r,i as G,f as e,b as K,c as a,e as p,n as C,t as u,F as L,g as S,j as A,v as Q,k as W,m as X,u as h,l as Y,p as m}from"./app-CKAcpjBV.js";import{F as Z}from"./FileManagerModal-f1My9mV1.js";import{u as ee}from"./HeaderArea.vue_vue_type_script_setup_true_lang-D1RHVwo1.js";import{u as te}from"./useFileManager-DxDatXCE.js";import{_ as se}from"./DefaultLayout.vue_vue_type_script_setup_true_lang-CARaw083.js";/* empty css            */import"./createLucideIcon-Df3IFRix.js";import"./file-text-BLNM0-0V.js";import"./x-B7zhStCE.js";import"./search-Belar87F.js";import"./trash-2-BypubTO-.js";import"./eye-BmTjTwP1.js";import"./download-Dv48hGc0.js";import"./folder-open-BFUxBil7.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./index-BLRDgKr4.js";import"./useDefaultImages-Ci2HP7qX.js";const oe={class:"p-6"},le={key:1},re={key:0,class:"rounded-lg bg-white p-8 text-center shadow"},ae={key:1,class:"grid gap-4 md:grid-cols-2 lg:grid-cols-3"},ie={class:"mb-3 flex items-start justify-between"},ne={class:"text-lg font-semibold text-gray-900"},de=["onClick"],ue={key:0,class:"mb-3"},ce=["src","alt"],ve={class:"mb-3"},pe={class:"text-sm text-gray-600"},ge={class:"flex space-x-2"},me=["onClick"],be=["onClick"],fe={key:2},ye={class:"mb-6 flex items-center justify-between"},xe={class:"text-2xl font-bold text-gray-900"},he={class:"rounded-lg bg-white p-6 shadow"},ke={class:"space-y-6"},_e={class:"flex items-center space-x-4"},we={key:0,class:"h-24 w-24 flex-shrink-0 rounded border border-gray-300 p-2 bg-white"},Ce=["src"],Le={key:1,class:"h-24 w-24 flex-shrink-0 rounded border-2 border-dashed border-gray-300 flex items-center justify-center bg-gray-50"},Se={class:"space-y-3"},Ae={class:"flex-1 space-y-2"},Me=["value","onInput"],Fe=["value","onInput"],$e=["onClick"],je={class:"flex items-center"},Ee={class:"flex justify-end space-x-3"},Ue=["disabled"],Xe=z({__name:"Index",props:{cards:{},siteId:{}},setup(M){const _=M,{adminRoute:g}=ee(),b=v([..._.cards]),n=v("list"),t=v(null),c=v(!1),f=v(""),k=v(""),{isModalVisible:F,modalOptions:$,selectImage:j,handleFileSelect:E,closeModal:U}=te();J(()=>_.cards,o=>{b.value=[...o]},{deep:!0});const y=()=>{m.visit(g("apa-cards"),{only:["cards"],preserveState:!0,preserveScroll:!0})},i=(o,s)=>{f.value=o,k.value=s,setTimeout(()=>{f.value="",k.value=""},5e3)},I=()=>{t.value={id:0,title:"",logo:null,links:[{title:"",url:""}],sort_order:b.value.length+1,is_active:!0},n.value="form"},N=o=>{t.value=JSON.parse(JSON.stringify(o)),n.value="form"},w=()=>{t.value=null,n.value="list"},T=()=>{t.value&&t.value.links.push({title:"",url:""})},V=o=>{t.value&&t.value.links.length>1&&t.value.links.splice(o,1)},B=(o,s)=>{t.value&&(t.value.links[o].title=s)},P=(o,s)=>{t.value&&(t.value.links[o].url=s)},R=async()=>{t.value&&j(o=>{if(t.value){const s=o.url||`/file-manager/view?path=${encodeURIComponent(o.path)}`;t.value.logo=s,Y(()=>{i("Logo selected","success")})}})},D=async()=>{if(t.value){if(!t.value.title.trim()){i("Title is required","error");return}if(t.value.links=t.value.links.filter(o=>o.title.trim()&&o.url.trim()),t.value.links.length===0){i("At least one link is required","error");return}c.value=!0;try{const o={title:t.value.title,logo:t.value.logo,links:t.value.links,sort_order:t.value.sort_order,is_active:t.value.is_active};t.value.id===0?m.post(g("apa-cards"),o,{preserveScroll:!0,onSuccess:()=>{i("Card created successfully","success"),n.value="list",y()},onError:s=>{i("Failed to create card: "+(s.message||"Unknown error"),"error")},onFinish:()=>{c.value=!1}}):m.put(g(`apa-cards/${t.value.id}`),o,{preserveScroll:!0,onSuccess:()=>{i("Card updated successfully","success"),n.value="list",y()},onError:s=>{i("Failed to update card: "+(s.message||"Unknown error"),"error")},onFinish:()=>{c.value=!1}})}catch(o){i("Error: "+o.message,"error"),c.value=!1}}},O=o=>{confirm(`Are you sure you want to delete "${o.title}"?`)&&m.delete(g(`apa-cards/${o.id}`),{preserveScroll:!0,onSuccess:()=>{i("Card deleted successfully","success"),y()},onError:()=>{i("Failed to delete card","error")}})},q=o=>{const s={title:o.title,logo:o.logo,links:o.links,sort_order:o.sort_order,is_active:!o.is_active};m.put(g(`apa-cards/${o.id}`),s,{preserveScroll:!0,onSuccess:()=>{y()},onError:()=>{i("Failed to update card status","error")}})};return(o,s)=>(r(),H(se,null,{default:G(()=>[e("div",oe,[f.value?(r(),a("div",{key:0,class:C([k.value==="success"?"bg-green-100 text-green-800":"bg-red-100 text-red-800","mb-4 rounded-lg p-4"])},u(f.value),3)):p("",!0),n.value==="list"?(r(),a("div",le,[e("div",{class:"mb-6 flex items-center justify-between"},[s[4]||(s[4]=e("div",null,[e("h1",{class:"text-2xl font-bold text-gray-900"},"APA Cards"),e("p",{class:"text-sm text-gray-500"},"Manage APA cards displayed on the homepage")],-1)),e("button",{onClick:I,class:"rounded bg-primary px-4 py-2 font-medium text-white hover:bg-opacity-90"}," + Add Card ")]),b.value.length===0?(r(),a("div",re,[...s[5]||(s[5]=[e("p",{class:"text-gray-500"}
1,'No cards yet. Click "Add Card" to create one.',-1)])])):(r(),a("div",ae,[(r(!0),a(L,null,S(b.value,l=>(r(),a("div",{key:l.id,class:"rounded-lg border border-gray-200 bg-white p-4 shadow hover:shadow-md transition-shadow"},[e("div",ie,[e("h3",ne,u(l.title),1),e("button",{onClick:d=>q(l),class:C([l.is_active?"bg-green-100 text-green-800":"bg-red-100 text-red-800","rounded-full px-2 py-1 text-xs font-semibold"])},u(l.is_active?"Active":"Inactive"),11,de)]),l.logo?(r(),a("div",ue,[e("img",{src:l.logo,alt:l.title,class:"h-16 w-16 rounded object-contain"},null,8,ce)])):p("",!0),e("div",ve,[e("p",pe,u(l.links?.length||0)+" links",1)]),e("div",ge,[e("button",{onClick:d=>N(l),class:"flex-1 rounded bg-blue-500 px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-600"}," Edit ",8,me),e("button",{onClick:d=>O(l),class:"flex-1 rounded bg-red-500 px-3 py-1.5 text-sm font-medium text-white hover:bg-red-600"}," Delete ",8,be)])]))),128))]))])):p("",!0),n.value==="form"&&t.value?(r(),a("div",fe,[e("div",ye,[e("h1",xe,u(t.value.id===0?"Add New Card":"Edit Card"),1),e("button",{onClick:w,class:"rounded bg-gray-500 px-4 py-2 font-medium text-white hover:bg-gray-600"}," Cancel ")]),e("div",he,[e("div",ke,[e("div",null,[s[6]||(s[6]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700"},"Title *",-1)),A(e("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>t.value.title=l),type:"text",class:"w-full rounded border border-gray-300 px-3 py-2 focus:border-primary focus:outline-none",placeholder:"Enter card title"},null,512),[[Q,t.value.title]])]),e("div",null,[s[8]||(s[8]=e("label",{class:"mb-2 block text-sm font-medium text-gray-700"},"Logo",-1)),e("div",_e,[t.value.logo?(r(),a("div",we,[(r(),a("img",{key:t.value.logo,src:t.value.logo,alt:"Logo",class:"h-full w-full object-contain",onError:s[1]||(s[1]=l=>t.value.logo=null)},null,40,Ce))])):(r(),a("div",Le,[...s[7]||(s[7]=[e("svg",{class:"h-8 w-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})],-1)])])),e("button",{onClick:R,class:"rounded bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-200"},u(t.value.logo?"Change Logo":"Upload Logo"),1),t.value.logo?(r(),a("button",{key:2,onClick:s[2]||(s[2]=l=>t.value.logo=null),class:"rounded bg-red-100 px-4 py-2 text-sm font-medium text-red-700 hover:bg-red-200"}," Remove ")):p("",!0)])]),e("div",null,[e("div",{class:"mb-2 flex items-center justify-between"},[s[9]||(s[9]=e("label",{class:"block text-sm font-medium text-gray-700"},"Links *",-1)),e("button",{onClick:T,class:"rounded bg-green-500 px-3 py-1 text-sm font-medium text-white hover:bg-green-600"}," + Add Link ")]),e("div",Se,[(r(!0),a(L,null,S(t.value.links,(l,d)=>(r(),a("div",{key:d,class:"flex items-center space-x-2 rounded border border-gray-200 p-3"},[e("div",Ae,[e("input",{value:l.title,onInput:x=>B(d,x.target.value),type:"text",class:"w-full rounded border border-gray-300 px-3 py-2 text-sm focus:border-primary focus:outline-none",placeholder:"Link title"},null,40,Me),e("input",{value:l.url,onInput:x=>P(d,x.target.value),type:"url",class:"w-full rounded border border-gray-300 px-3 py-2 text-sm focus:border-primary focus:outline-none",placeholder:"Link URL"},null,40,Fe)]),t.value.links.length>1?(r(),a("button",{key:0,onClick:x=>V(d),class:"rounded bg-red-100 p-2 text-red-600 hover:bg-red-200"},[...s[10]||(s[10]=[e("svg",{class:"h-5 w-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])],8,$e)):p("",!0)]))),128))])]),e("div",je,[A(e("input",{"onUpdate:modelValue":s[3]||(s[3]=l=>t.value.is_active=l),type:"checkbox",id:"is_active",class:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"},null,512),[[W,t.value.is_active]]),s[11]||(s[11]=e("label",{for:"is_active",class:"ml-2 text-sm font-medium text-gray-700"},"Active",-1))]),e("div",Ee,[e("button",{onClick:w,class:"rounded bg-gray-500 px-6 py-2 font-medium text-white hover:bg-gray-600"}
1," Cancel "),e("button",{onClick:D,disabled:c.value,class:"rounded bg-primary px-6 py-2 font-medium text-white hover:bg-opacity-90 disabled:opacity-50"},u(c.value?"Saving...":t.value.id===0?"Create":"Update"),9,Ue)])])])])):p("",!0)]),K(Z,X({"is-visible":h(F)},h($),{onSelect:h(E),onClose:h(U)}),null,16,["is-visible","onSelect","onClose"])]),_:1}))}});export{Xe 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.