first commit

This commit is contained in:
2025-01-06 20:47:25 +01:00
commit 3bdbd78c2f
25591 changed files with 3586440 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import Grid from '../../components/grid/grid';
import BulkActionCheckboxExtension from '../../components/grid/extension/bulk-action-checkbox-extension';
import SubmitBulkExtension from '../../components/grid/extension/submit-bulk-action-extension';
import LinkRowActionExtension from '../../components/grid/extension/link-row-action-extension';
import SubmitRowActionExtension from '../../components/grid/extension/action/row/submit-row-action-extension';
const $ = window.$;
$(() => {
const backupGrid = new Grid('backup');
backupGrid.addExtension(new BulkActionCheckboxExtension());
backupGrid.addExtension(new SubmitBulkExtension());
backupGrid.addExtension(new LinkRowActionExtension());
backupGrid.addExtension(new SubmitRowActionExtension());
});

View File

@@ -0,0 +1,32 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import SpecificPriceFormHandler from './specific-price-form-handler';
const $ = window.$;
$(() => {
new SpecificPriceFormHandler();
});

View File

@@ -0,0 +1,497 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
const $ = window.$;
class SpecificPriceFormHandler {
constructor() {
this.prefixCreateForm = 'form_step2_specific_price_';
this.prefixEditForm = 'form_modal_';
this.editModalIsOpen = false;
this.$createPriceFormDefaultValues = new Object();
this.storePriceFormDefaultValues();
this.loadAndDisplayExistingSpecificPricesList();
this.configureAddPriceFormBehavior();
this.configureEditPriceModalBehavior();
this.configureDeletePriceButtonsBehavior();
this.configureMultipleModalsBehavior();
}
/**
* @private
*/
loadAndDisplayExistingSpecificPricesList() {
var listContainer = $('#js-specific-price-list');
var url = listContainer.data('listingUrl').replace(/list\/\d+/, 'list/' + this.getProductId());
$.ajax({
type: 'GET',
url: url,
})
.done(specificPrices => {
var tbody = listContainer.find('tbody');
tbody.find('tr').remove();
if (specificPrices.length > 0) {
listContainer.removeClass('hide');
} else {
listContainer.addClass('hide');
}
var specificPricesList = this.renderSpecificPricesListingAsHtml(specificPrices);
tbody.append(specificPricesList);
});
}
/**
* @param array specificPrices
*
* @returns string
*
* @private
*/
renderSpecificPricesListingAsHtml(specificPrices) {
var specificPricesList = '';
var self = this;
$.each(specificPrices, (index, specificPrice) => {
var deleteUrl = $('#js-specific-price-list').attr('data-action-delete').replace(/delete\/\d+/, 'delete/' + specificPrice.id_specific_price);
var row = self.renderSpecificPriceRow(specificPrice, deleteUrl);
specificPricesList = specificPricesList + row;
});
return specificPricesList;
}
/**
* @param Object specificPrice
* @param string deleteUrl
*
* @returns string
*
* @private
*/
renderSpecificPriceRow(specificPrice, deleteUrl) {
var specificPriceId = specificPrice.id_specific_price;
var row = '<tr>' +
'<td>' + specificPrice.rule_name + '</td>' +
'<td>' + specificPrice.attributes_name + '</td>' +
'<td>' + specificPrice.currency + '</td>' +
'<td>' + specificPrice.country + '</td>' +
'<td>' + specificPrice.group + '</td>' +
'<td>' + specificPrice.customer + '</td>' +
'<td>' + specificPrice.fixed_price + '</td>' +
'<td>' + specificPrice.impact + '</td>' +
'<td>' + specificPrice.period + '</td>' +
'<td>' + specificPrice.from_quantity + '</td>' +
'<td>' + (specificPrice.can_delete ? '<a href="' + deleteUrl + '" class="js-delete delete btn tooltip-link delete pl-0 pr-0"><i class="material-icons">delete</i></a>' : '') + '</td>' +
'<td>' + (specificPrice.can_edit ? '<a href="#" data-specific-price-id="' + specificPriceId + '" class="js-edit edit btn tooltip-link delete pl-0 pr-0"><i class="material-icons">edit</i></a>' : '') + '</td>' +
'</tr>';
return row;
}
/**
* @private
*/
configureAddPriceFormBehavior() {
const usePrefixForCreate = true;
var selectorPrefix = this.getPrefixSelector(usePrefixForCreate);
$('#specific_price_form .js-cancel').click(() => {
this.resetCreatePriceFormDefaultValues();
$('#specific_price_form').collapse('hide');
});
$('#specific_price_form .js-save').on('click', () => this.submitCreatePriceForm());
$('#js-open-create-specific-price-form').on('click', () => this.loadAndFillOptionsForSelectCombinationInput(usePrefixForCreate));
$(selectorPrefix + 'leave_bprice').on('click', () => this.enableSpecificPriceFieldIfEligible(usePrefixForCreate));
$(selectorPrefix + 'sp_reduction_type').on('change', () => this.enableSpecificPriceTaxFieldIfEligible(usePrefixForCreate));
}
/**
* @private
*/
configureEditPriceFormInsideModalBehavior() {
const usePrefixForCreate = false;
var selectorPrefix = this.getPrefixSelector(usePrefixForCreate);
$('#form_modal_cancel').click(() => this.closeEditPriceModalAndRemoveForm());
$('#form_modal_close').click(() => this.closeEditPriceModalAndRemoveForm());
$('#form_modal_save').click(() => this.submitEditPriceForm());
this.loadAndFillOptionsForSelectCombinationInput(usePrefixForCreate);
$(selectorPrefix + 'leave_bprice').on('click', () => this.enableSpecificPriceFieldIfEligible(usePrefixForCreate));
$(selectorPrefix + 'sp_reduction_type').on('change', () => this.enableSpecificPriceTaxFieldIfEligible(usePrefixForCreate));
this.reinitializeDatePickers();
this.initializeLeaveBPriceField(usePrefixForCreate);
this.enableSpecificPriceTaxFieldIfEligible(usePrefixForCreate);
}
/**
* @private
*/
reinitializeDatePickers() {
$('.datepicker input').datetimepicker({format: 'YYYY-MM-DD'});
}
/**
* @param boolean usePrefixForCreate
*
* @private
*/
initializeLeaveBPriceField(usePrefixForCreate) {
var selectorPrefix = this.getPrefixSelector(usePrefixForCreate);
if ($(selectorPrefix + 'sp_price').val() != '') {
$(selectorPrefix + 'sp_price').prop('disabled', false);
$(selectorPrefix + 'leave_bprice').prop('checked', false);
}
}
/**
* @private
*/
configureEditPriceModalBehavior() {
$(document).on('click', '#js-specific-price-list .js-edit', (event) => {
event.preventDefault();
var specificPriceId = $(event.currentTarget).data('specificPriceId');
this.openEditPriceModalAndLoadForm(specificPriceId);
});
}
/**
* @private
*/
configureDeletePriceButtonsBehavior() {
$(document).on('click', '#js-specific-price-list .js-delete', (event) => {
event.preventDefault();
this.deleteSpecificPrice(event.currentTarget);
});
}
/**
* @see https://vijayasankarn.wordpress.com/2017/02/24/quick-fix-scrolling-and-focus-when-multiple-bootstrap-modals-are-open/
*/
configureMultipleModalsBehavior() {
$('.modal').on('hidden.bs.modal', () => {
if (this.editModalIsOpen) {
$('body').addClass('modal-open');
}
});
}
/**
* @private
*/
submitCreatePriceForm() {
const url = $('#specific_price_form').attr('data-action');
const data = $('#specific_price_form input, #specific_price_form select, #form_id_product').serialize();
$('#specific_price_form .js-save').attr('disabled', 'disabled');
$.ajax({
type: 'POST',
url: url,
data: data,
})
.done(response => {
showSuccessMessage(translate_javascripts['Form update success']);
this.resetCreatePriceFormDefaultValues();
$('#specific_price_form').collapse('hide');
this.loadAndDisplayExistingSpecificPricesList();
$('#specific_price_form .js-save').removeAttr('disabled');
})
.fail(errors => {
showErrorMessage(errors.responseJSON);
$('#specific_price_form .js-save').removeAttr('disabled');
});
}
/**
* @private
*/
submitEditPriceForm() {
const baseUrl = $('#edit-specific-price-modal-form').attr('data-action');
const specificPriceId = $('#edit-specific-price-modal-form').data('specificPriceId');
const url = baseUrl.replace(/update\/\d+/, 'update/' + specificPriceId);
const data = $('#edit-specific-price-modal-form input, #edit-specific-price-modal-form select, #form_id_product').serialize();
$('#edit-specific-price-modal-form .js-save').attr('disabled', 'disabled');
$.ajax({
type: 'POST',
url: url,
data: data,
})
.done(response => {
showSuccessMessage(translate_javascripts['Form update success']);
this.closeEditPriceModalAndRemoveForm();
this.loadAndDisplayExistingSpecificPricesList();
$('#edit-specific-price-modal-form .js-save').removeAttr('disabled');
})
.fail(errors => {
showErrorMessage(errors.responseJSON);
$('#edit-specific-price-modal-form .js-save').removeAttr('disabled');
});
}
/**
* @param string clickedLink selector
*
* @private
*/
deleteSpecificPrice(clickedLink) {
modalConfirmation.create(translate_javascripts['This will delete the specific price. Do you wish to proceed?'], null, {
onContinue: () => {
var url = $(clickedLink).attr('href');
$(clickedLink).attr('disabled', 'disabled');
$.ajax({
type: 'GET',
url: url,
})
.done(response => {
this.loadAndDisplayExistingSpecificPricesList();
showSuccessMessage(response);
$(clickedLink).removeAttr('disabled');
})
.fail(errors => {
showErrorMessage(errors.responseJSON);
$(clickedLink).removeAttr('disabled');
});
}
}).show();
}
/**
* Store 'add specific price' form values
* for future usage
*
* @private
*/
storePriceFormDefaultValues() {
var storage = this.$createPriceFormDefaultValues;
$('#specific_price_form').find('select,input').each((index, value) => {
storage[$(value).attr('id')] = $(value).val();
});
$('#specific_price_form').find('input:checkbox').each((index, value) => {
storage[$(value).attr('id')] = $(value).prop('checked');
});
this.$createPriceFormDefaultValues = storage;
}
/**
* @param boolean usePrefixForCreate
*
* @private
*/
loadAndFillOptionsForSelectCombinationInput(usePrefixForCreate) {
var selectorPrefix = this.getPrefixSelector(usePrefixForCreate);
var inputField = $(selectorPrefix + 'sp_id_product_attribute');
var url = inputField.attr('data-action').replace(/product-combinations\/\d+/, 'product-combinations/' + this.getProductId());
$.ajax({
type: 'GET',
url: url,
})
.done(combinations => {
/** remove all options except first one */
inputField.find('option:gt(0)').remove();
$.each(combinations, (index, combination) => {
inputField.append('<option value="' + combination.id + '">' + combination.name + '</option>');
});
if (inputField.data('selectedAttribute') != '0') {
inputField.val(inputField.data('selectedAttribute')).trigger('change');
}
});
}
/**
* @param boolean usePrefixForCreate
*
* @private
*/
enableSpecificPriceTaxFieldIfEligible(usePrefixForCreate) {
var selectorPrefix = this.getPrefixSelector(usePrefixForCreate);
if ($(selectorPrefix + 'sp_reduction_type').val() === 'percentage') {
$(selectorPrefix + 'sp_reduction_tax').hide();
} else {
$(selectorPrefix + 'sp_reduction_tax').show();
}
}
/**
* Reset 'add specific price' form values
* using previously stored default values
*
* @private
*/
resetCreatePriceFormDefaultValues() {
var previouslyStoredValues = this.$createPriceFormDefaultValues;
$('#specific_price_form').find('input').each((index, value) => {
$(value).val(previouslyStoredValues[$(value).attr('id')]);
});
$('#specific_price_form').find('select').each((index, value) => {
$(value).val(previouslyStoredValues[$(value).attr('id')]).change();
});
$('#specific_price_form').find('input:checkbox').each((index, value) => {
$(value).prop("checked", true);
});
}
/**
* @param boolean usePrefixForCreate
*
* @private
*/
enableSpecificPriceFieldIfEligible(usePrefixForCreate) {
var selectorPrefix = this.getPrefixSelector(usePrefixForCreate);
$(selectorPrefix + 'sp_price').prop('disabled', $(selectorPrefix + 'leave_bprice').is(':checked')).val('');
}
/**
* Open 'edit specific price' form into a modal
*
* @param integer specificPriceId
*
* @private
*/
openEditPriceModalAndLoadForm(specificPriceId) {
const url = $('#js-specific-price-list').data('actionEdit').replace(/form\/\d+/, 'form/' + specificPriceId);
$('#edit-specific-price-modal').modal("show");
this.editModalIsOpen = true;
$.ajax({
type: 'GET',
url: url,
})
.done(response => {
this.insertEditSpecificPriceFormIntoModal(response);
$('#edit-specific-price-modal-form').data('specificPriceId', specificPriceId);
this.configureEditPriceFormInsideModalBehavior();
})
.fail(errors => {
showErrorMessage(errors.responseJSON);
});
}
/**
* @private
*/
closeEditPriceModalAndRemoveForm() {
$('#edit-specific-price-modal').modal("hide");
this.editModalIsOpen = false;
var formLocationHolder = $('#edit-specific-price-modal-form');
formLocationHolder.empty();
}
/**
* @param string form: HTML 'edit specific price' form
*
* @private
*/
insertEditSpecificPriceFormIntoModal(form) {
var formLocationHolder = $('#edit-specific-price-modal-form');
formLocationHolder.empty();
formLocationHolder.append(form);
}
/**
* Get product ID for current Catalog Product page
*
* @returns integer
*
* @private
*/
getProductId() {
return $('#form_id_product').val();
}
/**
* @param boolean usePrefixForCreate
*
* @returns string
*
* @private
*/
getPrefixSelector(usePrefixForCreate) {
if (usePrefixForCreate == true) {
return '#' + this.prefixCreateForm;
} else {
return '#' + this.prefixEditForm;
}
}
}
export default SpecificPriceFormHandler;

