Liferay.Loader.define("commerce-frontend-js@4.0.52/components/account_selector/views/OrdersListView",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","liferay!frontend-js-react-web$react","../../../ServiceProvider/index","../../../utilities/eventsDefinitions","../../../utilities/index","../../modal/Modal","../OrdersTable","../util/constants","./EmptyListView","./ListView"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=g(a("@frontend-taglib-clay$clayui/button")),l=y(a("@frontend-taglib-clay$clayui/drop-down")),n=g(a("liferay!frontend-js-react-web$react")),i=y(a("../../../ServiceProvider/index")),d=a("../../../utilities/eventsDefinitions"),o=a("../../../utilities/index"),u=y(a("../../modal/Modal")),c=y(a("../OrdersTable")),f=a("../util/constants"),s=y(a("./EmptyListView")),m=y(a("./ListView"));function y(e){return e&&e.__esModule?e:{default:e}}function p(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return p=function(){return e},e}function g(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=p();if(t&&t.has(e))return t.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=r?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(a,l,n):a[l]=e[l]}return a.default=e,t&&t.set(e,a),a}var v=function({commerceChannelId:e,createOrderURL:t,currentAccount:a,disabled:y,selectOrderURL:p,setCurrentView:g,showOrderTypeModal:v}){const w=(0,n.useMemo)((()=>i.default.DeliveryCartAPI("v1")),[]),b=(0,n.useRef)();return n.default.createElement(l.default.ItemList,{className:"orders-list-container"},n.default.createElement(l.default.Section,{className:"item-list-head"},n.default.createElement(r.ClayButtonWithIcon,{displayType:"unstyled",onClick:()=>g(f.VIEWS.ACCOUNTS_LIST),symbol:"angle-left-small"}),n.default.createElement("span",{className:"text-truncate-inline"},n.default.createElement("span",{className:"text-truncate"},a.name))),n.default.createElement(l.default.Divider,null),n.default.createElement(l.default.Section,{className:"item-list-body"},n.default.createElement(m.default,{apiUrl:w.cartsByAccountIdAndChannelIdURL(a.id,e),contentWrapperRef:b,customView:({items:e,loading:t})=>e&&e.length?n.default.createElement(c.default,{orders:e,selectOrderURL:p}):n.default.createElement(s.default,{caption:Liferay.Language.get("no-orders-were-found"),loading:t}),disabled:y,placeholder:Liferay.Language.get("search-order")})),n.default.createElement(l.default.Divider,null),n.default.createElement("li",null,n.default.createElement("div",{ref:b})),n.default.createElement(l.default.Section,null,n.default.createElement(r.default,{className:"m-auto w-100",displayType:"primary",onClick:()=>v?Liferay.fire(d.OPEN_MODAL,{id:"add-order-modal"}):(0,o.liferayNavigate)(t)},Liferay.Language.get("create-new-order"))),v?n.default.createElement(u.default,{id:"add-order-modal",refreshPageOnClose:!0,url:t}):null)};t.default=v}}));
//# sourceMappingURL=OrdersListView.js.map