PageSourceSearch

https://foodfinder.mx/chunk-EGRVVJTX.js

js foodfinder.mx collected 2026-10-02 16:15:19 UTC 10,547 bytes, 20 lines download raw bytes

1import{a as j}from"./chunk-3YJEOFPK.js";import{b as N,c as $,p as X}from"./chunk-Q5B3BLJC.js";import"./chunk-RJSAQQJR.js";import"./chunk-DJY7TLQR.js";import"./chunk-DCQ6K7MS.js";import"./chunk-6XIRPTFG.js";import"./chunk-CDN6YX5H.js";import"./chunk-HJ4QCVAO.js";import"./chunk-D3F2YJ7V.js";import"./chunk-TBB5A4RC.js";import"./chunk-2AGFAF2T.js";import"./chunk-7RHLFJDC.js";import{s as z}from"./chunk-QLVBULEA.js";import"./chunk-2VMYDSIC.js";import"./chunk-DNIVSGA6.js";import{a as G}from"./chunk-DMKEOHTA.js";import{k as V}from"./chunk-YCP52F36.js";import"./chunk-FHDYJKXC.js";import{$b as D,Ab as w,Cb as F,Ja as m,Ka as o,Kb as R,La as r,Qa as T,Ra as U,Ta as I,Va as f,Xa as g,Zb as H,_b as L,bb as k,fb as a,ha as s,hb as u,ic as M,jc as B,mc as A,pa as C,r as x,s as b,tb as O,ua as P,yb as S,za as _}from"./chunk-DBXDUEE4.js";import"./chunk-TAAAIZHL.js";import{e as K}from"./chunk-EQDQRRRY.js";var p=K(G());function q(n,d){let e=n.includes(",")?n.split(",")[1]:n,i=atob(e),t=8192,c=[];for(let l=0;l<i.length;l+=t){let h=i.slice(l,l+t),v=new Uint8Array(h.length);for(let y=0;y<h.length;y++)v[y]=h.charCodeAt(y);c.push(v)}return new Blob(c,{type:d})}function W(n){let d=q(n.base64Content,n.contentType||"application/pdf"),e=URL.createObjectURL(d),i=()=>window.open(e,"_blank")?(setTimeout(()=>URL.revokeObjectURL(e),6e4),"opened"):(URL.revokeObjectURL(e),"blocked");try{let t=document.createElement("iframe");return t.style.position="fixed",t.style.right="0",t.style.bottom="0",t.style.width="0",t.style.height="0",t.style.border="0",t.setAttribute("aria-hidden","true"),t.onload=()=>{try{let c=t.contentWindow;if(!c)throw new Error("iframe sin contentWindow");c.focus(),c.print()}catch(c){i()}setTimeout(()=>{t.remove(),URL.revokeObjectURL(e)},6e4)},t.onerror=()=>{t.remove(),i()},t.src=e,document.body.appendChild(t),"printed"}catch(t){return i()}}function E(n){let d=q(n.base64Content,n.contentType||"application/octet-stream"),e=URL.createObjectURL(d),i=document.createElement("a");i.href=e,i.download=n.fileName||"documento",document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(e)}var J=(n,d)=>({"bg-green-100 text-green-700":n,"bg-red-100 text-red-700":d});function Q(n,d){if(n&1&&(T(0),a(1),S(2,"number"),U()),n&2){let e=g().$implicit;s(),u("$",w(2,1,e.total,"1.2-2"))}}function Y(n,d){n&1&&a(0,"\u2014")}function Z(n,d){if(n&1){let e=I();o(0,"button",24),f("click",function(){x(e);let t=g().$implicit,c=g();return b(c.cancelInvoice(t.invoiceId))}),a(1," Cancelar "),r()}}function ee(n,d){if(n&1){let e=I();o(0,"tr",13)(1,"td",14),a(2),r(),o(3,"td",15),a(4),r(),o(5,"td",15),a(6),S(7,"date"),r(),o(8,"td",16),_(9,Q,3,4,"ng-container",17)(10,Y,1,0,"ng-template",null,0,F),r(),o(12,"td",9)(13,"span",18),a(14),r()(),o(15,"td",15)(16,"div",19)(17,"button",20),f("click",function(){let t=x(e).$implicit,c=g();return b(c.imprimirFactura(t))}),a(18),r(),o(19,"button",21),f("click",function(){let t=x(e).$implicit,c=g();return b(c.descargarPdf(t))}),a(20),r(),o(21,"button",22),f("click",function(){let t=x(e).$implicit,c=g();return b(c.descargarXml(t))}),a(22),r()()(),o(23,"td",9),_(24,Z,2,0,"button",23),r()()}if(n&2){let e=d.$implicit,i=k(11),t=g();s(2),u(" ",e.cfdiUuid||e.invoiceId," "),s(2),u(" #",e.orderId," "),s(2),u(" ",w(7,14,e.createdAt,"dd/MM/yyyy HH:mm")," "),s(3),m("ngIf",e.total!=null)("ngIfElse",i),s(4),m("ngClass",O(17,J,!t.esCancelada(e),t.esCancelada(e))),s(),u(" ",t.esCancelada(e)?"Cancelada":"Vigente"," "),s(3),m("disabled",t.estaOcupada(e)),s(),u(" ",t.busy[e.invoiceId]==="print"?"Preparando\u2026":"Imprimir"," "),s(),m("disabled",t.estaOcupada(e)),s(),u(" ",t.busy[e.invoiceId]==="pdf"?"\u2026":"PDF"," "),s(),m("disabled",t.estaOcupada(e)),s(),u(" ",t.busy[e.invoiceId]==="xml"?"\u2026":"XML"," "),s(2),m("ngIf",!t.esCancelada(e))}}function te(n,d){n&1&&(o(0,"tr")(1,"td",25),a(2," No hay facturas emitidas "),r()())}var ve=(()=>{class n{invoiceService;cdr;allInvoices=[];invoices=[];currentPage=0;itemsPerPage=10;pageSizeOptions=[10,20,50,100];get totalInvoices(){return this.allInvoices.length}busy={};constructor(e,i){this.invoiceService=e,this.cdr=i}ngOnInit(){this.loadInvoices()}loadInvoices(){this.invoiceService.getInvoiceHistory().subscribe({next:e=>{this.allInvoices=e.invoices,this.currentPage=0,this.updatePagination(),this.cdr.detectChanges()},error:()=>{this.cdr.detectChanges()}})}updatePagination(){let e=this.currentPage*this.itemsPerPage,i=e+this.itemsPerPage;this.invoices=this.allInvoices.slice(e,i)}goToPage(e){this.currentPage=e,this.updatePagination(),this.cdr.detectChanges()}onPageSizeChange(e){this.itemsPerPage=e,this.currentPage=0,this.updatePagination(),this.cdr.detectChanges()}esCancelada(e){return String(e?.status??"").toLowerCase()==="cancelled"}estaOcupada(e){return!!this.busy[e?.invoiceId]}conArchivo(e,i,t,c){let l=e?.invoiceId;if(!l||this.busy[l])return;this.busy[l]=t,this.cdr.detectChanges(),(i==="pdf"?this.invoiceService.getInvoicePdf(l):this.invoiceService.getInvoiceXml(l)).subscribe({next:v=>{if(this.busy[l]=void 0,!v?.file?.base64Content){p.default.fire({icon:"error",title:"Archivo vac\xEDo",text:"FiscalAPI no devolvi\xF3 el documento. Intenta de nuevo en un momento."}),this.cdr.detectChanges();return}c(v.file),this.cdr.detectChanges()},error:v=>{this.busy[l]=void 0,this.cdr.detectChanges(),p.default.fire({icon:"error",title:i==="pdf"?"No se pudo obtener el PDF":"No se pudo obtener el XML",text:v?.error?.message||"Revisa tu conexi\xF3n e intenta de nuevo."})}})}imprimirFactura(e){this.conArchivo(e,"pdf","print",i=>{W(i)==="blocked"&&p.default.fire({icon:"warning",title:"El navegador bloque\xF3 la impresi\xF3n",text:"Permite las ventanas emergentes para este sitio, o descarga el PDF e impr\xEDmelo desde ah\xED."})})}descargarPdf(e){this.conArchivo(e,"pdf","pdf",i=>E(i))}descargarXml(e){this.conArchivo(e,"xml","xml",i=>E(i))}cancelInvoice(e){p.default.fire({title:"Cancelar factura",html:`
2      <p class="text-sm text-gray-600 mb-3">
3        Esta acci\xF3n es <b>irreversible</b> y ser\xE1 reportada al SAT.
4      </p>
5
6      <label class="block text-left text-sm mb-1">Motivo de cancelaci\xF3n</label>
7     <select id="reasonCode" class="swal2-input">
8  <option value="">Selecciona un motivo</option>
9  <option value="01">01 - Comprobante emitido con errores (requiere sustituci\xF3n)</option>
10  <option value="02">02 - Operaci\xF3n no realizada</option>
11  <option value="03">03 - Error en los datos del receptor</option>
12</select>
13
14<input
15  id="replacementUuid"
16  class="swal2-input"
17  placeholder="UUID de la nueva factura (solo para motivo 01)"
18  style="display:none"
19/>
20    `,showCancelButton:!0,confirmButtonText:"Cancelar factura",cancelButtonText:"Cerrar",confirmButtonColor:"#dc2626",didOpen:()=>{let i=document.getElementById("reasonCode"),t=document.getElementById("replacementUuid");i.addEventListener("change",()=>{t.style.display=i.value==="01"?"block":"none"})},preConfirm:()=>{let i=document.getElementById("reasonCode").value,t=document.getElementById("replacementUuid").value;if(!i){p.default.showValidationMessage("Selecciona un motivo de cancelaci\xF3n");return}if(i==="01"&&!t){p.default.showValidationMessage("El UUID de la factura 
20sustituta es obligatorio para el motivo 01");return}return{cancellationReasonCode:i,replacementUuid:t||void 0}}}).then(i=>{i.isConfirmed&&(p.default.fire({title:"Cancelando factura...",allowOutsideClick:!1,didOpen:()=>p.default.showLoading()}),this.invoiceService.cancelInvoice(e,i.value).subscribe({next:()=>{p.default.fire({icon:"success",title:"Factura cancelada",text:"La factura fue cancelada correctamente.",confirmButtonColor:"#16a34a"}),this.loadInvoices()},error:t=>{p.default.fire({icon:"error",title:"Error al cancelar",text:t?.error?.message||"No fue posible cancelar la factura"})}}))})}static \u0275fac=function(i){return new(i||n)(C(j),C(R))};static \u0275cmp=P({type:n,selectors:[["app-invoice-history"]],decls:28,vars:6,consts:[["sinTotal",""],[1,"px-6","py-8","max-w-7xl","mx-auto","space-y-6"],[1,"text-2xl","font-semibold","text-gray-800"],[1,"text-sm","text-gray-500"],[1,"bg-white","rounded-xl","shadow","overflow-hidden"],[1,"min-w-full","text-sm"],[1,"bg-gray-50","border-b"],[1,"px-4","py-3","text-left"],[1,"px-4","py-3","text-right"],[1,"px-4","py-3","text-center"],["class","border-b hover:bg-gray-50",4,"ngFor","ngForOf"],[4,"ngIf"],[3,"pageChange","pageSizeChange","total","currentPage","pageSize","pageSizeOptions"],[1,"border-b","hover:bg-gray-50"],[1,"px-4","py-3","text-xs","break-all"],[1,"px-4","py-3"],[1,"px-4","py-3","text-right","font-semibold"],[4,"ngIf","ngIfElse"],[1,"px-2","py-1","rounded-full","text-xs","font-semibold",3,"ngClass"],[1,"flex","items-center","justify-center","gap-2"],["title","Imprimir la factura",1,"px-3","py-1.5","rounded-lg","bg-gray-900","text-white","text-xs","font-semibold","hover:bg-black","disabled:opacity-50","disabled:cursor-not-allowed",3,"click","disabled"],["title","Descargar el PDF",1,"px-2.5","py-1.5","rounded-lg","border","border-gray-300","text-gray-700","text-xs","font-semibold","hover:bg-gray-50","disabled:opacity-50","disabled:cursor-not-allowed",3,"click","disabled"],["title","Descargar el XML timbrado (es el que tiene valor fiscal)",1,"px-2.5","py-1.5","rounded-lg","border","border-gray-300","text-gray-700","text-xs","font-semibold","hover:bg-gray-50","disabled:opacity-50","disabled:cursor-not-allowed",3,"click","disabled"],["class","text-red-600 hover:text-red-800 font-semibold text-sm",3,"click",4,"ngIf"],[1,"text-red-600","hover:text-red-800","font-semibold","text-sm",3,"click"],["colspan","7",1,"px-4","py-6","text-center","text-gray-500"]],template:function(i,t){i&1&&(o(0,"div",1)(1,"div")(2,"h1",2),a(3," Historial de facturaci\xF3n "),r(),o(4,"p",3),a(5," Facturas emitidas "),r()(),o(6,"div",4)(7,"table",5)(8,"thead",6)(9,"tr")(10,"th",7),a(11,"UUID"),r(),o(12,"th",7),a(13,"Orden"),r(),o(14,"th",7),a(15,"Fecha"),r(),o(16,"th",8),a(17,"Total"),r(),o(18,"th",9),a(19,"Estado"),r(),o(20,"th",9),a(21,"Documentos"),r(),o(22,"th",9),a(23,"Acci\xF3n"),r()()(),o(24,"tbody"),_(25,ee,25,20,"tr",10)(26,te,3,0,"tr",11),r()()(),o(27,"app-paginator",12),f("pageChange",function(l){return t.goToPage(l)})("pageSizeChange",function(l){return t.onPageSizeChange(l)}),r()()),i&2&&(s(25),m("ngForOf",t.invoices),s(),m("ngIf",!t.invoices.length),s(),m("total",t.totalInvoices)("currentPage",t.currentPage)("pageSize",t.itemsPerPage)("pageSizeOptions",t.pageSizeOptions))},dependencies:[$,A,H,L,D,z,N,X,V,M,B],encapsulation:2})}return n})();export{ve as InvoiceHistoryComponent};

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.