PageSourceSearch

https://portal.cardapioweb.com/assets/BillingsPage-i9hQNwwA.js

js cardapioweb.com collected 2026-09-24 11:57:22 UTC 11,709 bytes, 5 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c1a51011-b2f6-5115-a628-8884bca864bc")}catch(e){}}();
3import{Q as O,aJ as $,bM as W,l as m,V as c,bN as q,W as R,aj as P,R as e,x as E,bJ as G,ai as Q,cc as b,y as d,cd as w,aL as U,Y as J,bK as X,bk as k,ce as Z,cf as ee,ao as ae,n as te,bY as se,bi as y,cg as le,bB as N,bH as C,bh as ne,j as S,ch as oe,ci as re,cj as ie,aG as ce}from"./index-Cs-In7Vx.js";import{S as ue}from"./SearchInput-6k8qtIIx.js";import{b as me,a as de,c as pe,d as ge,e as fe,f as _e,g as D,h as be,i as ye,j as he,k as ve,l as xe}from"./constants-2ySKHZ7n.js";import{A as Ee}from"./ApartmentRounded-xr62LVSX.js";import{m as ke}from"./apiEndpoints-DMnpAh1j.js";import{I as we}from"./index-CZT6I8m8.js";import"./Drawer-z0Voclkl.js";import"./Receipt-DpaxsT7M.js";import"./formatAddress-DI14OUhR.js";import"./formatPeriod-CMJE9Ypw.js";import"./CodeRounded-CAzTBunu.js";import"./GetAppRounded-DDuWLHeg.js";import"./useBillings-Csu4T8Yk.js";import"./validateCNPJ-D1dZ3Lbf.js";import"./validateCPF-BkwZ4IBk.js";import"./useAccount-BtmLSkRg.js";async function Ne(){return(await O.post("/api/v2/admin/billings/process_nfse_batch")).data}const Ce="/api/v2/admin/billings";let M;function x(o=M){M=o;const t={...o};t.due_at_start=t.due_at_start?m(t.due_at_start).format("YYYY-MM-DDT00:00:00.000"):null,t.due_at_end=t.due_at_end?m(t.due_at_end).format("YYYY-MM-DDT23:59:59.999"):null,t.paid_at_start=t.paid_at_start?m(t.paid_at_start).format("YYYY-MM-DDT00:00:00.000"):null,t.paid_at_end=t.paid_at_end?m(t.paid_at_end).format("YYYY-MM-DDT23:59:59.999"):null,t.value_gt=t.value_gt?"":"0";const s=c.queryParamsObjectToString(t);return`${Ce}?${s}`}function Se(o){const{data:t,error:s,mutate:n,isValidating:i}=$(x(o),W,{dedupingInterval:15e3,revalidateOnFocus:!1,revalidateOnReconnect:!1});return{data:t?.data,totalRecords:t?.total||0,isLoading:!s&&!t,isValidating:i,isError:s,mutate:n}}const v=q(o=>({filters:{page:1,per_page:10,search_text:"",billing_status:[],payment_method:[],nfe_status:[],asaas_billing_status:[],client_type:[],value_gt
3:!1,due_at_start:void 0,due_at_end:void 0,paid_at_start:void 0,paid_at_end:void 0},updateFilter:(t,s)=>o(n=>({...n,filters:t==="page"?{...n.filters,[t]:s}:{...n.filters,[t]:s,page:1}}))})),Y=[{key:"owner",label:"Proprietário"},{key:"reseller",label:"Revendedor"}],Me=[{key:!0,label:"Sim"},{key:!1,label:"Não"}],Re=ee(Y,"key");function Pe(){const o=R(),t=P(),s=v(a=>a.filters),n=v(a=>a.updateFilter),[i,h]=e.useState(""),u=E(({auth:a})=>a.user.role),{mutate:g}=G(),f=e.useMemo(()=>Q(a=>{n("search_text",a)},600),[n]),_=e.useRef(!0);e.useEffect(()=>{_.current?(_.current=!1,n("search_text","")):f(i)},[i,f,n]);const p=e.useCallback(async()=>t({title:"Gerar as notas das faturas deste mês",description:"Serão consideradas todas as faturas pagas neste mês com valor maior que zero e que ainda não foram processadas.",cancellationText:"Voltar",confirmationText:"Confirmar"}).then(async()=>{try{await Ne(),await g(x()),o.success("Solicitação enviada com sucesso!")}catch(a){o.error(a.response?.data?.message||"Não foi possível processar a solicitação")}}).catch(()=>{}),[o,t,g]);return e.createElement("div",{className:"grid grid-cols-1 gap-16 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4"},e.createElement(ue,{placeholder:"Pesquise pelo nome, e-mail ou organização",value:i,onChange:a=>h(a.target.value),wrapperClassName:"w-full"}),e.createElement(b,{label:"Forma de pagamento",name:"payment_method",value:s.payment_method,onChange:a=>n("payment_method",a.target.value),optionValueKey:"key",optionLabelKey:"label",options:de.map(a=>({...a,checked:s.payment_method.includes(a.key)})),renderValue:a=>a.map(r=>me[r]).join(", "),className:"w-full bg-white"}),e.createElement(b,{label:"Status da fatura",name:"billing_status",value:s.billing_status,onChange:a=>n("billing_status",a.target.value),optionValueKey:"key",optionLabelKey:"label",options:ge.map(a=>({...a,checked:s.billing_status.includes(a.key)})),renderValue:a=>a.map(r=>pe[r]).join(", "),className:"w-full bg-white"}),c.hasPermission(d.cwManager,u)&&e.createElement(b,{label:"Status Asaas",name:"asaas_billing_status",value:s.asaas_billing_status,onChange:a=>n("asaas_billing_status",a.target.value),optionValueKey:"key",optionLabelKey:"label",options:_e.map(a=>({...a,checked:s.asaas_billing_status.includes(a.key)})),renderValue:a=>a.map(r=>fe[r]).join(", "),className:"w-full bg-white"}),c.hasPermission(d.cwManager,u)&&e.createElement(b,{label:"Status da nota fiscal",name:"nfe_status",value:s.nfe_status,onChange:a=>n("nfe_status",a.target.value),optionValueKey:"key",optionLabelKey:"label",options:be.map(a=>({...a,checked:s.nfe_status.includes(a.key)})),renderValue:a=>a.map(r=>D[r]).join(", "),className:"w-full bg-white"}),c.hasPermission(d.cwManager,u)&&e.createElement(b,{label:"Tipo de cliente",name:"client_type",value:s.client_type,onChange:a=>n("client_type",a.target.value),optionValueKey:"key",optionLabelKey:"label",options:Y.map(a=>({...a,checked:s.client_type.includes(a.key)})),renderValue:a=>a.map(r=>Re[r].label).join(", "),className:"w-full bg-white"}),e.createElement(w,{value:s.due_at_start&&s.due_at_end?[s.due_at_start,s.due_at_end]:void 0,onChange:a=>{n("due_at_start",a[0]),n("due_at_end",a[1])},className:"w-full sm:w-auto",placeholder:"Filtrar por vencimento",maxDaysAllowed:100,allowFuture:!0,cleanable:!0}),e.createElement(w,{value:s.paid_at_start&&s.paid_at_end?[s.paid_at_start,s.paid_at_end]:void 0,onChange:a=>{n("paid_at_start",a[0]),n("paid_at_end",a[1])},className:"w-full sm:w-auto",placeholder:"Filtrar por pagamento",maxDaysAllowed:100,cleanable:!0}),e.createElement("div",{className:"flex space-x-12"},e.createElement(U,{name:"value_gt",label:"Mostrar faturas zeradas",value:s.value_gt,onChange:a=>n("value_gt",a.target.value),options:Me,optionValueKey:"key",optionLabelKey:"label",className:"flex-1 flex-shrink-0 bg-white"}),c.hasPermission(d.admin,u)&&e.createElement(J,{variant:"outlined",className:"flex-1 flex-shrink-0 bg-white",startIcon:e.createElement(X,null),onClick:p},"Notas em lote"),e.createElement(k,{tooltip:"Atualizar faturas",onClick:()=>g(x())},e.createElement(Z,{className:"text-gray-500"}))))}
3function De({open:o,billing:t,onClose:s}){const[n,i]=e.useState(null);return e.useEffect(()=>{t&&i(t)},[t]),e.createElement(ae,{open:o,title:"Motivos do status da nota fiscal",onClose:s,keepMounted:!1,maxWidth:"sm"},e.createElement("div",{className:"space-y-12"},e.createElement("div",{className:"space-y-4"},e.createElement("div",{className:"text-18 font-bold text-gray-600"},"Fatura ",n?.id?n.id.toString().padStart(6,"0"):"000000"),e.createElement("div",{className:"text-18 font-bold text-gray-600"},"Status"," ",n?.nfe_status?D[n.nfe_status]:"Desconhecido")),e.createElement("div",{className:"whitespace-pre-wrap text-16 font-medium text-gray-600"},n?.nfe_motivo_status||"Motivo do status não informado")))}const T=e.createContext();function Ye({row:o}){const t=o.owner_name||o.reseller_name||"Desconhecimento",s=o.organization_id?"reseller":"owner";return s==="owner"?e.createElement(N,{to:`/contas/${o.owner_id}`,onClick:n=>n.stopPropagation()},e.createElement(C,{label:t,title:t,icon:e.createElement(ne,{className:"text-gray-400"}),className:"max-w-full cursor-pointer rounded-6 text-gray-600",variant:"outlined",size:"small",clickable:!0})):s==="reseller"?e.createElement(N,{to:`/organizacoes/${o.organization_id}`,onClick:n=>n.stopPropagation()},e.createElement(C,{label:t,title:t,icon:e.createElement(Ee,{className:"text-gray-400"}),className:"max-w-full rounded-6 text-gray-600",variant:"outlined",size:"small",clickable:!0})):t}function Te({row:o}){const t=E(({auth:s})=>s.user.role);return e.createElement("div",{className:"flex items-center space-x-12"},ve?.[o.payment_method]||e.createElement(y,{color:"grey"},"Indefinido"),c.hasPermission(d.cwManager,t)&&o.payment_method==="bank_slip"&&(o.bank_slip_viewed?e.createElement(S,{title:o.bank_slip_viewed_at?`Boleto visto (${m(o.bank_slip_viewed_at).format("DD/MM/YYYY HH:mm")})`:"Boleto visto",placement:"top",arrow:!0},e.createElement(oe,{className:"text-gray-300"})):e.createElement(S,{title:"Boleto não visto",placement:"top",arrow:!0},e.createElement(re,{className:"text-gray-300"}
3))))}function Fe({row:o}){const t=e.useContext(T);return e.createElement("div",{className:"flex items-center space-x-6"},xe?.[o.nfe_status]||e.createElement(y,{color:"grey"},"Indefinido"),o.nfe_motivo_status&&e.createElement(k,{tooltip:"Ver motivo do status",onClick:()=>t(o),color:"text-gray-400"},e.createElement(ie,null)))}function Ie(){const o=R(),t=te(),s=P(),n=E(({auth:l})=>l.user.role),i=v(l=>l.filters),h=v(l=>l.updateFilter),[u,g]=e.useState(null),[f,_]=e.useState({open:!1,billing:null}),{data:p,totalRecords:a,mutate:r,isLoading:F,isValidating:I,isError:V}=Se(i);e.useEffect(()=>{p&&g(p)},[p]);const B=l=>{h("page",l+1)},H=l=>{h("per_page",l)},L=e.useCallback((l,j)=>async()=>s({title:"Marcar fatura como paga",description:`Você está marcando a fatura ${l.toString().padStart(6,"0")} como paga. Essa operação não poderá ser desfeita e a fatura não poderá mais ser excluída.`,cancellationText:"Voltar",confirmationText:"Confirmar"}).then(async()=>{try{await ke(j,l),await r()}catch(z){o.error(z.response?.data?.message||"Não foi possível marcar a fatura como paga")}}).catch(()=>{}),[o,s,r]),K=e.useCallback(l=>{_({open:!0,billing:l})},[]),A=e.useCallback(()=>{_({open:!1,billing:null})},[]);return e.createElement(e.Fragment,null,e.createElement(De,{open:f.open,billing:f.billing,onClose:A}),e.createElement(T.Provider,{value:K},e.createElement(se,{data:u,totalRows:a,onChangePage:B,onChangeRowsPerPage:H,onRowClick:({id:l})=>t.push({search:`fatura=${l}`}),resetCurrentPage:i.page===1,loading:F||I||!u&&p,loadingRowsQuantity:10,showError:V,stickyHeader:!0,columns:[{Header:"Número",accessor:"id",sortable:!1,formatDataFunction:l=>l.toString().padStart(6,"0")},{Header:"Cliente",sortable:!1,className:"min-w-160 font-semibold max-w-256 truncate",Cell:Ye},{Header:"Valor",accessor:"value",sortable:!1,className:"min-w-136",formatDataFunction:l=>c.formatMonetaryValue(l)},{Header:"Vencimento",accessor:"due_at",sortable:!1,className:"min-w-160",formatDataFunction:l=>m(l).format("DD/MM/YYYY")},{Header:"Pagamento",accessor:"paid_at",sortable:!1,className:"min-w-160",formatDataFunction:l=>l?m(l).format("DD/MM/YYYY"):e.createElement(y,{color:"grey"},"Indefinido")},{Header:"Forma de pagamento",sortable:!1,className:"min-w-136",Cell:Te},{Header:"Status",accessor:"status",sortable:!1,formatDataFunction:l=>ye?.[l]||e.createElement(y,{color:"grey"},"Indefinido")},c.hasPermission(d.cwManager,n)&&{Header:"Asaas",accessor:"asaas_billing_status",sortable:!1,formatDataFunction:l=>he?.[l]||e.createElement(y,{color:"grey"},"Indefinido")},c.hasPermission(d.cwManager,n)&&{Header:"Nota fiscal",sortable:!1,Cell:Fe},{Header:"",sortable:!1,align:"right",Cell:({row:l})=>e.createElement("div",{className:"space-x-8"},l.status==="pending"&&!l.asaas_payment_id&&e.createElement(k,{tooltip:"Marcar como paga",onClick:L(l.id,l.owner_id)},e.createElement(le,{color:"inherit"})))}].filter(Boolean)})))}function Xe(){return e.createElement(ce,null,e.createElement("div",{className:"flex w-full flex-1 flex-col space-y-24 overflow-auto px-12 py-24 sm:px-28"},e.createElement(Pe,null),e.createElement("div",{className:"sm:flex-1 sm:overflow-auto"},e.createElement(Ie,null)),e.createElement(we,null)))}export{Xe as default};
4
5//# debugId=c1a51011-b2f6-5115-a628-8884bca864bc

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.