PageSourceSearch

https://fonds.lv/build/assets/Import-4V_1ilMV.js

js fonds.lv collected 2026-10-01 12:26:42 UTC 13,273 bytes, 1 lines download raw bytes

1import{f as l,b as t,e as p,t as g,l as b,v as _,F as h,j as u,g as m,o as s,m as P,n as M,r as x,c as k,w as f,d as v,a as w,T as N,x as S}from"./app-BFBm0Bhp.js";import{A as D}from"./AuthenticatedLayout-BgPi6SK7.js";import{_ as C}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 A={props:{data:Array,nonMatchingData:Array,totalCounts:{type:Object,default:()=>({patrons_count:0,payments_incomming_count:0})}},data(){return{search:"",selectedRows:[],currentPage:1,itemsPerPage:10,sortColumn:"",sortOrder:"asc",matchingColumns:[{key:"patron_name_lv",label:"Patron Name (LV)"},{key:"patron_partner_pid",label:"Patron PID"},{key:"payment_partner_name",label:"Payment Partner Name"},{key:"payment_partner_pid",label:"Payment Partner PID"},{key:"project_regid",label:"Project RegID"},{key:"reg_no",label:"Reg No"},{key:"amount",label:"Amount"}],nonMatchingSearch:"",selectedNonMatchingRows:[],nonMatchingCurrentPage:1,nonMatchingItemsPerPage:10,nonMatchingSortColumn:"",nonMatchingSortOrder:"asc",nonMatchingColumns:[{key:"payment_partner_name",label:"Payment Partner Name"},{key:"payment_partner_pid",label:"Payment Partner PID"},{key:"payment_created_at",label:"Created At"},{key:"project_regid",label:"Project RegID"},{key:"reg_no",label:"Reg No"},{key:"amount",label:"Amount"}]}},computed:{filteredData(){const o=this.data.filter(c=>c.patron_name_lv.toLowerCase().includes(this.search.toLowerCase()));this.sortColumn&&o.sort((c,d)=>{const r=c[this.sortColumn],a=d[this.sortColumn];return r<a?this.sortOrder==="asc"?-1:1:r>a?this.sortOrder==="asc"?1:-1:0});const e=(this.currentPage-1)*this.itemsPerPage;return o.slice(e,e+this.itemsPerPage)},totalPages(){return Math.ceil(this.data.filter(o=>o.patron_name_lv.toLowerCase().includes(this.search.toLowerCase())).length/this.itemsPerPage)},allSelected(){return this.data.length>0&&this.data.every(o=>this.selectedRows.includes(o.reg_no))},filteredNonMatchingData(){const o=this.nonMatchingData.filter(c=>c.payment_partner_name.toLowerCase().includes(this.nonMatchingSearch.toLowerCase()));this.nonMatchingSortColumn&&o.sort((c,d)=>{const r=c[this.nonMatchingSortColumn],a=d[this.nonMatchingSortColumn];return r<a?this.nonMatchingSortOrder==="asc"?-1:1:r>a?this.nonMatchingSortOrder==="asc"?1:-1:0});const e=(this.nonMatchingCurrentPage-1)*this.nonMatchingItemsPerPage;return o.slice(e,e+this.nonMatchingItemsPerPage)},nonMatchingTotalPages(){return Math.ceil(this.nonMatchingData.filter(o=>o.payment_partner_name.toLowerCase().includes(this.nonMatchingSearch.toLowerCase())).length/this.nonMatchingItemsPerPage)},allNonMatchingSelected(){return this.nonMatchingData.length>0&&this.nonMatchingData.every(o=>this.selectedNonMatchingRows.includes(o.reg_no))}},methods:{toggleAll(){this.allSelected?this.selectedRows=[]:this.selectedRows=this.data.map(o=>o.reg_no)},prevPage(){this.currentPage>1&&this.currentPage--},nextPage(){this.currentPage<this.totalPages&&this.currentPage++},goToPage(o){this.currentPage=o},sort(o){this.sortColumn===o?this.sortOrder=this.sortOrder==="asc"?"desc":"asc":(this.sortColumn=o,this.sortOrder="asc")},openModal(o){console.log("View item:",o)},toggleAllNonMatching(){this.allNonMatchingSelected?this.selectedNonMatchingRows=[]:this.selectedNonMatchingRows=this.nonMatchingData.map(o=>o.reg_no)},prevNonMatchingPage(){this.nonMatchingCurrentPage>1&&this.nonMatchingCurrentPage--},nextNonMatchingPage(){this.nonMatchingCurrentPage<this.nonMatchingTotalPages&&this.nonMatchingCurrentPage++},goToNonMatchingPage(o){this.nonMatchingCurrentPage=o},sortNonMatching(o){this.nonMatchingSortColumn===o?this.nonMatchingSortOrder=this.nonMatchingSortOrder==="asc"?"desc":"asc":(this.nonMatchingSortColumn=o,this.nonMatchingSortOrder="asc")},openNonMatchingModal(o){console.log("View non-matching item:",o)},openEditModal(o){console.log("Edit non-matching item:",o)},resetMatchingPage(){this.currentPage=1},resetNonMatchingPage(){this.nonMatchingCurrentPage=1},async addMatchingPayment(){var o;try{const e=await axios.post("/admin/payments/update-matching");console.log(e.data.message),this.$emit("refreshData"),window.location.reload()}catch(e){console.error("Error updating payments:",((o=e.response)==null?void 0:o.data)||e.message)}},async addNonMatchingPayment(){var o;try{const e=await axios.post("/admin/payments/update-non-matching");console.log(e.data.message),this.$emit("refreshData")}catch(e){console.error("Error updating payments:",((o=e.response)==null?void 0:o.data)||e.message)}}},watch:{search:"resetMatchingPage",nonMatchingSearch:"resetNonMatchingPage"}},O={class:"mb-4"},R={class:"text-gray-700"},T={class:"font-bold"},V={class:"text-gray-700"},I={class:"font-bold"},L={class:"mb-4"},j={class:"overflow-x-auto"},U={class:"table-auto w-full border-collapse border border-gray-300"},E={class:"bg-gray-100"},F={class:"border border-gray-300 px-4 py-2"},B=["checked"],z=["onClick"],q={key:0},G={class:"border border-gray-300 px-4 py-2"},H=["value"],J={class:"border border-gray-300 px-4 py-2"},K=["onClick"],Q={key:0},W={class:"flex justify-center items-center mt-4 space-x-2"},X=["disabled"],Y=["onClick"],Z=["disabled"],$={class:"flex justify-end mt-4"},ee={class:"mb-4"},te={class:"overflow-x-auto"},ne={class:"table-auto w-full border-collapse border border-gray-300"},oe={class:"bg-gray-100"},ae={class:"border border-gray-300 px-4 py-2"},re=["checked"],se=["onClick"],le={key:0},ie={class:"border border-gray-300 px-4 py-2"},ce=["value"],de={class:"border border-gray-300 px-4 py-2"},ge=["onClick"],he={key:0},ue={class:"flex justify-center items-center mt-4 space-x-2"},ye=["disabled"],me=["onClick"],pe=["disabled"],be={class:"flex justify-end mt-4"};function _e(o,e,c,d,r,a){return s(),l("div",null,[t("div",O,[t("p",R,[e[12]||(e[12]=p(" Total Patrons: ",-1)),t("span",T,g(c.totalCounts.patrons_count),1)]),t("p",V,[e[13]||(e[13]=p(" Total Payments Incoming: ",-1)),t("span",I,g(c.totalCounts.payments_incomming_count),1)])]),e[18]||(e[18]=t("h2",{class:"font-semibold text-xl text-gray-800 leading-tight"},"Matching Payments",-1)),t("div",L,[b(t("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=n=>r.search=n),placeholder:"Search matching payments...",class:"border border-gray-300 rounded-lg px-4 py-2 w-1/3"},null,512),[[_,r.search]])]),t("div",j,[t("table",U,[t("thead",null,[t("tr",E,[t("th",F,[t("input",{type:"checkbox",onChange:e[1]||(e[1]=(...n)=>a.toggleAll&&a.toggleAll(...n)),checked:a.allSelected},null,40,B)]),(s(!0),l(h,null,u(r.matchingColumns,n=>(s(),l("th",{key:n.key,class:"border border-gray-300 px-4 py-2 cursor-pointer",onClick:i=>a.sort(n.key)}
1,[p(g(n.label)+" ",1),r.sortColumn===n.key?(s(),l("span",q,g(r.sortOrder==="asc"?"▲":"▼"),1)):m("",!0)],8,z))),128)),e[14]||(e[14]=t("th",{class:"border border-gray-300 px-4 py-2"},"Actions",-1))])]),t("tbody",null,[(s(!0),l(h,null,u(a.filteredData,n=>(s(),l("tr",{key:n.reg_no},[t("td",G,[b(t("input",{type:"checkbox","onUpdate:modelValue":e[2]||(e[2]=i=>r.selectedRows=i),value:n.reg_no},null,8,H),[[P,r.selectedRows]])]),(s(!0),l(h,null,u(r.matchingColumns,i=>(s(),l("td",{key:i.key,class:"border border-gray-300 px-4 py-2"},g(n[i.key]),1))),128)),t("td",J,[t("button",{class:"bg-blue-500 text-white px-4 py-2 rounded",onClick:i=>a.openModal(n)},"View",8,K)])]))),128)),a.filteredData.length===0?(s(),l("tr",Q,[...e[15]||(e[15]=[t("td",{colspan:"9",class:"text-center py-4"},"No matching data available",-1)])])):m("",!0)])])]),t("div",W,[t("button",{class:"px-4 py-2 bg-gray-300 text-gray-700 rounded hover:bg-gray-400",disabled:r.currentPage===1,onClick:e[3]||(e[3]=(...n)=>a.prevPage&&a.prevPage(...n))}," Previous ",8,X),(s(!0),l(h,null,u(a.totalPages,n=>(s(),l("button",{key:n,class:M(["px-4 py-2 rounded",{"bg-blue-500 text-white":r.currentPage===n,"bg-gray-300 text-gray-700":r.currentPage!==n}]),onClick:i=>a.goToPage(n)},g(n),11,Y))),128)),t("button",{class:"px-4 py-2 bg-gray-300 text-gray-700 rounded hover:bg-gray-400",disabled:r.currentPage===a.totalPages,onClick:e[4]||(e[4]=(...n)=>a.nextPage&&a.nextPage(...n))}," Next ",8,Z)]),t("div",$,[t("button",{class:"bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600",onClick:e[5]||(e[5]=(...n)=>a.addMatchingPayment&&a.addMatchingPayment(...n))}," Add Payments ")]),e[19]||(e[19]=t("h2",{class:"font-semibold text-xl text-gray-800 leading-tight mt-5"},"Non-Matching Payments",-1)),t("div",ee,[b(t("input",{type:"text","onUpdate:modelValue":e[6]||(e[6]=n=>r.nonMatchingSearch=n),placeholder:"Search non-matching payments...",class:"border border-gray-300 rounded-lg px-4 py-2 w-1/3"},null,512),[[_,r.nonMatchingSearch]])]),t("div",te,[t("table",ne,[t("thead",null,[t("tr",oe,[t("th",ae,[t("input",{type:"checkbox",onChange:e[7]||(e[7]=(...n)=>a.toggleAllNonMatching&&a.toggleAllNonMatching(...n)),checked:a.allNonMatchingSelected},null,40,re)]),(s(!0),l(h,null,u(r.nonMatchingColumns,n=>(s(),l("th",{key:n.key,class:"border border-gray-300 px-4 py-2 cursor-pointer",onClick:i=>a.sortNonMatching(n.key)},[p(g(n.label)+" ",1),r.nonMatchingSortColumn===n.key?(s(),l("span",le,g(r.nonMatchingSortOrder==="asc"?"▲":"▼"),1)):m("",!0)],8,se))),128)),e[16]||(e[16]=t("th",{class:"border border-gray-300 px-4 py-2"},"Actions",-1))])]),t("tbody",null,[(s(!0),l(h,null,u(a.filteredNonMatchingData,n=>(s(),l("tr",{key:n.reg_no},[t("td",ie,[b(t("input",{type:"checkbox","onUpdate:modelValue":e[8]||(e[8]=i=>r.selectedNonMatchingRows=i),value:n.reg_no},null,8,ce),[[P,r.selectedNonMatchingRows]])]),(s(!0),l(h,null,u(r.nonMatchingColumns,i=>(s(),l("td",{key:i.key,class:"border border-gray-300 px-4 py-2"},g(n[i.key]),1))),128)),t("td",de,[t("button",{class:"bg-blue-500 text-white px-4 py-2 rounded",onClick:i=>a.openNonMatchingModal(n)},"View",8,ge)])]))),128)),a.filteredNonMatchingData.length===0?(s(),l("tr",he,[...e[17]||(e[17]=[t("td",{colspan:"9",class:"text-center py-4"},"No non-matching data available",-1)])])):m("",!0)])])]),t("div",ue,[t("button",{class:"px-4 py-2 bg-gray-300 text-gray-700 rounded hover:bg-gray-400",disabled:r.nonMatchingCurrentPage===1,onClick:e[9]||(e[9]=(...n)=>a.prevNonMatchingPage&&a.prevNonMatchingPage(...n))}," Previous ",8,ye),(s(!0),l(h,null,u(a.nonMatchingTotalPages,n=>(s(),l("button",{key:n,class:M(["px-4 py-2 rounded",{"bg-blue-500 text-white":r.nonMatchingCurrentPage===n,"bg-gray-300 text-gray-700":r.nonMatchingCurrentPage!==n}]),onClick:i=>a.goToNonMatchingPage(n)},g(n),11,me))),128)),t("button",{class:"px-4 py-2 bg-gray-300 text-gray-700 rounded hover:bg-gray-400",disabled:r.nonMatchingCurrentPage===a.nonMatchingTotalPages,onClick:e[10]||(e[10]=(...n)=>a.nextNonMatchingPage&&a.nextNonMatchingPage(...n))}," Next ",8,pe)]),t("div",be,[t("button",{class:"bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600",onClick:e[11]||(e[11]=(...n)=>a.addNonMatchingPayment&&a.addNonMatchingPayment(...n))}," Add new Patrons and Payments ")])])}const Pe=C(A,[["render",_e]]),Me={name:"ImportPayments",components:{AuthenticatedLayout:D,PaymentsTable:Pe},props:{data:Array,nonMatchingData:Array,totalCounts:Object},setup(){const o=N({file:null}),e=S("");return{form:o,error:e,handleFileUpload:a=>{const n=a.target.files[0];n&&n.type==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"?(o.file=n,e.value=""):(e.value="Please upload a valid Excel file (.xlsx).",o.file=null)},submit:()=>{o.post(route("admin.payments.import.process"),{onSuccess:()=>{o.reset()},onError:()=>{e.value="An error occurred while importing the file."}})},cancel:()=>{window.history.back()}}}},xe={class:"py-12 space-y-5"},fe={class:"bg-white overflow-hidden shadow-sm sm:rounded-lg p-4 space-y-12"},Ce={class:"mb-4"},ke={key:0,class:"text-red-500 text-sm mt-2"},ve={class:"flex space-x-4"},we=["disabled"],Ne={class:"py-12 space-y-5"},Se={class:"bg-white overflow-hidden shadow-sm sm:rounded-lg p-4 space-y-12"};function De(o,e,c,d,r,a){const n=x("PaymentsTable"),i=x("AuthenticatedLayout");return s(),k(i,null,{header:f(()=>[...e[3]||(e[3]=[t("h2",{class:"font-semibold text-xl text-gray-800 leading-tight"},"Import Payments",-1)])]),default:f(()=>[t("div",xe,[t("div",fe,[t("form",{onSubmit:e[2]||(e[2]=v((...y)=>d.submit&&d.submit(...y),["prevent"]))},[t("div",Ce,[e[4]||(e[4]=t("label",{for:"file",class:"block text-sm font-medium text-gray-700"},"Upload Excel File",-1)),t("input",{type:"file",id:"file",class:"mt-1 block w-full border-gray-300 rounded-md shadow-sm focus:ring-accent focus:border-accent",onChange:e[0]||(e[0]=(...y)=>d.handleFileUpload&&d.handleFileUpload(...y))},null,32),d.error?(s(),l("p",ke,g(d.error),1)):m("",!0)]),t("div",ve,[t("button",{type:"submit",class:"px-4 py-2 bg-accent text-white rounded hover:bg-accent-dark",disabled:!d.form.file}," Import ",8,we),t("button",{type:"button",class:"px-4 py-2 bg-gray-300 text-gray-700 rounded hover:bg-gray-400",onClick:e[1]||(e[1]=(...y)=>d.cancel&&d.cancel(...y))}," Cancel ")])],32)])]),t("div",Ne,[t("div",Se,[w(n,{data:c.data,nonMatchingData:c.nonMatchingData,totalCounts:c.totalCounts,onView:o.openModal},null,8,["data","nonMatchingData","totalCounts","onView"])])])]),_:1})}const Ue=C(Me,[["render",De]]);export{Ue 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.