View File

@@ -0,0 +1,171 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
const $ = window.$;
/**
* Class is responsible for managing test email sending
*/
class EmailSendingTest {
constructor() {
this.$successAlert = $('.js-test-email-success');
this.$errorAlert = $('.js-test-email-errors');
this.$loader = $('.js-test-email-loader');
this.$sendEmailBtn = $('.js-send-test-email-btn');
this.$sendEmailBtn.on('click', (event) => {
this._handle(event);
});
}
/**
* Handle test email sending
*
* @param {Event} event
*
* @private
*/
_handle(event) {
// fill test email sending form with configured values
$('#test_email_sending_mail_method').val($('input[name="form[email_config][mail_method]"]:checked').val());
$('#test_email_sending_smtp_server').val($('#form_smtp_config_server').val());
$('#test_email_sending_smtp_username').val($('#form_smtp_config_username').val());
$('#test_email_sending_smtp_password').val($('#form_smtp_config_password').val());
$('#test_email_sending_smtp_port').val($('#form_smtp_config_port').val());
$('#test_email_sending_smtp_encryption').val($('#form_smtp_config_encryption').val());
const $testEmailSendingForm = $(event.currentTarget).closest('form');
this._resetMessages();
this._hideSendEmailButton();
this._showLoader();
$.post({
url: $testEmailSendingForm.attr('action'),
data: $testEmailSendingForm.serialize(),
}).then((response) => {
this._hideLoader();
this._showSendEmailButton();
if (0 !== response.errors.length) {
this._showErrors(response.errors);
return;
}
this._showSuccess();
});
}
/**
* Make sure that additional content (alerts, loader) is not visible
*
* @private
*/
_resetMessages() {
this._hideSuccess();
this._hideErrors();
}
/**
* Show success message
*
* @private
*/
_showSuccess() {
this.$successAlert.removeClass('d-none');
}
/**
* Hide success message
*
* @private
*/
_hideSuccess() {
this.$successAlert.addClass('d-none');
}
/**
* Show loader during AJAX call
*
* @private
*/
_showLoader() {
this.$loader.removeClass('d-none');
}
/**
* Hide loader
*
* @private
*/
_hideLoader() {
this.$loader.addClass('d-none');
}
/**
* Show errors
*
* @param {Array} errors
*
* @private
*/
_showErrors(errors) {
errors.forEach((error) => {
this.$errorAlert.append('<p>' + error + '</p>');
});
this.$errorAlert.removeClass('d-none');
}
/**
* Hide errors
*
* @private
*/
_hideErrors() {
this.$errorAlert.addClass('d-none').empty();
}
/**
* Show send email button
*
* @private
*/
_showSendEmailButton() {
this.$sendEmailBtn.removeClass('d-none');
}
/**
* Hide send email button
*
* @private
*/
_hideSendEmailButton() {
this.$sendEmailBtn.addClass('d-none');
}
}
export default EmailSendingTest;

