Files
drmaterac.pl/modules/import_api/views/templates/admin/configure.tpl
2025-01-06 20:47:25 +01:00

87 lines
2.5 KiB
Smarty

{*
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2018 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<div class="panel" id="tab-general">
<p>Source: {$file_name}</p>
<div style="min-height:20px">
<p id="api-loader" style="display:none"> Please wait while module read file
<span class="hidden-xs" >
<i class="icon-refresh icon-spin icon-fw"></i>
</span>
</p>
</div>
<button id="reload-fields">Reload file</button>
<a class="pull-right" href="{$import_link}">Go to import page</a>
</div>
<script type="text/javascript">
function find_fields() {
$.ajax({
url: '{$get_fields_link}',
type: 'post',
data: $('#tab-general :input'),
dataType: 'json',
beforeSend: function() {
$('#api-loader').show();
$('#configuration_form').hide();
$('#reload-fields').button('loading');
},
complete: function() {
$('#api-loader').hide();
$('#configuration_form').show();
$('#reload-fields').button('reset');
},
success: function(json) {
if(json['error']){
alert(json['error']);
} else {
$('.api_field').empty();
$('.api_field').append(new Option('--Please select--', 0));
$.each(json.field, function(key, value) {
$('.api_field').append(new Option(value, value));
});
}
$('#import_api_fields').val(json.fields);
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
}
});
}
$( document ).ready(function() {
{if !$file_settings.fields}
find_fields();
{/if}
});
$(document).delegate('#reload-fields', 'click', function() {
find_fields();
});
</script>