web2019/static/js/shop.min.js

16 lines
35 KiB
JavaScript
Raw Normal View History

feat(place-order): Adds order hardware system fix(place-order): Avoids colliding with page var feat(place-order): Adds drag(copy)/drop system Finally get this to work.. Still some minor issues while drag(copy)/drop This commit allows to drag(copy)/drop inside the crate. Allows to reorder the crate feat(place-order): Adds basic summary of shopping cart allows to delete item feat(place-order): Adds form also applies some cosmetcis css feat(place-order): Applies custom css to drag/drop process feat(place-order): Improves crate UI feat(place-order): Adds missing assets feat(place-order): Updates icon button add feat(place-order): Changes cart layout to increase space - moves up the control crate type (rack/desktop) - increase card size a bit - reduces some padding - adding some space above card title - re-organise react component to achieve this layout feat(place-order): Updates icon remove in summary price - uses icon instead of shitty html/css - re-organises react component fix(place-order): Reduces overlay gradient effect on the aside also increases padding-bottom to avoid overlay above content feat(place-order): Updates summary price layout feat(place-order): Updates CrateMode using data this avoid using hard text in component and also, adding crate mode in data.js will be helpful for other component too (e.g OrderSummary) feat(place-order): Adds crate mode in OrderSummary Allows to add fees to rack mode for exemple feat(place-order): Allows to delete all items in the crate at once feat(place-order): Updates typo uses currentMode instead of crateMode feat(place-order): Displays selection shadow on card when user hover delete button feat(place-order): Allows to add item to the crate feat(place-order): Corrects typo feat(place-order): Corrects layout for browser support feat(place-order): Adds first automatic rules this allows to test how things could be done feat(place-order): Allows to remove card when drop out of crate feat(place-order): Adds icon reminder to rules feat(place-order): Uses internal js production assets feat(place-order): Uses production file feat(place-order): Adds kali first as initialisation feat(place-order): Simulates slots in crate (desktop/rack) feat(place-order): Updates data that prepare for rules algo feat(place-order): Adds some rules feat(place-order): Removes rule 2kasli when no more kasli it's a fix feat(place-order): Corrects typo rules koster fix(place-order): Removes PWA prompt fix(place-order): Corrects size card inside crate refactor(place-order): Reduces padding between items in listing refactor(place-order): Uses USD currency feat(place-order): Upgrades algo for rules feat(place-order): Adds progress bar to kasli/kasli w/backplane feat(place-order): Refactores a bit rule handler feat(place-order): Adds all other rules fix(place-order): Corrects typo fix(place-order): Corrects count zotino/hd68 when IDC-BNC does not follow each others feat(place-order): Backups dev script call just in case For now, I can work with prod build even debugging production code feat(place-order): Adds super tooltip to progress bar feat(place-order): Adds tooltip for zotino/hd68 too refactor(place-order): Updates typo rule for Koster feat(place-order/WIP): Adds warning feat(place-order): Adds Mirny adds css changes from previous commit (i've forgotten) feat(place-order): Updates build feat(place-order): Set RJ45-DIO to occupy 2 EEMs feat(place-order): Make clocker progress bar visible It was hidden by horizontal scrollbar inside crate feat(place-order): Remove red warning for 2 kaslis following each other feat(place-order): Adds rule for cards that need a resource controller feat(place-order): Corrects typo, adds point to end of message feat(place-order): Changes idc-bnc info into a warning one feat(place-order): Moves down warning box feat(place-order): Updates some cosmetics css fix(place-order): Removes IDC-BNC from Kasli connectors count feat(place-order): Displays warning on hover warning icon feat(place-order): Updates design hover item in listing feat(place-order): Updates price estimate feat(place-order): Displays warning in summary feat(place-order): Allows to select item feat(place-order): Allows to send request quote through client email fix(place-order): Allows to click on remove inside summary list feat(place-order): Adds btn remove for each cards inside crate feat(place-order): Builds fix(place-order): Updates icon warning fix(place-order): Corrects recipient email address LOL, forgot to remove mine haha fix(place-order): Removes typo (kasli double) fix(place-order): Removes num from email title subject fix(place-order): Adds warning resources to mirny, zotino Also updates message text feat(place-order): Adds clocker counter feat(place-order): Uses warning for id68 instead of reminder feat(place-order): Adds crate type into the json feat(place-order): Adds btn order hardware in homepage refactor(place-order): Cleans a bit fix(place-order): Improves a bit ux remove item from crate fix(place-order): Improves a bit ux remove item from crate feat(place-order): Builds fix(place-order): Uses cursor pointer on remove button fix(place-order): Corrects card need a resources card chore(place-order): Removes call to ap.js fix(place-order): Tries with fixed height on warning icon fix(place-order): Adds fixed height to other element fix(place-order): Tries to remove up container height to let flex to its job fix(place-order): Removes .trim call which block multiline and augments row to 5 feat(place-order): Builds fix(place-order): Adds min-height for the crate
2019-10-02 12:16:07 +08:00
'use strict';function _extends(){return _extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}function _typeof(a){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0// hack: remove weird animation after a drop
2019-11-13 10:47:39 +08:00
,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}function _possibleConstructorReturn(a,b){return b&&("object"===_typeof(b)||"function"==typeof b)?b:_assertThisInitialized(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&_setPrototypeOf(a,b)}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(a,b){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a)){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(b,!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(b).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}var _window$ReactBeautifu=window.ReactBeautifulDnd,DragDropContext=_window$ReactBeautifu.DragDropContext,Draggable=_window$ReactBeautifu.Draggable,Droppable=_window$ReactBeautifu.Droppable,data=window.shop_data,productStyle=function(a,b,c,d,e){var f={opacity:b.isDragging?.7:1,backgroundColor:d||e?"#eae7f7":"initial"};return b.isDropAnimating?(c&&(f.transitionDuration="0.001s"),_objectSpread({},a,{},f)):_objectSpread({},a,{},f)},cartStyle=function(a,b){var c=b.isDraggingOver;return _objectSpread({},a,{},{backgroundColor:c?"#f2f2f2":"#f9f9f9",border:c?"1px dashed #ccc":"0"})},nbrConnectorsStyle=function(a){if(!a||!a.nbrCurrentSlot)return{};var b=100*a.nbrCurrentSlot/a.nbrSlotMax;return 100<b&&(b=100),{width:"".concat(b,"%")}},nbrClocksStyle=function(a){if(!a||!a.nbrCurrentClock)return{};var b=100*a.nbrCurrentClock/a.nbrClockMax;return 100<b&&(b=100),{width:"".concat(b,"%")}},copy=function(a,b,c,d,e){var f=Array.from(b.itemIds),g=Array.from(c.items),h=f[d.index];return g.splice(e.index,0,_objectSpread({},a[h],{id:uuidv4()})),g},reorder=function(a,b,c){var d=Array.from(a),e=d.splice(b,1),f=_slicedToArray(e,1),g=f[0];return d.splice(c,0,g),d},remove=function(a,b){var c=Array.from(a);return c.splice(b,1),c},nbrOccupiedSlotsInCrate=function(a){return a.reduce(function(a,b){return a+(8===b.hp?2:1)},0)};function formatMoney(a){var b=Math.abs,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:2,d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:".",e=3<arguments.length&&void 0!==arguments[3]?arguments[3]:",";// https://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-currency-string-in-javascript
// changes: return amount if error in order to avoid empty value
try{c=b(c),c=isNaN(c)?2:c;var f=0>a?"-":"",g=parseInt(a=b(+a||0).toFixed(c)).toString(),h=3<g.length?g.length%3:0;return f+(h?g.substr(0,h)+e:"")+g.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+e)+(c?d+b(a-g).toFixed(c).slice(2):"")}catch(b){return a}}/**
* Component that provides a base layout (aside/main) for the page.
2019-12-13 09:33:00 +08:00
*/var Layout=/*#__PURE__*/function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,_getPrototypeOf(b).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:"render",value:function render(){var a=this.props,b=a.aside,c=a.main;return React.createElement("div",{className:"layout"},React.createElement("aside",{className:"aside"},b),React.createElement("section",{className:"main"},c))}}],[{key:"propTypes",get:function get(){return{aside:PropTypes.any,main:PropTypes.any}}}]),b}(React.PureComponent),ProductItem=/*#__PURE__*/function(a){function b(a){var c;return _classCallCheck(this,b),c=_possibleConstructorReturn(this,_getPrototypeOf(b).call(this,a)),c.handleOnClickAddItem=c.handleOnClickAddItem.bind(_assertThisInitialized(c)),c}return _inherits(b,a),_createClass(b,null,[{key:"propTypes",get:function get(){return{id:PropTypes.string.isRequired,index:PropTypes.number.isRequired,name:PropTypes.string.isRequired,price:PropTypes.number.isRequired,currency:PropTypes.string.isRequired,image:PropTypes.string.isRequired,specs:PropTypes.array,onClickAddItem:PropTypes.func}}}]),_createClass(b,[{key:"handleOnClickAddItem",value:function handleOnClickAddItem(a,b){this.props.onClickAddItem&&this.props.onClickAddItem(a),b.preventDefault()}},{key:"render",value:function render(){var a=this.props,b=a.id,c=a.index,d=a.name,e=a.price,f=a.currency,g=a.image,h=a.specs,i=h&&0<h.length&&React.createElement("ul",null,h.map(function(a,b){return React.createElement("li",{key:b},a)}));return React.createElement("section",{className:"productItem"},React.createElement("div",{className:"content"},React.createElement("h3",null,d),React.createElement("div",{className:"price"},"".concat(f," ").concat(formatMoney(e))),i),React.createElement("div",{className:"content"},React.createElement("button",{onClick:this.handleOnClickAddItem.bind(this,c)},React.createElement("img",{src:"/images/shop/icon-add.svg",alt:"add"})),React.createElement(Draggable,{draggableId:b,index:c},function(a,b){return React.createElement(React.Fragment,null,React.createElement("img",_extends({ref:a.innerRef},a.draggableProps,a.dragHandleProps,{style:productStyle(a.draggableProps.style,b,!0),src:g})),b.isDragging&&React.createElement("img",{className:"",src:g}))})))}}]),b}(React.PureComponent),ProductCartItem=/*#__PURE__*/function(a){function b(a){var c;return _classCallCheck(this,b),c=_possibleConstructorReturn(this,_getPrototypeOf(b).call(this,a)),c.handleOnMouseEnterItem=c.handleOnMouseEnterItem.bind(_assertThisInitialized(c)),c.handleOnMouseLeaveItem=c.handleOnMouseLeaveItem.bind(_assertThisInitialized(c)),c.handleOnMouseEnterWarningItem=c.handleOnMouseEnterWarningItem.bind(_assertThisInitialized(c)),c.handleOnMouseLeaveWarningItem=c.handleOnMouseLeaveWarningItem.bind(_assertThisInitialized(c)),c.handleOnMouseEnterRemoveItem=c.handleOnMouseEnterRemoveItem.bind(_assertThisInitialized(c)),c.handleOnMouseLeaveRemoveItem=c.handleOnMouseLeaveRemoveItem.bind(_assertThisInitialized(c)),c.handleOnClickRemoveItem=c.handleOnClickRemoveItem.bind(_assertThisInitialized(c)),c}return _inherits(b,a),_createClass(b,null,[{key:"propTypes",get:function get(){return{hovered:PropTypes.bool,index:PropTypes.number.isRequired,model:PropTypes.object.isRequired,data:PropTypes.object,onToggleProgress:PropTypes.func,onToggleWarning:PropTypes.func,onToggleOverlayRemove:PropTypes.func,onClickRemoveItem:PropTypes.func}}},{key:"defaultProps",get:function get(){return{hovered:!1}}}]),_createClass(b,[{key:"handleOnMouseEnterItem",value:function handleOnMouseEnterItem(a,b){this.props.onToggleProgress&&this.props.onToggleProgress(a,!0),b.preventDefault()}},{key:"handleOnMouseLeaveItem",value:function handleOnMouseLeaveItem(a,b){this.props.onToggleProgress&&this.props.onToggleProgress(a,!1),b.preventDefault()}},{key:"handleOnMouseEnterWarningItem",value:function handleOnMouseEnterWarningItem(a,b,c){b&&(this.props.onToggleWarning&&this.props.onToggleWarning(a,!0),c.preventDefault())}},{key:"handleOnMouseLeaveWarningItem",value:function handleOnMouseLeaveWarningItem(a,b,c){b&&(t
this.handleOnDragEnd({source:{droppableId:"backlog",index:0},destination:{droppableId:"cart",index:0},draggableId:null})}},{key:"componentDidUpdate",value:function componentDidUpdate(a,b){(b.columns.cart.items!==this.state.columns.cart.items||b.currentMode!==this.state.currentMode)&&this.checkAlerts(b.columns.cart.items,this.state.columns.cart.items)}},{key:"handleCrateModeChange",value:function handleCrateModeChange(a){this.setState({currentMode:a})}},{key:"handleDeleteItem",value:function handleDeleteItem(a){var b=Array.from(this.state.columns.cart.items);b.splice(a,1),this.setState(_objectSpread({},this.state,{columns:_objectSpread({},this.state.columns,{cart:_objectSpread({},this.state.columns.cart,{items:b})})}))}},{key:"handleDeleteAllItems",value:function handleDeleteAllItems(){this.setState(_objectSpread({},this.state,{columns:_objectSpread({},this.state.columns,{cart:_objectSpread({},this.state.columns.cart,{items:[]})})}))}},{key:"handleMouseEnterItem",value:function handleMouseEnterItem(a){this.setState(_objectSpread({},this.state,{currentItemHovered:a}))}},{key:"handleMouseLeaveItem",value:function handleMouseLeaveItem(){this.setState(_objectSpread({},this.state,{currentItemHovered:null}))}},{key:"handleClickAddItem",value:function handleClickAddItem(a){var b={droppableId:"cart",index:this.state.columns.cart.items.length};this.handleOnDragEnd({source:{droppableId:"backlog",index:a},destination:b,draggableId:null})}},{key:"handleToggleItemProgress",value:function handleToggleItemProgress(a,b){var c=Array.from(this.state.columns.cart.items);this.setState(_objectSpread({},this.state,{columns:_objectSpread({},this.state.columns,{cart:_objectSpread({},this.state.columns.cart,{items:c.map(function(c,d){return _objectSpread({},c,{showProgress:d===a&&b,showOverlayRemove:!1,showWarning:!1})})})})}))}},{key:"handleToggleItemWarning",value:function handleToggleItemWarning(a,b){var c=Array.from(this.state.columns.cart.items);this.setState(_objectSpread({},this.state,{columns:_objectSpread({},this.state.columns,{cart:_objectSpread({},this.state.columns.cart,{items:c.map(function(c,d){return _objectSpread({},c,{showWarning:d===a&&b,showProgress:!1,showOverlayRemove:!1})})})})}))}},{key:"handleClickSelectItem",value:function handleClickSelectItem(a){var b=Array.from(this.state.columns.cart.items);this.setState(_objectSpread({},this.state,{columns:_objectSpread({},this.state.columns,{cart:_objectSpread({},this.state.columns.cart,{items:b.map(function(b,c){return _objectSpread({},b,{selected:c===a})})})})}))}},{key:"handleToggleOverlayRemove",value:function handleToggleOverlayRemove(a,b){var c=Array.from(this.state.columns.cart.items);this.setState(_objectSpread({},this.state,{columns:_objectSpread({},this.state.columns,{cart:_objectSpread({},this.state.columns.cart,{items:c.map(function(c,d){return _objectSpread({},c,{showOverlayRemove:d===a&&b,showProgress:!1,showWarning:!1})})})})}))}},{key:"handleClickSubmit",value:function handleClickSubmit(b){var c={items:[],type:this.state.currentMode},d=Array.from(this.state.columns.cart.items);for(var g in d){var h=d[g];c.items.push({name:h.name})}var e=document.createElement("a"),a=new Date().getTime(),f="Hello!\n\nI would like to request a quotation for my below configuration:\n\n".concat(JSON.stringify(c),"\n\n(Please do not edit the machine-readable representation above)\n\n");b&&(f="".concat(f,"\n\nAdditional note:\n\n").concat(b?b.trim():"")),document.body.appendChild(e),e.style="display: none",e.href="mailto:sales@m-labs.hk?subject=".concat("[Order hardware] - Request Quote","&body=").concat(encodeURIComponent(f)),e.click()}},{key:"handleOnDragEnd",value:function handleOnDragEnd(a){var b=a.source,c=a.destination,d=a.draggableId;if(!c)return void("cart"===b.droppableId&&this.setState(_objectSpread({},this.state,{columns:_objectSpread({},this.state.columns,_defineProperty({},b.droppableId,_objectSpread({},this.state.columns[b.droppableId],{items:remove(this.state.columns[b.droppableId].items,b.index)})))})));switch(b.droppableId){case"backlog":this.setState(_objectSpread({},thi
feat(place-order): Adds order hardware system fix(place-order): Avoids colliding with page var feat(place-order): Adds drag(copy)/drop system Finally get this to work.. Still some minor issues while drag(copy)/drop This commit allows to drag(copy)/drop inside the crate. Allows to reorder the crate feat(place-order): Adds basic summary of shopping cart allows to delete item feat(place-order): Adds form also applies some cosmetcis css feat(place-order): Applies custom css to drag/drop process feat(place-order): Improves crate UI feat(place-order): Adds missing assets feat(place-order): Updates icon button add feat(place-order): Changes cart layout to increase space - moves up the control crate type (rack/desktop) - increase card size a bit - reduces some padding - adding some space above card title - re-organise react component to achieve this layout feat(place-order): Updates icon remove in summary price - uses icon instead of shitty html/css - re-organises react component fix(place-order): Reduces overlay gradient effect on the aside also increases padding-bottom to avoid overlay above content feat(place-order): Updates summary price layout feat(place-order): Updates CrateMode using data this avoid using hard text in component and also, adding crate mode in data.js will be helpful for other component too (e.g OrderSummary) feat(place-order): Adds crate mode in OrderSummary Allows to add fees to rack mode for exemple feat(place-order): Allows to delete all items in the crate at once feat(place-order): Updates typo uses currentMode instead of crateMode feat(place-order): Displays selection shadow on card when user hover delete button feat(place-order): Allows to add item to the crate feat(place-order): Corrects typo feat(place-order): Corrects layout for browser support feat(place-order): Adds first automatic rules this allows to test how things could be done feat(place-order): Allows to remove card when drop out of crate feat(place-order): Adds icon reminder to rules feat(place-order): Uses internal js production assets feat(place-order): Uses production file feat(place-order): Adds kali first as initialisation feat(place-order): Simulates slots in crate (desktop/rack) feat(place-order): Updates data that prepare for rules algo feat(place-order): Adds some rules feat(place-order): Removes rule 2kasli when no more kasli it's a fix feat(place-order): Corrects typo rules koster fix(place-order): Removes PWA prompt fix(place-order): Corrects size card inside crate refactor(place-order): Reduces padding between items in listing refactor(place-order): Uses USD currency feat(place-order): Upgrades algo for rules feat(place-order): Adds progress bar to kasli/kasli w/backplane feat(place-order): Refactores a bit rule handler feat(place-order): Adds all other rules fix(place-order): Corrects typo fix(place-order): Corrects count zotino/hd68 when IDC-BNC does not follow each others feat(place-order): Backups dev script call just in case For now, I can work with prod build even debugging production code feat(place-order): Adds super tooltip to progress bar feat(place-order): Adds tooltip for zotino/hd68 too refactor(place-order): Updates typo rule for Koster feat(place-order/WIP): Adds warning feat(place-order): Adds Mirny adds css changes from previous commit (i've forgotten) feat(place-order): Updates build feat(place-order): Set RJ45-DIO to occupy 2 EEMs feat(place-order): Make clocker progress bar visible It was hidden by horizontal scrollbar inside crate feat(place-order): Remove red warning for 2 kaslis following each other feat(place-order): Adds rule for cards that need a resource controller feat(place-order): Corrects typo, adds point to end of message feat(place-order): Changes idc-bnc info into a warning one feat(place-order): Moves down warning box feat(place-order): Updates some cosmetics css fix(place-order): Removes IDC-BNC from Kasli connectors count feat(place-order): Displays warning on hover warning icon feat(place-order): Updates design hover item in listing feat(place-order): Updates price estimate feat(place-order): Displays warning in summary feat(place-order): Allows to select item feat(place-order): Allows to send request quote through client email fix(place-order): Allows to click on remove inside summary list feat(place-order): Adds btn remove for each cards inside crate feat(place-order): Builds fix(place-order): Updates icon warning fix(place-order): Corrects recipient email address LOL, forgot to remove mine haha fix(place-order): Removes typo (kasli double) fix(place-order): Removes num from email title subject fix(place-order): Adds warning resources to mirny, zotino Also updates message text feat(place-order): Adds clocker counter feat(place-order): Uses warning for id68 instead of reminder feat(place-order): Adds crate type into the json feat(place-order): Adds btn order hardware in homepage refactor(place-order): Cleans a bit fix(place-order): Improves a bit ux remove item from crate fix(place-order): Improves a bit ux remove item from crate feat(place-order): Builds fix(place-order): Uses cursor pointer on remove button fix(place-order): Corrects card need a resources card chore(place-order): Removes call to ap.js fix(place-order): Tries with fixed height on warning icon fix(place-order): Adds fixed height to other element fix(place-order): Tries to remove up container height to let flex to its job fix(place-order): Removes .trim call which block multiline and augments row to 5 feat(place-order): Builds fix(place-order): Adds min-height for the crate
2019-10-02 12:16:07 +08:00
for(var u=h.reduce(function(a,b,c){return("kasli"===b.type||"kasli-backplane"===b.type||"clocker"===b.type)&&a.push(c),a},[]),v=0;v<=u.length-1;v++){var w=void 0,x=0,y=u[v];w=v==u.length-1?h.slice(y+1):h.slice(y+1,u[v+1]),x=w.reduce(function(a,b){return a+b.clockOccupied},0),y in j?j[y].nbrCurrentClock?j[y].nbrCurrentClock+=x:j[y].nbrCurrentClock=x:(j[y]=_objectSpread({},h[y]),j[y].nbrCurrentClock=x,j[y].warnings={}),x>h[y].nbrClockMax&&(k[h[y].rules.maxClock.type]=_objectSpread({},h[y].rules.maxClock),j[y].warnings.maxClockWarning=_objectSpread({},h[y].rules.maxClockWarning))}// check for number of recommanded EEM connectors
["novo","urukul","koster"].map(function(a){return h.find(function(b){return b.type===a})&&(k[c.state.items[a].rules.connectors.type]=_objectSpread({},c.state.items[a].rules.connectors)),a});for(var z=h.reduce(function(a,b,c){return"idc-bnc"===b.type&&a.push(c),a},[]),A=z.length-1;0<=A;A--){var B=z[A],C=!1;if(0==B)C=!0;else if(1<=B){var H=z[A]-1;"zotino"!==h[H].type&&"hd68"!==h[H].type&&"idc-bnc"!==h[H].type&&(C=!0)}C&&(j[B]=_objectSpread({},h[B]),j[B].warnings={},j[B].warnings.wrong=_objectSpread({},h[B].rules.wrong))}// check number of IDC-BNC adapters for a Zotino and HD68-IDC
for(var D=h.reduce(function(a,b,c){return("zotino"===b.type||"hd68"===b.type)&&a.push(c),a},[]),E=function(a){var b=void 0,c=0,d=D[a];b=a===D.length-1?h.slice(d+1):h.slice(d+1,D[a+1]);var e=!1;// check if HD68-IDC has at least 1 IDC-BNC adapter
if(c=b.reduce(function(a,b,c,d){return 0===c&&"idc-bnc"===b.type?a+1:"idc-bnc"===d[0].type&&0<c&&"idc-bnc"===d[c-1].type?("idc-bnc"!==b.type&&(e=!0),a+("idc-bnc"!==b.type||e?0:1)):a},0),(d in j)?(j[d].nbrCurrentSlot=c,!("warnings"in j[d])&&(j[d].warnings={})):(j[d]=_objectSpread({},h[d]),j[d].nbrCurrentSlot=c,j[d].warnings={}),0<c&&(k[h[d].rules.maxSlot.type]=_objectSpread({},h[d].rules.maxSlot)),c>h[d].nbrSlotMax&&(j[d].warnings.maxSlotWarning=_objectSpread({},h[d].rules.maxSlotWarning)),"hd68"===h[d].type){var f=!1;d<h.length-1?"idc-bnc"!==h[d+1].type&&(f=!0):d===h.length-1&&(f=!0),f&&((d in j)?j[d].warnings.minAdapter=_objectSpread({},h[d].rules.minAdapter):(j[d]=_objectSpread({},h[d]),j[d].warnings={},j[d].warnings.minAdapter=_objectSpread({},h[d].rules.minAdapter)))}},F=0;F<=D.length-1;F++)E(F);// update state with rules
2019-11-13 10:47:39 +08:00
this.setState(_objectSpread({},this.state,{columns:_objectSpread({},this.state.columns,{cart:_objectSpread({},this.state.columns.cart,{itemsData:_objectSpread({},j)})}),rules:_objectSpread({},k)}))}},{key:"render",value:function render(){var a=this.state,b=a.currency,c=a.currentItemHovered,d=a.currentMode,e=a.crateModeSlots,f=a.crateModeItems,g=a.items,h=a.columns,i=a.rules;return React.createElement(DragDropContext,{onDragEnd:this.handleOnDragEnd},React.createElement(Layout,{className:"shop",aside:React.createElement(Backlog,{currency:b,items:g,data:h.backlog,onClickAddItem:this.handleClickAddItem}),main:React.createElement(OrderPanel,{title:"Order hardware",description:" Drag and drop the cards you want into the crate below to see how the combination would look like. If you have any issues with this ordering system, or if you need other configurations, email us directly anytime at sales@m-****.hk. The price is estimated and must be confirmed by a quote.",crateMode:React.createElement(CrateMode,{items:f,mode:d,onClickMode:this.handleCrateModeChange}),crate:React.createElement(Crate,{cart:React.createElement(Cart,{nbrSlots:e[d],data:h.cart,itemHovered:c,onToggleProgress:this.handleToggleItemProgress,onToggleWarning:this.handleToggleItemWarning,onToggleOverlayRemove:this.handleToggleOverlayRemove,onClickRemoveItem:this.handleDeleteItem}),rules:Object.values(i).filter(function(a){return a})}),summaryPrice:React.createElement(OrderSumary,{currency:b,currentMode:d,modes:f,summary:h.cart.items,itemsData:h.cart.itemsData,onMouseEnterItem:this.handleMouseEnterItem,onMouseLeaveItem:this.handleMouseLeaveItem,onDeleteItem:this.handleDeleteItem,onDeleteAllItems:this.handleDeleteAllItems,onClickSelectItem:this.handleClickSelectItem}),form:React.createElement(OrderForm,{onClickSubmit:this.handleClickSubmit})})}))}}]),b}(React.PureComponent);/**
* Component that renders a product.
* Used in the aside (e.g backlog of product)
*/ReactDOM.render(React.createElement(Shop,{data:data}),document.querySelector("#root-shop"));