芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/xmintal.sdektun.com/assets/renovate-DlGrzt6U.js
import{W as p}from"./vuejs3-datepicker-C6wjEZix.js";import{_ as h,c as y,a as e,t as l,d as u,l as v,b as a,f as g,g as f,e as b,r as i,o as c}from"./index-C5D-hTCr.js";const V={components:{DatePicker:p},data(){return{model:{license:{},customer:{},lastpayment:{}},payment:{validity_start_date:new Date},options:[{id:"cash",name:"Efectivo"},{id:"transfer",name:"Depósito/Transferencia"}],saving:!1,error:{},month_duration:1}},methods:{renovate(){this.payment.customer_id=this.model.customer_id,this.payment.customerlicense_id=this.model.id;let n=this.$push.promise("Renovando");this.$api.post("/payments/renovate",this.payment).then(t=>{n.resolve("Pago guardado correctamente"),this.$router.push("/customerlicenses")}).catch(t=>{n.reject("Hubo problemas al intentar renovar, verifica la información e intenta de nuevo")})},updateEndValidity(){const n=this.payment.validity_start_date,t=new Date;t.setFullYear(n.getFullYear()),t.setDate(n.getDate()),t.setHours(n.getHours()),t.setMinutes(n.getMinutes()),t.setSeconds(n.getSeconds()),t.setMonth(n.getMonth()+parseInt(this.month_duration)),this.payment.validity_end_date=t},onDataLoaded(n){this.model=n.data,this.month_duration=this.model.month_duration}},mounted(){this.updateEndValidity();let n=this.$route.params.id;this.$api.get("/customerlicenses/"+n+"?expand=customer,license,lastpayment").then(t=>{this.onDataLoaded(t)})},watch:{"payment.validity_start_date":{handler:function(n){this.updateEndValidity()},deep:!0}}},D={class:"card"},k={class:"card-body"},x=e("h4",{class:"card-title page-title"},[e("span",{class:"page-title-icon bg-gradient-primary text-white me-2"},[e("i",{class:"mdi mdi-account-star"})]),u(" Renovar licencia ")],-1),w=e("br",null,null,-1),B=e("br",null,null,-1),M=e("br",null,null,-1),S=e("img",{src:b},null,-1),E=e("br",null,null,-1),F=e("br",null,null,-1),C=e("p",null,"Datos de renovación",-1),N={class:"row"},P={class:"col-md-3"},U={class:"form-group"},H=e("label",null,"Método de pago",-1),R={class:"col-md-3"},I={class:"form-group"},L=e("label",null,"Inicio de vigencia",-1),T={class:"col-md-3"},W={class:"form-group"},Y=e("label",null,"Final de vigencia",-1),j={class:"col-md-3"},q=e("br",null,null,-1);function z(n,t,A,G,o,r){const d=i("FormControl"),m=i("DatePicker"),_=i("SubmitButton");return c(),y("div",D,[e("div",k,[x,w,B,M,e("h5",null,l(o.model.license.name),1),e("h6",null,[S,u(" "+l(o.model.customer.name),1)]),e("p",null,"Última renovación "+l(this.$date.format(o.model.lastpayment.validity_end_date)),1),E,F,C,e("form",{onSubmit:t[4]||(t[4]=v((...s)=>r.renovate&&r.renovate(...s),["prevent"]))},[e("div",N,[e("div",P,[e("div",U,[H,a(d,{type:"select",required:!0,error:o.error.payment_method,modelValue:o.payment.payment_method,"onUpdate:modelValue":t[0]||(t[0]=s=>o.payment.payment_method=s),options:o.options},null,8,["error","modelValue","options"]),o.payment.payment_method=="transfer"?(c(),g(d,{key:0,modelValue:o.payment.payment_reference,"onUpdate:modelValue":t[1]||(t[1]=s=>o.payment.payment_reference=s),type:"text"},null,8,["modelValue"])):f("",!0)])]),e("div",R,[e("div",I,[L,a(m,{modelValue:o.payment.validity_start_date,"onUpdate:modelValue":t[2]||(t[2]=s=>o.payment.validity_start_date=s),error:o.error.validity_start_date,"calendar-class":"calendar-top-right",language:"es"},null,8,["modelValue","error"])])]),e("div",T,[e("div",W,[Y,a(m,{modelValue:o.payment.validity_end_date,"onUpdate:modelValue":t[3]||(t[3]=s=>o.payment.validity_end_date=s),error:o.error.validity_end_date,"calendar-class":"calendar-top-right",language:"es",disabled:!0},null,8,["modelValue","error"])])]),e("div",j,[q,a(_,{label:"Renovar",saving:o.saving},null,8,["saving"])])])],32)])])}const O=h(V,[["render",z]]);export{O as default};