import{ay as t,aI as i,aH as e}from"../../../../vendor-element-plus.js?ver=3.1.0";import{P as s}from"../../../../PaginationBar.js?ver=3.1.0";import{r as a,c as o,o as r,b as n,P as c,K as p,d as l,a as d,w as u,Q as m,as as h,O as _,L as g}from"../../../../vendor.js?ver=3.1.0";import{_ as b}from"../../../../fc-bits-ui.js?ver=3.1.0";const f={class:"purchase_history_block"},k={class:"history_title"},v={class:"provider_data"},y=["innerHTML"];const w={key:0,class:"fluentcrm_databox"};const C=b({name:"ProfileSuportTickets",props:["subscriber_id"],components:{SupportTicketsBlock:b({name:"SupportTicketsBlock",props:["provider","subscriber_id"],components:{PaginationBar:s},data:()=>({loading:!1,tickets:[],pagination:{per_page:10,current_page:1,total:0},columnsConfig:{}}),computed:{table_columns(){let t=[];return this.tickets&&this.tickets.length&&(t=this.tickets[0]),t}},methods:{fetch(){this.loading=!0,this.$get(`subscribers/${this.subscriber_id}/support-tickets`,{provider:this.provider.provider_key,page:this.pagination.current_page,per_page:this.pagination.per_page}).then(t=>{this.tickets=t.tickets.data,this.pagination.total=parseInt(t.tickets.total),t.tickets.columns_config&&(this.columnsConfig=t.tickets.columns_config)}).catch(t=>{this.handleError(t)}).finally(()=>{this.loading=!1})}},mounted(){this.fetch()}},[["render",function(s,g,b,w,C,T){const P=i,$=e,j=a("pagination-bar"),x=t;return r(),o("div",f,[n("h3",k,c(b.provider.title),1),n("div",v,[p((r(),d($,{"empty-text":s.$t("No Data Found"),border:"",stripe:"",data:C.tickets},{empty:u(()=>[n("p",null,[_(c(s.$t("Support Tickets from"))+" ",1),n("b",null,c(b.provider.name),1),_(" "+c(s.$t("no_tickets_found_for_this_subscriber")),1)])]),default:u(()=>[(r(!0),o(m,null,h(T.table_columns,(t,i)=>(r(),d(P,{key:i,width:C.columnsConfig[i]?C.columnsConfig[i].width:"",label:C.columnsConfig[i]&&C.columnsConfig[i].label?C.columnsConfig[i].label:s.ucFirst(i)},{default:u(t=>[n("div",{innerHTML:t.row[i]},null,8,y)]),_:2},1032,["width","label"]))),128))],void 0),_:1},8,["empty-text","data"])),[[x,C.loading]]),l(j,{pagination:C.pagination,onFetch:T.fetch},null,8,["pagination","onFetch"])])])}]])},data:()=>({providersData:{},app_ready:!1}),computed:{},mounted(){this.each(window.fcAdmin.support_tickets_providers,(t,i)=>{const e={title:t.title,name:t.name,provider_key:i};this.providersData[i]=e}),this.app_ready=!0}},[["render",function(t,i,e,s,n,c){const p=a("support-tickets-block");return n.app_ready?(r(),o("div",w,[(r(!0),o(m,null,h(n.providersData,(t,i)=>(r(),d(p,{key:i,provider:t,subscriber_id:e.subscriber_id},null,8,["provider","subscriber_id"]))),128))])):g("",!0)}]]);export{C as default};
