PageSourceSearch

https://sistema.yacamba.com/assets/GeneralForm-C0dLrn6r.js

js yacamba.com collected 2026-09-24 11:07:14 UTC 9,454 bytes, 1 lines download raw bytes

1import{jc as I,hH as c,gT as e,b6 as B,de as O,y as v,am as Y,ah as q,bO as C,bQ as y,fm as j,z as P,em as S,bP as k,iU as E,j1 as A,i_ as M,eI as G,aQ as $}from"./index-DfEzlclk.js";import{S as R}from"./switch-BxVCM1la.js";import{editGeneralInfo as V,createGeneralInfo as z,getCustomer as L}from"./utils-CaAhyYPE.js";import{D as Q,g as J,b as U,e as K}from"./drawer-Ch_49rYl.js";import{C as D}from"./calendar-CYaAk85-.js";import{a as W,S as N,T as m,b as X,F as Z,f as ee}from"./SectionKit-UmoIxhTp.js";import"./index-DzrlfVn7.js";import"./csfApply-p28rz2fU.js";import"./endOfMonth-CltHSOWp.js";import"./subDays-qKYcXrMN.js";import"./addDays-Bo6lmrjB.js";import"./SheetPicker-DkmVY5FX.js";function te({setFunctionParent:t,index:i,disabled:x}){const{t:l}=I(),[r,p]=c.useState(!1),[s,o]=c.useState(!1),[n,f]=c.useState(!1),[d,b]=c.useState("".replace(/-/g,"/")),[a,u]=c.useState("".replace(/-/g,"/")),h=g=>{b(g),o(!1)},T=g=>{u(g),f(!1)},H=()=>{!d||!a||(t(d,a,i),w())},w=()=>{o(!1),f(!1),b("".replace(/-/g,"/")),u("".replace(/-/g,"/")),p(!1)};return e.jsxs(Q,{open:r,onOpenChange:p,children:[e.jsxs(J,{disabled:x,className:"flex h-[24px] items-center gap-x-1 rounded-xl bg-blancoBox2 px-2 text-xs font-medium text-grisHeading hover:bg-blancoBox2",children:[e.jsx(B,{className:"h-5 w-5",icon:O}),e.jsx("span",{className:"truncate",children:l("Periodo")})]}),e.jsxs(U,{className:"h-[40%] px-0 pb-6",children:[e.jsxs("div",{className:"mt-0 flex items-center justify-between px-4",children:[e.jsx(v,{type:"button",variant:"ghost",className:"h-8 min-w-16 whitespace-normal rounded-xl px-2 font-roboto text-xs font-normal text-grisHeading",onClick:()=>w(),children:l("Cancelar")}),e.jsx("div",{className:"flex-1 break-words pl-3 text-center text-[14px] font-semibold leading-tight",children:l("Seleccionar Periodo")}),e.jsx(v,{type:"button",variant:"ghost",className:"h-8 min-w-16 whitespace-normal rounded-xl px-2 font-roboto text-xs font-normal text-primarioBotones hover:bg-blancoForms hover:text-primarioBotones",onClick:()=>H(),children:l("Aceptar")})]}),e.jsx(K,{className:"flex items-center justify-center gap-0 border-b py-3"}),e.jsx(Y,{className:"hidden"}),e.jsx(q,{className:"hidden"}),e.jsxs("div",{className:"mt-4 flex flex-col gap-4 px-4",children:[e.jsxs("div",{className:"w-full",children:[e.jsx("p",{className:"mb-1 overflow-visible text-xs font-normal text-grisText",children:l("Inicio")}),e.jsxs(C,{open:s,onOpenChange:o,children:[e.jsx(y,{asChild:!0,children:e.jsxs(v,{variant:"outline",className:S("min-h-10 w-full justify-between overflow-hidden rounded-lg border border-grisDisabled bg-inherit px-3 font-roboto text-sm font-light text-grisHeading focus-visible:ring-primarioBotones",!d&&"text-muted-foreground"),children:[e.jsx("div",{className:"w-full truncate text-left",children:d?j(d,"PP"):e.jsx("span",{children:"MM/DD/YYYY"})}),e.jsx(P,{className:"ml-2 h-4 w-4 flex-shrink-0"})]})}),e.jsx(k,{className:"w-auto p-0",children:e.jsx(D,{mode:"single",selected:d,onSelect:g=>h(g),initialFocus:!0})})]})]}),e.jsxs("div",{className:"w-full",children:[e.jsx("p",{className:"mb-1 overflow-visible text-xs font-normal text-grisText",children:l("Finalización")}),e.jsxs(C,{open:n,onOpenChange:f,children:[e.jsx(y,{asChild:!0,children:e.jsxs(v,{variant:"outline",className:S("min-h-10 w-full justify-between overflow-hidden rounded-lg border border-grisDisabled bg-inherit px-3 font-roboto text-sm font-light text-grisHeading focus-visible:ring-primarioBotones",!a&&"text-muted-foreground"),children:[e.jsx("div",{className:"w-full truncate text-left",children:a?j(a,"PP"):e.jsx("span",{children:"MM/DD/YYYY"})}),e.jsx(P,{className:"ml-2 h-4 w-4 flex-shrink-0"})]})}),e.jsx(k,{className:"w-auto p-0",children:e.jsx(D,{mode:"single",selected:a,onSelect:g=>T(g),initialFocus:!0})})]})]})]})]})]})}const F={street:"",int:"",ext:"",cologne:"",city:"",state:"",cp:"",country:"",status:!1,start:"",end:"",shopping_person:"",comment:""},_=t=>{var i,x,l,r,p,s,o,n;return{street:((i=t==null?void 0:t.address)==null?void 0:i.street)||"",int:((x=t==null?void 0:t.address)==null?void 0:x.int)||"",ext:((l=t==null?void 0:t.address)==null?void 0:l.ext)||"",cologne:((r=t==null?void 0:t.address)==null?void 0:r.cologne)||"",city:((p=t==null?void 0:t.address)==null?void 0:p.city)||"",state:((s=t==null?void 0:t.address)==null?void 0:s.state)||"",cp:((o=t==null?void 0:t.address)==null?void 0:o.cp)||"",country:((n=t==null?void 0:t.address)==null?void 0:n.country)||"",status:(t==null?void 0:t.status)=="1",start:(t==null?void 0:t.from_date)||"",end:(t==null?void 0:t.to_date)||"",shopping_person:(t==null?void 0:t.shopping_boss)||"",comment:(t==null?void 0:t.comments)||""}};function ue(){var b;const{t}=I(),i=E(),x=A(),l=M(),r=i.customer.data,p=c.useMemo(()=>(r.contacts||[]).map(a=>({label:a.name,value:a.id})),[r.contacts]),[s,o]=c.useState({...F,..._(r)}),n=c.useCallback((a,u)=>{o(h=>({...h,[a]:u}))},[]),f=G();c.useEffect(()=>{const a=`private-get-transactional-client.${x.id}`;return f.subscribe(a).bind("fill-transactional-client",async()=>{const h=await L(x.id);o({...F,..._(h==null?void 0:h.data)})}),()=>f.unsubscribe(a)},[x.id]);const d=!!s.start&&!!s.end;return e.jsx(W,{title:t("General"),subtitle:t("Dirección, vigencia y comentarios"),formId:"form-general",saving:l.state==="submitting",children:e.jsxs($,{id:"form-general",action:`/sales-mobile/customer/edit/${r.id}/general`,method:"post",className:"flex flex-col gap-y-3",children:[e.jsx("input",{type:"hidden",hidden:!0,name:"client_transactional_id",value:r.
1id}),e.jsx("input",{type:"hidden",hidden:!0,name:"info_id",value:(b=r==null?void 0:r.general)==null?void 0:b.id}),e.jsx("input",{type:"hidden",hidden:!0,name:"type",value:"generalInfo"}),e.jsxs(N,{children:[e.jsx(m,{label:t("Calle"),name:"street",value:s.street,onChange:a=>n("street",a.target.value),placeholder:t("Av. Vallarta")}),e.jsxs("div",{className:"flex gap-x-2.5",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(m,{label:t("Número Ext."),required:!0,name:"ext",value:s.ext,onChange:a=>n("ext",a.target.value),placeholder:"1200"})}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(m,{label:t("Número Int."),required:!0,name:"int",value:s.int,onChange:a=>n("int",a.target.value),placeholder:t("3B")})})]}),e.jsx(m,{label:t("Colonia"),required:!0,name:"cologne",value:s.cologne,onChange:a=>n("cologne",a.target.value),placeholder:t("Americana")}),e.jsxs("div",{className:"flex gap-x-2.5",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(m,{label:t("Ciudad"),required:!0,name:"city",value:s.city,onChange:a=>n("city",a.target.value),placeholder:t("Guadalajara")})}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(m,{label:t("Estado"),required:!0,name:"state",value:s.state,onChange:a=>n("state",a.target.value),placeholder:"JAL"})})]}),e.jsxs("div",{className:"flex gap-x-2.5",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(m,{label:t("CP"),required:!0,name:"cp",value:s.cp,onChange:a=>n("cp",a.target.value),placeholder:"44100"})}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(m,{label:t("País"),required:!0,name:"country",value:s.country,onChange:a=>n("country",a.target.value),placeholder:t("México")})})]})]}),e.jsxs(N,{children:[e.jsx("p",{className:"font-jakarta text-[14.5px] font-bold text-grisHeading",children:t("Estatus")}),e.jsxs("div",{className:"mt-3 flex items-center gap-x-3",children:[e.jsx(R,{className:"data-[state=checked]:bg-violetBlue data-[state=unchecked]:bg-grisDisabled",checked:s.status,onCheckedChange:a=>n("status",a)}),e.jsx("span",{className:"min-w-0 flex-1 font-jakarta text-[13.5px] font-bold text-grisHeading",children:s.status?t("Activo"):t("Inactivo")}),d?e.jsx("button",{type:"button",onClick:()=>{n("start",""),n("end","")},className:"h-8 shrink-0 rounded-[10px] bg-blancoForms px-3 font-jakarta text-[12px] font-bold text-deleteRed active:scale-[.98] dark:bg-white/5",children:t("Restablecer")}):e.jsx(te,{setFunctionParent:(a,u)=>{n("start",a),n("end",u)}})]}),d?e.jsxs("div",{className:"mt-3 flex items-center gap-x-2",children:[e.jsx("input",{type:"hidden",hidden:!0,name:"start",value:j(s.start,"PP")}),e.jsx("input",{type:"hidden",hidden:!0,name:"end",value:j(s.end,"PP")}),e.jsx("span",{className:"rounded-[9px] bg-blancoForms px-2.5 py-1 font-jakarta text-[12px] font-bold text-grisHeading dark:bg-white/5",children:j(s.start,"PP")}),e.jsx("span",{className:"font-jakarta text-[12px] font-bold text-grisSubText",children:"→"}),e.jsx("span",{className:"rounded-[9px] bg-blancoForms px-2.5 py-1 font-jakarta text-[12px] font-bold text-grisHeading dark:bg-white/5",children:j(s.end,"PP")})]}):e.jsx("p",{className:"mt-2 font-jakarta text-[11.5px] font-semibold text-grisSubText",children:t("Sin periodo de tiempo: el cliente está vigente siempre.")})]}),e.jsxs(N,{children:[e.jsx(X,{label:t("Encargado de compras"),name:"shopping_person",options:p,value:s.shopping_person,onChange:a=>n("shopping_person",a.value),hint:t("Se elige entre los contactos registrados del cliente.")}),e.jsx(Z,{label:t("Comentarios"),children:e.jsx("textarea",{name:"comment",rows:4,value:s.comment,onChange:a=>n("comment",a.target.value),placeholder:t("Notas internas sobre este cliente"),className:`${ee} h-auto py-3`})})]})]})})}async function he({request:t}){const i=await t.formData();switch(i.get("type")){case"generalInfo":i.get("info_id")?await V(i):await z(i);break}return"0"}export{he as Action,ue 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.