PageSourceSearch

https://app.stoqui.com.br/assets/StockProductPage-BfmmoJQF.js

js stoqui.com.br collected 2026-09-24 11:58:40 UTC 5,215 bytes, 1 lines download raw bytes

1import{j as e,R as D,ac as E,ab as u,T as c,as as L,a7 as l,H as b,Q as y,aw as A}from"./mui-CRsYZxVY.js";import{r as j}from"./vendor-Dwao9eNC.js";import{b8 as V,J as B,b as M,T as S,bG as N}from"./index-TALscxEc.js";import{u as R}from"./useProduct-BltDnkHr.js";import{u as F}from"./useProductVariations-zMUBu_ll.js";import{u as H,S as O,a as G}from"./StockMovementSkeleton-OwZxa3oJ.js";import{S as U,a as $,b as W}from"./StockPageSkeleton-BuARnKWC.js";import{S as z}from"./StockChip-B81FVTrG.js";import{V as J,e as Q}from"./icons-D8aatgQ4.js";import{u as Y}from"./useAddStock-54MbzO7V.js";import{u as K}from"./useEditProduct-D1wHpcZy.js";import"./query-8ViTdhdk.js";import"./datePickers-BIJXYOKG.js";import"./lab-DSem1Osk.js";import"./ProductAvatar-BTM6y7KS.js";import"./getMovementTypeInfo-D9It_2AF.js";import"./useSuppliers-CrWpT6AC.js";import"./stock-DrtHpNCn.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"2ad85febf9735404429b0670d4acf56a0af5a0a2"}}catch{}})();try{(function(){var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new s.Error().stack;a&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[a]="5e67999d-4e59-47a8-a15e-c88af0a39ee3",s._sentryDebugIdIdentifier="sentry-dbid-5e67999d-4e59-47a8-a15e-c88af0a39ee3")})()}catch{}const X=({name:s,stock:a,minStock:f,hidden:i=!1,stockControlEnabled:x=!0,onClick:n})=>{const o=n?L:l,g=n?{onClick:n}:{sx:{display:"flex",alignItems:"center",width:"100%",px:2,py:1.5}};return e.jsx(D,{disablePadding:!0,sx:{opacity:i?.6:1},children:e.jsx(o,{...g,children:e.jsx(E,{primaryTypographyProps:{component:"div"},primary:e.jsxs(u,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsxs(u,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(c,{component:"div",sx:V,children:s}),i&&e.jsx(J,{sx:{fontSize:16,color:"text.disabled"}})]}),e.jsxs(u,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(c,{variant:"caption",color:"text.secondary",children:"Em estoque:"}),e.jsx(z,{amount:a,minStock:f,isInfinite:!x,isHidden:i})]})]})})})})},he=()=>{var h;const{productId:s}=B(),a=Number(s),[f,i]=j.useState(!1),[x,n]=j.useState(),{data:o,isLoading:g}=R(String(a)),{data:m=[]}=F(String(a)),{data:d=[],isLoading:v}=H({productId:a}),_=Y(),k=K(),p=M(),I=async t=>{await _.mutateAsync({produto_id:a,...t,data_movimento:t.data_movimento?t.data_movimento.toISOString():null}),i(!1)},w=async t=>{o&&await k.mutateAsync({id:Number(o.id),...t})},q=async t=>{o!=null&&o.controlar_estoque&&p(`/stock/products/${a}/variation/${t.id}`)};if(g)return e.jsx(U,{});if(!o)return e.jsxs(l,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(S,{title:"Gerenciar estoque",navigateBack:()=>p("/stock")}),e.jsx(l,{sx:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(c,{children:"Produto não encontrado"})})]});const r=m.length>0,P=r?m.reduce((t,C)=>t+(C.estoque_atual||0),0):o.estoque_atual||0,T=!!(!r&&o.controlar_estoque&&d.length===0);return e.jsxs(l,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(S,{title:"Gerenciar estoque",navigateBack:()=>p(-1)}),e.jsx(l,{sx:{flex:1,overflow:"auto",p:2,pb:2},children:e.jsxs(u,{spacing:2,children:[e.jsx($,{imageUrl:(h=o.image_url)==null?void 0:h[0],productName:o.nome,productId:Number(o.id),hasVariations:m.length>0,stockControlEnabled:o.controlar_estoque||!1,totalStock:P,minStock:o.estoque_minimo||0,onUpdateSettings:w,onAddStock:!r&&o.controlar_estoque?()=>{n(d.length===0?"entrada_inicial":"entrada_compra"),i(!0)}:void 0,onRemoveStock:!r&&o.controlar_estoque?()=>{n("saida_perda"),i(!0)}:void 0,averageCost:o.custo_medio_atual,purchaseAverageCost:o.custo_medio_compra}),r?e.jsxs(b,{elevation:0,children:[e.jsx(c,{variant:"subtitle1",gutterBottom:!0,fontWeight:500,color:"primary",children:"Variações"}),e.jsx(y,{disablePadding:!0,children:m.map(t=>e.jsx(X,{productId:a,variationId:t.id,name:t.nome,stock:t.estoque_atual||0,minStock:t.estoque_minimo||0,hidden:t.oculto,stockControlEnabled:o.controlar_estoque&&t.controlar_estoque,onClick:()=>q(t)},t.id))})]}
1):e.jsxs(b,{elevation:0,children:[e.jsx(c,{variant:"subtitle1",gutterBottom:!0,fontWeight:500,color:"primary",mb:2,children:"Histórico de movimentações"}),v?e.jsx(u,{spacing:1,children:[1,2,3].map(t=>e.jsx(O,{},t))}):d.length===0?e.jsx(c,{color:"text.secondary",textAlign:"center",py:4,children:"Nenhuma movimentação registrada"}):e.jsx(y,{disablePadding:!0,children:d.map(t=>e.jsx(G,{...t,hideProduct:!0,hideSupplier:!1,onClick:()=>p(`/stock/movements/${t.id}`)},t.id))})]})]})}),!r&&o.controlar_estoque&&e.jsxs(e.Fragment,{children:[e.jsx(A,{color:"primary",sx:{position:"fixed",right:16,bottom:"calc(var(--safe-area-inset-bottom) + 16px)"},onClick:()=>i(!0),children:e.jsx(Q,{})}),e.jsx(N,{text:"Clique para adicionar estoque",visible:T,fabBottom:"calc(var(--safe-area-inset-bottom) + 16px)",fabRight:16}),e.jsx(W,{open:f,onClose:()=>{i(!1),n(void 0)},onSubmit:I,productId:a,hasExistingMovements:d.length>0,currentAverageCost:o.custo_medio_atual,defaultMovementType:x})]})]})};export{he 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.