mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-03 19:53:19 +03:00
37 lines
3.9 KiB
JavaScript
37 lines
3.9 KiB
JavaScript
|
function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}}/**
|
||
|
* MIT License
|
||
|
*
|
||
|
* Copyright (c) 2020 DIGITAL RETAIL TECHNOLOGIES SL
|
||
|
*
|
||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
|
* of this software and associated documentation files (the "Software"), to deal
|
||
|
* in the Software without restriction, including without limitation the rights
|
||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
|
* copies of the Software, and to permit persons to whom the Software is
|
||
|
* furnished to do so, subject to the following conditions:
|
||
|
*
|
||
|
* The above copyright notice and this permission notice shall be included in
|
||
|
* all copies or substantial portions of the Software.
|
||
|
*
|
||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||
|
* SOFTWARE.
|
||
|
*
|
||
|
* DISCLAIMER
|
||
|
*
|
||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||
|
* needs please refer to http://www.prestashop.com for more information.
|
||
|
*
|
||
|
* @author DIGITAL RETAIL TECHNOLOGIES SL <mail@simlachat.com>
|
||
|
* @copyright 2020 DIGITAL RETAIL TECHNOLOGIES SL
|
||
|
* @license https://opensource.org/licenses/MIT The MIT License
|
||
|
*
|
||
|
* Don't forget to prefix your containers with your own identifier
|
||
|
* to avoid any conflicts with others containers.
|
||
|
*/$(function(){function a(a){if(this.idStorageKey="retailCRM_uploadOrdersIds",this.form=$("input[name=RETAILCRM_UPLOAD_ORDERS_ID]").closest("form").get(0),"undefined"==typeof this.form)return!1;this.input=$(this.form).find("input[name=\"RETAILCRM_UPLOAD_ORDERS_ID\"]").get(0),this.submitButton=$(this.form).find("button[id=\"upload-orders-submit\"]").get(0),this.submitAction=this.submitAction.bind(this),this.partitionId=this.partitionId.bind(this),this.setLoading=this.setLoading.bind(this),this.tabController=a,$(this.submitButton).click(this.submitAction);var b=localStorage.getItem(this.idStorageKey);null!==b&&($(this.input).val(b),localStorage.removeItem(this.idStorageKey))}a.prototype.submitAction=function(a){a.preventDefault();var b=$(this.input).val(),c=this.partitionId(b.toString().replace(/\s+/g,""));return 0!==c.length&&void(this.setLoading(!0),localStorage.setItem(this.idStorageKey,b),this.tabController.storeTabInAction(this.form),$(this.form).submit())},a.prototype.setLoading=function(a){var b=$("#retailcrm-loading-fade");0===b.length&&($("body").append("\n <div id=\"".concat("retailcrm-loading-fade","\">\n <div id=\"retailcrm-loader\"></div>\n </div>\n ").trim()),b=$("#retailcrm-loading-fade")),b.css("visibility",a?"visible":"hidden")},a.prototype.partitionId=function(a){if(""===a)return[];var b=a.split(","),c=b.filter(function(a){return-1===a.toString().indexOf("-")}),d=b.filter(function(a){return-1!==a.toString().indexOf("-")}),e=[];return d.forEach(function(a){var b=a.split("-");e=[].concat(_toConsumableArray(e),_toConsumableArray(_toConsumableArray(Array(+b[1]+1).keys()).slice(+b[0],+b[1]+1)))}),[].concat(_toConsumableArray(c),_toConsumableArray(e)).map(function(a){return+a}).sort(function(c,a){return c-a})},window.RetailcrmUploadForm=a});
|