芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/xmintal.sdektun.com/assets/index-CsOzsVLi.js
import{W as w}from"./vuejs3-datepicker-C6wjEZix.js";import{_ as b,o,c as p,a as s,i as C,d as v,j as k,v as V,F as x,h as S,t as c,k as B,g as f,f as g,b as y,l as D,r as m,w as h}from"./index-C5D-hTCr.js";import{I}from"./InteracTable-QPmpzMbW.js";const R={components:{Datepicker:w},emits:["beforeSearch","results"],props:{url:{type:String,required:!0},filters:{type:Array,required:!0},modelValue:{type:String}},data(){return{searchkey:"",searchkey2:"",searchfield:"",searchtype:"",saving:!1,fieldname:""}},emits:["update:modelValue"],computed:{type(){return function(t){let e="text";if(this.searchfield){let i=this.filters.find(d=>d.value==this.searchfield).type;i&&(e=i)}return t==e}}},methods:{search(){this.$emit("beforeSearch"),this.saving=!0;let t=this.searchkey,e=this.searchkey2;(this.searchtype=="date"||this.searchtype=="range")&&(t=this.$date.dbformat(t,!1),e=this.$date.dbformat(e,!1));let i=this.searchfield.replace("{key}",encodeURIComponent(t)).replace("{key2}",encodeURIComponent(e)),d=this.url.indexOf("?")!=-1?this.url+"&"+i:this.url+"?"+i;this.$api.get(d).then(a=>{this.$emit("results",a.data)}).catch(a=>{this.$push.error(a.response.data[0].message)}).finally(()=>{this.saving=!1})},onChange(t){this.fieldname=this.filters.find(e=>e.value==t.target.value).label,this.searchtype=this.filters.find(e=>e.value==t.target.value).type},emitChange(t){this.$emit("update:modelValue",{type:this.searchtype,value:t})}},mounted(){for(var t in this.filters)if(this.filters[t].selected){this.searchfield=this.filters[t].value,this.fieldname=this.filters[t].label,(this.filters[t].type=="date"||this.filters[t].type=="range")&&(this.searchkey=this.searchkey2=new Date,this.searchtype=this.filters[t].type);break}this.$emit("update:modelValue",this.searchkey)}},U={class:"form-group"},M={class:"input-group"},T={class:"input-group-prepend"},q=["value"],L=["placeholder"],N={class:"input-group-append"};function A(t,e,i,d,a,l){const u=m("Datepicker"),_=m("SubmitButton");return o(),p("form",{onSubmit:e[6]||(e[6]=D((...r)=>l.search&&l.search(...r),["prevent"]))},[s("div",U,[s("label",null,[C(t.$slots,"title",{},()=>[v(" Buscar datos del cliente ")])]),s("div",M,[s("div",T,[k(s("select",{class:"form-control","onUpdate:modelValue":e[0]||(e[0]=r=>a.searchfield=r),onChange:e[1]||(e[1]=(...r)=>l.onChange&&l.onChange(...r))},[(o(!0),p(x,null,S(i.filters,(r,n)=>(o(),p("option",{key:n,value:r.value},c(r.label),9,q))),128))],544),[[V,a.searchfield]])]),l.type("text")?k((o(),p("input",{key:0,type:"text",class:"form-control","onUpdate:modelValue":e[2]||(e[2]=r=>a.searchkey=r),onInput:e[3]||(e[3]=(...r)=>l.emitChange&&l.emitChange(...r)),placeholder:"Escribe para buscar "+a.fieldname.toLowerCase()},null,40,L)),[[B,a.searchkey]]):f("",!0),l.type("range")||l.type("date")?(o(),g(u,{key:1,language:"es",modelValue:a.searchkey,"onUpdate:modelValue":e[4]||(e[4]=r=>a.searchkey=r),"wrapper-class":"calendar-light",onSelected:l.emitChange},null,8,["modelValue","onSelected"])):f("",!0),l.type("range")?(o(),g(u,{key:2,language:"es",modelValue:a.searchkey2,"onUpdate:modelValue":e[5]||(e[5]=r=>a.searchkey2=r),"wrapper-class":"calendar-light"},null,8,["modelValue"])):f("",!0),s("div",N,[y(_,{saving:a.saving,label:"Buscar"},null,8,["saving"])])])])],32)}const F=b(R,[["render",A]]),$={name:"Listlicenses",components:{InteracTable:I,SearchBox:F},data(){return{filters:[{value:"filter[mac_address]={key}",label:"Dirección MAC",selected:!0}],rows:[]}},computed:{getroute(){let t="/customerlicenses?expand=customer,currentpayment",e=this.$route.query.mac_address;return e&&(t+="&filter[mac_address]="+e),t}},methods:{onResults(t){this.rows=t}}},E={class:"row"},W={class:"col-12 grid-margin"},j={class:"card"},z={class:"card-body"},O=s("i",{class:"mdi mdi-plus btn-icon-append"},null,-1),G=s("h4",{class:"card-title page-title"},[s("span",{class:"page-title-icon bg-gradient-primary text-white me-2"},[s("i",{class:"mdi mdi-account-star"})]),v(" Listando licencias de usuarios ")],-1),H={class:"table-responsive"},J=s("th",null,"ID",-1),K=s("th",null,"Usuario",-1),P=s("th",null,"Dirección MAC",-1),Q=s("th",null,"Inicia vigencia",-1),X=s("th",null,"Finaliza vigencia",-1),Y=s("i",{class:"mdi mdi-check-circle-outline"},null,-1);function Z(t,e,i,d,a,l){const u=m("router-link"),_=m("SearchBox"),r=m("InteracTable");return o(),p("div",E,[s("div",W,[s("div",j,[s("div",z,[t.$allow("customerlicenses.create")?(o(),g(u,{key:0,to:"/customerlicenses/create",class:"btn pull-right btn-gradient-primary btn-icon-text btn-sm"},{default:h(()=>[O,v(" Registrar nueva licencia ")]),_:1})):f("",!0),G,y(_,{url:"/customerlicenses?expand=customer,currentpayment",filters:a.filters,onResults:l.onResults},null,8,["filters","onResults"]),s("div",H,[y(r,{rows:a.rows,route:l.getroute},{headers:h(()=>[J,K,P,Q,X]),row:h(n=>[s("td",null,c(n.id),1),s("td",null,c(n.customer.name),1),s("td",null,c(n.mac_address),1),s("td",null,c(n.currentpayment?t.$date.format(n.currentpayment.validity_start_date):"vencido"),1),s("td",null,c(n.currentpayment?t.$date.format(n.currentpayment.validity_end_date):"vencido"),1)]),update:h(n=>[y(u,{class:"action-link",to:"/customerlicenses/renovate/"+n.id},{default:h(()=>[Y]),_:2},1032,["to"])]),_:1},8,["rows","route"])])])])])])}const re=b($,[["render",Z]]);export{re as default};