add empik module
This commit is contained in:
126
modules/empikmarketplace/views/js/admin/empik.js
Normal file
126
modules/empikmarketplace/views/js/admin/empik.js
Normal file
@@ -0,0 +1,126 @@
|
||||
$(function () {
|
||||
const empikProductExportButtonSelector = '.js-empik-products-export';
|
||||
const empikOfferExportButtonSelector = '.js-empik-offers-export';
|
||||
const empikPriceInputSelector = '.js-empik-price-input';
|
||||
|
||||
$(document).on('click', empikProductExportButtonSelector, function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
$(this).attr('disabled', 'disabled');
|
||||
|
||||
let page = 0;
|
||||
ajaxRequest();
|
||||
|
||||
function ajaxRequest() {
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('action', 'exportProducts');
|
||||
formData.append('page', page);
|
||||
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: empikAjaxUrl,
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
dataType: 'json',
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
if (response.continue) {
|
||||
page++;
|
||||
ajaxRequest();
|
||||
} else {
|
||||
window.location = response.redirect;
|
||||
$(this).removeAttr('disabled');
|
||||
}
|
||||
} else {
|
||||
alert(response.errors[0]);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', empikOfferExportButtonSelector, function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
$(this).attr('disabled', 'disabled');
|
||||
|
||||
let page = 0;
|
||||
ajaxRequest();
|
||||
|
||||
function ajaxRequest() {
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('action', 'exportOffers');
|
||||
formData.append('page', page);
|
||||
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: empikAjaxUrl,
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
dataType: 'json',
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
if (response.continue) {
|
||||
page++;
|
||||
ajaxRequest();
|
||||
} else {
|
||||
window.location = response.redirect;
|
||||
$(this).removeAttr('disabled');
|
||||
}
|
||||
} else {
|
||||
alert(response.errors[0]);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('change', empikPriceInputSelector, function (e) {
|
||||
const value = $(this).val();
|
||||
|
||||
// replace , with .
|
||||
let formattedValue = value.replace(',', '.');
|
||||
|
||||
// remove all non-numeric characters
|
||||
formattedValue = formattedValue.replace(/[^0-9\.]/g, '');
|
||||
|
||||
formattedValue = parseFloat(formattedValue);
|
||||
|
||||
// check is value is a number
|
||||
if (isNaN(formattedValue)) {
|
||||
formattedValue = 0.00;
|
||||
}
|
||||
|
||||
formattedValue = formattedValue.toFixed(2);
|
||||
|
||||
$(this).val(formattedValue);
|
||||
});
|
||||
|
||||
$(document).on('change', empikPriceInputSelector, function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('action', $(this).data('action'));
|
||||
formData.append('id_product', $(this).data('product-id'));
|
||||
formData.append('id_product_attribute', $(this).data('product-attribute-id'));
|
||||
formData.append('price', $(this).val());
|
||||
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: empikAjaxUrl,
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
dataType: 'json',
|
||||
success: (response) => {
|
||||
if (response.success && typeof response.message !== 'undefined') {
|
||||
showSuccessMessage(response.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
11
modules/empikmarketplace/views/js/admin/index.php
Normal file
11
modules/empikmarketplace/views/js/admin/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
122
modules/empikmarketplace/views/js/empik.js
Normal file
122
modules/empikmarketplace/views/js/empik.js
Normal file
@@ -0,0 +1,122 @@
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ "./src/css/empik.scss":
|
||||
/*!**********************************!*\
|
||||
!*** ./src/css/empik.scss ***!
|
||||
\**********************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("// extracted by mini-css-extract-plugin\n\n//# sourceURL=webpack:///./src/css/empik.scss?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "./src/js/empik.js":
|
||||
/*!*******************************!*\
|
||||
!*** ./src/js/empik.js ***!
|
||||
\*******************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
eval("\n\n//# sourceURL=webpack:///./src/js/empik.js?");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 0:
|
||||
/*!****************************************************************!*\
|
||||
!*** multi ./src/js/empik.js ./src/css/empik.scss ***!
|
||||
\****************************************************************/
|
||||
/*! no static exports found */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
eval("__webpack_require__(/*! ./src/js/empik.js */\"./src/js/empik.js\");\nmodule.exports = __webpack_require__(/*! ./src/css/empik.scss */\"./src/css/empik.scss\");\n\n\n//# sourceURL=webpack:///multi_./src/js/empik.js_./src/css/empik.scss?");
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
||||
11
modules/empikmarketplace/views/js/index.php
Normal file
11
modules/empikmarketplace/views/js/index.php
Normal file
@@ -0,0 +1,11 @@
|
||||
index.php<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
Reference in New Issue
Block a user