View File

@@ -0,0 +1,54 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import EmailSendingTest from './email-sending-test';
import SmtpConfigurationToggler from './smtp-configuration-toggler';
import Grid from '../../components/grid/grid';
import ReloadListActionExtension from '../../components/grid/extension/reload-list-extension';
import ExportToSqlManagerExtension from '../../components/grid/extension/export-to-sql-manager-extension';
import FiltersResetExtension from '../../components/grid/extension/filters-reset-extension';
import SortingExtension from '../../components/grid/extension/sorting-extension';
import BulkActionCheckboxExtension from '../../components/grid/extension/bulk-action-checkbox-extension';
import SubmitBulkExtension from '../../components/grid/extension/submit-bulk-action-extension';
import SubmitGridExtension from '../../components/grid/extension/submit-grid-action-extension';
import LinkRowActionExtension from '../../components/grid/extension/link-row-action-extension';
const $ = window.$;
$(() => {
const emailLogsGrid = new Grid('email_logs');
emailLogsGrid.addExtension(new ReloadListActionExtension());
emailLogsGrid.addExtension(new ExportToSqlManagerExtension());
emailLogsGrid.addExtension(new FiltersResetExtension());
emailLogsGrid.addExtension(new SortingExtension());
emailLogsGrid.addExtension(new BulkActionCheckboxExtension());
emailLogsGrid.addExtension(new SubmitBulkExtension());
emailLogsGrid.addExtension(new SubmitGridExtension());
emailLogsGrid.addExtension(new LinkRowActionExtension());
new EmailSendingTest();
new SmtpConfigurationToggler();
});

View File

@@ -0,0 +1,70 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
const $ = window.$;
/**
* Class SmtpConfigurationToggler is responsible for showing/hiding SMTP configuration form
*/
class SmtpConfigurationToggler {
constructor() {
$('.js-email-method').on('change', 'input[type="radio"]', (event) => {
const mailMethod = $(event.currentTarget).val();
this._getSmtpMailMethodOption() == mailMethod ? this._showSmtpConfiguration() : this._hideSmtpConfiguration();
});
}
/**
* Show SMTP configuration form
*
* @private
*/
_showSmtpConfiguration() {
$('.js-smtp-configuration').removeClass('d-none');
}
/**
* Hide SMTP configuration
*
* @private
*/
_hideSmtpConfiguration() {
$('.js-smtp-configuration').addClass('d-none');
}
/**
* Get SMTP mail option value
*
* @private
*
* @returns {String}
*/
_getSmtpMailMethodOption() {
return $('.js-email-method').data('smtp-mail-method');
}
}
export default SmtpConfigurationToggler;

