import{aH as t,aI as e,ay as a}from"../../../../vendor-element-plus.js?ver=3.1.10";import{aQ as i,W as s,X as r,ab as o,a5 as n,a6 as c,Y as p,J as l,az as d,Z as u,a9 as _,aa as m,a8 as h}from"../../../../vendor.js?ver=3.1.10";import{P as b}from"../../../../PaginationBar.js?ver=3.1.10";import{D as f}from"../../../../DataTable.js?ver=3.1.10";import{_ as g}from"../../../../fc-bits-ui.js?ver=3.1.10";const k={class:"purchase_history_block"},v={class:"fcrm_table_header_inner_left_title"},y=["innerHTML"];const T={key:0};const w=g({name:"ProfileSuportTickets",props:["subscriber_id"],components:{SupportTicketsBlock:g({name:"SupportTicketsBlock",props:["provider","subscriber_id"],components:{DataTable:f,PaginationBar:b},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(h,b,f,g,T,w){const C=e,D=t,j=i("pagination-bar"),$=i("data-table"),B=a;return s(),r("div",k,[o($,{class:"fcrm_support_ticket_block",wrapper_border:!0,"has-selection":!1},{"header-left":n(()=>[u("h3",v,m(f.provider.title),1)]),table:n(()=>[c((s(),p(D,{"empty-text":h.$t("No Data Found"),border:"",stripe:"",data:T.tickets},{empty:n(()=>[u("p",null,[_(m(h.$t("Support Tickets from"))+" ",1),u("b",null,m(f.provider.name),1),_(" "+m(h.$t("no_tickets_found_for_this_subscriber")),1)])]),default:n(()=>[(s(!0),r(l,null,d(w.table_columns,(t,e)=>(s(),p(C,{key:e,width:T.columnsConfig[e]?T.columnsConfig[e].width:"",label:T.columnsConfig[e]&&T.columnsConfig[e].label?T.columnsConfig[e].label:h.ucFirst(e)},{default:n(t=>[u("div",{innerHTML:t.row[e]},null,8,y)]),_:2},1032,["width","label"]))),128))],void 0,!0),_:1},8,["empty-text","data"])),[[B,T.loading]])]),pagination:n(()=>[o(j,{pagination:T.pagination,onFetch:w.fetch},null,8,["pagination","onFetch"])]),_:1})])}]])},data:()=>({providersData:{},app_ready:!1}),computed:{},mounted(){this.each(window.fcAdmin.support_tickets_providers,(t,e)=>{const a={title:t.title,name:t.name,provider_key:e};this.providersData[e]=a}),this.app_ready=!0}},[["render",function(t,e,a,o,n,c){const u=i("support-tickets-block");return n.app_ready?(s(),r("div",T,[(s(!0),r(l,null,d(n.providersData,(t,e)=>(s(),p(u,{key:e,provider:t,subscriber_id:a.subscriber_id},null,8,["provider","subscriber_id"]))),128))])):h("",!0)}]]);export{w as default};
