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