View File

@@ -0,0 +1,32 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import ChoiceTable from '../../components/choice-table';
const $ = window.$;
$(() => {
new ChoiceTable();
});

View File

@@ -0,0 +1,155 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
const $ = window.$;
const entityCategories = 0;
const entityProducts = 1;
const entityCombinations = 2;
const entityCustomers = 3;
const entityAddresses = 4;
const entityBrands = 5;
const entitySuppliers = 6;
const entityAlias = 7;
const entityStoreContacts = 8;
export default class FormFieldToggle {
constructor() {
$('.js-entity-select').on('change', this.toggleForm.bind(this));
this.toggleForm();
}
toggleForm() {
let selectedOption = $('#entity').find('option:selected');
let selectedEntity = parseInt(selectedOption.val());
let entityName = selectedOption.text().toLowerCase();
this.toggleEntityAlert(selectedEntity);
this.toggleFields(selectedEntity, entityName);
this.loadAvailableFields(selectedEntity);
}
/**
* Toggle alert warning for selected import entity
*
* @param {int} selectedEntity
*/
toggleEntityAlert(selectedEntity) {
let $alert = $('.js-entity-alert');
if ([entityCategories, entityProducts].includes(selectedEntity)) {
$alert.show();
} else {
$alert.hide();
}
}
/**
* Toggle available options for selected entity
*
* @param {int} selectedEntity
* @param {string} entityName
*/
toggleFields(selectedEntity, entityName) {
const $truncateFormGroup = $('.js-truncate-form-group');
const $matchRefFormGroup = $('.js-match-ref-form-group');
const $regenerateFormGroup = $('.js-regenerate-form-group');
const $forceIdsFormGroup = $('.js-force-ids-form-group');
const $entityNamePlaceholder = $('.js-entity-name');
if (entityStoreContacts === selectedEntity) {
$truncateFormGroup.hide();
} else {
$truncateFormGroup.show();
}
if ([entityProducts, entityCombinations].includes(selectedEntity)) {
$matchRefFormGroup.show();
} else {
$matchRefFormGroup.hide();
}
if ([
entityCategories,
entityProducts,
entityBrands,
entitySuppliers,
entityStoreContacts
].includes(selectedEntity)
) {
$regenerateFormGroup.show();
} else {
$regenerateFormGroup.hide();
}
if ([
entityCategories,
entityProducts,
entityCustomers,
entityAddresses,
entityBrands,
entitySuppliers,
entityStoreContacts,
entityAlias
].includes(selectedEntity)
) {
$forceIdsFormGroup.show();
} else {
$forceIdsFormGroup.hide();
}
$entityNamePlaceholder.html(entityName);
}
/**
* Load available fields for given entity
*
* @param {int} entity
*/
loadAvailableFields(entity) {
const url = -1 === window.location.href.indexOf('index.php') ? '../../../ajax.php' : '../../../../ajax.php';
$.ajax({
url: url,
data: {
getAvailableFields: 1,
entity: entity
},
dataType: 'json',
}).then(response => {
let fields = '';
let $availableFields = $('.js-available-fields');
$availableFields.empty();
for (let i = 0; i < response.length; i++) {
fields += response[i].field;
}
$availableFields.html(fields);
$availableFields.find('[data-toggle="popover"]').popover();
});
}
}

View File

@@ -0,0 +1,268 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import FormFieldToggle from "./FormFieldToggle";
const $ = window.$;
export default class ImportPage {
constructor() {
new FormFieldToggle();
$('.js-from-files-history-btn').on('click', () => this.showFilesHistoryHandler());
$('.js-close-files-history-block-btn').on('click', () => this.closeFilesHistoryHandler());
$('#fileHistoryTable').on('click', '.js-use-file-btn', (event) => this.useFileFromFilesHistory(event));
$('.js-change-import-file-btn').on('click', () => this.changeImportFileHandler());
$('.js-import-file').on('change', () => this.uploadFile());
this.toggleSelectedFile();
this.handleSubmit();
}
/**
* Handle submit and add confirm box in case the toggle button about
* deleting all entities before import is checked
*/
handleSubmit() {
$('.js-import-form').on('submit', function() {
const $this = $(this);
if ($this.find('input[name="truncate"]:checked').val() === '1') {
return confirm(`${$this.data('delete-confirm-message')} ${$.trim($('#entity > option:selected').text().toLowerCase())}?`);
}
});
}
/**
* Check if selected file names exists and if so, then display it
*/
toggleSelectedFile() {
let selectFilename = $('#csv').val();
if (selectFilename.length > 0) {
this.showImportFileAlert(selectFilename);
this.hideFileUploadBlock();
}
}
changeImportFileHandler() {
this.hideImportFileAlert();
this.showFileUploadBlock();
}
/**
* Show files history event handler
*/
showFilesHistoryHandler() {
this.showFilesHistory();
this.hideFileUploadBlock();
}
/**
* Close files history event handler
*/
closeFilesHistoryHandler() {
this.closeFilesHistory();
this.showFileUploadBlock();
}
/**
* Show files history block
*/
showFilesHistory() {
$('.js-files-history-block').removeClass('d-none');
}
/**
* Hide files history block
*/
closeFilesHistory() {
$('.js-files-history-block').addClass('d-none');
}
/**
* Prefill hidden file input with selected file name from history
*/
useFileFromFilesHistory(event) {
let filename = $(event.target).closest('.btn-group').data('file');
$('.js-import-file-input').val(filename);
this.showImportFileAlert(filename);
this.closeFilesHistory();
}
/**
* Show alert with imported file name
*/
showImportFileAlert(filename) {
$('.js-import-file-alert').removeClass('d-none');
$('.js-import-file').text(filename);
}
/**
* Hides selected import file alert
*/
hideImportFileAlert() {
$('.js-import-file-alert').addClass('d-none');
}
/**
* Hides import file upload block
*/
hideFileUploadBlock() {
$('.js-file-upload-form-group').addClass('d-none');
}
/**
* Hides import file upload block
*/
showFileUploadBlock() {
$('.js-file-upload-form-group').removeClass('d-none');
}
/**
* Make file history button clickable
*/
enableFilesHistoryBtn() {
$('.js-from-files-history-btn').removeAttr('disabled');
}
/**
* Show error message if file uploading failed
*
* @param {string} fileName
* @param {integer} fileSize
* @param {string} message
*/
showImportFileError(fileName, fileSize, message) {
const $alert = $('.js-import-file-error');
const fileData = fileName + ' (' + this.humanizeSize(fileSize) + ')';
$alert.find('.js-file-data').html(fileData);
$alert.find('.js-error-message').html(message);
$alert.removeClass('d-none');
}
/**
* Hide file uploading error
*/
hideImportFileError() {
const $alert = $('.js-import-file-error');
$alert.addClass('d-none');
}
/**
* Show file size in human readable format
*
* @param {int} bytes
*
* @returns {string}
*/
humanizeSize(bytes) {
if (typeof bytes !== 'number') {
return '';
}
if (bytes >= 1000000000) {
return (bytes / 1000000000).toFixed(2) + ' GB';
}
if (bytes >= 1000000) {
return (bytes / 1000000).toFixed(2) + ' MB';
}
return (bytes / 1000).toFixed(2) + ' KB';
}
/**
* Upload selected import file
*/
uploadFile() {
this.hideImportFileError();
const $input = $('#file');
const uploadedFile = $input.prop('files')[0];
const maxUploadSize = $input.data('max-file-upload-size');
if (maxUploadSize < uploadedFile.size) {
this.showImportFileError(uploadedFile.name, uploadedFile.size, 'File is too large');
return;
}
const data = new FormData();
data.append('file', uploadedFile);
$.ajax({
type: 'POST',
url: $('.js-import-form').data('file-upload-url'),
data: data,
cache: false,
contentType: false,
processData: false,
}).then(response => {
if (response.error) {
this.showImportFileError(uploadedFile.name, uploadedFile.size, response.error);
return;
}
let filename = response.file.name;
$('.js-import-file-input').val(filename);
this.showImportFileAlert(filename);
this.hideFileUploadBlock();
this.addFileToHistoryTable(filename);
this.enableFilesHistoryBtn();
});
}
/**
* Renders new row in files history table
*
* @param {string} filename
*/
addFileToHistoryTable(filename) {
const $table = $('#fileHistoryTable');
let baseDeleteUrl = $table.data('delete-file-url');
let deleteUrl = baseDeleteUrl + '&filename=' + encodeURIComponent(filename);
let baseDownloadUrl = $table.data('download-file-url');
let downloadUrl = baseDownloadUrl + '&filename=' + encodeURIComponent(filename);
let $template = $table.find('tr:first').clone();
$template.removeClass('d-none');
$template.find('td:first').text(filename);
$template.find('.btn-group').attr('data-file', filename);
$template.find('.js-delete-file-btn').attr('href', deleteUrl);
$template.find('.js-download-file-btn').attr('href', downloadUrl);
$table.find('tbody').append($template);
let filesNumber = $table.find('tr').length - 1;
$('.js-files-history-number').text(filesNumber);
}
}

