Initial commit

This commit is contained in:
2019-11-20 07:44:43 +01:00
commit 5bf49c4a81
41188 changed files with 5459177 additions and 0 deletions

View File

@@ -0,0 +1,231 @@
/**
* NOTICE OF LICENSE
*
* This source file is subject to a commercial license from Common-Services Co., Ltd.
* Use, copy, modification or distribution of this source file without written
* license agreement from the SARL SMC is strictly forbidden.
* In order to obtain a license, please contact us: contact@common-services.com
* ...........................................................................
* INFORMATION SUR LA LICENCE D'UTILISATION
*
* L'utilisation de ce fichier source est soumise a une licence commerciale
* concedee par la societe Common-Services Co., Ltd.
* Toute utilisation, reproduction, modification ou distribution du present
* fichier source sans contrat de licence ecrit de la part de la Common-Services Co. Ltd. est
* expressement interdite.
* Pour obtenir une licence, veuillez contacter Common-Services Co., Ltd. a l'adresse: contact@common-services.com
* ...........................................................................
*
* @package SoNice Retour
* @author Alexandre D.
* @copyright Copyright (c) 2011-2015 Common Services Co Ltd - 90/25 Sukhumvit 81 - 10260 Bangkok - Thailand
* @license Commercial license
* Support by mail : support.sonice@common-services.com
*/
$(document).ready(function () {
/*
* From: http://phpjs.org/functions
*/
function version_compare(v1, v2, operator) {
this.php_js = this.php_js || {};
this.php_js.ENV = this.php_js.ENV || {};
var i = 0, x = 0, compare = 0, vm = {
'dev': -6,
'alpha': -5,
'a': -5,
'beta': -4,
'b': -4,
'RC': -3,
'rc': -3,
'#': -2,
'p': 1,
'pl': 1
},
prepVersion = function (v) {
v = ('' + v).replace(/[_\-+]/g, '.');
v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
return (!v.length ? [-8] : v.split('.'));
},
numVersion = function (v) {
return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
};
v1 = prepVersion(v1);
v2 = prepVersion(v2);
x = Math.max(v1.length, v2.length);
for (i = 0; i < x; i++) {
if (v1[i] == v2[i]) {
continue;
}
v1[i] = numVersion(v1[i]);
v2[i] = numVersion(v2[i]);
if (v1[i] < v2[i]) {
compare = -1;
break;
} else if (v1[i] > v2[i]) {
compare = 1;
break;
}
}
if (!operator) {
return compare;
}
switch (operator) {
case '>':
case 'gt':
return (compare > 0);
case '>=':
case 'ge':
return (compare >= 0);
case '<=':
case 'le':
return (compare <= 0);
case '==':
case '=':
case 'eq':
return (compare === 0);
case '<>':
case '!=':
case 'ne':
return (compare !== 0);
case '':
case '<':
case 'lt':
return (compare < 0);
default:
return null;
}
}
/*
* Get current browser
* @see http://stackoverflow.com/questions/2400935/browser-detection-in-javascript#answer-2401861
*/
navigator.sayswho = (function () {
var ua = navigator.userAgent, tem,
M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*([\d\.]+)/i) || [];
if (/trident/i.test(M[1])) {
tem = /\brv[ :]+(\d+(\.\d+)?)/g.exec(ua) || [];
return ('IE ' + (tem[1] || ''));
}
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
tem = ua.match(/version\/([\.\d]+)/i);
if (tem !== null)
M[2] = tem[1];
return (M.join(' '));
})();
if (/Chrome/.test(navigator.sayswho))
$('.beware_chrome').show();
/*
* Multi Select Carriers
*/
$('#carrier-sne_move-right').click(function () {
return !$('#available-carriers option:selected').remove().appendTo('#filtered-carriers');
});
$('#carrier-sne_move-left').click(function () {
return !$('#filtered-carriers option:selected').remove().appendTo('#available-carriers');
});
/*
* Multi Select Status
*/
$('#status-sne_move-right').click(function () {
return !$('#available-status option:selected').remove().appendTo('#filtered-status');
});
$('#status-sne_move-left').click(function () {
return !$('#filtered-status option:selected').remove().appendTo('#available-status');
});
/*
* Login checking
*/
$('#login_checker').click(function (ev) {
$('#sne_loader').show();
$.ajax({
type: 'POST',
url: $('#check_login_url').val(),
dataType: 'jsonp',
data: $('#conf-account').find('input[name^="return_info"]').serialize(),
success: function (data) {
$('#sne_loader').hide();
if (window.console)
console.log(data);
if (typeof(data) === 'undefined' || data === null || typeof(data.info) === 'undefined' || data.info === null) {
$('.login_checker_result, #login_not_ok').show();
$('#error').html(data.output + '<br>' + data.console);
$('#error_request').html(data.request);
$('#error_response').html(data.response);
return;
}
if (data.info.status === true && !data.console) {
$('.login_checker_result, #login_ok').show();
$('#login_not_ok').hide();
if (data.output) {
$('#error').html(data.output);
$('#error_request').html(data.request);
$('#error_response').html(data.response);
$('.login_checker_result, #login_not_ok').show();
}
}
else {
$('#errorID').html(data.info.errorID[0] ? data.info.errorID[0] : '?');
$('#error').html(data.info.error[0] + '<br>' + data.console);
$('#error_request').html(data.request);
$('#error_response').html(data.response);
$('.login_checker_result, #login_not_ok').show();
}
},
error: function (data) {
if (window.console)
console.log(data);
$('#sne_loader').hide();
$('.login_checker_result, #login_not_ok').show();
$('#login_not_ok').find('strong:first').html(data.console);
$('#login_not_ok').find('span:last').html(data.responseText);
$('#error_request').html(data.request);
$('#error_response').html(data.response);
}
});
});
// PHPINFO & PSINFO
$('#phpinfo_button').unbind('click').click(function () {
$('#psinfo:visible').toggle();
$('#phpinfo').toggle();
});
$('#psinfo_button').unbind('click').click(function () {
$('#phpinfo:visible').toggle();
$('#psinfo').toggle();
});
// qTip
$('label[rel]').each(function () {
var target_glossary_key = $(this).attr('rel');
var target_glossary_div = $('#glossary div.' + target_glossary_key);
if (target_glossary_div && target_glossary_div.length) {
var title = $(this).text() || null;
var content = target_glossary_div.html().trim() || 'N/A';
$(this).addClass('tip').html('<span>' + title + '</span>').find('span').qtip({
content: {
text: content,
title: title
},
hide: {
fixed: true,
delay: 300
},
plugins: {}
});
}
});
});

