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]="2395ae2b-0d65-5813-8456-44cd6db50761")}catch(e){}}(); 3import{bN as N,l as c,aJ as R,bM as k,cb as C,V as s,R as t,f$ as D,cd as T,e8 as h,bY as v,bB as x,j as f,bi as i,bk as F,cv as S}from"./index-Cs-In7Vx.js";import{T as w}from"./TrendingDownRounded-Df8UqwPX.js";import{A as H}from"./index-Dpr9l0yn.js";import{t as P,u as I,c as U,d as L,C as A}from"./index-fQb1qIxV.js";import{l as $,R as M,A as V}from"./ReportButton-BWrEQcNI.js";import{i as j}from"./immer-DcGVaYhT.js";import{H as Y}from"./Help-D_hZHZg-.js";import"./SearchTextInput-Gprlx1Wp.js";import"./ExportReportDialog-D8cuoLvc.js";import"./NotificationsRounded-CplVMLN2.js";import"./Badge-afidKPqR.js";import"./GetAppRounded-DDuWLHeg.js";const _={page:1,per_page:10,order:"desc",order_by:"id",q:{created_at_gteq:c().startOf("day").format(),created_at_lteq:c().endOf("day").format()}},d=N(j(a=>({filters:{..._},updateFilter:(r,l)=>a(n=>{const o={created_at_gteq:n.filters.q.created_at_gteq,created_at_lteq:n.filters.q.created_at_lteq};$(n.filters,r,l),n.filters.q={...o,...n.filters.q},r!=="page"&&(n.filters.page=1)}),resetFilters:()=>a(r=>{r.filters={..._}})})));function B(a){const r=C(a.q,["type_in","type_not_in"]);if(a.q.type_in){const n=a.q.type_in.map(o=>`${o}_id`).join("_or_")+"_not_null";r[n]=!0}if(a.q.type_not_in){const n=a.q.type_not_in.map(o=>`${o}_id`).join("_and_")+"_null";r[n]=!0}const l=s.queryParamsObjectToString({...a,q:r});return`${P}?${l}`}function g(){const a=d(u=>u.filters),{data:r,error:l,isLoading:n,isValidating:o,mutate:m}=R(B(a),k,{dedupingInterval:3e4,revalidateOnFocus:!1,revalidateOnReconnect:!1,errorRetryCount:1,keepPreviousData:!0});return{data:r?.data,totalRecords:r?.total||0,isLoading:n,isValidating:o,isError:l,mutate:m}}const K=[{field:"item_name_or_food_input_name_or_subitem_name",label:"Nome",type:"string"},{field:"type",label:"Tipo de produto",type:"list_in_required",valueOptions:[{id:"item",label:"Produto"},{id:"subitem",label:"Opção"},{id:"food_input",label:"Insumo"}],valueOptionKey:"id",valueOptionLabel:"label"},{field:"operation_type",label:"Tipo de operação",type:"list_in_required",valueOptions:[{id:"INPUT",label:"Entrada"},{id:"OUTPUT",label:"SaÃda"},{id:"SALE",label:"Venda"},{id:"RETURN",label:"Devolução"}],valueOptionKey:"id",valueOptionLabel:"label"},{field:"order_id",label:"ID do pedido",type:"number"},{field:"description",label:"Descrição",type:"string"},{field:"user_name",label:"Usuário",type:"string"}];function Q(){const a=d(o=>o.filters),r=d(o=>o.updateFilter),l=I(o=>o.openDialog),{mutate:n}=g();return t.createElement("div",{className:"w-full"},t.createElement(H,{fields:K,onFilterChange:o=>r("q",o),actions:t.createElement(t.Fragment,null,t.createElement("button",{className:"my-6 mr-12 inline-flex cursor-pointer items-center space-x-12 whitespace-nowrap rounded-6 border border-solid border-gray-200 bg-gray-50 py-8 pl-12 pr-16 text-16 font-bold text-gray-600 hover:bg-gray-100",onClick:()=>l({operation_type:"INPUT"},()=>n())},t.createElement(D,null)," ",t.createElement("span",null,"Inserir")),t.createElement("button",{className:"my-6 mr-12 inline-flex cursor-pointer items-center space-x-12 whitespace-nowrap rounded-6 border border-solid border-gray-200 bg-gray-50 py-8 pl-12 pr-16 text-16 font-bold text-gray-600 hover:bg-gray-100",onClick:()=>l({operation_type:"OUTPUT"},()=>n())},t.createElement(w,null)," ",t.createElement("span",null,"Retirar")),t.createElement(M,{reportLink:"/api/v2/reports/company/stock_o
3perations",filters:a.q}))},t.createElement(T,{value:[new Date(a.q.created_at_gteq),new Date(a.q.created_at_lteq)],onChange:o=>{r("q.created_at_gteq",c(o[0]).startOf("minute").format()),r("q.created_at_lteq",c(o[1]).endOf("minute").format())},className:"my-6 mr-12 w-full sm:w-auto",format:"dd/MM/yyyy HH:mm",ranges:U,appearance:"subtle",maxDaysAllowed:60,allowFuture:!0})))}const z=a=>a.item_id?t.createElement(i,{color:"blue"},"Produto"):a.subitem_id?t.createElement(i,{color:"purple"},"Opção"):a.food_input_id?t.createElement(i,{color:"indigo"},"Insumo"):t.createElement(i,{color:"grey"},"Outro");function J(){const a=d(e=>e.filters.page),r=d(e=>e.updateFilter),{data:l,totalRecords:n,isLoading:o,isValidating:m,isError:u}=g(),b=h(),y=e=>{r("page",e+1)},E=e=>{r("per_page",e)},q=(e,p)=>{r("order_by",e),r("order",p)},O=t.useCallback(e=>{if(e.item_id)return`/estoque/meu_estoque/produtos/${e.item_id}`;if(e.subitem_id)return`/estoque/meu_estoque/opcoes/${e.subitem_id}`;if(e.food_input_id)return`/estoque/meu_estoque/insumos/${e.food_input_id}`},[]);return t.createElement(v,{data:l,totalRows:n,onChangePage:y,onChangeRowsPerPage:E,onRequestSort:q,resetCurrentPage:a===1,loading:o||m,loadingRowsQuantity:10,showError:u,stickyHeader:!0,columns:[{Header:"Tipo",sortable:!1,Cell:({row:e})=>z(e)},{Header:"Nome",sortable:!1,accessor:"name",className:"font-bold min-w-200",Cell:({row:e})=>t.createElement(x,{to:O(e),onClick:p=>p.stopPropagation()},t.createElement(f,{title:"Mais informações",placement:"top",arrow:!0},t.createElement("span",{className:"cursor-pointer"},e.name)))},{Header:"Data",accessor:"created_at",formatDataFunction:e=>c(e).format("DD/MM/YYYY HH:mm")},{Header:"Operação",sortable:!1,accessor:"operation_type",formatDataFunction:e=>L[e]},{Header:"Qtde",accessor:"quantity",align:"center",sortable:!1,formatDataFunction:e=>s.formatNumber(e,null)},{Header:t.createElement("div",{className:"flex items-center justify-center space-x-8"},t.createElement("span",null,"Variação"),t.createElement(f,{title:"Estoque antes e depois da operação",placement:"top",enterTouchDelay:50},t.createElement(Y,{fontSize:"small",className:"text-gray-700"}))),accessor:"previous_stock",align:"center",className:"min-w-192",sortable:!1,Cell:({row:e})=>t.createElement("div",{className:"flex items-center justify-center"},t.createElement("span",{className:"min-w-32"},s.formatNumber(e.previous_stock,null)),t.createElement(V,null),t.createElement("span",{className:"min-w-32"},s.formatNumber(s.sumNumbersCorrectly(e.previous_stock,["INPUT","RETURN"].includes(e.operation_type)?e.quantity:-e.quantity),null)))},{Header:"Custo Un.",accessor:"unit_cost_price",sortable:!1,formatDataFunction:e=>e||e===0?s.formatMonetaryValue(e):t.createElement(i,{color:"grey"},"Sem dados")},{Header:"Descrição",accessor:"description",sortable:!1,className:"min-w-256"},{Header:"Usuário",accessor:"user_name",sortable:!1,className:"truncate max-w-216",formatDataFunction:e=>e?t.createElement("span",{title:e},e):t.createElement(i,{color:"grey"},"Desconhecido")},{Header:"",accessor:"order_id",align:"right",sortable:!1,Cell:({row:e})=>t.createElement(F,{disabled:!e.order_id,tooltip:e.order_id?"Ver pedido":"Nenhum pedido associado",onClick:()=>b(e.order_id)},t.createElement(S,null))}]})}function ie(){return t.createElement("div",{className:"flex w-full flex-1 flex-col space-y-24 overflow-auto px-12 py-24 sm:px-28"},t.createElement(Q,null),t.createElement("div",{className:"sm:flex-1 sm:overflow-auto"},t.createElement(J,null)),t.createElement(A,null))}export{ie as default}; 4 5//# debugId=2395ae2b-0d65-5813-8456-44cd6db50761
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.