PageSourceSearch

https://go.pospos.co/390.764477fcc7685194.js

js pospos.co collected 2026-10-01 23:44:27 UTC 48,134 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkgo_pospos=self.webpackChunkgo_pospos||[]).push([[390],{41744:(k,N,c)=>{c.d(N,{d:()=>P});class P{static validatePriceLevel(e){if(!e.root||!e.root.value)return null;const{price_level_status:i}=e.root.value;return i&&!e.value?{required:!0}:null}static validateCredit(e){if(!e.root||!e.root.value)return null;const{vendor_credit_status:i}=e.root.value;return i&&(!e.value||e.value<1||e.value>999)?{required:!0}:null}}},10390:(k,N,c)=>{c.d(N,{b:()=>De});var P=c(49671),O=c(70655),e=c(5e3),i=c(93075),x=c(83905),L=c(4128),b=c(61021),f=c(45429),w=c(8839),T=c(89506),y=c(41744),I=c(18995),R=c(50072),V=c(17295),F=c(32011),Y=c(2861),Z=c(69808),U=c(82320),D=c(36417),M=c(12594),J=c(53117),S=c(74054),j=c(51202),Q=c(76041),B=c(51086),H=c(36012),K=c(4324);const z=["searchProduct"],q=function(o){return{color:o}};function G(o,l){if(1&o&&(e.TgZ(0,"span",44),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o){const n=e.oxw();e.Q6J("ngStyle",e.VKq(4,q,"0"===n.categoryFilter.type?"#888888":"#1eaaf0")),e.xp6(1),e.hij("(",e.lcZ(2,2,n.categoryFilter.name),") ")}}function X(o,l){if(1&o&&(e.TgZ(0,"span",45),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o){const n=e.oxw();e.Q6J("ngStyle",e.VKq(4,q,"all"===n.productFilter.type?"#888888":"#1eaaf0")),e.xp6(1),e.hij("(",e.lcZ(2,2,n.productFilter.name),") ")}}function W(o,l){if(1&o&&(e._UZ(0,"img",51),e.ALo(1,"urlProductImage")),2&o){const n=e.oxw().item;e.Q6J("src",e.lcZ(1,1,n.image),e.LSH)}}function ee(o,l){if(1&o&&(e.ynx(0),e.TgZ(1,"small"),e._uU(2),e.qZA(),e.BQk()),2&o){const n=e.oxw().item;e.xp6(2),e.hij(" code: ",n.code," ")}}function te(o,l){if(1&o&&(e.TgZ(0,"small"),e._uU(1),e.qZA()),2&o){const n=e.oxw().item;e.xp6(1),e.hij(" sku: ",n.sku," ")}}function ne(o,l){if(1&o&&(e.TgZ(0,"div",46),e.YNc(1,W,2,3,"img",47),e.TgZ(2,"div",48)(3,"span"),e._uU(4),e.qZA(),e.YNc(5,ee,3,1,"ng-container",49),e.YNc(6,te,2,1,"ng-template",null,50,e.W1O),e.qZA()()),2&o){const n=l.item,t=e.MAs(7),r=e.oxw();e.xp6(1),e.Q6J("ngIf",r.isShowImages),e.xp6(3),e.Oqu(n.search_name||n.name),e.xp6(1),e.Q6J("ngIf",n.code)("ngIfElse",t)}}function oe(o,l){if(1&o){const n=e.EpF();e.ynx(0),e.TgZ(1,"div",52)(2,"span"),e._uU(3),e.qZA(),e.TgZ(4,"div",53)(5,"button",54),e.NdJ("click",function(){return e.CHM(n),e.oxw().handleClickImportToPO()}),e._UZ(6,"i",55),e._uU(7),e.ALo(8,"translate"),e.qZA(),e.TgZ(9,"button",56),e.NdJ("click",function(){return e.CHM(n),e.oxw().handleClickDeleteProduct()}),e._UZ(10,"i",57),e._uU(11),e.ALo(12,"translate"),e.qZA()()(),e.BQk()}if(2&o){const n=e.oxw();e.xp6(3),e.hij(" ",n.productSelected.length," \u0e23\u0e32\u0e22\u0e01\u0e32\u0e23 "),e.xp6(4),e.hij("",e.lcZ(8,3,"STOCK_LIST.IMPORT_PO")," "),e.xp6(4),e.hij("",e.lcZ(12,5,"DIALOG.DELETE_BTN")," ")}}function re(o,l){1&o&&(e.TgZ(0,"span",66),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"STOCK_CREATE.INVALID_PRODUCT_CODE")))}function ie(o,l){if(1&o){const n=e.EpF();e.TgZ(0,"tr",58)(1,"td",59),e.NdJ("click",function(){const a=e.CHM(n).index;return e.oxw().handleClickCheckboxProduct(a)}),e._UZ(2,"input",60),e.qZA(),e.TgZ(3,"td",61),e._uU(4),e.qZA(),e.TgZ(5,"td",61),e._UZ(6,"input",62),e.YNc(7,re,3,3,"span",63),e.qZA(),e.TgZ(8,"td",61),e._UZ(9,"input",64),e.qZA(),e.TgZ(10,"td",61)(11,"input",65),e.NdJ("focus",function(){const a=e.CHM(n).index;return e.oxw().onPressNumPad(a)}),e.qZA()(),e.TgZ(12,"td",38),e._uU(13),e.qZA()()}if(2&o){const n=l.$implicit,t=l.index,r=e.oxw();let a;e.Q6J("formGroupName",t),e.xp6(4),e.hij(" ",r.getProductName(n)," "),e.xp6(2),e.s9C("placeholder",r.getCodeOfProduct(n)),e.xp6(1),e.Q6J("ngIf",(null==(a=n.get("vendor_product_code"))?null:a.invalid)&&(null==(a=n.get("vendor_product_code"))?null:a.touched)),e.xp6(2),e.s9C("placeholder",r.getProductName(n)),e.xp6(4),e.Oqu(r.getStockOfProduct(n))}}function ae(o,l){if(1&o){const n=e.EpF();e.TgZ(0,"app-number-pad",67),e.NdJ("sendNumber",function(r){return e.CHM(n),e.oxw().callBackValueForNumpad(r)}),e.qZA()}if(2&o){const n=e.oxw();e.Q6J("isEnablePoint",n.isEnablePoint)("maxDecimalPlaces",n.maxDecimalPlaces)("mNumber",n.numPadValue)}}let le=(()=>{class o{constructor(n,t,r,a,s,_){this.serverService=n,this.translate=t,this.spinner=r,this.toastr=a,this.router=s,this.stockProductService=_,this.vendorProductsList=[],this.products=[],this.searchLoading=!1,this.textLanguage={},this.isShowingNumpad=!1,this.isEnablePoint=!0,this.maxDecimalPlaces=2,this.numPadValue="0",this.categoryFilter={type:"0",name:"STOCK_LIST.FILTER_TYPE_ALL"},this.productFilter={type:"all",name:"STOCK_LIST.FILTER_TYPE_ALL"},this.categoryData=[]}get isShowImages(){return this.stockProductService.showImageProducts}get productSelected(){return this.vendorProductListFormControls().controls.map(t=>t.value).filter(t=>t.tdChecked)}ngOnInit(){this.fetchLanguage(),this.initForm(),this.fetchProduct(),this.fetchVendorProducts(),this.fetchCategory()}fetchCategory(){this.serverService.getCategories().subscribe({next:n=>{this.categoryData=n.data},error:n=>{this.toastr.error(n.error.message)}})}fetchLanguage(){this.translate.get(["STOCK_LIST.PROCESS_COMPLETED"]).subscribe(t=>this.textLanguage=t)}initForm(){this.vendorProductsForm=new i.cw({vendor_product_list:new i.Oe([]),deleted_items:new i.Oe([])})}customSearchFn(n,t){const r=t.search_name||t.name,a=t.sku?t.sku:t.code,s=new RegExp((0,b.hr)(n.toLowerCase()));return s.test(r.toLowerCase())||s.test(a.toLowerCase())||t.barcode_input_type===f.sr.BARCODE_TYPE_CUSTOM&&t.barcode_code===n}fetchProduct(){this.spinner.show(),this.serverService.getProductForVendorProducts({type:this.productFilter.type,category:this.categoryFilter.type}).subscribe({next:({data:n})=>{this.spinner.hide(),this.products=n},error:n=>{this.spinner.hide(),this.toastr.error(n.message)}})}fetchVendorProducts(){this.serverService.getVendorProductsListByVendorId(this.vendor._id).subscribe({next:({data:n})=>{this.vendorProductsList=n,this.patchValue(n)},error:n=>{this.toastr.error(n.error.message)}})}vendorProductListFormControls(){return this.vendorProductsForm.get("vendor_product_list")}deletedItemsFormControls(){return this.vendorProductsForm.get("deleted_items")}removeAllVendorProductListFormControl(){this.vendorProductListFormControls().controls=[]}
1patchValue(n){n.forEach(t=>this.addToForm(t))}addToForm(n){const{_id:t,vendor:r,product:a,vendor_product_code:s,vendor_product_name:_,price:u,product_attribute:p,stock:d}=n;this.vendorProductListFormControls().push(new i.cw({_id:new i.NI(t),vendor:new i.NI(r,i.kI.required),product:new i.NI(a,i.kI.required),product_attribute:new i.NI(p),vendor_product_code:new i.NI(s,T.j.validateEnglishCharactor),vendor_product_name:new i.NI(_),price:new i.NI(u,i.kI.required),stock:new i.NI(d),tdChecked:new i.NI(!1)}))}onSelectedProduct(n){var t;if(n){const{attribute_status:r,_id:a,sku_list:s}=n;this.vendorProductListFormControls().controls.findIndex(u=>{const{value:p}=u.get("product"),{value:d}=u.get("product_attribute");return r&&d?String(d._id)===String(s[0]._id):String(p._id)===String(a)})<0?this.vendorProductListFormControls().push(new i.cw({_id:new i.NI(void 0),vendor:new i.NI(this.vendor,i.kI.required),product:new i.NI(n,i.kI.required),product_attribute:new i.NI(r?s[0]:void 0),vendor_product_code:new i.NI(void 0,T.j.validateEnglishCharactor),vendor_product_name:new i.NI(void 0),price:new i.NI(n.cost,i.kI.required),tdChecked:new i.NI(!1)})):this.toastr.warning("\u0e1c\u0e39\u0e49\u0e1c\u0e25\u0e34\u0e15\u0e21\u0e35\u0e2a\u0e34\u0e19\u0e04\u0e49\u0e32\u0e19\u0e35\u0e49\u0e41\u0e25\u0e49\u0e27")}null===(t=this.ngSelect)||void 0===t||t.clearItem(n)}onPressNumPad(n){this.selectedValueIndexForNumpad={index:n};const t=this.vendorProductListFormControls().controls[n].get("price");if(t){const{value:r}=t;this.numPadValue=(0,b.i1)(r),this.isShowingNumpad=!0,$("#numpadModal").modal("show")}}callBackValueForNumpad(n){if(!this.selectedValueIndexForNumpad)return;const{index:t}=this.selectedValueIndexForNumpad;this.vendorProductListFormControls().controls[t].patchValue({price:n}),this.onCloseNumPadModal()}onCloseNumPadModal(){$("#numpadModal").modal("hide")}getUnderscoreId(n){const{value:t}=n.get("product"),{value:r}=n.get("product_attribute");return r?r._id:t._id}getProductName(n){const{value:t}=n.get("product"),{value:r}=n.get("product_attribute"),{attribute_status:a,name:s}=t;return a?`${s}${r.options.reduce((p,d)=>p+" "+d.name,"")}`:s}getCodeOfProduct(n){const{value:t}=n.get("product"),{value:r}=n.get("product_attribute"),{attribute_status:a,code:s}=t;return a?r.sku:s}getStockOfProduct(n){const{value:t}=n.get("product"),{value:r}=n.get("product_attribute"),{attribute_status:a,stock:s}=t;return a?r.stock:s}handleClickCheckedAll(){const n=this.vendorProductListFormControls().controls.every(t=>{var r;return null===(r=t.get("tdChecked"))||void 0===r?void 0:r.value});this.vendorProductListFormControls().controls.forEach(t=>{var r;null===(r=t.get("tdChecked"))||void 0===r||r.patchValue(!n)}),this.toggleCheckSelectAll()}handleClickCheckboxProduct(n){const t=this.vendorProductListFormControls().controls[n],{value:r}=t.get("tdChecked");r?this.vendorProductListFormControls().controls[n].patchValue({tdChecked:!1}):this.vendorProductListFormControls().controls[n].patchValue({tdChecked:!0}),this.toggleCheckSelectAll()}toggleCheckSelectAll(){const t=this.vendorProductListFormControls().controls.map(r=>r.value).length===this.productSelected.length;$("#PO_select_all").prop("checked",t)}handleClickDeleteProduct(){this.productSelected.map(t=>t._id).forEach(t=>{this.deletedItemsFormControls().push(new i.cw({_id:new i.NI(t)}));const r=this.vendorProductListFormControls().controls.map(s=>s.value);if(!r)return;const a=r.findIndex(s=>String(s._id)===String(t));this.vendorProductListFormControls().removeAt(a)})}handleClickImportToPO(){var n;const t=this.productSelected.map(a=>{var s,_;return null!==(_=null===(s=a.product_attribute)||void 0===s?void 0:s._id)&&void 0!==_?_:a.product._id}),r=null===(n=this.vendorProductListFormControls().controls[0].get("vendor"))||void 0===n?void 0:n.value._id;this.stockProductService.setStockDataArray(t,r),this.router.navigate(["/core/stock/purchaseorder/create"])}handleFilterCategory(n){if(n){if("parent"in n&&"children"in n){const{parent:t}=n;this.fetchProductByCategory(t._id,t.name,!0)}else{const{_id:t,name:r}=n;this.fetchProductByCategory(t,r,!0)}(0,b.uA)("category-tree-dropdown")}else this.fetchProductByCategory("0","STOCK_LIST.FILTER_TYPE_ALL",!1)}fetchProductByCategory(n,t,r){$(".category-dropdown-menu li").removeClass("dropdown-highlight"),$(`#category_${n}`).addClass("dropdown-highlight"),n!==this.categoryFilter.type&&(this.categoryFilter={type:n,name:t},this.fetchProduct())}fetchProductByType(n,t,r){$(".stock-dropdown-menu li").removeClass("dropdown-highlight"),$(`#${n}`).addClass("dropdown-highlight"),this.productFilter={type:n,name:t},this.fetchProduct()}onSubmit(){(0,b.w2)(this.vendorProductsForm.controls);const{value:n,valid:t}=this.vendorProductsForm,{vendor_product_list:r,deleted_items:a}=n;if(t&&(r.length||a.length)){this.spinner.show(),r.forEach(d=>{delete d.tdChecked});const _=[];r.forEach(d=>{const C=d,{product:g,_id:v}=d;if(v)_.push(Object.assign({},C));else{const{_id:h}=g;_.push(Object.assign(Object.assign({},C),{product:h}))}});const p=n.deleted_items.map(d=>d._id);this.serverService.saveVendorProducts({data:_,deleted_items:p}).subscribe({next:()=>{this.removeAllVendorProductListFormControl(),this.fetchVendorProducts(),this.spinner.hide(),this.toastr.success(this.textLanguage["STOCK_LIST.PROCESS_COMPLETED"])},error:d=>{this.spinner.hide(),d.status===f.sr.HTTP_STATUS_CODE_PACKAGE?(0,w.vP)(this.router):this.toastr.error(d.error.message)}})}}}return o.\u0275fac=function(n){return new(n||o)(e.Y36(V.N),e.Y36(I.sK),e.Y36(R.t2),e.Y36(F.G),e.Y36(D.F0),e.Y36(Q.O))}
1,o.\u0275cmp=e.Xpm({type:o,selectors:[["app-vendor-products"]],viewQuery:function(n,t){if(1&n&&e.Gf(z,5),2&n){let r;e.iGM(r=e.CRH())&&(t.ngSelect=r.first)}},inputs:{vendor:"vendor"},decls:81,vars:44,consts:[[1,"box-content-no-border",2,"margin-bottom","0"],["disableEnterSubmit","",3,"formGroup","ngSubmit"],[1,"box-header","with-border","header-flex"],[2,"flex-grow","1"],["src","assets/images/search_menu/ic_menu_stock_normal_gray.svg","alt","",1,"title-icon"],[1,"box-title","title-text","main-content-title","content-middle"],[1,"text-right"],["type","submit",1,"btn","pp-btn-success"],[1,"fa","fa-save"],[1,"box-body"],[2,"margin","20px 0"],[1,"form-group",2,"width","100%"],["for","source_products",1,"title-label",2,"margin","8px"],[1,"tw-flex","tw-gap-2","tw-w-full"],["id","category-tree-dropdown",1,"tw-dropdown","dropdown","tw-min-w-[100px]"],["id","category-tree-dropdown-menu","type","button","data-toggle","dropdown",1,"btn","tw-btn-default","tw-btn-border","btn-sm","!tw-justify-center","tw-w-full","!tw-h-[34px]"],["class","tw-text-[14px]",3,"ngStyle",4,"ngIf"],[1,"caret"],[1,"dropdown-menu",2,"min-width","300px"],[3,"categories","onSelected"],[1,"tw-dropdown","dropdown","tw-min-w-[100px]"],["id","status-dropdown","type","button","data-toggle","dropdown",1,"btn","tw-btn-default","tw-btn-border","!tw-h-[34px]","btn-sm","!tw-justify-center","tw-w-full"],["class","tw-text-[12px]",3,"ngStyle",4,"ngIf"],["aria-labelledby","dropdownSelectTypeMenu",1,"dropdown-menu","stock-dropdown-menu"],["id","all",1,"dropdown-highlight",3,"click"],["id","ready_for_sale",3,"click"],["id","out_of_stock",3,"click"],["id","low",3,"click"],[1,"tw-w-full",3,"items","hideSelected","virtualScroll","clearSearchOnAdd","searchFn","placeholder","notFoundText","change"],["searchProduct",""],["ng-option-tmp",""],["formGroupName","vendor_product_list"],[1,"table-responsive"],[4,"ngIf"],[1,"table","table-bordered","pp-table","table-hover"],[1,"text-center","tw-min-w-[30px]","tw-w-[40px]",3,"click"],["type","checkbox","id","PO_select_all",1,"tw-cursor-pointer"],[2,"width","25%"],[1,"text-center"],[1,"text-center",2,"width","18%"],[3,"formGroupName",4,"ngFor","ngForOf"],["id","numpadModal","tabindex","-1","role","dialog","data-backdrop","static","data-keyboard","false",1,"modal","fade","modal-center"],[1,"modal-dialog",2,"width","350px"],["title","\u0e23\u0e32\u0e04\u0e32",3,"isEnablePoint","maxDecimalPlaces","mNumber","sendNumber",4,"ngIf"],[1,"tw-text-[14px]",3,"ngStyle"],[1,"tw-text-[12px]",3,"ngStyle"],[1,"ng-select-product-items"],["onerror","this.src = 'assets/images/ic_product_default.png'",3,"src",4,"ngIf"],[1,"info"],[4,"ngIf","ngIfElse"],["skuItem",""],["onerror","this.src = 'assets/images/ic_product_default.png'",3,"src"],[1,"tw-flex","tw-","tw-justify-between","tw-py-2","tw-items-center"],[1,"tw-flex","tw-gap-2"],["type","button",1,"btn","tw-btn-default",3,"click"],[1,"fa","fa-fw","fa-file-text-o"],["type","button",1,"btn","btn-danger",3,"click"],[1,"fa","fa-fw","fa-tras
1h-o"],[3,"formGroupName"],[1,"text-center","tw-cursor-pointer",3,"click"],["type","checkbox","formControlName","tdChecked",1,"tw-cursor-pointer"],[1,"text-vertical-center"],["type","text","formControlName","vendor_product_code","autocomplete","off",1,"form-control","input-text","text-center",3,"placeholder"],["class","help-block with-error",4,"ngIf"],["type","text","formControlName","vendor_product_name","autocomplete","off",1,"form-control","input-text","text-center",3,"placeholder"],["type","text","formControlName","price","autocomplete","off","readonly","",1,"form-control","input-text","text-center","readonly-not-disabled:!tw-bg-white",3,"focus"],[1,"help-block","with-error"],["title","\u0e23\u0e32\u0e04\u0e32",3,"isEnablePoint","maxDecimalPlaces","mNumber","sendNumber"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"form",1),e.NdJ("ngSubmit",function(){return t.onSubmit()}),e.TgZ(2,"div",2)(3,"div",3),e._UZ(4,"img",4),e.TgZ(5,"h5",5),e._uU(6),e.ALo(7,"translate"),e.qZA()(),e.TgZ(8,"div",6)(9,"button",7),e._UZ(10,"i",8),e._uU(11),e.ALo(12,"translate"),e.qZA()()(),e.TgZ(13,"div",9)(14,"div")(15,"h4"),e._uU(16),e.qZA()(),e._UZ(17,"hr",10),e.TgZ(18,"div",11)(19,"label",12),e._uU(20,"\u0e40\u0e25\u0e37\u0e2d\u0e01\u0e2a\u0e34\u0e19\u0e04\u0e49\u0e32 :"),e.qZA(),e.TgZ(21,"div",13)(22,"div",14)(23,"button",15),e._uU(24),e.ALo(25,"translate"),e.YNc(26,G,3,6,"span",16),e._UZ(27,"span",17),e.qZA(),e.TgZ(28,"ul",18)(29,"app-category-tree",19),e.NdJ("onSelected",function(a){return t.handleFilterCategory(a)}),e.qZA()()(),e.TgZ(30,"div",20)(31,"button",21),e._uU(32),e.ALo(33,"translate"),e.YNc(34,X,3,6,"span",22),e._UZ(35,"span",17),e.qZA(),e.TgZ(36,"ul",23)(37,"li",24),e.NdJ("click",function(){return t.fetchProductByType("all","STOCK_LIST.FILTER_TYPE_ALL",!1)}),e.TgZ(38,"a"),e._uU(39),e.ALo(40,"translate"),e.qZA()(),e.TgZ(41,"li",25),e.NdJ("click",function(){return t.fetchProductByType("ready_for_sale","STOCK_LIST.FILTER_TYPE_READY_FOR_SALE",!0)}),e.TgZ(42,"a"),e._uU(43),e.ALo(44,"translate"),e.qZA()(),e.TgZ(45,"li",26),e.NdJ("click",function(){return t.fetchProductByType("out_of_stock","STOCK_LIST.FILTER_TYPE_OUT_STOCK",!0)}),e.TgZ(46,"a"),e._uU(47),e.ALo(48,"translate"),e.qZA()(),e.TgZ(49,"li",27),e.NdJ("click",function(){return t.fetchProductByType("low","STOCK_LIST.FILTER_TYPE_LOW_STOCK",!0)}),e.TgZ(50,"a"),e._uU(51),e.ALo(52,"translate"),e.qZA()()()(),e.TgZ(53,"ng-select",28,29),e.NdJ("change",function(a){return t.onSelectedProduct(a)}),e.ALo(55,"translate"),e.ALo(56,"translate"),e.YNc(57,ne,8,4,"ng-template",30),e.qZA()()(),e.ynx(58,31),e.TgZ(59,"div",32),e.YNc(60,oe,13,7,"ng-container",33),e.TgZ(61,"table",34)(62,"thead")(63,"tr")(64,"th",35),e.NdJ("click",function(){return t.handleClickCheckedAll()}),e._UZ(65,"input",36),e.qZA(),e.TgZ(66,"th",37),e._uU(67,"\u0e0a\u0e37\u0e48\u0e2d\u0e2a\u0e34\u0e19\u0e04\u0e49\u0e32"),e.qZA(),e.TgZ(68,"th",38),e._uU(69,"\u0e23\u0e2b\u0e31\u0e2a\u0e2a\u0e34\u0e19\u0e04\u0e49\u0e32(\u0e1c\u0e39\u0e49\u0e1c\u0e25\u0e34\u0e15)"),e.qZA(),e.TgZ(70,"th",38),e._uU(71,"\u0e0a\u0e37\u0e48\u0e2d\u0e2a\u0e34\u0e19\u0e04\u0e49\u0e32(\u0e1c\u0e39\u0e49\u0e1c\u0e25\u0e34\u0e15)"),e.qZA(),e.TgZ(72,"th",39),e._uU(73,"\u0e23\u0e32\u0e04\u0e32"),e.qZA(),e.TgZ(74,"th",39),e._uU(75,"\u0e04\u0e07\u0e40\u0e2b\u0e25\u0e37\u0e2d"),e.qZA()()(),e.TgZ(76,"tbody"),e.YNc(77,ie,14,6,"tr",40),e.qZA()()(),e.BQk(),e.qZA()()(),e.TgZ(78,"div",41)(79,"div",42),e.YNc(80,ae,1,3,"app-number-pad",43),e.qZA()()),2&n&&(e.xp6(1),e.Q6J("formGroup",t.vendorProductsForm),e.xp6(5),e.hij(" ",e.lcZ(7,24,"VENDOR_CREATE.VENDOR_PRODUCT_TITLE")," "),e.xp6(5),e.hij(" ",e.lcZ(12,26,"DIALOG.SAVE_BTN")," "),e.xp6(5),e.AsE("#",null==t.vendor?null:t.vendor.code," ",null==t.vendor?null:t.vendor.company_name,""),e.xp6(8),e.hij(" ",e.lcZ(25,28,"STOCK_LIST.TABLE_COLUMN_CATEGORY")," "),e.xp6(2),e.Q6J("ngIf","0"!==t.categoryFilter.type),e.xp6(3),e.Q6J("categories",t.categoryData),e.xp6(3),e.hij(" ",e.lcZ(33,30,"STOCK_LIST.TABLE_COLUMN_STATUS")," "),e.xp6(2),e.Q6J("ngIf","all"!==t.productFilter.type),e.xp6(5),e.Oqu(e.l
1cZ(40,32,"STOCK_LIST.FILTER_TYPE_ALL")),e.xp6(4),e.Oqu(e.lcZ(44,34,"STOCK_LIST.FILTER_TYPE_READY_FOR_SALE")),e.xp6(4),e.Oqu(e.lcZ(48,36,"STOCK_LIST.FILTER_TYPE_OUT_STOCK")),e.xp6(4),e.Oqu(e.lcZ(52,38,"STOCK_LIST.FILTER_TYPE_LOW_STOCK")),e.xp6(2),e.s9C("placeholder",e.lcZ(55,40,"PURCHASE_ORDER.SEARCH_PRODUCT")),e.s9C("notFoundText",e.lcZ(56,42,"PURCHASE_ORDER.PRODUCT_NOT_FOUND")),e.Q6J("items",t.products)("hideSelected",!0)("virtualScroll",!0)("clearSearchOnAdd",!0)("searchFn",t.customSearchFn),e.xp6(7),e.Q6J("ngIf",t.productSelected.length>0),e.xp6(17),e.Q6J("ngForOf",t.vendorProductListFormControls().controls),e.xp6(3),e.Q6J("ngIf",t.isShowingNumpad))},directives:[i._Y,i.JL,U.O,i.sg,Z.O5,Z.PC,B.W,S.w9,S.ir,i.x0,Z.sg,i.Wl,i.JJ,i.u,i.Fj,H.q],pipes:[I.X$,K.v],styles:[".header-flex[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.icon-trash[_ngcontent-%COMP%]{font-size:18px;color:red}"]}),o})();var se=c(42575);function ce(o,l){if(1&o){const n=e.EpF();e.TgZ(0,"div",58)(1,"div",59)(2,"ul",60)(3,"li",61),e.NdJ("click",function(){return e.CHM(n),e.oxw().toggleTabs(!1)}),e.TgZ(4,"a",62)(5,"div",63),e._uU(6),e.ALo(7,"translate"),e.qZA()()(),e.TgZ(8,"li",64),e.NdJ("click",function(){return e.CHM(n),e.oxw().toggleTabs(!0)}),e.TgZ(9,"a",65)(10,"div",63),e._uU(11),e.ALo(12,"translate"),e.qZA()()()()()()}2&o&&(e.xp6(6),e.Oqu(e.lcZ(7,2,"VENDOR_CREATE.COMPANY_DATA_TITLE")),e.xp6(5),e.Oqu(e.l
1cZ(12,4,"VENDOR_CREATE.VENDOR_PRODUCT_TITLE")))}const de=function(o){return{search:o}};function ue(o,l){if(1&o&&(e.ynx(0),e.TgZ(1,"a",66),e._uU(2,"("),e._UZ(3,"i",67),e._uU(4," PO)"),e.qZA(),e.BQk()),2&o){const n=e.oxw();e.xp6(1),e.Q6J("queryParams",e.VKq(1,de,n.vendor.code))}}function _e(o,l){if(1&o){const n=e.EpF();e.TgZ(0,"button",68),e.NdJ("click",function(){return e.CHM(n),e.oxw().handleClickOpenScannerIdCardModal()}),e._UZ(1,"i",69),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&o&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"CREATE_MEMBER.READ_ID_CARD")," "))}function pe(o,l){1&o&&(e.TgZ(0,"span",70),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"small",17),e._uU(4,"*"),e.qZA()()),2&o&&(e.xp6(1),e.hij("",e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_COMPANY_NAME")," "))}function me(o,l){1&o&&(e.TgZ(0,"span",70),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_BRANCH")))}function he(o,l){1&o&&(e.TgZ(0,"span",70),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_PHONE_NUMBER")))}function ge(o,l){1&o&&(e.TgZ(0,"span",70),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_ADDRESS")))}function ve(o,l){1&o&&(e.TgZ(0,"span",70),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.hij("",e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_COUNTRY")," "))}function Ce(o,l){1&o&&(e.TgZ(0,"span",70),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.hij("",e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_PROVINCE")," "))}function fe(o,l){if(1&o){const n=e.EpF();e.ynx(0),e.TgZ(1,"div",15)(2,"label",71),e._uU(3),e.ALo(4,"translate"),e.TgZ(5,"small",17),e._uU(6,"*"),e.qZA()(),e.TgZ(7,"ng-select",72),e.NdJ("change",function(r){return e.CHM(n),e.oxw().onChangeProvince(r)}),e.qZA(),e.YNc(8,Ce,3,3,"span",19),e.qZA(),e.BQk()}if(2&o){const n=e.oxw();let t;e.xp6(3),e.hij("",e.lcZ(4,4,"VENDOR_CREATE.PROVINCE_TITLE")," "),e.xp6(4),e.Q6J("items",n.provinces)("clearable",!1),e.xp6(1),e.Q6J("ngIf",(null==(t=n.vendorForm.get("province"))?null:t.invalid)&&(null==(t=n.vendorForm.get("province"))?null:t.touched))}}function Ee(o,l){1&o&&(e.TgZ(0,"span",76),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_PROVINCE")))}function Te(o,l){if(1&o&&(e.TgZ(0,"div",15)(1,"div",73)(2,"label",74),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.YNc(5,Ee,3,3,"span",42),e.qZA(),e._UZ(6,"input",75),e.qZA()),2&o){const n=e.oxw();let t;e.xp6(3),e.Oqu(e.lcZ(4,2,"VENDOR_CREATE.PROVINCE_TITLE")),e.xp6(2),e.Q6J("ngIf",(null==(t=n.vendorForm.get("province_other"))?null:t.invalid)&&(null==(t=n.vendorForm.get("province_other"))?null:t.touched))}}function be(o,l){1&o&&(e.TgZ(0,"span",70),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_DISTRICT")))}function Ae(o,l){1&o&&(e.TgZ(0,"span",70),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_SUB_DISTRICT")))}function Ze(o,l){if(1&o){const n=e.EpF();e.ynx(0),e.TgZ(1,"div",21)(2,"div",15)(3,"label",77),e._uU(4),e.ALo(5,"translate"),e.TgZ(6,"small",17),e._uU(7,"*"),e.qZA()(),e.TgZ(8,"ng-select",78),e.NdJ("change",function(r){return e.CHM(n),e.oxw().onChangeDistrict(r)}),e.qZA(),e.YNc(9,be,3,3,"span",19),e.qZA()(),e.TgZ(10,"div",21)(11,"div",15)(12,"label",77),e._uU(13),e.ALo(14,"translate"),e.TgZ(15,"small",17),e._uU(16,"*"),e.qZA()(),e.TgZ(17,"ng-select",79),e.NdJ("change",function(r){return e.CHM(n),e.oxw().onChangeSubDistrict(r)}),e.qZA(),e.YNc(18,Ae,3,3,"span",19),e.qZA()(),e.BQk()}if(2&o){const n=e.oxw();let t,r;e.xp6(4),e.hij("",e.lcZ(5,8,"VENDOR_CREATE.DISTRICT_TITLE")," "),e.xp6(4),e.Q6J("items",n.district)("clearable",!1),e.xp6(1),e.Q6J("ngIf",(null==(t=n.vendorForm.get("district"))?null:t.invalid)&&(null==(t=n.vendorForm.get("district"))?null:t.touched)),e.xp6(4),e.hij("",e.lcZ(14,10,"VENDOR_CREATE.SUB_DISTRICT_TITLE")," "),e.xp6(4),e.Q6J("items",n.subDistrict)("clearable",!1),e.xp6(1),e.Q6J("ngIf",(null==(r=n.vendorForm.get("sub_district"))?null:r.invalid)&&(null==(r=n.vendorForm.get("sub_district"))?null:r.touched))}}function xe(o,l){1&o&&(e.TgZ(0,"span",70),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.l
1cZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_ZIP_CODE")))}function Ie(o,l){1&o&&(e.TgZ(0,"span",70),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_EMAIL")))}function Ne(o,l){1&o&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&o&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"VENDOR_CREATE.INVALID_TAX_ID")," "))}function Pe(o,l){1&o&&(e._uU(0),e.ALo(1,"translate")),2&o&&e.hij(" ",e.lcZ(1,1,"VENDOR_CREATE.PLEASE_SPECIFY_TAX_ID")," ")}function Se(o,l){if(1&o&&(e.TgZ(0,"span",76),e.YNc(1,Ne,3,3,"ng-container",31),e.YNc(2,Pe,2,3,"ng-template",null,80,e.W1O),e.qZA()),2&o){const n=e.MAs(3),t=e.oxw();let r;e.xp6(1),e.Q6J("ngIf",null==(r=t.vendorForm.get("tax_id"))||null==r.errors?null:r.errors.invalid_value)("ngIfElse",n)}}function Oe(o,l){1&o&&(e.TgZ(0,"span",76),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_PRICE_LEVEL")," "))}function Le(o,l){if(1&o&&(e.TgZ(0,"div",14)(1,"div",15),e._UZ(2,"ng-select",81),e.YNc(3,Oe,3,3,"span",42),e.qZA()()),2&o){const n=e.oxw();let t;e.xp6(2),e.Q6J("items",n.priceLevels)("clearable",!1),e.xp6(1),e.Q6J("ngIf",(null==(t=n.vendorForm.get("price_level_id"))?null:t.invalid)&&(null==(t=n.vendorForm.get("price_level_id"))?null:t.touched))}}function we(o,l){1&o&&(e.TgZ(0,"span",76),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_CREDIT_TITLE")))}function ye(o,l){if(1&o&&(e.TgZ(0,"div",14)(1,"div",15),e._UZ(2,"input",82),e.YNc(3,we,3,3,"span",42),e.qZA()()),2&o){const n=e.oxw();let t;e.xp6(3),e.Q6J("ngIf",(null==(t=n.vendorForm.get("vendor_credit"))?null:t.invalid)&&(null==(t=n.vendorForm.get("vendor_credit"))?null:t.touched))}}function Re(o,l){1&o&&(e.TgZ(0,"span",70),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"VENDOR_CREATE.PLEASE_SPECIFY_EMAIL")))}function Ve(o,l){if(1&o&&(e.TgZ(0,"div",14)(1,"div",20)(2,"div",21)(3,"div",15)(4,"label",83),e._uU(5),e.ALo(6,"translate"),e.qZA(),e._UZ(7,"input",84),e.qZA()(),e.TgZ(8,"div",21)(9,"div",15)(10,"label",85),e._uU(11),e.ALo(12,"translate"),e.qZA(),e._UZ(13,"input",86),e.qZA()()(),e.TgZ(14,"div",20)(15,"div",21)(16,"div",15)(17,"label",87),e._uU(18),e.ALo(19,"translate"),e.qZA(),e._UZ(20,"input",88),e.YNc(21,Re,3,3,"span",19),e.qZA()(),e.TgZ(22,"div",21)(23,"div",15)(24,"label",89),e._uU(25),e.ALo(26,"translate"),e.qZA(),e._UZ(27,"input",90),e.qZA()()(),e.TgZ(28,"div",20)(29,"div",21)(30,"div",15)(31,"label",91),e._uU(32),e.ALo(33,"translate"),e.qZA(),e._UZ(34,"input",92),e.qZA()()()()),2&o){const n=e.oxw();let t;
1e.xp6(5),e.Oqu(e.lcZ(6,6,"VENDOR_CREATE.FIST_NAME_TITLE")),e.xp6(6),e.Oqu(e.lcZ(12,8,"VENDOR_CREATE.LAST_NAME_TITLE")),e.xp6(7),e.Oqu(e.lcZ(19,10,"VENDOR_CREATE.CONTACT_PERSON_EMAIL")),e.xp6(3),e.Q6J("ngIf",(null==(t=n.vendorForm.get("email"))?null:t.invalid)&&(null==(t=n.vendorForm.get("email"))?null:t.touched)),e.xp6(4),e.Oqu(e.lcZ(26,12,"VENDOR_CREATE.CONTACT_PERSON_PHONE_NUMBER")),e.xp6(7),e.Oqu(e.lcZ(33,14,"VENDOR_CREATE.CONTACT_PERSON_LINE"))}}function Fe(o,l){if(1&o&&e._UZ(0,"app-vendor-products",93),2&o){const n=e.oxw();e.Q6J("vendor",n.vendor)}}function Ue(o,l){if(1&o){const n=e.EpF();e.TgZ(0,"app-scanner-id-card-modal",94),e.NdJ("closeModal",function(){return e.CHM(n),e.oxw().handleCloseScannerIdCardModal()}),e.qZA()}}let De=(()=>{class o{constructor(n,t,r,a,s){this.translate=n,this.spinner=t,this.serverService=r,this.toastr=a,this.memberService=s,this.isModalFromShopBuy=!1,this.visibleScannerIdCard=!0,this.height=82,this.callbackSubmit=new e.vpe,this.isEdit=!1,this.countries=[],this.provinces=[],this.district=[],this.subDistrict=[],this.priceLevels=[],this.textLanguage={},this.isProductManage=!1,this.visibleScannerIdCardModal=!1,this.LanguageContant=f.SQ}get Constant(){return f.sr}ngOnInit(){this.initForm(),this.vendorId?(this.isEdit=!0,this.initInstancesForEdit(this.vendorId)):this.initInstancesForCreate(),this.memberIdCardChangeSubscription=this.memberService.memberIdCardChange$.subscribe(n=>{"create"===n.type&&this.setFromVendorIdCard(n.data)})}setFromVendorIdCard(n){var t=this;return(0,P.Z)(function*(){var r;try{t.spinner.show();const a=yield(0,x.z)(t.serverService.autoFillAddress(n.address)),{address:s,country:_,province:u,district:p,sub_district:d}=a.data[0],C=yield(0,x.z)(t.serverService.getProvinceByID(_._id));if(t.provinces=C.data,u){const h=yield(0,x.z)(t.serverService.getDistrictByID(u._id));t.district=h.data}let g=null;if(p){const h=yield(0,x.z)(t.serverService.getSubDistrictByID(p._id));t.subDistrict=h.data,g=null===(r=h.data.find(m=>m._id===(null==d?void 0:d._id)))||void 0===r?void 0:r.ZIP_CODE.toString()}const v={company_name:`${null==n?void 0:n.firstNameTH} ${null==n?void 0:n.lastNameTH}`,address_status:!!u&&!!p,address:s,province:null==u?void 0:u._id,district:null==p?void 0:p._id,sub_district:null==d?void 0:d._id,zipcode:g,tax_id:n.personalId};setTimeout(()=>t.vendorForm.patchValue(v),0),t.spinner.hide()}catch(a){t.toastr.error(a.message),t.spinner.hide()}})()}initForm(){this.vendorForm=new i.cw({company_name:new i.NI(null,i.kI.required),branch:new i.NI("00000",[i.kI.required,i.kI.maxLength(5),i.kI.minLength(5)]),tax_id:new i.NI(null,T.j.validationThaiCountryTaxIdAndThaiIdentityCard("country")),company_email:new i.NI(null,[i.kI.email,T.j.validateEmailSpecialCharactor.bind(this)]),company_line:new i.NI(null),phonenumber:new i.NI(null,i.kI.required),company_fax:new i.NI(null),address:new i.NI(null,[i.kI.required]),country:new i.NI(f.sr.COUNTRY_THAI_ID,i.kI.required),province:new i.NI(null,i.kI.required),district:new i.NI(null,T.j.validateDistrict("country")),sub_district:new i.NI(null,T.j.validateDistrict("country")),province_other:new i.NI(null,T.j.validateProvinceOther("country")),zipcode:new i.NI(null,i.kI.required),vendor_credit_status:new i.NI(!1),vendor_credit:new i.NI(0,[y.d.validateCredit]),contact_person_section:new i.NI(!1),first_name:new i.NI,last_name:new i.NI,email:new i.NI(null,[i.kI.email,T.j.validateEmailSpecialCharactor.bind(this)]),contact_person_phonenumber:new i.NI,contact_person_line:new i.NI,price_level_status:new i.NI(!1),price_level_id:new i.NI(null,y.d.validatePriceLevel)})}onChangeContactPersonSection(n){(0,b.W8)(this.vendorForm,["first_name","last_name","email","contact_person_phonenumber","contact_person_line"],!n)}initInstancesForCreate(){(0,L.D)([this.serverService.getAllCountry("en"),this.serverService.getProvinceByID(f.sr.COUNTRY_THAI_ID),this.serverService.getPriceLevels()]).subscribe({next:n=>{this.countries=n[0].data,this.provinces=n[1].data,this.priceLevels=n[2].data,this.onChangeContactPersonSection(!1)},error:n=>{this.toastr.error(n.error.message)}})}initInstancesForEdit(n){this.spinner.show(),this.isProductManage=!1,(0,L.D)([this.serverService.getVendorByID(n),this.serverService.getPriceLevels()]).subscribe({next:t=>{const r=t[0].data[0];this.vendor=r,this.countries=t[0].countries,this.provinces=t[0].provinces,this.district=t[0].districts,this.subDistrict=t[0].sub_districts,this.priceLevels=t[1].data;const{country:a,province:s,district:_,sub_district:u,province_other:p,first_name:d,last_name:C,email:g,contact_person_line:v,contact_person_phonenumber:h}=r,m=!!(d||C||g||v||h);this.onChangeContactPersonSection(m),this.vendorForm.patchValue(Object.assign(Object.assign({},r),{contact_person_section:m,country:a._id,province:s._id,province_other:a._id===f.sr.COUNTRY_THAI_ID?null:p,district:a._id===f.sr.COUNTRY_THAI_ID?_._id:null,
1sub_district:a._id===f.sr.COUNTRY_THAI_ID?null==u?void 0:u._id:null})),this.spinner.hide()},error:t=>{this.spinner.hide(),this.toastr.error(t.error.message)}})}onChangeCountry(n){this.vendorForm.patchValue({province:null,district:null,sub_district:null,province_other:null,zipcode:null}),this.provinces=[],this.district=[],this.subDistrict=[],this.serverService.getProvinceByID(n._id).subscribe({next:t=>{this.provinces=t.data,n._id!==f.sr.COUNTRY_THAI_ID&&this.vendorForm.patchValue({province:this.provinces[0]._id})},error:t=>{this.toastr.error(t.error.message)}})}onChangeProvince(n){this.vendorForm.patchValue({district:null,sub_district:null,zipcode:null}),this.district=[],this.subDistrict=[],this.serverService.getDistrictByID(n._id).subscribe({next:t=>{this.district=t.data},error:t=>{this.toastr.error(t.error.message)}})}onChangeDistrict(n){this.vendorForm.patchValue({sub_district:null,zipcode:null}),this.subDistrict=[],this.serverService.getSubDistrictByID(n._id).subscribe({next:t=>{this.subDistrict=t.data},error:t=>{this.toastr.error(t.error.message)}})}onChangeSubDistrict(n){this.vendorForm.patchValue({zipcode:n.ZIP_CODE})}handleSetDefaultPhoneNumber(){const n=`\n    <div class="text-center">\n      <h4 class="tw-font-bold">${this.translate.instant("VENDOR_CREATE.PHONE_NUMBER_INVALID")}</h4>
1\n      <span class="tw-text-gray-500 tw-text-2xl">${this.translate.instant("VENDOR_CREATE.SET_DEFAULT_PHONE_NUMBER")}</span>\n    </div>\n    `;(0,w.$M)(n,"warning",!0,this.translate,()=>{this.vendorForm.patchValue({phonenumber:"-"}),this.onSubmit()})}onSubmit(){if(this.vendorForm.controls.phonenumber.invalid)return void this.handleSetDefaultPhoneNumber();(0,b.w2)(this.vendorForm.controls);const{valid:n,value:t}=this.vendorForm;if(n){const{contact_person_section:r,first_name:a,last_name:s,email:_,contact_person_line:u,contact_person_phonenumber:p,price_level_status:d,price_level_id:C,vendor_credit_status:g,vendor_credit:v}=t,h=(0,O._T)(t,["contact_person_section","first_name","last_name","email","contact_person_line","contact_person_phonenumber","price_level_status","price_level_id","vendor_credit_status","vendor_credit"]);let m=Object.assign(Object.assign({},h),{clear_contact_person:!0,vendor_credit_status:g,price_level_status:d});d&&(m=Object.assign(Object.assign({},m),{price_level_id:C})),g&&(m=Object.assign(Object.assign({},m),{vendor_credit:v})),r&&(m=Object.assign(Object.assign({},m),{clear_contact_person:!1,first_name:a,last_name:s,email:_,contact_person_line:u,contact_person_phonenumber:p})),this.isEdit?(m=Object.assign(Object.assign({},m),{_id:this.vendor._id}),this.spinner.show(),this.serverService.updateVendor(m).subscribe({next:({data:E})=>{this.spinner.hide(),this.translate.get("VENDOR_CREATE.UPDATE_VENDOR_SUCCESS").subscribe(qe=>this.toastr.success(qe));const[A]=E;this.initInstancesForEdit(A._id),this.callbackSubmit.emit()},error:E=>{this.spinner.hide(),this.toastr.error(E.error.message)}})):(this.spinner.show(),this.serverService.createVendor(m).subscribe({next:({data:E})=>{this.spinner.hide(),this.translate.get("VENDOR_CREATE.CREATE_VENDOR_SUCCESS").subscribe(A=>this.toastr.success(A)),this.callbackSubmit.emit(E[0])},error:E=>{this.spinner.hide(),this.toastr.error(E.error.message)}}))}}handleClickOpenScannerIdCardModal(){this.visibleScannerIdCardModal=!0,(0,b.h7)("scannerIdCardModal")}handleCloseScannerIdCardModal(){this.visibleScannerIdCardModal=!1}toggleTabs(n){this.isProductManage=n}ngOnDestroy(){var n;null===(n=this.memberIdCardChangeSubscription)||void 0===n||n.unsubscribe()}}return o.\u0275fac=function(n){return new(n||o)(e.Y36(I.sK),e.Y36(R.t2),e.Y36(V.N),e.Y36(F.G),e.Y36(Y.n))},o.\u0275cmp=e.Xpm({type:o,selectors:[["app-vendor-create"]],inputs:{vendorId:"vendorId",isModalFromShopBuy:"isModalFromShopBuy",visibleScannerIdCard:"visibleScannerIdCard",height:"height"},outputs:{callbackSubmit:"callbackSubmit"},decls:136,vars:72,consts:[[1,"box-content-no-border",2,"border","0","overflow-y","auto"],["class","box-header with-border tab-flex",4,"ngIf"],[1,"box-body","!tw-p-0",3,"ngClass"],[1,"tab-content",3,"ngClass"],["id","vendor_detail",1,"active","tab-pane"],["disableEnterSubmit","",3,"formGroup","ngSubmit"],[1,"box-content-no-border"],[1,"box-header","with-border","header-flex"],[1,"tw-flex","tw-justify-between",2,"flex-grow","1"],[1,"tw-flex","tw-items-center"],["src","assets/images/ic_amb_company.svg","alt","",1,"title-icon"],[1,"box-title","title-text","main-content-title","content-middle"],[4,"ngIf"],["type","button","class","btn pp-btn-default",3,"click",4,"ngIf"],[1,"box-body"],[1,"form-group"],["for","company_name",1,"title-label"],[1,"tw-text-red-500"],["type","text","id","company_name","name","company_name","formControlName","company_name","trim","blur",1,"form-control","input-text"],["class","help-block with-error",4,"ngIf"],[1,"row"],[1,"col-sm-6"],["for","branch",1,"title-label","tw-relative",2,"width","100%"],[1,"tw-text-red-500","!tw-items-start"],["appNumbersOnly","","type","text","name","branch","id","branch","formControlName","branch","maxlength","5","trim","blur",1,"form-control","input-text",3,"placeholder"],["for","phonenumber",1,"title-label"],["id","phonenumber","type","tel","name","phonenumber","formControlName","phonenumber","trim","blur",1,"form-control","input-text"],["for","address",1,"title-label"],["formControlName","address","id","address","type","text","name","address","trim","blur",1,"form-control","input-text"],["for","country",1,"title-label"],["bindValue","_id","formControlName","country",1,"ng-select-separator",3,"bindLabel","items","clearable","change"],[4,"ngIf","ngIfElse"],["isForeignOther",""],["for","zipcode",1,"title-label"],["id","zipcode","formControlName","zipcode","type","text","name","zipcode","trim","blur",1,"form-control","input-text"],[1,"tw-mt-[20px]","tw-mb-[10px]"],["for","company_email",1,"title-label"],["id","company_email","name","company_email","formControlName","company_email","type","email","trim","blur",1,"form-control","input-text"],["for","company_line",1,"title-label"],["id","company_line","name","company_line","formControlName","company_line","trim","blur",1,"form-control","input-text"],["for","tax_id",1,"title-label"],["appNumbersOnly","","type","text","id","tax_id","name","tax_id","formControlName","tax_id","trim","blur","maxlength","13",1,"form-control","input-text"],["class","label-with-error",4,"ngIf"],["for","company_fax",1,"title-label"],["id","company_fax","type","tel","name","company_fax","formControlName","company_fax","trim","blur",1,"form-control","input-text"],[1,"box-header","with-border"],["src","assets/images/ic_buy_price_level_gray.svg","alt","",1,"title-icon"],[2,"float","right"],["size","small","formControlName","price_level_status"],["class","box-body",4,"ngIf"],["src","assets/images/ic_debt_normal.svg","alt","",1,"title-icon"],["size","small","formControlName","vendor_credit_status"],[1,"box-content-no-border",2,"margin-bottom","0"],["src","assets/images/ic_amb_user.svg","alt","",1,"title-icon"],["size","small","formControlName","contact_person_section",3,"valueChange"],["id","vendor_product",1,"tab-pane"],[3,"vendor",4,"ngIf"],[3,"closeModal",4,"ngIf"],[1,"box-header","with-border","tab-flex"],[1,"pp-tabs",2,"margin-bottom","0"],[1,"nav","nav-tabs","first-border"],[1,"active",2,"background","#f7f7f7",3,"click"],["href","#vendor_detail","data-toggle","tab"],[1,"tab-title-label"],[2,"background","#f7f7f7",3,"click"],["href","#vendor_product","data-toggle","tab"],["routerLink","/core/stock/import/purchaseorder",3,"queryParams"],[1,"fa","fa-fw","fa-search"],["type","button",1,"btn","pp-btn-default",3,"click"],[1,"fa","fa-fw","fa-credit-card"],[1,"help-block","with-error"],["for","province",1,"title-label"],["bindValue","_id","bindLabel","PRO
1VINCE_NAME_TH","formControlName","province",1,"ng-select-separator",3,"items","clearable","change"],[1,"alert-label"],["for","province_other",1,"title-label"],["id","province_other","type","text","name","province_other","formControlName","province_other","trim","blur",1,"form-control","input-text"],[1,"label-with-error"],["for","district",1,"title-label"],["bindValue","_id","bindLabel","DISTRICT_NAME_TH","formControlName","district",1,"ng-select-separator",3,"items","clearable","change"],["bindValue","_id","bindLabel","SUB_DISTRICT_NAME_TH","formControlName","sub_district",1,"ng-select-separator",3,"items","clearable","change"],["errorRequiredTaxId",""],["bindValue","_id","bindLabel","name","formControlName","price_level_id",1,"ng-select-separator",3,"items","clearable"],["type","number","formControlName","vendor_credit",1,"form-control","input-text"],["for","first_name",1,"title-label"],["id","first_name","name","first_name","formControlName","first_name","trim","blur",1,"form-control","input-text"],["for","last_name",1,"title-label"],["type","text","id","last_name","name","last_name","formControlName","last_name","trim","blur",1,"form-control","input-text"],["for","email",1,"title-label"],["id","email","name","email","formControlName","email","type","email","trim","blur",1,"form-control","input-text"],["for","contact_person_phonenumber",1,"title-label"],["id","contact_person_phonenumber","type","tel","name","contact_person_phonenumber","formControlName","contact_person_phonenumber","trim","blur",1,"form-control","input-text"],["for","contact_person_line",1,"title-label"],["id","contact_person_line","name","contact_person_line","formControlName","contact_person_line","type","email","trim","blur",1,"form-control","input-text"],[3,"vendor"],[3,"closeModal"]],template:function(n,t){if(1&n&&(e.TgZ(0,"div",0),e.YNc(1,ce,13,6,"div",1),e.TgZ(2,"div",2)(3,"div",3)(4,"div",4)(5,"form",5),e.NdJ("ngSubmit",function(){return t.onSubmit()}),e.TgZ(6,"div",6)(7,"div",7)(8,"div",8)(9,"div",9),e._UZ(10,"img",10),e.TgZ(11,"h5",11),e._uU(12),e.ALo(13,"translate"),e.YNc(14,ue,5,3,"ng-container",12),e.qZA()(),e.YNc(15,_e,4,3,"button",13),e.qZA()(),e.TgZ(16,"div",14)(17,"div",15)(18,"label",16),e._uU(19),e.ALo(20,"translate"),e.TgZ(21,"small",17),e._uU(22,"*"),e.qZA()(),e._UZ(23,"input",18),e.YNc(24,pe,5,3,"span",19),e.qZA(),e.TgZ(25,"div",20)(26,"div",21)(27,"div",15)(28,"label",22),e._uU(29),e.ALo(30,"translate"),e.TgZ(31,"small",23),e._uU(32,"*"),e.qZA()(),e._UZ(33,"input",24),e.ALo(34,"translate"),e.YNc(35,me,3,3,"span",19),e.qZA()(),e.TgZ(36,"div",21)(37,"div",15)(38,"label",25),e._uU(39),e.ALo(40,"translate"),e.TgZ(41,"small",17),e._uU(42,"*"),e.qZA()(),e._UZ(43,"input",26),e.YNc(44,he,3,3,"span",19),e.qZA()()(),e.TgZ(45,"div",15)(46,"label",27),e._uU(47),e.ALo(48,"translate"),e.TgZ(49,"small",17),e._uU(50,"*"),e.qZA()(),e._UZ(51,"input",28),e.YNc(52,ge,3,3,"span",19),e.qZA(),e.TgZ(53,"div",20)(54,"div",21)(55,"div",15)(56,"label",29),e._uU(57),e.ALo(58,"translate"),e.TgZ(59,"small",17),e._uU(60,"*"),e.qZA()(),e.TgZ(61,"ng-select",30),e.NdJ("change",function(a){return t.onChangeCountry(a)}),e.qZA(),e.YNc(62,ve,3,3,"span",19),e.qZA()(),e.TgZ(63,"div",21),e.YNc(64,fe,9,6,"ng-container",31),e.YNc(65,Te,7,4,"ng-template",null,32,e.W1O),e.qZA()(),e.TgZ(67,"div",20),e.YNc(68,Ze,19,12,"ng-container",12),e.TgZ(69,"div",21)(70,"div",15)(71,"label",33),e._uU(72),e.ALo(73,"translate"),e.TgZ(74,"small",17),e._uU(75,"*"),e.qZA()(),e._UZ(76,"input",34),e.YNc(77,xe,3,3,"span",19),e.qZA()()(),e._UZ(78,"hr",35),e.TgZ(79,"div",20)(80,"div",21)(81,"div",15)(82,"label",36),e._uU(83),e.ALo(84,"translate"),e.qZA(),e._UZ(85,"input",37),e.YNc(86,Ie,3,3,"span",19),e.qZA()(),e.TgZ(87,"div",21)(88,"div",15)(89,"label",38),e._uU(90),e.ALo(91,"translate"),e.qZA(),e._UZ(92,"input",39),e.qZA()()(),e.TgZ(93,"div",20)(94,"div",21)(95,"div",15)(96,"label",40),e._uU(97),e.ALo(98,"translate"),e.qZA(),e._UZ(99,"input",41),e.YNc(100,Se,4,2,"span",42),e.qZA()(),e.TgZ(101,"div",21)(102,"label",43),e._uU(103),e.ALo(104,"translate"),e.qZA(),e._UZ(105,"input",44),e.qZA()()()(),e.TgZ(106,"div",6)(107,"div",45),e._UZ(108,"img",46),e.TgZ(109,"h5",11),e._uU(110),e.ALo(111,"translate"),e.qZA(),e.TgZ(112,"div",47),e._UZ(113,"ui-switch",48),e.qZA()(),e.YNc(114,Le,4,3,"div",49),e.qZA(),e.TgZ(115,"div",6)(116,"div",45),e._UZ(117,"img",50),e.TgZ(118,"h5",11),e._uU(119),e.ALo(120,"translate"),e.qZA(),e.TgZ(121,"div",47),e._UZ(122,"ui-switch",51),e.qZA()(),e.YNc(123,ye,4,1,"div",49),e.qZA(),e.TgZ(124,"div",52)(125,"div",45),e._UZ(126,"img",53),e.TgZ(127,"h5",11),e._uU(128),e.ALo(129,"translate"),e.qZA(),e.TgZ(130,"div",47)(131,"ui-switch",54),e.NdJ("valueChange",function(a){return t.onChangeContactPersonSection(a)}),e.qZA()()(),e.YNc(132,Ve,35,16,"div",49),e.qZA()()(),e.TgZ(133,"div",55),e.YNc(134,Fe,1,1,"app-vendor-products",56),e.qZA()()()(),e.YNc(135,Ue,1,0,"app-scanner
1-id-card-modal",57)),2&n){const r=e.MAs(66);let a,s,_,u,p,d,C,g,v,h,m,E,A;e.Udp("height",t.height,"vh"),e.xp6(1),e.Q6J("ngIf",t.isEdit),e.xp6(1),e.Q6J("ngClass",t.isModalFromShopBuy?"!tw-px-2":""),e.xp6(1),e.Q6J("ngClass",t.isModalFromShopBuy?"":"!tw-bg-[#edf1f5]"),e.xp6(2),e.Q6J("formGroup",t.vendorForm),e.xp6(7),e.hij(" ",e.lcZ(13,42,"VENDOR_CREATE.COMPANY_DATA_TITLE")," "),e.xp6(2),e.Q6J("ngIf",t.vendor),e.xp6(1),e.Q6J("ngIf",t.visibleScannerIdCard),e.xp6(4),e.hij("",e.lcZ(20,44,"VENDOR_CREATE.COMPANY_NAME_TITLE")," "),e.xp6(5),e.Q6J("ngIf",(null==(a=t.vendorForm.get("company_name"))?null:a.invalid)&&(null==(a=t.vendorForm.get("company_name"))?null:a.touched)),e.xp6(5),e.hij("",e.lcZ(30,46,"VENDOR_CREATE.COMPANY_BRANCH_TITLE")," "),e.xp6(4),e.s9C("placeholder",e.lcZ(34,48,"GLOBAL.NUMBER_IS_HEADQUARTER")),e.xp6(2),e.Q6J("ngIf",(null==(s=t.vendorForm.get("branch"))?null:s.invalid)&&(null==(s=t.vendorForm.get("branch"))?null:s.touched)),e.xp6(4),e.hij("",e.lcZ(40,50,"VENDOR_CREATE.PHONE_NUMBER_TITLE")," "),e.xp6(5),e.Q6J("ngIf",(null==(_=t.vendorForm.get("phonenumber"))?null:_.invalid)&&(null==(_=t.vendorForm.get("phonenumber"))?null:_.touched)),e.xp6(3),e.hij("",e.lcZ(48,52,"VENDOR_CREATE.ADDRESS_TITLE")," "),e.xp6(5),e.Q6J("ngIf",(null==(u=t.vendorForm.get("address"))?null:u.invalid)&&(null==(u=t.vendorForm.get("address"))?null:u.touched)),e.xp6(5),e.hij("",e.lcZ(58,54,"VENDOR_CREATE.COUNTRY_TITLE")," "),e.xp6(4),e.Q6J("bindLabel",t.translate.currentLang===t.LanguageContant.TH?"COUNTRY_NAME_TH":"COUNTRY_NAME_EN")("items",t.countries)("clearable",!1),e.xp6(1),e.Q6J("ngIf",(null==(p=t.vendorForm.get("country"))?null:p.invalid)&&(null==(p=t.vendorForm.get("country"))?null:p.touched)),e.xp6(2),e.Q6J("ngIf",(null==(d=t.vendorForm.get("country"))?null:d.value)===t.Constant.COUNTRY_THAI_ID)("ngIfElse",r),e.xp6(4),e.Q6J("ngIf",(null==(C=t.vendorForm.get("country"))?null:C.value)===t.Constant.COUNTRY_THAI_ID),e.xp6(4),e.hij("",e.lcZ(73,56,"VENDOR_CREATE.ZIP_CODE_TITLE")," "),e.xp6(5),e.Q6J("ngIf",(null==(g=t.vendorForm.get("zipcode"))?null:g.invalid)&&(null==(g=t.vendorForm.get("zipcode"))?null:g.touched)),e.xp6(6),e.Oqu(e.lcZ(84,58,"VENDOR_CREATE.COMPANY_EMAIL")),e.xp6(3),e.Q6J("ngIf",(null==(v=t.vendorForm.get("company_email"))?null:v.invalid)&&(null==(v=t.vendorForm.get("company_email"))?null:v.touched)),e.xp6(4),e.Oqu(e.lcZ(91,60,"VENDOR_CREATE.COMPANY_LINE")),e.xp6(7),e.Oqu(e.l
1cZ(98,62,"VENDOR_CREATE.TAX_ID_TITLE")),e.xp6(3),e.Q6J("ngIf",(null==(h=t.vendorForm.get("tax_id"))?null:h.invalid)&&(null==(h=t.vendorForm.get("tax_id"))?null:h.touched)),e.xp6(3),e.Oqu(e.lcZ(104,64,"VENDOR_CREATE.COMPANY_FAX")),e.xp6(7),e.hij(" ",e.lcZ(111,66,"VENDOR_CREATE.PRICE_LEVEL_TITLE")," "),e.xp6(4),e.Q6J("ngIf",null==(m=t.vendorForm.get("price_level_status"))?null:m.value),e.xp6(5),e.hij(" ",e.lcZ(120,68,"VENDOR_CREATE.CREDIT_TITLE")," "),e.xp6(4),e.Q6J("ngIf",null==(E=t.vendorForm.get("vendor_credit_status"))?null:E.value),e.xp6(5),e.hij(" ",e.lcZ(129,70,"VENDOR_CREATE.MORE_INFORMATION_TITLE")," "),e.xp6(4),e.Q6J("ngIf",null==(A=t.vendorForm.get("contact_person_section"))?null:A.value),e.xp6(2),e.Q6J("ngIf",t.isProductManage),e.xp6(1),e.Q6J("ngIf",t.visibleScannerIdCardModal)}},directives:[Z.O5,Z.mk,i._Y,i.JL,U.O,i.sg,D.yS,i.Fj,M.$,i.JJ,i.u,J.X,i.nD,S.w9,j.o,i.wV,le,se.J],pipes:[I.X$],styles:[".tab-flex[_ngcontent-%COMP%]{display:flex;padding:0}.header-flex[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}"]}),o})()}}]);

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.