View File

@@ -0,0 +1,32 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import ImportPage from './ImportPage';
const $ = window.$;
$(() => {
new ImportPage();
});

View File

@@ -0,0 +1,32 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import PositionsListHandler from './positions-list-handler';
const $ = window.$;
$(() => {
new PositionsListHandler();
});

View File

@@ -0,0 +1,284 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
const $ = window.$;
class PositionsListHandler {
constructor() {
if ($("#position-filters").length === 0) {
return;
}
const self = this;
self.$panelSelection = $("#modules-position-selection-panel");
self.$panelSelectionSingleSelection = $("#modules-position-single-selection");
self.$panelSelectionMultipleSelection = $("#modules-position-multiple-selection");
self.$panelSelectionOriginalY = self.$panelSelection.offset().top;
self.$showModules = $("#show-modules");
self.$modulesList = $('.modules-position-checkbox');
self.$hookPosition = $("#hook-position");
self.$hookSearch = $("#hook-search");
self.$modulePositionsForm = $('#module-positions-form');
self.$moduleUnhookButton = $('#unhook-button-position-bottom');
self.$moduleButtonsUpdate = $('.module-buttons-update .btn');
self.handleList();
self.handleSortable();
$('input[name="form[general][enable_tos]"]').on('change', () => self.handle());
}
/**
* Handle all events for Design -> Positions List
*/
handleList() {
const self = this;
$(window).on('scroll', () => {
const $scrollTop = $(window).scrollTop();
self.$panelSelection.css(
'top',
$scrollTop < 20 ? 0 : $scrollTop - self.$panelSelectionOriginalY
);
});
self.$modulesList.on('change', function () {
const $checkedCount = self.$modulesList.filter(':checked').length;
if ($checkedCount === 0) {
self.$moduleUnhookButton.hide();
self.$panelSelection.hide();
self.$panelSelectionSingleSelection.hide();
self.$panelSelectionMultipleSelection.hide();
} else if ($checkedCount === 1) {
self.$moduleUnhookButton.show();
self.$panelSelection.show();
self.$panelSelectionSingleSelection.show();
self.$panelSelectionMultipleSelection.hide();
} else {
self.$moduleUnhookButton.show();
self.$panelSelection.show();
self.$panelSelectionSingleSelection.hide();
self.$panelSelectionMultipleSelection.show();
$('#modules-position-selection-count').html($checkedCount);
}
});
self.$panelSelection.find('button').click(() => {
$('button[name="unhookform"]').trigger('click');
});
self.$hooksList = [];
$('section.hook-panel .hook-name').each(function () {
const $this = $(this);
self.$hooksList.push({
'title': $this.html(),
'element': $this,
'container': $this.parents('.hook-panel')
});
});
self.$showModules.select2();
self.$showModules.on('change', () => {
self.modulesPositionFilterHooks();
});
self.$hookPosition.on('change', () => {
self.modulesPositionFilterHooks();
});
self.$hookSearch.on('input', () => {
self.modulesPositionFilterHooks();
});
$('.hook-checker').on('click', function() {
$(`.hook${$(this).data('hook-id')}`).prop('checked', $(this).prop('checked'));
});
self.$modulesList.on('click', function() {
$(`#Ghook${$(this).data('hook-id')}`).prop(
'checked',
$(`.hook${$(this).data('hook-id')}:not(:checked)`).length === 0
);
});
self.$moduleButtonsUpdate.on('click', function() {
const $btn = $(this);
const $current = $btn.closest('.module-item');
let $destination;
if ($btn.data('way')) {
$destination = $current.next('.module-item');
} else {
$destination = $current.prev('.module-item');
}
if ($destination.length === 0) {
return false;
}
if ($btn.data('way')) {
$current.insertAfter($destination);
} else {
$current.insertBefore($destination);
}
self.updatePositions(
{
hookId: $btn.data('hook-id'),
moduleId: $btn.data('module-id'),
way: $btn.data('way'),
positions: [],
},
$btn.closest('ul')
);
return false;
});
}
/**
* Handle sortable events
*/
handleSortable() {
const self = this;
$('.sortable').sortable({
forcePlaceholderSize: true,
start: function(e, ui) {
$(this).data('previous-index', ui.item.index());
},
update: function($event, ui) {
const [ hookId, moduleId ] = ui.item.attr('id').split('_');
const $data = {
hookId,
moduleId,
way: ($(this).data('previous-index') < ui.item.index()) ? 1 : 0,
positions: [],
};
self.updatePositions(
$data,
$($event.target)
);
},
});
}
updatePositions($data, $list) {
const self = this;
$.each($list.children(), function(index, element) {
$data.positions.push($(element).attr('id'));
});
$.ajax({
type: 'POST',
headers: {'cache-control': 'no-cache'},
url: self.$modulePositionsForm.data('update-url'),
data: $data,
success: () => {
let start = 0;
$.each($list.children(), function(index, element) {
console.log($(element).find('.index-position'));
$(element).find('.index-position').html(++start);
});
window.showSuccessMessage(window.update_success_msg);
}
});
}
/**
* Filter hooks / modules search and everything
* about hooks positions.
*/
modulesPositionFilterHooks() {
const self = this;
const $hookName = self.$hookSearch.val();
const $moduleId = self.$showModules.val();
const $regex = new RegExp(`(${$hookName})`, 'gi');
for (let $id = 0; $id < self.$hooksList.length; $id++) {
self.$hooksList[$id].container.toggle($hookName === '' && $moduleId === 'all');
self.$hooksList[$id].element.html(self.$hooksList[$id].title);
self.$hooksList[$id].container.find('.module-item').removeClass('highlight');
}
// Have select a hook name or a module id
if ($hookName !== '' || $moduleId !== 'all') {
// Prepare set of matched elements
let $hooksToShowFromModule = $();
let $hooksToShowFromHookName = $();
let $currentHooks;
let $start;
for (let $id = 0; $id < self.$hooksList.length; $id++) {
// Prepare highlight when one module is selected
if ($moduleId !== 'all') {
$currentHooks = self.$hooksList[$id].container.find(`.module-position-${$moduleId}`);
if ($currentHooks.length > 0) {
$hooksToShowFromModule = $hooksToShowFromModule.add(self.$hooksList[$id].container);
$currentHooks.addClass('highlight');
}
}
// Prepare highlight when there is a hook name
if ($hookName !== '') {
$start = self.$hooksList[$id].title.toLowerCase().search($hookName.toLowerCase());
if ($start !== -1) {
$hooksToShowFromHookName = $hooksToShowFromHookName.add(self.$hooksList[$id].container);
self.$hooksList[$id].element.html(
self.$hooksList[$id].title.replace(
$regex,
'<span class="highlight">$1</span>'
)
);
}
}
}
// Nothing selected
if ($moduleId === 'all' && $hookName !== '') {
$hooksToShowFromHookName.show();
} else if ($hookName === '' && $moduleId !== 'all') { // Have no hook bug have a module
$hooksToShowFromModule.show();
} else { // Both selected
$hooksToShowFromHookName.filter($hooksToShowFromModule).show();
}
}
if (!self.$hookPosition.prop('checked')) {
for (let $id = 0; $id < self.$hooksList.length; $id++) {
if (self.$hooksList[$id].container.is('.hook-position')) {
self.$hooksList[$id].container.hide();
}
}
}
};
}
export default PositionsListHandler;

