|
1
|
+var _e=Object.defineProperty;var we=(t,l,e)=>l in t?_e(t,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[l]=e;var te=(t,l,e)=>we(t,typeof l!="symbol"?l+"":l,e);import{M as Ve}from"./Model.js?ver=1.6.5";import{e as h,o as n,d as o,b as S,m as R,a as d,r as w,t as p,w as m,f as A,u as G,F as x,g as U,Y as Se,Q as Ce,h as P,c as T,l as M,i as ee,x as J,M as ve,G as ke,n as z,S as oe,v as X,q as Q,A as ne,B as re,U as Te,I as be,z as L,W as $e,a1 as Ae,L as Fe,T as xe}from"./vue.esm-bundler.js?ver=1.6.5";import{u as Pe,S as I}from"./common.js?ver=1.6.5";import{R as q}from"./Rest.js?ver=1.6.5";import{a as ie}from"./vue-router.js?ver=1.6.5";import{U as W}from"./Url.js?ver=1.6.5";import{A as Y}from"./Arr.js?ver=1.6.5";import{t as y,A as de,a as ce}from"./Translator.js?ver=1.6.5";import{d as se}from"./dayjs.min.js?ver=1.6.5";import{u as Ie,t as Oe}from"./timezone.js?ver=1.6.5";import{n as j}from"./Notify.js?ver=1.6.5";import{_ as B}from"./DynamicIcon.js?ver=1.6.5";import{_ as K}from"./_plugin-vue_export-helper.js?ver=1.6.5";import{E as Ne}from"./index3.js?ver=1.6.5";import{E as ae}from"./index.js?ver=1.6.5";import{I as Z}from"./IconButton.js?ver=1.6.5";import{U as De}from"./Utils.js?ver=1.6.5";import{T as ye}from"./TransitionAccordion.js?ver=1.6.5";import{S as ue}from"./Str.js?ver=1.6.5";const Ue={name:"ProFeatureNotice",components:{DynamicIcon:B},props:{title:{type:String},text:{type:String},placement:{type:String,default:"upgrade_page"}},methods:{translate:y,upgradeUrl:Pe}},Be={class:"fct-pro-feature-notice-wrap"},Ee={class:"fct-pro-feature-content"},je={class:"fct-pro-feature-icon"},ze={key:0,class:"fct-pro-feature-title"},qe={key:1,class:"fct-pro-feature-text"};function Me(t,l,e,i,s,a){const r=w("DynamicIcon"),v=w("el-button");return n(),h("div",Be,[o("div",Ee,[o("div",je,[d(r,{name:"Crown"})]),e.title?(n(),h("h4",ze,p(e.title),1)):S("",!0),e.text?(n(),h("p",qe,p(e.text),1)):S("",!0),R(t.$slots,"default"),d(v,{type:"primary",tag:"a",href:a.upgradeUrl(e.placement),target:"_blank"},{default:m(()=>[d(r,{name:"Crown"}),A(" "+p(a.translate("Upgrade to Pro")),1)]),_:1},8,["href"])])])}const Re=K(Ue,[["render",Me]]),He={class:"fluent-cart-admin-pages"},Qe={class:"fct-pro-feature-title"},Ge=["innerHTML"],We={key:0,class:"fct-feature-list"},Ye=["innerHTML"],Je={__name:"Features",props:{featureName:String,featureDescription:String,features:Array,onClose:Function,placement:{type:String,default:"upgrade_page"}},setup(t){return(l,e)=>(n(),h("div",He,[d(Re,{placement:t.placement},{default:m(()=>[o("h4",Qe,p(G(y)("%s requires FluentCart Pro",t.featureName)),1),t.featureDescription?(n(),h("p",{key:0,class:"fct-pro-feature-text",innerHTML:t.featureDescription},null,8,Ge)):S("",!0)]),_:1},8,["placement"]),t.features.length?(n(),h("ul",We,[(n(!0),h(x,null,U(t.features,i=>(n(),h("li",{key:i,innerHTML:i},null,8,Ye))),128))])):S("",!0)]))}};class Ze{constructor(){te(this,"$message",Ne);te(this,"duration",1e3)}success(l){this.show(l,"success")}error(l){this.show(l,"error")}info(l){this.show(l,"info")}show(l,e="success",i=40,s=1e3){this.$message({type:e,offset:i,message:l,dangerouslyUseHTMLString:!0,duration:s??this.duration})}showFeaturesCTA(l,e,i,s,a="upgrade_page"){let r=null;s&&(r=s.appContext),ae({title:y("Pro Feature"),message:Se(Je,{featureName:l,featureDescription:e,features:i,placement:a}),customClass:"fluent-cart-pro-cta",showCancelButton:!1,showConfirmButton:!1,showFooter:!1,showClose:!0},r)}}const he=new Ze;class Tl extends Ve{constructor(e={}){super();te(this,"data",{callbacks:{onDataLoaded:null},tableData:[],search:"",advanceFilters:[[]],searching:!1,selectedView:"",sorting:{sortBy:"id",sortType:"DESC"},paginate:{current_page:1,per_page:10,last_page:1,total:0,from:1,to:10},filterType:"simple",columns:[],loading:!1,inputRef:P(null),nextPageCount:10,user_tz:null,showDeleteBulkAction:!1,savedViews:[],activeSavedViewId:null,savedViewQueryParams:null,showSaveViewDialog:!1});Ce(()=>{this.setupInitialData(),se.extend(Ie),se.extend(Oe),this.data.user_tz=se.tz.guess(),this.data.vueInstance=e.instance,e.fetch!==!1&&this.fetch()})}onDataLoaded(e){this.data.callbacks.onDataLoaded=e}setupInitialData(){this.setupInitialTab(),this.setupInitialColumnVisibility(),this.setupInitialFilterType(),this.setupInitialAdvanceFilter(),this.setupInitialSearch(),this.setupInitialPagination(),this.setupSavedViews()}setupInitialSearch(){this.isRouteSearchApplied()&&(this.data.search=this.isRouteSearchApplied(),this.data.searching=!0)}setupInitialPagination(){const e=I.get(this.getPerPageStorageName()),i=I.get(this.getCurrentPageStorageName());this.data.paginate.per_page=parseInt(e)||10,this.data.paginate.current_page=parseInt(i)||1}setupInitialTab(){var r;const i=(r=ie().query.active_view)==null?void 0:r.toString(),s=this.getTabs()||{};if(i){if(s.hasOwnProperty(i)){this.data.selectedView=i;return}this.data.pendingViewFromUrl=i,this.data.selectedView=this.getDefaultView();return}const a=I.get(this.getTabStorageName());if(typeof a=="string"&&s.hasOwnProperty(a)){this.data.selectedView=a;return}typeof a=="string"&&a!==""&&(this.data.pendingViewFromStorage=a),this.data.selectedView=this.getDefaultView()}setupSavedViews(){this.data.savedViews=Y.get(window,`fluentCartAdminApp.table_config.${this.getTableName()}.saved_views`)||[];const e=this.data.pendingViewFromUrl||this.data.pendingViewFromStorage;if(delete this.data.pendingViewFromUrl,delete this.data.pendingViewFromStorage,e){const i=this.data.savedViews.find(s=>s.slug===e||String(s.id)===String(e));i?(this.data.activeSavedViewId=i.slug,this.data.savedViewQueryParams=i.query_params,this._resetLiveFilter(),this.data.selectedView=this.getDefaultView()):(this.data.selectedView=this.getDefaultView(),I.set(this.getTabStorageName(),this.getDefaultView()),W.pushToVueUrl(null,{active_view:this.getDefaultView()}))}}handleTabChanged(e){const i=!!this.data.activeSavedViewId;i&&(this.data.activeSavedViewId=null,this.data.savedViewQueryParams=null,this._resetLiveFilter()),!(e===this.data.selectedView&&!i)&&(this.data.selectedView=e,this.data.paginate.current_page=1,this.setCurrentPage(1),I.set(this.getTabStorageName(),this.data.selectedView),W.pushToVueUrl(null,{active_view:this.data.selectedView}),this.fetch())}getSelectedTab(){return this.data.selectedView}setupInitialColumnVisibility(){let e=I.get(this.getColumnStorageName());if(Array.isArray(e))this.data.columns=e;else{let i=[];for(let s of this.getToggleableColumns())i.push(s.value);this.data.columns=i}}isSearching(){return this.data.searching!==!1}openSearch(){this.data.activeSavedViewId&&this.data.savedViewQueryParams&&this.data.savedViewQueryParams.filter_type!=="advanced"&&this._prefillFiltersFromParams(this.data.savedViewQueryParams),this.data.searching=!this.isUsingAdvanceFilter(),I.set(this.getToggleSearchingStorageName(),this.data.searching)}closeSearch(){const e=!!this.data.search;this.data.searching=!1,this.data.search="",I.set(this.getToggleSearchingStorageName(),this.data.searching),e&&this.fetch()}showBulkDeleteAction(e=null){this.data.showDeleteBulkAction=e,I.set(this.getDeleteBulkActionStorageName(),this.data.showDeleteBulkAction)}useFullWidthSearch(){return this.getTabsCount()===0}handleSortChange(){this.fetch()}isUsingSimpleFilter(){return this.data.filterType==="simple"}setupInitialFilterType(){if(!this.isProActive()){this.data.filterType="simple";return}if(this.isRouteActiveViewApplied()||this.isRouteSearchApplied()){this.data.filterType="simple";return}const e=I.get(this.getFilterTypeStorageName());if(["simple","advanced"].includes(e)){if(e==="advanced"&&!this.isAdvanceFilterEnabled())return;this.data.filterType=e}const i=I.get(this.getToggleSearchingStorageName());i&&(this.data.searching=i);const s=I.get(this.getDeleteBulkActionStorageName());s&&(this.data.showDeleteBulkAction=s)}onFilterTypeChanged(e){e==="advanced"&&(this.data.searching=!1,this.data.search="",this.data.activeSavedViewId&&this.data.savedViewQueryParams&&this.data.savedViewQueryParams.filter_type==="advanced"&&this._prefillFiltersFromParams(this.data.savedViewQueryParams)),e==="simple"&&this.fetch(),I.set(this.getFilterTypeStorageName(),this.data.filterType)}setupInitialAdvanceFilter(){let e=I.get(this.getAdvancedFilterStorageName());typeof e=="string"&&(e=[[]]),this.data.advanceFilters=e}isProActive(){return de.get("app_config.isProActive")}applyAdvancedFilter(e=!1){if(!this.isProActive()){e||he.showFeaturesCTA(y("Advanced Filter"),y("Advanced filter is only available in pro version"),[],this.data.vueInstance,"feature_lock_advanced_filtering"),this.storeAdvanceFilter();return}this.setCurrentPage(1),this.fetch(),this.storeAdvanceFilter()}storeAdvanceFilter(){I.set(this.getAdvancedFilterStorageName(),this.data.advanceFilters)}isUsingAdvanceFilter(){return this.data.filterType==="advanced"}addAdvanceFilterGroup(){this.data.advanceFilters.push([])}removeAdvanceFilterGroup(e){this.data.advanceFilters.length>1&&this.data.advanceFilters.splice(e,1),this.storeAdvanceFilter()}clearAdvanceFilter(){this.data.advanceFilters=[[]],this.applyAdvancedFilter()}getAdvanceFilterOptions(){return Y.get(window,`fluentCartAdminApp.table_config.${this.getTableName()}.filters.advance`)}getSearchGuideOptions(){return Y.get(window,`fluentCartAdminApp.table_config.${this.getTableName()}.filters.guide`)||[]}isAdvanceFilterEnabled(){return this.getAdvanceFilterOptions()!==null}buildQueryParams(){const e={per_page:this.data.paginate.per_page,page:this.data.paginate.current_page,sort_by:this.data.sorting.sortBy,sort_type:this.data.sorting.sortType,with:this.with(),scopes:this.scopes(),user_tz:this.data.user_tz};return this.data.activeSavedViewId?e.active_view=this.data.activeSavedViewId:this.isUsingAdvanceFilter()||(e.active_view=this.data.selectedView),this.isUsingAdvanceFilter()?(e.filter_type="advanced",e.advanced_filters=JSON.stringify(this.data.advanceFilters)):(e.filter_type="simple",e.search=this.data.search),e}search(){W.pushToVueUrl(null,{search:this.data.search}),this.fetch()}fetch(){this.data.loading=!0;let e=this.buildQueryParams(),i=!1;q.get(this.getFetchUrl(),e).then(s=>{const a=this.parseResponse(s);if(a.last_page>0&&this.data.paginate.current_page>a.last_page){this.data.paginate.current_page=a.last_page,this.setCurrentPage(a.last_page),i=!0,this.fetch();return}this.data.tableData=a.data,this.data.paginate.total=a.total,this.data.paginate.last_page=a.last_page,this.data.paginate.from=a.from,this.data.paginate.to=a.to,this.data.nextPageCount=this.guessNextPageCount(a),typeof this.data.callbacks.onDataLoaded=="function"&&this.data.callbacks.onDataLoaded(s)}).catch(s=>{var a;s.status_code=="422"?j.validationErrors(s):j.error((a=s.data)==null?void 0:a.message),this.data.tableData=[]}).finally(()=>{i||(this.data.loading=!1)})}getTableData(){return this.data.tableData}isLoading(){return this.data.loading===!0}getDefaultView(){return"all"}handleColumnVisibilityChange(){I.set(this.getColumnStorageName(),this.data.columns)}handlePerPageChange(){this.data.paginate.current_page=1,this.setCurrentPage(1),I.set(this.getPerPageStorageName(),this.data.paginate.per_page),this.fetch()}handlePageChange(){this.fetch(),this.setCurrentPage()}setCurrentPage(e){I.set(this.getCurrentPageStorageName(),e||this.data.paginate.current_page)}getCurrentPage(){return I.get(this.getCurrentPageStorageName())}getColumnStorageName(){return`${this.getTableName()}_columns`}getTabStorageName(){return`${this.getTableName()}_tab`}getFilterTypeStorageName(){return`${this.getTableName()}_filter_type`}getAdvancedFilterStorageName(){return`${this.getTableName()}_advanced_filter`}getPerPageStorageName(){return`${this.getTableName()}_per_page`}getCurrentPageStorageName(){return`${this.getTableName()}_current_page`}getToggleSearchingStorageName(){return`${this.getTableName()}_toggle_searching`}getDeleteBulkActionStorageName(){return`${this.getTableName()}_delete_bulk_action`}getSavedViews(){return this.data.savedViews}getActiveSavedViewId(){return this.data.activeSavedViewId}getCurrentUserId(){return de.get("me.id")}isViewOwner(e){return e.owner_id===this.getCurrentUserId()}promptAndSaveView(){if(!this.isProActive()){he.showFeaturesCTA(y("Saved Views"),y("Saved views is only available in pro version"),[],this.data.vueInstance,"feature_lock_saved_views");return}this.data.showSaveViewDialog=!0}_resetLiveFilter(){this.data.search="",this.data.searching=!1,this.data.advanceFilters=[[]],this.data.filterType="simple",I.set(this.getFilterTypeStorageName(),"simple")}_prefillFiltersFromParams(e){if(e){if(e.filter_type==="advanced"&&e.advanced_filters){let i;try{i=typeof e.advanced_filters=="string"?JSON.parse(e.advanced_filters):e.advanced_filters}catch{i=[[]]}this.data.advanceFilters=Array.isArray(i)?i:[[]],this.data.search="",this.data.searching=!1,this.data.filterType="advanced"}else this.data.search=e.search||"",this.data.advanceFilters=[[]],this.data.searching=!!e.search,this.data.filterType="simple",e.active_view&&(this.data.selectedView=e.active_view);I.set(this.getFilterTypeStorageName(),this.data.filterType)}}_buildViewQueryParams(){const e={filter_type:this.data.filterType};return this.data.filterType==="advanced"?e.advanced_filters=JSON.stringify(this.data.advanceFilters):(e.search=this.data.search,e.active_view=this.data.selectedView),e}_getFallbackViewId(){const e=this.getTabs()||{},i=this.getDefaultView();if(e.hasOwnProperty(i))return i;const s=Object.keys(e)[0];if(s)return s;const a=this.data.savedViews[0];return a?a.slug:i}saveCurrentView(e,i,s){if(this.data.savedViews.length>=20)return j.error(y("Maximum of 20 saved views reached")),null;const a=this._buildViewQueryParams();return q.post("saved-views",{object_type:this.getTableName(),name:e,description:i||"",is_public:s||!1,query_params:a}).then(r=>{const v=r.view;v.object_type=this.getTableName(),this.data.savedViews.push(v),this._syncGlobalSavedViews(),this.data.activeSavedViewId=v.slug,this.data.savedViewQueryParams=v.query_params,this._resetLiveFilter(),this.data.selectedView=this.getDefaultView(),I.set(this.getTabStorageName(),v.slug),W.pushToVueUrl(null,{active_view:v.slug})}).catch(r=>{var v;j.error(((v=r.data)==null?void 0:v.message)||y("Failed to save view"))})}applySavedView(e){const i=this.data.savedViews.find(s=>s.slug===e);i&&(this.data.activeSavedViewId=e,this.data.savedViewQueryParams=i.query_params,this._resetLiveFilter(),this.data.selectedView=this.getDefaultView(),this.data.paginate.current_page=1,this.setCurrentPage(1),I.set(this.getTabStorageName(),e),W.pushToVueUrl(null,{active_view:e}),this.fetch())}updateSavedView(e){const i=this.data.savedViews.find(a=>a.slug===e);if(!i)return;const s=this._buildViewQueryParams();q.put("saved-views/"+i.id,{query_params:s}).then(a=>{i.query_params=s}).catch(a=>{var r;j.error(((r=a.data)==null?void 0:r.message)||y("Failed to update view"))})}deleteSavedView(e){const i=this.data.savedViews.find(s=>s.slug===e);i&&q.delete("saved-views/"+i.id).then(()=>{const s=this.data.savedViews.findIndex(a=>a.slug===e);if(s!==-1&&this.data.savedViews.splice(s,1),this._syncGlobalSavedViews(),this.data.activeSavedViewId===e){const a=this._getFallbackViewId(),r=this.data.savedViews.find(v=>v.slug===a);this.data.activeSavedViewId=r?r.slug:null,this.data.savedViewQueryParams=r?r.query_params:null,this.data.selectedView=r?this.getDefaultView():a,this.data.filterType="simple",this.data.advanceFilters=[[]],this.data.search="",this.data.searching=!1,I.set(this.getFilterTypeStorageName(),"simple"),I.set(this.getTabStorageName(),a),W.pushToVueUrl(null,{active_view:a}),this.fetch()}}).catch(s=>{var a;j.error(((a=s.data)==null?void 0:a.message)||y("Failed to delete view"))})}renameSavedView(e,i){const s=this.data.savedViews.find(a=>a.slug===e);s&&q.put("saved-views/"+s.id,{name:i}).then(a=>{s.name=i,this._syncGlobalSavedViews()}).catch(a=>{var r;j.error(((r=a.data)==null?void 0:r.message)||y("Failed to rename view"))})}_syncGlobalSavedViews(){if(window.fluentCartAdminApp&&window.fluentCartAdminApp.table_config){const e=this.getTableName();window.fluentCartAdminApp.table_config[e]||(window.fluentCartAdminApp.table_config[e]={}),window.fluentCartAdminApp.table_config[e].saved_views=this.data.savedViews}}isColumnVisible(e){return this.data.columns.includes(e)}getSearchHint(){throw new Error("Override getSearchHint method")}getFetchUrl(){throw new Error("Override getFetchUrl method")}getTabs(){throw new Error("Override getTabs method")}getTabsCount(){const e=this.getTabs()||{};return Object.keys(e).length+this.getSavedViews().length}getToggleableColumns(){throw new Error("Override getToggleableColumns method")}getSortableColumns(){return[]}getRegisteredSortableColumns(){const e=Y.get(window,`fluentCartAdminApp.table_config.${this.getTableName()}.filters.sorts`)||{};return Object.keys(e).map(i=>({value:i,label:e[i]}))}getSortOptions(){const e=this.getSortableColumns()||[],i=this.getRegisteredSortableColumns().filter(s=>!e.some(a=>a.value===s.value));return[...e,...i]}getTableName(){throw new Error("Override getTableName method")}parseResponse(e){throw new Error("Override parseResponse method")}with(){return[]}scopes(){return[]}isRouteActiveViewApplied(){return ie().query.active_view||!1}isRouteSearchApplied(){return ie().query.search||!1}guessNextPageCount(e){const{total:i,to:s,per_page:a,current_page:r,last_page:v}=e;if(r>=v)return 1;const f=i-s;return Math.max(1,Math.min(a,f))}get nextPageCount(){return this.data.nextPageCount}guessTitle(){let e=this.getTableName();return e=e.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase(),e=e.replace(/_?table$/,""),e.split("_").map(i=>i.charAt(0).toLowerCase()+i.slice(1)).join(" ")}isFiltering(){return this.data.activeSavedViewId?"saved_view":this.isUsingAdvanceFilter()?(this.data.advanceFilters||[]).some(e=>Array.isArray(e)&&e.length>0)?"advanced":!1:this.data.search!==""?"search":this.data.selectedView!=="all"?"tab":!1}emptyMessageFiltered(e){return e==="search"||e==="tab"?y("No %s found based on your search",this.guessTitle()):y("No %s found based on your filter",this.guessTitle())}getEmptyMessage(){return y("No %s found",this.guessTitle())}get emptyMessage(){const e=this.isFiltering();return e?this.emptyMessageFiltered(e):this.getEmptyMessage()}getCustomColumns(){return Y.get(window,`fluentCartAdminApp.table_config.${this.getTableName()}.filters.columns`)||{}}}const Ke={props:{table:{type:Object,required:!1},pagerSizes:{type:Boolean,default:!0},pagination:{required:!0,type:Object},extra_sizes:{required:!1,type:Array,default(){return[]}},hide_on_single:{required:!1,type:Boolean,default(){return!0}},background:{type:Boolean,default:!0},layout:{type:String,default:"prev, pager, next, slot"},pager_count:{type:Number,default:5}},data(){return{currentPage:1,pickerObserver:null,paginationUpdating:!1}},computed:{page_sizes(){const t=[];this.pagination.per_page<10&&t.push(this.pagination.per_page);const l=[10,20,50,80,100,120,150];return[...t,...l,...this.extra_sizes]},totalPage(){const t=this.pagination.per_page,l=this.pagination.total;return isNaN(l)||l<=0?0:Math.ceil(l/t)}},watch:{pagination:{immediate:!0,handler(t,l){setTimeout(()=>{this.translatePickerElements()},400)}},"pagination.last_page":{handler(t,l){t!==l&&(this.paginationUpdating=!0,this.$nextTick(()=>{this.paginationUpdating=!1}))},flush:"sync"}},mounted(){this.translatePickerElements()},methods:{translateNumber:ce,translate:y,changePage(t){var e;if(this.paginationUpdating)return;let l=this.getCurrentPageCount(t,this.pagination.per_page);this.currentPage=t,this.pagination.current_page=t,this.$emit("currentPageChanged",{page:t,currentPageCount:l}),this.$emit("fetch"),(e=this.table)==null||e.handlePageChange(),setTimeout(()=>{this.translatePickerElements()},300)},changeSize(t){var l;this.currentPage=1,this.pagination.current_page=1,this.$emit("onPerPageChanged",t),this.$emit("fetch"),(l=this.table)==null||l.handlePerPageChange()},getCurrentPageCount(t,l){return(t<this.pagination.last_page?l:this.pagination.total%l)||l},translatePickerElements(){const t=document.querySelector(".el-pagination.is-background");if(!t)return;t.querySelectorAll("li.number").forEach(i=>{const s=i.textContent.trim();if(s&&/\d/.test(s)&&!i.dataset.translated){const a=ce(s);i.style.setProperty("--translated-number",`"${a}"`),i.dataset.translated="1"}})}}},Xe={class:"pagination-wrap"},Le={key:0,class:"pager-wrap"},et={class:"text"},tt={class:"el-pagination"},at={class:"text"};function lt(t,l,e,i,s,a){const r=w("el-option"),v=w("el-select"),f=w("el-pagination");return n(),h("div",Xe,[e.pagerSizes?(n(),h("div",Le,[o("span",et,p(a.translate("Page %1$s of %2$s",a.translateNumber(s.currentPage),a.translateNumber(a.totalPage))),1),o("div",tt,[d(v,{onChange:a.changeSize,modelValue:e.pagination.per_page,"onUpdate:modelValue":l[0]||(l[0]=g=>e.pagination.per_page=g),placeholder:a.translate("Select")},{default:m(()=>[(n(!0),h(x,null,U(a.page_sizes,g=>(n(),T(r,{key:g,label:a.translate("%s / page",a.translateNumber(g)),value:g},null,8,["label","value"]))),128))]),_:1},8,["onChange","modelValue","placeholder"])]),o("span",at,p(a.translate("Total %s",a.translateNumber(e.pagination.total))),1)])):S("",!0),d(f,{ref:"paginationRef","hide-on-single-page":e.hide_on_single,background:e.background,"current-page":e.pagination.current_page,layout:e.layout,onCurrentChange:a.changePage,"page-sizes":a.page_sizes,total:e.pagination.total,"pager-count":e.pager_count,"page-size":e.pagination.per_page},{default:m(g=>[A(p(g),1)]),_:1},8,["hide-on-single-page","background","current-page","layout","onCurrentChange","page-sizes","total","pager-count","page-size"])])}const it=K(Ke,[["render",lt]]),st={class:"filter-popover-item"},nt={class:"filter-popover-title"},me={__name:"ColumnVisibility",props:{table:Object},setup(t){return(l,e)=>{const i=w("el-checkbox"),s=w("el-checkbox-group"),a=w("el-tooltip"),r=w("el-popover");return n(),T(r,{trigger:"click",placement:"bottom-start",width:"240","popper-class":"filter-popover"},{reference:m(()=>[o("span",null,[d(a,{effect:"light",content:l.$t("Toggle columns"),placement:"top","popper-class":"fct-tooltip"},{default:m(()=>[d(Z,{tag:"button"},{default:m(()=>[d(B,{name:"ColumnIcon"})]),_:1})]),_:1},8,["content"])])]),default:m(()=>[o("div",st,[o("h3",nt,p(l.$t("Columns")),1),d(s,{onChange:e[0]||(e[0]=()=>{t.table.handleColumnVisibilityChange()}),class:"fct-checkbox-blocks",modelValue:t.table.data.columns,"onUpdate:modelValue":e[1]||(e[1]=v=>t.table.data.columns=v)},{default:m(()=>[(n(!0),h(x,null,U(t.table.getToggleableColumns(),v=>(n(),T(i,{key:v.value,value:v.value,label:v.label},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1})}}},rt={class:"filter-popover-item"},ot={class:"filter-popover-title"},fe={__name:"ColumnSort",props:{table:Object},setup(t){return(l,e)=>{const i=w("el-radio"),s=w("el-radio-group"),a=w("el-radio-button"),r=w("el-tooltip"),v=w("el-popover");return n(),T(v,{trigger:"click",placement:"bottom-start",width:"240","popper-class":"filter-popover"},{reference:m(()=>[o("span",null,[d(r,{effect:"light",content:l.$t("Sort"),placement:"top","popper-class":"fct-tooltip"},{default:m(()=>[d(Z,{tag:"button"},{default:m(()=>[d(B,{name:"ArrowUpDown"})]),_:1})]),_:1},8,["content"])])]),default:m(()=>[o("div",rt,[o("h3",ot,p(l.$t("Sort By")),1),d(s,{onChange:e[0]||(e[0]=()=>{t.table.handleSortChange()}),class:"fct-radios-blocks",modelValue:t.table.data.sorting.sortBy,"onUpdate:modelValue":e[1]||(e[1]=f=>t.table.data.sorting.sortBy=f)},{default:m(()=>[(n(!0),h(x,null,U(t.table.getSortOptions(),f=>(n(),T(i,{key:f.value,value:f.value,label:f.label},null,8,["value","label"]))),128))]),_:1},8,["modelValue"]),e[4]||(e[4]=o("hr",null,null,-1)),d(s,{onChange:e[2]||(e[2]=()=>{t.table.handleSortChange()}),size:"small",modelValue:t.table.data.sorting.sortType,"onUpdate:modelValue":e[3]||(e[3]=f=>t.table.data.sorting.sortType=f)},{default:m(()=>[d(a,{value:"ASC"},{default:m(()=>[A(p(l.$t("Ascending")),1)]),_:1}),d(a,{value:"DESC"},{default:m(()=>[A(p(l.$t("Descending")),1)]),_:1})]),_:1},8,["modelValue"])])]),_:1})}}},dt={__name:"FluidTab",props:{activeIndex:null,hasIcon:{type:Boolean,default:!1},small:{type:Boolean,default:!1}},setup(t,{expose:l}){const e=t,i=P(null),s=P(0),a=P(0),r=P(0),v=P(0),f=P(null);let g=null;const $=C=>{if(!i.value||!C)return;const D=i.value.getBoundingClientRect(),{left:E,width:O,height:N,top:V}=C.getBoundingClientRect();s.value=E-D.left,a.value=V-D.top,r.value=O,v.value=N},c=()=>{f.value&&$(f.value)},b=M(()=>({left:`${s.value}px`,top:`${a.value}px`,width:`${r.value}px`,height:`${v.value}px`})),F=C=>{!i.value||!C||($(C),f.value=C,typeof ResizeObserver<"u"&&(g||(g=new ResizeObserver(()=>{f.value&&$(f.value)})),g.disconnect(),g.observe(C)))},_=C=>{if(!i.value)return;const D=i.value.children;D[C]&&F(D[C])},u=()=>{J(()=>{if(!i.value)return;const C=i.value.children,D=Array.from(C).find(E=>E.classList.contains("active"));D&&F(D)})},k=C=>f.value===C;return l({setActiveByActiveClass:u,setActiveByIndex:_}),oe("setActiveItem",F),oe("isActiveItem",k),window.addEventListener("resize",c),ee(()=>{J(()=>{e.activeIndex?_(e.activeIndex-1):u()})}),ve(()=>{window.removeEventListener("resize",c),g&&g.disconnect()}),(C,D)=>(n(),h("div",{class:z(`fct-fluid-tab ${t.hasIcon?"is-icon":""} ${t.small?"small":""}`),ref_key:"tab",ref:i},[o("div",{class:"fct-fluid-tab-active-bar",style:ke(b.value)},null,4),R(C.$slots,"default")],2))}},ct={name:"FluidTabItem",inject:["setActiveItem","isActiveItem"],props:{label:String,requiredConfirmation:{type:Boolean,default:!1},onClick:{type:Function,default:null}},data(){return{isActive:!1}},mounted(){this.updateActive()},updated(){this.isActive=this.isActiveItem(this.$refs.btn)},methods:{clicked(){if(this.requiredConfirmation){typeof this.onClick=="function"&&this.onClick(this.updateActive);return}this.updateActive(),this.$emit("click")},updateActive(){var t;(t=this.$refs)!=null&&t.btn&&this.setActiveItem(this.$refs.btn),this.isActive=this.isActiveItem(this.$refs.btn)}}};function ut(t,l,e,i,s,a){return n(),h("span",{class:"fct-fluid-tab-item",onClick:l[0]||(l[0]=(...r)=>a.clicked&&a.clicked(...r)),ref:"btn"},[e.label?(n(),h(x,{key:0},[A(p(e.label),1)],64)):R(t.$slots,"default",{key:1})],512)}const ge=K(ct,[["render",ut]]),ht={class:"inline-flex items-center gap-1"},mt={key:0,xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"opacity-40"},ft={key:0,style:{display:"flex","align-items":"center","justify-content":"space-between",width:"100%"}},gt={class:"select-label"},pt={key:0,class:"select-desc"},vt=["onClick"],bt={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{opacity:"0.6"}},yt={key:1},_t={class:"select-label"},wt={class:"select-desc"},Vt={__name:"FilterTabs",props:{table:Object},setup(t){const l=t,e=P(""),i=M(()=>{const _=l.table.getTabs()||{},u=Object.entries(_),C=l.table.getSavedViews().map(V=>[V.slug,{title:V.name,isCustomView:!0,viewId:V.slug,description:V.description||"",is_public:V.is_public,owner_id:V.owner_id}]),D=[...u,...C];let E=D.slice(0,4);const O=Object.fromEntries(E),N=Object.fromEntries(D.filter(([V])=>!O.hasOwnProperty(V)));return{visibleTabs:O,excludedTabs:N}}),s=M(()=>Object.entries(i.value.visibleTabs).map(([_,u])=>typeof u=="object"?[_,u.title,u.description||"",u.is_public?"1":"0"].join(":"):`${_}:${u}`).join("|")),a=P(null);let r=null;const v=()=>{J(()=>{r&&clearTimeout(r),r=setTimeout(()=>{if(!a.value)return;const _=l.table.getActiveSavedViewId();if(_&&i.value.excludedTabs.hasOwnProperty(_)){e.value=_,a.value.setActiveByIndex(-1);return}a.value.setActiveByActiveClass()},50)})};ee(()=>{const _=l.table.getActiveSavedViewId();_&&i.value.excludedTabs.hasOwnProperty(_)?e.value=_:i.value.excludedTabs.hasOwnProperty(l.table.getSelectedTab())&&(e.value=l.table.getSelectedTab()),v()}),ve(()=>{r&&clearTimeout(r)}),X(()=>l.table.data.activeSavedViewId,_=>{_&&i.value.excludedTabs.hasOwnProperty(_)&&(e.value=_),v()}),X(s,()=>{v()});const f=(_,u)=>{const k=l.table.getActiveSavedViewId();return u&&u.isCustomView?k===u.viewId:!k&&l.table.getSelectedTab()===_},g=(_,u)=>{l.table.isUsingAdvanceFilter()&&!(u&&u.isCustomView)||(u&&u.isCustomView?(l.table.applySavedView(u.viewId),i.value.excludedTabs.hasOwnProperty(u.viewId)||(e.value="")):(l.table.handleTabChanged(_),i.value.excludedTabs.hasOwnProperty(l.table.getSelectedTab())||(e.value="")))},$=_=>{const u=i.value.excludedTabs[_];u&&u.isCustomView?l.table.applySavedView(u.viewId):l.table.isUsingAdvanceFilter()||l.table.handleTabChanged(_)},c=()=>{setTimeout(()=>{const _=l.table.getActiveSavedViewId();let u=-1;if(!_){const k=Object.keys(i.value.visibleTabs).indexOf(l.table.getSelectedTab());u=k!==-1?k+1:-1}a.value.setActiveByIndex(u)},50)},b=async(_,u)=>{try{const{value:k}=await ae.prompt(y("Enter a new name"),y("Rename View"),{confirmButtonText:y("Save"),cancelButtonText:y("Cancel"),inputValue:u,inputValidator:C=>!!(C!=null&&C.trim())||y("Name is required")});k&&k.trim()&&l.table.renameSavedView(_,k.trim())}catch{}},F=async _=>{try{await ae.confirm(y("Are you sure you want to delete this view?"),y("Delete View"),{confirmButtonText:y("Delete"),cancelButtonText:y("Cancel"),type:"warning"}),l.table.deleteSavedView(_),e.value===_&&(e.value="")}catch{}};return(_,u)=>{const k=w("el-dropdown-item"),C=w("el-dropdown-menu"),D=w("el-dropdown"),E=w("el-tooltip"),O=w("el-option"),N=w("el-select");return n(),T(dt,{class:z(t.table.isUsingAdvanceFilter()&&!t.table.getActiveSavedViewId()?"is-disabled":""),ref_key:"fluidTab",ref:a},{default:m(()=>[(n(!0),h(x,null,U(i.value.visibleTabs,(V,H)=>(n(),T(ge,{key:H,class:z(f(H,V)?"active":""),"aria-pressed":f(H,V),onClick:()=>g(H,V)},{default:m(()=>[V&&V.isCustomView?(n(),T(E,{key:0,content:V.description||"",disabled:!V.description,placement:"top",effect:"light","popper-class":"fct-tooltip"},{default:m(()=>[o("span",ht,[o("span",null,p(V.title),1),V.is_public?(n(),h("svg",mt,u[4]||(u[4]=[o("circle",{cx:"12",cy:"12",r:"10"},null,-1),o("path",{d:"M2 12h20"},null,-1),o("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"},null,-1)]))):S("",!0),t.table.isViewOwner(V)?(n(),T(D,{key:1,trigger:"click",onCommand:le=>{le==="rename"?b(V.viewId,V.title):le==="delete"&&F(V.viewId)},onClick:u[1]||(u[1]=Q(()=>{},["stop"]))},{dropdown:m(()=>[d(C,null,{default:m(()=>[d(k,{command:"rename"},{default:m(()=>[A(p(_.$t("Rename")),1)]),_:1}),d(k,{command:"delete",divided:""},{default:m(()=>[A(p(_.$t("Delete")),1)]),_:1})]),_:1})]),default:m(()=>[o("span",{class:"inline-flex items-center text-system-light cursor-pointer opacity-50 hover:opacity-100 dark:text-gray-400 [&_svg]:w-3 [&_svg]:h-3",onClick:u[0]||(u[0]=Q(()=>{},["stop"]))},[d(B,{name:"ChevronDown"})])]),_:2},1032,["onCommand"])):S("",!0)])]),_:2},1032,["content","disabled"])):(n(),h(x,{key:1},[A(p(typeof V=="object"?V.title:V),1)],64))]),_:2},1032,["class","aria-pressed","onClick"]))),128)),Object.keys(i.value.excludedTabs).length>0?(n(),T(ge,{key:0,class:"fct-fluid-tab-select-wrap"},{default:m(()=>[d(N,{placeholder:G(y)("More views"),modelValue:e.value,"onUpdate:modelValue":u[2]||(u[2]=V=>e.value=V),onChange:$,onVisibleChange:u[3]||(u[3]=V=>{V||c()}),class:z(["w-[120px]",{active:e.value}]),"popper-class":"fct-fluid-tab-select"},{default:m(()=>[(n(!0),h(x,null,U(i.value.excludedTabs,(V,H)=>(n(),T(O,{key:H,label:typeof V=="object"?V.title:V,value:H},{default:m(()=>[V&&V.isCustomView?(n(),h("div",ft,[o("div",null,[o("div",gt,p(V.title),1),V.description?(n(),h("div",pt,p(V.description),1)):S("",!0)]),t.table.isViewOwner(V)?(n(),h("span",{key:0,style:{display:"inline-flex","align-items":"center",cursor:"pointer",padding:"2px"},onClick:Q(le=>F(V.viewId),["stop"])},[(n(),h("svg",bt,u[5]||(u[5]=[o("polyline",{points:"3 6 5 6 21 6"},null,-1),o("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"},null,-1)])))],8,vt)):S("",!0)])):typeof V=="object"?(n(),h("div",yt,[o("div",_t,p(V.title),1),o("div",wt,p(V.description),1)])):(n(),h(x,{key:2},[A(p(V),1)],64))]),_:2},1032,["label","value"]))),128))]),_:1},8,["placeholder","modelValue","class"])]),_:1})):S("",!0)]),_:1},8,["class"])}}},St={key:0,class:"fct-alert-icon"},Ct={__name:"Alert",props:{type:{type:String,default:""},content:{type:String,default:""},icon:{type:String,default:""},closable:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:l}){const e=t,i=M(()=>({"fct-alert":!0,"fct-alert-info":e.type==="info","fct-alert-success":e.type==="success","fct-alert-warning":e.type==="warning","fct-alert-error":e.type==="error"})),s=l,a=()=>{s("close")};return(r,v)=>(n(),h("div",{class:z(i.value)},[t.icon?(n(),h("div",St,[d(B,{name:t.icon},null,8,["name"])])):S("",!0),r.$slots.content?R(r.$slots,"content",{key:1}):(n(),h(x,{key:2},[A(p(t.content),1)],64)),t.closable?(n(),h("div",{key:3,class:"fct-alert-close",onClick:a},[d(B,{name:"Cross"})])):S("",!0),R(r.$slots,"default")],2))}},kt={class:"fct-search-guide-wrap"},Tt={class:"fct-search-guide-example"},$t={class:"fct-search-guide-list"},At={class:"fct-search-guide-example"},Ft={class:"fct-search-guide-list"},xt={class:"fct-search-guide-note"},Pt={class:"fct-search-guide-example"},It={class:"fct-search-guide-examples-list"},Ot={key:0},Nt=["onClick"],Dt={class:"example-query"},Ut={class:"click-hint"},Bt={class:"fct-search-guide-example"},Et={class:"fct-search-guide-examples-list"},jt=["onClick"],zt={class:"example-query"},qt={class:"example-description"},Mt={key:0,class:"example-description"},Rt={key:0,class:"click-hint"},pe={__name:"SearchGuide",props:{table:{type:Object,required:!0}},setup(t){const l=P(!1),e=P("examples"),i=t,s=a=>{i.table.data.search=a,i.table.search(),l.value=!1};return(a,r)=>{const v=w("el-button"),f=w("el-tag"),g=w("el-tab-pane"),$=w("el-tabs"),c=w("el-dialog");return n(),h(x,null,[d(v,{class:"fct-search-guide-btn",link:"",size:"small",onClick:r[0]||(r[0]=b=>l.value=!0)},{default:m(()=>[A(p(a.$t("Search Help")),1)]),_:1}),d(c,{modelValue:l.value,"onUpdate:modelValue":r[2]||(r[2]=b=>l.value=b),title:a.$t("Search Operators Guide"),"append-to-body":!0,class:"fct-search-guide-dialog"},{default:m(()=>[o("div",kt,[o("div",Tt,[o("h5",null,p(a.$t("Available Operators")),1),o("ul",$t,[o("li",null,[d(f,{type:"info"},{default:m(()=>[A("> "+p(a.$t("Greater Than")),1)]),_:1})]),o("li",null,[d(f,{type:"info"},{default:m(()=>[A("< "+p(a.$t("Less Than")),1)]),_:1})]),o("li",null,[d(f,{type:"info"},{default:m(()=>[A(">= "+p(a.$t("Greater Than or Equal")),1)]),_:1})]),o("li",null,[d(f,{type:"info"},{default:m(()=>[A("<= "+p(a.$t("Less Than or Equal")),1)]),_:1})]),o("li",null,[d(f,{type:"info"},{default:m(()=>[A("= "+p(a.$t("Equal")),1)]),_:1})]),o("li",null,[d(f,{type:"info"},{default:m(()=>[A("!= "+p(a.$t("Not Equal")),1)]),_:1})])])]),o("div",At,[o("h5",null,p(a.$t("Wildcard Matching (= and != only)")),1),o("ul",Ft,[o("li",null,[d(f,{type:"info"},{default:m(()=>[A("value* "+p(a.$t("Starts with")),1)]),_:1})]),o("li",null,[d(f,{type:"info"},{default:m(()=>[A("*value "+p(a.$t("Ends with")),1)]),_:1})]),o("li",null,[d(f,{type:"info"},{default:m(()=>[A("*value* "+p(a.$t("Contains")),1)]),_:1})])]),o("p",xt,p(a.$t("Use * as a wildcard with = or != operators. Example: sku = ABC*")),1)]),d(Ct,{icon:"InformationFill",type:"info",content:a.$t("Note: For plain text searches, simply type your query without operators. The system will search across all text fields.")},null,8,["content"]),d($,{modelValue:e.value,"onUpdate:modelValue":r[1]||(r[1]=b=>e.value=b),class:"demo-tabs"},{default:m(()=>[d(g,{label:a.$t("Examples"),name:"examples"},{default:m(()=>[o("div",Pt,[o("div",It,[(n(!0),h(x,null,U(t.table.getSearchGuideOptions(),(b,F)=>{var _;return n(),h(x,{key:F},[(_=b.examples)!=null&&_.length?(n(),h("h5",Ot,p(G(y)("Field: ")+F),1)):S("",!0),(n(!0),h(x,null,U(b.examples,(u,k)=>(n(),h("div",{key:k,class:"fct-search-guide-example-item",onClick:()=>{s(u)}},[o("div",null,[o("div",Dt,p(u),1)]),o("div",Ut,p(a.$t("Click to try")),1)],8,Nt))),128))],64)}),128))])])]),_:1},8,["label"]),d(g,{label:a.$t("Fields"),name:"fields"},{default:m(()=>[o("div",Bt,[o("div",Et,[(n(!0),h(x,null,U(t.table.getSearchGuideOptions(),(b,F)=>{var _;return n(),h("div",{key:F,class:"fct-search-guide-example-item",onClick:()=>{Array.isArray(b.examples)&&b.examples.length>0&&s(b.examples[0])}},[o("div",null,[o("div",zt,p(F),1),o("div",qt,p(b.description),1),b.note?(n(),h("div",Mt,p(b.note),1)):S("",!0)]),(_=b.examples)!=null&&_.length?(n(),h("div",Rt,p(a.$t("Click to try")),1)):S("",!0)],8,jt)}),128))])])]),_:1},8,["label"])]),_:1},8,["modelValue"])])]),_:1},8,["modelValue","title"])],64)}}},Ht={class:"relative"},Qt={key:0,class:"absolute top-0 left-0 w-full h-full"},Gt={class:"h-full w-full"},Wt={__name:"RemoteTreeSelect",props:ne({table:{type:Object,required:!0},itemConfig:{type:Object,required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const l=t,e=re(t,"modelValue"),i=P(""),s=P(l.itemConfig.options??[]),a=P(!1),r=async()=>{i.value.toString().length===0&&s.value.length>0||(a.value=!0,q.get("advance_filter/get-filter-options",{search:i.value,remote_data_key:l.itemConfig.remote_data_key,include_ids:e.value,limit:l.itemConfig.limit}).then(f=>{s.value=f.options}).catch(f=>{j.error(f)}).finally(()=>{a.value=!1}))},v=f=>{i.value=f,r()};return ee(()=>{typeof s.value=="object"&&Object.values(s.value).length>0||r()}),(f,g)=>{const $=w("el-tree-select"),c=Te("loading");return n(),h("div",Ht,[d($,{modelValue:e.value,"onUpdate:modelValue":g[0]||(g[0]=b=>e.value=b),data:s.value,multiple:"",filterable:"","check-strictly":t.itemConfig.check_strictly||!1,"show-checkbox":"","reserve-keyword":!1,"filter-method":G(De).debounce(v,500),"render-after-expand":!0,size:"small",onChange:g[1]||(g[1]=()=>{t.table.applyAdvancedFilter()})},null,8,["modelValue","data","check-strictly","filter-method"]),a.value?(n(),h("div",Qt,[be(o("div",Gt,null,512),[[c,!0]])])):S("",!0)])}}},Yt={class:"flex items-center gap-2",style:{"flex-wrap":"nowrap","min-width":"0"}},Jt={key:0,class:"terms-group",style:{flex:"1","min-width":"0",display:"flex","align-items":"stretch"}},Zt={__name:"CascadingSelect",props:ne({table:{type:Object,required:!0},itemConfig:{type:Object,required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const l=t,e=re(t,"modelValue"),i=P([]),s=P([]),a=P(!1),r=P(null),v=P([]),f=P([]),g=P(!1),$=P([]),c=P("any");e.value&&e.value.group_id&&(r.value=e.value.group_id,$.value=e.value.term_ids||[],c.value=e.value.match||"any");const b=()=>{if(s.value.length){i.value=s.value;return}a.value=!0,q.get("advance_filter/get-filter-options",{remote_data_key:"attr_groups"}).then(k=>{s.value=k.options||[],i.value=s.value}).catch(k=>{j.error(k)}).finally(()=>{a.value=!1})},F=k=>{if(!k){v.value=[],f.value=[];return}if(f.value.length){v.value=f.value;return}g.value=!0,q.get("advance_filter/get-filter-options",{remote_data_key:"attr_terms",parent_id:k}).then(C=>{r.value===k&&(f.value=C.options||[],v.value=f.value)}).catch(C=>{j.error(C)}).finally(()=>{r.value===k&&(g.value=!1)})},_=(k=!0)=>{if(!r.value){const C=!!e.value;e.value=null,k&&C&&l.table.applyAdvancedFilter();return}e.value={group_id:r.value,term_ids:$.value,match:c.value},k&&l.table.applyAdvancedFilter()};X(r,(k,C)=>{k!==C&&($.value=[],v.value=[],f.value=[],c.value="any"),F(k),_(!1)}),X($,()=>{_()}),X(c,()=>{_()});const u=M(()=>!!r.value);return ee(()=>{b(),r.value&&F(r.value)}),(k,C)=>{const D=w("el-option"),E=w("el-select");return n(),h("div",Yt,[d(E,{modelValue:r.value,"onUpdate:modelValue":C[0]||(C[0]=O=>r.value=O),loading:a.value,placeholder:G(y)("Select attribute"),filterable:"",clearable:"",size:"small",style:{width:"160px","flex-shrink":"0"}},{default:m(()=>[(n(!0),h(x,null,U(i.value,O=>(n(),T(D,{key:O.id,value:O.id,label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue","loading","placeholder"]),r.value?(n(),h("div",Jt,[d(E,{modelValue:$.value,"onUpdate:modelValue":C[1]||(C[1]=O=>$.value=O),loading:g.value,placeholder:G(y)("Select terms"),multiple:"",filterable:"",size:"small",style:{flex:"1","min-width":"0"}},{default:m(()=>[(n(!0),h(x,null,U(v.value,O=>(n(),T(D,{key:O.id,value:O.id,label:O.title},null,8,["value","label"]))),128))]),_:1},8,["modelValue","loading","placeholder"]),u.value?(n(),T(E,{key:0,modelValue:c.value,"onUpdate:modelValue":C[2]||(C[2]=O=>c.value=O),disabled:$.value.length<2,size:"small",class:"match-select",style:{width:"80px","flex-shrink":"0"}},{default:m(()=>[d(D,{value:"any",label:"OR"}),d(D,{value:"all",label:"AND"})]),_:1},8,["modelValue","disabled"])):S("",!0)])):S("",!0)])}}},Kt={__name:"SelectItem",props:ne({table:{type:Object,required:!0},itemConfig:{type:Object,required:!0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const l=t,e=re(t,"modelValue"),i=P({}),s=P(!1),a=M(()=>l.itemConfig.remote?i.value:l.itemConfig.options||{}),r=async f=>{l.itemConfig.remote&&(s.value=!0,q.get("advance_filter/get-filter-options",{search:f,remote_data_key:l.itemConfig.remote_data_key,include_ids:e.value,limit:l.itemConfig.limit}).then(g=>{i.value=g.options}).catch(g=>{j.error(g),i.value={}}).finally(()=>{s.value=!1}))},v=()=>{l.table.applyAdvancedFilter()};return ee(()=>{r("")}),(f,g)=>{const $=w("el-option"),c=w("el-select");return t.itemConfig.options||t.itemConfig.remote?(n(),T(c,{key:0,onChange:v,"remote-method":r,size:"small",modelValue:e.value,"onUpdate:modelValue":g[0]||(g[0]=b=>e.value=b),multiple:t.itemConfig.is_multiple,placeholder:G(y)("Select Option"),remote:!0,filterable:t.itemConfig.remote,"remote-show-suffix":t.itemConfig.remote,loading:s.value},{default:m(()=>[(n(!0),h(x,null,U(a.value,(b,F)=>(n(),T($,{key:F,value:F,label:b},null,8,["value","label"]))),128))]),_:1},8,["modelValue","multiple","placeholder","filterable","remote-show-suffix","loading"])):S("",!0)}}},Xt={name:"FilterItem",components:{SelectItem:Kt,RemoteTreeSelect:Wt,CascadingSelect:Zt,DynamicIcon:B,IconButton:Z},props:["item","filterLabels","table"],data(){return{}},computed:{operatorOptionsNative(){var s,a,r;const t=((s=this.itemConfig)==null?void 0:s.type)||"text",l=(a=this.itemConfig)==null?void 0:a.filter_type,e=(r=this.itemConfig)==null?void 0:r.operators;if(l==="custom"&&e)return e;const i={text:{"=":this.$t("Equal"),"!=":this.$t("Doesn't equal"),contains:this.$t("Includes"),not_contains:this.$t("Doesn't includes")},numeric:{">":this.$t("Greater Than"),"<":this.$t("Less Than"),"=":this.$t("Equal"),"!=":this.$t("Doesn't equal")},remote_tree_select:{contains:this.$t("Includes"),not_contains:this.$t("Doesn't includes")},dates:{before:this.$t("Before"),after:this.$t("After"),date_equal:this.$t("At the date"),days_before:this.$t("Days before"),days_within:this.$t("Within days")}};return t==="cascading_select"?{in:this.$t("Includes"),not_in:this.$t("Excludes")}:t==="selections"?this.itemConfig.is_multiple?{in:{title:this.$t("Includes any of"),description:this.$t("At least one matches")},in_all:{title:this.$t("Includes all of"),description:this.$t("All must match")},not_in:{title:this.$t("Exclude if any"),description:this.$t("Exclude if one matches")},not_in_all:{title:this.$t("Exclude if all"),description:this.$t("Exclude only if all match")}}:this.itemConfig.is_only_in?{in:this.$t("Includes in")}:{"=":this.$t("Is"),"!=":this.$t("Is Not")}:Y.get(i,t,{})},operatorOptions(){return this.operatorOptionsNative},itemConfig(){const t=this.item.source.join("-");return this.filterLabels[t]||{}}},mounted(){if(!this.item.operator){const t=Object.keys(this.operatorOptions);t.length&&(this.item.operator=t[0],jQuery(this.$el).find(".fct-filter-value input").focus(),jQuery(this.$el).find(".fct-filter-operator .el-select").trigger("click"))}},methods:{removeItem(){this.$emit("removeItem")},getProviderLabel(t){return t?(t=t.replace(/_/g," ").replace(/-/g," "),t.charAt(0).toUpperCase()+t.slice(1)):""},operatorSelected(t){!t&&this.item.operator&&setTimeout(()=>{jQuery(this.$el).find(".fct-filter-value input").focus()},200)},applyFilter(){setTimeout(()=>{this.table.applyAdvancedFilter()},200)}}},Lt={class:"w-[250px] fct-filter-label"},ea={class:"fct-filter-operator w-[190px]"},ta={key:0,class:"fct-operator-description p-2"},aa={style:{"padding-left":"8px"}},la={class:"fct-filter-value"},ia={class:"w-[40px] text-right fct-filter-action"};function sa(t,l,e,i,s,a){const r=w("el-option"),v=w("el-select"),f=w("el-input"),g=w("el-date-picker"),$=w("SelectItem"),c=w("RemoteTreeSelect"),b=w("CascadingSelect"),F=w("DynamicIcon"),_=w("IconButton");return n(),h("tr",null,[o("td",Lt,[A(p(a.getProviderLabel(a.itemConfig.provider))+" ",1),l[9]||(l[9]=o("span",{class:"fct-provider-separator"},"/",-1)),A(" "+p(a.itemConfig.label),1)]),o("td",ea,[d(v,{size:"small",placeholder:t.$t("Select Operator"),modelValue:e.item.operator,"onUpdate:modelValue":l[0]||(l[0]=u=>e.item.operator=u),onVisibleChange:a.operatorSelected,onChange:l[1]||(l[1]=()=>{const u=typeof e.item.value=="object"?Object.values(e.item.value):e.item.value;(Array.isArray(u)&&u>0||u.toString().length>0)&&e.table.applyAdvancedFilter()})},{default:m(()=>[(n(!0),h(x,null,U(a.operatorOptions,(u,k)=>(n(),h(x,{key:k},[typeof u=="string"?(n(),T(r,{key:0,value:k,label:u},null,8,["value","label"])):(n(),T(r,{key:1,style:{height:"auto"},value:k,label:u.title},{default:m(()=>[u.description?(n(),h("p",ta,[o("span",null,[A(p(u.title)+" ",1),l[10]||(l[10]=o("br",null,null,-1)),o("span",aa,"- "+p(u.description),1)])])):S("",!0)]),_:2},1032,["value","label"]))],64))),128))]),_:1},8,["placeholder","modelValue","onVisibleChange"])]),o("td",la,[!a.itemConfig.type||a.itemConfig.type==="text"?(n(),T(f,{key:0,size:"small",placeholder:t.$t("Condition Value"),type:"text",modelValue:e.item.value,"onUpdate:modelValue":l[2]||(l[2]=u=>e.item.value=u),onKeydown:L(a.applyFilter,["enter"])},null,8,["placeholder","modelValue","onKeydown"])):a.itemConfig.type==="numeric"?(n(),T(f,{key:1,size:"small",type:"number",placeholder:t.$t("Condition Value"),modelValue:e.item.value,"onUpdate:modelValue":l[3]||(l[3]=u=>e.item.value=u),onKeydown:L(a.applyFilter,["enter"])},null,8,["placeholder","modelValue","onKeydown"])):a.itemConfig.type==="dates"?(n(),h(x,{key:2},[e.item.operator==="days_before"||e.item.operator==="days_within"?(n(),T(f,{key:0,size:"small",type:"number",placeholder:t.$t("Days"),modelValue:e.item.value,"onUpdate:modelValue":l[4]||(l[4]=u=>e.item.value=u),onKeydown:L(a.applyFilter,["enter"])},null,8,["placeholder","modelValue","onKeydown"])):e.item.operator?(n(),T(g,{key:1,onChange:a.applyFilter,type:"datetime","value-format":"YYYY-MM-DDTHH:mm:ssZ",size:"small",modelValue:e.item.value,"onUpdate:modelValue":l[5]||(l[5]=u=>e.item.value=u)},null,8,["onChange","modelValue"])):S("",!0)],64)):S("",!0),a.itemConfig.type==="selections"?(n(),T($,{key:3,table:e.table,"item-config":a.itemConfig,modelValue:e.item.value,"onUpdate:modelValue":l[6]||(l[6]=u=>e.item.value=u)},null,8,["table","item-config","modelValue"])):S("",!0),a.itemConfig.type==="remote_tree_select"?(n(),T(c,{key:4,table:e.table,"item-config":a.itemConfig,modelValue:e.item.value,"onUpdate:modelValue":l[7]||(l[7]=u=>e.item.value=u)},null,8,["table","item-config","modelValue"])):S("",!0),a.itemConfig.type==="cascading_select"?(n(),T(b,{key:5,table:e.table,"item-config":a.itemConfig,modelValue:e.item.value,"onUpdate:modelValue":l[8]||(l[8]=u=>e.item.value=u)},null,8,["table","item-config","modelValue"])):S("",!0)]),o("td",ia,[d(_,{onClick:a.removeItem,size:"x-small",bg:"info",tag:"button"},{default:m(()=>[d(F,{name:"Delete"})]),_:1},8,["onClick"])])])}const na=K(Xt,[["render",sa]]),ra={name:"CascaderPanel",components:{TransitionAccordion:ye},props:{options:{type:Array,required:!0},modelValue:{type:Array,default:()=>[]}},emits:["update:modelValue","change"],data(){return{openPanel:null}},methods:{toggleOpen(t){this.openPanel=this.openPanel===t?null:t},selectOption(t,l){const e=[t,l];this.$emit("update:modelValue",e),this.$emit("change",e),this.openPanel=null}}},oa={class:"fct-cascader-panel"},da=["onClick"],ca={class:"fct-cascader-content"},ua=["onClick"];function ha(t,l,e,i,s,a){const r=w("TransitionAccordion");return n(),h("div",oa,[(n(!0),h(x,null,U(e.options,v=>(n(),h("div",{key:v.value,class:"fct-cascader-option"},[o("div",{class:"fct-cascader-button",onClick:f=>a.toggleOpen(v.value)},p(v.label),9,da),d(r,{visible:s.openPanel===v.value},{default:m(()=>[be(o("ul",ca,[(n(!0),h(x,null,U(v.children,f=>(n(),h("li",{class:"fct-cascader-item",key:f.value,onClick:g=>a.selectOption(v.value,f.value)},p(f.label),9,ua))),128))],512),[[$e,s.openPanel===v.value]])]),_:2},1032,["visible"])]))),128))])}const ma=K(ra,[["render",ha]]),fa={class:"fct-advanced-filters"},ga={key:0,class:"w-full"},pa={class:"fct-advanced-filter-intro"},va={class:"fct-cascader-panel-wrap"},ba={class:"px-2"},ya={__name:"_Filters",props:{table:{required:!0},items:{type:Array,default:()=>[]},filtersLength:{type:Number},filterOptions:{type:Array,default:()=>[]},filterIndex:{type:Number,required:!0}},setup(t){const l=t,e=P(null),i=P([]),s=P(!1),a=M(()=>{const f={};return l.filterOptions.forEach(g=>{g.children&&g.children.forEach($=>{f[`${g.value}-${$.value}`]={provider:g.value,...$}})}),f}),r=f=>{if(i.value.length===2){const g=l.filterOptions.find(c=>c.value===f[0]),$=g==null?void 0:g.children.find(c=>c.value===f[1]);$&&(l.items.push({source:[...i.value],filter_type:$.filter_type,operator:"",value:"",column:$.column,relation:$.relation}),s.value=!1,J(()=>{e.value&&e.value.hide()}),i.value=[])}},v=f=>{J(()=>{l.items.splice(f,1),l.table.applyAdvancedFilter(!0)})};return(f,g)=>{const $=w("el-cascader-panel"),c=w("el-button"),b=w("el-popover");return n(),h("div",fa,[t.items.length?(n(),h("table",ga,[o("tbody",null,[(n(!0),h(x,null,U(t.items,(F,_)=>(n(),T(na,{table:t.table,key:_,filterLabels:a.value,item:F,onRemoveItem:u=>v(_)},null,8,["table","filterLabels","item","onRemoveItem"]))),128))])])):S("",!0),o("div",pa,[d(b,{placement:"right",width:"450","popper-class":"fct-advanced-filter-popover",trigger:"click",ref_key:"popoverRef",ref:e},{reference:m(()=>[d(c,{class:"el-button--x-small"},{default:m(()=>[d(B,{name:"Plus"}),A(" "+p(f.$t("Add")),1)]),_:1})]),default:m(()=>[o("div",va,[d(ma,{options:t.filterOptions,modelValue:i.value,"onUpdate:modelValue":g[0]||(g[0]=F=>i.value=F),onChange:r},null,8,["options","modelValue"]),d($,{style:{width:"100%"},options:t.filterOptions,modelValue:i.value,"onUpdate:modelValue":g[1]||(g[1]=F=>i.value=F),onChange:r},null,8,["options","modelValue"])])]),_:1},512),o("span",ba,p(f.$t("Add new properties")),1),t.items.length===0?(n(),T(Z,{key:0,onClick:g[2]||(g[2]=()=>{t.table.removeAdvanceFilterGroup(t.filterIndex)}),class:"float-end",size:"x-small",bg:"info",tag:"button",disabled:t.filtersLength<=1},{default:m(()=>[d(B,{name:"Delete"})]),_:1},8,["disabled"])):S("",!0)])])}}},_a={class:"fct-advanced-filter-container"},wa={class:"fct-advanced-filter-wrap"},Va={key:0,class:"fct-condition-or-wrap"},Sa={class:"fct-condition-or"},Ca={class:"fct-condition-or-wrap"},ka={class:"fct-advanced-filter-footer justify-end"},Ta={__name:"AdvancedFilter",props:{table:Object,showSaveView:{type:Boolean,default:!0}},setup(t){const l=t,e=M(()=>(l.table.data.advanceFilters||[]).some(s=>Array.isArray(s)&&s.length>0)),i=()=>{l.table.promptAndSaveView()};return(s,a)=>{const r=w("el-button");return n(),T(ye,{visible:t.table.isUsingAdvanceFilter()},{default:m(()=>[o("div",_a,[o("div",wa,[(n(!0),h(x,null,U(t.table.data.advanceFilters,(v,f)=>(n(),h("div",{class:"fct-advanced-filter",key:f},[d(ya,{filterIndex:f,table:t.table,items:v,filtersLength:t.table.data.advanceFilters.length,filterOptions:t.table.getAdvanceFilterOptions()},null,8,["filterIndex","table","items","filtersLength","filterOptions"]),f<t.table.data.advanceFilters.length-1?(n(),h("div",Va,[o("div",Sa,p(s.$t("or")),1)])):S("",!0)]))),128))]),o("div",Ca,[o("div",{class:"fct-condition-or",onClick:a[0]||(a[0]=v=>t.table.addAdvanceFilterGroup())},[d(B,{name:"Plus"}),A(" "+p(s.$t("or")),1)])]),o("div",ka,[d(r,{onClick:a[1]||(a[1]=()=>t.table.clearAdvanceFilter()),text:"",class:"el-button--x-small"},{default:m(()=>[A(p(s.$t("Reset")),1)]),_:1}),d(r,{onClick:a[2]||(a[2]=()=>t.table.applyAdvancedFilter()),type:"primary",class:"el-button--x-small"},{default:m(()=>[A(p(s.$t("Apply")),1)]),_:1}),t.showSaveView?(n(),T(r,{key:0,onClick:i,text:"",class:"el-button--x-small",disabled:!e.value},{default:m(()=>[d(B,{name:"Plus"}),A(" "+p(s.$t("Save as view")),1)]),_:1},8,["disabled"])):S("",!0)])])]),_:1},8,["visible"])}}},$a={class:"fct-filter-tabs-mobile"},Aa={key:0},Fa={class:"select-label"},xa={class:"select-desc"},Pa={class:"flex items-center justify-between w-full"},Ia={class:"text-sm text-system-dark dark:text-gray-50"},Oa=["onClick"],Na={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",style:{opacity:"0.6"}},Da={__name:"FilterTabsMobile",props:{table:Object},setup(t){const l=t,e=async a=>{try{await ae.confirm(y("Are you sure you want to delete this view?"),y("Delete View"),{confirmButtonText:y("Delete"),cancelButtonText:y("Cancel"),type:"warning"}),l.table.deleteSavedView(a)}catch{}},i=M({get(){const a=l.table.getActiveSavedViewId();return a||l.table.getSelectedTab()},set(){}}),s=a=>{l.table.getSavedViews().some(v=>v.slug===a)?l.table.applySavedView(a):l.table.isUsingAdvanceFilter()||l.table.handleTabChanged(a)};return(a,r)=>{const v=w("el-option"),f=w("el-select");return n(),h("div",$a,[d(f,{modelValue:i.value,"onUpdate:modelValue":r[0]||(r[0]=g=>i.value=g),onChange:r[1]||(r[1]=g=>{s(g)}),"popper-class":"fct-fluid-tab-select",size:"small"},{default:m(()=>[(n(!0),h(x,null,U(t.table.getTabs()||{},(g,$)=>(n(),T(v,{key:$,label:g.title||g,value:$},{default:m(()=>[typeof g=="object"?(n(),h("div",Aa,[o("div",Fa,p(g.title),1),o("div",xa,p(g.description),1)])):(n(),h(x,{key:1},[A(p(g),1)],64))]),_:2},1032,["label","value"]))),128)),(n(!0),h(x,null,U(t.table.getSavedViews(),g=>(n(),T(v,{key:g.slug,label:g.name,value:g.slug},{default:m(()=>[o("div",Pa,[o("span",Ia,p(g.name),1),t.table.isProActive()&&t.table.isViewOwner(g)?(n(),h("span",{key:0,style:{display:"inline-flex","align-items":"center",cursor:"pointer",padding:"2px"},onClick:Q($=>e(g.slug),["stop"])},[(n(),h("svg",Na,r[2]||(r[2]=[o("polyline",{points:"3 6 5 6 21 6"},null,-1),o("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"},null,-1)])))],8,Oa)):S("",!0)])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue"])])}}},Ua={class:"fct-card"},Ba={class:"fct-card-header-top"},Ea={class:"fct-card-header-left flex-1"},ja={class:"fct-mobile-header-actions md:hidden"},za={class:"fct-btn-group sm"},qa={key:1},Ma={class:"flex items-center justify-between pt-1"},Ra={class:"text-xs text-system-light dark:text-gray-300"},Ha={class:"fct-card-header-actions"},Qa={key:0,class:"fct-advanced-filter-toggle-wrapper"},Ga={class:"fct-btn-group sm hidden md:flex"},Wa={key:0,class:"filter-search-wrap"},Ya={class:"search-bar"},Ja={class:"flex items-center justify-between pt-2"},Za={class:"text-xs text-system-light dark:text-gray-300"},Ka={class:"fct-card-body"},Xa={class:"fct-table-wrapper-inner"},La={key:0,class:"block md:hidden"},el={class:"flex items-center gap-2"},tl={class:"text-sm text-system-mid dark:text-gray-300"},al={class:"dialog-footer"},$l={__name:"TableWrapper",props:{table:Object,classicTabStyle:!1,hasMobileSlot:!1},setup(t){const l=t,e=Ae("search-input"),i=()=>{l.table.openSearch(),J(()=>{e.value.focus()})},s=Fe({name:"",description:"",is_public:!1}),a=()=>{s.name="",s.description="",s.is_public=!1,l.table.promptAndSaveView()},r=c=>{c.style.overflow="hidden",c.style.height="auto",c.style.visibility="hidden",c.style.position="absolute"},v=(c,b)=>{const F=c.scrollHeight+"px";c.style.position="",c.style.visibility="",c.style.height="0",c.style.paddingTop="0",c.style.opacity="0",c.offsetHeight,c.style.transition="height 0.25s ease, padding-top 0.25s ease, opacity 0.25s ease",c.style.height=F,c.style.paddingTop="",c.style.opacity="1",c.addEventListener("transitionend",()=>{c.style.height="",c.style.overflow="",c.style.transition="",b()},{once:!0})},f=c=>{c.style.height=c.scrollHeight+"px",c.style.overflow="hidden",c.offsetHeight},g=(c,b)=>{c.style.transition="height 0.25s ease, padding-top 0.25s ease, opacity 0.25s ease",c.style.height="0",c.style.paddingTop="0",c.style.opacity="0",c.addEventListener("transitionend",()=>{c.style.height="",c.style.paddingTop="",c.style.overflow="",c.style.transition="",b()},{once:!0})},$=()=>{if(!s.name||!s.name.trim()){j.error(y("Name is required"));return}if(s.name.trim().length>50){j.error(y("Name must be 50 characters or fewer"));return}const c=l.table.saveCurrentView(s.name.trim(),s.description.trim(),s.is_public);c&&c.then&&c.then(()=>{l.table.data.showSaveViewDialog=!1})};return(c,b)=>{var O;const F=w("el-tooltip"),_=w("el-input"),u=w("el-button"),k=w("el-switch"),C=w("el-form-item"),D=w("el-form"),E=w("el-dialog");return n(),h("div",{class:z(["fct-table-wrapper",t.hasMobileSlot?"fct-table-wrapper-mobile":""])},[o("div",Ua,[o("div",{class:z(["fct-card-header",t.table.useFullWidthSearch()?"is-full-width-search":""])},[o("div",Ba,[o("div",Ea,[t.table.getTabsCount()&&!t.table.isUsingAdvanceFilter()?(n(),T(Vt,{key:0,class:z(`hide-animation-on-mobile hidden md:inline-flex ${t.classicTabStyle?"classic-tab-style":""}`),table:t.table},null,8,["class","table"])):S("",!0),o("div",ja,[t.table.getTabsCount()&&!t.table.isUsingAdvanceFilter()?(n(),T(Da,{key:0,table:t.table},null,8,["table"])):S("",!0),o("div",za,[!t.table.isSearching()&&!t.table.useFullWidthSearch()?(n(),T(F,{key:0,effect:"light",content:c.$t("Search"),placement:"top","popper-class":"fct-tooltip"},{default:m(()=>[d(Z,{tag:"button",onClick:Q(i,["prevent"]),disabled:!t.table.isUsingSimpleFilter()},{default:m(()=>[d(B,{name:"Search"})]),_:1},8,["disabled"])]),_:1},8,["content"])):S("",!0),t.table.getToggleableColumns().length?(n(),T(me,{key:1,table:t.table},null,8,["table"])):S("",!0),t.table.getSortOptions().length?(n(),T(fe,{key:2,table:t.table},null,8,["table"])):S("",!0)])]),t.table.useFullWidthSearch()&&!t.table.isUsingAdvanceFilter()?(n(),h("div",qa,[o("div",{class:z(`search-bar is-transparent ${t.table.isUsingAdvanceFilter()?"is-unable-advanced-filter":""}`)},[d(_,{placeholder:c.$t("Search"),ref:"search-input",onClear:b[0]||(b[0]=()=>{t.table.search()}),onKeyup:b[1]||(b[1]=L(()=>{t.table.search()},["enter"])),modelValue:t.table.data.search,"onUpdate:modelValue":b[2]||(b[2]=N=>t.table.data.search=N),type:"text",clearable:""},{prefix:m(()=>[d(B,{name:"Search"})]),_:1},8,["placeholder","modelValue"])],2),o("div",Ma,[o("div",Ra,[A(p(t.table.getSearchHint())+" ",1),(O=t.table.getSearchGuideOptions())!=null&&O.length?(n(),T(pe,{key:0,table:t.table},null,8,["table"])):S("",!0)]),d(u,{text:"",class:"el-button--x-small",onClick:a,disabled:!t.table.data.search},{default:m(()=>[d(B,{name:"Plus"}),A(" "+p(c.$t("Save as view")),1)]),_:1},8,["disabled"])])])):S("",!0)]),o("div",Ha,[t.table.isAdvanceFilterEnabled()?(n(),h("div",Qa,[d(k,{class:"fct-advanced-filter-toggle",onChange:b[3]||(b[3]=N=>{t.table.onFilterTypeChanged(N)}),"active-value":"advanced","inactive-value":"simple",modelValue:t.table.data.filterType,"onUpdate:modelValue":b[4]||(b[4]=N=>t.table.data.filterType=N),"active-text":c.$t("Advanced Filter"),size:"small"},null,8,["modelValue","active-text"])])):S("",!0),o("div",Ga,[!t.table.isSearching()&&!t.table.useFullWidthSearch()?(n(),T(F,{key:0,effect:"light",content:c.$t("Search"),placement:"top","popper-class":"fct-tooltip"},{default:m(()=>[d(Z,{tag:"button",onClick:Q(i,["prevent"]),disabled:!t.table.isUsingSimpleFilter()},{default:m(()=>[d(B,{name:"Search"})]),_:1},8,["disabled"])]),_:1},8,["content"])):S("",!0),t.table.getToggleableColumns().length?(n(),T(me,{key:1,table:t.table},null,8,["table"])):S("",!0),t.table.getSortOptions().length?(n(),T(fe,{key:2,table:t.table},null,8,["table"])):S("",!0)])])]),d(Ta,{table:t.table},null,8,["table"]),d(xe,{css:!1,onBeforeEnter:r,onEnter:v,onBeforeLeave:f,onLeave:g},{default:m(()=>[t.table.isSearching()&&!t.table.useFullWidthSearch()?(n(),h("div",Wa,[o("div",Ya,[d(_,{ref:"search-input",onClear:b[5]||(b[5]=()=>{t.table.search()}),onKeyup:b[6]||(b[6]=L(()=>{t.table.search()},["enter"])),modelValue:t.table.data.search,"onUpdate:modelValue":b[7]||(b[7]=N=>t.table.data.search=N),type:"text",placeholder:c.$t("Search"),clearable:""},{prefix:m(()=>[d(B,{name:"Search"})]),_:1},8,["modelValue","placeholder"]),o("div",Ja,[o("div",Za,[A(p(t.table.getSearchHint())+" ",1),d(pe,{table:t.table},null,8,["table"])]),d(u,{text:"",class:"el-button--x-small",onClick:a,disabled:!t.table.data.search},{default:m(()=>[d(B,{name:"Plus"}),A(" "+p(c.$t("Save as view")),1)]),_:1},8,["disabled"])])]),d(u,{text:"",onClick:b[8]||(b[8]=()=>{t.table.closeSearch()})},{default:m(()=>[A(p(c.$t("Cancel")),1)]),_:1})])):S("",!0)]),_:1})],2),o("div",Ka,[o("div",Xa,[o("div",{class:z({"hidden md:block":t.hasMobileSlot,block:!t.hasMobileSlot})},[R(c.$slots,"default")],2),t.hasMobileSlot?(n(),h("div",La,[R(c.$slots,"mobile")])):S("",!0),d(it,{table:t.table,hide_on_single:!1,pagination:t.table.data.paginate},null,8,["table","pagination"])])])]),d(E,{modelValue:t.table.data.showSaveViewDialog,"onUpdate:modelValue":b[13]||(b[13]=N=>t.table.data.showSaveViewDialog=N),title:c.$t("Save View"),width:"420px","close-on-click-modal":!1,"append-to":"#fct_admin_app_wrapper"},{footer:m(()=>[o("div",al,[d(u,{onClick:b[12]||(b[12]=N=>t.table.data.showSaveViewDialog=!1)},{default:m(()=>[A(p(c.$t("Cancel")),1)]),_:1}),d(u,{type:"primary",onClick:$},{default:m(()=>[A(p(c.$t("Save")),1)]),_:1})])]),default:m(()=>[d(D,{"label-position":"top",onSubmit:Q($,["prevent"])},{default:m(()=>[d(C,{label:c.$t("Name")},{default:m(()=>[d(_,{modelValue:s.name,"onUpdate:modelValue":b[9]||(b[9]=N=>s.name=N),placeholder:c.$t("View name"),maxlength:"50"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),d(C,{label:c.$t("Description")},{default:m(()=>[d(_,{modelValue:s.description,"onUpdate:modelValue":b[10]||(b[10]=N=>s.description=N),placeholder:c.$t("Optional description"),type:"textarea",rows:2},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),d(C,null,{default:m(()=>[o("div",el,[d(k,{modelValue:s.is_public,"onUpdate:modelValue":b[11]||(b[11]=N=>s.is_public=N),size:"small"},null,8,["modelValue"]),o("span",tl,p(c.$t("Make public (visible to all users)")),1)])]),_:1})]),_:1})]),_:1},8,["modelValue","title"])],2)}}},ll={name:"Badge",components:{DynamicIcon:B},props:{status:String,text:{type:String,default:null,required:!1},hideIcon:{type:Boolean,default:!1},size:String,highContrast:{type:Boolean,default:!1},type:String,icon:String},computed:{Str(){return ue},computedStatus(){return this.status||this.type},badgeType(){switch(this.computedStatus){case"completed":case"paid":case"active":case"publish":case"shipped":case"success":case"licensed":case"succeeded":return"success";case"failed":case"error":case"canceled":case"expired":return"danger";case"blue":case"partially_paid":case"intended":return"blue";case"scheduled":case"on-hold":case"pending":case"unpaid":case"warning":case"processing":case"future":return"warning";case"inactive":return"warning";case"dispute":return"warning";default:return"info"}},badgeSize(){return this.size?this.size:""},HighContrast(){return this.highContrast?"is-high-contrast":""}},methods:{getStatusText(){switch(this.computedStatus){case"completed":return y("Completed");case"paid":return y("Paid");case"active":return y("Active");case"publish":return y("Published");case"draft":return y("Draft");case"shipped":return y("Shipped");case"success":return y("Success");case"licensed":return y("Licensed");case"succeeded":return y("Succeeded");case"failed":return y("Failed");case"error":return y("Error");case"canceled":return y("Canceled");case"expired":return y("Expired");case"partially_paid":return y("Partially Paid");case"intended":return y("Intended");case"scheduled":return y("Scheduled");case"on-hold":return y("On Hold");case"pending":return y("Pending");case"unpaid":return y("Unpaid");case"warning":return y("Warning");case"processing":return y("Processing");case"future":return y("Future");case"inactive":return y("Inactive");case"dispute":return y("Dispute");case"disabled":return y("Disabled");case"beta":return y("Beta");default:return ue.headline(this.computedStatus)}}}},il={key:0};function sl(t,l,e,i,s,a){const r=w("DynamicIcon");return n(),h("span",{class:z(`badge ${a.badgeType} ${a.badgeSize} ${a.HighContrast}`)},[e.status||e.text?(n(),h(x,{key:0},[e.icon?(n(),h("span",il,[d(r,{name:e.icon},null,8,["name"])])):S("",!0),e.text?(n(),h(x,{key:1},[A(p(e.text),1)],64)):(n(),h(x,{key:2},[A(p(a.getStatusText()),1)],64))],64)):R(t.$slots,"default",{key:1})],2)}const Al=K(ll,[["render",sl]]);export{Al as B,ge as F,Re as P,Tl as T,$l as _,dt as a,Ct as b,it as c,Ta as d,Vt as e,he as m}; |