PageSourceSearch

https://sistema.yacamba.com/assets/BillingForm-DuNfP-I0.js

js yacamba.com collected 2026-10-01 14:29:05 UTC 6,048 bytes, 1 lines download raw bytes

1import{j4 as w,iT as z,iQ as q,hA as l,hD as E,h5 as F,j6 as L,gY as a,cU as k,a_ as $,cT as y,N as D,dl as S,cV as C,dr as M,iL as O,eZ as N,cH as P,aL as U,bC as G,bf as V,dx as W,ag as H,cc as Q,ac as X}from"./index-DJZVjtmQ.js";import{destroyBillingInfo as Y,editBillingInfo as Z,createBillingInfo as J,getCustomer as K}from"./utils-DmlhPcEv.js";import{F as I}from"./file-text-Dz_AMiL-.js";import{S as ee}from"./star-MnLOFP-U.js";const B={regimen_fiscal:"",rfc:"",uso_cfdi:"",metodo_pago:"",razon_social:"",email:"",forma_pago:"0",active:"1",start:"",end:"",principal_record:!1};function ae({billings:n,billingId:s,setBillingtId:u,setShow:h}){const{t:i}=w(),m=z(),g=q(),[t,_]=l.useState(B),[p,r]=l.useState(!1),b=()=>{u(null),h(!1),_(B)};l.useEffect(()=>{p&&g.state==="idle"&&(b(),r(!1))},[g.state,p]),l.useEffect(()=>{if(s===null)return;const e=n.find(d=>d.billing_id===s);e&&_(e)},[s,n]);const x=E.map(e=>({label:`${e.value} - ${e.label}`,value:e.value})),j=F.map(e=>({label:e.label,value:e.value})),o=l.useMemo(()=>L.filter(e=>e.regimenes.find(d=>d==t.regimen_fiscal)).map(e=>({label:e.label,value:e.value})),[t.regimen_fiscal]),v=l.useMemo(()=>{var e;return((e=F.find(d=>d.value==t.metodo_pago))==null?void 0:e.forma)||[]},[t.metodo_pago]),c=e=>d=>_(T=>({...T,[e]:d})),f=e=>d=>c(e)(d.target.value),A=!t.regimen_fiscal||!t.uso_cfdi||!t.metodo_pago||!t.forma_pago||t.forma_pago==="0";return a.jsx(k,{title:t.billing_id?i("Editar registro"):i("Nuevo registro"),subtitle:t.razon_social||i("RFC, régimen fiscal y CFDI"),formId:"new-billing",saving:g.state==="submitting",disabled:A,saveLabel:i("Guardar registro"),savedMessage:i(s?"Registro editado":"Registro agregado"),onClose:b,children:a.jsxs($,{id:"new-billing",action:`/sales-mobile/customer/edit/${m.id}/billing`,method:"post",onSubmit:()=>r(!0),children:[a.jsx("input",{type:"hidden",hidden:!0,name:"client_transactional_id",value:m.id}),a.jsx("input",{type:"hidden",hidden:!0,name:"supplier_id",value:m.id}),a.jsx("input",{type:"hidden",name:"billing_id",value:t.billing_id||"",readOnly:!0}),a.jsx("input",{type:"hidden",hidden:!0,name:"type",value:"billing"}),a.jsx(y,{title:i("Datos fiscales"),children:a.jsxs(D,{children:[a.jsx(S,{label:i("Razón social"),required:!0,name:"razon_social",value:t.razon_social,onChange:f("razon_social"),placeholder:i("Grupo Ferretero Altamira SA de CV"),hint:i("Como aparece en la constancia de situación fiscal.")}),a.jsx(S,{label:"RFC",required:!0,name:"rfc",value:t.rfc,onChange:f("rfc"),placeholder:i("GFA980412ABC"),hint:i("12 caracteres para persona moral, 13 para física.")}),a.jsx(S,{label:i("Correo de facturación"),name:"email",type:"email",value:t.email,onChange:f("email"),placeholder:i("[email protected]"),hint:i("A esta dirección se envían el PDF y el XML.")})]})}),a.jsx(y,{title:i("CFDI"),children:a.jsxs(D,{children:[a.jsx(C,{label:i("Régimen Fiscal"),required:!0,name:"regimen_fiscal",options:x,value:t.regimen_fiscal,onChange:e=>c("regimen_fiscal")(e.value),hint:i("Debe coincidir con el SAT o el CFDI se rechaza.")}),a.jsx(C,{label:i("Uso de CFDI"),required:!0,name:"uso_cfdi",options:o,value:t.uso_cfdi,onChange:e=>c("uso_cfdi")(e.value),disabled:!t.regimen_fiscal,hint:i("Solo se listan los usos válidos para el régimen elegido.")}),a.jsx(C,{label:i("Método de pago"),required:!0,name:"metodo_pago",options:j,value:t.metodo_pago,onChange:e=>c("metodo_pago")(e.value)}),a.jsx(C,{label:i("Forma de pago"),required:!0,name:"forma_pago",options:v,value:t.forma_pago,onChange:e=>c("forma_pago")(e.value),disabled:!t.metodo_pago}),a.jsx(M,{label:i("Registro principal"),note:i("Es el que se usa por defecto al facturarle."),value:!!t.principal_record,onChange:e=>c("principal_record")(e),on:i("Sí"),off:i("No")}),a.jsx("input",{type:"hidden",name:"principal_record",value:t.principal_record?"1":""})]})})]})})}const R=n=>(n||[]).map(s=>({...s,billing_id:s.id})),ie=n=>{const s=E.find(u=>u.value===Number(n));return s?`${s.value} - ${s.label}`:""};function le(){const{t:n}=w(),s=O(),u=z(),h=s.customer.data,[i,m]=l.useState(!1),[g,t]=l.useState(()=>R(h==null?void 0:h.billing)),[_,p]=l.useState(null),[r,b]=l.useState(null),x=N();l.useEffect(()=>{const o=`private-get-transactional-client.${u.id}`;return x.subscribe(o).bind("fill-transactional-client",async()=>{var f;const c=await K(u.id);t(R((f=c==null?void 0:c.data)==null?void 0:f.billing))}),()=>x.unsubscribe(o)},[u.id]);const j=`/sales-mobile/customer/edit/${u.id}/billing`;return a.jsxs(P,{children:[i?a.jsx(ae,{billings:g,billingId:_,setBillingtId:p,setShow:m}):a.jsx(k,{title:n("Información de facturación"),subtitle:n("RFC, régimen fiscal y uso de CFDI"),footer:a.jsxs(H,{onClick:()=>{p(null),m(!0)},style:";flex:1;justify-content:center;height:48px",children:[a.jsx(Q,{size:16,strokeWidth:2.4}),n("Agregar registro")]}),children:g.length===0?a.jsx(U,{icon:I,title:n("Sin datos fiscales"),text:n("Sin RFC y régimen fiscal no se le puede timbrar una factura.")}):a.jsx(y,{children:g.map((o,v)=>a.jsx(G,{first:v===0,icon:I,tone:o.principal_record?"ok":"raised",title:o.razon_social||n("Sin razón social"),mono:!0,sub:[o.rfc,ie(o.regimen_fiscal)].filter(
1Boolean).join(" · ")||n("Sin RFC"),chip:o.principal_record?a.jsx(ee,{size:14,fill:"var(--pos-warn-2)",color:"var(--pos-warn-2)",style:{flexShrink:0}}):null,onClick:()=>{p(o.billing_id),m(!0)},right:a.jsx(V,{title:n("Eliminar"),onClick:()=>b(o),style:";color:var(--danger)",children:a.jsx(W,{size:15,strokeWidth:1.9})})},o.billing_id))})}),a.jsx(X,{open:!!r,onClose:()=>b(null),title:n("Eliminar registro"),body:n("Estas tratando de destruir la información de facturación {{billingname}}, ¿Estás Seguro?",{billingname:r==null?void 0:r.razon_social}),action:j,hidden:{billing_id:r==null?void 0:r.billing_id,type:"destroy_invoice"},doneMessage:n("Registro eliminado")})]})}async function re({request:n}){const s=await n.formData();switch(s.get("type")){case"billing":s.get("billing_id")?await Z(s):await J(s);break;case"destroy_invoice":await Y(s);break}return"0"}export{re as Action,le 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.