PageSourceSearch

https://hou.la/chunk-ERTAKVXR.js

js hou.la collected 2026-10-02 16:00:30 UTC 16,797 bytes, 1 lines download raw bytes

1import{a as ut}from"./chunk-RGWTER5P.js";import{a as St}from"./chunk-ZVCHMNXO.js";import{a as dt,f as ct}from"./chunk-JDYWGDNH.js";import"./chunk-IRONFM6M.js";import"./chunk-VHX354RR.js";import{a as _t,b as Et}from"./chunk-22WJKAIZ.js";import{b as gt}from"./chunk-SLWPYULI.js";import{b as at,c as rt}from"./chunk-RPDGXIQT.js";import"./chunk-RFHORXFH.js";import"./chunk-44BDWJO3.js";import"./chunk-YPSMJDVJ.js";import"./chunk-F6HJUGGY.js";import{a as pt,b as st}from"./chunk-W6FQLWKF.js";import"./chunk-6MXSXX3N.js";import"./chunk-MT62CIDI.js";import"./chunk-BXNQRMY5.js";import"./chunk-RFCDL6VX.js";import"./chunk-XWDSR7V3.js";import"./chunk-3THAQ3J3.js";import"./chunk-OAED5FIG.js";import{a as tt,b as et}from"./chunk-P37GQ53N.js";import{b as lt,c as mt}from"./chunk-NZ226J7R.js";import"./chunk-7EBKYMB6.js";import"./chunk-YK3HMHC4.js";import"./chunk-2DRXLVRR.js";import{c as nt,e as ot}from"./chunk-OFHUO5H7.js";import"./chunk-M3XSAKW4.js";import"./chunk-H76LZNGX.js";import"./chunk-PGR2NPNS.js";import"./chunk-OZD37XM5.js";import"./chunk-DLIVM562.js";import"./chunk-CV2ZWZQE.js";import"./chunk-AVEXXPAT.js";import{ja as Q}from"./chunk-FHU4TM37.js";import"./chunk-32B64V2R.js";import"./chunk-3XLVKQRY.js";import"./chunk-DJ5AJG3T.js";import"./chunk-SLPC3Y4V.js";import"./chunk-XIRWNEM2.js";import"./chunk-AAORKXGN.js";import"./chunk-KDGXQRVY.js";import{D as q,g as $,l as Z}from"./chunk-Q2KKZV5J.js";import{a as Y}from"./chunk-JICM7NVH.js";import{a as it}from"./chunk-BD6EMWWF.js";import{a as z}from"./chunk-AB6CKZTE.js";import{c as K,d as j,e as J}from"./chunk-DIGPPQJE.js";import"./chunk-EU6HCBUP.js";import{h as U}from"./chunk-KAJMKXZ6.js";import{D as W}from"./chunk-ZAQTNZYS.js";import{c as k}from"./chunk-SRTXE2HR.js";import{Dc as A,Ec as M,Fa as H,Fc as b,Jb as g,Kc as w,Lc as N,Mb as O,Rb as S,Uc as m,Vc as d,Wb as a,Wc as V,Xb as r,Yb as E,Z as F,ac as R,ca as X,da as T,db as o,gc as h,hc as l,la as x,ma as f,p as P,sb as B,uc as s,vc as y,wa as G,wc as _,yb as C}from"./chunk-NTTV6FWH.js";import{a as D,b as L,g as u}from"./chunk-W7GRJBO5.js";var I=class i{constructor(t){this.http=t}api=z.api+"/api/manager/shop/exports";create(t){return u(this,null,function*(){return P(this.http.post(this.api,t))})}list(t=1,e=20){return u(this,null,function*(){return P(this.http.get(this.api,{params:{page:t.toString(),limit:e.toString()}}))})}findOne(t){return u(this,null,function*(){return P(this.http.get(`${this.api}/${t}`))})}downloadFile(t){return u(this,null,function*(){let e=yield P(this.http.get(`${this.api}/${t}/download`,{responseType:"blob"})),p=(yield this.findOne(t)).fileName||`export-${t}.csv`,c=window.URL.createObjectURL(e),v=document.createElement("a");v.href=c,v.download=p,v.click(),window.URL.revokeObjectURL(c)})}static \u0275fac=function(e){return new(e||i)(X(U))};static \u0275prov=F({token:i,factory:i.\u0275fac,providedIn:"root"})};var Tt=()=>({width:"500px"}),xt=()=>({width:"100%"}),Rt=()=>[10,20,50],Ct=i=>({days:i});function yt(i,t){i&1&&E(0,"app-widget-loading")}function Pt(i,t){if(i&1){let e=R();a(0,"app-widget-api-error",9),h("retry",function(){x(e);let p=l();return f(p.loadExports())}),r()}if(i&2){let e=l();g("message",e.error)}}function wt(i,t){if(i&1){let e=R();a(0,"div",10)(1,"div",13)(2,"span",14),E(3,"i",15),s(4),m(5,"translate"),r(),a(6,"span",16),s(7),r()(),a(8,"button",17),h("click",function(){x(e);let p=l(2);return f(p.openCreateDialog())}),E(9,"i",18),s(10),m(11,"translate"),r()()}if(i&2){let e=l(2);o(4),_(" ",d(5,3,"MANAGER.SHOP_EXPORTS.TITLE")," "),o(3),y(e.total),o(3),_(" ",d(11,5,"MANAGER.SHOP_EXPORTS.NEW_EXPORT")," ")}}function Ot(i,t){if(i&1){let e=R();a(0,"app-widget-manager-empty-state",19),h("ctaClick",function(){x(e);let p=l(2);return f(p.openCreateDialog())}),r()}if(i&2){let e=l(2);g("features",e.emptyStateFeatures)}}function At(i,t){i&1&&(a(0,"tr")(1,"th"),s(2),m(3,"translate"),r(),a(4,"th"),s(5),m(6,"translate"),r(),a(7,"th"),s(8),m(9,"translate"),r(),a(10,"th"),s(11),m(12,"translate"),r(),a(13,"th",23),s(14),m(15,"translate"),r(),a(16,"th",24),s(17),m(18,"translate"),r(),a(19,"th",24),s(20),m(21,"translate"),r()()),i&2&&(o(2),y(d(3,7,"MANAGER.SHOP_EXPORTS.COL_DATE")),o(3),y(d(6,9,"MANAGER.SHOP_EXPORTS.COL_TYPE")),o(3),y(d(9,11,"MANAGER.SHOP_EXPORTS.COL_PERIOD")),o(3),y(d(12,13,"MANAGER.SHOP_EXPORTS.COL_STATUS")),o(3),_(" ",d(15,15,"MANAGER.SHOP_EXPORTS.COL_ROWS")," "),o(3),_(" ",d(18,17,"MANAGER.SHOP_EXPORTS.COL_SIZE")," "),o(3),_(" ",d(21,19,"MANAGER.SHOP_EXPORTS.COL_ACTIONS")," "))}function Mt(i,t){i&1&&E(0,"i",29)}function bt(i,t){if(i&1&&E(0,"i",30),i&2){let e=l().$implicit;g("pTooltip",e.errorMessage)}}function It(i,t){if(i&1&&(E(0,"br"),a(1,"small",6),E(2,"i",34),s(3),m(4,"translate"),r()),i&2){let e=l().$implicit,n=l(3);o(3),_(" ",V(4,1,"MANAGER.SHOP_EXPORTS.EXPIRES_IN",N(4,Ct,n.getDaysUntilExpiry(e)))," ")}}function vt(i,t){if(i&1&&s(0),i&2){let e=l().$implicit;_(" ",e.rowCount," ")}}function Dt(i,t){i&1&&(a(0,"span",6),s(1,"-"),r())}function Nt(i,t){if(i&1){let e=R();a(0,"button",35),m(1,"translate"),m(2,"translate"),h("click",function(){x(e);let p=l().$implicit,c=l(3);return f(c.downloadExport(p))}),r()}if(i&2){let e=l().$implicit,n=l(3);g("label",d(1,2,"MANAGER.SHOP_EXPORTS.BTN_DOWNLOAD"))("pTooltip",n.isExpiringSoon(e)?V(2,4,"MANAGER.SHOP_EXPORTS.EXPIRES_IN",N(7,Ct,n.getDaysUntilExpiry(e))):"")}}function Vt(i,t){i&1&&(a(0,"span",32),E(1,"i",36),s(2),m(3,"translate"),r()),i&2&&(o(2),_(" ",d(3,1,"MANAGER.SHOP_EXPORTS.EXPIRED")," "))}function Lt(i,t){i&1&&(a(0,"span",32),E(1,"i",37),s(2),m(3,"translate"),r()),i&2&&(o(2),_(" ",d(3,1,"MANAGER.SHOP_EXPORTS.IN_PROGRESS")," "))}function Ft(i,t){i&1&&(a(0,"span",33),E(1,"i",38),s(2),m(3,"translate"),r()),i&2&&(o(2),_(" ",d(3,1,"MANAGER.SHOP_EXPORTS.FAILED")," "))}function Xt(i,t){if(i&1&&(a(0,"tr")(1,"td",25),s(2),r(),a(3,"td"),E(4,"p-tag",26),r(),a(5,"td",25),s(6),E(7,"i",27),s(8),r(),a(9,"td"),E(10,"p-tag",28),C(11,Mt,1,0,"i",29)(12,bt,1,1,"i",30)(13,It,5,6),r(),a(14,"td",23),C(15,vt,1,1)(16,Dt,2,0,"span",6),r(),a(17,"td",24),s(18),r(),a(19,"td",24),C(20,Nt,3,9,"button",31)(21,Vt,4,3,"span",32)(22,Lt,4,3,"span",32)(23,Ft,4,3,"span",33),r()()),i&2){let e=t.$implicit,n=l(3);o(2),_(" ",n.formatDateFull(e.createdAt)," "),o(2),g("value",n.getTypeLabel(e.type)),o(2),_(" ",n.formatDateShort(e.filters==null?null:e.filters.from)," "),o(2),_(" ",n.formatDateShort(e.filters==null?null:e.filters.to)," "),o(2),g("value",n.getStatusLabel(e.status))("severity",n.getStatusSeverity(e.status)),o(),S(e.status==="processing"?11:-1),o(),S(e.status==="failed"&&e.errorMessage?12:-1),o(),S(e.status==="completed"&&e.expiresAt&&!n.isExpired(e)?13:-1),o(2),S(e.rowCount!==null&&e.rowCount!==void 0?15:16),o(3),_(" ",n.formatFileSize(e.fileSizeBytes)," "),o(2),S(e.status==="completed"&&!n.isExpired(e)?20:e.status==="expired"||n.isExpired(e)?21:e.status==="pending"||e.status==="processing"?22:e.status==="failed"?23:-1)}}function Gt(i,t){if(i&1){let e=R();a(0,"p-table",20),h("onLazyLoad",function(p){x(e);let c=l(2);return f(c.onPageChange(p))}),C(1,At,22,21,"ng-template",21)(2,Xt,24,12,"ng-template",22),r()}if(i&2){let e=l(2);g("value",e.exports)("paginator",e.total>e.limit)("rows",e.limit)("totalRecords",e.total)("lazy",!0)("rowsPerPageOptions",w(6,Rt))}}function Ht(i,t){if(i&1&&C(0,wt,12,7,"div",10)(1,Ot,1,1,"app-widget-manager-empty-state",11)(2,Gt,3,7,"p-table",12),i&2){let e=l();S(e.exports.length>0?0:-1),o(),S(e.exports.length===0?1:-1),o(),S(e.exports.length>0?2:-1)}}function Bt(i,t){if(i&1){let e=R();a(0,"button",39),m(1,"translate"),h("click",function(){x(e);let p=l();return f(p.showCreateDialog=!1)}),r(),a(2,"button",40),m(3,"translate"),h("click",function(){x(e);let p=l();return f(p.createExport())}),r()}if(i&2){let e=l();g("label",d(1,4,"MANAGER.SHOP_EXPORTS.BTN_CANCEL"))("disabled",e.creating),o(2),g("label",d(3,6,"MANAGER.SHOP_EXPORTS.BTN_CREATE"))("loading",e.creating)}}var ft=class i{exportService=T(I);toastService=T(Y);t=T(K);socketService=T(St);ngZone=T(G);platformId=T(H);loading=!0;error=null;exports=[];total=0;page=1;limit=20;showCreateDialog=!1;creating=!1;selectedType="orders_csv";dateRange=[];typeOptions=[{label:"CSV Commandes",value:"orders_csv",i18n:"MANAGER.SHOP_EXPORTS.TYPE_ORDERS_CSV"},{label:"FEC (comptable)",value:"fec",i18n:"MANAGER.SHOP_EXPORTS.TYPE_FEC"},{label:"ZIP Factures",value:"invoices_zip",i18n:"MANAGER.SHOP_EXPORTS.TYPE_INVOICES_ZIP"}];emptyStateFeatures=[{icon:"pi pi-file",iconColor:"#667eea",labelKey:"MANAGER.SHOP_EXPORTS.FEATURE_CSV",descKey:"MANAGER.SHOP_EXPORTS.FEATURE_CSV_DESC"},{icon:"pi pi-calculator",iconColor:"#764ba2",labelKey:"MANAGER.SHOP_EXPORTS.FEATURE_FEC",descKey:"MANAGER.SHOP_EXPORTS.FEATURE_FEC_DESC"},{icon:"pi pi-file-pdf",iconColor:"#f97316",labelKey:"MANAGER.SHOP_EXPORTS.FEATURE_INVOICES",de
1scKey:"MANAGER.SHOP_EXPORTS.FEATURE_INVOICES_DESC"},{icon:"pi pi-clock",iconColor:"#10b981",labelKey:"MANAGER.SHOP_EXPORTS.FEATURE_AUTO",descKey:"MANAGER.SHOP_EXPORTS.FEATURE_AUTO_DESC"}];refreshInterval=null;unsubWs=null;ngOnInit(){this.initDateRange(),this.typeOptions=this.typeOptions.map(t=>L(D({},t),{label:this.t.instant(t.i18n)})),this.loadExports(),k(this.platformId)&&(this.setupWebSocket(),this.refreshInterval=setInterval(()=>{this.exports.some(t=>t.status==="pending"||t.status==="processing")&&this.loadExports()},6e4))}ngOnDestroy(){this.refreshInterval&&clearInterval(this.refreshInterval),this.unsubWs?.()}setupWebSocket(){this.unsubWs=this.socketService.on("shop:export",t=>{this.ngZone.run(()=>{t?.type==="status_changed"&&this.patchExportJob(t)})})}patchExportJob(t){let e=this.exports.findIndex(p=>p.id===t.jobId);if(e===-1){this.loadExports();return}let n=D({},this.exports[e]);n.status=t.status,t.fileName&&(n.fileName=t.fileName),t.rowCount!=null&&(n.rowCount=t.rowCount),t.fileSizeBytes!=null&&(n.fileSizeBytes=t.fileSizeBytes),(t.status==="completed"||t.status==="failed")&&(n.completedAt=new Date().toISOString()),this.exports[e]=n,this.exports=[...this.exports],t.status==="completed"&&this.toastService.success(this.t.instant("MANAGER.SHOP_EXPORTS.EXPORT_READY"))}initDateRange(){let t=new Date,e=new Date;e.setMonth(e.getMonth()-1),e.setDate(1),this.dateRange=[e,t]}loadExports(){return u(this,null,function*(){this.loading=!0,this.error=null;try{let t=yield this.exportService.list(this.page,this.limit);this.exports=t.items,this.total=t.total}catch(t){this.error=t?.message||"Error"}finally{this.loading=!1}})}onPageChange(t){this.page=Math.floor(t.first/t.rows)+1,this.limit=t.rows,this.loadExports()}openCreateDialog(){this.showCreateDialog=!0}createExport(){return u(this,null,function*(){if(!this.dateRange||this.dateRange.length<2||!this.dateRange[0]||!this.dateRange[1]){this.toastService.error(this.t.instant("MANAGER.SHOP_EXPORTS.ERROR_DATE_RANGE"));return}this.creating=!0;try{let t=this.formatDate(this.dateRange[0]),e=this.formatDate(this.dateRange[1]);yield this.exportService.create({type:this.selectedType,from:t,to:e}),this.toastService.success(this.t.instant("MANAGER.SHOP_EXPORTS.CREATE_SUCCESS")),this.showCreateDialog=!1,yield this.loadExports()}catch(t){let e=t?.error?.message||t?.message||"Error";this.toastService.error(e)}finally{this.creating=!1}})}downloadExport(t){return u(this,null,function*(){try{yield this.exportService.downloadFile(t.id)}catch(e){this.toastService.error(e?.message||"Download failed")}})}getStatusSeverity(t){switch(t){case"completed":return"success";case"processing":return"info";case"pending":return"warn";case"failed":return"danger";case"expired":return"secondary";default:return"secondary"}}getStatusLabel(t){return this.t.instant(`MANAGER.SHOP_EXPORTS.STATUS_${t.toUpperCase()}`)}getTypeLabel(t){return this.t.instant(`MANAGER.SHOP_EXPORTS.TYPE_${t.toUpperCase()}`)}formatFileSize(t){return t?t<1024?t+" o":t<1024*1024?(t/1024).toFixed(1)+" Ko":(t/(1024*1024)).toFixed(1)+" Mo":"-"}formatDateShort(t){return t?new Date(t).toLocaleDateString("fr-FR",{day:"2-digit",month:"2-digit",year:"numeric"}):"-"}formatDateFull(t){if(!t)return"-";let e=new Date(t);return e.toLocaleDateString("fr-FR",{day:"2-digit",month:"2-digit",year:"numeric"})+" "+e.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})}isExpiringSoon(t){if(!t.expiresAt||t.status!=="completed")return!1;let e=new Date(t.expiresAt).getTime(),n=Date.now(),p=2*24*60*60*1e3;return e-n<p&&e>n}isExpired(t){return t.expiresAt?new Date(t.expiresAt).getTime()<Date.now():!1}getDaysUntilExpiry(t){if(!t.expiresAt)return 0;let e=new Date(t.expiresAt).getTime()-Date.now();return Math.max(0,Math.ceil(e/(24*60*60*1e3)))}formatDate(t){let e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),p=String(t.getDate()).padStart(2,"0");return`${e}-${n}-${p}`}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=B({type:i,selectors:[["app-view-manager-shop-exports"]],decls:21,vars:30,consts:[[3,"message"],[3,"visibleChange","header","visible","modal","dismissableMask"],[1,"d-flex","flex-column","gap-3","pt-2"],[1,"form-label","fw-semibold"],["optionLabel","label","optionValue","value",3,"ngModelChange","options","ngModel"],["selectionMode","range","dateFormat","dd/mm/yy","appendTo","body",3,"ngModelChange","ngModel","showIcon","maxDate"],[1,"text-muted"],[1,"pi","pi-info-circle","me-1"],["pTemplate","footer"],[3,"retry","message"],[1,"d-flex","justify-content-between","align-items-center","mb-3"],["icon","pi pi-download","titleKey","MANAGER.SHOP_EXPORTS.EMPTY_TITLE","descriptionKey","MANAGER.SHOP_EXPORTS.EMPTY_DESC","ctaLabelKey","MANAGER.SHOP_EXPORTS.CREATE_FIRST","ctaIcon","pi pi-plus",3,"features"],["dataKey","id","styleClass","p-datatable-sm p-datatable-striped","responsiveLayout","scroll",3,"value","paginator","rows","totalRecords","lazy","rowsPerPageOptions"],[1,"d-flex","align-items-center"],[1,"text-light","fs-6"],[1,"pi","pi-download","me-2"],[1,"badge","bg-secondary","ms-2"],["type","button",1,"btn","btn-sm","btn-primary","text-white","mb-0",3,"click"],[1,"pi","pi-plus","me-1"],["icon","pi pi-download","titleKey","MANAGER.SHOP_EXPORTS.EMPTY_TITLE","descriptionKey","MANAGER.SHOP_EXPORTS.EMPTY_DESC","ctaLabelKey","MANAGER.SHOP_EXPORTS.CREATE_FIRST","ctaIcon","pi pi-plus",3,"ctaClick","features"],["dataKey","id","styleClass","p-datatable-sm p-datatable-striped","responsiveLayout","scroll",3,"onLazyLoad","value","paginator","rows","totalRecords","lazy","rowsPerPageOptions"],["pTemplate","header"],["pTemplate","body"],[1,"text-center"],[1,"text-end"],[1,"text-nowrap"],["severity","info",3,"value"],[1,"pi","pi-arrow-right","mx-1",2,"font-size","0.7rem"],[3,"value","severity"],[1,"pi","pi-spin","pi-spinner","ms-2",2,"font-size","0.85rem"],["tooltipPosition","top",1,"pi","pi-info-circle","ms-1","text-danger",3,"pTooltip"],["pButton","","icon","pi pi-download","tooltipPosition","top",1,"p-button-sm","p-button-success",3,"label","pTooltip"],[1,"text-muted","small"],[1,"text-danger","small"],[1,"pi","pi-clock","me-1",2,"font-size","0.7rem"],["pButton","","icon","pi pi-download","tooltipPosition","top",1,"p-button-sm","p-button-success",3,"click","label","pTooltip"],[1,"pi","pi-clock","me-1"],[1,"pi","pi-spin","pi-spinner","me-1"],[1,"pi","pi-times-circle","me-1"],["pButton","",1,"p-button-text",3,"click","label","disabled"],["pButton","","icon","pi pi-download",1,"p-button-primary",3,"click","label","loading"]],template:function(e,n){e&1&&(C(0,yt,1,0,"app-widget-loading")(1,Pt,1,1,"app-widget-api-error",0)(2,Ht,3,3),a(3,"p-dialog",1),m(4,"translate"),b("visibleChange",function(c){return M(n.showCreateDialog,c)||(n.showCreateDialog=c),c}),a(5,"div",2)(6,"div")(7,"label",3),s(8),m(9,"translate"),r(),a(10,"p-select",4),b("ngModelChange",function(c){return M(n.selectedType,c)||(n.selectedType=c),c}),r()(),a(11,"div")(12,"label",3),s(13),m(14,"translate"),r(),a(15,"p-datepicker",5),b("ngModelChange",function(c){return M(n.dateRange,c)||(n.dateRange=c),c}),r()(),a(16,"small",6),E(17,"i",7),s(18),m(19,"translate"),r()(),C(20,Bt,4,8,"ng-template",8),r()),e&2&&(S(n.loading?0:n.error?1:2),o(3),O(w(27,Tt)),g("header",d(4,19,"MANAGER.SHOP_EXPORTS.CREATE_TITLE")),A("visible",n.showCreateDialog),g("modal",!0)("dismissableMask",!0),o(5),_(" ",d(9,21,"MANAGER.SHOP_EXPORTS.LABEL_TYPE")," "),o(2),O(w(28,xt)),g("options",n.typeOptions),A("ngModel",n.selectedType),o(3),_(" ",d(14,23,"MANAGER.SHOP_EXPORTS.LABEL_PERIOD")," "),o(2),O(w(29,xt)),A("ngModel",n.dateRange),g("showIcon",!0)("maxDate",n.dateRange[1]||void 0),o(3),_(" ",d(19,25,"MANAGER.SHOP_EXPORTS.CREATE_HINT")," "))},dependencies:[W,q,$,Z,J,j,ot,nt,Q,ct,dt,Et,_t,et,tt,mt,lt,st,pt,rt,at,it,gt,ut],styles:[".container-items[_ngcontent-%COMP%]   .row[_ngcontent-%COMP%]{transition:background-color .15s}.container-items[_ngcontent-%COMP%]   .row[_ngcontent-%COMP%]:hover{background-color:#f8f9fa}[_nghost-%COMP%]{display:block}"]})};export{ft as ViewManagerShopExportsComponent};

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.