refactor(orders): clean up order form structure and improve script loading
This commit is contained in:
@@ -325,14 +325,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Сохраняем текущее значение
|
|
||||||
const currentValue = $element.val();
|
|
||||||
const currentText = $element.find(':selected').text();
|
|
||||||
|
|
||||||
if (!currentValue) {
|
|
||||||
$element.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Инициализация Select2
|
// Инициализация Select2
|
||||||
$element.select2({
|
$element.select2({
|
||||||
theme: 'bootstrap-5',
|
theme: 'bootstrap-5',
|
||||||
@@ -358,12 +350,8 @@
|
|||||||
escapeMarkup: function(markup) { return markup; }
|
escapeMarkup: function(markup) { return markup; }
|
||||||
});
|
});
|
||||||
|
|
||||||
// Восстанавливаем значение
|
|
||||||
if (currentValue && currentText) {
|
|
||||||
$element.val(currentValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Интеграция с DraftCreator при загрузке
|
// Интеграция с DraftCreator при загрузке
|
||||||
|
const currentValue = $element.val();
|
||||||
if (currentValue && window.DraftCreator) {
|
if (currentValue && window.DraftCreator) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
window.DraftCreator.triggerDraftCreation();
|
window.DraftCreator.triggerDraftCreation();
|
||||||
|
|||||||
@@ -164,7 +164,14 @@
|
|||||||
data-ajax-url="{% url 'customers:api-search-customers' %}"
|
data-ajax-url="{% url 'customers:api-search-customers' %}"
|
||||||
data-create-url="{% url 'customers:api-create-customer' %}"
|
data-create-url="{% url 'customers:api-create-customer' %}"
|
||||||
data-modal-id="createCustomerModal">
|
data-modal-id="createCustomerModal">
|
||||||
{{ form.customer.value|default:'' }}
|
{% if form.customer.value %}
|
||||||
|
<option value="{{ form.customer.value }}" selected
|
||||||
|
data-name="{{ form.instance.customer.name }}"
|
||||||
|
data-phone="{{ form.instance.customer.phone|default:'' }}"
|
||||||
|
data-email="{{ form.instance.customer.email|default:'' }}">
|
||||||
|
{{ form.instance.customer.name }}{% if form.instance.customer.phone %} ({{ form.instance.customer.phone }}){% endif %}
|
||||||
|
</option>
|
||||||
|
{% endif %}
|
||||||
</select>
|
</select>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if form.customer.errors %}
|
{% if form.customer.errors %}
|
||||||
|
|||||||
Reference in New Issue
Block a user