View File

@@ -0,0 +1,34 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2017 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import initDatePickers from '../../app/utils/datepicker';
import TranslatableInput from '../../components/translatable-input';
const $ = window.$;
$(() => {
initDatePickers();
new TranslatableInput();
});

View File

@@ -0,0 +1,33 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
const $ = window.$;
$(() => {
// show warning message when currency is changed
$('#form_configuration_default_currency').on('change', function () {
alert($(this).data('warning-message'));
});
});

View File

@@ -0,0 +1,43 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2017 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import Grid from '../../components/grid/grid';
import ReloadListActionExtension from '../../components/grid/extension/reload-list-extension';
import ExportToSqlManagerExtension from '../../components/grid/extension/export-to-sql-manager-extension';
import FiltersResetExtension from '../../components/grid/extension/filters-reset-extension';
import SortingExtension from '../../components/grid/extension/sorting-extension';
import SubmitGridActionExtension from '../../components/grid/extension/submit-grid-action-extension';
const $ = global.$;
$(() => {
const grid = new Grid('logs');
grid.addExtension(new ReloadListActionExtension());
grid.addExtension(new ExportToSqlManagerExtension());
grid.addExtension(new FiltersResetExtension());
grid.addExtension(new SortingExtension());
grid.addExtension(new SubmitGridActionExtension());
});

View File

