1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AlertMessage-BLBzK4iL.js","assets/index-sUPB-bMu.js","assets/index-CjsJg3P0.css","assets/AlertMessage-B_d4RM-u.css","assets/PriceField-DXA4fqvq.js","assets/SpecialGiveCard-BtIxyXQW.js","assets/SpecialGiveCard-CL0liS-x.css"])))=>i.map(i=>d[i]); 2import{_ as A,m as N,j as P,k as V,b as _,c as u,e as g,o as l,g as h,a as t,w as S,Z as G,t as a,d as D,F as R,s as M,n as v,a1 as d,ak as f,f as L,a8 as j,p as O,ai as F,a7 as U,al as b}from"./index-sUPB-bMu.js";import{m as B}from"./menuItemNameMixin-D-Sxrcvm.js";const E={subject:"ds",recurrency:"rc",frequency:"fq",parcels:"pr"},I=e=>{const s=Number(e);return Number.isInteger(s)&&s>0?s:null};function H(e={}){const s=I(e[E.subject]),n=I(e[E.frequency]),p=I(e[E.parcels]),i=String(e[E.recurrency]).toLowerCase()==="true";return!s||!n||!p||!i?null:{subjectId:s,frequencyDays:n,parcels:p}}const Y=V(()=>O(()=>import("./AlertMessage-BLBzK4iL.js"),__vite__mapDeps([0,1,2,3]))),q=V(()=>O(()=>import("./PriceField-DXA4fqvq.js"),__vite__mapDeps([4,1,2]))),X=V(()=>O(()=>import("./SpecialGiveCard-BtIxyXQW.js"),__vite__mapDeps([5,1,2,6]))),Q=()=>({motivo:0,valor:0}),z={name:"GiveSingle",components:{PriceField:q,AlertMessage:Y,SpecialGiveCard:X},mixins:[B],data(){return{recurrency:!1,inputFocusOut:!1,selectFocusOut:!1,recurrencyInterval:30,motivos:[],pendingSpecialGive:null,specialGiveApplied:!1}},computed:{...P(["appLoading","appGatewayId","giveCheckoutData","giveSubjects","churchPaymentMethods","giveGetTotalValue","churchData","giveSpecialGive"]),isSpecialGive(){return!!this.giveSpecialGive},isSpecialGivePending(){return!!this.pendingSpecialGive},hasContentLoaded(){return!!this.giveSubjects&&!!this.churchPaymentMethods},getTotalValue(){return this.motivos.reduce((s,n)=>s+n.valor,0).toFixed(2)},sortedSubjects(){return this.giveSubjects?.pagamentoMotivos?.sort((s,n)=>n.categoria.id-s.categoria.id)},hasEmptyMotive(){return!!this.motivos.filter(e=>e.motivo===0)?.length},hasEmptyValue(){return!!this.motivos.filter(e=>e.valor<=0)?.length},checkoutIsBlocked(){return this.hasEmptyMotive||this.hasEmptyValue||!this.valueIsValid},minimumValue(){const e=this.churchPaymentMethods.metodosPagamento,s=e.some(p=>p.idGatewayPagamento===this.appGatewayId.asaas),n=e.some(p=>p.idGatewayPagamento===this.appGatewayId.zoop);return s?5:n?3:e[0].valorMinimo},hasErrorMessage(){return this.inputFocusOut&&!this.valueIsValid},valueIsValid(){return this.giveGetTotalValue>=this.minimumValue},hasRecurrencyInSelectedSubject(){return this.motivos.length&&this.motivos[0].motivo!==0?this.sortedSubjects.filter(e=>e.id===this.motivos[0].motivo)[0]?.flagPermitirRecorrencia:!0},idSelected(){return this.motivos.map(({motivo:e})=>e)},allReasonSelected(){return this.motivos?.length>=this.sortedSubjects?.length},minValue(){return j(this.minimumValue,this.churchData.moeda)}},watch:{motivos:{handler(){this.hasRecurrencyInSelectedSubject||(this.recurrency=!1)},deep:!0},getTotalValue(){this.setGiveCheckoutTotalValue(parseFloat(this.getTotalValue))},sortedSubjects:{handler(){this.applySpecialGive()},immediate:!0}},created(){this.$useHead({title:this.$t("GIVE.HOME.TITLE.PAGE")}),this.setGiveSpecialGive(null),this.pendingSpecialGive=H(this.$route.query)},mounted(){if(this.loadData(),!this.isSpecialGivePending){if(this.giveCheckoutData.motivos?this.motivos=this.giveCheckoutData.motivos:this.getEmptyMotive(),this.giveCheckoutData.recorrenciaDias===0){this.recurrency=!1,this.recurrencyInterval=30;return}this.recurrency=!1,this.recurrencyInterval=this.giveCheckoutData.recorrenciaDias}},methods:{...N(["setGiveCheckoutTotalValue","setGiveCheckoutRecurrency","loadGiveSubjects","appSetLoadingState","setGiveCheckoutSubjects","churchGetPaymentMethods","setGiveCheckoutAllowRecurrency","setGiveSpecialGive","checkoutType"]),applySpecialGive(){if(!this.pendingSpecialGive||this.specialGiveApplied)return;const e=this.sortedSubjects?.find(s=>s.id===this.pendingSpecialGive.subjectId);!e||!e.flagPermitirRecorrencia||(this.specialGiveApplied=!0,this.setGiveSpecialGive({...this.pendingSpecialGive,subjectName:e.nome}),this.motivos=[{motivo:e.id,valor:0}],this.recurrency=!0,this.recurrencyInterval=this.pendingSpecialGive.frequencyDays)},clearSpecialGiveQuery(){const e={...this.$route.query};delete e.ds,delete e.rc,delete e.fq,delete e.pr,this.$router.replace({query:e}).catch(()=>{})},async loadData(){this.hasContentLoaded||this.appSetLoadingState({context:"GLOBAL",status:!0});try{await Promise.all([this.loadGiveSubjects(),this.churchGetPaymentMethods()]),(!this.giveSubjects?.pagamentoMotivos?.length||!this.churchPaymentMethods.metodosPagamento?.length)&&this.$emit("showMessage",{type:"warning",message:this.$t("GIVE.HOME.MESSAGE.ERROR.NO_GIVE")})}catch{this.$emit("showMessage",{type:"warning",message:this.$t("GIVE.HOME.MESSAGE.ERROR.GENERIC_ERROR")})}this.pendingSpecialGive&&!this.specialGiveApplied&&(this.pendingSpecialGive=null,this.getEmptyMotive(),this.clearSpecialGiveQuery()),this.appSetLoadingState({context:"GLOBAL",status:!1})},goBack(){this.$router.go(-1)},changeValue(e,s){this.motivos[s].valor=e},checkout(){if(this.checkoutIsBlocked)return;this.checkoutType("give"),this.setGiveCheckoutAllowRecurrency(this.recurrency),this.setGiveCheckoutSubjects(this.motivos);const e=this.recurrency?this.recurrencyInterval:0;this.setGiveCheckoutRecurrency(e),this.$router.push({name:"checkout"}).catch(()=>{})},getEmptyMotive(){this.motivos.push(Q()),this.recurrency=!1,this.inputFocusOut=!1,this.selectFocusOut=!1},hasErrorInput(e){const s=this.motivos[e].valor===0;return this.hasErrorMessage||s&&this.inputFocusOut},hasErrorSelect(e){return this.motivos[e].motivo===0&&this.selectFocusOut}}
2},W={key:0,class:"page-give-value"},Z={class:"page-give-value__content"},K={class:"give-options-group"},J={class:"label-input-text",for:"give-options"},$={class:"options-wrapper"},x=["onUpdate:modelValue"],ee={value:0,class:"category-option"},te=["value"],se={class:"give-value-group"},ie={class:"label-input-text",for:"give-options"},oe={class:"value-wrapper"},re=["onClick"],ae={key:0,class:"form-styled give-recurrency-form"},ne={class:"white-card__content"},ce={class:"input-item"},le={for:"recurring",class:"give-recurrency-form__subtitle"},ue={class:"give-recurrency-form__wrapper"},he={class:"field-switch__switch"},ve={class:"switch-status"},de={class:"switch-true"},pe={class:"switch-false"},me={class:"give-recurrency-form__obs"},_e={for:"frequencia",class:"input-item__label text"},ge={class:"message"},ye={class:"message__text"},Ee={class:"radio-inline-options"},Se={class:"radio-inline-options__description"},Ge={class:"radio-inline-options"},fe={class:"radio-inline-options__description"},be={class:"radio-inline-options"},Ie={class:"radio-inline-options__description"},Ve={key:2,class:"page-give-value__content__button-get"},Oe={class:"page-give-value__content__button-get__wrapper"},Ce={class:"page-give-value__content__button-next"},Re={key:0,class:"page-give-value__content__button-next__total"},Me={class:"total-label"};function Te(e,s,n,p,i,o){const T=_("PageContentHeader"),k=_("SpecialGiveCard"),y=_("SvgElement"),C=_("PriceField"),w=_("AlertMessage");return e.appLoading("GIVE_OPTIONS")?g("",!0):(l(),u("div",W,[h(T,{padded:!0},{default:S(()=>[G(a(e.menuItemName("INPCAPP_DOACOES")||e.$t("GIVE.HOME.TITLE.PAGE")),1)]),_:1}),t("div",Z,[o.isSpecialGive?(l(),D(k,{key:0,modelValue:i.motivos[0].valor,"onUpdate:modelValue":s[0]||(s[0]=c=>i.motivos[0].valor=c),"subject-name":e.giveSpecialGive.subjectName,"frequency-days":e.giveSpecialGive.frequencyDays,parcels:e.giveSpecialGive.parcels,currency:e.churchData.moeda,"has-error":o.hasErrorInput(0),onValueFocusOut:s[1]||(s[1]=c=>i.inputFocusOut=!0)},null,8,["modelValue","subject-name","frequency-days","parcels","currency","has-error"])):o.isSpecialGivePending?g("",!0):(l(!0),u(R,{key:1},M(i.motivos,(c,m)=>(l(),u("div",{key:m,class:"give-options-form"},[t("div",K,[t("label",J,a(e.$t("GIVE.HOME.TEXT.CHOOSE_METHOD")),1),t("div",$,[d(t("select",{"onUpdate:modelValue":r=>c.motivo=r,class:v(["give-options-group__select input",o.hasErrorSelect(m)?"give-value-group__input--invalid":""]),name:"give-options",onFocusout:s[2]||(s[2]=r=>i.selectFocusOut=!0)},[t("option",ee,a(e.$t("GIVE.HOME.TEXT.CHOOSE_OPTION")),1),(l(!0),u(R,null,M(o.sortedSubjects,r=>d((l(),u("option",{key:r.id,value:r.id,class:"category-option"},a(r.nome),9,te)),[[f,!o.idSelected.includes(r.id)]])),128))],42,x),[[F,c.motivo]]),h(y,{class:"arrow-down",name:"ChevronBottom",title:"ChevronBottom"})])]),t("div",se,[t("label",ie,a(e.$t("GIVE.HOME.TEXT.CHOOSE_AMOUNT")),1),t("div",oe,[t("div",{class:v(["give-value-group__input input",o.hasErrorInput(m)?"give-value-group__input--invalid":""]),onFocusout:s[3]||(s[3]=r=>i.inputFocusOut=!0)},[h(C,{"field-value":i.motivos[m].valor,onUpdateValue:r=>o.changeValue(r,m)},null,8,["field-value","onUpdateValue"])],34),d(t("button",{class:"btn-delete",onClick:r=>i.motivos.splice(m,1)},[h(y,{class:"icon-delete",name:"TrashCanThin",title:"Delete"})],8,re),[[f,i.motivos?.length>1]])])]),i.motivos?.length===1&&o.hasRecurrencyInSelectedSubject?(l(),u("div",ae,[t("div",ne,[t("div",ce,[t("label",le,a(e.$t("FORM.LABEL.RECURRENCY")),1),t("div",ue,[t("label",{class:v(["input-item__field--switch give-recurrency-form__switch",{"input-item__field--disabled":o.hasEmptyMotive}])},[d(t("input",{"onUpdate:modelValue":s[4]||(s[4]=r=>i.recurrency=r),class:"field-switch__input",type:"checkbox",name:"recurring"},null,512),[[U,i.recurrency]]),t("span",he,[t("div",ve,[t("span",de,a(e.$t("FORM.LABEL.YES")),1),t("span",pe,a(e.$t("FORM.LABEL.NO")),1)])])],2),t("div",me,[t("p",null,a(e.$t("GIVE.RECURRENCY.TEXT.OBS1")),1),t("p",null,a(e.$t("GIVE.RECURRENCY.TEXT.OBS2")),1)])])]),t("div",{class:v(["input-item give-recurrency-form__frequency",i.recurrency?"":"disabled"])},[t("label",_e,a(e.$t("FORM.LABEL.FREQUENCY_IN_DAYS")),1),t("div",ge,[t("p",ye,a(e.$t("GIVE.RECURRENCY.TEXT.INFO")),1)]),t("div",{class:v(["input-item__field--radio-inline recurring-options",i.recurrency?"":"disabled"])},[t("label",Ee,[d(t("input",{"onUpdate:modelValue":s[5]||(s[5]=r=>i.recurrencyInterval=r),type:"radio",name:"frequencia",value:"7",class:"radio-inline-options__input"},null,512),[[b,i.recurrencyInterval]]),t("p",Se,"7 "+a(e.$t("GIVE.RECURRENCY.TEXT.DAYS")),1)]),t("label",Ge,[d(t("input",{"onUpdate:modelValue":s[6]||(s[6]=r=>i.recurrencyInterval=r),type:"radio",name:"frequencia",value:"15",class:"radio-inline-options__input"},null,512),[[b,i.recurrencyInterval]]),t("p",fe,"15 "+a(e.$t("GIVE.RECURRENCY.TEXT.DAYS")),1)]),t("label",be,[d(t("input",{"onUpdate:modelValue":s[7]||(s[7]=r=>i.recurrencyInterval=r),type:"radio",name:"frequencia",value:"30",class:"radio-inline-options__input"},null,512),[[b,i.recurrencyInterval]]),t("p",Ie,"30 "+a(e.$t("GIVE.RECURRENCY.TEXT.DAYS")),1)])],2)],2)
2])])):g("",!0)]))),128)),o.isSpecialGive?g("",!0):(l(),u("div",Ve,[t("div",Oe,[t("button",{class:v(["btn btn--outline-primary",{"btn--disabled-gray":i.recurrency||o.allReasonSelected}]),onClick:s[8]||(s[8]=(...c)=>o.getEmptyMotive&&o.getEmptyMotive(...c))},[h(y,{class:"icon-circle-plus",name:"CirclePlus",title:"Plus",color:"var(--primary)"}),G(" "+a(e.$t("GIVE.HOME.BUTTON.NEW_REASON")),1)],2)])])),t("div",Ce,[d(h(w,{type:"error"},{icon:S(()=>[h(y,{name:"Alert",width:"1.25rem",height:"100%"})]),default:S(()=>[G(" "+a(e.$t("GIVE.HOME.MESSAGE.ERROR.MIN_VALUE",{minValue:o.minValue})),1)]),_:1},512),[[f,o.hasErrorMessage]]),t("div",{class:v(["page-give-value__content__button-next__wrapper",{"page-give-value__content__button-next__wrapper--single":o.isSpecialGive}])},[o.isSpecialGive?g("",!0):(l(),u("div",Re,[t("p",Me,a(e.$t("GIVE.HOME.BUTTON.TOTAL")),1),h(C,{"field-value":o.getTotalValue},null,8,["field-value"])])),t("button",{class:v(["btn btn--color-primary",{"btn--disabled-gray":o.checkoutIsBlocked}]),onClick:s[9]||(s[9]=L((...c)=>o.checkout&&o.checkout(...c),["prevent"]))},a(e.$t("GIVE.HOME.BUTTON.NEXT")),3)],2)])])]))}const Ae=A(z,[["render",Te]]);export{Ae 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.