PageSourceSearch

https://wrb-software.pages.dev/assets/ReplaceStock-CCudO7TP.js

js wrb-software.pages.dev collected 2026-10-03 06:06:00 UTC 12,526 bytes, 1 lines download raw bytes

1import{c as I,q as F,v as y,r as u,j as e,B as b,e as S,u as q,I as A,m as C,K as L,s as N}from"./index-CToaoKZe.js";import{L as k}from"./label-BsX5CoYO.js";import{D as V,a as O,b as B,c as K}from"./dialog-CC_oHHoJ.js";import{S as x,a as m,b as p,c as h,d as i}from"./select-CozcUnjJ.js";import{T as U}from"./textarea-B8CCCuS8.js";import{u as Y}from"./useDesigners-CnpSSN2k.js";import{c as z}from"./common-Cc37xNC0.js";import{P as M}from"./plus-DvM7fkm0.js";import"./check-IDdpj7Hq.js";import"./index-BPahu1Ac.js";import"./index-rsrw5ISx.js";const Q=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],$=I("funnel",Q),w=F({stock_title:"Restock List",stock_count_needed:"needed",stock_count_ordered:"ordered",stock_count_urgent:"urgent",stock_add_to_list:"Add to Restock List",stock_style_number:"Style #",stock_style_ph:"e.g. 1234",stock_designer:"Designer",stock_select_ph:"Select…",stock_description:"Description",stock_description_ph:"e.g. Ivory A-line gown, size 10",stock_priority:"Priority",stock_notes:"Notes",stock_notes_ph:"Any details…",stock_adding:"Adding…",stock_add_button:"Add to List",stock_priority_urgent:"Urgent",stock_priority_normal:"Normal",stock_priority_low:"Low",stock_status_needed:"Needed",stock_status_ordered:"Ordered",stock_status_received:"Received",stock_badge_urgent:"urgent",stock_badge_normal:"normal",stock_badge_low:"low",stock_badge_needed:"needed",stock_badge_ordered:"ordered",stock_badge_received:"received",stock_unknown_designer:"Unknown Designer",stock_status:"Status",stock_all_statuses:"All Statuses",stock_all_priorities:"All Priorities",stock_clear_filters:"Clear filters",stock_empty:"No items on the restock list yet.",stock_empty_filtered:"No items match your filters.",stock_add_first:"Add First Item"},{stock_title:"Lista de reposição",stock_count_needed:"para pedir",stock_count_ordered:"com pedido feito",stock_count_urgent:"com urgência",stock_add_to_list:"Adicionar à lista de reposição",stock_style_number:"Nº do modelo",stock_style_ph:"ex. 1234",stock_designer:"Estilista",stock_select_ph:"Escolher…",stock_description:"Descrição",stock_description_ph:"ex. Vestido evasê marfim, tamanho 10",stock_priority:"Prioridade",stock_notes:"Observações",stock_notes_ph:"Algum detalhe…",stock_adding:"Adicionando…",stock_add_button:"Adicionar à lista",stock_priority_urgent:"Urgente",stock_priority_normal:"Normal",stock_priority_low:"Baixa",stock_status_needed:"Falta pedir",stock_status_ordered:"Pedido feito",stock_status_received:"Recebido",stock_badge_urgent:"urgente",stock_badge_normal:"normal",stock_badge_low:"baixa",stock_badge_needed:"falta pedir",stock_badge_ordered:"pedido feito",stock_badge_received:"recebido",stock_unknown_designer:"Estilista não informado",stock_status:"Status",stock_all_statuses:"Todos os status",stock_all_priorities:"Todas as prioridades",stock_clear_filters:"Limpar filtros",stock_empty:"Nada na lista de reposição ainda.",stock_empty_filtered:"Nada encontrado com esses filtros.",stock_add_first:"Adicionar o primeiro item"});function H(){return q({queryKey:["replace_stock"],queryFn:async()=>{const{data:s,error:r}=await N.from("replace_stock").select("*, designer:designers(*)").order("created_at",{ascending:!1});if(r)throw r;return s}})}function G(){const s=C();return L({mutationFn:async r=>{const{data:t,error:l}=await N.from("replace_stock").insert(r).select("*, designer:designers(*)").single();if(l)throw l;return t},onSuccess:()=>s.invalidateQueries({queryKey:["replace_stock"]})})}function J(){const s=C();return L({mutationFn:async({id:r,...t})=>{const{data:l,error:a}=await N.from("replace_stock").update(t).eq("id",r).select("*, designer:designers(*)").single();if(a)throw a;return l},onSuccess:()=>s.invalidateQueries({queryKey:["replace_stock"]})})}const T={urgent:"bg-red-100 text-red-700 border-red-200",normal:"bg-yellow-100 text-yellow-700 border-yellow-200",low:"bg-stone-100 text-stone-600 border-stone-200"},P={needed:"bg-orange-100 text-orange-700 border-orange-200",ordered:"bg-blue-100 text-blue-700 border-blue-200",received:"bg-emerald-100 text-emerald-700 border-emerald-200"},R={urgent:"stock_badge_urgent",normal:"stock_badge_normal",low:"stock_badge_low"},D={needed:"stock_badge_needed",ordered:"stock_badge_ordered",received:"stock_badge_received"};function W({open:s,onClose:r}){const t=y(w),l=y(z),[a,c]=u.useState({style_number:"",designer_id:"",description:"",priority:"normal",notes:""}),{data:j=[]}
1=Y(),d=G();function _(o,n){c(v=>({...v,[o]:n}))}async function f(){await d.mutateAsync({style_number:a.style_number.trim()||null,designer_id:a.designer_id||null,description:a.description.trim()||null,priority:a.priority,status:"needed",notes:a.notes.trim()||null,dress_id:null}),c({style_number:"",designer_id:"",description:"",priority:"normal",notes:""}),r()}return e.jsx(V,{open:s,onOpenChange:o=>{o||r()},children:e.jsxs(O,{className:"sm:max-w-md",children:[e.jsx(B,{children:e.jsx(K,{children:t("stock_add_to_list")})}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(k,{className:"text-xs text-stone-600",children:t("stock_style_number")}),e.jsx(A,{className:"mt-1.5",placeholder:t("stock_style_ph"),value:a.style_number,onChange:o=>_("style_number",o.target.value)})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-xs text-stone-600",children:t("stock_designer")}),e.jsxs(x,{value:a.designer_id,onValueChange:o=>_("designer_id",o),children:[e.jsx(m,{className:"mt-1.5 w-full",children:e.jsx(p,{placeholder:t("stock_select_ph")})}),e.jsx(h,{children:j.map(o=>e.jsx(i,{value:o.id,children:o.name},o.id))})]})]})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-xs text-stone-600",children:t("stock_description")}),e.jsx(A,{className:"mt-1.5",placeholder:t("stock_description_ph"),value:a.description,onChange:o=>_("description",o.target.value)})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-xs text-stone-600",children:t("stock_priority")}),e.jsxs(x,{value:a.priority,onValueChange:o=>_("priority",o),children:[e.jsx(m,{className:"mt-1.5 w-full",children:e.jsx(p,{})}),e.jsxs(h,{children:[e.jsx(i,{value:"urgent",children:t("stock_priority_urgent")}),e.jsx(i,{value:"normal",children:t("stock_priority_normal")}),e.jsx(i,{value:"low",children:t("stock_priority_low")})]})]})]}),e.jsxs("div",{children:[e.jsx(k,{className:"text-xs text-stone-600",children:t("stock_notes")}),e.jsx(U,{className:"mt-1.5",rows:2,placeholder:t("stock_notes_ph"),value:a.notes,onChange:o=>_("notes",o.target.value)})]})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx(b,{className:"flex-1 bg-black hover:bg-stone-800 text-white",onClick:f,disabled:d.isPending,children:d.isPending?t("stock_adding"):t("stock_add_button")}),e.jsx(b,{variant:"outline",onClick:r,children:l("common_cancel")})]})]})})}function X({item:s}){const r=y(w),t=J();function l(c){t.mutate({id:s.id,status:c})}function a(c){t.mutate({id:s.id,priority:c})}return e.jsx("div",{className:"bg-white rounded-xl border border-stone-100 shadow-sm p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[s.style_number&&e.jsxs("span",{className:"text-xs font-mono bg-stone-100 text-stone-600 px-2 py-0.5 rounded",children:["#",s.style_number]}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium border ${T[s.priority]}`,children:r(R[s.priority])}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium border ${P[s.status]}`,children:r(D[s.status])})]}),e.jsx("p",{className:"font-semibold text-stone-800 truncate",children:s.designer?.name??r("stock_unknown_designer")}),s.description&&e.jsx("p",{className:"text-sm text-stone-500 mt-0.5 line-clamp-2",children:s.description}),s.notes&&e.jsx("p",{className:"text-xs text-stone-400 mt-1 italic",children:s.notes})]}),e.jsxs("div",{className:"flex flex-col gap-2 shrink-0",children:[e.jsxs(x,{value:s.status,onValueChange:c=>l(c),children:[e.jsx(m,{className:"h-7 text-xs w-28",children:e.jsx(p,{})}),e.jsxs(h,{children:[e.jsx(i,{value:"needed",children:r("stock_status_needed")}),e.jsx(i,{value:"ordered",children:r("stock_status_ordered")}),e.jsx(i,{value:"received",children:r("stock_status_received")})]})]}),e.jsxs(x,{value:s.priority,onValueChange:c=>a(c),children:[e.jsx(m,{className:"h-7 text-xs w-28",children:e.jsx(p,{})}),e.jsxs(h,{children:[e.jsx(i,{value:"urgent",children:r("stock_priority_urgent")}),e.jsx(i,{value:"normal",children:r("stock_priority_normal")}),e.jsx(i,{value:"low",children:r("stock_priority_low")})]})]})]})]})})}function de(){const s=y(w),[r,t]=u.useState(!1),[l,a]=u.useState("all"),[c,j]=u.useState("all"),{data:d=[],isLoading:_}
1=H(),f=u.useMemo(()=>d.filter(n=>!(l!=="all"&&n.status!==l||c!=="all"&&n.priority!==c)),[d,l,c]),o=u.useMemo(()=>{const n=d.filter(g=>g.status==="needed").length,v=d.filter(g=>g.status==="ordered").length,E=d.filter(g=>g.priority==="urgent").length;return{needed:n,ordered:v,urgent:E}},[d]);return e.jsxs("div",{className:"min-h-screen bg-stone-50",children:[e.jsx("div",{className:"bg-white border-b border-stone-100 px-6 py-4",children:e.jsxs("div",{className:"max-w-4xl mx-auto flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-stone-800",children:s("stock_title")}),e.jsxs("p",{className:"text-sm text-stone-400 mt-0.5",children:[o.needed," ",s("stock_count_needed")," · ",o.ordered," ",s("stock_count_ordered"),o.urgent>0&&e.jsxs("span",{className:"ml-2 text-red-500 font-medium",children:["· ",o.urgent," ",s("stock_count_urgent")]})]})]}),e.jsxs(b,{className:"bg-black hover:bg-stone-800 text-white",onClick:()=>t(!0),children:[e.jsx(M,{className:"w-4 h-4 mr-1"}),s("stock_add_to_list")]})]})}),e.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-6 space-y-5",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx($,{className:"w-4 h-4 text-stone-400"}),e.jsxs(x,{value:l,onValueChange:a,children:[e.jsx(m,{className:"w-36 h-8 text-sm bg-white",children:e.jsx(p,{placeholder:s("stock_status")})}),e.jsxs(h,{children:[e.jsx(i,{value:"all",children:s("stock_all_statuses")}),e.jsx(i,{value:"needed",children:s("stock_status_needed")}),e.jsx(i,{value:"ordered",children:s("stock_status_ordered")}),e.jsx(i,{value:"received",children:s("stock_status_received")})]})]}),e.jsxs(x,{value:c,onValueChange:j,children:[e.jsx(m,{className:"w-36 h-8 text-sm bg-white",children:e.jsx(p,{placeholder:s("stock_priority")})}),e.jsxs(h,{children:[e.jsx(i,{value:"all",children:s("stock_all_priorities")}),e.jsx(i,{value:"urgent",children:s("stock_priority_urgent")}),e.jsx(i,{value:"normal",children:s("stock_priority_normal")}),e.jsx(i,{value:"low",children:s("stock_priority_low")})]})]}),(l!=="all"||c!=="all")&&e.jsx("button",{className:"text-xs text-black hover:underline",onClick:()=>{a("all"),j("all")},children:s("stock_clear_filters")})]}),_?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(n=>e.jsx("div",{className:"h-24 bg-white rounded-xl animate-pulse border border-stone-100"},n))}):f.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsx("p",{className:"text-stone-400 text-sm",children:d.length===0?s("stock_empty"):s("stock_empty_filtered")}),d.length===0&&e.jsx(b,{variant:"outline",className:"mt-4 border-stone-200 text-stone-700 hover:bg-stone-50",onClick:()=>t(!0),children:s("stock_add_first")})]}):e.jsx("div",{className:"space-y-3",children:f.map(n=>e.jsx(X,{item:n},n.id))}),e.jsxs("div",{className:"flex flex-wrap gap-4 pt-2",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("p",{className:"text-xs text-stone-400 font-medium",children:[s("stock_priority"),":"]}),["urgent","normal","low"].map(n=>e.jsx(S,{className:`${T[n]} border text-xs capitalize`,children:s(R[n])},n))]}),e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("p",{className:"text-xs text-stone-400 font-medium",children:[s("stock_status"),":"]}),["needed","ordered","received"].map(n=>e.jsx(S,{className:`${P[n]} border text-xs capitalize`,children:s(D[n])},n))]})]})]}),e.jsx(W,{open:r,onClose:()=>t(!1)})]})}export{de 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.