PageSourceSearch

https://creditos.somosziro.com/chunk-HKRPMY5Y.js

js somosziro.com collected 2026-10-07 04:18:03 UTC 13,861 bytes, 1 lines download raw bytes

1import{a as te}from"./chunk-VH2QCD4W.js";import{a as ee}from"./chunk-L7HSHIEE.js";import{b as Y,c as Z}from"./chunk-HZB6WFJ5.js";import{a as f}from"./chunk-NUC6BEEO.js";import"./chunk-LGQXCYCX.js";import{A as X,b as w,c as O,d as m,f as V,g as $,k as P,l as G,o as j,p as U,q as z,r as H,s as J,t as K,u as Q,y as W}from"./chunk-DNNY4O57.js";import{a as D}from"./chunk-NPABV3IJ.js";import{a as B}from"./chunk-TLJ5UPI2.js";import{a as L}from"./chunk-TZF5454P.js";import{Da as d,Gb as R,M as g,Mc as T,Na as S,Nc as q,Sa as u,Y as F,Za as h,aa as p,ab as y,ba as M,bb as E,cb as n,db as t,eb as a,kb as v,pa as A,rc as k,vb as r,wb as x,zc as I}from"./chunk-4P234F3D.js";var _=class s{http=p(I);baseUrl=L.apiUrlCustomer;getAdvisorsByShopCommerce(e){return this.http.get(`${this.baseUrl}/customers/backoffice/manual/advisors`,{params:{shop_commerce_id:e}})}createManualCustomer(e,o,i,l){let c=new FormData,b=new Blob([JSON.stringify(e)],{type:"application/json"});return c.append("request",b,"request.json"),c.append("photo_document_front",o),c.append("photo_document_back",i),c.append("photo_selfie",l),this.http.post(`${this.baseUrl}/customers/backoffice/manual`,c)}static \u0275fac=function(o){return new(o||s)};static \u0275prov=F({token:s,factory:s.\u0275fac,providedIn:"root"})};var ie=(s,e)=>e.value;function oe(s,e){s&1&&(n(0,"p",4),r(1,"Cargando cat\xE1logos..."),t())}function re(s,e){s&1&&(n(0,"div",5),r(1," Faltan cat\xE1logos (ciudad, tipo de negocio o comercio). Verifique la configuraci\xF3n antes de continuar. "),t())}function ae(s,e){if(s&1&&(n(0,"option",14),r(1),t()),s&2){let o=e.$implicit;u("value",o.value),d(),x(o.label)}}function le(s,e){if(s&1&&(n(0,"option",14),r(1),t()),s&2){let o=e.$implicit;u("value",o.value),d(),x(o.label)}}function se(s,e){s&1&&r(0," Guardando... ")}function me(s,e){s&1&&r(0," Guardar cliente ")}var N=class s{fb=p(W);parametersService=p(ee);commercesService=p(te);manualCustomerService=p(_);modalAlertService=p(D);router=p(T);destroyRef=p(A);form;saving=!1;catalogsLoading=!0;advisorsLoading=!1;cities=[];businessTypes=[];shopCommerces=[];advisors=[];photoDocumentFront=null;photoDocumentBack=null;photoSelfie=null;identificationTypes=[{value:"CC",label:"C\xE9dula"},{value:"CE",label:"C\xE9dula extranjer\xEDa"},{value:"PPT",label:"Permiso protecci\xF3n temporal"}];sexOptions=[{value:"M",label:"Masculino"},{value:"F",label:"Femenino"},{value:"NA",label:"No aplica"}];breadcrumbItems=[{label:"Clientes",url:"/clientes/listado"},{label:"Registro manual",url:"/clientes/registro-manual"}];ngOnInit(){this.buildForm(),this.loadCatalogs(),this.watchShopCommerceChanges()}buildForm(){this.form=this.fb.group({name:["",[m.required,m.maxLength(255)]],last_name:["",[m.required,m.maxLength(255)]],identification:["",[m.required,m.pattern(/^[0-9]+$/)]],identification_type:["CC",m.required],email:["",[m.required,m.email]],phone_1:["",[m.required,m.pattern(/^[0-9]+$/)]],phone_2:["",m.pattern(/^[0-9]*$/)],date_of_birth:["",m.required],shop_commerce_id:[null,m.required],city_id:[null,m.required],customer_business_types_id:[null,m.required],advisor_id:[{value:null,disabled:!0}],address:[""],business_address:[""],business_name:[""],nit:[""],date_expedition:[""],date_expiration:[""],nationality:[""],sexo:[null],value_request:[null,m.min(0)],previous_year_income:[null,[m.required,m.min(0)]],registered_chamber_commerce:[!0]})}watchShopCommerceChanges(){this.form.get("shop_commerce_id")?.valueChanges.pipe(f(this.destroyRef)).subscribe(e=>{if(this.form.patchValue({advisor_id:null},{emitEvent:!1}),this.advisors=[],e==null||e===""){this.form.get("advisor_id")?.disable({emitEvent:!1});return}this.loadAdvisors(Number(e))})}loadCatalogs(){this.catalogsLoading=!0;let e=3,o=()=>{e-=1,e<=0&&(this.catalogsLoading=!1)};this.parametersService.getCities().pipe(f(this.destroyRef)).subscribe({next:i=>{this.cities=i?.data??[],o()},error:()=>{this.cities=[],o()}}),this.parametersService.getBusinessTypes().pipe(f(this.destroyRef)).subscribe({next:i=>{this.businessTypes=i??[],o()},error:()=>{this.businessTypes=[],o()}}),this.commercesService.getShopCommercesList().pipe(f(this.destroyRef)).subscribe({next:i=>{this.shopCommerces=(i?.data??[]).filter(l=>l?.id!=null).map(l=>({id:l.id,name:l.code?`${l.name} (${l.code})`:l.name,code:l.code})),o()},error:()=>{this.shopCommerces=[],o()}})}loadAdvisors(e){this.advisorsLoading=!0,this.form.get("advisor_id")?.disable({emitEvent:!1}
1),this.manualCustomerService.getAdvisorsByShopCommerce(e).pipe(g(()=>{this.advisorsLoading=!1,this.form.get("advisor_id")?.enable({emitEvent:!1})}),f(this.destroyRef)).subscribe({next:o=>{this.advisors=(o?.data??[]).map(i=>this.toAdvisorOption(i))},error:()=>{this.advisors=[]}})}toAdvisorOption(e){let o=e.name?.trim()?e.name.trim():e.email?.trim()||`ID ${e.id}`,i=e.identification?.trim()||"",l=e.provider_name?.trim()||"",c=e.shop_commerce_name?.trim()||"",b=l||c,C=o;return i&&(C+=` (${i})`),b&&(C+=` \u2014 ${b}`),{id:e.id,label:C,name:o,identification:i||void 0,providerName:b||void 0,shopCommerceName:c||void 0}}searchAdvisor(e,o){let i=e.trim().toLowerCase();return i?o.label.toLowerCase().includes(i)||(o.identification?.toLowerCase().includes(i)??!1)||o.name.toLowerCase().includes(i):!0}onFileSelected(e,o){let l=e.target.files?.[0]??null;o==="front"?this.photoDocumentFront=l:o==="back"?this.photoDocumentBack=l:this.photoSelfie=l}submit(){if(this.form.invalid){this.form.markAllAsTouched(),this.modalAlertService.openModal("Formulario incompleto","Revise los campos obligatorios.","warning");return}if(!this.photoDocumentFront||!this.photoDocumentBack||!this.photoSelfie){this.modalAlertService.openModal("Documentos requeridos","Debe adjuntar las tres fotos: documento frontal, reverso y selfie.","warning");return}if(!this.catalogsReady){this.modalAlertService.openModal("Cat\xE1logos incompletos","Espere a que carguen ciudad, comercio y tipo de negocio.","warning");return}let e=this.form.getRawValue(),o={name:e.name?.trim(),last_name:e.last_name?.trim(),identification:e.identification?.trim(),identification_type:e.identification_type,email:e.email?.trim(),phone_1:e.phone_1?.trim(),phone_2:e.phone_2?.trim()||null,date_of_birth:e.date_of_birth,shop_commerce_id:Number(e.shop_commerce_id),city_id:Number(e.city_id),customer_business_types_id:Number(e.customer_business_types_id),address:e.address?.trim()||null,business_address:e.business_address?.trim()||null,business_name:e.business_name?.trim()||null,nit:e.nit?.trim()||null,advisor_id:e.advisor_id!=null?Number(e.advisor_id):null,date_expedition:e.date_expedition||null,date_expiration:e.date_expiration||null,nationality:e.nationality?.trim()||null,sexo:e.sexo||null,value_request:e.value_request!=null&&e.value_request!==""?Number(e.value_request):null,previous_year_income:e.previous_year_income!=null&&e.previous_year_income!==""?Number(e.previous_year_income):null,registered_chamber_commerce:!!e.registered_chamber_commerce};this.saving=!0,this.manualCustomerService.createManualCustomer(o,this.photoDocumentFront,this.photoDocumentBack,this.photoSelfie).pipe(g(()=>this.saving=!1),f(this.destroyRef)).subscribe({next:i=>{if(!i?.ok){this.modalAlertService.openModal("Error",i?.message??"No se pudo crear el cliente","error");return}this.modalAlertService.openModal("Cliente creado",i.message??"Registro manual completado.","success"),this.router.navigate(["/clientes/listado"],{queryParams:{identification:o.identification}})},error:i=>{let l=i?.error?.message??i?.message??"Error al crear el cliente";this.modalAlertService.openModal("Error",l,"error")}})}get catalogsReady(){return!this.catalogsLoading&&this.cities.length>0&&this.businessTypes.length>0&&this.shopCommerces.length>0}static \u0275fac=function(o){return new(o||s)};static \u0275cmp=M({type:s,selectors:[["app-customers-manual-create-index"]],standalone:!0,features:[R],decls:127,vars:21,consts:[["title","Registro manual de cliente",3,"items"],[1,"px-3","pb-4"],[1,"card","card-shadow"],[1,"card-body"],[1,"text-muted","mb-3"],[1,"alert","alert-warning"],[3,"ngSubmit","formGroup"],[1,"row","g-3"],[1,"col-md-6"],[1,"form-label"],["formControlName","name",1,"form-control"],["formControlName","last_name",1,"form-control"],["formControlName","identification",1,"form-control"],["formControlName","identification_type",1,"form-select"],[3,"value"],["type","email","formControlName","email",1,"form-control"],["formControlName","phone_1",1,"form-control"],["formControlName","phone_2",1,"form-control"],["type","date","formControlName","date_of_birth",1,"form-control"],["formControlName","shop_commerce_id","bindLabel","name","bindValue","id","placeholder","Seleccione comercio",3,"items","searchable","clearable"],["formControlName","city_id","bindLabel","name","bindValue","id","placeholder","Seleccione ciudad",3,"items","searchable","clearable"],["formControlName","customer_business_types_id","bindLabel","name","bindValue","id","placeholder","Seleccione tipo",3,"items","searchable","clearable"],[1,"text-muted","small","mb-1"],["formControlName","advisor_id","bindLabel","label","bindValue","id","placeholder","Sin asesor","notFoundText","No hay asesores para este comercio",3,"items","searchable","searchFn","clearable","loading"],[1,"col-12"],["formControlName","address",1,"form-control"],["formControlName","business_address",1,"form-control"],["formControlName","business_name",1,"form-control"],["formControlName","nit",1,"form-control"],["type","number","min","0","step","1","formControlName","value_request",1,"form-control"],["type","number","min","0","step","1","formControlName","previous_year_income","required","",1,"form-control"],["type","date","formControlName","date_expedition",1,"form-control"],["type","date","formControlName","date_expiration",1,"form-control"],["formControlName","nationality",1,"form-control"],["formControlName","sexo",1,"form-select"],[3,"ngValue"],[1,"form-check"],["type","checkbox","formControlName","registered_chamber_commerce","id","registeredChamberCommerce",1,"form-check-input"],["for","registeredChamberCommerce",1,"form-check-label"],["type","file","accept","image/*",1,"form-control",3,"change"],[1,"mt-4","d-flex","flex-wrap","gap-2"],["type","submit",1,"btn","btn-success",3,"disabled"],["routerLink","/clientes/listado",1,"btn","btn-outline-secondary"]],template:function(o,i){o&1&&(a(0,"app-breadcrumb",0),n(1,"div",1)(2,"div",2)(3,"div",3),S(4,oe,2,0,"p",4)(5,re,2,0,"div",5),n(6,"form",6),v("ngSubmit",function(){return i.submit()}),n(7,"div",7)(8,"div",8)(9,"label",9),r(10,"Nombre *"),t(),a(11,"input",10),t(),n(12,"div",8)(13,"label",9),r(14,"Apellido *"),t(),a(15,"input",11),t(),n(16,"div",8)(17,"label",9),r(18,"C\xE9dula *"),t(),a(19,"input",12),t(),n(20,"div",8)(21,"label",9),r(22,"Tipo de documento *"),t(),n(23,"select",13),y(24,ae,2,2,"option",14,ie),t()(),n(26,"div",8)(27,"label",9),r(28,"Correo electr\xF3nico *"),t(),a(29,"input",15),t(),n(30,"div",8)(31,"label",9),r(32,"Celular *"),t(),a(33,"input",16),t(),n(34,"div",8)(35,"label",9),r(36,"Tel\xE9fono alternativo"),t(),a(37,"input",17),t(),n(38,"div",8)(39,"label",9),r(40,"Fecha de nacimiento *"),t(),a(41,"input",18),t(),n(42,"div",8)(43,"label",9),r(44,"Comercio *"),t(),a(45,"ng-select",19),t(),n(46,"div",8)(47,"label",9),r(48,"Ciudad *"),t(),a(49,"ng-select",20),t(),n(50,"div",8)(51,"label",9),r(52,"Tipo de negocio *"),t(),a(53,"ng-select",21),t(),n(54,"div",8)(55,"label",9),r(56,"Asesor / vendedor"),t(),n(57,"p",22),r(58," Seleccione primero el comercio. Puede buscar por nombre o c\xE9dula. "),t(),a(59,"ng-select",23),t(),n(60,"div",24)(61,"label",9),r(62,"Direcci\xF3n"),t(),a(63,"input",25),t(),n(64,"div",24)(65,"label",9),r(66,"Direcci\xF3n del negocio"),t(),a(67,"input",26),t(),n(68,"div",24)(69,"label",9),r(70,"Nombre del negocio"),t(),a(71,"input",27),t(),n(72,"div",8)(73,"label",9),r(74,"NIT"),t(),a(75,"input",28),t(),n(76,"div",8)(77,"label",9),r(78,"Valor solicitud (cupo preaprobado)"),t(),a(79,"input",29),t(),n(80,"div",8)(81,"label",9),r(82,"Ingresos a\xF1o anterior"),t(),a(83,"input",30),t(),n(84,"div",8)(85,"label",9),r(86,"Fecha expedici\xF3n documento"),t(),a(87,"input",31),t(),n(88,"div",8)(89,"label",9),r(90,"Fecha vencimiento documento"),t(),a(91,"input",32),t(),n(92,"div",8)(93,"label",9),r(94,"Nacionalidad"),t(),a(95,"input",33),t(),n(96,"div",8)(97,"label",9),r(98,"Sexo"),t(),n(99,"select",34)(100,"option",35),r(101,"\u2014"),t(),y(102,le,2,2,"option",14,ie),t()(),n(104,"div",24)(105,"div",36),a(106,"input",37),n(107,"label",38),r(108," Registrado en c\xE1mara de comercio "),t()()(),n(109,"div",24)(110,"label",9),r(111,"Foto documento (frontal) *"),t(),n(112,"input",39),v("change",function(c){return i.onFileSelected(c,"front")}),t()(),n(113,"div",24)(114,"label",9),r(115,"Foto documento (reverso) *"),t(),n(116,"input",39),v("change",function(c){return i.onFileSelected(c,"back")}),t()(),n(117,"div",24)(118,"label",9),r(119,"Selfie *"),t(),n(120,"input",39),v("change",function(c){return i.onFileSelected(c,"selfie")}),t()()(),n(121,"div",40)(122,"button",41),S(123,se,1,0)(124,me,1,0),t(),n(125,"a",42),r(126,"Volver al listado"),t()()()()()()),o&2&&(u("items",i.breadcrumbItems),d(4),h(i.catalogsLoading?4:-1),d(),h(!i.catalogsLoading&&!i.catalogsReady?5:-1),d(),u("formGroup",i.form),d(18),E(i.identificationTypes),d(21),u("items",i.shopCommerces)("searchable",!0)("clearable",!1),d(4),u("items",i.cities)("searchable",!0)("clearable",!1),d(4),u("items",i.businessTypes)("searchable",!0)("clearable",!1),d(6),u("items",i.advisors)("searchable",!0)("searchFn",i.searchAdvisor)("clearable",!0)("loading",i.advisorsLoading),d(41),u("ngValue",null),d(2),E(i.sexOptions),d(20),u("disabled",i.saving||!i.catalogsReady),d(),h(i.saving?123:124))},dependencies:[k,X,P,H,J,O,G,w,z,V,$,Q,K,j,U,Z,Y,B,q],styles:[".card-shadow[_ngcontent-%COMP%]{box-shadow:0 .125rem .25rem #00000013}"]})};export{N 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.