mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-23 21:56:07 +03:00
314 lines
20 KiB
Twig
314 lines
20 KiB
Twig
|
{{ header }}{{ column_left }}
|
||
|
|
||
|
<div id="content">
|
||
|
<div class="page-header">
|
||
|
<div class="container-fluid">
|
||
|
<div class="pull-right">
|
||
|
{% if export_file %}
|
||
|
<button type="button" id="export" data-toggle="tooltip" title="{{ text_button_export }}" class="btn btn-success"><i class="fa fa-download"></i></button>
|
||
|
{% endif %}
|
||
|
<button type="button" id="icml" data-toggle="tooltip" title="{{ text_button_catalog }}" class="btn btn-success"><i class="fa fa-file-text-o"></i></button>
|
||
|
<button type="submit" form="form-module" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
|
||
|
<a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
|
||
|
<h1>{{ heading_title }}</h1>
|
||
|
<ul class="breadcrumb">
|
||
|
{% for breadcrumb in breadcrumbs %}
|
||
|
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
|
||
|
{% endfor %}
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="container-fluid">
|
||
|
{% if error_warning %}
|
||
|
<div class="alert alert-danger">
|
||
|
<button type="button" class="close" data-dismiss="alert">×</button>
|
||
|
<i class="fa fa-exclamation-circle"></i> {{ error_warning }}
|
||
|
</div>
|
||
|
{% endif %}
|
||
|
{% if saved_settings.module_retailcrm_url is defined %}
|
||
|
<div class="alert alert-info"><i class="fa fa-exclamation-circle"></i>
|
||
|
<button type="button" class="close" data-dismiss="alert">×</button>
|
||
|
{{ text_notice }}
|
||
|
<a href="{{ saved_settings.module_retailcrm_url }}/admin/settings#t-main">{{ saved_settings.module_retailcrm_url }}/admin/settings#t-main</a>
|
||
|
</div>
|
||
|
|
||
|
{% endif %}
|
||
|
|
||
|
<div class="panel panel-default">
|
||
|
<div class="panel-body">
|
||
|
<form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-module">
|
||
|
<ul class="nav nav-tabs">
|
||
|
<li class="active"><a href="#tab-general" data-toggle="tab">{{ general_tab_text }}</a></li>
|
||
|
{% if saved_settings.module_retailcrm_apikey is defined and saved_settings.module_retailcrm_apikey and saved_settings.module_retailcrm_url is defined and saved_settings.module_retailcrm_url %}
|
||
|
<li><a href="#tab-references" data-toggle="tab">{{ references_tab_text }}</a></li>
|
||
|
<li><a href="#tab-collector" data-toggle="tab">{{ collector_tab_text }}</a></li>
|
||
|
{% endif %}
|
||
|
</ul>
|
||
|
|
||
|
<div class="tab-content">
|
||
|
<div class="tab-pane active" id="tab-general">
|
||
|
<input type="hidden" name="module_retailcrm_status" value="1">
|
||
|
|
||
|
<h3>{{ retailcrm_base_settings }}</h3>
|
||
|
<div class="retailcrm_unit">
|
||
|
<label for="retailcrm_url">{{ retailcrm_apiversion }}</label><br>
|
||
|
<select name="module_retailcrm_apiversion">
|
||
|
{% for version in api_versions %}
|
||
|
<option value="{{ version }}" {% if saved_settings.module_retailcrm_apiversion is defined and saved_settings.module_retailcrm_apiversion == version %} selected="selected" {% elseif saved_settings.module_retailcrm_apiversion is not defined and default_apiversion == version %} selected="selected" {% endif %}>{{ version }}</option>
|
||
|
{% endfor %}
|
||
|
</select>
|
||
|
</div>
|
||
|
<div class="retailcrm_unit">
|
||
|
<label for="retailcrm_url">{{ retailcrm_url }}</label><br>
|
||
|
<input id="retailcrm_url" type="text" name="module_retailcrm_url" value="{% if saved_settings.module_retailcrm_url is defined %}{{ saved_settings.module_retailcrm_url }}{% endif %}">
|
||
|
</div>
|
||
|
<div class="retailcrm_unit">
|
||
|
<label for="retailcrm_apikey">{{ retailcrm_apikey }}</label><br>
|
||
|
<input id="retailcrm_apikey" type="text" name="module_retailcrm_apikey" value="{% if saved_settings.module_retailcrm_apikey is defined %}{{ saved_settings.module_retailcrm_apikey }}{% endif %}">
|
||
|
</div>
|
||
|
|
||
|
<h3>{{ retailcrm_countries_settings }}</h3>
|
||
|
<div class="retailcrm_unit">
|
||
|
<div class="well well-sm" style="height: 150px; overflow: auto; width: 30%;">
|
||
|
{% for country in countries %}
|
||
|
<div class="checkbox">
|
||
|
<label>
|
||
|
<input type="checkbox" name="module_retailcrm_country[]" value="{{ country.country_id }}" {% if saved_settings.module_retailcrm_country is defined and country.country_id in saved_settings.module_retailcrm_country %} {{ 'checked' }} {% endif %}">
|
||
|
{{ country.name }}
|
||
|
</label>
|
||
|
</div>
|
||
|
{% endfor %}
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
{% if saved_settings.module_retailcrm_apikey is defined and saved_settings.module_retailcrm_apikey and saved_settings.module_retailcrm_url is defined and saved_settings.module_retailcrm_url %}
|
||
|
|
||
|
{% if retailcrm_errors|length %}
|
||
|
{% for retailcrm_error in retailcrm_errors %}
|
||
|
<div class="warning">{{ retailcrm_error }}</div>
|
||
|
{% endfor %}
|
||
|
{% else %}
|
||
|
<h3>{{ retailcrm_upload_order }}</h3>
|
||
|
<div class="retailcrm_unit">
|
||
|
<label>{{ text_button_export_order }} № </label><input type="text" name="order_id">
|
||
|
<button type="button" id="export_order" data-toggle="tooltip" title="{{ text_button_export_order }}" class="btn btn-success"><i class="fa fa-download"></i></button>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="tab-pane" id="tab-references">
|
||
|
<h3>{{ retailcrm_dict_settings }}</h3>
|
||
|
|
||
|
<h4>{{ retailcrm_dict_delivery }}</h4>
|
||
|
{% for value in delivery.opencart %}
|
||
|
|
||
|
<div class="pm">{{ value.title ~ ':' }}</div>
|
||
|
|
||
|
{% for key, val in value %}
|
||
|
{% if key != 'title' %}
|
||
|
<div class="retailcrm_unit">
|
||
|
<select id="retailcrm_delivery_{{ val.code }}" name="module_retailcrm_delivery[{{ val.code }}]" >
|
||
|
{% for k, v in delivery.retailcrm %}
|
||
|
<option value="{{ v.code }}" {% if saved_settings.module_retailcrm_delivery[key] is defined and v.code == saved_settings.module_retailcrm_delivery[key] %} selected="selected" {% endif %}>
|
||
|
{{ v.name }}
|
||
|
</option>
|
||
|
{% endfor %}
|
||
|
</select>
|
||
|
<label for="retailcrm_pm_{{ val.code }}">{{ val.title }}</label>
|
||
|
</div>
|
||
|
{% endif %}
|
||
|
{% endfor %}
|
||
|
{% endfor %}
|
||
|
|
||
|
<h4>{{ retailcrm_dict_status }}</h4>
|
||
|
{% for status in statuses.opencart %}
|
||
|
{% set uid = status.order_status_id %}
|
||
|
<div class="retailcrm_unit">
|
||
|
<select id="retailcrm_status_{{ uid }}" name="module_retailcrm_status[{{ status.order_status_id }}]" >
|
||
|
{% for k, v in statuses.retailcrm %}
|
||
|
<option value="{{ v.code }}" {% if saved_settings.module_retailcrm_status[uid] is defined and v.code == saved_settings.module_retailcrm_status[uid] %} selected="selected" {% endif %}>
|
||
|
{{ v.name }}
|
||
|
</option>
|
||
|
{% endfor %}
|
||
|
</select>
|
||
|
<label for="retailcrm_status_{{ status.order_status_id }} ">{{ status.name }}</label>
|
||
|
</div>
|
||
|
{% endfor %}
|
||
|
|
||
|
<h4>{{ retailcrm_dict_payment }}</h4>
|
||
|
{% for key, value in payments.opencart %}
|
||
|
<div class="retailcrm_unit">
|
||
|
<select id="retailcrm_payment_{{ key }}" name="module_retailcrm_payment[{{ key }}]" >
|
||
|
{% for k, v in payments.retailcrm %}
|
||
|
<option value="{{ v.code }}" {% if saved_settings.module_retailcrm_payment[key] is defined and v.code == saved_settings.module_retailcrm_payment[key] %} selected="selected" {% endif %}>
|
||
|
{{ v.name }}
|
||
|
</option>
|
||
|
{% endfor %}
|
||
|
</select>
|
||
|
<label for="retailcrm_payment_{{ key }}">{{ value }}</label>
|
||
|
</div>
|
||
|
{% endfor %}
|
||
|
|
||
|
{% endif %}
|
||
|
|
||
|
{% endif %}
|
||
|
</div>
|
||
|
|
||
|
<div class="tab-pane" id="tab-collector">
|
||
|
<h3>{{ daemon_collector }}</h3>
|
||
|
<div class="retailcrm_unit">
|
||
|
<label for="retailcrm_collector_active" class="col-md-4">{{ text_collector_activity }}</label>
|
||
|
<label class="radio-inline">
|
||
|
<input type="radio" name="module_retailcrm_collector_active" value="1" {% if saved_settings.module_retailcrm_collector_active is defined and
|
||
|
saved_settings.module_retailcrm_collector_active == 1 %} {{ 'checked' }}
|
||
|
{% endif %}>
|
||
|
{{ text_yes }}
|
||
|
</label>
|
||
|
<label class="radio-inline">
|
||
|
<input type="radio" name="module_retailcrm_collector_active" value="0" {% if not saved_settings.module_retailcrm_collector_active or
|
||
|
saved_settings.module_retailcrm_collector_active == 0 %} {{ 'checked' }}
|
||
|
{% endif %}>
|
||
|
{{ text_no }}
|
||
|
</label>
|
||
|
</div>
|
||
|
<div class="retailcrm_unit">
|
||
|
<label for="retailcrm_collector" class="col-md-4">{{ collector_site_key }}</label>
|
||
|
<input id="retailcrm_collector_site_key" type="text" name="module_retailcrm_collector[site_key]" value="{% if saved_settings.module_retailcrm_collector.site_key is defined %}{{ saved_settings.module_retailcrm_collector.site_key }}{% endif %}">
|
||
|
</div>
|
||
|
{% if saved_settings.module_retailcrm_collector.site_key is not empty and
|
||
|
saved_settings.module_retailcrm_collector_active == 1 %}
|
||
|
<div class="retailcrm_unit">
|
||
|
<label for="retailcrm_collector" class="col-md-4">{{ text_collector_form_capture }}</label>
|
||
|
<label class="radio-inline">
|
||
|
<input type="radio" name="module_retailcrm_collector[form_capture]" value="1" {% if saved_settings.module_retailcrm_collector.form_capture is defined and
|
||
|
saved_settings.module_retailcrm_collector.form_capture == 1 %} {{ 'checked' }}
|
||
|
{% endif %}>
|
||
|
{{ text_yes }}
|
||
|
</label>
|
||
|
<label class="radio-inline">
|
||
|
<input type="radio" name="module_retailcrm_collector[form_capture]" value="0" {% if saved_settings.module_retailcrm_collector.form_capture is not defined or
|
||
|
saved_settings.module_retailcrm_collector.form_capture == 0 %} {{ 'checked' }}
|
||
|
{% endif %}>
|
||
|
{{ text_no }}
|
||
|
</label>
|
||
|
</div>
|
||
|
{% if saved_settings.module_retailcrm_collector.form_capture is defined and
|
||
|
saved_settings.module_retailcrm_collector.form_capture == 1 %}
|
||
|
<div class="retailcrm_unit">
|
||
|
<label for="retailcrm_collector" class="col-md-4">{{ text_collector_period }}</label>
|
||
|
<input id="retailcrm_collector_period" type="text" name="module_retailcrm_collector[period]" value="{% if saved_settings.module_retailcrm_collector.period is defined %}{{ saved_settings.module_retailcrm_collector.period }}{% endif %}">
|
||
|
</div>
|
||
|
<div class="retailcrm_unit">
|
||
|
<label for="retailcrm_collector" class="col-md-4">{{ text_label_promo }}</label>
|
||
|
<input id="retailcrm_collector[]" type="text" name="module_retailcrm_collector[label_promo]" value="{% if saved_settings.module_retailcrm_collector.label_promo is defined %}{{ saved_settings.module_retailcrm_collector.label_promo }}{% endif %}">
|
||
|
</div>
|
||
|
<div class="retailcrm_unit">
|
||
|
<label for="retailcrm_collector" class="col-md-4">{{ text_label_send }}</label>
|
||
|
<input id="retailcrm_collector_label_send" type="text" name="module_retailcrm_collector[label_send]" value="{% if saved_settings.module_retailcrm_collector.label_send is defined %} {{ saved_settings.module_retailcrm_collector.label_send }} {% endif %}">
|
||
|
</div>
|
||
|
<div class="retailcrm_unit">
|
||
|
<label for="retailcrm_collector" class="col-md-4">{{ collector_custom_text }}</label>
|
||
|
<label class="radio-inline">
|
||
|
<input type="radio" name="module_retailcrm_collector[custom_form]" value="1" {% if saved_settings.module_retailcrm_collector.custom_form is defined and
|
||
|
saved_settings.module_retailcrm_collector.custom_form == 1 %} {{ 'checked' }}
|
||
|
{% endif %}>
|
||
|
{{ text_yes }}
|
||
|
</label>
|
||
|
<label class="radio-inline">
|
||
|
<input type="radio" name="module_retailcrm_collector[custom_form]" value="0" {% if saved_settings.module_retailcrm_collector.custom_form is defined or
|
||
|
saved_settings.module_retailcrm_collector.custom_form == 0 %} {{ 'checked' }}
|
||
|
{% endif %}>
|
||
|
{{ text_no }}
|
||
|
</label>
|
||
|
</div>
|
||
|
{% if saved_settings.module_retailcrm_collector.custom_form is defined and
|
||
|
saved_settings.module_retailcrm_collector.custom_form == 1 %}
|
||
|
{% for field, label in collectorFields %}
|
||
|
<div class="retailcrm_unit">
|
||
|
<label for="retailcrm_collector" class="col-md-4">{{ label }}</label>
|
||
|
<div class="col-md-8">
|
||
|
{# <input id="retailcrm_collector" type="text" name="module_retailcrm_collector[custom][{{ field }}]" value="{% if saved_settings.module_retailcrm_collector.custom.{{ field }} is defined %} {{ saved_settings.module_retailcrm_collector.custom.{{ field }} {% endif %}"> #}
|
||
|
<input type="checkbox" name="module_retailcrm_collector[require][{{ field }}_require]" value="1" {% if saved_settings.module_retailcrm_collector.require.field ~'_require' %} {{ 'checked' }} {% endif %}>
|
||
|
<label for="retailcrm_collector">{{ text_require }}</label>
|
||
|
</div>
|
||
|
</div>
|
||
|
{% endfor %}
|
||
|
{% endif %}
|
||
|
{% endif %}
|
||
|
{% endif %}
|
||
|
</div>
|
||
|
</div>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
{{ footer }}
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
var token = '{{ user_token }}';
|
||
|
$('#icml').on('click', function() {
|
||
|
$.ajax({
|
||
|
url: '{{ catalog }}' + 'admin/index.php?route=extension/module/retailcrm/icml&user_token=' + token,
|
||
|
beforeSend: function() {
|
||
|
$('#icml').button('loading');
|
||
|
},
|
||
|
complete: function() {
|
||
|
$('.alert-success').remove();
|
||
|
$('#content > .container-fluid').prepend('<div class="alert alert-success"><i class="fa fa-exclamation-circle"></i> {{ text_success_catalog }}</div>');
|
||
|
$('#icml').button('reset');
|
||
|
},
|
||
|
error: function(){
|
||
|
alert('error');
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
$('#export').on('click', function() {
|
||
|
$.ajax({
|
||
|
url: '{{ catalog }}' + 'admin/index.php?route=extension/module/retailcrm/export&user_token=' + token,
|
||
|
beforeSend: function() {
|
||
|
$('#export').button('loading');
|
||
|
},
|
||
|
complete: function() {
|
||
|
$('.alert-success').remove();
|
||
|
$('#content > .container-fluid').prepend('<div class="alert alert-success"><i class="fa fa-exclamation-circle"></i> {{ text_success_export }}</div>');
|
||
|
$('#export').button('reset');
|
||
|
},
|
||
|
error: function(){
|
||
|
alert('error');
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
$('#export_order').on('click', function() {
|
||
|
var order_id = $('input[name=\'order_id\']').val();
|
||
|
if (order_id && order_id > 0) {
|
||
|
$.ajax({
|
||
|
url: '{{ catalog }}' + 'admin/index.php?route=extension/module/retailcrm/exportOrder&user_token=' + token + '&order_id=' + order_id,
|
||
|
beforeSend: function() {
|
||
|
$('#export_order').button('loading');
|
||
|
},
|
||
|
error: function(xhr, ajaxOptions, thrownError) {
|
||
|
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
||
|
},
|
||
|
success: function(data, textStatus, jqXHR) {
|
||
|
if (jqXHR['responseText'] == 'false') {
|
||
|
$('.alert-danger').remove();
|
||
|
$('#content > .container-fluid').prepend('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i>{{ text_error_order }}</div>');
|
||
|
$('#export_order').button('reset');
|
||
|
} else {
|
||
|
$('.alert-success').remove();
|
||
|
$('#content > .container-fluid').prepend('<div class="alert alert-success"><i class="fa fa-exclamation-circle"></i>{{ text_success_export_order }}</div>');
|
||
|
$('#export_order').button('reset');
|
||
|
$('input[name=\'order_id\']').val('');
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
} else {
|
||
|
$('.alert-danger').remove();
|
||
|
$('#content > .container-fluid').prepend('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> {{ text_error_order_id }}</div>');
|
||
|
$('#export_order').button('reset');
|
||
|
}
|
||
|
});
|
||
|
</script>
|