PageSourceSearch

https://facturino.com/assets/ProductsListView-Cv7_EJhL.js

js facturino.com collected 2026-10-02 00:17:26 UTC 9,478 bytes, 1 lines download raw bytes

1import{h as e,w as a,z as t,V as i,n as s,u as l,a8 as o,X as r,F as n,W as u,aa as c,a4 as p,a9 as d,O as m,b as f,f as v,U as g,q as h,ag as y,af as _}from"./vendor-oAkPuYrc.js";import{useProductStore as b}from"./useProductStore-BSVnWO7F.js";import{i as k,u as w,H as C,y as x,e as j,J as P,aI as L,t as V}from"./index-BZekDLOH.js";import{u as R}from"./useTenantRole-FrZWpTTe.js";import{_ as M}from"./DataTable.vue_vue_type_script_setup_true_lang-B1PEpg8z.js";import{_ as S}from"./AmountDisplay.vue_vue_type_script_setup_true_lang-5gYOrJyx.js";import{_ as z}from"./EmptyState.vue_vue_type_script_setup_true_lang-BB4TAozD.js";import{_ as A}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-CA1DGR69.js";import{_ as D}from"./ListFilterBar.vue_vue_type_script_setup_true_lang-B9ejVwgj.js";import{_ as N}from"./MobileCardList.vue_vue_type_script_setup_true_lang-BbpaV1Oc.js";import{_ as T}from"./SwipeableRow.vue_vue_type_script_setup_true_lang-0e6lEKWq.js";import{u as E,_ as U}from"./usePullToRefresh-BojQPjc_.js";import{ac as F}from"./vuetify-1DwLL1X_.js";import"./firebase-D-ZPylk-.js";import"./livemode-BCl9euiE.js";import"./decimal-ChF0ithK.js";import"./decimal-BX0koNkP.js";import"./VTable-DSXoB7U0.js";const q={class:"fc-page fc-page--list animate-in"},H={class:"fc-page-head"},I={class:"fc-page-head-text"},J={class:"fc-page-head-title"},K={key:0,class:"fc-page-head-count"},$={key:0,class:"fc-page-head-actions"},G={key:0,class:"fc-list-card"},O={class:"text-body-2 text-medium-emphasis tabular-nums"},B={style:{"min-width":"0"}},W={class:"font-weight-medium"},X={key:0,class:"text-caption text-medium-emphasis text-truncate",style:{"max-width":"300px"}},Q={class:"tabular-nums"},Y=["onClick","onKeydown"],Z={class:"fc-list-item-icon"},ee={class:"fc-list-item-body"},ae={class:"fc-list-item-title"},te={class:"fc-list-item-subtitle"},ie={class:"fc-list-item-meta"},se={class:"fc-list-item-trail"},le={class:"fc-list-item-amount"},oe=["onClick"],re=["onClick"],ne=e({__name:"ProductsListView",setup(e){const ne=m(),ue=b(),ce=k(),{handleError:pe}=j(),{can:de}=R(),{impact:me}=w(),{mdAndDown:fe}=F(),ve=f(""),ge=f(""),he=f(""),ye=f(!0),_e=f(!1),be=f(!1),ke=f(null),we=[{title:"Référence",key:"reference",sortable:!1},{title:"Nom",key:"name",sortable:!1},{title:"Prix HT",key:"unitPrice",sortable:!1,align:"end"},{title:"TVA",key:"vatRate",sortable:!1,align:"center"},{title:"Unité",key:"unit",sortable:!1},{title:"",key:"actions",sortable:!1,width:140}],Ce={unit:"Pièce",hour:"Heure",day:"Jour",month:"Mois",flat_rate:"Forfait",kg:"kg",m:"m",m2:"m²",m3:"m³",l:"L"},xe=v(()=>{if(!ve.value.trim())return ue.items;const e=ve.value.toLowerCase();return ue.items.filter(a=>a.name.toLowerCase().includes(e)||a.reference?.toLowerCase().includes(e)||a.description?.toLowerCase().includes(e))}),je=v(()=>!(ue.loading||0!==ue.items.length||ge.value||he.value||ve.value));function Pe(){ve.value="",ge.value="",he.value=""}async function Le(){ue.resetList();const e={};ge.value&&(e.category=ge.value),he.value&&(e.tag=he.value);try{await ue.fetchList(e)}catch(a){pe(a)}finally{ye.value=!1}}async function Ve(){const e={};ge.value&&(e.category=ge.value),he.value&&(e.tag=he.value);try{await ue.fetchList(e)}catch(a){pe(a)}}function Re(e){const a=e;ne.push({name:"product-detail",params:{id:a.id}})}function Me(e){ne.push({name:"product-edit",params:{id:e.id}})}const Se=f(!1);function ze(e){ke.value=e,_e.value=!0}async function Ae(){if(ke.value){be.value=!0;try{await ue.softDelete(ke.value.id),await me("warning"),ce.showNotification({message:"Produit supprimé."})}catch(e){await me("error"),pe(e)}finally{be.value=!1,_e.value=!1,ke.value=null}}}a([ge,he],()=>{Le()});const{pullDistance:De,pullProgress:Ne,isRefreshing:Te,registerScrollContainer:Ee,threshold:Ue}=E({onRefresh:()=>Le()});return t(()=>{Le(),Ee(document.scrollingElement)}),(e,a)=>(g(),i("div",q,[s(U,{"pull-distance":l(De),"pull-progress":l(Ne),"is-refreshing":l(Te),threshold:l(Ue)},null,8,["pull-distance","pull-progress","is-refreshing","threshold"]),ye.value?(g(),o(C,{key:0,indeterminate:"",color:"primary",height:2,class:"fc-page-progress"})):r("",!0),ye.value?r("",!0):(g(),i(n,{key:1}
1,[u("header",H,[u("div",I,[a[7]||(a[7]=u("p",{class:"fc-page-head-eyebrow"},"Gestion",-1)),u("h1",J,[a[6]||(a[6]=c(" Produits ",-1)),je.value?r("",!0):(g(),i("span",K,p(xe.value.length)+p(l(ue).hasMore?"+":""),1))]),a[8]||(a[8]=u("p",{class:"fc-page-head-subtitle"}," Gérez votre catalogue de produits et services. ",-1))]),je.value?r("",!0):(g(),i("div",$,[l(de)("editor")?(g(),o(x,{key:0,color:"primary",variant:"flat","prepend-icon":"mdi-plus",rounded:"lg",class:"text-none",to:{name:"product-create"}},{default:d(()=>[...a[9]||(a[9]=[c(" Nouveau produit ",-1)])]),_:1})):r("",!0)]))]),je.value?(g(),o(z,{key:0,variant:"product",title:"Aucun produit pour le moment",description:"Créez votre catalogue de produits et services pour accélérer la saisie de vos factures.","action-label":l(de)("editor")?"Nouveau produit":void 0,onAction:a[0]||(a[0]=e=>l(ne).push({name:"product-create"}))},null,8,["action-label"])):(g(),i(n,{key:1},[s(D,{sticky:"",search:ve.value,"search-placeholder":"Nom, référence, description...","onUpdate:search":a[3]||(a[3]=e=>ve.value=e),onClear:Pe},{default:d(()=>[s(P,{modelValue:ge.value,"onUpdate:modelValue":a[1]||(a[1]=e=>ge.value=e),"prepend-inner-icon":"mdi-shape-outline",placeholder:"Filtrer par catégorie",density:"comfortable",variant:"outlined","hide-details":"",clearable:"",rounded:"lg",style:{flex:"0 0 220px"}},null,8,["modelValue"]),s(P,{modelValue:he.value,"onUpdate:modelValue":a[2]||(a[2]=e=>he.value=e),"prepend-inner-icon":"mdi-tag-outline",placeholder:"Filtrer par tag",density:"comfortable",variant:"outlined","hide-details":"",clearable:"",rounded:"lg",style:{flex:"0 0 220px"}},null,8,["modelValue"])]),_:1},8,["search"]),l(fe)?(g(),o(N,{key:1,items:xe.value,loading:l(ue).loading,"first-load":l(ue).loading&&0===xe.value.length,"has-more":l(ue).hasMore,onLoadMore:Ve},{empty:d(()=>[l(ue).loading?r("",!0):(g(),o(z,{key:0,variant:"no-results",title:"Aucun résultat","action-label":"Effacer les filtres","icon-color":"info",onAction:Pe}))]),item:d(({item:e})=>[s(T,{"reveal-width":180},{actions:d(({close:t})=>[u("button",{type:"button",class:"fc-swipe-action fc-swipe-action--info",onClick:a=>{t(),Me(e)}},[s(V,{size:"20"},{default:d(()=>[...a[11]||(a[11]=[c("mdi-pencil",-1)])]),_:1}),a[12]||(a[12]=u("span",null,"Modifier",-1))],8,oe),u("button",{type:"button",class:"fc-swipe-action fc-swipe-action--danger",onClick:a=>{t(),ze(e)}},[s(V,{size:"20"},{default:d(()=>[...a[13]||(a[13]=[c("mdi-delete-outline",-1)])]),_:1}),a[14]||(a[14]=u("span",null,"Supprimer",-1))],8,re)]),default:d(()=>[u("div",{class:"fc-list-item",role:"button",tabindex:"0",onClick:a=>Re(e),onKeydown:[_(a=>Re(e),["enter"]),_(y(a=>Re(e),["prevent"]),["space"])]},[u("span",Z,[s(V,{size:"18"},{default:d(()=>[...a[10]||(a[10]=[c("mdi-package-variant-closed",-1)])]),_:1})]),u("div",ee,[u("span",ae,p(e.name),1),u("span",te,p(e.reference||e.description||"—"),1),u("span",ie,p(e.vatRate)+" % TVA · "+p(Ce[e.unit]??e.unit),1)]),u("div",se,[u("span",le,[s(S,{amount:e.unitPrice},null,8,["amount"])])])],40,Y)]),_:2},1024)]),_:1},8,["items","loading","first-load","has-more"])):(g(),i("div",G,[s(M,{items:xe.value,headers:we,loading:l(ue).loading,"has-more":l(ue).hasMore,onLoadMore:Ve,"onClick:row":Re},{"item.reference":d(({item:e})=>[u("span",O,p(e.reference||"---"),1)]),"item.name":d(({item:e})=>[u("div",B,[u("span",W,p(e.name),1),e.description?(g(),i("div",X,p(e.description),1)):r("",!0)])]),"item.unitPrice":d(({item:e})=>[s(S,{amount:e.unitPrice,class:"tabular-nums"},null,8,["amount"])]),"item.vatRate":d(({item:e})=>[u("span",Q,p(e.vatRate)+" %",1)]),"item.unit":d(({item:e})=>[u("span",null,p(Ce[e.unit]??e.unit),1)]),"item.actions":d(({item:e})=>[u("div",{class:"d-flex justify-end ga-1",onClick:a[4]||(a[4]=y(()=>{},["stop"]))},[s(L,{text:"Modifier",location:"top"},{activator:d(({props:a})=>[s(x,h(a,{icon:"mdi-pencil",size:"small",variant:"text","aria-label":"Modifier le produit",onClick:a=>Me(e)}),null,16,["onClick"])]),_:2},1024),s(L,{text:"Dupliquer",location:"top"},{activator:d(({props:a})=>[s(x,h(a,{icon:"mdi-content-copy",size:"small",variant:"text","aria-label":"Dupliquer le produit",onClick:a=>async function(e){if(!Se.value){Se.value=!0;try{const a={name:`${e.name} (copie)`,description:e.description,reference:e.reference?`${e.reference}-COPIE`:void 0,unitPrice:e.unitPrice,vatRate:e.vatRate,vatCode:e.vatCode,unit:e.unit,category:e.category,tags:[...e.tags]},t=await ue.create(a);ce.showNotification({message:"Produit dupliqué avec succès."}),ne.push({name:"product-detail",params:{id:t}})}catch(a){pe(a)}finally{Se.value=!1}}}(e)}),null,16,["onClick"])]),_:2},1024),s(L,{text:"Supprimer",location:"top"},{activator:d(({props:a})=>[s(x,h(a,{icon:"mdi-delete",size:"small",variant:"text",color:"error","aria-label":"Supprimer le produit",onClick:a=>ze(e)}),null,16,["onClick"])]),_:2},1024)])]),_:1},8,["items","headers","loading","has-more"])]))],64))],64)),s(A,{modelValue:_e.value,"onUpdate:modelValue":a[5]||(a[5]=e=>_e.value=e),title:"Supprimer ce produit ?",message:`Le produit « ${ke.value?.name??""}
1 » sera supprimé. Les factures existantes utilisant ce produit ne seront pas affectées.`,"confirm-label":"Supprimer",type:"danger",loading:be.value,onConfirm:Ae},null,8,["modelValue","message","loading"])]))}});export{ne 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.