View 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;

View File

@@ -0,0 +1,26 @@
/**
* jQuery Simulate v1.0.0 - simulate browser mouse and keyboard events
* https://github.com/jquery/jquery-simulate
*
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* Date: 2014-08-22
*
* Updated on 2016-08-22 by debuss-a in minified format via https://closure-compiler.appspot.com .
*
* @package sonice_retour
* @author jQuery
* @copyright Copyright 2012 jQuery Foundation and other contributors
* @license MIT license [http://jquery.org/license]
*/
(function(f,h){var k=/^key/,l=/^(?:mouse|contextmenu)|click/;f.fn.simulate=function(d,a){return this.each(function(){new f.simulate(this,d,a)})};f.simulate=function(d,a,b){var c=f.camelCase("simulate-"+a);this.target=d;this.options=b;if(this[c])this[c]();else this.simulateEvent(d,a,b)};f.extend(f.simulate,{keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,
PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},buttonCode:{LEFT:0,MIDDLE:1,RIGHT:2}});f.extend(f.simulate.prototype,{simulateEvent:function(d,a,b){var c=this.createEvent(a,b);this.dispatchEvent(d,a,c,b)},createEvent:function(d,a){if(k.test(d))return this.keyEvent(d,a);if(l.test(d))return this.mouseEvent(d,a)},mouseEvent:function(d,a){var b,c,e,g;a=f.extend({bubbles:!0,cancelable:"mousemove"!==d,view:window,detail:0,screenX:0,screenY:0,clientX:1,clientY:1,ctrlKey:!1,altKey:!1,shiftKey:!1,
metaKey:!1,button:0,relatedTarget:h},a);document.createEvent?(b=document.createEvent("MouseEvents"),b.initMouseEvent(d,a.bubbles,a.cancelable,a.view,a.detail,a.screenX,a.screenY,a.clientX,a.clientY,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,a.button,a.relatedTarget||document.body.parentNode),0===b.pageX&&0===b.pageY&&Object.defineProperty&&(c=b.relatedTarget.ownerDocument||document,e=c.documentElement,g=c.body,Object.defineProperty(b,"pageX",{get:function(){return a.clientX+(e&&e.scrollLeft||g&&g.scrollLeft||
0)-(e&&e.clientLeft||g&&g.clientLeft||0)}}),Object.defineProperty(b,"pageY",{get:function(){return a.clientY+(e&&e.scrollTop||g&&g.scrollTop||0)-(e&&e.clientTop||g&&g.clientTop||0)}}))):document.createEventObject&&(b=document.createEventObject(),f.extend(b,a),b.button={0:1,1:4,2:2}[b.button]||(-1===b.button?0:b.button));return b},keyEvent:function(d,a){var b;a=f.extend({bubbles:!0,cancelable:!0,view:window,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:0,charCode:h},a);if(document.createEvent)try{b=
document.createEvent("KeyEvents"),b.initKeyEvent(d,a.bubbles,a.cancelable,a.view,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,a.keyCode,a.charCode)}catch(c){b=document.createEvent("Events"),b.initEvent(d,a.bubbles,a.cancelable),f.extend(b,{view:a.view,ctrlKey:a.ctrlKey,altKey:a.altKey,shiftKey:a.shiftKey,metaKey:a.metaKey,keyCode:a.keyCode,charCode:a.charCode})}else document.createEventObject&&(b=document.createEventObject(),f.extend(b,a));if(/msie [\w.]+/.exec(navigator.userAgent.toLowerCase())||"[object Opera]"===
{}.toString.call(window.opera))b.keyCode=0<a.charCode?a.charCode:a.keyCode,b.charCode=h;return b},dispatchEvent:function(d,a,b){if(d[a])d[a]();else d.dispatchEvent?d.dispatchEvent(b):d.fireEvent&&d.fireEvent("on"+a,b)},simulateFocus:function(){function d(){b=!0}var a,b=!1,c=f(this.target);c.bind("focus",d);c[0].focus();b||(a=f.Event("focusin"),a.preventDefault(),c.trigger(a),c.triggerHandler("focus"));c.unbind("focus",d)},simulateBlur:function(){function d(){b=!0}var a,b=!1,c=f(this.target);c.bind("blur",
d);c[0].blur();setTimeout(function(){c[0].ownerDocument.activeElement===c[0]&&c[0].ownerDocument.body.focus();b||(a=f.Event("focusout"),a.preventDefault(),c.trigger(a),c.triggerHandler("blur"));c.unbind("blur",d)},1)}});f.extend(f.simulate.prototype,{simulateDrag:function(){var d=0,a=this.target,b=this.options,c;if("corner"===b.handle){var e=a;c=f(e.ownerDocument);e=f(e);e=e.offset();c={x:e.left-c.scrollLeft(),y:e.top-c.scrollTop()}}else{c=a;var g=f(c.ownerDocument);c=f(c);e=c.offset();c={x:e.left+
c.outerWidth()/2-g.scrollLeft(),y:e.top+c.outerHeight()/2-g.scrollTop()}}e=c;c=Math.floor(e.x);var e=Math.floor(e.y),g={clientX:c,clientY:e},k=b.dx||(b.x!==h?b.x-c:0),l=b.dy||(b.y!==h?b.y-e:0),b=b.moves||3;for(this.simulateEvent(a,"mousedown",g);d<b;d++)c+=k/b,e+=l/b,g={clientX:Math.round(c),clientY:Math.round(e)},this.simulateEvent(a.ownerDocument,"mousemove",g);f.contains(document,a)?(this.simulateEvent(a,"mouseup",g),this.simulateEvent(a,"click",g)):this.simulateEvent(document,"mouseup",g)}})})(jQuery);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,380 @@
/**
* NOTICE OF LICENSE
*
* This source file is subject to a commercial license from Common-Services Co., Ltd.
* Use, copy, modification or distribution of this source file without written
* license agreement from the SARL SMC is strictly forbidden.
* In order to obtain a license, please contact us: contact@common-services.com
* ...........................................................................
* INFORMATION SUR LA LICENCE D'UTILISATION
*
* L'utilisation de ce fichier source est soumise a une licence commerciale
* concedee par la societe Common-Services Co., Ltd.
* Toute utilisation, reproduction, modification ou distribution du present
* fichier source sans contrat de licence ecrit de la part de la Common-Services Co. Ltd. est
* expressement interdite.
* Pour obtenir une licence, veuillez contacter Common-Services Co., Ltd. a l'adresse: contact@common-services.com
* ...........................................................................
*
* @package SoNice Retour
* @author Alexandre D.
* @copyright Copyright (c) 2011-2015 Common Services Co Ltd - 90/25 Sukhumvit 81 - 10260 Bangkok - Thailand
* @license Commercial license
* Support by mail : support.sonice@common-services.com
*/
$(document).ready(function () {
//OCARAT popover pour motif
$('[data-toggle="popover"]').popover({ trigger: "hover" });
/*
*******************************
* FUNCTIONS *
*******************************
*/
/**
* Fill the product array with product that are already chosen to be returned by customer.
*
* @param {jQuery} table jQuery table element.
* @param {array} product_list List of product to put in <table>.
*/
function fillProductAlreadyReturned(table, product_list) {
product_list.each(function (i) {
$('#orderProducts tr:visible').not(':first').each(function () {
var product_id_order_detail = parseInt($(this).find(edit_product_id_order_detail).val());
if (isNaN(product_id_order_detail))
product_id_order_detail = parseInt(getQueryVariable($(this).find('td:nth-child(2) > a').attr('href'), 'id_product'));
if (product_id_order_detail === parseInt($(product_list[i]).attr('rel'))) {
$(this).clone().appendTo(table).addClass('alreadyReturned');
$('.alreadyReturned:last').find(product_quantity_show).text($(product_list[i]).val());
// For PS1.4, disable input about returning a product
$('.sonice_retour_tbody_a').find('input').attr('disabled', true);
}
});
});
}
/**
* Parse query string values and returns the one we want (variable)
* @see http://stackoverflow.com/questions/2090551/parse-query-string-in-javascript#answer-2091331
*
* @param {String} query URL to parse
* @param {String} variable Variable you are looking for
* @returns String
*/
function getQueryVariable(query, variable) {
if (typeof(query) === 'undefined'){
return (false);
}
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) === variable) {
return decodeURIComponent(pair[1]);
}
}
return (false);
}
/*
*******************************
* CORE *
*******************************
*/
var newReturn = 1;
var demo = parseInt($('#sonice_retour_demo').val());
var ps15x = parseInt($('#ps15x').val());
/* Init variables */
var edit_product_id_order_detail = '[name="product_id_order_detail"]';
var product_price_show = ps15x ? '.product_price_show' : 'td:nth-child(3)';
var total_product = ps15x ? '.total_product:last' : 'td:nth-child(7)';
var product_quantity_show = ps15x ? '.product_quantity_show' : '.productQuantity:first';
/* Place our "Merchandise Return" fieldset under "Product" */
if (ps15x) {
$('#sonice_retour_env').insertAfter($('form.container-command-top-spacing:first'));
} else {
$('#sonice_retour_env').insertAfter($('#orderProducts').parent().parent());
}
/* Drag'n'Drop */
$('#product_drop').droppable({
accept: '#orderProducts tr',
drop: function (ev, ui) {
var pro = ui.draggable[0].innerHTML;
var proID = parseInt(ui.draggable.find(edit_product_id_order_detail).val());
if (isNaN(proID))
proID = parseInt(getQueryVariable(ui.draggable.find('td:nth-child(2) > a').attr('href'), 'id_product'));
// var qtyTotal = parseInt(ui.draggable.find('.product_quantity_show').text());
var qty = parseInt($('.sonice_retour_tbody:last').find('.sonice_retour_choseProd[rel="' + proID + '"]').val());
var qtyLeft = parseInt($('.sonice_retour_tbody:last').find('.sonice_retour_prodLeft[rel="' + proID + '"]').val());
var pu = ui.draggable.find(product_price_show).text();
if (qtyLeft > 0) {
if ($('#sonice_retour_landing_area').length)
$('#sonice_retour_landing_area').remove();
$('.sonice_retour_tbody:last').find('.sonice_retour_choseProd[rel="' + proID + '"]').val(qty);
$(this).find('tbody').append('<tr>' + pro + '</tr>').find('.product_quantity_show').text('1');
$('.sonice_retour_tbody:last').find(total_product).text(pu);
$('.sonice_retour_tbody:last').find('.sonice_retour_prodLeft[rel="' + proID + '"]').val(qtyLeft - 1);
if ($('.sonice_retour_tbody:last').find('.sonice_retour_choseProd[rel="' + proID + '"]').length) {
var value = parseInt($('.sonice_retour_tbody:last').find('.sonice_retour_choseProd[rel="' + proID + '"]').val()) + 1;
$('.sonice_retour_tbody:last').find('.sonice_retour_choseProd[rel="' + proID + '"]').val(value);
}
else
$('.sonice_retour_tbody:last').prepend(
'<input type="hidden" class="sonice_retour_choseProd" rel="' + proID + '" value="1">'
);
$('.sonice_retour_tbody:last').find('.tooltip').remove();
$('.sonice_retour_tbody:last tr').draggable({
helper: 'clone',
revert: 'invalid',
cursor: 'auto'
});
if (!$('#sonice_retour_drop').hasClass('sonice_retour_selectedTable')) {
$('.sonice_retour_selectedTable').removeClass('sonice_retour_selectedTable');
$('#sonice_retour_drop').addClass('sonice_retour_selectedTable');
}
/* For PS1.4, disable input about returning a product */
$('.sonice_retour_tbody:last').find('input').attr('disabled', true);
}
}
});
$('#content').droppable({
accept: '.sonice_retour_tbody tr',
drop: function (ev, ui) {
var proID = /*'toto'; /*/parseInt(ui.draggable.find(edit_product_id_order_detail).val());
if (isNaN(proID))
proID = parseInt(getQueryVariable(ui.draggable.find('td:nth-child(2) > a').attr('href'), 'id_product'));
// Remove product from return list
ui.draggable['context'].remove();
var qtyC = parseInt($('.sonice_retour_tbody').find('.sonice_retour_choseProd[rel="' + proID + '"]:last').val()) - 1;
var qtyP = parseInt($('.sonice_retour_tbody').find('.sonice_retour_prodLeft[rel="' + proID + '"]:last').val()) + 1;
// Update Product left variables
$('.sonice_retour_tbody').find('.sonice_retour_choseProd[rel="' + proID + '"]:last').val(qtyC);
$('.sonice_retour_tbody').find('.sonice_retour_prodLeft[rel="' + proID + '"]:last').val(qtyP);
$('.sonice_retour_choseProd[value="0"]').remove();
// Add Drag' n' Drop field
// setTimeout because asynchronous, script doesn't have time to remove tr before this checking
setTimeout(function () {
if (!$('.sonice_retour_tbody:last tr').length)
$('#sonice_retour_dragndropTemplate tr').clone().appendTo('.sonice_retour_tbody:last').attr('id', 'sonice_retour_landing_area');
}, 50);
}
});
$('#orderProducts tr').not(':first').draggable({
helper: 'clone',
revert: 'invalid',
cursor: 'auto',
stack: '#orderProducts tr',
distance: 0
});
if (!ps15x) {
// Add id_order_detail in ui-draggable element
$('.sonice_retour_prodLeft').each(function (i) {
var id_order_detail = $(this).attr('rel');
console.log($('.ui-draggable'), i);
$($('.ui-draggable').get(i)).append('<input type="hidden" name="product_id_order_detail" value="' + id_order_detail + '">');
});
}
/* Action buttons */
$('#actionButtonPrint').click(function () {
if ($('input[name="sonice_retour[action]"]').length)
$('input[name="sonice_retour[action]"]').remove();
$('#sonice_retour').append('<input type="hidden" name="sonice_retour[action]" value="print">');
});
$('#actionButtonSave').click(function () {
if ($('input[name="sonice_retour[action]"]').length)
$('input[name="sonice_retour[action]"]').remove();
$('#sonice_retour').append('<input type="hidden" name="sonice_retour[action]" value="save">');
});
$('#actionButtonSend, #actionButtonSave, #actionButtonPrint').click(function () {
$('.sonice_retour_selectedTable').find('input[name="sonice_retour_pending[id_order_return]"]').attr('name', 'sonice_retour[id_order_return]');
if ($('.sonice_retour_selectedTable').find('.sonice_retour_choseProd').length) {
if ($('.sonice_retour_selectedTable').find('tfoot td').length && $('input[name="sonice_retour[action]"]').val() === 'print') {
// Means find PDF
if ($('#sonice_retour_printing_type').val() == 'window')
window.open($('.sonice_retour_selectedTable').find('tfoot td').text(), 'Étiquette', 'height=1024,width=762');
else
$('#iframe_sonice_retour').attr('src', $('.sonice_retour_selectedTable').find('tfoot td').text()).load(function () {
this.contentWindow.print();
});
return (true);
}
else {
var id_order_details = [];
var id_order_details_quantity = [];
if ($('#sonice_retour_drop').hasClass('sonice_retour_selectedTable'))
$('input[name="sonice_retour[newReturn]"]').val(1);
else
$('input[name="sonice_retour[newReturn]"]').val(0);
$('.sonice_retour_choseProd[value="0"]').remove();
if (demo && $(this).attr('id') === 'actionButtonSend') {
plug.alert($('#demo_send_warning').val());
return (false);
}
$('.sonice_retour_selectedTable .sonice_retour_choseProd').each(function () {
id_order_details.push($(this).attr('rel'));
id_order_details_quantity.push($(this).val());
});
$('#actionLoader').show();
//$('#sonice_retour_loader').show();
$.ajax({
type: 'POST',
url: $('#get_label_url').val(),
dataType: 'jsonp',
data: {
id_order: $('[name="sonice_retour[id_order]"]').val(),
id_order_details: id_order_details,
id_order_details_quantity: id_order_details_quantity,
id_return: $('.sonice_retour_selectedTable').attr('rel')
},
success: function (data) {
$('#sonice_retour_return_done').val(1);
$('.sonice_retour_tbody:last tr').hasClass('ui-draggable') && $('.sonice_retour_tbody:last tr').draggable('destroy');
$('#actionLoader').hide();
$('#sonice_retour_loader').hide();
var id_order = $('[name="sonice_retour[id_order]"]').val();
if (data.console)
plug.alert(data.console + '\n' + data.pdfs[id_order].errorID + ': ' + data.pdfs[id_order].error);
if (typeof(data.pdfs) === 'undefined') {
plug.alert('Une erreur s\'est produite :\n\n' + data.responseText);
return false;
}
//$('#sonice_retour > div.metadata-command > dl:nth-child(3) > dd').text(data.pdfs[id_order].parcelNumber);
$('.sonice_retour_selectedTable').append('<tfoot style="display: none;"><td>' + data.pdfs[id_order].PdfUrl + '</td></tfoot>');
// metadata
if ($('.sonice_retour_selectedTable').prev().hasClass('metadata-command')) {
$('.sonice_retour_selectedTable').prev().remove();
}
var metadata = $('.metadata-model').clone().removeClass().addClass('metadata-command').show().insertBefore($('.sonice_retour_selectedTable'));
$(metadata).find('.metadata-date').text(data.pdfs[id_order].date);
$(metadata).find('.metadata-id_order_return').text(data.pdfs[id_order].id_return);
$(metadata).find('.metadata-tracking a')
.attr('href', 'http://www.colissimo.fr/portail_colissimo/suivreResultat.do?parcelnumber=' + data.pdfs[id_order].parcelNumber)
.text(data.pdfs[id_order].parcelNumber);
$(metadata).find('.metadata-state').text(data.pdfs[id_order].state).parent().attr('style', 'color: ' + data.pdfs[id_order].color);
$(metadata).find('.sonice_retour_select option[value="2"]').attr('selected', true);
},
error: function (data) {
window.console && console.log(data);
$('#sonice_retour_loader').hide();
$('#actionLoader').hide();
if (typeof(data.pdfs) === 'undefined') {
plug.alert('Une erreur s\'est produite :\n\n' + data.responseText);
return false;
}
}
});
}
}
else
plug.alert($('#sonice_retour_alert_drag').val());
});
// Change return state
$('#sonice_retour_env').delegate('.sonice_retour_select', 'change', function () {
var selector = $(this);
// Change the status in DB
$.ajax({
type: 'POST',
url: $('#change_return_state_url').val(),
dataType: 'json',
data: {
id: $(this).attr('rel'),
state: $(this).find(':selected').val()
},
success: function (data) {
console.log(data);
selector.parent().parent().find('.sonice_retour_succeed').show().delay(2000).fadeOut('slow');
},
error: function (data) {
console.log(data);
selector.parent().parent().find('.sonice_retour_fail').fadeIn('slow').delay(2000).fadeOut('slow');
}
});
});
if ($('#sonice_retour_alreadyReturned').length) {
// Fill tables
$('.sonice_retour_tbody_a').each(function () {
var product_list = $(this).find('input[rel]');
fillProductAlreadyReturned($(this), product_list);
});
// Click on table = border
$('.sonice_retour_unselectedTable').click(function () {
$('.sonice_retour_selectedTable').removeClass('sonice_retour_selectedTable');
$(this).toggleClass('sonice_retour_selectedTable');
});
}
// Border the last table
if ($('.sonice_retour_return_to_confirm').length)
$('.metadata-command:first').next('table').addClass('sonice_retour_selectedTable');
// Remove tooltip from our tables
$('#sonice_retour_env').find('.tooltip').remove();
// Return All Button
$('#snr_return_all').click(function () {
try {
$("#orderProducts").find('tr').each(function () {
var draggable = $(this).draggable();
var droppable = $("#product_drop").droppable();
var droppableOffset = droppable.offset();
var draggableOffset = draggable.offset();
var dx = droppableOffset.left - draggableOffset.left;
var dy = droppableOffset.top - draggableOffset.top;
draggable.simulate('drag', {
dx: dx,
dy: dy
});
});
} catch ($e) {
plug.alert($e);
}
});
});

