import{_ as w,u as C,r as b,o as E,b as n,c as r,j as $,d as e,T as D,t as l,F as z,k as L,g as i,f as j,l as B,n as v,i as m,L as N}from"./main.37e79106.js";import{g as A,a as R,m as S}from"./OrdenLavanderiaRepository.ed098771.js";const T={class:"layout-px-spacing"},I={class:"row layout-top-spacing"},M={class:"col-xl-12 col-lg-12 col-sm-12 layout-spacing"},O={class:"panel p-3"},V={class:"d-flex justify-content-between align-items-center mb-3"},F=["disabled"],P={class:"row g-3"},U={class:"card-body d-flex flex-column"},q={class:"d-flex justify-content-between align-items-center mb-1"},G={class:"badge bg-light text-dark"},H=["title"],J={key:0,class:"badge bg-danger ms-1"},K={class:"mb-1 text-muted small text-truncate"},Q={class:"mb-1 small text-muted etapa-label"},W={class:"mb-2 small text-muted"},X=["title"],Y={class:"mt-auto d-flex justify-content-between gap-1"},Z=["onClick"],ee=["onClick"],ae=["onClick"],te={key:0,class:"col-12"},se={__name:"dashboard",setup(oe){C({title:"Dashboard Lavander\xEDa"});const u=b([]),o=b(!1),p=t=>({recepcion:"Recepci\xF3n",lavado:"Lavado",secado:"Secado",planchado:"Planchado",terminado:"Terminado",entregado:"Entregado"})[t]||t,g=t=>!["terminado","entregado"].includes(t.current_step),f=t=>t.current_step==="terminado",c=(t="",s="success")=>{window.Swal.mixin({toast:!0,position:"top-end",showConfirmButton:!1,timer:3e3,timerProgressBar:!0}).fire({icon:s,title:t})},d=async()=>{o.value=!0;try{const t=await A();u.value=t.data||[]}catch(t){console.error(t),c("Error al cargar \xF3rdenes","error")}finally{o.value=!1}},y=async()=>{await d()},h=async t=>{try{o.value=!0;const s=await R(t.id);c("Orden actualizada","success"),await d()}catch(s){console.error(s),c("Error al avanzar la orden","error")}finally{o.value=!1}},x=async t=>{try{o.value=!0;const s=await S(t.id);c("Orden marcada como entregada","success"),await d()}catch(s){console.error(s),c("Error al marcar como entregada","error")}finally{o.value=!1}},k=t=>{const s=`
Folio: ${t.folio_unico}
Cliente: ${t.cliente_nombre}
Servicio: ${t.tipo_servicio}
Etapa: ${p(t.current_step)}
Minutos en etapa: ${t.minutos_en_etapa}
Instrucciones: ${t.instrucciones||"N/A"}
`;c(s,"info")};return E(async()=>{await d()}),(t,s)=>(n(),r("div",T,[(n(),$(D,{to:"#breadcrumb"},[s[1]||(s[1]=e("ul",{class:"navbar-nav flex-row"},[e("li",null,[e("div",{class:"page-header"},[e("nav",{class:"breadcrumb-one","aria-label":"breadcrumb"},[e("ol",{class:"breadcrumb"},[e("li",{class:"breadcrumb-item"},[e("a",{href:"javascript:;"},"Lavander\xEDa")]),e("li",{class:"breadcrumb-item active","aria-current":"page"},[e("span",null,"Dashboard Sem\xE1foro")])])])])])],-1))])),e("div",I,[e("div",M,[e("div",O,[e("div",V,[s[2]||(s[2]=e("h4",{class:"mb-0"},"\xD3rdenes en tiempo real",-1)),e("button",{class:"btn btn-outline-primary btn-sm",onClick:y,disabled:o.value},l(o.value?"Actualizando...":"Refrescar"),9,F)]),e("div",P,[(n(!0),r(z,null,L(u.value,a=>(n(),r("div",{key:a.id,class:"col-xl-3 col-lg-4 col-md-6 col-sm-12"},[e("div",{class:v(["card h-100 orden-card",[`orden-${a.color}`,{"orden-prioritaria":a.is_priority}]])},[e("div",U,[e("div",q,[e("span",G,l(a.folio_unico),1),e("span",{class:v(["badge",{"bg-success":a.color==="verde","bg-warning text-dark":a.color==="amarillo","bg-danger":a.color==="rojo"}])},l(a.color.toUpperCase()),3)]),e("h6",{class:"mb-1 text-truncate",title:a.cliente_nombre},[m(l(a.cliente_nombre)+" ",1),a.is_priority?(n(),r("span",J," PRIORIDAD ")):i("",!0)],8,H),e("p",K,l(a.tipo_servicio),1),e("p",Q,[s[3]||(s[3]=m(" Etapa: ",-1)),e("strong",null,l(p(a.current_step)),1)]),e("p",W,[s[4]||(s[4]=m(" Tiempo en etapa: ",-1)),e("strong",null,l(a.minutos_en_etapa)+" min",1)]),a.instrucciones?(n(),r("p",{key:0,class:"mb-2 small instrucciones text-truncate",title:a.instrucciones},l(a.instrucciones),9,X)):i("",!0),e("div",Y,[e("button",{class:"btn btn-outline-secondary btn-sm flex-fill",onClick:_=>k(a)}," Detalles ",8,Z),g(a)?(n(),r("button",{key:0,class:"btn btn-primary btn-sm flex-fill",onClick:_=>h(a)}," Avanzar ",8,ee)):i("",!0),f(a)?(n(),r("button",{key:1,class:"btn btn-success btn-sm flex-fill",onClick:_=>x(a)}," Entregar ",8,ae)):i("",!0)])])],2)]))),128)),!u.value.length&&!o.value?(n(),r("div",te,[...s[5]||(s[5]=[e("div",{class:"alert alert-info mb-0 text-center"}," No hay \xF3rdenes pendientes o en proceso. ",-1)])])):i("",!0)])])])]),j(B(N),{active:o.value,"onUpdate:active":s[0]||(s[0]=a=>o.value=a),"can-cancel":!1,"is-full-page":!0},null,8,["active"])]))}},le=w(se,[["__scopeId","data-v-38ed333e"]]);export{le as default};
