PageSourceSearch

https://app.playmetrics.com/assets/v2/ViewPlayerTeamFees-C1LRB4xH.js

js playmetrics.com collected 2026-09-24 09:43:15 UTC 16,741 bytes, 2 lines download raw bytes

1import{_ as n,P as x,m as g,a as y,c as h,p as u,x as F,F as D,r as N,v as M,e as r,q as v,z as _,f as w,y as k,E as B}from"./vendor-BlynvCoC.js";import{N as C,a as E,ar as R,a7 as A,a8 as S,e as z,c as V,y as j,u as H,E as q}from"./main-Bs_lHNW0.js";import{_ as K}from"./config-DrDySPH_.js";import{M as U}from"./MarkPaymentFailedModal-DOgZfYye.js";import{a as Z,E as L}from"./EditPlayerFeeModal-DzHifGjF.js";import{S as Y}from"./SubscriptionStatus-DHZCy5WP.js";import{T as G}from"./TeamFeeHeader-BR2UH8Ui.js";import"./InputMoney-C-XRYxZf.js";import"./RegProgram-XyfgTMo2.js";import"./subscription-LUvTbVTs.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"c27e83a969462e61a866326f8ee6cc37a4feab4d"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="fedb8847-ef0c-40eb-9f6c-4ba2f92427d0",e._sentryDebugIdIdentifier="sentry-dbid-fedb8847-ef0c-40eb-9f6c-4ba2f92427d0")}catch(s){}})();const J={components:{BaseModal:C,EditPaymentRow:Z,MarkTransactionFailedModal:U},provide(){return{typeForField:this.typeForField,messageForField:this.messageForField,setError:this.setError,updateKey:this.updateKey}},props:{playerName:{type:String,required:!0}},emits:["dismissed"],setup(){const e=z();return{capitalize:V,toast:e}},data(){return{saving:!1,type:"",teamFeesForPlayer:null,payments:[],feesById:{},teamFeePlayersKeyed:{},initialPaymentsKeyed:{},initialRefundsKeyed:{},errors:{},reasonForFailed:"",IDsOfNewlyFailed:[]}},computed:{loading(){return this.teamFeesForPlayer===null},invalid(){return this.loading},title(){return"Manage ".concat(n.capitalize(this.type),"s for ").concat(this.playerName)},isMobile(){return this.$store.getters.isMobile},fees(){return n.compact(n.values(this.feesById))},totalPaymentAmountsKeyed(){const e={};return n.forEach(this.payments,t=>{t.status!=="Failed"&&(e[t.key]=n.get(e,t.key,0)+t.amount)}),e},initialPaymentAmountsKeyed(){return n.mapValues(this.initialPaymentsKeyed,e=>n.sumBy(e,"amount"))},initialRefundAmountsKeyed(){return n.mapValues(this.initialRefundsKeyed,e=>n.sumBy(e,"amount"))}},methods:{show(e,t){this.type=e,this.teamFeesForPlayer=n.cloneDeep(t),this.initializePayments(),this.errors={},this.$refs.modal.showModal()},dismiss(e={refreshData:!1}){this.$refs.modal.close(),this.$emit("dismissed",e)},initializePayments(){const e=[],t={},s={},i={},l={};n.forEach(this.teamFeesForPlayer,a=>{const m=this.keyForPayment(a.team_id,a.fee_id,a.team_fee_player.player_id,a.team_fee_player.id);t[a.fee_id]||(t[a.fee_id]={id:a.fee_id,name:a.name,team_id:a.team_id,player_id:a.team_fee_player.player_id,team_fee_player_id:a.team_fee_player.id}),s[m]||(s[m]=a.team_fee_player);const f={key:m,fee_id:a.fee_id};n.forEach(a.team_fee_player.transactions,c=>{const d=n.cloneDeep(c);d.amount>0?(i[m]=n.concat(n.get(i,m,[]),d),this.type==="payment"&&e.push(Object.assign({},f,d))):d.amount<0&&(l[m]=n.concat(n.get(l,m,[]),d),this.type==="refund"&&(d.amount=0-d.amount,e.push(Object.assign({},f,d))))})}),this.feesById=t,this.teamFeePlayersKeyed=s,this.initialPaymentsKeyed=i,this.initialRefundsKeyed=l,this.payments=e,n.isEmpty(this.payments)&&this.addPayment()},keyForPayment(e,t,s,i){return"".concat(e,"_").concat(t,"_").concat(s,"_").concat(i)},updateKey(e,t){const s=this.feesById[e];s&&(this.payments[t].key=this.keyForPayment(s.team_id,s.id,s.player_id,s.team_fee_player_id),this.payments[t].id=null,this.payments[t].team_fee_player_id=s.team_fee_player_id)},validate(){return this.errors={},n.each(this.payments,(e,t)=>{this.paymentHasData(e)&&this.validatePayment(e,t)}),n.isEmpty(this.errors)},paymentHasData(e){return e.paid_on!=null||!!e.fee_id||!n.isEmpty(e.payment_description)||this.isNonZero(e.amount)},validatePayment(e,t){e.paid_on==null?this.setError("paid_on",t,this.type,"Date required"):x(e.paid_on).isValid()||this.setError("paid_on",t,this.type,"Please enter valid date"),e.fee_id||this.setError("fee",t,this.type,"Fee required"),n.isEmpty(e.payment_description)&&this.setError("payment_description",t,this.type,"Method required"),this.isNonZero(e.amount)||this.setError("amount",t,this.type,"Amount required")},isNonZero(e){return n.isNil(e)||e===""?!1:parseFloat(e)>0},typeForField(e,t,s){return S(this.errors,e,null,t,s)},messageForField(e,t,s){return A(this.errors,e,null,t,s)},setError(e,t,s,i){const l=R(e,null,t,s);this.errors[l]=i},addPayment(){this.payments.push({key:null,paid_on:null,fee_id:null,payment_description:"",amount:0,status:"Paid"})},removePayment(e){this.payments.splice(e,1),this.errors={}},amountDue(e){const t=this.teamFeePlayersKeyed[e.key]?this.teamFeePlayersKeyed[e.key].amount:0,s=this.totalPaymentAmountsKeyed[e.key]||0,i=this.initialRefundAmountsKeyed[e.key]||0;return t-s-i},amountPaid(e){return this.initialPaymentAmountsKeyed[e.key]||0},updateTeamFeesForPlayer(){if(this.validate())if(this.IDsOfNewlyFailed.length){const e=this.IDsOfNewlyFailed.length>1;this.$refs.confirmMarkFailedModal.showModal({title:"Mark Payment".concat(e?"s":""," as Failed"),message:"Marking ".concat(e?"these":"a"," team fee payment").concat(e?"s":""," as failed will notify the player contact so make sure to provide them a reason why their payment").concat(e?"s":""," failed."),onConfirm:()=>this.doUpdateTeamFeesForPlayer()},"team_fee")}else this.doUpdateTeamFeesForPlayer()},doUpdateTeamFeesForPlayer(){this.saving=!0;const e=n.groupBy(this.payments,"key"),t=n.map(e,(s,i)=>{const l=i.split("_"),a="/teams/".concat(l[0],"/fees/").concat(l[1],"/players/").concat(l[2]),m=n.pick(this.teamFeePlayersKeyed[i],"id","player_id","team_fee_id","amount","due_on");
1if(this.type==="payment"){const f=n(this.payments).filter(d=>d.key===i&&this.paymentHasData(d)).map(d=>n.omit(d,["key","fee_id"])).value(),c=this.initialRefundsKeyed[i]||[];m.transactions=n.concat(f,c),this.IDsOfNewlyFailed.length&&(m.ids_of_newly_failed=this.IDsOfNewlyFailed,m.failed_reason=this.reasonForFailed)}else if(this.type==="refund"){const f=this.initialPaymentsKeyed[i]||[],c=n(this.payments).filter(d=>d.key===i&&this.paymentHasData(d)).map(d=>n.omit(n.assign({},d,{amount:0-d.amount}),["key","fee_id"])).value();m.transactions=n.concat(f,c)}return E({showError:!1}).post(a,m)});Promise.all(t).then(()=>{this.toast.success("Payment Information Updated"),this.dismiss({refreshData:!0})}).catch(s=>{this.errorMsg=E().errorToMessage(s)}).finally(()=>{this.saving=!1})},statusChanged(e,t){const s=this.payments[e];s.status!==t&&(s.status=t,t==="Failed"?this.IDsOfNewlyFailed.push(s.id):t==="Paid"&&this.IDsOfNewlyFailed.includes(s.id)&&this.IDsOfNewlyFailed.splice(this.IDsOfNewlyFailed.indexOf(s.id),1))}}},Q={key:0},W={style:{margin:"2rem 0 1rem 0"}},X=["disabled"];function $(e,t,s,i,l,a){const m=g("EditPaymentRow"),f=g("BaseModal"),c=g("MarkTransactionFailedModal");return y(),h("div",null,[u(f,{ref:"modal",title:a.title,size:"lg","allow-overflow":""},{footer:F(()=>[r("button",{class:v([{"is-loading":l.saving},"button is-primary"]),disabled:a.invalid||l.saving,onClick:t[1]||(t[1]=(...d)=>a.updateTeamFeesForPlayer&&a.updateTeamFeesForPlayer(...d))}," Save Changes ",10,X)]),default:F(()=>[a.loading?w("",!0):(y(),h("div",Q,[(y(!0),h(D,null,N(l.payments,(d,b)=>(y(),M(m,{key:"payment_".concat(b),payment:l.payments[b],"onUpdate:payment":P=>l.payments[b]=P,index:b,"payment-or-refund":l.type,"is-multi-fee":!0,fees:a.fees,"amount-due":a.amountDue,"amount-paid":a.amountPaid,onRemove:a.removePayment,onStatusChanged:a.statusChanged},null,8,["payment","onUpdate:payment","index","payment-or-refund","fees","amount-due","amount-paid","onRemove","onStatusChanged"]))),128)),r("div",W,[r("button",{class:v([{"is-fullwidth":a.isMobile},"button is-dark"]),onClick:t[0]||(t[0]=(...d)=>a.addPayment&&a.addPayment(...d))}," Add Another "+_(i.capitalize(l.type)),3)])]))]),_:1},8,["title"]),u(c,{ref:"confirmMarkFailedModal",modelValue:l.reasonForFailed,"onUpdate:modelValue":t[2]||(t[2]=d=>l.reasonForFailed=d)},null,8,["modelValue"])])}const ee=K(J,[["render",$],["__scopeId","data-v-d055a5d1"]]),te={components:{PageNavigation:j,SubscriptionStatus:Y,EditPlayerFeeModal:L,AdjustPlayerFeesModal:ee,TeamFeeHeader:G},setup(){const{formatDate:e}=H();return{currency:q,formatDate:e}},data(){return{player:null,team:null,openFeeDetails:{}}},computed:{loading(){return this.player===null||this.team===null},ctas(){return[{text:"Message Player",icon:["far","envelope"],classes:!this.isMobile&&"is-primary is-outlined"},{text:"Manage Payments",dropdown_item:!0},{text:"Manage Refunds",dropdown_item:!0}]},backButton(){return{routeNames:["TeamFees","Team"],routeFallback:"TeamFees",name:"Back"}},isMobile(){return this.$store.getters.isMobile},playerName(){return this.player&&"".concat(this.player.first_name||""," ").concat(this.player.last_name||"")},teamID(){return parseInt(this.$route.params.team,10)},teamFeesForPlayer(){const e=[];return n.each(this.player.team_players,t=>{t.team_id===this.teamID&&n.each(t.team.team_fees,s=>{s.published_at&&n.each(s.team_fee_players,i=>{if(i.player_id===this.player.id&&i.amount>0){const l=n.sumBy(i.transactions,c=>c.status!=="Failed"&&c.amount>0?c.amount:0),a=0+n.sumBy(i.transactions,c=>c.amount_rescinded||0),m=i.amount-l+a;let f=0;this.isOverdue(i.due_on)&&(f=m),e.push({name:s.name,fee_id:s.id,team_id:t.team_id,due_on:i.due_on||s.default_due_on,amount:i.amount,amount_paid:l,amount_rescinded:a,amount_due:m,amount_overdue:f,amount_total:i.amount,status:this.paymentStatus(i.due_on||s.default_due_on,m,i),team_fee_player:i})}})})}),e},totals(){const e={amount_due:0,amount_paid:0,amount_rescinded:0,amount_overdue:0,amount_total:0};return n.each(this.teamFeesForPlayer,t=>{e.amount_due+=t.amount_due,e.amount_rescinded+=t.amount_rescinded,e.amount_paid+=t.amount_paid,e.amount_overdue+=t.amount_overdue,e.amount_total+=t.amount_total}),e}},created(){this.fetchPlayer(),this.fetchTeam()},methods:{fetchPlayer(){this.player=null;const e="/players/".concat(this.$route.params.player,"?populate=team_players,team_players:team,team_players:team:fees,team_players:team:fees:team_fee_players,team_players:team:fees:team_fee_players:player,team_players:team:fees:team_fee_players:transactions");E({showError:!1}).get(e).then(t=>{this.player=t.data}).catch(t=>{this.$refs.spinner.setError(t)})},fetchTeam(){this.team=null,E({showError:!1}).getTeam(this.teamID,"team_players").then(e=>{this.team=e}).catch(e=>{this.$refs.spinner&&this.$refs.spinner.setError(e)})},cta(e){e.text==="Message Player"?this.messagePlayer():e.text==="Manage Payments"?this.openManagePayments("payment"):e.text==="Manage Refunds"&&this.openManagePayments("refund")},paymentStatus(e,t,s){return t<=0?"Paid":this.isOverdue(e)?"Overdue":this.isFailed(s)?"Failed":"Current"},isOverdue(e){const t=x().tz(this.$store.getters.clubDetails.timezone).startOf("day");return x(e).isBefore(t,"day")},isFailed(e){let t=!1;return e.transactions&&e.transactions.forEach(s=>{s.status==="Failed"&&(t=!0)}),t},messagePlayer(){this.$router.push({name:"Compose",query:{recipients:["player_".concat(this.player.id)],subject:"".concat(this.team.name," Fees.")}})},editPlayerFee(e){const t={id:e.fee_id,name:e.name,default_due_on:e.due_on};this.$refs.editPlayerFee.show(e.team_fee_player,t)},dismissModal(e={refreshData:!1}){e.refreshData&&this.fetchPlayer()},openManagePayments(e){this.$refs.adjustPlayerFees.show(e,this.teamFeesForPlayer)},toggleDetails(e){this.openFeeDetails[e.fee_id]=!this.openFeeDetails[e.fee_id]}}},ae={class:"player-team-fees"},se={class:"columns is-vcentered"},ie={class:"column is-narrow team-column"},ne={class:"view-player-fee-table"},re={key:0},oe=["onClick"],le={class:"has-text-weight-semibold is-text-size-5",style:{"padding-top":"0.5rem","padding-bottom":"0.5rem"}},de={class:"columns is-mobile"},me={class:"column is-half"},ue={class:"fee-amount"},ye={class:"column is-half"},ce={key:1,class:"fee-amount-label"},_e={class:"fee-amount"},he={class:"column is-narrow"},fe={class:"fee-amount"},pe={class:"column"},Fe={style:{display:"flex","align-items":"center",height:"20px"}},ge={class:"box-footer"},Pe={class:"columns is-mobile is-vcentered"},be={class:"column"},ve=["onClick"],ke={class:"icon"},De={key:0},Me={key:0,class:"has-text-color-warning"},we={key:1};function Ee(e,t,s,i,l,a){const m=g("spinner"),f=g("PageNavigation"),c=g("fa-icon"),d=g("TeamFeeHeader"),b=g("SubscriptionStatus"),P=g("b-table-column"),T=g("BaseTable"),I=g("EditPlayerFeeModal"),O=g("AdjustPlayerFeesModal");return y(),h("div",ae,[u(m,{ref:"spinner",loading:a.loading},null,8,["loading"]),a.loading?w("",!0):(y(),h(D,{key:0},[u(f,{ctas:a.ctas,"back-button":a.backButton,"page-title":a.isMobile?"":a.playerName,"use-mobile-title-bar":!0,onCtaClicked:a.cta},{title:F(()=>[...t[0]||(t[0]=[r("div",null,[r("h1",{class:"title__page"},"Player Fee Details")],-1)])]),_:1},8,["ctas","back-button","page-title","onCtaClicked"]),r("div",null,[r("div",se,[r("div",{class:v(["column is-narrow is-font-mont is-text-size-4",a.isMobile?"has-text-weight-bold":"has-text-weight-semibold"]),style:{padding:"0.5rem 0.75rem"}},_(a.playerName),3),r("div",ie,[r("span",{class:v(["has-text-blue-slate",a.isMobile&&"half-opacity"])},[u(c,{icon:["fas","shield"]}),t[1]||(t[1]=k(" ",-1))],2),r("span",{class:v(a.isMobile?"has-text-blue-slate-light":"has-text-black-ter")},_(l.team.name),3)])]),u(d,{team:l.team,"payment-details":a.totals},null,8,["team","payment-details"]),r("div",ne,[a.isMobile?(y(),h("div",re,[(y(!0),h(D,null,N(a.teamFeesForPlayer,o=>(y(),h("a",{key:o.fee_id,class:"box",onClick:p=>a.editPlayerFee(o)},[r("div",le,_(o.name),1),r("div",de,[o.amount_due>0?(y(),h(D,{key:0},[r("div",me,[t[2]||(t[2]=r("p",{class:"fee-amount-label"},"Due Date",-1)),r("p",ue,_(i.formatDate(o.due_on,"ll")),1)]),r("div",ye,[o.status==="Overdue"?(y(),M(b,{key:0,status:o.status,style:{height:"1.25rem"}},null,8,["status"])):(y(),h("p",ce,"Outstanding")),r("p",_e,_(i.currency(o.amount_due)),1)])],64)):(y(),h(D,{key:1},[r("div",he,[t[3]||(t[3]=r("p",{class:"fee-amount-label"},"Fee Total",-1)),r("p",fe,_(i.currency(o.amount)),1)]),r("div",pe,[r("div",Fe,[u(b,{status:o.status},null,8,["status"])])])],64))]),r("div",ge,[r("div",Pe,[r("div",be,[r("button",{class:"button is-text",style:{padding:"0 0.25rem",height:"1.5em","text-decoration":"none"},onClick:B(p=>a.toggleDetails(o),["stop"])},[r("span",ke,[u(c,{icon:["far",l.openFeeDetails[o.fee_id]?"angle-up":"angle-down"]},null,8,["icon"])]),t[4]||(t[4]=r("span",{class:"is-font-mont has-text-weight-semibold is-text-size-7"},"details",-1))],8,ve)])]),l.openFeeDetails[o.fee_id]?(y(),h("div",De,[u(T,{data:[{description:"Paid to date",amount:o.amount_paid},{description:"Refunded",amount:0-o.amount_rescinded},{description:"Outstanding",amount:o.amount_due,status:o.status}],"mobile-cards":!1,name:"viewPlayerTeamFeesMobile","show-all":""},{default:F(()=>[u(P,{label:"Description","cell-class":"is-font-fira"},{default:F(({row:p})=>[r("span",{class:v({"has-text-blue-slate has-text-weight-medium":p.amount>0&&p.description==="Refunded","has-text-danger has-text-weight-medium":p.status==="Overdue"&&p.description==="Outstanding"})}
1,_(p.description),3)]),_:1}),u(P,{label:"Amount","cell-class":"is-font-fira",numeric:""},{default:F(({row:p})=>[r("span",{class:v({"has-text-blue-slate has-text-weight-medium":p.amount>0&&p.description==="Refunded","has-text-danger has-text-weight-medium":p.status==="Overdue"&&p.description==="Outstanding"})},_(i.currency(p.amount)),3)]),_:1})]),_:1},8,["data"])])):w("",!0)])],8,oe))),128))])):(y(),M(T,{key:1,data:a.teamFeesForPlayer,"empty-message":"There are no team fees to pay at this time.","row-class":()=>"clickable",hoverable:"",name:"viewPlayerTeamFees",onSelect:a.editPlayerFee},{default:F(()=>[u(P,{label:"Fee"},{default:F(({row:o})=>[k(_(o.name),1)]),_:1}),u(P,{label:"Due Date"},{default:F(({row:o})=>[k(_(i.formatDate(o.due_on,"ll")),1)]),_:1}),u(P,{label:"Paid",numeric:""},{default:F(({row:o})=>[k(_(i.currency(o.amount_paid)),1)]),_:1}),u(P,{label:"Refunded",numeric:""},{default:F(({row:o})=>[o.amount_rescinded?(y(),h("span",Me,_(i.currency(-o.amount_rescinded)),1)):w("",!0)]),_:1}),u(P,{label:"Due",numeric:""},{default:F(({row:o})=>[k(_(i.currency(o.amount_due)),1)]),_:1}),u(P,{label:"Status",centered:""},{default:F(({row:o})=>[o.status?(y(),M(b,{key:0,status:o.status},null,8,["status"])):(y(),h("div",we,"-"))]),_:1})]),_:1},8,["data","onSelect"]))])]),u(I,{ref:"editPlayerFee",team:l.team||{},onDismissed:a.dismissModal},null,8,["team","onDismissed"]),u(O,{ref:"adjustPlayerFees","player-name":a.playerName,onDismissed:a.dismissModal},null,8,["player-name","onDismissed"])],64))])}const Se=K(te,[["render",Ee]]);export{Se as default};
2//# sourceMappingURL=ViewPlayerTeamFees-C1LRB4xH.js.map

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.