import{j as K,aa as L,r as y,o as A,a as H,b as d,c as r,p as I,d as t,f as O,w as X,t as e,q as n,T as G,z as x,C as j,B as J,ab as Q,h as w,F as k,s as R,g as N,v as W}from"./main.84523976.js";import{u as Y}from"./use-meta.97669149.js";const Z="entregas/pases-entrada",tt=async(C={})=>(await K.get(Z,{params:C})).data,et={class:"layout-px-spacing"},st={class:"navbar-nav flex-row"},at={class:"page-header"},ot={class:"breadcrumb-one","aria-label":"breadcrumb"},lt={class:"breadcrumb"},nt={class:"breadcrumb-item"},it={class:"breadcrumb-item active","aria-current":"page"},dt={class:"row layout-top-spacing"},rt={class:"col-xl-12 layout-spacing"},_t={class:"panel p-4"},ct={class:"d-flex flex-wrap justify-content-between align-items-start gap-2 mb-4"},ut={class:"titulo-dorado mb-1"},vt={class:"text-muted mb-0 small"},mt=["disabled"],bt={class:"row g-3 mb-4"},ht={class:"col-md-3"},pt={class:"form-label"},ft={class:"col-md-3"},gt={class:"form-label"},yt={class:"col-md-3"},xt={class:"form-label"},wt={value:""},kt={value:"pendiente"},$t={value:"utilizado"},jt={value:"salida_sin_venta"},Ct={class:"col-md-3"},St={class:"form-label"},Vt=["placeholder"],Bt={key:0,class:"text-center py-5 text-muted"},Tt={key:1,class:"alert alert-light border mb-0"},Et={key:2,class:"table-responsive"},Ft={class:"table table-hover align-middle"},Mt={class:"text-end"},Ut={class:"font-monospace fw-semibold"},zt={class:"small"},Nt={class:"small"},Pt={class:"text-muted"},Dt={key:1,class:"text-muted"},qt={class:"small"},Kt={key:0,class:"badge bg-success ms-1"},Lt={key:2,class:"text-muted"},At={class:"small",style:{"max-width":"180px"}},Ht=["title"],It={key:1,class:"text-muted"},Ot={class:"small",style:{"max-width":"180px"}},Xt=["title"],Gt={key:1,class:"text-muted"},Jt={class:"text-end"},Qt=["onClick"],Rt={key:3,class:"d-flex justify-content-between align-items-center mt-3"},Wt={class:"text-muted"},Yt={class:"btn-group"},Zt=["disabled"],te=["disabled"],ae={__name:"PasesEntrada",setup(C){const{t:a}=L();Y({title:"Pases de entrada"});const b=y(!1),p=y([]),c=y({current_page:1,last_page:1,from:0,to:0,total:0}),u=y({fecha_desde:"",fecha_hasta:"",estatus:"",folio:""});function S(l){if(!l)return"\u2014";try{return new Date(l).toLocaleString("es-MX",{dateStyle:"short",timeStyle:"short"})}catch{return l}}function V(l,o=80){const _=String(l||"").trim();return _?_.length>o?`${_.slice(0,o)}\u2026`:_:"\u2014"}function P(l){return l==="utilizado"?"bg-success":l==="salida_sin_venta"?"bg-warning text-dark":l==="pendiente"?"bg-secondary":"bg-light text-dark"}function D(l){var _,s;const o=[];return(l.observacion_entrada||l.observacion_salida)&&o.push(`
      <div class="mb-3 text-start">
        ${l.observacion_entrada?`<div class="small mb-2"><strong>${a("pases_entrada_col_obs_entrada")}:</strong> ${l.observacion_entrada}</div>`:""}
        ${l.observacion_salida?`<div class="small mb-0"><strong>${a("pases_entrada_col_obs_salida")}:</strong> ${l.observacion_salida}</div>`:""}
      </div>
    `),l.foto_entrada_url&&o.push(`
      <div class="mb-3">
        <div class="small fw-semibold mb-2">${a("pases_entrada_foto_entrada")}</div>
        <img src="${l.foto_entrada_url}" alt="Entrada" class="img-fluid rounded border" style="max-height:280px" />
      </div>
    `),l.estatus==="salida_sin_venta"&&l.foto_salida_url&&o.push(`
      <div class="mb-3">
        <div class="small fw-semibold mb-2">${a("pases_entrada_foto_salida")}</div>
        <img src="${l.foto_salida_url}" alt="Salida" class="img-fluid rounded border" style="max-height:280px" />
      </div>
    `),(s=(_=l.venta)==null?void 0:_.fotos_salida)!=null&&s.length&&l.venta.fotos_salida.forEach(v=>{!v.foto_url||o.push(`
        <div class="mb-3">
          <div class="small fw-semibold mb-2">${a("pases_entrada_foto_viaje",{n:v.numero_viaje})}</div>
          <img src="${v.foto_url}" alt="Viaje ${v.numero_viaje}" class="img-fluid rounded border" style="max-height:280px" />
        </div>
      `)}),o.length?o.join(""):`<p class="text-muted mb-0">${a("pases_entrada_sin_fotos")}</p>`}function q(l){var o,_;(_=(o=window.Swal)==null?void 0:o.fire)==null||_.call(o,{title:l.folio,html:D(l),width:720,confirmButtonText:a("vigilante_pase_entregar")})}async function f(l=1){var o,_,s,v,T,E,F,M,U,g,z;b.value=!0;try{const m={page:l,per_page:25,...u.value};Object.keys(m).forEach($=>{(m[$]===""||m[$]==null)&&delete m[$]});const h=await tt(m),i=(o=h==null?void 0:h.data)!=null?o:h;p.value=(_=i==null?void 0:i.data)!=null?_:[],c.value={current_page:(s=i==null?void 0:i.current_page)!=null?s:1,last_page:(v=i==null?void 0:i.last_page)!=null?v:1,from:(T=i==null?void 0:i.from)!=null?T:0,to:(E=i==null?void 0:i.to)!=null?E:0,total:(F=i==null?void 0:i.total)!=null?F:p.value.length}}catch(m){p.value=[];const h=((U=(M=m.response)==null?void 0:M.data)==null?void 0:U.message)||m.message;(z=(g=window.Swal)==null?void 0:g.fire)==null||z.call(g,{icon:"error",title:a("vigilante_error"),text:h})}finally{b.value=!1}}function B(l){f(l)}return A(()=>f()),(l,o)=>{const _=H("router-link");return d(),r("div",et,[(d(),I(G,{to:"#breadcrumb"},[t("ul",st,[t("li",null,[t("div",at,[t("nav",ot,[t("ol",lt,[t("li",nt,[O(_,{to:"/entregas/vigilante"},{default:X(()=>[w(e(n(a)("vigilante_titulo")),1)]),_:1})]),t("li",it,[t("span",null,e(n(a)("pases_entrada_titulo")),1)])])])])])])])),t("div",dt,[t("div",rt,[t("div",_t,[t("div",ct,[t("div",null,[t("h3",ut,e(n(a)("pases_entrada_titulo")),1),t("p",vt,e(n(a)("pases_entrada_desc")),1)]),t("button",{type:"button",class:"btn btn-primary",disabled:b.value,onClick:f},e(n(a)("pases_entrada_refrescar")),9,mt)]),t("div",bt,[t("div",ht,[t("label",pt,e(n(a)("pases_entrada_fecha_desde")),1),x(t("input",{"onUpdate:modelValue":o[0]||(o[0]=s=>u.value.fecha_desde=s),type:"date",class:"form-control"},null,512),[[j,u.value.fecha_desde]])]),t("div",ft,[t("label",gt,e(n(a)("pases_entrada_fecha_hasta")),1),x(t("input",{"onUpdate:modelValue":o[1]||(o[1]=s=>u.value.fecha_hasta=s),type:"date",class:"form-control"},null,512),[[j,u.value.fecha_hasta]])]),t("div",yt,[t("label",xt,e(n(a)("pases_entrada_estatus")),1),x(t("select",{"onUpdate:modelValue":o[2]||(o[2]=s=>u.value.estatus=s),class:"form-select"},[t("option",wt,e(n(a)("pases_entrada_todos")),1),t("option",kt,e(n(a)("pases_entrada_estatus_pendiente")),1),t("option",$t,e(n(a)("pases_entrada_estatus_venta")),1),t("option",jt,e(n(a)("pases_entrada_estatus_salida_sin_venta")),1)],512),[[J,u.value.estatus]])]),t("div",Ct,[t("label",St,e(n(a)("pases_entrada_folio")),1),x(t("input",{"onUpdate:modelValue":o[3]||(o[3]=s=>u.value.folio=s),type:"text",class:"form-control font-monospace",placeholder:n(a)("pases_entrada_folio_ph"),onKeyup:Q(f,["enter"])},null,40,Vt),[[j,u.value.folio]])])]),b.value?(d(),r("div",Bt,[o[6]||(o[6]=t("span",{class:"spinner-border spinner-border-sm me-2"},null,-1)),w(" "+e(n(a)("pos_cargando")),1)])):p.value.length===0?(d(),r("div",Tt,e(n(a)("pases_entrada_vacio")),1)):(d(),r("div",Et,[t("table",Ft,[t("thead",null,[t("tr",null,[t("th",null,e(n(a)("pases_entrada_col_folio")),1),t("th",null,e(n(a)("pases_entrada_col_fecha")),1),t("th",null,e(n(a)("pases_entrada_col_resultado")),1),t("th",null,e(n(a)("pases_entrada_col_venta")),1),t("th",null,e(n(a)("pases_entrada_col_salida")),1),t("th",null,e(n(a)("pases_entrada_col_obs_entrada")),1),t("th",null,e(n(a)("pases_entrada_col_obs_salida")),1),t("th",Mt,e(n(a)("pases_entrada_col_fotos")),1)])]),t("tbody",null,[(d(!0),r(k,null,R(p.value,s=>(d(),r("tr",{key:s.id},[t("td",Ut,e(s.folio),1),t("td",zt,e(S(s.created_at)),1),t("td",null,[t("span",{class:W(["badge",P(s.estatus)])},e(s.resultado_label),3)]),t("td",Nt,[s.venta?(d(),r(k,{key:0},[t("div",null,e(s.venta.folio),1),t("div",Pt,e(s.venta.cliente||"\u2014"),1)],64)):(d(),r("span",Dt,"\u2014"))]),t("td",qt,[s.estatus==="salida_sin_venta"?(d(),r(k,{key:0},[w(e(S(s.salida_at)),1)],64)):s.venta?(d(),r(k,{key:1},[w(e(s.venta.viajes_usados)+"/"+e(s.venta.viajes_permitidos)+" ",1),s.venta.salida_completa?(d(),r("span",Kt,e(n(a)("vigilante_completado")),1)):N("",!0)],64)):(d(),r("span",Lt,"\u2014"))]),t("td",At,[s.observacion_entrada?(d(),r("span",{key:0,title:s.observacion_entrada},e(V(s.observacion_entrada)),9,Ht)):(d(),r("span",It,"\u2014"))]),t("td",Ot,[s.observacion_salida?(d(),r("span",{key:0,title:s.observacion_salida},e(V(s.observacion_salida)),9,Xt)):(d(),r("span",Gt,"\u2014"))]),t("td",Jt,[t("button",{type:"button",class:"btn btn-sm btn-outline-primary",onClick:v=>q(s)},e(n(a)("pases_entrada_ver_fotos")),9,Qt)])]))),128))])])])),c.value.last_page>1?(d(),r("div",Rt,[t("small",Wt,e(c.value.from)+"\u2013"+e(c.value.to)+" / "+e(c.value.total),1),t("div",Yt,[t("button",{type:"button",class:"btn btn-sm btn-outline-secondary",disabled:c.value.current_page<=1||b.value,onClick:o[4]||(o[4]=s=>B(c.value.current_page-1))}," \u2039 ",8,Zt),t("button",{type:"button",class:"btn btn-sm btn-outline-secondary",disabled:c.value.current_page>=c.value.last_page||b.value,onClick:o[5]||(o[5]=s=>B(c.value.current_page+1))}," \u203A ",8,te)])])):N("",!0)])])])])}}};export{ae as default};
