PageSourceSearch

https://fonds.lv/build/assets/Index-eZDQpAJp.js

js fonds.lv collected 2026-10-01 12:26:58 UTC 9,744 bytes, 1 lines download raw bytes

1import{A as H}from"./AuthenticatedLayout-BgPi6SK7.js";import{i as j,Z as R,r as c,f as h,a as l,w as u,b as t,e as C,o as a,F as x,j as S,n as y,t as w,c as O,g as f,T as k}from"./app-BFBm0Bhp.js";import{P as z}from"./PrimaryButton-DQRXstZk.js";import{_ as Z,a as q,b as G,c as J}from"./EyeOutline-oziHFuqu.js";import{_ as K}from"./CheckmarkCircleOutline-5KTJuc7H.js";import{_ as Q}from"./Modal-BCYUwSCy.js";import{_ as W}from"./ArrowDownOutline-reU2X3OH.js";import{_ as X}from"./ArrowUpOutline-D4ILiFyi.js";import{_ as Y}from"./ChevronDownOutline-I8s4miqi.js";import{_ as I}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ApplicationLogo-BDZZhcqx.js";import"./NavLink-XJ1F9B8R.js";import"./TextOutline-DJTNpM16.js";import"./DocumentTextOutline-CSPECrKp.js";import"./InformationCircleOutline-B09VKpeu.js";const $={components:{ChevronDownOutline:Y,ArrowUpOutline:X,ArrowDownOutline:W,Modal:Q,EyeOutline:J,TrashOutline:G,CheckmarkCircleOutline:K,EditOutline:q,CloseCircleOutline:Z,PrimaryButton:z,AuthenticatedLayout:H,Head:R,Link:j},props:{categories:{type:Object,default:[]}},data(){return{showCategoryContent:[],orderChanged:!1,itemOrderChanged:!1,showDeleteModal:!1,deleteModal:{type:null,name:null,id:null},categoryOrderForm:k({changes:[]}),itemOrderForm:k({changes:[]})}},methods:{showCategoriesContentToggle(s){const e=this.showCategoryContent.indexOf(s);e>-1?this.showCategoryContent.splice(e,1):this.showCategoryContent.push(s)},moveCategoryUp(s){const e=this.categories[s],o=s,n=s-1;this.categories[o].order=e.order+1,this.categories[n].order=e.order-1,this.updateCategoryOrderForm(o,n),this.reorderCategoriesByOrderAsc()},moveCategoryDown(s){const e=this.categories[s],o=s,n=s+1;this.categories[o].order=e.order-1,this.categories[n].order=e.order+1,this.updateCategoryOrderForm(o,n),this.reorderCategoriesByOrderAsc()},updateCategoryOrderForm(s,e){const o=this.categories[s],n=this.categories[e];this.categoryOrderForm.changes=this.categoryOrderForm.changes.filter(i=>i.id!==o.id&&i.id!==n.id),this.categoryOrderForm.changes.push({id:o.id,order:o.order},{id:n.id,order:n.order})},reorderCategoriesByOrderAsc(){this.categories.sort((s,e)=>e.order-s.order),this.orderChanged=!0},submitCategoryChangeForm(){this.categoryOrderForm.post(route("admin.categories.order",{type:"researches"}),{preserveState:"errors"})},moveItemUp(s,e,o){if(!o)return;const n=this.categories[s].researches[e],i=e,r=e-1;this.categories[s].researches[i].pivot.order=n.pivot.order-1,this.categories[s].researches[r].pivot.order=n.pivot.order+1,this.updateItemOrderForm(s,i,r),this.reorderItemsByOrderAsc(s)},moveItemDown(s,e,o){if(!o)return;const n=this.researches[s].researches[e],i=e,r=e+1;this.categories[s].researches[i].pivot.order=n.pivot.order+1,this.categories[s].researches[r].pivot.order=n.pivot.order-1,this.updateItemOrderForm(s,i,r),this.reorderItemsByOrderAsc(s)},updateItemOrderForm(s,e,o){const n=this.categories[s],i=this.categories[s].researches[e],r=this.categories[s].researches[o];this.itemOrderForm.changes=this.itemOrderForm.changes.filter(g=>!(g.id===i.id&&g.categoryIndex===s)&&!(g.id===r.id&&g.categoryIndex===s)),this.itemOrderForm.changes.push({id:i.id,categoryIndex:s,categoryId:n.id,order:i.pivot.order},{id:r.id,categoryIndex:s,categoryId:n.id,order:r.pivot.order})},reorderItemsByOrderAsc(s){this.categories[s].researches.sort((e,o)=>e.pivot.order-o.pivot.order),this.itemOrderChanged=!0},submitItemChangeForm(){this.itemOrderForm.post(route("admin.posts.order",{type:"researches"}),{preserveState:"errors"})},openDeleteModal(s,e,o){this.deleteModal={type:s,name:e,id:o},this.showDeleteModal=!0},closeDeleteModal(){this.showDeleteModal=!1,this.deleteModal={type:null,name:null,id:null}},destroyCategory(s){k({}).delete(route("admin.categories.destroy",{category:s,type:"researches"}),{preserveState:!1})},destroy(s){k({}).delete(route("admin.researches.destroy",{research:s}),{preserveState:!1})}}},ee={class:"flex"},se={class:"flex space-x-2"},te={class:"py-12 space-y-5"},re={class:"flex"},oe={class:"bg-white overflow-hidden shadow-sm sm:rounded-lg p-4 space-y-12"},ie={class:"flex border-b-2 px-4 py-5 bg-gray-100"},le=["onClick"],ne=["onClick"],ae={class:"font-semibold"},de={class:"flex space-x-2"},ce={class:"flex space-x-1"},me=["onClick"],he={key:0},ue={class:"border-b-2"},pe={class:"col-span-2 xl:col-span-1"},_e={key:0},ge={key:1},ve={class:"col-span-2 xl:col-span-1"},Ce={key:0},fe={key:1},ye={class:"col-span-6 xl:col-span-8"},we={class:"col-span-2 text-right flex"},Oe={class:"flex space-x-2"},ke={class:"flex space-x-1"},be=["onClick"],xe={class:"flex w-full p-4 border-b-2"},De={key:1},Fe={class:"space-y-5"},Me={class:"p-4 space-y-5"},Ae={class:"text-gray-700"},Be={class:"flex space-x-4"};function Te(s,e,o,n,i,r){const g=c("Head"),b=c("PrimaryButton"),v=c("Link"),U=c("ChevronDownOutline"),D=c("ArrowUpOutline"),F=c("ArrowDownOutline"),M=c("EditOutline"),A=c("TrashOutline"),B=c("CheckmarkCircleOutline"),T=c("CloseCircleOutline"),N=c("EyeOutline"),P=c("Modal"),V=c("AuthenticatedLayout");return a(),h(x,null,[l(g,{title:"Researches"}),l(V,null,{header:u(()=>[t("div",ee,[e[4]||(e[4]=t("h2",{class:"font-semibold text-xl text-gray-800 leading-tight"},"Researches",-1)),e[5]||(e[5]=t("div",{class:"flex-grow"},null,-1)),t("div",se,[i.orderChanged?(a(),O(b,{key:0,onClick:r.submitCategoryChangeForm},{default:u(()=>[...e[2]||(e[2]=[C("Save categories order",-1)])]),_:1},8,["onClick"])):f("",!0),i.itemOrderChanged?(a(),O(b,{key:1,onClick:r.submitItemChangeForm},{default:u(()=>[...e[3]||(e[3]=[C("Save posts order",-1)])]),_:1},8,["onClick"])):f("",!0)])])]),default:u(()=>[t("div",te,[t("div",re,[e[7]||(e[7]=t("div",{class:"flex-grow"},null,-1)),l(v,{href:s.route("admin.categories.create",{type:"researches"})},{default:u(()=>[l(b,null,{default:u(()=>[...e[6]||(e[6]=[C("Add Category",-1)])]),_:1})]),_:1},8,["href"])]),t("div",oe,[o.categories.length?(a(!0),h(x,{key:0},S(o.categories,(d,p)=>{var E;return a(),h("div",null,[t("div",ie,[t("div",{class:"mr-4",onClick:m=>r.showCategoriesContentToggle(p)},[l(U,{class:y(["w-6 transition-all duration-300",{"rotate-180":i.showCategoryContent.includes(p)}])},null,8,["class"])],8,le),t("div",{class:"flex-grow",onClick:m=>r.showCategoriesContentToggle(p)}
1,[t("span",ae,w(d.name.lv),1)],8,ne),t("div",de,[t("div",ce,[p>0?(a(),O(D,{key:0,class:"w-5 cursor-pointer",onClick:m=>r.moveCategoryUp(p)},null,8,["onClick"])):f("",!0),p<o.categories.length-1?(a(),O(F,{key:1,class:"w-5 cursor-pointer",onClick:m=>r.moveCategoryDown(p)},null,8,["onClick"])):f("",!0)]),l(v,{class:"cursor-pointer my-auto",href:s.route("admin.categories.edit",{category:d.id,type:"researches"})},{default:u(()=>[l(M,{class:"w-6"})]),_:1},8,["href"]),t("div",{class:"cursor-pointer my-auto",onClick:m=>r.openDeleteModal("category",d.name.lv,d.id)},[l(A,{class:"w-6 fill-red-600 text-red-600"})],8,me)])]),t("div",null,[(E=d.researches)!=null&&E.length&&i.showCategoryContent.includes(p)?(a(),h("div",he,[e[9]||(e[9]=t("div",{class:"grid grid-cols-12 p-4 border-b-2"},[t("div",{class:"col-span-2 xl:col-span-1"},"Published"),t("div",{class:"col-span-2 xl:col-span-1"},"Announced"),t("div",{class:"col-span-6 xl:col-span-8"},"Name"),t("div",{class:"col-span-2 text-right"},"Actions")],-1)),t("div",ue,[(a(!0),h(x,null,S(d.researches,(m,_)=>(a(),h("div",{class:y(["py-2 px-4 grid grid-cols-12",{"border-b-2":d.researches.length!==_+1}])},[t("div",pe,[m.published?(a(),h("div",_e,[l(B,{class:"w-6 text-green-600"})])):(a(),h("div",ge,[l(T,{class:"w-6 text-red-600"})]))]),t("div",ve,[m.announced?(a(),h("div",Ce,[l(B,{class:"w-6 text-green-600"})])):(a(),h("div",fe,[l(T,{class:"w-6 text-red-600"})]))]),t("div",ye,w(m.name.lv),1),t("div",we,[e[8]||(e[8]=t("div",{class:"flex-grow"},null,-1)),t("div",Oe,[t("div",ke,[l(D,{class:y(["w-5",_>0?"cursor-pointer":"cursor-not-allowed text-gray-300"]),onClick:L=>r.moveItemUp(p,_,_>0)},null,8,["class","onClick"]),l(F,{class:y(["w-5",_<d.researches.length-1?"cursor-pointer":"cursor-not-allowed text-gray-300"]),onClick:L=>r.moveItemDown(p,_,_<d.researches.length-1)},null,8,["class","onClick"])]),l(v,{class:"cursor-pointer my-auto",href:s.route("admin.researches.show",{research:m.id})},{default:u(()=>[l(N,{class:"w-6"})]),_:1},8,["href"]),l(v,{class:"cursor-pointer my-auto",href:s.route("admin.researches.edit",{research:m.id})},{default:u(()=>[l(M,{class:"w-6"})]),_:1},8,["href"]),t("div",{class:"cursor-pointer my-auto",onClick:L=>r.openDeleteModal("post",m.name.lv,m.id)},[l(A,{class:"w-6 fill-red-600 text-red-600"})],8,be)])])],2))),256))])])):f("",!0),t("div",xe,[l(v,{href:s.route("admin.researches.create",{category:d.id}),class:"mx-auto"},{default:u(()=>[...e[10]||(e[10]=[C("Create research",-1)])]),_:1},8,["href"])])])])}),256)):(a(),h("div",De," No categories created "))])]),l(P,{show:i.showDeleteModal,onClose:r.closeDeleteModal},{default:u(()=>[t("div",Fe,[e[12]||(e[12]=t("div",{class:"w-full bg-gray-200 py-2 px-4"},[t("p",{class:"text-gray-700 font-bold"},"Delete confirmation")],-1)),t("div",Me,[t("h1",Ae,[C("Are you sure you want to delete "+w(i.deleteModal.type)+": ",1),t("strong",null,w(i.deleteModal.name),1)]),t("div",Be,[e[11]||(e[11]=t("div",{class:"flex-grow"},null,-1)),t("div",{class:"border border-gray-900 font-semibold text-white bg-gray-900 rounded-lg py-1 px-3 cursor-pointer",onClick:e[0]||(e[0]=(...d)=>r.closeDeleteModal&&r.closeDeleteModal(...d))},"Cancel"),t("div",{class:"border border-red-600 font-semibold text-white bg-red-600 rounded-lg py-1 px-3 cursor-pointer",onClick:e[1]||(e[1]=d=>i.deleteModal.type==="category"?r.destroyCategory(i.deleteModal.id):r.destroy(i.deleteModal.id))},"Delete")])])])]),_:1},8,["show","onClose"])]),_:1})],64)}const Ke=I($,[["render",Te]]);export{Ke 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.