PageSourceSearch

https://www.getgekko.com/static/public/bundles_vue/assets/ImportProjectFilter-CBR-o-te.js

js getgekko.com collected 2026-09-24 09:21:08 UTC 4,148 bytes, 1 lines download raw bytes

1import{r as s,o as l,e as c,g as i,i as d,f as g,c as u,h as m,x as b,y as k,j as I,t as V,n as w,m as C}from"./chunk-vendors-CgL1FIjI.js";import{N as x}from"./sentryApiRejections-B0BgSXf9.js";import{_ as v}from"./i18n-DDYE_4TA.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:"03badf17e0"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2aeae451-5224-4a16-a742-4e5a13dc2d61",e._sentryDebugIdIdentifier="sentry-dbid-2aeae451-5224-4a16-a742-4e5a13dc2d61")}catch{}})();const P={inject:{getFilterMutationName:{default:()=>()=>""}},name:"ProjectListBySelectedCustomer",emits:["filter-updated"],props:{modelValue:{type:Object,default:()=>({})}},data(){return{defaultValue:this.$gettext("All projects"),selected:{id:null,name:this.$gettext("All projects")},search_by_name:"",loading:!1,projects:[],loadedCustomerId:null}},computed:{...C({selectedCustomer:"invoices/getInvoiceCreateRecipient"}),customerId(){return this.selectedCustomer&&this.selectedCustomer.id?this.selectedCustomer.id:null},projectList(){return[{id:null,name:this.$gettext("All projects")},...this.projects]},filteredProjects(){const e=(this.search_by_name||"").toLowerCase();return e?this.projectList.filter(t=>t.name&&t.name.toLowerCase().includes(e)):this.projectList},selectedValue(){return this.selected.name},isSelected(){return this.selectedValue!==this.defaultValue}},watch:{modelValue:{immediate:!0,handler(){this.syncSelectedValue()}},customerId:{immediate:!0,handler(){this.search_by_name="",this.projects=[],this.loadedCustomerId=null,this.selected={id:null,name:this.defaultValue},this.customerId&&this.loadProjects()}},isSelected(e){this.$emit("filter-updated",{name:this.$options.name,value:e})}},methods:{async loadProjects(){if(!this.customerId){this.projects=[],this.syncSelectedValue();return}if(this.loadedCustomerId===this.customerId){this.syncSelectedValue();return}this.loading=!0;try{const e=await x.list({company:this.customerId});this.projects=Array.isArray(e.data)?e.data:[],this.loadedCustomerId=this.customerId}catch{this.projects=[]}finally{this.loading=!1,this.syncSelectedValue()}},async onProjectFilterOpen(){this.customerId&&await this.loadProjects()},syncSelectedValue(){const e=this.modelValue&&this.modelValue.project?this.modelValue.project:null;if(!e){this.selected={id:null,name:this.defaultValue};return}const t=this.projectList.find(n=>n.id===e);this.selected=t||{id:null,name:this.defaultValue}},selectProjectAndStore(e){this.selected=e,this.$store.commit("filterStore/SET_CUSTOMER_PROJECT",{customer:this.customerId||null,project:e.id||null}),this.$store.commit("filterStore/"+this.getFilterMutationName())},resetFilter(){this.selectProjectAndStore({id:null,name:this.defaultValue})}}},D={class:"dropdown-search"};function G(e,t,n,L,a,r){const h=s("GkInput"),p=s("GkDropdownDivider"),f=s("GkLoadingSpinner"),_=s("GkDropdownItem"),y=s("GkScrollbars"),j=s("GkDropdown"),S=s("font-awesome-icon");return l(),c("div",{class:w(["filterbar-item",{selected:r.isSelected}])},[i(j,{id:"project_filter","no-flip":"",text:a.selected.name,variant:"link",block:"",class:"filterbar-item-button","toggle-class":"button-no-shadows text-decoration-none",onShown:r.onProjectFilterOpen},{default:d(()=>[g("div",D,[i(h,{modelValue:a.search_by_name,"onUpdate:modelValue":t[0]||(t[0]=o=>a.search_by_name=o),placeholder:e.$gettext("Search projects")},null,8,["modelValue","placeholder"])]),i(p),a.loading?(l(),u(f,{key:0,"display-text":e.$gettext("Loading projects"),size:"md"},null,8,["display-text"])):m("",!0),i(y,{ref:"projectFilterScrollbar",class:"filterbar-scrollbar"},{default:d(()=>[(l(!0),c(b,null,k(r.filteredProjects,o=>(l(),c("div",{key:o.id},[i(_,{class:"list-item",onClick:A=>r.selectProjectAndStore(o)},{default:d(()=>[I(V(o.name),1)]),_:2},1032,["onClick"])]))),128))]),_:1},512)]),_:1},8,["text","onShown"]),r.isSelected?(l(),u(S,{key:0,icon:"fa-solid fa-circle-xmark",class:"reset-filter",onClick:r.resetFilter},null,8,["onClick"])):m("",!0)],2)}const T=v(P,[["render",G]]);export{T as default};

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.