View File

@@ -0,0 +1,306 @@
/**
* Plug, the plugins library.<br>
* Easily create HTML advanced elements like dialog box, slider, ...
*
* @author debuss-a <alexandre@debuss-a.me>
* @copyright debuss-a [http://debuss-a.me]
* @license MIT
*/
var plug = (function () {
/**
* @lends plug
*/
return p = {
fn: {
version: '1.0.0',
overlay: function () {
var overlay = document.createElement('div');
overlay.style.backgroundColor = 'black';
overlay.style.opacity = '0.75';
overlay.style.mozOpacity = '0.75';
overlay.style.filter = 'alpha(opacity=75)';
overlay.style.position = 'fixed';
overlay.style.top = 0;
overlay.style.bottom = 0;
overlay.style.left = 0;
overlay.style.right = 0;
overlay.style.zIndex = 6000;
document.body.appendChild(overlay);
return overlay;
},
alert_modal: function () {
var alert_modal = document.createElement('div');
alert_modal.style.width = '50%';
alert_modal.style.position = 'absolute';
alert_modal.style.left = '50%';
alert_modal.style.top = '100px';
alert_modal.style.transform = 'translate(-50%)';
alert_modal.style.zIndex = 6001;
alert_modal.style.border = 'solid 1px #d3d8db';
alert_modal.style.backgroundColor = '#fff';
alert_modal.style.borderRadius = '5px';
alert_modal.className += ' bootstrap';
document.body.appendChild(alert_modal);
return alert_modal;
}
},
/**
* Display an alert dialog box.
*
* @param {string} message The message to display in the dialog box
*/
alert: function (message) {
message = message || '';
var overlay = this.fn.overlay();
var alert_modal = this.fn.alert_modal();
var alert_modal_content = document.createElement('div');
var alert_modal_footer = document.createElement('div');
var alert_modal_footer_ok = document.createElement('button');
var alert_modal_footer_clearfix = document.createElement('div');
// Overlay
overlay.addEventListener('click', function () {
this.parentNode.removeChild(this);
alert_modal.parentNode.removeChild(alert_modal);
});
// Modal content
alert_modal_content.style.padding = '20px';
alert_modal_content.style.borderBottom = '1px solid gainsboro';
alert_modal_content.innerHTML = message;
alert_modal.appendChild(alert_modal_content);
// Modal footer
alert_modal_footer.style.padding = '20px';
alert_modal.appendChild(alert_modal_footer);
// Modal footer button
alert_modal_footer_ok.className += ' button btn btn-primary';
alert_modal_footer_ok.style.float = 'right';
alert_modal_footer_ok.innerText = 'OK';
alert_modal_footer_clearfix.className += ' clearfix';
alert_modal_footer_clearfix.innerHTML = '&nbsp;';
alert_modal_footer.appendChild(alert_modal_footer_ok);
alert_modal_footer.appendChild(alert_modal_footer_clearfix);
alert_modal.appendChild(alert_modal_footer);
// Event
alert_modal_footer_ok.addEventListener('click', function () {
overlay.parentNode.removeChild(overlay);
alert_modal.parentNode.removeChild(alert_modal);
});
document.addEventListener('keydown', function (e) {
e.keyCode === 27 && (
this.removeEventListener('keydown', arguments.callee),
overlay.parentNode.removeChild(overlay),
alert_modal.parentNode.removeChild(alert_modal)
);
});
alert_modal_footer_ok.focus();
},
/**
* Display a confirm dialog box.
*
* @param {string} title Title of the dialog box, default is "Attention" (Can be HTML code)
* @param {string} content Content of the dialog box (Can be HTML code)
* @param {function} on_accept Callback if user accepts
* @param {function} on_cancel Callback if user denies
*/
confirm: function (title, content, on_accept, on_cancel) {
title = title || 'Attention !';
content = content || '';
var overlay = this.fn.overlay();
var alert_modal = this.fn.alert_modal();
var alert_modal_header = document.createElement('div');
var alert_modal_content = document.createElement('div');
var alert_modal_footer = document.createElement('div');
var alert_modal_footer_cancel = document.createElement('button');
var alert_modal_footer_ok = document.createElement('button');
// Overlay
overlay.addEventListener('click', function () {
this.parentNode.removeChild(overlay);
alert_modal.parentNode.removeChild(alert_modal);
});
// Modal title
alert_modal_header.style.padding = '20px';
alert_modal_header.style.fontSize = '16px';
alert_modal_header.style.fontWeight = 'bold';
alert_modal_header.style.borderBottom = '1px solid gainsboro';
alert_modal_header.innerHTML = title;
alert_modal.appendChild(alert_modal_header);
// Modal content
alert_modal_content.style.padding = '20px';
alert_modal_content.style.borderBottom = '1px solid gainsboro';
alert_modal_content.innerHTML = content;
alert_modal.appendChild(alert_modal_content);
// Modal footer
alert_modal_footer.style.padding = '20px';
alert_modal.appendChild(alert_modal_footer);
// Modal footer button
alert_modal_footer_cancel.className += ' button btn btn-danger';
alert_modal_footer_cancel.innerText = 'Cancel';
alert_modal_footer_ok.className += ' button btn btn-primary';
alert_modal_footer_ok.style.float = 'right';
alert_modal_footer_ok.innerText = 'OK';
alert_modal_footer.appendChild(alert_modal_footer_cancel);
alert_modal_footer.appendChild(alert_modal_footer_ok);
alert_modal.appendChild(alert_modal_footer);
// Events
alert_modal_footer_cancel.addEventListener('click', function () {
overlay.parentNode.removeChild(overlay);
alert_modal.parentNode.removeChild(alert_modal);
typeof(on_cancel) === 'function' && on_cancel();
});
alert_modal_footer_ok.addEventListener('click', function () {
overlay.parentNode.removeChild(overlay);
alert_modal.parentNode.removeChild(alert_modal);
typeof(on_accept) === 'function' && on_accept();
});
document.addEventListener('keydown', function (e) {
e.keyCode === 27 && (
this.removeEventListener('keydown', arguments.callee),
overlay.parentNode.removeChild(overlay),
alert_modal.parentNode.removeChild(alert_modal),
typeof(on_cancel) === 'function' && on_cancel()
);
});
alert_modal_footer_ok.focus();
},
/**
* Display a prompt dialog box.
*
* @param {string} message The message to display in the dialog box
* @param {string} default_value The default value
* @param {function} on_accept Callback if user accepts
* @param {function} on_cancel Callback if user denies
*/
prompt: function (message, default_value, on_accept, on_cancel) {
message = message || '';
default_value = default_value || '';
var overlay = this.fn.overlay();
var alert_modal = this.fn.alert_modal();
var alert_modal_content = document.createElement('div');
var alert_modal_content_input = document.createElement('input');
var alert_modal_footer = document.createElement('div');
var alert_modal_footer_cancel = document.createElement('button');
var alert_modal_footer_ok = document.createElement('button');
// Overlay
overlay.addEventListener('click', function () {
this.parentNode.removeChild(overlay);
alert_modal.parentNode.removeChild(alert_modal);
});
// Modal content
alert_modal_content.style.padding = '20px';
alert_modal_content.style.borderBottom = '1px solid gainsboro';
alert_modal_content.innerHTML = message + '<br>';
alert_modal_content_input.style.width = '100%';
alert_modal_content_input.style.padding = '5px';
alert_modal_content_input.value = default_value;
alert_modal_content.appendChild(alert_modal_content_input);
alert_modal.appendChild(alert_modal_content);
// Modal footer
alert_modal_footer.style.padding = '20px';
alert_modal.appendChild(alert_modal_footer);
// Modal footer button
alert_modal_footer_cancel.className += ' button btn btn-danger';
alert_modal_footer_cancel.innerText = 'Cancel';
alert_modal_footer_ok.className += ' button btn btn-primary';
alert_modal_footer_ok.style.float = 'right';
alert_modal_footer_ok.innerText = 'OK';
alert_modal_footer.appendChild(alert_modal_footer_cancel);
alert_modal_footer.appendChild(alert_modal_footer_ok);
alert_modal.appendChild(alert_modal_footer);
// Events
alert_modal_footer_cancel.addEventListener('click', function () {
overlay.parentNode.removeChild(overlay);
alert_modal.parentNode.removeChild(alert_modal);
typeof(on_cancel) === 'function' && on_cancel();
});
alert_modal_footer_ok.addEventListener('click', function () {
var entered_value = alert_modal.querySelector('input').value;
overlay.parentNode.removeChild(overlay);
alert_modal.parentNode.removeChild(alert_modal);
typeof(on_accept) === 'function' && on_accept(entered_value);
});
document.addEventListener('keydown', function (e) {
e.keyCode === 27 && (
this.removeEventListener('keydown', arguments.callee),
overlay.parentNode.removeChild(overlay),
alert_modal.parentNode.removeChild(alert_modal),
typeof(on_cancel) === 'function' && on_cancel()
);
});
alert_modal_footer_ok.focus();
},
switch: function (elements) {
elements.each(function (ind) {
var label_yes = document.createElement('label');
var label_no = document.createElement('label');
var input_yes = document.createElement('input');
var input_no = document.createElement('input');
var a_slider = document.createElement('a');
var element_id_yes = elements[ind].querySelector('input[type="radio"]').getAttribute('name').replace(/\W+/g, '_') + '_on';
var element_id_no = elements[ind].querySelector('input[type="radio"]').getAttribute('name').replace(/\W+/g, '_') + '_off';
var yes_selected = elements[ind].querySelector('input[type="radio"][value="1"]').checked;
var no_selected = elements[ind].querySelector('input[type="radio"][value="0"]').checked;
elements[ind].querySelector('input[type="radio"][value="1"]').id = element_id_yes;
elements[ind].querySelector('input[type="radio"][value="0"]').id = element_id_no;
label_yes.setAttribute('for', element_id_yes);
label_yes.innerText = 'Oui';
label_no.setAttribute('for', element_id_no);
label_no.innerText = 'Non';
input_yes.id = element_id_yes;
input_yes.type = 'radio';
input_yes.setAttribute('name', elements[ind].querySelector('input[type="radio"]').getAttribute('name'));
input_yes.value = 1;
input_yes.checked = (yes_selected || (!yes_selected && !no_selected)) ? true : false;
input_no.id = element_id_no;
input_no.type = 'radio';
input_no.setAttribute('name', elements[ind].querySelector('input[type="radio"]').getAttribute('name'));
input_no.value = 0;
input_no.checked = no_selected;
a_slider.className = 'slide-button btn';
elements[ind].innerHTML = '';
elements[ind].className += ' switch prestashop-switch fixed-width-lg';
elements[ind].appendChild(input_yes);
elements[ind].appendChild(label_yes);
elements[ind].appendChild(input_no);
elements[ind].appendChild(label_no);
elements[ind].appendChild(a_slider);
});
}
};
}());

