1import{_ as T,m as n,a as i,c,p as a,x as l,v as w,e as u,f as D,y,F as j,r as K,z as b,q as Z,P as me,N as oe,aQ as ce,l as pe,I as fe,u as U,D as re,j as I,g as O,O as ie,aq as De,ap as Fe}from"./vendor-BHkM-bSa.js";import{M as Ae}from"./MobileDisabled-DkPx10Ji.js";import{ao as Se,F as Ce,a as B,c as Re,L as we,al as he,u as ne,d as _e,aD as Pe,aa as Ee,g as be,D as ue,z as ke,y as Me}from"./main-Cw9iHKnp.js";import{e as xe,F as X}from"./Form-DVNB2D_x.js";import{D as qe}from"./FormField-sDTYcx9_.js";import{F as Ie}from"./FullScreenModal-CTnBZ7cp.js";import{_ as W}from"./config-Dv5dlIha.js";import{D as Ve}from"./DateRangeFilter-CUfx9gZM.js";import{F as ve}from"./FilterTray-LFPootpj.js";import{F as Ne}from"./FormRequestForms-FP04AKHE.js";import{F as ye}from"./FormsList-BO-J2PBT.js";import{C as Be}from"./CreateEditPDPRequestModal-CcKks48d.js";import{u as Ue}from"./useClubDetails-BYJdtSHR.js";import{A as Le}from"./AdvancedTeamSelection-Dfk_jqNs.js";import{S as Oe}from"./SeasonFilter-Bf22HArs.js";import"./FormField-CqM0RT0E.js";import"./Season-BDcJ3nmK.js";import"./ProgramType-DAIhsxM3.js";import"./ResourceTag-CcP0RDjR.js";import"./ResourceVideoModal-c_B8uMUc.js";import"./VideoPlayer-yN_7QOWX.js";import"./youtube-BRKE_oGu.js";import"./WaiverModal-CJGhy9kK.js";import"./PaginationView-CTcCu6PK.js";import"./DateFormField-Bpoq9qwJ.js";import"./FilterButton-ydCnqUsE.js";import"./FormApproveReject-Cr0vjxkH.js";import"./FormsFilter-CLs6xFBf.js";import"./useTeamAges-CVWej-TI.js";import"./TeamAgeClassification-CDAKeFIj.js";import"./AgeClassifyFilter-CdoD1WvM.js";import"./GradeFilter-OeOGVVs0.js";import"./FormStatusFilter-S9yY6ntq.js";import"./GenderFilter-CTDoiqAU.js";import"./ControlColumns-CYT_8U04.js";import"./gender-BHPQOoB4.js";import"./LevelFilter-BbXD8SbL.js";import"./SearchForFilter-Cc3xFZh-.js";import"./FormStatus-DU7GF96H.js";import"./DatePicker-CAKB0oRG.js";import"./Popover-fWwOauX1.js";import"./functionUtil-B5apIq6s.js";import"./ChooseMultipleTeams-B6J0ahYY.js";import"./SelectObjectsBox-BRHQNIvC.js";import"./SelectMultipleTeams-DipxmDCb.js";import"./TeamsFilter-C2TXPsli.js";import"./RegionFilter-BYwuHZ64.js";import"./SportFilter-GfqWHtHo.js";import"./Sport-BkL0qWPI.js";import"./TeamsWithoutStaffFilter-BvurP_qu.js";import"./SelectMultipleObjects-CytWVu9B.js";import"./RegProgramParent-DlCNdVau.js";import"./RegProgram-KioWd5gB.js";import"./subscription-B3MbuVK9.js";import"./TeamAssignment-D8Rpt6cK.js";import"./AttendanceConstants-DoV9Lqy9.js";import"./MultipleSelect-DjpSljtp.js";import"./SurfaceFilter--SC3a4wc.js";import"./TimeRangeFilter-C-xklas-.js";import"./CustomDropdown-DxopZJXd.js";import"./StaffFilter-B9nzIoNG.js";import"./TeamsFilterForContext-CwzqYB5Z.js";import"./AddItemCTA-uUYZBZA0.js";import"./TableActions-CS_kBNgZ.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:"6acc28cf2ce7a8c545bce6b0f1ace425ca8881d3"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a53ace74-b9fa-41b3-b83b-0fc049b57f27",e._sentryDebugIdIdentifier="sentry-dbid-a53ace74-b9fa-41b3-b83b-0fc049b57f27")}catch(r){}})();const Qe={components:{FullScreenModal:Ie,FormModalHeader:Ce,UploadProgress:Se},props:{pandadocTemplates:{type:Array,default:()=>[]}},emits:["dismissed","refresh"],setup(){return{capitalize:Re}},data(){return{template:null,adding:!0,file:{},fileInvalid:!1,usePandadocName:!0,hasExpiration:!1}},computed:{ACTION_ARCHIVE(){return"archive"},ACTION_RESTORE(){return"restore"},ACTION_PUBLISH(){return"publish"},ACTION_SAVE(){return"save"},invalid(){return!this.template||this.adding&&!this.template.vendor_id||this.fileInvalid||this.hasExpiration&&T.isNaN(parseInt(this.template.expiration_parameters_json.num_periods,10))},isArchived(){return this.template&&this.template.status==="archived"},isPublished(){return this.template&&this.template.status==="published"},isDraft(){return this.template&&this.template.status==="draft"},title(){return this.adding?"Create Digital Document":"Edit Digital Document"},actions(){const e=[];return this.adding?[this.ACTION_SAVE,this.ACTION_PUBLISH]:(this.template&&(this.isArchived||e.push(this.ACTION_ARCHIVE),this.isArchived&&e.push(this.ACTION_RESTORE),this.isArchived||e.push(this.ACTION_PUBLISH)),e)},types(){return[{name:"Player",description:"A player document will pertain to the players on the teams selected in the Form Request. A player form will be created for each player on the teams in the Form Request. Use this type of form for player evaluations and similar requests."},{name:"Coach",description:"A coach document will pertain to the coaches selected in the Form Request. A coach document will be created for each coach in the Form Request. Use this type of form for documents that coaches need to sign."},{name:"Registration",description:"A registration document will pertain to any player for registration. A single document will be created for each player chosen by the admin or director. Use this type of document to gather registration information from a player or player contact."}]},isSuperAdmin(){return this.$store.getters.isSuperAdmin}},methods:{show(e){if(this.fileInvalid=!1,!e&&this.isSuperAdmin)this.adding=!0,this.template=this.defaultTemplate(),this.file={},this.usePandadocName=!0,this.hasExpiration=!1;else{if(this.adding=!1,this.template=T.cloneDeep(e),this.template.source_document_url){const t=this.template.source_document_url.split("/"),r=t[t.length-1];this.file={name:r,type:"application/pdf"}}this.template.expiration_parameters_json?this.hasExpiration=!0:(this.template.expiration_parameters_json=this.defaultTemplate().expiration_parameters_json,this.hasExpiration=!1),this.usePandadocName=!this.template.name}this.$refs.modal.show()}
1,dismiss(){this.$refs.modal.dismiss(),this.template=null,this.$emit("dismissed")},defaultTemplate(){return T.cloneDeep({name:"",types:["Player"],vendor_id:"",expiration_parameters_json:{num_periods:1,period:"years"}})},setTemplateName(e){if(this.usePandadocName){const t=T.find(this.pandadocTemplates,r=>r.id===e);this.template.name=t&&t.name}},isSelectedType(e){return this.template&&this.template.types&&this.template.types.includes(e.name)},handleFileUpload(){this.file=this.$refs.file.files[0],this.fileInvalid=!1,this.file&&this.file.name&&T.toLower(T.last(this.file.name.split(".")))!=="pdf"&&(this.fileInvalid=!0)},templateToPost(){return{name:this.template.name,types:this.template.types,expiration_parameters_json:this.hasExpiration?{num_periods:parseInt(this.template.expiration_parameters_json.num_periods,10),period:this.template.expiration_parameters_json.period}:null}},archiveTemplate(){const e=this.templateToPost();e.status="archived",this.postTemplate(e)},restoreTemplate(){this.postTemplate({status:"draft"},!0)},saveTemplate(){const e=this.templateToPost();e.vendor_id=this.template.vendor_id,e.status="draft",this.file&&this.file.name&&this.file.size?this.$refs.uploadProgress.uploadFileNew(this.file,{disable_toast:!0}).then(t=>{e.source_document_url=t.url,this.postTemplate(e)}):this.postTemplate(e)},publishTemplate(){const e=this.templateToPost();e.status="published",this.isSuperAdmin&&this.adding&&(e.vendor_id=this.template.vendor_id),this.file&&this.file.name&&this.file.size?this.$refs.uploadProgress.uploadFileNew(this.file,{disable_toast:!0}).then(t=>{e.source_document_url=t.url,this.postTemplate(e)}):this.postTemplate(e)},postTemplate(e,t){let r="forms/digital_documents/templates";this.adding||(r+="/".concat(this.template.id)),B().post(r,e).then(()=>{this.$emit("refresh"),t||this.dismiss()})}}},He=["disabled"],je=["disabled"],ze={key:0,class:"centered-tool"},Ye={class:"box",style:{margin:"2rem 0"}},Ge=["value"],Ze=["value"],Ke={key:1},We={class:"file has-name is-fullwidth"},Je={class:"file-label"},Xe={class:"file-cta"},$e={class:"file-icon"},et={key:0,class:"file-label"},tt={key:1,class:"file-label"},st={class:"file-name"},at={key:2,class:"help has-text-danger"},lt={class:"columns"},rt={class:"column is-narrow"},it={class:"column"},ot={class:"has-text-weight-medium"},nt={class:"is-italic has-text-grey",style:{"margin-top":".5rem"}};function mt(e,t,r,v,o,s){const f=n("FormModalHeader"),g=n("message-box"),P=n("b-input"),h=n("b-field"),C=n("b-radio"),x=n("b-select"),M=n("fa-icon"),_=n("UploadProgress"),d=n("b-checkbox"),R=n("FullScreenModal");return i(),c("div",null,[a(R,{ref:"modal"},{header:l(()=>[a(f,{title:s.title,actions:s.actions,onDismiss:s.dismiss},{[s.ACTION_ARCHIVE]:l(()=>[u("button",{class:"button is-primary is-outlined",onClick:t[0]||(t[0]=(...m)=>s.archiveTemplate&&s.archiveTemplate(...m))},[...t[13]||(t[13]=[u("span",null,"Archive",-1)])])]),[s.ACTION_RESTORE]:l(()=>[u("button",{class:"button is-primary is-outlined",onClick:t[1]||(t[1]=(...m)=>s.restoreTemplate&&s.restoreTemplate(...m))},[...t[14]||(t[14]=[u("span",null,"Restore",-1)])])]),[s.ACTION_SAVE]:l(()=>[u("button",{class:"button is-primary is-outlined",disabled:s.invalid,onClick:t[2]||(t[2]=(...m)=>s.saveTemplate&&s.saveTemplate(...m))},[...t[15]||(t[15]=[u("span",null,"Save As Draft",-1)])],8,He)]),[s.ACTION_PUBLISH]:l(()=>[u("button",{class:"button is-primary",disabled:s.invalid,onClick:t[3]||(t[3]=(...m)=>s.publishTemplate&&s.publishTemplate(...m))},[...t[16]||(t[16]=[u("span",null,"Publish",-1)])],8,je)]),_:2},1032,["title","actions","onDismiss"])]),default:l(()=>[o.template?(i(),c("div",ze,[s.isDraft?(i(),w(g,{key:0,type:"is-blue-slate",icon:{icon:["fas","question-circle"],type:"blue-slate"},"is-vcentered":!1},{message:l(()=>[...t[17]||(t[17]=[u("p",{class:"has-text-blue-slate is-font-mont has-text-weight-semibold",style:{"line-height":"20px"}}," This document is a draft ",-1),u("p",{style:{"margin-top":"0.5rem"}}," Before you can access your Digital Document in Form Builder, you need to complete the information below and publish. ",-1)])]),_:1})):D("",!0),u("div",Ye,[t[23]||(t[23]=u("h2",{class:"has-text-weight-medium is-text-size-4",style:{"margin-bottom":"1.5rem"}}," Digital Document Details ",-1)),t[24]||(t[24]=u("p",{class:"label",style:{"margin-bottom":"0.75rem"}},[y(" Document Name"),u("br"),u("span",{class:"is-italic is-small half-opacity has-text-weight-normal"}," Provide a name to help the people understand the type of Document (Ex. Financial Aid Form) ")],-1)),a(h,null,{default:l(()=>[a(P,{modelValue:o.template.name,"onUpdate:modelValue":[t[4]||(t[4]=m=>o.template.name=m),t[5]||(t[5]=m=>o.usePandadocName=!1)],disabled:s.isArchived},null,8,["modelValue","disabled"])]),_:1}),t[25]||(t[25]=u("br",null,null,-1)),t[26]||(t[26]=u("p",{class:"label",style:{"margin-bottom":"0.75rem"}},[y(" Document Expiration"),u("br"),u("span",{class:"is-italic is-small half-opacity has-text-weight-normal"}," Determine how long a completed document will remain valid for reuse in future forms ")],-1)),a(h,{style:{"align-items":"center"}},{default:l(()=>[a(C,{modelValue:o.hasExpiration,"onUpdate:modelValue":t[6]||(t[6]=m=>o.hasExpiration=m),"native-value":!1},{default:l(()=>[...t[18]||(t[18]=[y(" No expiration ",-1)])]),_:1},8,["modelValue"])]),_:1}),a(h,{style:{"align-items":"center"}},{default:l(()=>[a(C,{modelValue:o.hasExpiration,"onUpdate:modelValue":t[7]||(t[7]=m=>o.hasExpiration=m),"native-value":!0},{default:l(()=>[...t[19]||(t[19]=[y(" Completed documents valid for ",-1)])]),_:1},8,["modelValue"]),a(P,{modelValue:o.template.expiration_parameters_json.num_periods,"onUpdate:modelValue":t[8]||(t[8]=m=>o.template.expiration_parameters_json.num_periods=m),type:"number",style:{width:"50px","margin-right":"0.5rem"}},null,8,["modelValue"]),a(x,{modelValue:o.template.expiration_parameters_json.peri
1od,"onUpdate:modelValue":t[9]||(t[9]=m=>o.template.expiration_parameters_json.period=m)},{default:l(()=>[(i(),c(j,null,K(["days","months","years"],m=>u("option",{key:m,value:m},b(v.capitalize(m)),9,Ge)),64))]),_:1},8,["modelValue"])]),_:1}),t[27]||(t[27]=u("br",null,null,-1)),s.isSuperAdmin?(i(),c(j,{key:0},[o.adding?(i(),w(h,{key:0,label:"Select a Template"},{default:l(()=>[a(x,{modelValue:o.template.vendor_id,"onUpdate:modelValue":[t[10]||(t[10]=m=>o.template.vendor_id=m),s.setTemplateName],placeholder:"Select the PandaDoc Template...",expanded:""},{default:l(()=>[(i(!0),c(j,null,K(r.pandadocTemplates,m=>(i(),c("option",{key:m.id,value:m.id},b(m.name),9,Ze))),128))]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:1})):D("",!0),o.adding?(i(),c("br",Ke)):D("",!0),t[20]||(t[20]=u("p",{class:"label"}," Upload a Preview PDF ",-1)),u("div",We,[u("label",Je,[u("input",{id:"file",ref:"file",class:"file-input",type:"file",accept:".pdf",onChange:t[11]||(t[11]=m=>s.handleFileUpload())},null,544),u("span",Xe,[u("span",$e,[a(M,{icon:["fal","file"]})]),o.template.source_document_url?(i(),c("span",et," Change file⦠")):(i(),c("span",tt," Choose a file⦠"))]),u("span",st,b(o.file.name),1)])]),a(_,{ref:"uploadProgress",style:{"margin-top":"1rem"}},null,512),o.fileInvalid?(i(),c("p",at,"File must be a PDF")):D("",!0),t[21]||(t[21]=u("br",null,null,-1)),t[22]||(t[22]=u("br",null,null,-1))],64)):D("",!0),t[28]||(t[28]=u("p",{class:"label"},"Select Document Type",-1)),(i(!0),c(j,null,K(s.types,m=>(i(),c("div",{key:m.name,class:Z([{"box-selected-outlined":s.isSelectedType(m)},"box type-box"])},[u("div",lt,[u("div",rt,[a(d,{modelValue:o.template.types,"onUpdate:modelValue":t[12]||(t[12]=p=>o.template.types=p),"native-value":m.name,disabled:s.isArchived},null,8,["modelValue","native-value","disabled"])]),u("div",it,[u("p",ot,b(m.name)+" Document",1),u("p",nt,b(m.description),1)])])],2))),128))])])):D("",!0)]),_:1},512)])}const ut=W(Qe,[["render",mt],["__scopeId","data-v-067178c9"]]),dt={components:{LabelTag:we,DigitalDocumentModal:qe,AddEditDigitalDocumentTemplate:ut},props:{digitalDocumentTemplates:{type:Array,required:!0},pandadocTemplates:{type:Array,default:()=>[]}},emits:["refresh-digital-documents"],data(){return{showArchived:!1,templateToPreview:null,payments:null,totalPaid:0}},computed:{loading(){return this.payments==null},isSuperAdmin(){return this.$store.getters.isSuperAdmin},isDirector(){return this.$store.getters.isDirector},visibleTemplates(){return this.isDirector?this.digitalDocumentTemplates.filter(e=>e.status==="published"):this.showArchived?this.digitalDocumentTemplates:this.digitalDocumentTemplates.filter(e=>e.status!=="archived")},hasArchived(){return this.digitalDocumentTemplates.filter(t=>t.status==="archived").length>0},totalUsed(){return this.digitalDocumentTemplates.reduce((e,t)=>e+t.total_used,0)},totalCentsPaid(){return(this.payments||[]).reduce((e,t)=>e+t.cents,0)},totalUnpaid(){return this.totalUsed-this.totalPaid}},watch:{digitalDocumentTemplates(){this.calculateTemplateStats()},payments(){this.calculateTemplateStats()}},created(){this.calculateTemplateStats(),this.loadPayments()},methods:{calculateTemplateStats(){let e=this.totalCentsPaid,t=0;if(this.digitalDocumentTemplates&&this.digitalDocumentTemplates.length>
10&&(this.digitalDocumentTemplates.forEach(r=>{let v=0;(r.document_stats||[]).forEach(o=>{if(v+=o.num_documents||0,o.total_fee_cents<=e)t+=o.num_documents,e-=o.total_fee_cents;else{const s=o.total_fee_cents/o.num_documents,f=Math.floor(e/s);t+=f,e-=s*f}}),r.total_used=v}),e>0)){const r=this.digitalDocumentTemplates[this.digitalDocumentTemplates.length-1].fee_cents,v=Math.floor(e/r);t+=v}this.totalPaid=t},loadPayments(){this.isDirector?this.payments=[]:B().get("forms/digital_documents/payments").then(e=>{this.payments=e.data})},status(e){return e.status==="archived"?"Archived":e.status==="draft"?"Draft":"Active"},statusBackgroundClass(e){return this.isArchived(e)?"has-bg-color-ui-dark":e.status==="draft"?"has-background-blue-slate":"has-bg-color-main-success"},isArchived(e){return e.status==="archived"},previewTemplate(e){this.templateToPreview=e,this.$nextTick(()=>{this.$refs.previewModal.showModal("preview")})},editTemplate(e){this.$refs.addEditTemplate.show(e)},archiveTemplate(e){B().post("forms/digital_documents/templates/".concat(e.id),{status:"archived"}).then(()=>{this.refresh()})},restoreTemplate(e){B().post("forms/digital_documents/templates/".concat(e.id),{status:"draft"}).then(()=>{this.refresh()})},refresh(){this.$emit("refresh-digital-documents")},cta(e){e.text==="Create Digital Document"&&this.$store.getters.isSuperAdmin&&this.$refs.addEditTemplate.show()},dismissDigitalDocumentModal(e={refreshData:!1}){this.templateToPreview=null,e.refreshData&&this.refresh()},dropdownPosition(e){const t=this.$el.querySelector(".row-".concat(e.id));return t&&window.innerHeight-t.getBoundingClientRect().y<150?"is-top-left":"is-bottom-left"}}},ct={key:1},pt={class:"is-flex"},ft={class:"usage-block"},ht={class:"usage-amount"},_t={key:0,class:"usage-block"},bt={class:"usage-amount"},vt={class:"usage-label"},yt={class:"usage-amount"},Tt={class:"level",style:{width:"100%",margin:"1rem 0"}},gt={key:0,class:"level-right"},Dt={class:"has-text-blue-slate",style:{margin:"0 .2rem 0 .4rem"}},Ft={key:0,class:"has-text-blue-slate",style:{"margin-right":".5rem"}},At=["onClick"];function St(e,t,r,v,o,s){const f=n("spinner"),g=n("fa-icon"),P=n("b-switch"),h=n("b-table-column"),C=n("LabelTag"),x=n("b-button"),M=n("b-dropdown-item"),_=n("b-dropdown"),d=n("BaseTable"),R=n("AddEditDigitalDocumentTemplate"),m=n("DigitalDocumentModal");return s.loading?(i(),w(f,{key:0})):(i(),c("div",ct,[s.isDirector?D("",!0):(i(),c(j,{key:0},[t[3]||(t[3]=u("div",{class:"section-title"}," Document Usage ",-1)),u("div",pt,[u("div",ft,[t[1]||(t[1]=u("div",{class:"usage-label"},"# Used",-1)),u("div",ht,b(s.totalUsed),1)]),s.isSuperAdmin?(i(),c("div",_t,[t[2]||(t[2]=u("div",{class:"usage-label"},"# Paid",-1)),u("div",bt,b(o.totalPaid),1)])):D("",!0),s.isSuperAdmin?(i(),c("div",{key:1,class:Z(["usage-block",{negative:s.totalUnpaid>0}])},[u("div",vt,"# "+b(s.totalUnpaid>0?"Unpaid":"Remaining"),1),u("div",yt,b(Math.abs(s.totalUnpaid)),1)],2)):D("",!0)])],64)),a(d,{data:s.visibleTemplates,"row-class":p=>"row-".concat(p.id),name:"digitalDocuments","mobile-cards":"",hoverable:""},{"table-header":l(()=>[u("div",Tt,[t[5]||(t[5]=u("div",{class:"level-left section-title"}," My Documents ",-1)),!s.isDirector&&s.hasArchived?(i(),c("div",gt,[a(P,{modelValue:o.showArchived,"onUpdate:modelValue":t[0]||(t[0]=p=>o.showArchived=p)},{default:l(()=>[u("span",Dt,[a(g,{icon:["fas","archive"]})]),t[4]||(t[4]=u("span",null,"Show archived",-1))]),_:1},8,["modelValue"])])):D("",!0)])]),default:l(()=>[a(h,{label:"Document Title"},{default:l(({row:p})=>[u("span",{class:Z(s.isArchived(p)?"archived-text":"")},[s.isArchived(p)?(i(),c("span",Ft,[a(g,{icon:["fas","archive"]})])):D("",!0),y(" "+b(p.name),1)],2)]),_:1}),a(h,{label:"Form Type"},{default:l(({row:p})=>[u("span",{class:Z(s.isArchived(p)?"archived-text":"")},b(p.types.join(", ")||"-"),3)]),_:1}),a(h,{visible:!s.isDirector,label:"# Used",numeric:""},{default:l(({row:p})=>[u("span",{class:Z(s.isArchived(p)?"archived-text":"")},b(p.total_used),3)]),_:1},8,["visible"]),a(h,{visible:!s.isDirector,label:"Status",centered:""},{default:l(({row:p})=>[a(C,{"tag-text":s.status(p),class:Z("has-text-color-white ".concat(s.statusBackgroun
1dClass(p))),rounded:""},null,8,["tag-text","class"])]),_:1},8,["visible"]),a(h,{label:"Actions",centered:""},{default:l(({row:p})=>[s.isDirector?(i(),c("button",{key:0,class:"button is-text has-text-primary","aria-label":"preview",onClick:Q=>s.previewTemplate(p)},[a(g,{icon:["far","eye"]})],8,At)):(i(),w(_,{key:1,ref:"dropdown",position:s.dropdownPosition(p)},{trigger:l(()=>[a(x,{class:"is-borderless is-hollow is-medium has-text-primary","aria-label":"preview","icon-right":"ellipsis-h"})]),default:l(()=>[a(M,{onClick:Q=>s.previewTemplate(p)},{default:l(()=>[...t[6]||(t[6]=[y(" Preview ",-1)])]),_:1},8,["onClick"]),p.status!=="archived"?(i(),w(M,{key:0,onClick:Q=>s.editTemplate(p)},{default:l(()=>[...t[7]||(t[7]=[y(" Edit ",-1)])]),_:1},8,["onClick"])):D("",!0),p.status!=="archived"?(i(),w(M,{key:1,onClick:Q=>s.archiveTemplate(p)},{default:l(()=>[...t[8]||(t[8]=[y(" Archive ",-1)])]),_:1},8,["onClick"])):D("",!0),p.status==="archived"?(i(),w(M,{key:2,onClick:Q=>s.restoreTemplate(p)},{default:l(()=>[...t[9]||(t[9]=[y(" Restore ",-1)])]),_:1},8,["onClick"])):D("",!0)]),_:2},1032,["position"]))]),_:1})]),_:1},8,["data","row-class"]),a(R,{ref:"addEditTemplate","pandadoc-templates":r.pandadocTemplates,onRefresh:s.refresh},null,8,["pandadoc-templates","onRefresh"]),o.templateToPreview?(i(),w(m,{key:1,ref:"previewModal",title:o.templateToPreview.name,"preview-url":o.templateToPreview.source_document_url,"show-live-option":!0,"template-id":o.templateToPreview.id,onDismissed:s.dismissDigitalDocumentModal},null,8,["title","preview-url","template-id","onDismissed"])):D("",!0)]))}const Ct=W(dt,[["render",St],["__scopeId","data-v-ff6d2434"]]),de={onlyMyRequests:!1,dateRange:{start_date:null,end_date:null},types:[],statuses:[],template:null,showArchived:!1},Rt={components:{FilterTray:ve,FilterSection:he,DateRangeFilter:Ve},props:{formRequests:{type:Array,required:!0},searchQuery:{type:String,required:!0},isCurrent:{type:Boolean,required:!0}},emits:["getRequests","filtered","filterActive"],setup(){const{formatDate:e}=ne();return{formatDate:e}},data(){return{clubFormTemplates:[],filters:T.cloneDeep(this.$store.getters.tableFiltersFor("form_requests")||de)}},computed:{allTypes(){return["Player","Coach","Team","Club"]},allStatuses(){return["Draft","Processing","Completed","Overdue","Sent","Closed"]},myUserId(){return this.$store.getters.user.id},filtered(){return this.formRequests.filter(e=>e&&this.requestCurrent(e)===this.isCurrent&&(T.isEmpty(this.searchQuery)||T.toLower(e.title).includes(T.toLower(this.searchQuery))||T.toLower(e.form_template_name).includes(T.toLower(this.searchQuery)))&&(!this.typeFilterActive||T.includes(this.filters.types,e.form_template_context_type))&&(!this.statusFilterActive||T.includes(this.filters.statuses,e.status))&&(!this.templateFilterActive||this.filters.template===e.form_template_id)&&(!this.filters.onlyMyRequests||e.created_by_user_id===this.myUserId)&&(T.isNil(this.filters.dateRange.start_date)||me(this.formatDate(e.due_date,"YYYY-MM-DD HH:mm")).isSameOrAfter(this.filters.dateRange.start_date,"day"))&&(T.isNil(this.filters.dateRange.end_date)||me(this.formatDate(e.due_date,"YYYY-MM-DD HH:mm")).isSameOrBefore(this.filters.dateRange.end_date,"day"))&&(this.filters.showArchived||!e.archived_at))},filterActive(){return this.dateFilterActive||this.typeFilterActive||this.statusFilterActive||this.templateFilterActive||this.filters.onlyMyRequests||this.filters.showArchived},dateFilterActive(){return!T.isNil(this.filters.dateRange.start_date)||!T.isNil(this.filters.dateRange.end_date)},typeFilterActive(){return!T.isEmpty(this.filters.types)},statusFilterActive(){return!T.isEmpty(this.filters.statuses)},templateFilterActive(){return!!this.filters.template},advancedFiltersActive(){return this.filters.showArchived}},watch:{filters:{deep:!0,handler(){this.filterChanged()}},filtered(){this.changed()}},created(){this.loadFormTemplates(),this.changed()},methods:{loadFormTemplates(){B().get("/forms/templates").then(e=>{this.clubFormTemplates=e.data||[]})},changed(){this.$emit("filtered",this.filtered),this.$emit("filterActive",this.filterActive)},clearFilters(){this.filters=T.cloneDeep(de)},filterChanged(){this.$store.commit("setTableDataFor",{name:"form_requests",filters:T.cloneDeep(this.filters)}),this.changed()},requestCurrent(e){return e.status!=="Completed"&&e.status!=="Closed"},closeDatepickers(e){this.$refs.dateRangeFilter&&this.$refs.dateRangeFilter.closeDatepickers(e)}}},wt=["value"],Pt={class:"control"};function Et(e,t,r,v,o,s){const f=n("b-switch"),g=n("b-field"),P=n("FilterSection"),h=n("DateRangeFilter"),C=n("b-checkbox"),x=n("b-select"),M=n("b-button"),_=n("FilterTray");return i(),w(_,{title:"Filter Requests","filters-active":s.filterActive,onClearFilters:s.clearFilters,onClick:s.closeDatepickers},{content:l(()=>[a(P,null,{default:l(()=>[a(g,null,{default:l(()=>[a(f,{modelValue:o.filters.onlyMyRequests,"onUpdate:modelValue":t[0]||(t[0]=d=>o.filters.onlyMyRequests=d),style:{padding:"0.5rem 0 0 0"}},{default:l(()=>[...t[8]||(t[8]=[y(" My Form Requests ",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1}),a(h,{ref:"dateRangeFilter",modelValue:o.filters.dateRange,"onUpdate:modelValue":t[1]||(t[1]=d=>o.filters.dateRange=d),title:"Due Date Range"},null,8,["modelValue"]),a(P,{collapsible:!0,"default-open":!0,"filter-active":s.typeFilterActive,label:"Type of Request"},{default:l(()=>[a(g,null,{default:l(()=>[u("div",null,[(i(!0),c(j,null,K(s.allTypes,d=>(i(),c("div",{key:d,style:{"margin-bottom":"0.75rem"}},[a(C,{modelValue:o.filters.types,"onUpdate:modelValue":t[2]||(t[2]=R=>o.filters.types=R),"native-value":d},{default:l(()=>[y(b(d),1)]),_:2},1032,["modelValue","native-value"])]))),128))])]),_:1})]),_:1},8,["filter-active"]),a(P,{collapsible:!0,"default-open":!0,"filter-active":s.statusFilterActive,label:"Request Status"},{default:l(()=>[a(g,null,{default:l(()=>[u("div",null,[(i(!0),c(j,null,K(s.allStatuses,d=>(i(),c("div",{key:d,style:{"margin-bottom":"0.75rem"}},[a(C,{modelValue:o.filters.statuses,"onUpdate:modelValue":t[3]||(t[3]=R=>o.filters.statuses=R),"native-value":d},{default:l(()=>[y(b(d),1)]),_:2},1032,["modelValue","native-value"])]))),128))])]),_:1})]),_:1},8,["filter-active"]),a(P,{collapsible:!0,"default-open":!0,"filter-active":s.templateFilterActive,label:"Filter by Template"},{default:l(()=>[a(g,null,{default:l(()=>[a(x,{modelValue:o.filters.template,"onUpdate:modelValue":t[4]||(t[4]=d=>o.filters.template=d),placeholder:"Select Template",expanded:""},{default:l(()=>[(i(!0),c(j,null,K(o.clubFormTemplates,d=>(i(),c("option",{key:d.id,value:d.id},b(d.name),9,wt))),128))]),_:1},8,["modelValue"]),u("p",Pt,[a(M,{"aria-label":"Clear Template Filter","icon-right":"times",onClick:t[5]||(t[5]=d=>o.filters.template=null)})])]),_:1})]),_:1},8,["filter-active"]),a(P,{collapsible:!0,"filter-active":s.advancedFiltersActive,label:"Advanced"},{default:l(()=>[a(g,null,{default:l(()=>[a(f,{modelValue:o.filters.showArchived,"onUpdate:modelValue":[t[6]||(t[6]=d=>
1o.filters.showArchived=d),t[7]||(t[7]=d=>e.$emit("getRequests"))]},{default:l(()=>[...t[9]||(t[9]=[y(" Include Archived Form Requests ",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["filter-active"])]),_:1},8,["filters-active","onClearFilters","onClick"])}const kt=W(Rt,[["render",Et]]),Mt={key:1},xt=["onClick"],qt={__name:"FormRequests",setup(e,{expose:t}){const r=oe(),v=ce(),{formatDate:o}=ne(),{isMobile:s}=pe(_e()),f=O(null),g=O(0),P=O(""),h=O(!1),C=O([]),x=O(!1),M=O(null),_=I(()=>f.value&&f.value.length>0),d=I(()=>f.value.length>0&&C.value.length===0),R=I(()=>s.value&&d.value||!d.value),m=I(()=>f.value==null),p=I(()=>g.value===0),Q=I(()=>g.value===1),ae=I(()=>[{id:0,name:"Open"},{id:1,name:"Closed"}]);function A(){var F;P.value="",r.commit("setTableDataFor",{name:"formRequests",search:""}),h.value=!1,(F=M.value)==null||F.clearFilters()}function E(F){const V=F?F.id:"new";if(F&&F.status==="Draft"&&F.request_context&&F.request_context.startsWith("FieldPlan_")){const G=F.request_context.split("_")[1];v.push({name:"CreateEditPracticePreferences",params:{plan:G}});return}v.push({name:"AddEditFormRequest",params:{request:V}})}function H(F){return F.status==="Draft"?E(F):v.push({name:"ViewFormRequest",params:{request:F.id}})}function z(F,V,G){return F.due_date<V.due_date===G?-1:1}function $(F){F==="Create a Request"&&E(null)}t({cta:$});function J(F,V){return F.status==="Draft"?"-":F[V]}function Y(F,V){return F.status==="Draft"?-1:V}function ee(F){f.value=null;const V={include_canceled:!0},G=F||r.getters.tableFiltersFor("form_requests")&&r.getters.tableFiltersFor("form_requests").showArchived;G&&(V.include_archived=G),B().get("/forms/requests?data=".concat(JSON.stringify(V),"&populate=form_template,form_stats,form_stats:all,prune")).then(L=>{const se=L.data;se.forEach(k=>{k.num_pending=Y(k,k.num_pending+k.num_rejected),k.num_submitted=Y(k,k.num_submitted),k.num_approved=Y(k,k.num_approved),k.due_date_formatted=o(k.due_date,"l LT"),k.num_pending_formatted=J(k,"num_pending"),k.num_submitted_formatted=J(k,"num_submitted"),k.num_approved_formatted=J(k,"num_approved"),k.num_canceled_formatted=J(k,"num_canceled")}),x.value=G,f.value=se})}function N(){x.value||ee(!0)}function te(F){return F.status==="Sent"?"has-background-warning":F.status==="Completed"?"is-success":F.status==="Overdue"?"is-danger":"has-background-grey"}return ee(),(F,V)=>{const G=n("spinner"),L=n("b-table-column"),se=n("b-tag"),k=n("fa-icon"),Te=n("EmptyStateComponent"),ge=n("BaseTable");return i(),c("div",null,[m.value?(i(),w(G,{key:0})):(i(),c("div",Mt,[a(ge,{data:C.value,"row-class":(function(){return"clickable"}),filterable:_.value,searchable:_.value,"filters-active":h.value,name:"formRequests",hoverable:"","mobile-cards":"","show-empty-state-in-table":!U(s)&&d.value,"use-empty-search":!U(s)&&d.value,onClearSearchAndFilters:A,onQueryUpdated:V[1]||(V[1]=S=>P.value=S),onSelect:H},fe({"header-left":l(()=>[a(Ee,{"active-tab":g.value,"onUpdate:activeTab":V[0]||(V[0]=S=>g.value=S),tabs:ae.value},null,8,["active-tab","tabs"])]),default:l(()=>[a(L,{field:"title",label:"Title",sortable:!U(s)},{default:l(({row:S})=>[y(b(S.title),1)]),_:1},8,["sortable"]),a(L,{field:"form_template_context_type",label:"Type",sortable:!U(s)},{default:l(({row:S})=>[y(b(S.form_template_context_type),1)]),_:1},8,["sortable"]),a(L,{field:"form_template_name",label:"Template",sortable:!U(s)},{default:l(({row:S})=>[y(b(S.form_template_name),1)]),_:1},8,["sortable"]),a(L,{field:"due_date_formatted",label:"Due Date",sortable:!U(s),"custom-sort":z},{default:l(({row:S})=>[y(b(S.due_date_formatted),1)]),_:1},8,["sortable"]),a(L,{visible:p.value,field:"num_pending_formatted",label:"Pending",numeric:"",sortable:!U(s)},{default:l(({row:S})=>[y(b(S.num_pending_formatted),1)]),_:1},8,["visible","sortable"]),a(L,{visible:p.value,field:"num_submitted_formatted",label:"Submitted",numeric:"",sortable:!U(s)},{default:l(({row:S})=>[y(b(S.num_submitted_formatted),1)]),_:1},8,["visible","sortable"]),a(L,{field:"num_approved_formatted",label:"Completed",numeric:"",sortable:!U(s)},{default:l(({row:S})=>[y(b(S.num_approved_formatted),1)]),_:1},8,["sortable"]),a(L,{visible:Q.value,field:"num_canceled_formatted",label:"Canceled",numeric:"",sortable:!U(s)},{default:l(({row:S})=>[y(b(S.num_canceled_formatted),1)]),_:1},8,["visible","sortable"]),a(L,{visible:p.value,field:"status",label:"Status",centered:""},{default:l(({row:S})=>[a(se,{class:Z([te(S),"form-request-status"]),rounded:""},{default:l(()=>[y(b(S.status),1)]),_:2},1032,["class"])]),_:1},8,["visible"]),a(L,{visible:p.value,field:"actions","custom-key":"actions",centered:""},{default:l(({row:S})=>[S.status==="Draft"?(i(),c("a",{key:0,class:"has-text-primary clickable",style:{"padding-right":"1rem"},"aria-label":"edit request",onClick:re(ps=>E(S),["stop"])},[a(k,{icon:["far","pencil"]})],8,xt)):D("",!0)]),_:1},8,["visible"])]),_:2},[R.value?{name:"empty",fn:l(()=>[U(s)&&d.value?(i(),w(Pe,{key:0,filterable:_.value,onClearSearchAndFilters:A},null,8,["filterable"])):(i(),w(Te,{key:1,header:"No ".concat(p.value?"Open":"Closed"," Form Requests Found"),body:f.value.length===0?"There are no ".concat(p.value?"open":"closed"," form requests."):"No form requests match the current search criteria.","img-src":"/static/images/icons/form-requests-empty-icon.svg",class:"mt-5"},null,8,["header","body"]))]),key:"0"}:void 0]),1032,["data","filterable","searchable","filters-active","show-empty-state-in-table","use-empty-search"]),a(kt,{ref_key:"formRequestsFilter",ref:M,"form-requests":f.value,"search-query":P.value,"is-current":p.value,onFilterActive:V[2]||(V[2]=S=>h.value=S),onFiltered:V[3]||(V[3]=S=>C.value=S),onGetRequests:N},null,8,["form-requests","search-query","is-current"])]))])}}},It={setup(){const e="formTemplates",t=be();return{TABLE_NAME:e,modulesStore:t}},data(){return{formTemplates:null,viewMyTemplates:this.$store.getters.tableDataFor("forms").onlyMyTemplates,searchQuery:"",user:null,potentialOwners:null}},computed:{searchable(){var e,t;return((t=(e=this.formTemplates)==null?void 0:e.length)!=null?t:0)>0},formsDirectorsCanAdminTemplates(){return this.modulesStore.directorsCanAdminFormTemplates},ownerOrCreatedBy(){return this.isDirector&&!this.formsDirectorsCanAdminTemplates?"Created By":"Owner"},isDirector(){return this.$store.getters.isDirector},loading(){return this.formTemplates==null},filteredData(){let e=this.formTemplates;return this.searchQuery.length!==0&&(e=this.formTemplates.filter(t=>t.name.toLowerCase().includes(this.searchQuery.toLowerCase())||t.context_type.toLowerCase().includes(this.searchQuery.toLowerCase()))),this.viewMyTemplates?(e||[]).filter(t=>t.owner.user_id===this.$store.getters.user.id):e},useEmptySearch(){return this.formTemplates.length>0&&this.filteredData.length===0}},created(){this.fetchTemplates(),this.user=this.$store.getters.user,this.loadPotentialOwners()},methods:{loadPotentialOwners(){B().get("/club_admin/club/directors").then(e=>{B().get("/club_admin/club/admin_users").then(t=>{const r=[];this.potentialOwners=T.sortBy(T.uniqBy(r.concat(e.data.concat(t.data)),"id"),["last_name","first_name"]),T.each(this.potentialOwners,v=>{v.display_name="".concat(v.first_name," ").concat(v.last_name)})})})},selected(e){e.template===""&&this.$router.push({name:"FormTemplatePreview",params:{template:e.id}})},cta(){this.editTemplate("new")},editTemplate(e,t=!1){const r=t?"ClubAdminFormTemplateCopy":"AddEditFormTemplate";this.$router.push({name:r,params:{template:e}})},templateBuilder(e){this.$router.push({name:"FormTemplateBuilder",params:{template:e}})},fetchTemplates(){B().get("/forms/templates").then(e=>{this.formTemplates=T.each(e.data,t=>{t.actions=""})})},canCopy(e){return e.template===""&&(this.$store.getters.isClubAdmin||this.$store.getters.isDirector&&this.formsDirectorsCanAdminTemplates)},canEdit(e){return e.template===""&&(this.$store.getters.isRegionlessAdmin||this.$store.getters.user.id===e.owner.user_id&&(this.$store.getters.isRegionalAdmin||this.$store.getters.isDirector&&this.formsDirectorsCanAdminTemplates))},statusClass(e){return e==="System"?"is-info":e==="Published"?"is-success":"has-background-grey"},setOnlyMyTemplates(e){this.$store.commit("setTableDataFor",{name:"forms",onlyMyTemplates:e})},submitterTitle(e){return e===xe?"Primary Director":e},clearSearchAndFilters(){this.$store.commit("setTableDataFor",{name:this.TABLE_NAME,search:""}),this.searchQuery=""}}},Vt={key:1},Nt=["onClick"],Bt={class:"is-text-size-6"},Ut=["onClick"],Lt={class:"is-text-size-6"};function Ot(e,t,r,v,o,s){const f=n("spinner"),g=n("b-switch"),P=n("b-field"),h=n("b-table-column"),C=n("fa-icon"),x=n("EmptyStateComponent"),M=n("BaseTable");return i(),c("div",null,[s.loading?(i(),w(f,{key:0})):(i(),c("div",Vt,[!s.isDirector||s.isDirector&&s.formsDirectorsCanAdminTemplates?(i(),w(P,{key:0},{default:l(()=>[a(g,{modelValue:o.viewMyTemplates,"onUpdate:modelValue":[t[0]||(t[0]=_=>o.viewMyTemplates=_),s.setOnlyMyTemplates],size:"is-small"},{default:l(()=>[...t[2]||(t[2]=[u("span",{class:"is-text-size-6"}," View My Templates ",-1)])]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:1})):D("",!0),a(M,{data:s.filteredData,searchable:s.searchable,"row-class":(function(_){return _.template===""?"clickable":""}),name:v.TABLE_NAME,"mobile-cards":"",hoverable:"","show-empty-state-in-table":s.useEmptySearch,"use-empty-search":s.useEmptySearch,onClearSearchAndFilters:s.clearSearchAndFilters,onQueryUpdated:t[1]||(t[1]=_=>o.searchQuery=_),onSelect:s.selected},fe({default:l(()=>[a(h,{field:"name",label:"Title",sortable:""},{default:l(({row:_})=>[y(b(_.name),1)]),_:1}),a(h,{"mobile-sort-options":["A to Z","Z to A"],field:"context_type",label:"Form Type",sortable:""},{default:l(({row:_})=>[y(b(_.context_type),1)]),_:1}),a(h,{"mobile-sort-options":["A to Z","Z to A"],field:"submitter",label:"Submitter",sortable:""},{default:l(({row:_})=>[y(b(s.submitterTitle(_.submitter)),1)]),_:1}),a(h,{"mobile-sort-options":["A to Z","Z to A"],field:"status",label:"Status",sortable:""},{default:l(({row:_})=>[u("p",{class:Z([s.statusClass(_.status),"tag is-rounded form-template-status"])},b(_.status),3)]),_:1}),a(h,{"mobile-sort-options":["A to Z","Z to A"],label:s.ownerOrCreatedBy,"custom-key":"owner_display_name",field:"owner.dis
1play_name",sortable:""},{default:l(({row:_})=>[y(b(_.owner.display_name),1)]),_:1},8,["label"]),a(h,{"custom-key":"actions"},{default:l(({row:_})=>[s.canCopy(_)?(i(),c("a",{key:0,class:"button is-text is-small has-text-primary","aria-label":"copy",onClick:re(d=>s.editTemplate(_.id,!0),["stop"])},[u("div",Bt,[a(C,{icon:["far","copy"]})])],8,Nt)):D("",!0),s.canEdit(_)?(i(),c("a",{key:1,class:"button is-text is-small has-text-primary","aria-label":"edit",onClick:re(d=>s.templateBuilder(_.id),["stop"])},[u("div",Lt,[a(C,{icon:["far","pencil"]})])],8,Ut)):D("",!0)]),_:1})]),_:2},[s.useEmptySearch?void 0:{name:"empty",fn:l(()=>[a(x,{header:"No Form Templates Found",body:o.formTemplates.length===0?"There are no form templates.":"No form templates match the current search criteria.","img-src":"/static/images/icons/form-templates-empty-icon.svg",class:"mt-5"},null,8,["body"])]),key:"0"}]),1032,["data","searchable","row-class","name","show-empty-state-in-table","use-empty-search","onClearSearchAndFilters","onSelect"])]))])}const Qt=W(It,[["render",Ot],["__scopeId","data-v-60137216"]]),Ht={components:{"app-form-request-forms":Ne},props:{forms:{type:Array,required:!0}},emits:["refresh"],computed:{formRequest(){const t=Object.keys(T.keyBy(this.forms,"team_id")).map(Number).map(r=>this.clubTeamByID(r));return{forms:this.forms,form_template_context_type:"ForDirector",teams:t}}},methods:{clubTeamByID(e){return this.$store.getters.clubTeamByID(e)}}};function jt(e,t,r,v,o,s){const f=n("app-form-request-forms");return i(),c("div",null,[a(f,{"form-request":s.formRequest,"is-for-review":!0,sortable:!e.$store.getters.isMobile,onRefreshFormRequest:t[0]||(t[0]=g=>e.$emit("refresh"))},null,8,["form-request","sortable"])])}const zt=W(Ht,[["render",jt]]),Yt={components:{FormsList:ye},props:{forms:{type:Array,default:null},myFormsTab:{type:Number,required:!1,default:0},searchQuery:{type:String,default:""}},setup(){const{formatDate:e}=ne();return{formatDate:e,TABLE_NAME:"coachforms"}},data(){return{reviews:null,submissions:null}},computed:{loading(){return this.formsForTable==null},tabs(){const e=["My Forms","My Submissions"];return this.$store.getters.isDirector&&e.push("My Reviews"),e},formsForTable(){return this.myFormsTab===1?this.submissions:this.myFormsTab===2?this.reviews:this.forms},isMobile(){return this.$store.getters.isMobile},submissionTab(){return this.myFormsTab===1}},created(){this.myFormsTab===1?this.loadSubmissions():this.myFormsTab===2&&this.loadReviews()},methods:{viewForm(e){this.$router.push("/forms/".concat(e.id))},loadSubmissions(){this.submissions=null,B().get("/forms/submissions?populate=player,form_request,form_request:created_by,users").then(e=>{const t=e.data;t.forEach(r=>{X.fillInForm(r)}),this.submissions=t})},loadReviews(){this.reviews=null,B().get("/forms/reviews?populate=player,form_request,form_request:created_by,users").then(e=>{const t=e.data;t==null||t.forEach(r=>{X.fillInForm(r)}),this.reviews=t})},changeTab(e){this.formTab=e,e===0?this.$router.replace({name:"FormsMyForms"}):e===1?this.$router.replace({name:"FormsMySubmissions"}):e===2&&this.$router.replace({name:"FormsMyReviews"})}}},Gt={key:1,class:"forms-tab"};function Zt(e,t,r,v,o,s){const f=n("spinner"),g=n("b-tab-item"),P=n("b-tabs"),h=n("b-tag"),C=n("b-table-column"),x=n("EmptyStateComponent"),M=n("BaseTable"),_=n("FormsList");return s.loading?(i(),w(f,{key:0})):(i(),c("div",Gt,[r.myFormsTab===0?(i(),w(M,{key:0,data:s.formsForTable,"default-current-sort":["approved_at","desc"],"row-class":()=>"clickable",name:v.TABLE_NAME,class:"my-forms",hoverable:"",onSelect:s.viewForm},{"header-left":l(()=>[a(P,{"model-value":r.myFormsTab,type:"is-toggle",class:"b-tabs-no-content","onUpdate:modelValue":s.changeTab},{default:l(()=>[(i(!0),c(j,null,K(s.tabs,d=>(i(),w(g,{key:d,label:d},null,8,["label"]))),128))]),_:1},8,["model-value","onUpdate:modelValue"])]),empty:l(()=>[r.forms.length===0?(i(),w(x,{key:0,header:"No Forms Found",body:r.myFormsTab===0?"You have no forms to review yet.":"No forms match the current search criteria.","img-src":"/static/images/icons/forms-empty-icon.svg"},null,8,["body"])):D("",!0)]),default:l(()=>[a(C,{field:"form_request.title",label:"Title",sortable:!s.isMobile},{default:l(({row:d})=>[y(b(d.form_request.title)+" ",1),d.is_new?(i(),w(h,{key:0,class:"ml-2",type:"is-primary",rounded:""},{default:l(()=>[...t[0]||(t[0]=[y(" New ",-1)])]),_:1})):D("",!0)]),_:1},8,["sortable"]),a(C,{field:"form_request.form_template_context_type",label:"Type",sortable:!s.isMobile},{default:l(({row:d})=>[y(b(d.form_request.form_template_context_type),1)]),_:1},8,["sortable"]),a(C,{field:"completed_by",label:"Completed By",sortable:!s.isMobile},{default:l(({row:d})=>[y(b(d.completed_by),1)]),_:1},8,["sortable"]),a(C,{field:"approved_by_name",label:"Reviewed By",sortable:!s.isMobile},{default:l(({row:d})=>[y(b(d.approved_by_name),1)]),_:1},8,["sortable"]),a(C,{field:"approved_at",label:"Completed On",sortable:!s.isMobile},{default:l(({row:d})=>[y(b(v.formatDate(d.approved_at,"ll")),1)]),_:1},8,["sortable"])]),_:1},8,["data","name","onSelect"])):D("",!0),r.myFormsTab===1||r.myFormsTab===2?(i(),w(_,{key:1,forms:s.formsForTable,"default-current-sort":["form_request.due_date","desc"],"empty-state":r.myFormsTab,"no-toggle":!0,"my-forms-tab":r.myFormsTab,"my-reviews":r.myFormsTab===2},{"header-left":l(()=>[a(P,{"model-value":r.myFormsTab,type:"is-toggle",class:"b-tabs-no-content","onUpdate:modelValue":s.changeTab},{default:l(()=>[(i(!0),c(j,null,K(s.tabs,d=>(i(),w(g,{key:d,label:d},null,8,["label"]))),128))]),_:1},8,["model-value","onUpdate:modelValue"])]),_:1},8,["forms","empty-state","my-forms-tab","my-reviews"])):D("",!0)]))}const Kt=W(Yt,[["render",Zt]]),Wt={components:{FormsList:ye},props:{myFormsTab:{type:Number,required:!1,default:0}},data(){return{forms:null}},computed:{loading(){return this.forms==null}},created(){this.loadForms()},methods:{loadForms(){B().get("/forms/todo?populate=player,form_request,form_request:created_by,users").then(e=>{this.forms=this.processForms(e.data)})},processForms(e){const t=e.filter(r=>r.status!=="Canceled");return t.forEach(r=>{X.fillInForm(r)}),t}}};function Jt(e,t,r,v,o,s){const f=n("spinner"),g=n("FormsList");return s.loading?(i(),w(f,{key:0})):(i(),w(g,{key:1,forms:o.forms,"default-current-sort":["form_request.due_date","desc"],"no-toggle":!0},null,8,["forms"]))}const Xt=W(Wt,[["render",Jt]]),$t={__name:"PDPRequestsFilter",props:{modelValue:{type:Object,default:()=>({})},pdps:{type:Array,default:()=>[]}},emits:["update:modelValue"],setup(e,{emit:t}){const r=e,v=t,o=oe(),{teams:s}=Ue();function f(R){v("update:modelValue",{...r.modelValue,...R})}function g(){return{teams:[],seasons:[]}}const P=I(()=>{const R=(r.pdps||[]).reduce((m,p)=>
1((p.teams||[]).forEach(Q=>{m[Q.team_id]=!0}),m),{});return s.value.filter(m=>R[m.id])}),h=I({get:()=>r.modelValue.teams||[],set:R=>{f({teams:R})}}),C=I({get(){return r.modelValue.seasons||[]},set(R){f({seasons:R})}}),x=I(()=>{var R;return(((R=o.getters.clubDetails)==null?void 0:R.seasons)||[]).filter(m=>!m.archived)}),M=I(()=>{const R=ie.keyBy(r.pdps||[],m=>m.season_id);return x.value.filter(m=>R[m.id])}),_=I(()=>C.value.length>0||h.value.length>0);function d(){f(g())}return(function(){f({...g(),...r.modelValue})})(),(R,m)=>(i(),w(ve,{title:"Filter PDPs","filters-active":_.value,onClearFilters:d},{default:l(()=>[a(he,{label:"Teams"},{default:l(()=>[a(Le,{modelValue:h.value,"onUpdate:modelValue":m[0]||(m[0]=p=>h.value=p),teams:P.value},null,8,["modelValue","teams"])]),_:1}),a(Oe,{modelValue:C.value,"onUpdate:modelValue":m[1]||(m[1]=p=>C.value=p),seasons:M.value,"default-open":""},null,8,["modelValue","seasons"])]),_:1},8,["filters-active"]))}},es={key:1,class:"mt-6"},ts={__name:"PDPRequestsTable",setup(e,{expose:t}){const r=oe(),v=ce(),o=De("createPdpModal"),s=O(0),f=O(null),g=O(null),P=O(""),h=O({seasons:[],teams:[]}),C=I(()=>{var A;return((A=r.getters.clubDetails)==null?void 0:A.seasons)||[]}),x=I(()=>ie.keyBy(C.value.filter(A=>A.status==="Current"||A.status==="Future"),"id")),M=I(()=>f.value==null),_=I(()=>f.value&&f.value.length>0),d=I(()=>s.value===0),R=I(()=>{let A=f.value||[];if(d.value?A=A.filter(E=>x.value[E.season_id]):A=A.filter(E=>!x.value[E.season_id]),h.value.seasons.length&&(A=A.filter(E=>h.value.seasons.includes(E.season_id))),h.value.teams.length){const E=ie.keyBy(h.value.teams);A=A.filter(H=>(H.teams||[]).some(z=>E[z.team_id]))}if(P.value.length){const E=P.value.toLowerCase();A=A.filter(H=>H.name.toLowerCase().includes(E))}return A}),m=I(()=>h.value.seasons.length>0||h.value.teams.length>0);async function p(){f.value=null;try{const A=ke({created_by_user:!0,num_players:!0,num_teams:!0}),E=await B({showError:!1}).get("/club_admin/pdp-requests?populate=".concat(A));f.value=E.data.map(H=>{var z;return{...H,seasonName:((z=r.getters.clubSeasonByID(H.season_id))==null?void 0:z.name)||"-"}})}catch(A){g.value=A}}function Q(A){v.push({name:"PDPRequest",params:{pdp_request_id:A.id}})}function ae(A){var E;A.text==="Create PDP"&&((E=o.value)==null||E.showModal())}return t({cta:ae}),Fe(async()=>{await p()}),(A,E)=>{const H=n("spinner"),z=n("EmptyStateComponent"),$=n("b-tab-item"),J=n("b-tabs"),Y=n("b-table-column"),ee=n("BaseTable");return i(),c("div",null,[M.value?(i(),w(H,{key:0,"api-error":g.value},null,8,["api-error"])):_.value?(i(),w(ee,{key:2,name:"PDPsTable",data:R.value,"filters-active":m.value,"row-class":()=>"clickable",filterable:"",hoverable:"","is-paginated":"",searchable:"","search-placeholder-text":"Search for...",sortable:"","onUpdate:searchQuery":E[1]||(E[1]=N=>P.value=N),onSelect:Q},{"header-left":l(()=>[a(J,{modelValue:s.value,"onUpdate:modelValue":E[0]||(E[0]=N=>s.value=N),type:"is-toggle",class:"b-tabs-no-content"},{default:l(()=>[a($,{label:"Current"}),a($,{label:"Past"})]),_:1},8,["modelValue"])]),empty:l(()=>[a(z,{header:"No ".concat(d.value?"Current":"Past"," PDPs Found"),"img-src":"/static/images/icons/todo-list-empty-icon.svg"},null,8,["header"])]),default:l(()=>[a(Y,{field:"name",label:"PDP Name",sortable:""},{default:l(({row:N})=>[y(b(N.name),1)]),_:1}),a(Y,{field:"num_teams",label:"Teams"},{default:l(({row:N})=>[y(b(U(ue)(N.num_teams||0,"Team")),1)]),_:1}),a(Y,{field:"num_players",label:"Players"},{default:l(({row:N})=>[y(b(U(ue)(N.num_players||0,"Player")),1)]),_:1}),a(Y,{field:"created_by_user.name",label:"Created By"},{default:l(({row:N})=>{var te;return[y(b(((te=N.created_by_user)==null?void 0:te.name)||"-"),1)]}),_:1}),a(Y,{field:"seasonName",label:"Season",sortable:""},{default:l(({row:N})=>[y(b(N.seasonName),1)]),_:1})]),_:1},8,["data","filters-active"])):(i(),c("div",es,[a(z,{header:"No PDPs Found",body:"No PDPs have been created yet.","img-src":"/static/images/icons/todo-list-empty-icon.svg"})])),a($t,{modelValue:h.value,"onUpdate:modelValue":E[2]||(E[2]=N=>h.value=N),pdps:f.value},null,8,["modelValue","pdps"]),a(Be,{ref_key:"createPdpModal",ref:o,onRefresh:p},null,512)])}}},q={TASK_LIST:"To Do List",REVIEW_LIST:"Review List",FORMS:"Forms",FORM_REQUESTS:"Form Requests",FORM_TEMPLATES:"Form Templates",DIGITAL_DOCUMENTS:"Digital Documents",PDPS:"PDPs"},le={CREATE_PDP:{text:"Create PDP",classes:"is-primary"},MANAGE_PLAYER_CHARACTERISTICS:{text:"Manage Player Characteristics",dropdown_item:!0}},ss={components:{MobileDisabled:Ae,DirectorReviewList:zt,FormRequests:qt,FormTemplates:Qt,DigitalDocuments:Ct,FormsTab:Kt,FormsToDoTab:Xt,PDPRequestsTable:ts,PageNavigation:Me},props:{activeTab:{type:String,required:!1,default:q.TASK_LIST},myFormsTab:{type:Number,required:!1,default:0}},setup(){const{isTouch:e}=pe(_e()),t=be();return{isTouch:e,modulesStore:t,TABS:q}},data(){return{formsToReview:null,formsMyForms:null,searchQuery:"",digitalDocumentTemplates:null,pandadocTemplates:[]}},computed:{canAdminTemplates(){return!this.isDirector||this.modulesStore.directorsCanAdminFormTemplates},tabs(){const e=[];
1if(e.push({name:q.TASK_LIST,ctas:[],indicator:"formsToDoCount"}),this.isDirector&&this.hasFormsToReview&&e.push({name:q.REVIEW_LIST,ctas:[],indicator:"formsToReviewCount"}),e.push({name:q.FORMS,tag:this.hasNewMyForms?"New":null}),this.canAdminTeams&&(e.push({name:q.FORM_REQUESTS,ctas:["Create a Request"]}),!this.isTouch)){const t=this.canAdminTemplates?["Create Form Template"]:[];e.push({name:q.FORM_TEMPLATES,ctas:t})}if(this.useDigitalDocuments&&(!T.isEmpty(this.visibleTemplates)||this.$store.getters.isSuperAdmin&&!T.isEmpty(this.usablePandadocTemplates))){const t=[{text:"Create Digital Document",classes:"is-superadmin-primary is-outlined is-small"}];e.push({name:q.DIGITAL_DOCUMENTS,indicator:this.isDirector?null:"digitalDocumentsDraftCount",ctas:this.$store.getters.isSuperAdmin?t:[]})}return this.formsPDPEnabled&&e.push({name:q.PDPS,ctas:[le.CREATE_PDP,le.MANAGE_PLAYER_CHARACTERISTICS]}),e},loading(){return this.formsToReview==null||this.formsMyForms==null||this.useDigitalDocuments&&this.digitalDocumentTemplates==null},isClubAdmin(){return this.$store.getters.isClubAdmin},isDirector(){return this.$store.getters.isDirector},canAdminTeams(){return this.$store.getters.canAdminTeams},hasFormsToReview(){return this.formsToReview&&this.formsToReview.length>0},hasNewMyForms(){return this.formsMyForms&&T.some(this.formsMyForms,e=>e.is_new)},useDigitalDocuments(){return this.canAdminTeams&&this.modulesStore.digitalDocumentsEnabled},formsPDPEnabled(){return this.modulesStore.formsPDPsEnabled},visibleTemplates(){return this.isDirector?this.digitalDocumentTemplates.filter(e=>e.status==="published"):this.digitalDocumentTemplates},digitalDocumentTemplatesByVendorId(){return T.keyBy(this.digitalDocumentTemplates,"vendor_id")},usablePandadocTemplates(){return T.filter(this.pandadocTemplates,e=>!this.digitalDocumentTemplatesByVendorId[e.id])}},created(){this.loadDeliveredForms(),this.loadDirectorForms(),this.loadDigitalDocumentTemplates(),this.pandadocTemplates=[],this.$store.getters.isSuperAdmin&&this.useDigitalDocuments&&B().get("forms/digital_documents/templates/pandadoc_templates").then(e=>{this.pandadocTemplates=T.sortBy(e.data,["name","date_created"])})},methods:{goBack(){this.$router.push({name:"PlayerForms"})},loadDirectorForms(){if(!this.isDirector){this.formsToReview=[];return}this.formsToReview=null,B().get("/forms/admin/to-review?populate=form_request,player,users").then(e=>{this.formsToReview=this.processForms(e.data)})},loadDeliveredForms(){B().get("/forms/delivered?populate=form_request,form_request:created_by,users").then(e=>{const t=e.data;t.forEach(r=>{X.fillInMyForm(r)}),this.formsMyForms=t})},processForms(e){const t=e.filter(r=>r.status!=="Canceled");return t.forEach(r=>{X.fillInForm(r)}),t},loadDigitalDocumentTemplates(){this.useDigitalDocuments&&B().get("forms/digital_documents/templates?populate=stats").then(e=>{this.digitalDocumentTemplates=e.data;const t=this.digitalDocumentTemplates.filter(r=>r.status==="draft").length;this.$store.commit("setDigitalDocumentsDraftCount",t)})},cta(e){if(e===le.MANAGE_PLAYER_CHARACTERISTICS){this.$router.push({name:"PDPPlayerCharacteristics"});return}this.activeTab===q.FORM_REQUESTS?this.$refs.formRequests.cta(e):this.activeTab===q.FORM_TEMPLATES?this.$refs.formTemplates.cta(e):this.activeTab===q.DIGITAL_DOCUMENTS?this.$refs.digitalDocuments.cta(e):this.activeTab===q.PDPS&&this.$refs.pdpRequestsTable.cta(e)},tab(e){if(e===this.activeTab)return;const r={[q.TASK_LIST]:"PlayerForms",[q.REVIEW_LIST]:"FormsReviewList",[q.FORMS]:"FormsMyForms",[q.FORM_REQUESTS]:"FormsFormRequests",[q.FORM_TEMPLATES]:"ClubAdminFormTemplates",[q.DIGITAL_DOCUMENTS]:"FormsDigitalDocuments",[q.PDPS]:"PDPRequests"}[e]||"ClubAdminForms";this.$router.push({name:r})}}},as={key:1},ls={key:2},rs={key:0},is={key:1},os={key:2},ns={key:3},ms={key:4},us={key:5},ds={key:6};function cs(e,t,r,v,o,s){const f=n("spinner"),g=n("MobileDisabled"),P=n("PageNavigation"),h=n("FormsToDoTab"),C=n("DirectorReviewList"),x=n("FormsTab"),M=n("FormRequests"),_=n("FormTemplates"),d=n("DigitalDocuments"),R=n("PDPRequestsTable");return i(),c("div",null,[s.loading?(i(),w(f,{key:0})):r.activeTab===v.TABS.FORM_TEMPLATES&&v.isTouch?(i(),c("div",as,[v.isTouch?(i(),w(g,{key:0,name:"Form Template Builder","exit-text":"Back to Forms",onExit:s.goBack},null,8,["onExit"])):D("",!0)])):(i(),c("div",ls,[a(P,{tabs:s.tabs,"active-tab":r.activeTab,"page-title":"Forms","use-mobile-title-bar":!0,onTabClicked:t[0]||(t[0]=m=>s.tab(m)),onCtaClicked:t[1]||(t[1]=m=>s.cta(m)),onQueryUpdated:t[2]||(t[2]=m=>o.searchQuery=m)},null,8,["tabs","active-tab"]),r.activeTab===v.TABS.TASK_LIST?(i(),c("div",rs,[a(h)])):D("",!0),r.activeTab===v.TABS.REVIEW_LIST?(i(),c("div",is,[a(C,{forms:o.formsToReview,onRefresh:s.loadDirectorForms},null,8,["forms","onRefresh"])])):D("",!0),r.activeTab===v.TABS.FORMS?(i(),c("div",os,[a(x,{forms:o.formsMyForms,"my-forms-tab":r.myFormsTab},null,8,["forms","my-forms-tab"])])):D("",!0),r.activeTab===v.TABS.FORM_REQUESTS?(i(),c("div",ns,[a(M,{ref:"formRequests"},null,512)])):D("",!0),r.activeTab===v.TABS.FORM_TEMPLATES?(i(),c("div",ms,[a(_,{ref:"formTemplates"},null,512)])):D("",!0),r.activeTab===v.TABS.DIGITAL_DOCUMENTS?(i(),c("div",us,[a(d,{ref:"digitalDocuments","digital-document-templates":o.digitalDocumentTemplates,"pandadoc-templates":s.usablePandadocTemplates,onRefreshDigitalDocuments:s.loadDigitalDocumentTemplates},null,8,["digital-document-templates","pandadoc-templates","onRefreshDigitalDocuments"])])):D("",!0),r.activeTab===v.TABS.PDPS&&s.formsPDPEnabled?(i(),c("div",ds,[a(R,{ref:"pdpRequestsTable"},null,512)])):D("",!0)]))])}const Aa=W(ss,[["render",cs]]);
1export{q as TABS,Aa as default}; 2//# sourceMappingURL=StaffForms-CWyhe1_K.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.