PageSourceSearch

https://admin.easystore.blue/assets/SelectInventoryLocation-DPkSQERn.js

js easystore.blue collected 2026-10-09 02:55:44 UTC 8,911 bytes, 1 lines download raw bytes

1import{_ as P}from"./Screen-DV8QfyoK.js";import{_ as q,a as x}from"./ScreenLayoutSection-BIi4-1wM.js";import{_ as C}from"./Card-DSzZAmEE.js";import{_ as E,b as O,B as N}from"./index-BykrHpuN.js";import{_ as T}from"./PosLoadingState-CJU9hyqw.js";import{s as B}from"./scheduleOrder-Bq8_ECNO.js";import{S as D}from"./ScheduleOrderSummary-CsPE_uff.js";import{P as A}from"./PosListGroup-CS7xdMUo.js";import{P as $}from"./PosListItem-dZ05URwC.js";import{n as V}from"./Navigator-BERqhirj.js";import{g as z}from"./dom-BIOseQp1.js";import{r as k,o as c,e as S,w as l,P as m,J as h,N as _,H as y,K as b,L as R,cX as G,cV as H,O as M}from"./vendor-BehnxqKh.js";import"./ScreenHeaderBar-D_evskJC.js";import"./device-DCkCH9Bp.js";import"./FacilAccordionPanel-D4lR5ktY.js";import"./FacilLoader-CiRTVYPY.js";import"./People-u57SB6Io.js";import"./TotalPrice-tXEslmj3.js";import"./formatMoney--0QyqCU6.js";import"./isFalsey-vG52LgbP.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"chinhong93@[email protected]"};var e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="3b31868a-19d6-4dc4-8ba2-9d94f2359dfd",t._sentryDebugIdIdentifier="sentry-dbid-3b31868a-19d6-4dc4-8ba2-9d94f2359dfd")}catch{}})();const j={name:"ScheduleOrderSelectInventoryLocationLegacy",components:{PosListGroup:A,PosListItem:$,ScheduleOrderSummary:D},mixins:[V,B],data(){return{storeLocations:[],primaryLocation:{},isLocationsInventoriesLoaded:!1,location_inventories:[],primary_location_details:null,location_details:[]}},computed:{pos(){return N()},headerBar(){return{title:this.$tt("pos.schedule_shipping.ship_from.select_inventory_location"),leftAction:{icon:"chevron_left",onAction:()=>{this.navigatorPop()}}}},mappedLocations(){return this.storeLocations.map(t=>{let e=t.address1;return t.address2!=null&&(e=e+", "+t.address2),t.zip!=null&&(e=e+", "+t.zip),t.city!=null&&(e=e+", "+t.city),t.sub_district!=null&&(e=e+", "+t.sub_district),t.district!=null&&(e=e+", "+t.district),t.province!=null&&(e=e+", "+t.province),t.country!=null&&(e=e+", "+t.country),t.address=e,t})}},mounted(){this.loadStoreLocation()},methods:{handleClick(t,e="select"){const n=z(t,"data-id")||t;let s={};e==="select"&&!this.isLocationsInventoriesLoaded?s=this.storeLocations.find(o=>o.id==n):s=this.location_inventories.find(o=>o.id==n),this.scheduleOrder.shipping_origin=s,this.pos.SET_SCHEDULE_ORDER(this.scheduleOrder),e=="select"?this.statePickupHandle?(this.pos.calculateCart(),this.navigatorPush("checkout-summary")):this.navigatorPush("select-shipping-rate"):this.navigatorPush("view-product-inventory")},async loadStoreLocation(){let t=[],e=[];this.locations.length?t=this.locations:t=await this.$api.location.listLocations({include_hidden:!0,is_enabled:!0,is_filter_pos_location_permission:!0}).then(n=>{var s,o;return(o=(s=n.data)==null?void 0:s.data)!=null&&o.locations?n.data.data.locations:[]}).catch(()=>[]),this.storeLocations=t.filter(n=>{var s;return!!(n.is_primary==!0||n.track_inventory_enabled&&(n.online_fulfillment_enabled==!0||(s=this.currentState.selectedLocation)!=null&&s.id&&this.currentState.selectedLocation.id==n.id))}),e=this.storeLocations,this.primaryLocation=this.storeLocations.filter(n=>n.is_primary),this.storeLocations=this.storeLocations.sort((n,s)=>{var o,a;return(o=this.currentState.selectedLocation)!=null&&o.id&&this.currentState.selectedLocation.id==n.id?-1:(a=this.currentState.selectedLocation)!=null&&a.id&&this.currentState.selectedLocation.id==s.id?1:n.fulfillment_priority-s.fulfillment_priority}),this.loadLocationsInventories(e)},loadLocationsInventories(t){let e=[];t.forEach(n=>{let s=this.getInventoryLevel(n);e.push(s)}),Promise.all(e).then(()=>{this.location_inventories=this.location_inventories.concat(this.location_details),this.primary_location_details&&this.location_inventories.forEach((n,s)=>{n.track_inventory_enabled||(this.location_inventories[s].location_inventory_status=this.primary_location_details.location_inventory_status,this.location_inventories[s].location_items_inventory=this.primary_location_details.location_items_inventory)}),this.isLocationsInventoriesLoaded=!0}).catch(n=>{console.error("Error during API calls:",n),this.isLocationsInventoriesLoaded=!0})}
1,getInventoryLevel(t){return new Promise((e,n)=>{let s=this.pos.cart.items,o="sufficient",a=[],r=s.map(i=>{let u="sufficient";if(i.inventory_management==="none")u="not_tracked",o="not_tracked",a.push({product_name:i.product_name,variant_name:i.variant_name,image_url:i.image_url,inventory_status:u,onhand_inventory_quantity:0,inventory_quantity:0,is_new:!1});else{if(t.track_inventory_enabled&&!i.is_new)return this.$api.inventory_level.getInventoryLevel({variant_id:i.variant_id,location_id:t.id,fields:"committed_inventory_quantity,onhand_inventory_quantity",extras:"variant,location"}).then(p=>{var g;let v=0,d=0;if((g=p==null?void 0:p.data)!=null&&g.inventory_level){let L=p.data.inventory_level;v=L.onhand_inventory_quantity,d=L.inventory_quantity,o=="sufficient"&&(d<i.quantity||d<=0)&&(o="insufficient"),d<i.quantity&&(u="insufficient")}else o="insufficient",u="insufficient",v=0,d=0;a.push({product_name:i.product_name,variant_name:i.variant_name,image_url:i.image_url,inventory_status:u,onhand_inventory_quantity:v,inventory_quantity:d,is_new:!1})}).catch(()=>{o="insufficient",a.push({product_name:i.product_name,variant_name:i.variant_name,image_url:i.image_url,inventory_status:"insufficient",onhand_inventory_quantity:0,inventory_quantity:0,is_new:!1})});i.is_new?a.push({product_name:i.product_name,variant_name:"",image_url:null,inventory_status:"insufficient",onhand_inventory_quantity:0,inventory_quantity:0,is_new:!0}):(o="insufficient",a.push({product_name:i.product_name,variant_name:i.variant_name,image_url:i.image_url,inventory_status:"insufficient",onhand_inventory_quantity:0,inventory_quantity:0,is_new:!1}))}});Promise.all(r).then(()=>{let i={id:t.id,name:t.name,location_inventory_status:o,location_items_inventory:a,track_inventory_enabled:t.track_inventory_enabled};t.is_primary&&(this.primary_location_details=i),this.location_details.push(i),e()}).catch(i=>{console.error("Error during API calls:",i),n(i)})})},getInventoryStatus(t){const e=this.location_inventories.filter(r=>r.id==t);if(!e.length)return"not_tracked";const n=e[0].location_items_inventory||[];return n.length?n.some(r=>r.inventory_status==="insufficient")?"insufficient":n.every(r=>r.inventory_status==="not_tracked")?"not_tracked":n.every(r=>r.inventory_status==="sufficient"||r.inventory_status==="not_tracked")?"sufficient":"insufficient":"not_tracked"}}},F={class:"screen-text-large font-500"},J={class:"flex flex-col gap-y-1.5"},K={class:"font-medium screen-text-medium"},U={class:"text-muted screen-text-default"},X={class:"flex flex-col justify-end gap-y-1.5"},Y={key:0,class:"text-muted flex items-center justify-end"},Q={class:"ml-2"},W={key:0,class:"label label--success ml-auto font-medium screen-text-default"},Z={key:1,class:"label label--warning ml-auto font-medium screen-text-default"},tt={key:2,class:"label label--info ml-auto font-medium screen-text-default"};function et(t,e,n,s,o,a){const r=k("ScheduleOrderSummary"),i=x,u=T,p=O,v=k("PosListItem"),d=k("PosListGroup"),g=C,L=q,I=P;return c(),S(I,{"header-bar":a.headerBar,class:"bg-white"},{default:l(()=>[m(L,null,{default:l(()=>[m(i,{primary:"",class:"section-layout__left"},{default:l(()=>[m(r)]),_:1}),m(i,{class:"section-layout__right"},{default:l(()=>[m(g,{medium:""},{default:l(()=>[h("h3",F,_(t.$tt("pos.schedule_shipping.ship_from.from_location")),1),m(d,{onClick:a.handleClick},{default:l(()=>[(c(!0),y(b,null,R(a.mappedLocations,(f,w)=>(c(),S(v,{key:w,"data-id":f.id,"show-icon":!0},{left:l(()=>[...e[0]||(e[0]=[])]),content:l(()=>[h("div",J,[h("div",K,_(f.name),1),h("div",U,_(f.address),1)])]),right:l(()=>[h("div",X,[o.isLocationsInventoriesLoaded?(c(),y(b,{key:1},[a.getInventoryStatus(f.id)=="sufficient"?(c(),y("div",W,_(t.$tt("pos.schedule_shipping.ship_from.sufficient")),1)):a.getInventoryStatus(f.id)=="insufficient"?(c(),y("div",Z,_(t.$tt("pos.schedule_shipping.ship_from.insufficient")),1)):(c(),y("div",tt,_(t.$tt("pos.schedule_shipping.ship_from.not_tracked")),1)),a.getInventoryStatus(f.id)!="not_tracked"?(c(),S(p,{key:3,kind:"link",type:"primary",size:"xl",onClick:G(nt=>a.handleClick(f.id,"view"),["prevent"])},{default:l(()=>[H(_(t.$tt("pos.schedule_shipping.ship_from.view_details")),1)]),_:1},8,["onClick"])):M("",!0)],64)):(c(),y("div",Y,[m(u,{type:"optimistic"}),h("span",Q,_(t.$tt("pos.schedule_shipping.ship_from.fetching")),1)]))])]),_:2},1032,["data-id"]))),128))]),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1})]),_:1},8,["header-bar"])}const bt=E(j,[["render",et],["__scopeId","data-v-d9c983eb"],["__file","SelectInventoryLocation.vue"]]);export{bt 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.