View File

@@ -0,0 +1,61 @@
/** NOTICE OF LICENSE
*
* This source file is subject to a commercial license from SARL SMC
* Use, copy, modification or distribution of this source file without written
* license agreement from the SARL SMC is strictly forbidden.
* In order to obtain a license, please contact us: support.gosport@common-services.com
* ...........................................................................
* INFORMATION SUR LA LICENCE D'UTILISATION
*
* L'utilisation de ce fichier source est soumise a une licence commerciale
* concedee par la societe SMC
* Toute utilisation, reproduction, modification ou distribution du present
* fichier source sans contrat de licence ecrit de la part de la SARL SMC est
* expressement interdite.
* Pour obtenir une licence, veuillez contacter Common-Services Co., Ltd. a l'adresse: contact@common-services.com
* ...........................................................................
*
* @author debuss-a
* @copyright Copyright (c) 2011-2015 Common Services Co Ltd - 90/25 Sukhumvit 81 - 10260 Bangkok - Thailand
* @package CommonServices
* @license Commercial license
*/
$(document).ready(function() {
/**
* Display the last tab seen by the user.
*/
function setCurrentTab()
{
var current_tab = $('#selected_tab').val();
if (typeof(current_tab) !== 'undefined' && current_tab.length)
$('#' + current_tab).click();
else
$('div[id^="conf-"]:first').show();
}
/*
* Tabs
*/
var confDiv = $('div[id^="conf-"]');
var confTab = $('li[id^="menu-"]');
$('li[id^="menu-"], li[id^="menudiv-"]').click(function() {
var divName = 'conf-' + $(this).attr('id').match('^(.*)-(.*)$')[2];
var confVisibleDiv = $('div[id^="conf-"]:visible');
if (confVisibleDiv.attr('id') === divName)
return (false);
confTab.removeClass('selected');
confDiv.fadeOut('fast');
$(this).addClass('selected');
$('#' + divName).delay(195).fadeIn('slow');
$('input[name="current_tab"]').val('#' + divName);
$('input[name="selected_tab"]').val($(this).attr('id'));
});
setCurrentTab();
});

View 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;