init
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://magezon.com/license/.
|
||||
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
|
||||
* If you wish to customize this module for your needs.
|
||||
* Please refer to https://www.magezon.com for more information.
|
||||
*
|
||||
* @category Magezon
|
||||
* @package Magezon_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head>
|
||||
<css src="Magezon_Core::css/swatches.css"/>
|
||||
<css src="Magezon_Core::css/magnific-popup.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<referenceBlock name="header.links">
|
||||
<block class="Magezon\QuickOrder\Block\Link" name="quickorder.top.link" ifconfig="quickorder/general/enabled"/>
|
||||
</referenceBlock>
|
||||
</body>
|
||||
</page>
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://magezon.com/license/.
|
||||
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
|
||||
* If you wish to customize this module for your needs.
|
||||
* Please refer to https://www.magezon.com for more information.
|
||||
*
|
||||
* @category Magezon
|
||||
* @package Magezon_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<block class="Magezon\QuickOrder\Block\Form" name="quickorder_form"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://magezon.com/license/.
|
||||
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
|
||||
* If you wish to customize this module for your needs.
|
||||
* Please refer to https://www.magezon.com for more information.
|
||||
*
|
||||
* @category Magezon
|
||||
* @package Magezon_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<page layout="empty" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<block class="Magezon\QuickOrder\Block\Product" name="ajax.product.info" template="Magezon_QuickOrder::product.phtml"/>
|
||||
<move element="product.info.main" destination="ajax.product.info" as="product_info_main"/>
|
||||
<referenceContainer name="product.info.social" remove="true"/>
|
||||
<referenceBlock name="product.info.review" remove="true"/>
|
||||
<referenceBlock name="product.info.overview" remove="true"/>
|
||||
<referenceBlock name="product.info.addtocart.instantPurchase" remove="true"/>
|
||||
<referenceBlock name="product.info.addtocart.instantPurchase.additional" remove="true"/>
|
||||
<referenceBlock name="product.info.addtocart" remove="true"/>
|
||||
<referenceBlock name="product.info.addtocart.additional" remove="true"/>
|
||||
<block class="Magento\Framework\View\Element\Template" name="ajax.product.bottom"/>
|
||||
</body>
|
||||
</page>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://magezon.com/license/.
|
||||
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
|
||||
* If you wish to customize this module for your needs.
|
||||
* Please refer to https://www.magezon.com for more information.
|
||||
*
|
||||
* @category Magezon
|
||||
* @package Magezon_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceBlock name="product.info.bundle.options.top" remove="true"/>
|
||||
<referenceBlock name="customize.button" remove="true"/>
|
||||
<move element="bundle.options.container" destination="ajax.product.bottom" before="-" />
|
||||
<referenceBlock name="product.info.addtocart.bundle" remove="true"/>
|
||||
</body>
|
||||
</page>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://magezon.com/license/.
|
||||
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
|
||||
* If you wish to customize this module for your needs.
|
||||
* Please refer to https://www.magezon.com for more information.
|
||||
*
|
||||
* @category Magezon
|
||||
* @package Magezon_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://magezon.com)
|
||||
*/
|
||||
-->
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceBlock name="product.info.downloadable.samples" remove="true"/>
|
||||
<move element="product.info" destination="product.info.main" after="alert.urls"/>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,9 @@
|
||||
var config = {
|
||||
config: {
|
||||
mixins: {
|
||||
'Magento_Swatches/js/swatch-renderer': {
|
||||
'Magezon_QuickOrder/js/swatch-renderer': true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
$coreHelper = $this->helper('\Magezon\Core\Helper\Data');
|
||||
$dataHelper = $this->helper('\Magezon\QuickOrder\Helper\Data');
|
||||
$enableMultiskus = $dataHelper->getConfig('general/enable_multiskus');
|
||||
$enableUpload = $dataHelper->getConfig('general/enable_upload');
|
||||
$headBackgroundColor = $dataHelper->getConfig('general/head_background_color');
|
||||
$headColor = $dataHelper->getConfig('general/head_color');
|
||||
$btnColor = $dataHelper->getConfig('general/button_color');
|
||||
$spinnerColor = $dataHelper->getConfig('general/spinner_color');
|
||||
$linkColor = $dataHelper->getConfig('general/link_color');
|
||||
$minLength = $dataHelper->getConfig('search/min_length');
|
||||
$searchImage = $dataHelper->getConfig('search/show_image');
|
||||
$searchSku = $dataHelper->getConfig('search/show_sku');
|
||||
$searchPrice = $dataHelper->getConfig('search/show_price');
|
||||
$storageKey = $block->hasData('storageKey') ? $block->getData('storageKey') : 'quickorderItems';
|
||||
$loadProductsUrl = $block->hasData('loadProductsUrl') ? $block->getData('loadProductsUrl') : $block->getUrl('quickorder/index/loadproducts');
|
||||
$loadProductsUrl = $block->hasData('loadProductsUrl') ? $block->getData('loadProductsUrl') : $block->getUrl('quickorder/index/loadproducts');
|
||||
$loadItemInfoUrl = $block->hasData('loadItemInfoUrl') ? $block->getData('loadItemInfoUrl') : $block->getUrl('quickorder/index/item');
|
||||
$actionUrl = $block->hasData('actionUrl') ? $block->getUrl($block->getData('actionUrl')) : $block->getUrl('quickorder/index/addtocart');
|
||||
$showImage = $block->hasData('showImage') ? $block->getData('showImage') : true;
|
||||
$showPrice = $block->hasData('showPrice') ? $block->getData('showPrice') : true;
|
||||
$showQty = $block->hasData('showQty') ? $block->getData('showQty') : true;
|
||||
$showSubTotal = $block->hasData('showSubTotal') ? $block->getData('showSubTotal') : true;
|
||||
$showAction = $block->hasData('showAction') ? $block->getData('showAction') : true;
|
||||
$showGrandTotal = $block->hasData('showGrandTotal') ? $block->getData('showGrandTotal') : true;
|
||||
$showSku = $block->hasData('showSku') ? $block->getData('showSku') : true;
|
||||
$showEmptyBtn = $block->hasData('showEmptyBtn') ? $block->getData('showEmptyBtn') : true;
|
||||
$showQty = $block->hasData('showQty') ? $block->getData('showQty') : true;
|
||||
$submitBtnLabel = $block->hasData('submitBtnLabel') ? $block->getData('submitBtnLabel') : __('Add to Cart');
|
||||
$mode = $block->hasData('mode') ? $block->getData('mode') : 'quickorder';
|
||||
|
||||
/* @var $block \Magezon\QuickOrder\Block\Form */
|
||||
?>
|
||||
<div class="quickorder-form" data-bind="scope: 'quickorder'">
|
||||
<!-- ko template: getTemplate() --><!-- /ko -->
|
||||
</div>
|
||||
<div id="quickorder-popup" class="white-popup mfp-with-anim mfp-hide" data-effect="mfp-zoom-in">
|
||||
<div class="quickorder-popup-wrapper">
|
||||
<div class="quickorder-popup-content"></div>
|
||||
</div>
|
||||
<div class="quickorder-popup-loader">
|
||||
<div class="quickorder-popup-loader-bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
<?php if ($spinnerColor) { ?>
|
||||
#quickorder-popup .quickorder-popup-loader .quickorder-popup-loader-bar {
|
||||
background: <?= $spinnerColor ?>;
|
||||
}
|
||||
.quickorder-spinner i {
|
||||
border-color: <?= $spinnerColor ?>;
|
||||
border-top-color: transparent;
|
||||
}
|
||||
<?php } ?>
|
||||
<?php if ($headBackgroundColor) { ?>
|
||||
.mgz-quickorder thead tr th.col {
|
||||
background: <?= $headBackgroundColor ?>;
|
||||
}
|
||||
<?php } ?>
|
||||
<?php if ($headColor) { ?>
|
||||
.mgz-quickorder thead tr th.col {
|
||||
color: <?= $headColor ?>;
|
||||
}
|
||||
<?php } ?>
|
||||
<?php if ($btnColor) { ?>
|
||||
#quickorder-popup .action.action-select:hover {
|
||||
opacity: .8;
|
||||
}
|
||||
#quickorder-popup .action.action-select,
|
||||
.mgz-quickorder .quickorder-btn {
|
||||
background: <?= $btnColor ?>;
|
||||
border-color: <?= $btnColor ?>;
|
||||
}
|
||||
<?php } ?>
|
||||
<?php if ($linkColor) { ?>
|
||||
#quickorder-popup .action-cancel,
|
||||
.mgz-quickorder a {
|
||||
color: <?= $linkColor ?>;
|
||||
}
|
||||
<?php } ?>
|
||||
</style>
|
||||
<script type="text/x-magento-init">
|
||||
{
|
||||
"*": {
|
||||
"Magento_Ui/js/core/app": {
|
||||
"components": {
|
||||
"quickorder": {
|
||||
"component": "Magezon_QuickOrder/js/editor",
|
||||
"storageKey": "<?= $storageKey ?>",
|
||||
"enableMultiskus": <?= $enableMultiskus ? 'true' : 'false' ?>,
|
||||
"enableUpload": <?= $enableUpload ? 'true' : 'false' ?>,
|
||||
"ajaxUrl": "<?= $loadProductsUrl ?>",
|
||||
"loadChildrensUrl": "<?= $block->getUrl('quickorder/index/loadChildrens') ?>",
|
||||
"excelUploadUrl": "<?= $block->getUrl('quickorder/index/batchimport') ?>",
|
||||
"formKey": "<?= $block->getFormKey() ?>",
|
||||
"priceFormat": <?= $coreHelper->serialize($block->getPriceFormat()) ?>,
|
||||
"loadItemInfoUrl": "<?= $loadItemInfoUrl ?>",
|
||||
"minLength": "<?= $minLength ? $minLength : 0 ?>",
|
||||
"actionUrl": "<?= $actionUrl ?>",
|
||||
"showImage": <?= $showImage ? 'true' : 'false' ?>,
|
||||
"showPrice": <?= $showPrice ? 'true' : 'false' ?>,
|
||||
"showQty": <?= $showQty ? 'true' : 'false' ?>,
|
||||
"showSubTotal": <?= $showSubTotal ? 'true' : 'false' ?>,
|
||||
"showAction": <?= $showAction ? 'true' : 'false' ?>,
|
||||
"showGrandTotal": <?= $showGrandTotal ? 'true' : 'false' ?>,
|
||||
"showSku": <?= $showSku ? 'true' : 'false' ?>,
|
||||
"showEmptyBtn": <?= $showEmptyBtn ? 'true' : 'false' ?>,
|
||||
"instantSearch": false,
|
||||
"search": {
|
||||
"showImage": <?= $searchImage ? 'true' : 'false' ?>,
|
||||
"showSku": <?= $searchSku ? 'true' : 'false' ?>,
|
||||
"showPrice": <?= $searchPrice ? 'true' : 'false' ?>
|
||||
},
|
||||
"submitBtnLabel": "<?= $submitBtnLabel ?>",
|
||||
"mode": "<?= $mode ?>",
|
||||
"downloadSampleLink": "<?= $block->getViewFileUrl('Magezon_QuickOrder/css/quickorder_import.xlsx') ?>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
$imageHelper = $this->helper('\Magezon\Core\Helper\Image');
|
||||
$product = $block->getProduct();
|
||||
$bottomHtml = $block->getLayout()->getBlock('ajax.product.bottom')->getChildHtml();
|
||||
?>
|
||||
<div class="ajaxcart-content">
|
||||
<div class="ajaxcart-content_left">
|
||||
<?= $block->getImage($product, 'quickorder_popup_image')->toHtml() ?>
|
||||
</div>
|
||||
<div class="ajaxcart-content_right">
|
||||
<?= $block->getChildHtml('product_info_main') ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($bottomHtml) { ?>
|
||||
<div class="ajaxcart-bottom"><?= $bottomHtml ?></div>
|
||||
<?php } ?>
|
||||
<div class="ajaxcart-footer">
|
||||
<a href="#" class="action-cancel"><?= __('Cancel') ?></a>
|
||||
<button class="action primary action-select"><?= __('Select') ?></button>
|
||||
</div>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$helper = $this->helper('\Magento\Catalog\Helper\Product\Configuration');
|
||||
?>
|
||||
<?php if ($_options = $block->getOptionList()):?>
|
||||
<dl class="item-options">
|
||||
<?php foreach ($_options as $_option) : ?>
|
||||
<?php $_formatedOptionValue = $helper->getFormattedOptionValue($_option) ?>
|
||||
<dt><?= $block->escapeHtml($_option['label']) ?></dt>
|
||||
<dd>
|
||||
<?php if (isset($_formatedOptionValue['full_view'])): ?>
|
||||
<?= $_formatedOptionValue['full_view'] ?>
|
||||
<?php else: ?>
|
||||
<?= $_formatedOptionValue['value'] ?>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<?php endforeach; ?>
|
||||
</dl>
|
||||
<?php endif;?>
|
||||
@@ -0,0 +1 @@
|
||||
Sku,Qty,Product Name,Lab ID,CD No.,Quote No.,Discount,Item Remark,Order Remark
|
||||
|
Binary file not shown.
@@ -0,0 +1,682 @@
|
||||
@quickorder-color: #ff9900;
|
||||
|
||||
@keyframes qoloader{
|
||||
0% {
|
||||
background-position:0 0
|
||||
} to {
|
||||
background-position:50px 50px
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes qospin {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.quickorder-loading {
|
||||
width: 500px;
|
||||
height: 200px;
|
||||
|
||||
.quickorder-popup-wrapper {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.quickorder-spinner {
|
||||
display: inline-block;
|
||||
|
||||
i {
|
||||
width: 1.3rem;
|
||||
height: 1.3rem;
|
||||
display: block;
|
||||
border: 3px solid @quickorder-color;
|
||||
border-top-color: transparent;
|
||||
border-radius: 50%;
|
||||
animation: qospin 1.1s infinite linear;
|
||||
margin-top: 7px;
|
||||
|
||||
span {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mgz-quickorder {
|
||||
|
||||
.quickquote-message-success {
|
||||
font-weight: 600;
|
||||
color: green;
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.quickquote-message-error {
|
||||
font-weight: 600;
|
||||
color: #e22626;
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
thead {
|
||||
tr {
|
||||
th.col {
|
||||
background: @quickorder-color;
|
||||
padding: 10px;
|
||||
color: #FFF;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.col {
|
||||
&.qty,
|
||||
&.price,
|
||||
&.subtotal {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
&.search {
|
||||
width: 225px;
|
||||
}
|
||||
|
||||
&.action {
|
||||
text-align: center;
|
||||
|
||||
a {
|
||||
padding: 0px 7px 2px 7px;
|
||||
|
||||
&.action-duplicate {
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.product-item-sku {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.product-item-photo {
|
||||
display: table-cell;
|
||||
max-width: 100%;
|
||||
padding-right: 20px;
|
||||
position: static;
|
||||
vertical-align: top;
|
||||
width: 1%;
|
||||
|
||||
.product-image-container {
|
||||
width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.product-item-details {
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
white-space: normal;
|
||||
width: 99%;
|
||||
}
|
||||
|
||||
.product-item-name {
|
||||
font-size: 1.8rem;
|
||||
display: block;
|
||||
margin: -3px 0 5px;
|
||||
}
|
||||
|
||||
.item-options {
|
||||
margin: 0;
|
||||
|
||||
dd, dt {
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
dt {
|
||||
clear: left;
|
||||
float: left;
|
||||
margin: 0 10px 0 0;
|
||||
|
||||
&:after {
|
||||
content: ': ';
|
||||
}
|
||||
}
|
||||
|
||||
dd:last-child {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.col.price .price,
|
||||
.col.subtotal .price {
|
||||
font-weight: 700;
|
||||
font-size: 1.8rem;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.col.qty .input-text {
|
||||
height: 36px;
|
||||
margin-top: -7px;
|
||||
text-align: center;
|
||||
width: 55px;
|
||||
}
|
||||
|
||||
.item-options-wrapper {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
tbody .col {
|
||||
padding: 20px 8px 20px 0;
|
||||
background: #FFF;
|
||||
}
|
||||
|
||||
.product-image-wrapper {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.mgz-quickorder-action {
|
||||
margin-top: 15px;
|
||||
padding: 20px 15px;
|
||||
background: #F5F5F5;
|
||||
overflow: hidden;
|
||||
|
||||
.quickorder-btn {
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.quickorder-btn {
|
||||
background: @quickorder-color;
|
||||
color: #FFF;
|
||||
border: 0;
|
||||
font-size: 1.4rem;
|
||||
font-weight: 400;
|
||||
padding: 10px 15px;
|
||||
height: auto;
|
||||
|
||||
&:hover {
|
||||
opacity: .8;
|
||||
}
|
||||
}
|
||||
|
||||
.quickorder-grand-total {
|
||||
font-size: 1.4em;
|
||||
float: right;
|
||||
|
||||
span:last-child {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.mgz-quickorder-search {
|
||||
position: relative;
|
||||
|
||||
.quickorder-spinner {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 5px;
|
||||
|
||||
i {
|
||||
width: 1.3rem;
|
||||
height: 1.3rem
|
||||
}
|
||||
}
|
||||
|
||||
.mgz-quickorder-ui-wrapper {
|
||||
box-shadow: 0 0 4px rgba(0,0,0,.14), 0 4px 8px rgba(0,0,0,.28);
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
background: #ffffff;
|
||||
|
||||
.ui-autocomplete {
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
border: 1px solid #c2c2c2;
|
||||
border-top: 0;
|
||||
float: left;
|
||||
max-height: 500px;
|
||||
overflow: scroll;
|
||||
margin: 0;
|
||||
width: 300px !important;
|
||||
|
||||
li {
|
||||
cursor: pointer;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
white-space: normal;
|
||||
float: left;
|
||||
width: 100%;
|
||||
|
||||
&.selected,
|
||||
&:hover {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
|
||||
.ui-state-active,
|
||||
.ui-widget-content .ui-state-active,
|
||||
.ui-widget-header .ui-state-active,
|
||||
a.ui-button:active,
|
||||
.ui-button:active,
|
||||
.ui-button.ui-state-active:hover {
|
||||
background: #F0F0F0;
|
||||
}
|
||||
|
||||
.mgz-quickorder-item_left {
|
||||
float: left;
|
||||
margin-right: 15px;
|
||||
max-width: 50px;
|
||||
}
|
||||
|
||||
.mgz-quickorder-item_right {
|
||||
.mgz-quickorder-item_title {
|
||||
font-size: 1.6rem;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.mgz-quickorder-item {
|
||||
display: flex;
|
||||
padding: 5px 10px 5px 10px;
|
||||
}
|
||||
|
||||
|
||||
img {
|
||||
.sidebar & {
|
||||
max-width: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.quickorder-action-edit {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.mgz-quicorder-multiskus, .mgz-quicorder-file {
|
||||
margin-top: 30px;
|
||||
|
||||
input[type=number] {
|
||||
width: 55px;
|
||||
}
|
||||
.fieldset > .field:not(.choice) > .label{
|
||||
float: none;
|
||||
display: block;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
.fieldset > .field:not(.choice) > .control{
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.mgz-quicorder-file {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.file-uploader-button {
|
||||
padding: 0.6rem 1em 0.6rem;
|
||||
background: #e3e3e3;
|
||||
border: 1px solid #adadad;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
|
||||
&:hover {
|
||||
opacity: .8;
|
||||
}
|
||||
}
|
||||
|
||||
#quickorder-file {
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
width: 0;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
#quickorder-popup {
|
||||
position: relative;
|
||||
margin: 0 auto;
|
||||
background: #fff;
|
||||
overflow-x: scroll;
|
||||
border-radius: 2px;
|
||||
max-width: 640px;
|
||||
padding: 30px;
|
||||
min-height: 250px;
|
||||
|
||||
.quickorder-popup-loader {
|
||||
display: none;
|
||||
-webkit-align-items: center;
|
||||
-ms-align-items: center;
|
||||
align-items: center;
|
||||
height: 260px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
left: 0;
|
||||
|
||||
.quickorder-popup-loader-bar {
|
||||
margin: auto;
|
||||
max-width: 300px;
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
border-radius: 10px;
|
||||
box-shadow: inset 0 2px 9px rgba(255,255,255,0.3), inset 0 -2px 6px rgba(0,0,0,0.4);
|
||||
background: #ff9900;
|
||||
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-image: -webkit-linear-gradient(135deg, rgba(255,255,255,0.2) 25%, transparent 0, transparent 50%, rgba(255,255,255,0.2) 0, rgba(255,255,255,0.2) 75%, transparent 0, transparent);
|
||||
background-image: linear-gradient(-45deg, rgba(255,255,255,0.2) 25%, transparent 0, transparent 50%, rgba(255,255,255,0.2) 0, rgba(255,255,255,0.2) 75%, transparent 0, transparent);
|
||||
background-size: 50px 50px;
|
||||
content: "";
|
||||
-webkit-animation: qoloader 2s linear infinite;
|
||||
animation: qoloader 2s linear infinite;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.quickorder-loading {
|
||||
.quickorder-popup-loader {
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 32px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.ajaxcart-content {
|
||||
width: 100%;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
|
||||
.ajaxcart-content_left {
|
||||
float: left;
|
||||
width: 260px;
|
||||
-webkit-box-flex: 0;
|
||||
-webkit-flex: 0 0 auto;
|
||||
-ms-flex: 0 0 auto;
|
||||
flex: 0 0 auto;
|
||||
margin-right: 20px;
|
||||
|
||||
.ajaxcart-product_image {
|
||||
text-align: center;
|
||||
|
||||
.product.media {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.ajaxcart-product_review {
|
||||
text-align: center;
|
||||
|
||||
.product-reviews-summary {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ajaxcart-content_right {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1 1 auto;
|
||||
-ms-flex: 1 1 auto;
|
||||
flex: 1 1 auto;
|
||||
-webkit-align-self: center;
|
||||
-ms-flex-item-align: center;
|
||||
align-self: center;
|
||||
|
||||
.page-title-wrapper{
|
||||
margin-top: 0;
|
||||
}
|
||||
.ajaxcart-cart-info {
|
||||
text-align: center;
|
||||
|
||||
.ajaxcart-cart-subtotal {
|
||||
font-size: 18px;
|
||||
|
||||
.price {
|
||||
display: block;
|
||||
width: 100%;
|
||||
font-size: 28px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.box-tocart .action.tocart {
|
||||
margin-top: 20px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.product-info-price .price-box {
|
||||
width: auto;
|
||||
|
||||
.price-container .price {
|
||||
font-size: 24px;
|
||||
line-height: 24px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.ajaxcart-content_right {
|
||||
.ajaxcart-product_title {
|
||||
margin-top: 0;
|
||||
font-size: 3rem;
|
||||
}
|
||||
|
||||
.product-info-main {
|
||||
width: 100%;
|
||||
|
||||
.product-add-form {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.product-options-bottom .box-tocart {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.product-info-price {
|
||||
border-bottom-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.field.qty {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
div:focus {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.product-info-price .price-box .old-price .price-container {
|
||||
.price-label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.price {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ajaxcart-bottom {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.ajaxcart-footer {
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
margin-top: 30px;
|
||||
|
||||
.action-cancel {
|
||||
width: 260px;
|
||||
-webkit-box-flex: 0;
|
||||
-webkit-flex: 0 0 auto;
|
||||
-ms-flex: 0 0 auto;
|
||||
flex: 0 0 auto;
|
||||
margin-right: 20px;
|
||||
font-size: 18px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.action {
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
padding: 0;
|
||||
width: 50%;
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
|
||||
&.action-select {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1 1 auto;
|
||||
-ms-flex: 1 1 auto;
|
||||
flex: 1 1 auto;
|
||||
-webkit-align-self: center;
|
||||
-ms-flex-item-align: center;
|
||||
align-self: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bundle-options-container {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
|
||||
.product-options-wrapper {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.block-bundle-summary .box-tocart .checkout-btn {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.legend.title {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.block-bundle-summary {
|
||||
margin-top: 0;
|
||||
|
||||
> .title {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.product-add-form {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Mobile
|
||||
// _____________________________________________
|
||||
|
||||
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
|
||||
.mgz-quickorder {
|
||||
thead {
|
||||
display: none;
|
||||
}
|
||||
|
||||
tbody {
|
||||
.col {
|
||||
display: block;
|
||||
|
||||
&.search,
|
||||
&.item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&.col.price,
|
||||
&.col.qty,
|
||||
&.col.subtotal {
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
float: left;
|
||||
white-space: nowrap;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
&.col.action {
|
||||
float: left;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
tr {
|
||||
border-top: 1px solid #cccccc;
|
||||
}
|
||||
}
|
||||
|
||||
.col.action a {
|
||||
padding: 4px 10px 4px 10px;
|
||||
}
|
||||
|
||||
.mgz-quickorder-action button {
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
#quickorder-popup {
|
||||
.ajaxcart-content_left {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ajaxcart-footer {
|
||||
display: block;
|
||||
|
||||
.action-cancel,
|
||||
.action-select {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
&.quickorder-loading {
|
||||
padding: 0;
|
||||
min-height: 250px;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
+560
@@ -0,0 +1,560 @@
|
||||
define([
|
||||
'jquery',
|
||||
'ko',
|
||||
'underscore',
|
||||
'uiComponent',
|
||||
'Magezon_QuickOrder/js/model/item',
|
||||
'Magento_Catalog/js/price-utils',
|
||||
'mage/translate',
|
||||
'Magento_Ui/js/modal/confirm',
|
||||
'Magento_Ui/js/modal/alert',
|
||||
'mage/url',
|
||||
'Magento_Catalog/product/view/validation',
|
||||
'Magezon_QuickOrder/js/knockout.files',
|
||||
'Magezon_Core/js/jquery.magnific-popup.min'
|
||||
], function ($, ko, _, Component, Item, priceUtils, $t, confirm, malert, url) {
|
||||
'use strict';
|
||||
|
||||
return Component.extend({
|
||||
|
||||
defaults: {
|
||||
items: [],
|
||||
mode: 'quickorder',
|
||||
template: 'Magezon_QuickOrder/editor',
|
||||
popupSelector: '#quickorder-popup',
|
||||
popupMainClass: 'quickorder-popup',
|
||||
enableMultiskus: true,
|
||||
enableUpload: true,
|
||||
showImage: true,
|
||||
showPrice: true,
|
||||
showQty: true,
|
||||
showSubTotal: true,
|
||||
showAction: true,
|
||||
showGrandTotal: true,
|
||||
showSku: true,
|
||||
searchPlaceholder: $t('Enter SKU or Product Name'),
|
||||
addBtnLabel: $t('Add Line'),
|
||||
submitBtnLabel: $t('Add to Cart'),
|
||||
grandTotalLabel: $t('Total value:'),
|
||||
emptyBtnLabel: $t('Empty List'),
|
||||
showEmptyBtn: true,
|
||||
confirmMessage: $t('Are you sure you would like to empty this list?'),
|
||||
multiSkusLabel: $t('Enter Multiple SKUs'),
|
||||
multiSkusDescription: $t('Use commas or paragraph to seperate SKUs.'),
|
||||
addToListBtnLabel: $t('Add to List'),
|
||||
fileRule: $t('File must be in .csv format and include \"SKU\" and \"QTY\" columns'),
|
||||
fileSuccessMessage: $t('File was imported sucessfully'),
|
||||
fileLoading: false,
|
||||
submitLoading: false,
|
||||
loadingproduct: false,
|
||||
storageKey: 'quickorderItems',
|
||||
instantSearch: true,
|
||||
qty: 1,
|
||||
|
||||
listens: {
|
||||
loadingproduct: 'loadingProductSpinner'
|
||||
}
|
||||
},
|
||||
|
||||
cache: [],
|
||||
|
||||
initialize: function () {
|
||||
this._super();
|
||||
|
||||
_.bindAll(this,
|
||||
'removeItem',
|
||||
'duplicateItem',
|
||||
'openPopup',
|
||||
'onLoadedFile',
|
||||
'onProgressFile',
|
||||
'onErrorFile'
|
||||
);
|
||||
|
||||
var self = this;
|
||||
|
||||
if (this.instantSearch) {
|
||||
self.loadProducts();
|
||||
}
|
||||
|
||||
$(self.popupSelector).on('click', '.action-cancel', function(e) {
|
||||
e.preventDefault();
|
||||
$.magnificPopup.close();
|
||||
});
|
||||
|
||||
$(self.popupSelector).on('click', '.action-select', function(e) {
|
||||
e.preventDefault();
|
||||
if (self.currentItem) {
|
||||
var form = $('#product_addtocart_form');
|
||||
if(form.valid()) {
|
||||
var data = form.serialize();
|
||||
var startDate = $(self.popupSelector).find('#zonrentals-from').val();
|
||||
var endDate = $(self.popupSelector).find('#zonrentals-to').val();
|
||||
if (startDate && endDate) {
|
||||
data += '&rental=1';
|
||||
}
|
||||
|
||||
self.currentItem.options(data);
|
||||
self.loadItemInfo(self.currentItem);
|
||||
$.magnificPopup.close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
self.grandTotal = ko.pureComputed(function() {
|
||||
var total = 0;
|
||||
$.each(self.items(), function() {
|
||||
total += this.subtotal();
|
||||
});
|
||||
self.saveItemsToLocalStorage();
|
||||
return total;
|
||||
});
|
||||
|
||||
_.each(this.getItemsFromLocalStorage(), function(item) {
|
||||
this.addItem(item);
|
||||
}, this);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
initObservable: function () {
|
||||
this._super()
|
||||
.observe('grandTotal skus qty fileLoading submitLoading fileMessage loadingproduct')
|
||||
.observe({
|
||||
items: [],
|
||||
products: []
|
||||
});
|
||||
return this;
|
||||
},
|
||||
|
||||
submitItems: function (elem, event) {
|
||||
this.submitLoading(true);
|
||||
var items = [];
|
||||
_.each(this.items(), function(item) {
|
||||
if (item.isValid()) {
|
||||
var row = {
|
||||
product: item.product().value,
|
||||
options: item.options(),
|
||||
qty: item.qty(),
|
||||
others: item.others(),
|
||||
quote_type: item.quoteType(),
|
||||
name: item.product().name
|
||||
}
|
||||
items.push(row);
|
||||
}
|
||||
});
|
||||
if (items.length) {
|
||||
var self = this;
|
||||
$.ajax({
|
||||
url: self.actionUrl,
|
||||
data: {items: items, mode: self.mode},
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.message) {
|
||||
alert(res.message);
|
||||
}
|
||||
if (res.status) {
|
||||
self.clearLocalStorage();
|
||||
}
|
||||
if (res.redirectUrl) {
|
||||
window.location.href = res.redirectUrl;
|
||||
}
|
||||
self.submitLoading(false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.submitLoading(false);
|
||||
}
|
||||
},
|
||||
|
||||
loadChildrenIds: function(product) {
|
||||
var self = this;
|
||||
self.spinnerloading(true);
|
||||
$.ajax({
|
||||
url: self.loadChildrensUrl,
|
||||
data: { id: product.value, type: product.type },
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.status) {
|
||||
_.each(res.childrens, function(product) {
|
||||
var item = _.findWhere(self.products(), {id: product.id});
|
||||
if (!item) {
|
||||
self.products().push(product);
|
||||
}
|
||||
self.addItem({
|
||||
price: product.price,
|
||||
qty: 1,
|
||||
product: product
|
||||
});
|
||||
});
|
||||
self.spinnerloading(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
addChildrens: function(product, item) {
|
||||
item.spinnerloading(true);
|
||||
var self = this;
|
||||
if (!product.hasOwnProperty('childrens')) {
|
||||
$.ajax({
|
||||
url: self.loadChildrensUrl,
|
||||
data: { id: product.value, type: product.type },
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.status) {
|
||||
_.each(res.childrens, function(product) {
|
||||
var item = _.findWhere(self.products(), {id: product.id});
|
||||
if (!item) {
|
||||
self.products().push(product);
|
||||
}
|
||||
self.addItem({
|
||||
price: product.price,
|
||||
qty: 1,
|
||||
product: product
|
||||
});
|
||||
});
|
||||
product.childrens = res.childrens;
|
||||
self.removeItem(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
_.each(product.childrens, function(product) {
|
||||
var item = _.findWhere(self.products(), {id: product.id});
|
||||
if (!item) {
|
||||
self.products().push(product);
|
||||
}
|
||||
self.addItem({
|
||||
price: product.price,
|
||||
qty: 1,
|
||||
product: product
|
||||
});
|
||||
});
|
||||
self.removeItem(item);
|
||||
}
|
||||
},
|
||||
|
||||
addItem: function (data) {
|
||||
if (data.qty==0) {
|
||||
return;
|
||||
}
|
||||
if (!data) {
|
||||
data = {};
|
||||
}
|
||||
data = ko.toJS(data);
|
||||
data['parent'] = this;
|
||||
var item = new Item(data);
|
||||
this.items.push(item);
|
||||
},
|
||||
|
||||
removeItem: function (item) {
|
||||
this.items.remove(item);
|
||||
},
|
||||
|
||||
duplicateItem: function (item) {
|
||||
var data = item.getData();
|
||||
data['parent'] = this;
|
||||
this.items.push(new Item(data));
|
||||
},
|
||||
|
||||
loadProducts: function() {
|
||||
if (!this.productLoaded) {
|
||||
var self = this;
|
||||
self.loadingproduct(true);
|
||||
$.ajax({
|
||||
url: self.ajaxUrl,
|
||||
data: {mode: self.mode},
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.message) alert(res.message);
|
||||
self.products(res.products);
|
||||
self.loadingproduct(false);
|
||||
}
|
||||
});
|
||||
self.productLoaded = true;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* FormatPrice
|
||||
*/
|
||||
getFormattedPrice: function (price) {
|
||||
return priceUtils.formatPrice(price, this.priceFormat);
|
||||
},
|
||||
|
||||
openPopup: function(item) {
|
||||
var self = this;
|
||||
|
||||
if (!this.cache[item.product().value]) {
|
||||
$.ajax({
|
||||
url: item.product().url + '?options=cart',
|
||||
data: {product: item.product().value, mgz_qo: 1,mode: self.mode},
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
beforeSend: function () {
|
||||
$(self.popupSelector + ' .quickorder-popup-content').html('');
|
||||
$(self.popupSelector).addClass('quickorder-loading');
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.message) alert(res.message);
|
||||
if (res.html) {
|
||||
$(self.popupSelector + ' .quickorder-popup-content').html(res.html);
|
||||
$(self.popupSelector + ' .quickorder-popup-content').trigger('contentUpdated');
|
||||
$(self.popupSelector + ' #product_addtocart_form').validation();
|
||||
$(self.popupSelector).removeClass('quickorder-loading');
|
||||
setTimeout(function() {
|
||||
self.editOptions(item.options());
|
||||
}, 200);
|
||||
self.cache[item.product().value] = res.html;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var html = self.cache[item.product().value];
|
||||
$(self.popupSelector).addClass('quickorder-loading');
|
||||
$(self.popupSelector + ' .quickorder-popup-content').html(html);
|
||||
$(self.popupSelector + ' .quickorder-popup-content').trigger('contentUpdated');
|
||||
$(self.popupSelector + ' #product_addtocart_form').validation();
|
||||
setTimeout(function() {
|
||||
self.editOptions(item.options());
|
||||
setTimeout(function() {
|
||||
$(self.popupSelector).removeClass('quickorder-loading');
|
||||
}, 300);
|
||||
}, 200);
|
||||
}
|
||||
|
||||
$.magnificPopup.open({
|
||||
items: {
|
||||
src: self.popupSelector
|
||||
},
|
||||
type: 'inline',
|
||||
removalDelay: 300,
|
||||
mainClass: self.popupMainClass,
|
||||
fixedContentPos: true,
|
||||
fixedBgPos: true,
|
||||
overflowY: 'auto',
|
||||
showCloseBtn: false,
|
||||
callbacks: {
|
||||
beforeOpen: function() {
|
||||
$('body').addClass('quickorder-popup');
|
||||
this.st.mainClass = $(self.popupSelector).attr('data-effect');
|
||||
},
|
||||
beforeClose: function() {
|
||||
this.st.mainClass = '';
|
||||
$(self.popupSelector).css('transition', '');
|
||||
$('body').removeClass('quickorder-popup');
|
||||
self.currentItem.checkValid();
|
||||
}
|
||||
},
|
||||
}, 0);
|
||||
this.currentItem = item;
|
||||
},
|
||||
|
||||
loadItemInfo: function(item) {
|
||||
var self = this;
|
||||
$.ajax({
|
||||
url: this.loadItemInfoUrl,
|
||||
data: {product: item.product().value, type: item.product().type, options: item.options(),mode: self.mode},
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.message) alert(res.message);
|
||||
if (res.status) {
|
||||
item.optionsHtml(res.options);
|
||||
item.price(res.price);
|
||||
} else {
|
||||
self.removeItem(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
parseParams: function(str) {
|
||||
var re = /([^&=]+)=?([^&]*)/g;
|
||||
var decodeRE = /\+/g;
|
||||
var decode = function (str) {return decodeURIComponent( str.replace(decodeRE, " ") );};
|
||||
var params = {}, e;
|
||||
while ( e = re.exec(str) ) {
|
||||
var k = decode( e[1] ), v = decode( e[2] );
|
||||
if (k.substring(k.length - 2) === '[]') {
|
||||
k = k.substring(0, k.length - 2);
|
||||
(params[k] || (params[k] = [])).push(v);
|
||||
}
|
||||
else params[k] = v;
|
||||
}
|
||||
return params;
|
||||
},
|
||||
|
||||
editOptions: function(options) {
|
||||
var self = this;
|
||||
var newOptions = self.parseParams(options);
|
||||
$(self.popupSelector).find('input, select, textarea').each(function(index, el) {
|
||||
var name = $(this).attr('name');
|
||||
if (newOptions[name]) {
|
||||
$(this).val(newOptions[name]);
|
||||
$(this).trigger('change');
|
||||
if ($(this).hasClass('swatch-input')) {
|
||||
var parent = $(this).parents('.swatch-attribute');
|
||||
parent.find('.swatch-option[option-id=' + newOptions[name] + ']').eq(0).trigger('click');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getItemsFromLocalStorage: function() {
|
||||
return JSON.parse(localStorage.getItem(this.storageKey));
|
||||
},
|
||||
|
||||
saveItemsToLocalStorage: function() {
|
||||
$(".ui-helper-hidden-accessible").remove();
|
||||
var items = [];
|
||||
_.each(this.items(), function(item) {
|
||||
items.push(item.getData());
|
||||
});
|
||||
return localStorage.setItem(this.storageKey, JSON.stringify(items));
|
||||
},
|
||||
|
||||
clearLocalStorage: function() {
|
||||
return localStorage.removeItem(this.storageKey);
|
||||
},
|
||||
|
||||
emptyItems: function() {
|
||||
var self = this;
|
||||
confirm({
|
||||
content: self.confirmMessage,
|
||||
actions: {
|
||||
confirm: function () {
|
||||
self.items.removeAll();
|
||||
},
|
||||
always: function (e) {
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
addToList: function() {
|
||||
if (this.skus()) {
|
||||
var self = this;
|
||||
var result = [];
|
||||
var skus = self.skus().split("\n");
|
||||
for (var i = 0; i < skus.length; i++) {
|
||||
var row = skus[i];
|
||||
var skus2 = row.split(",");
|
||||
for (var x = 0; x < skus2.length; x++) {
|
||||
var sku = skus2[x].trim();
|
||||
if ($.inArray( sku, result )==-1) {
|
||||
result.push(sku);
|
||||
}
|
||||
}
|
||||
}
|
||||
var products =_.filter(self.products(), function(product) {
|
||||
return ($.inArray( product.sku, result )!=-1)
|
||||
});
|
||||
|
||||
if (self.instantSearch) {
|
||||
self._processAddToList(products);
|
||||
} else {
|
||||
$.ajax({
|
||||
url: self.ajaxUrl,
|
||||
data: { skus: result,mode: self.mode },
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.message) alert(res.message);
|
||||
self._processAddToList(res.products, skus);
|
||||
}
|
||||
});
|
||||
}
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth' // 平滑滚动效果
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_processAddToList: function(products) {
|
||||
var qty = parseInt(this.qty()) ? parseInt(this.qty()) : 1;
|
||||
_.each(products, function(product) {
|
||||
this.addItem({
|
||||
price: product.price,
|
||||
qty: qty,
|
||||
product: product
|
||||
});
|
||||
}, this);
|
||||
this.skus('');
|
||||
this.qty('');
|
||||
},
|
||||
|
||||
onLoadedFile: function(file, data) {
|
||||
|
||||
var self = this;
|
||||
|
||||
if (!file) {
|
||||
malert({"message": "请选择你要导入的excel文件"})
|
||||
return;
|
||||
}
|
||||
|
||||
let formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('form_key', self.formKey);
|
||||
|
||||
$.ajax({
|
||||
url: self.excelUploadUrl,
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
showLoader: true,
|
||||
success: function (response) {
|
||||
let targetUrl = '/quick-order/';
|
||||
if (response.result) {
|
||||
targetUrl = '/checkout/cart/'
|
||||
}
|
||||
window.location.href = targetUrl;
|
||||
},
|
||||
error: function (xhr) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_processOnLoadedFile: function(products, skus, others) {
|
||||
_.each(products, function(product) {
|
||||
|
||||
this.addItem({
|
||||
price: product.price,
|
||||
others: others[product.realSku],
|
||||
options: product.options==''? null : product.options,
|
||||
qty: skus[product.realSku]==undefined? 0:skus[product.realSku]['qty'],
|
||||
product: product
|
||||
});
|
||||
}, this);
|
||||
this.fileLoading(false);
|
||||
this.fileMessage('<span class="quickquote-message-success">' + this.fileSuccessMessage + '</span>');
|
||||
},
|
||||
|
||||
onErrorFile: function(file, error) {
|
||||
this.fileLoading(false);
|
||||
this.fileMessage('<span class="quickquote-message-error">' + error + '</span>');
|
||||
},
|
||||
|
||||
onProgressFile: function(file) {
|
||||
this.fileLoading(true);
|
||||
this.fileMessage('');
|
||||
},
|
||||
|
||||
loadingProductSpinner: function(status) {
|
||||
if (status) {
|
||||
$('.page-title').append('<div class="quickorder-spinner"><i></i></div>');
|
||||
} else {
|
||||
$('.page-title').children('.quickorder-spinner').remove();
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
+2519
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,118 @@
|
||||
(function (factory) {
|
||||
// Module systems magic dance.
|
||||
|
||||
if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
|
||||
// CommonJS or Node: hard-coded dependency on "knockout"
|
||||
factory(require("knockout"));
|
||||
} else if (typeof define === "function" && define["amd"]) {
|
||||
// AMD anonymous module with hard-coded dependency on "knockout"
|
||||
define(["knockout"], factory);
|
||||
} else {
|
||||
// <script> tag: use the global `ko` object, attaching a `mapping` property
|
||||
factory(ko);
|
||||
}
|
||||
}
|
||||
(function (ko) {
|
||||
ko.bindingHandlers.files = {
|
||||
init: function(element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
var allBindings = allBindingsAccessor();
|
||||
var loadedCallback, progressCallback, errorCallback, hoverClass, allowDrop, fileFilter, readAs, maxFileSize;
|
||||
var filesBinding = allBindings.files;
|
||||
|
||||
if (typeof(ko.unwrap(filesBinding)) == "function")
|
||||
{ loadedCallback = ko.unwrap(filesBinding); }
|
||||
else
|
||||
{
|
||||
loadedCallback = ko.unwrap(filesBinding.onLoaded);
|
||||
progressCallback = ko.unwrap(filesBinding.onProgress);
|
||||
errorCallback = ko.unwrap(filesBinding.onError);
|
||||
allowDrop = ko.unwrap(filesBinding.allowDrop);
|
||||
hoverClass = ko.unwrap(filesBinding.hoverClass);
|
||||
fileFilter = ko.unwrap(filesBinding.fileFilter);
|
||||
maxFileSize = ko.unwrap(filesBinding.maxFileSize);
|
||||
readAs = ko.unwrap(filesBinding.readAs);
|
||||
}
|
||||
|
||||
if(typeof(loadedCallback) != "function")
|
||||
{ return; }
|
||||
|
||||
var readFile = function(file) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(fileLoadedEvent) {
|
||||
loadedCallback(file, fileLoadedEvent.target.result);
|
||||
};
|
||||
|
||||
if(typeof(progressCallback) == "function")
|
||||
{
|
||||
reader.onprogress = function(fileProgressEvent) {
|
||||
progressCallback(file, fileProgressEvent.loaded, fileProgressEvent.total);
|
||||
};
|
||||
}
|
||||
|
||||
if(typeof(errorCallback) == "function")
|
||||
{
|
||||
reader.onerror = function(fileErrorEvent) {
|
||||
errorCallback(file, fileErrorEvent.target.error);
|
||||
};
|
||||
}
|
||||
|
||||
if(readAs == "text")
|
||||
{ reader.readAsText(file); }
|
||||
else if(readAs == "array")
|
||||
{ reader.readAsArrayBuffer(file); }
|
||||
else if(readAs == "binary")
|
||||
{ reader.readAsBinaryString(file); }
|
||||
else
|
||||
{ reader.readAsDataURL(file); }
|
||||
};
|
||||
|
||||
var handleFileDrag = function(fileDragEvent) {
|
||||
fileDragEvent.stopPropagation();
|
||||
fileDragEvent.preventDefault();
|
||||
|
||||
if(fileDragEvent.type == "dragover")
|
||||
{ fileDragEvent.target.classList.add(hoverClass); }
|
||||
else
|
||||
{ fileDragEvent.target.classList.remove(hoverClass); }
|
||||
};
|
||||
|
||||
var handleDrop = function(fileDropEvent) {
|
||||
handleFileDrag(fileDropEvent);
|
||||
handleFileSelected(fileDropEvent);
|
||||
}
|
||||
|
||||
var handleFileSelected = function(fileSelectionEvent) {
|
||||
var files = fileSelectionEvent.target.files || fileSelectionEvent.dataTransfer.files;
|
||||
for (var i = 0, f; f = files[i]; i++) {
|
||||
if (typeof(fileFilter) != "undefined" && !f.type.match(fileFilter))
|
||||
{
|
||||
if(typeof(errorCallback) == "function")
|
||||
{ errorCallback(f, "File type does not match filter"); }
|
||||
continue;
|
||||
}
|
||||
|
||||
if(typeof(maxFileSize) != "undefined" && f.size >= maxFileSize)
|
||||
{
|
||||
if(typeof(errorCallback) == "function")
|
||||
{ errorCallback(f, "File exceeds file size limit"); }
|
||||
continue;
|
||||
}
|
||||
|
||||
readFile(f);
|
||||
}
|
||||
};
|
||||
|
||||
if (!document.addEventListener) {
|
||||
return; //IE8 won't work with addEventListener, avoid JS error
|
||||
}
|
||||
|
||||
element.addEventListener('change', handleFileSelected, false);
|
||||
|
||||
if(allowDrop) {
|
||||
element.addEventListener('dragover', handleFileDrag, false);
|
||||
element.addEventListener('dragleave', handleFileDrag, false);
|
||||
element.addEventListener('drop', handleDrop, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
}));
|
||||
@@ -0,0 +1,192 @@
|
||||
define([
|
||||
'jquery',
|
||||
'ko',
|
||||
'underscore',
|
||||
'mageUtils',
|
||||
'mage/translate',
|
||||
'Magezon_QuickOrder/js/jquery-ui'
|
||||
], function($, ko, _, utils, $t) {
|
||||
|
||||
return function(data) {
|
||||
var self = this;
|
||||
this.uid = utils.uniqueid();
|
||||
this.parent = data.parent;
|
||||
this.search = ko.observable();
|
||||
this.product = ko.observable(data['product'] ? data['product'] : '');
|
||||
this.price = ko.observable(data['price'] ? data['price'] : 0);
|
||||
this.qty = ko.observable(data['qty'] ? parseFloat(data['qty']) : 1);
|
||||
this.options = ko.observable(data['options'] ? data['options'] : []);
|
||||
this.optionsHtml = ko.observable(data['optionsHtml'] ? data['optionsHtml'] : '');
|
||||
this.others = ko.observable(data['others'] ? data['others'] : '');
|
||||
this.message = ko.observable(data['message'] ? data['message'] : '');
|
||||
this.forceCheckValid = ko.observable(data.hasOwnProperty('forceCheckValid') ? data['forceCheckValid'] : true);
|
||||
this.qtyVisible = ko.observable(data.hasOwnProperty('qtyVisible') ? data['qtyVisible'] : true);
|
||||
this.products = ko.observableArray();
|
||||
this.spinnerloading = ko.observable(false);
|
||||
var quoteType = data['quoteType'];
|
||||
if (!quoteType && data['product'] && data['product']['quoteTypes'] && data['product']['quoteTypes'][0]) {
|
||||
quoteType = data['product']['quoteTypes'][0]['value'];
|
||||
}
|
||||
this.quoteType = ko.observable(quoteType);
|
||||
console.log('item data: ', data)
|
||||
self.getData = function() {
|
||||
return {
|
||||
product: self.product(),
|
||||
price: self.price(),
|
||||
qty: self.qty(),
|
||||
options: self.options(),
|
||||
optionsHtml: self.optionsHtml(),
|
||||
message: self.message(),
|
||||
forceCheckValid: self.forceCheckValid(),
|
||||
quoteType: self.quoteType()
|
||||
}
|
||||
}
|
||||
|
||||
self.subtotal = ko.pureComputed(function() {
|
||||
self.checkValid();
|
||||
return (self.product() ? self.price() * self.qty() : 0);
|
||||
});
|
||||
|
||||
self.parent.products.subscribe(function(products) {
|
||||
if (self.parent.instantSearch) {
|
||||
self.products(products);
|
||||
}
|
||||
});
|
||||
|
||||
self.products.subscribe(function() {
|
||||
self.initAutoComplete();
|
||||
})
|
||||
|
||||
self.search.subscribe(function(search) {
|
||||
if (!self.parent.instantSearch && search.length >= self.parent.minLength) {
|
||||
self.spinnerloading(true);
|
||||
$.ajax({
|
||||
url: self.parent.ajaxUrl,
|
||||
data: { search: search,mode: self.parent.mode },
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
if (res.message) alert(res.message);
|
||||
|
||||
self.products(res.products);
|
||||
self.spinnerloading(false);
|
||||
$('#' + self.uid).autocomplete('search', search);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
self.product.subscribe(function(product) {
|
||||
self.options([]);
|
||||
self.optionsHtml('');
|
||||
if (product) {
|
||||
self.price(product.price);
|
||||
} else {
|
||||
self.price(0);
|
||||
}
|
||||
});
|
||||
|
||||
self.forceCheckValid.subscribe(function(status) {
|
||||
if (status) {
|
||||
self.message('');
|
||||
}
|
||||
});
|
||||
|
||||
self.checkValid = function() {
|
||||
if (!this.isValid()) {
|
||||
self.message($t('Please specify product option(s).'));
|
||||
} else {
|
||||
self.message('');
|
||||
}
|
||||
}
|
||||
|
||||
self.isValid = function() {
|
||||
var valid = false;
|
||||
if (self.product() && self.product().canConfigure && !self.options().length) {
|
||||
valid = false
|
||||
} else {
|
||||
valid = true;
|
||||
}
|
||||
if (self.product().type == 'grouped') {
|
||||
self.qtyVisible(false);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
self.initAutoComplete = function() {
|
||||
$('#' + self.uid).focus();
|
||||
self._initAutoComplete();
|
||||
}
|
||||
|
||||
self._initAutoComplete = function() {
|
||||
|
||||
if (self.parent.instantSearch) {
|
||||
var products = self.parent.products();
|
||||
} else {
|
||||
var products = self.products();
|
||||
}
|
||||
console.log('self.products(): ', self.products())
|
||||
var element = $('#' + self.uid);
|
||||
element.autocomplete({
|
||||
messages: {
|
||||
noResults: '',
|
||||
results: function() {
|
||||
|
||||
}
|
||||
},
|
||||
minLength: self.parent.minLength,
|
||||
appendTo: '#mgz-quickorder-ui-' + this.uid,
|
||||
source: products,
|
||||
select: function( event, ui ) {
|
||||
console.log('ui: ', ui)
|
||||
event.preventDefault();
|
||||
// if (ui.item.type=='grouped') {
|
||||
// self.parent.addChildrens(ui.item, self);
|
||||
// } else {
|
||||
self.product(ui.item);
|
||||
if (ui.item.options != '') {
|
||||
self.options(ui.item.options);
|
||||
}
|
||||
|
||||
if (self.product().canConfigure) {
|
||||
self.forceCheckValid(false);
|
||||
} else {
|
||||
self.forceCheckValid(true);
|
||||
}
|
||||
if (self.parent.instantSearch) {
|
||||
element.val(self.product().name);
|
||||
}
|
||||
if (!self.product().canConfigure && self.product().openmodal) {
|
||||
self.parent.openPopup(self);
|
||||
}
|
||||
if (self.product().canConfigure) {
|
||||
self.parent.openPopup(self);
|
||||
}
|
||||
self.forceCheckValid(true);
|
||||
//}
|
||||
},
|
||||
focus: function(event, ui) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}).data( "ui-autocomplete" )._renderItem = function(ul, item) {
|
||||
var $html = '<div class="ui-menu-item-wrapper">';
|
||||
$html += '<div class="mgz-quickorder-item">';
|
||||
if (item.img && self.parent.search.showImage) {
|
||||
$html += '<div class="mgz-quickorder-item_left"><img src="' + item.img + '" alt="' + item.name + '"/></div>';
|
||||
}
|
||||
$html += '<div class="mgz-quickorder-item_right">';
|
||||
$html += '<div class="mgz-quickorder-item_title"><a href="#"><span>' + item.name + '</span></a></div>';
|
||||
if (self.parent.search.showSku) {
|
||||
$html += '<div class="mgz-quickorder-item_sku"><b>SKU#: </b>' + item.sku + '</div>';
|
||||
}
|
||||
if (self.parent.search.showPrice) {
|
||||
$html += '<div class="mgz-quickorder-item_price">' + item.priceHtml + '</div>';
|
||||
}
|
||||
$html += '</div>';
|
||||
$html += '</div>';
|
||||
$html += '</div>';
|
||||
return $('<li class="ui-menu-item" data-label=' + item.name + '>').data("ui-autocomplete-item",item).append($html).appendTo( ul );
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,92 @@
|
||||
define([
|
||||
'jquery'
|
||||
], function ($) {
|
||||
'use strict';
|
||||
|
||||
return function (widget) {
|
||||
|
||||
$.widget('mage.SwatchRenderer', widget, {
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_create: function () {
|
||||
var options = this.options,
|
||||
gallery = $('[data-gallery-role=gallery-placeholder]'),
|
||||
productData = this._determineProductData(),
|
||||
$main = productData.isInProductView ?
|
||||
this.element.parents('.column.main') :
|
||||
this.element.parents('.product-item-info');
|
||||
|
||||
if (productData.isInProductView) {
|
||||
gallery.data('gallery') ?
|
||||
this._onGalleryLoaded(gallery) :
|
||||
gallery.on('gallery:loaded', this._onGalleryLoaded.bind(this, gallery));
|
||||
} else {
|
||||
options.mediaGalleryInitial = [{
|
||||
'img': $main.find('.product-image-photo').attr('src')
|
||||
}];
|
||||
}
|
||||
|
||||
this.productForm = this.element.parents(this.options.selectorProductTile).find('form:first');
|
||||
this.inProductList = this.productForm.length > 0;
|
||||
},
|
||||
|
||||
/**
|
||||
* Update [gallery-placeholder] or [product-image-photo]
|
||||
* @param {Array} images
|
||||
* @param {jQuery} context
|
||||
* @param {Boolean} isInProductView
|
||||
*/
|
||||
updateBaseImage: function (images, context, isInProductView) {
|
||||
var justAnImage = images[0],
|
||||
initialImages = this.options.mediaGalleryInitial,
|
||||
gallery = $(this.options.mediaGallerySelector).data('gallery'),
|
||||
imagesToUpdate,
|
||||
isInitial;
|
||||
|
||||
// 每个产品图片添加caption信息
|
||||
if(images.length){
|
||||
images.forEach(function(img){
|
||||
img.caption = initialImages[0].caption
|
||||
});
|
||||
}
|
||||
|
||||
if (isInProductView) {
|
||||
imagesToUpdate = images.length ? this._setImageType($.extend(true, [], images)) : [];
|
||||
isInitial = _.isEqual(imagesToUpdate, initialImages);
|
||||
|
||||
if (this.options.gallerySwitchStrategy === 'prepend' && !isInitial) {
|
||||
imagesToUpdate = imagesToUpdate.concat(initialImages);
|
||||
}
|
||||
|
||||
imagesToUpdate = this._setImageIndex(imagesToUpdate);
|
||||
|
||||
if (gallery) {
|
||||
gallery.updateData(imagesToUpdate);
|
||||
}
|
||||
|
||||
if ($(this.options.mediaGallerySelector).length) {
|
||||
if (isInitial) {
|
||||
$(this.options.mediaGallerySelector).AddFotoramaVideoEvents();
|
||||
} else {
|
||||
$(this.options.mediaGallerySelector).AddFotoramaVideoEvents({
|
||||
selectedOption: this.getProduct(),
|
||||
dataMergeStrategy: this.options.gallerySwitchStrategy
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (gallery) {
|
||||
gallery.first();
|
||||
}
|
||||
|
||||
} else if (justAnImage && justAnImage.img) {
|
||||
context.find('.product-image-photo').attr('src', justAnImage.img);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return $.mage.SwatchRenderer;
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,126 @@
|
||||
<div class="mgz-quickorder">
|
||||
<table class="items data table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col search">
|
||||
<span data-bind="i18n: 'Search'"></span>
|
||||
</th>
|
||||
<th class="col item">
|
||||
<span data-bind="i18n: 'Item'"></span>
|
||||
</th>
|
||||
<th class="col price" if="showPrice">
|
||||
<span data-bind="i18n: 'Price'"></span>
|
||||
</th>
|
||||
<th class="col qty" if="showQty">
|
||||
<span data-bind="i18n: 'Qty'"></span>
|
||||
</th>
|
||||
<th class="col subtotal" if="showSubTotal">
|
||||
<span data-bind="i18n: 'Subtotal'"></span>
|
||||
</th>
|
||||
<th class="col action" if="showAction">
|
||||
<span data-bind="i18n: 'Action'"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: items">
|
||||
<tr class="item-info">
|
||||
<td class="col search">
|
||||
<div class="mgz-quickorder-search">
|
||||
<input type="text" data-bind="textInput: search" attr="id: uid,placeholder: $parent.searchPlaceholder" autocomplete="off"/>
|
||||
<div class="quickorder-spinner" if="spinnerloading"><i></i></div>
|
||||
<div attr="id: 'mgz-quickorder-ui-'+ uid" class="mgz-quickorder-ui-wrapper" afterRender="initAutoComplete"></div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="col item">
|
||||
<div class="item-info-inner" if="product">
|
||||
<div class="product-item-photo" if="$parent.showImage">
|
||||
<span class="product-image-container">
|
||||
<span class="product-image-wrapper">
|
||||
<img attr="src: product().img, alt: product().name"/>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="product-item-details">
|
||||
<strong class="product-item-name">
|
||||
<a attr="href: product().url" text="product().name"></a>
|
||||
</strong>
|
||||
<div class="product-item-sku"><b data-bind="i18n: 'SKU#:'"></b> <span text="product().sku"></span></div>
|
||||
<div class="product-quote-type" if="$parent.mode=='quickquote'&&product().quoteTypes.length"><b data-bind="i18n: 'Type:'"></b>
|
||||
<select data-bind="options: product().quoteTypes,
|
||||
optionsText: 'label',
|
||||
optionsValue: 'value',
|
||||
value: quoteType" style="width: auto"></select>
|
||||
</div>
|
||||
<div class="quickquote-message message error" if="message"><span text="message"></span></div>
|
||||
<div class="item-options-wrapper" html="optionsHtml" if="product&&optionsHtml"></div>
|
||||
<a href="#" class="quickorder-action-edit" data-bind="i18n: 'Edit'" if="product().canConfigure||product().openmodal" click="parent.openPopup"></a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="col price" if="$parent.showPrice">
|
||||
<span class="price" text="$parent.getFormattedPrice(price())" if="product"></span>
|
||||
</td>
|
||||
<td class="col qty" if="$parent.showQty">
|
||||
<input type="number" data-bind="value: qty" min="1" class="input-text qty" if="product" visible="qtyVisible"/>
|
||||
</td>
|
||||
<td class="col subtotal" if="$parent.showSubTotal">
|
||||
<span class="price" text="$parent.getFormattedPrice(subtotal())" if="product"></span>
|
||||
</td>
|
||||
<td class="col action" if="$parent.showAction">
|
||||
<a href="#" class="quickorder-btn action-duplicate" click="$parent.duplicateItem" if="product">+</a>
|
||||
<a href="#" class="quickorder-btn action-delete" click="$parent.removeItem">x</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="mgz-quickorder-action">
|
||||
<div class="quickorder-grand-total" if="showGrandTotal">
|
||||
<span text="grandTotalLabel"></span> <span data-bind="text: getFormattedPrice(grandTotal())"></span>
|
||||
</div>
|
||||
<button class="quickorder-btn" data-bind="disable: submitLoading" click="addItem" text="addBtnLabel"></button>
|
||||
<button class="quickorder-btn" data-bind="disable: submitLoading" click="emptyItems" text="emptyBtnLabel" if="showEmptyBtn"></button>
|
||||
<button class="quickorder-btn" data-bind="disable: submitLoading" click="submitItems" text="submitBtnLabel"></button>
|
||||
<div class="quickorder-spinner" if="submitLoading"><i></i></div>
|
||||
</div>
|
||||
<div class="mgz-quicorder-multiskus" if="enableMultiskus">
|
||||
<fieldset class="fieldset">
|
||||
<div class="field">
|
||||
<label class="label">
|
||||
<span text="multiSkusLabel"></span>
|
||||
</label>
|
||||
<div class="control">
|
||||
<textarea class="textarea" rows="5" data-bind="value: skus"></textarea>
|
||||
<p text="multiSkusDescription"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label">
|
||||
<span data-bind="i18n: 'Qty'"></span>
|
||||
</label>
|
||||
<div class="control">
|
||||
<input type="number" class="text" data-bind="value: qty" min="1"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<button class="quickorder-btn" click="addToList" text="addToListBtnLabel"></button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="mgz-quicorder-file" if="enableUpload">
|
||||
<fieldset class="fieldset">
|
||||
<div class="field">
|
||||
<label class="label">
|
||||
<span data-bind="i18n: 'Add from file'"></span>
|
||||
</label>
|
||||
|
||||
<div class="control">
|
||||
<label class="file-uploader-button" for="quickorder-file" data-bind="i18n: 'Choose File'"></label>
|
||||
<input type="file" id="quickorder-file" class="file" data-bind="files: { onLoaded: onLoadedFile, fileFilter: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',onError: onErrorFile,onProgress: onProgressFile, readAs: 'text'}" accept=".xlsx" />
|
||||
<a attr="href: downloadSampleLink"><span data-bind="i18n: '下载excel文件模板'"></span></a>
|
||||
<div class="quickorder-spinner" if="fileLoading"><i></i></div>
|
||||
<p html="fileMessage"></p>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user