Files
2019-11-17 19:14:07 +01:00

142 lines
5.6 KiB
JavaScript

/**
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* 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 PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*
* Don't forget to prefix your containers with your own identifier
* to avoid any conflicts with others containers.
*/
$( document ).ready(function() {
if ($('#formactif').val() == 'import') {
$('#module_form_1').hide();
} else {
$('#module_form').hide();
}
$('#menudiv-cron').insertAfter('#module_form_1');
$( "#showexport" ).click(function() {
$('#menuecstock li').removeClass('active');
$(this).parent().addClass('active');
$('#module_form').hide();
$('#module_form_1').show();
$('#cronimport').hide();
$('#cronexport').show();
});
$( "#showimport" ).click(function() {
$('#menuecstock li').removeClass('active');
$(this).parent().addClass('active');
$('#module_form_1').hide();
$('#module_form').show();
$('#cronexport').hide();
$('#cronimport').show();
});
if($("#ECSTOCK_FTP_off").prop("checked")) {
$("#ECSTOCK_FTP_off").parent().parent().parent().next().hide();
$("#ECSTOCK_FTP_off").parent().parent().parent().next().next().hide();
$("#ECSTOCK_FTP_off").parent().parent().parent().next().next().next().hide();
$("#ECSTOCK_FTP_off").parent().parent().parent().next().next().next().next().hide();
}
$( "#ECSTOCK_FTP_off" ).click(function() {
$(this).parent().parent().parent().next().hide();
$(this).parent().parent().parent().next().next().hide();
$(this).parent().parent().parent().next().next().next().hide();
$(this).parent().parent().parent().next().next().next().next().hide();
});
$( "#ECSTOCK_FTP_on" ).click(function() {
$(this).parent().parent().parent().next().show();
$(this).parent().parent().parent().next().next().show();
$(this).parent().parent().parent().next().next().next().show();
$(this).parent().parent().parent().next().next().next().next().show();
});
if($("#ECSTOCK_EXPORTFTP_off").prop("checked")) {
$("#ECSTOCK_EXPORTFTP_off").parent().parent().parent().next().hide();
$("#ECSTOCK_EXPORTFTP_off").parent().parent().parent().next().next().hide();
$("#ECSTOCK_EXPORTFTP_off").parent().parent().parent().next().next().next().hide();
$("#ECSTOCK_EXPORTFTP_off").parent().parent().parent().next().next().next().next().hide();
}
$( "#ECSTOCK_EXPORTFTP_off" ).click(function() {
$(this).parent().parent().parent().next().hide();
$(this).parent().parent().parent().next().next().hide();
$(this).parent().parent().parent().next().next().next().hide();
$(this).parent().parent().parent().next().next().next().next().hide();
});
$( "#ECSTOCK_EXPORTFTP_on" ).click(function() {
$(this).parent().parent().parent().next().show();
$(this).parent().parent().parent().next().next().show();
$(this).parent().parent().parent().next().next().next().show();
$(this).parent().parent().parent().next().next().next().next().show();
});
$('#module_form_submit_btn').after('<button id="executescript" name="eximportstock" class="btn btn-default pull-right"><i class="process-icon-upload"></i> Import</button>');
$('#module_form_submit_btn_1').after('<button id="exexportstock" name="exexportstock" class="btn btn-default pull-right"><i class="process-icon-download"></i> Export</button>');
$( "#executescript" ).click(function(e) {
e.preventDefault();
tokenecstock = $('#tokenecstock').val();
if (tokenecstock != ""){
$.ajax({
url: "../modules/ecstock/ecupdatestock.php",
type: "GET",
data: ({
token: tokenecstock,
}),
dataType: "json"
})
.done(function (data) {
});
$('#ecstockmoduleconfirmimport').insertBefore('#menuecstock');
$('#ecstockmoduleconfirmimport').show();
} else {
alert('Token invalide');
}
});
$( "#exexportstock" ).click(function(e) {
e.preventDefault();
tokenecstock = $('#tokenecstock').val();
if (tokenecstock != ""){
$.ajax({
url: "../modules/ecstock/ecexportstock.php",
type: "GET",
data: ({
token: tokenecstock,
id_shop: $('#id_shop').val()
}),
dataType: "json"
})
.done(function (data) {
});
$('#ecstockmoduleconfirmexport').insertBefore('#menuecstock');
$('#ecstockmoduleconfirmexport').show();
} else {
alert('Token invalide');
}
});
});