@@ -0,0 +1,55 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2017 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import Grid from "../../components/grid/grid";
import ReloadListActionExtension from "../../components/grid/extension/reload-list-extension";
import ExportToSqlManagerExtension from "../../components/grid/extension/export-to-sql-manager-extension";
import FiltersResetExtension from "../../components/grid/extension/filters-reset-extension";
import SortingExtension from "../../components/grid/extension/sorting-extension";
import LinkRowActionExtension from "../../components/grid/extension/link-row-action-extension";
import SubmitGridExtension from "../../components/grid/extension/submit-grid-action-extension";
import SubmitBulkExtension from "../../components/grid/extension/submit-bulk-action-extension";
import BulkActionCheckboxExtension from "../../components/grid/extension/bulk-action-checkbox-extension";
import SubmitRowActionExtension from "../../components/grid/extension/action/row/submit-row-action-extension";
import ShowcaseCard from "../../components/showcase-card/showcase-card";
import ShowcaseCardCloseExtension from "../../components/showcase-card/extension/showcase-card-close-extension";
const $ = window.$;
$(() => {
const meta = new Grid('meta');
meta.addExtension(new ReloadListActionExtension());
meta.addExtension(new ExportToSqlManagerExtension());
meta.addExtension(new FiltersResetExtension());
meta.addExtension(new SortingExtension());
meta.addExtension(new LinkRowActionExtension());
meta.addExtension(new SubmitGridExtension());
meta.addExtension(new SubmitBulkExtension());
meta.addExtension(new SubmitRowActionExtension());
meta.addExtension(new BulkActionCheckboxExtension());
const helperBlock = new ShowcaseCard('seo-urls-showcase-card');
helperBlock.addExtension(new ShowcaseCardCloseExtension());
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,36 @@
/**
* 2007-2018 PrestaShop.
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import ModuleCard from '../../components/module-card';
import AdminModuleController from './controller';
import ModuleLoader from './loader';
const $ = window.$;
$(() => {
const moduleCardController = new ModuleCard();
new ModuleLoader();
new AdminModuleController(moduleCardController);
});

View File

@@ -0,0 +1,80 @@
/**
* 2007-2018 PrestaShop.
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
const $ = window.$;
/**
* Module Admin Page Loader.
* @constructor
*/
class ModuleLoader {
constructor() {
ModuleLoader.handleImport();
ModuleLoader.handleEvents();
}
static handleImport() {
const moduleImport = $('#module-import');
moduleImport.click(() => {
moduleImport.addClass('onclick', 250, validate);
});
function validate() {
setTimeout(
() => {
moduleImport.removeClass('onclick');
moduleImport.addClass('validate', 450, callback);
},
2250
);
}
function callback() {
setTimeout(
() => {
moduleImport.removeClass('validate');
},
1250
);
}
}
static handleEvents() {
$('body').on(
'click',
'a.module-read-more-grid-btn, a.module-read-more-list-btn',
(event) => {
event.preventDefault();
const modulePoppin = $(event.target).data('target');
$.get(event.target.href, (data) => {
$(modulePoppin).html(data);
$(modulePoppin).modal();
});
}
);
}
}
export default ModuleLoader;

View File

@@ -0,0 +1,32 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import TermsAndConditionsOptionHandler from './terms-and-conditions-option-handler';
const $ = window.$;
$(() => {
new TermsAndConditionsOptionHandler();
});

View File

@@ -0,0 +1,53 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
const $ = window.$;
class TermsAndConditionsOptionHandler {
constructor() {
this.handle();
$('input[name="form[general][enable_tos]"]').on('change', () => this.handle());
}
handle() {
const tosEnabledVal = $('input[name="form[general][enable_tos]"]:checked').val();
const isTosEnabled = parseInt(tosEnabledVal);
this.handleTermsAndConditionsCmsSelect(isTosEnabled);
}
/**
* If terms and conditions option is disabled, then terms and conditions
* cms select must be disabled.
*
* @param {int} isTosEnabled
*/
handleTermsAndConditionsCmsSelect(isTosEnabled) {
$('#form_general_tos_cms_id').prop('disabled', !isTosEnabled);
}
}
export default TermsAndConditionsOptionHandler;

View File

@@ -0,0 +1,32 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import TranslatableInput from '../../../components/translatable-input';
const $ = window.$;
$(() => {
new TranslatableInput();
});

View File

@@ -0,0 +1,32 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import MultipleChoiceTable from '../../components/multiple-choice-table';
const $ = window.$;
$(() => {
new MultipleChoiceTable();
});

View File

@@ -0,0 +1,34 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import TranslatableInput from '../../components/translatable-input';
import StockManagementOptionHandler from './stock-management-option-handler';
const $ = window.$;
$(() => {
new TranslatableInput();
new StockManagementOptionHandler();
});

View File

@@ -0,0 +1,80 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
const $ = window.$;
class StockManagementOptionHandler {
constructor() {
this.handle();
$('input[name="form[stock][stock_management]"]').on('change', () => this.handle());
}
handle() {
const stockManagementVal = $('input[name="form[stock][stock_management]"]:checked').val();
const isStockManagementEnabled = parseInt(stockManagementVal);
this.handleAllowOrderingOutOfStockOption(isStockManagementEnabled);
this.handleDisplayAvailableQuantitiesOption(isStockManagementEnabled);
}
/**
* If stock managament is disabled
* then 'Allow ordering of out-of-stock products' option must be Yes and disabled
* otherwise it should be enabled
*
* @param {int} isStockManagementEnabled
*/
handleAllowOrderingOutOfStockOption(isStockManagementEnabled) {
const allowOrderingOosRadios = $('input[name="form[stock][allow_ordering_oos]"]');
if (isStockManagementEnabled) {
allowOrderingOosRadios.removeAttr('disabled');
} else {
allowOrderingOosRadios.val([1]);
allowOrderingOosRadios.attr('disabled', 'disabled');
}
}
/**
* If stock managament is disabled
* then 'Display available quantities on the product page' option must be No and disabled
* otherwise it should be enabled
*
* @param {int} isStockManagementEnabled
*/
handleDisplayAvailableQuantitiesOption(isStockManagementEnabled) {
const displayQuantitiesRadio = $('input[name="form[page][display_quantities]"]');
if (isStockManagementEnabled) {
displayQuantitiesRadio.removeAttr('disabled');
} else {
displayQuantitiesRadio.val([0]);
displayQuantitiesRadio.attr('disabled', 'disabled');
}
}
}
export default StockManagementOptionHandler;

View File

@@ -0,0 +1,127 @@
/**
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2017 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import Grid from '../../components/grid/grid';
import ReloadListActionExtension from '../../components/grid/extension/reload-list-extension';
import ExportToSqlManagerExtension from '../../components/grid/extension/export-to-sql-manager-extension';
import FiltersResetExtension from '../../components/grid/extension/filters-reset-extension';
import SortingExtension from '../../components/grid/extension/sorting-extension';
import BulkActionCheckboxExtension from '../../components/grid/extension/bulk-action-checkbox-extension';
import SubmitBulkExtension from '../../components/grid/extension/submit-bulk-action-extension';
import SubmitGridExtension from '../../components/grid/extension/submit-grid-action-extension';
import LinkRowActionExtension from '../../components/grid/extension/link-row-action-extension';
const $ = window.$;
class SqlManagerPage {
constructor() {
const requestSqlGrid = new Grid('sqlrequest');
requestSqlGrid.addExtension(new ReloadListActionExtension());
requestSqlGrid.addExtension(new ExportToSqlManagerExtension());
requestSqlGrid.addExtension(new FiltersResetExtension());
requestSqlGrid.addExtension(new SortingExtension());
requestSqlGrid.addExtension(new LinkRowActionExtension());
requestSqlGrid.addExtension(new SubmitGridExtension());
requestSqlGrid.addExtension(new SubmitBulkExtension());
requestSqlGrid.addExtension(new BulkActionCheckboxExtension());
$(document).on('change', '.js-db-tables-select', () => this.reloadDbTableColumns());
$(document).on('click', '.js-add-db-table-to-query-btn', (event) => this.addDbTableToQuery(event));
$(document).on('click', '.js-add-db-table-column-to-query-btn', (event) => this.addDbTableColumnToQuery(event));
}
/**
* Reload database table columns
*/
reloadDbTableColumns() {
const $selectedOption = $('.js-db-tables-select').find('option:selected');
const $table = $('.js-table-columns');
$.ajax($selectedOption.data('table-columns-url'))
.then((response) => {
$('.js-table-alert').addClass('d-none');
const columns = response.columns;
$table.removeClass('d-none');
$table.find('tbody').empty();
columns.forEach((column) => {
const $row = $('<tr>')
.append($('<td>').html(column.name))
.append($('<td>').html(column.type))
.append($('<td>').addClass('text-right')
.append($('<button>')
.addClass('btn btn-sm btn-outline-secondary js-add-db-table-column-to-query-btn')
.attr('data-column', column.name)
.html($table.data('action-btn'))
)
);
$table.find('tbody').append($row);
});
});
}
/**
* Add selected database table name to SQL query input
*
* @param event
*/
addDbTableToQuery(event) {
const $selectedOption = $('.js-db-tables-select').find('option:selected');
if ($selectedOption.length === 0) {
alert($(event.target).data('choose-table-message'));
return;
}
this.addToQuery($selectedOption.val());
}
/**
* Add table column to SQL query input
*
* @param event
*/
addDbTableColumnToQuery(event) {
this.addToQuery($(event.target).data('column'));
}
/**
* Add data to SQL query input
*
* @param {String} data
*/
addToQuery(data) {
const $queryInput = $('#form_request_sql_sql');
$queryInput.val($queryInput.val() + ' ' + data);
}
}
$(document).ready(() => {
new SqlManagerPage();
});

View File

@@ -0,0 +1,161 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
const $ = window.$;
/**
* Back office translations type
*
* @type {string}
*/
const back = 'back';
/**
* Modules translations type
* @type {string}
*/
const themes = 'themes';
/**
* Modules translations type
* @type {string}
*/
const modules = 'modules';
/**
* Mails translations type
* @type {string}
*/
const mails = 'mails';
/**
* Other translations type
* @type {string}
*/
const others = 'others';
/**
* Email body translations type
* @type {string}
*/
const emailContentBody = 'body';
export default class FormFieldToggle {
constructor() {
$('.js-translation-type').on('change', this.toggleFields.bind(this));
$('.js-email-content-type').on('change', this.toggleEmailFields.bind(this));
this.toggleFields();
}
/**
* Toggle dependant translations fields, based on selected translation type
*/
toggleFields() {
let selectedOption = $('.js-translation-type').val();
let $modulesFormGroup = $('.js-module-form-group');
let $emailFormGroup = $('.js-email-form-group');
let $themesFormGroup = $('.js-theme-form-group');
let $themesSelect = $themesFormGroup.find('select');
let $noThemeOption = $themesSelect.find('.js-no-theme');
let $firstThemeOption = $themesSelect.find('option:not(.js-no-theme):first');
switch (selectedOption) {
case back:
case others:
this._hide($modulesFormGroup, $emailFormGroup, $themesFormGroup);
break;
case themes:
if ($noThemeOption.is(':selected')) {
$themesSelect.val($firstThemeOption.val());
}
this._hide($modulesFormGroup, $emailFormGroup, $noThemeOption);
this._show($themesFormGroup);
break;
case modules:
this._hide($emailFormGroup, $themesFormGroup);
this._show($modulesFormGroup);
break;
case mails:
this._hide($modulesFormGroup, $themesFormGroup);
this._show($emailFormGroup);
break;
}
this.toggleEmailFields();
}
/**
* Toggles fields, which are related to email translations
*/
toggleEmailFields() {
if ($('.js-translation-type').val() !== mails) {
return;
}
let selectedEmailContentType = $('.js-email-form-group').find('select').val();
let $themesFormGroup = $('.js-theme-form-group');
let $noThemeOption = $themesFormGroup.find('.js-no-theme');
if (selectedEmailContentType === emailContentBody) {
$noThemeOption.prop('selected', true);
this._show($noThemeOption, $themesFormGroup);
} else {
this._hide($noThemeOption, $themesFormGroup);
}
}
/**
* Make all given selectors hidden
*
* @param $selectors
* @private
*/
_hide(...$selectors) {
for (let key in $selectors) {
$selectors[key].addClass('d-none');
$selectors[key].find('select').prop('disabled', 'disabled');
}
}
/**
* Make all given selectors visible
*
* @param $selectors
* @private
*/
_show(...$selectors) {
for (let key in $selectors) {
$selectors[key].removeClass('d-none');
$selectors[key].find('select').prop('disabled', false);
}
}
}

View File

@@ -0,0 +1,32 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import FormFieldToggle from "./FormFieldToggle";
export default class TranslationSettingsPage {
constructor() {
new FormFieldToggle();
}
}

View File

@@ -0,0 +1,32 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import TranslationSettingsPage from './TranslationSettingsPage';
const $ = window.$;
$(() => {
new TranslationSettingsPage();
});

View File

@@ -0,0 +1,49 @@
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 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:
* https://opensource.org/licenses/OSL-3.0
* 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-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
import Grid from "../../components/grid/grid";
import FiltersResetExtension from "../../components/grid/extension/filters-reset-extension";
import ReloadListActionExtension from "../../components/grid/extension/reload-list-extension";
import ExportToSqlManagerExtension from "../../components/grid/extension/export-to-sql-manager-extension";
import BulkActionCheckboxExtension from "../../components/grid/extension/bulk-action-checkbox-extension";
import SubmitBulkActionExtension from "../../components/grid/extension/submit-bulk-action-extension";
import SortingExtension from "../../components/grid/extension/sorting-extension";
import SubmitRowActionExtension from "../../components/grid/extension/action/row/submit-row-action-extension";
import ColumnTogglingExtension from "../../components/grid/extension/column-toggling-extension";
const $ = window.$;
$(() => {
const webserviceGrid = new Grid('webservice_key');
webserviceGrid.addExtension(new ReloadListActionExtension());
webserviceGrid.addExtension(new ExportToSqlManagerExtension());
webserviceGrid.addExtension(new FiltersResetExtension());
webserviceGrid.addExtension(new ColumnTogglingExtension());
webserviceGrid.addExtension(new SortingExtension());
webserviceGrid.addExtension(new SubmitBulkActionExtension());
webserviceGrid.addExtension(new SubmitRowActionExtension());
webserviceGrid.addExtension(new BulkActionCheckboxExtension());
});