bp/app/Modules/CRM/Views/contacts/form.twig

128 lines
6.1 KiB
Twig
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends 'layouts/base.twig' %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3 mb-0">{{ title }}</h1>
<a href="{{ site_url('/crm/contacts') }}" class="btn btn-outline-secondary">
<i class="fa-solid fa-arrow-left me-2"></i>К списку
</a>
</div>
{# Сообщения об ошибках #}
{% if errors is defined and errors|length > 0 %}
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<ul class="mb-0">
{% for error in errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endif %}
<div class="card shadow-sm">
<div class="card-body">
<form method="POST" action="{{ actionUrl }}">
{{ csrf_field()|raw }}
{% if contact is defined %}
<input type="hidden" name="_method" value="PUT">
{% endif %}
<div class="mb-3">
<label for="name" class="form-label fw-bold">Имя *</label>
<input type="text"
class="form-control"
id="name"
name="name"
value="{{ old.name|default(contact.name|default('')) }}"
required
placeholder="Иван Иванов">
</div>
<div class="row mb-3">
<div class="col-md-6">
<label for="email" class="form-label fw-bold">Email</label>
<input type="email"
class="form-control"
id="email"
name="email"
value="{{ old.email|default(contact.email|default('')) }}"
placeholder="email@example.com">
</div>
<div class="col-md-6">
<label for="phone" class="form-label fw-bold">Телефон</label>
<input type="text"
class="form-control"
id="phone"
name="phone"
value="{{ old.phone|default(contact.phone|default('')) }}"
placeholder="+7 (999) 123-45-67">
</div>
</div>
<div class="row mb-3">
<div class="col-md-6">
<label for="position" class="form-label fw-bold">Должность</label>
<input type="text"
class="form-control"
id="position"
name="position"
value="{{ old.position|default(contact.position|default('')) }}"
placeholder="Менеджер, Директор...">
</div>
<div class="col-md-6">
<label for="customer_id" class="form-label fw-bold">Клиент</label>
<select class="form-select" id="customer_id" name="customer_id">
<option value="">Не привязан</option>
{% for client in clients %}
<option value="{{ client.id }}"
{{ (old.customer_id|default(contact.customer_id|default(''))) == client.id ? 'selected' : '' }}>
{{ client.name }}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="mb-3">
<label for="notes" class="form-label fw-bold">Заметки</label>
<textarea class="form-control"
id="notes"
name="notes"
rows="3"
placeholder="Дополнительная информация...">{{ old.notes|default(contact.notes|default('')) }}</textarea>
</div>
<div class="mb-3">
<div class="form-check">
<input class="form-check-input"
type="checkbox"
id="is_primary"
name="is_primary"
value="1"
{{ (old.is_primary|default(contact.is_primary|default(false))) ? 'checked' : '' }}>
<label class="form-check-label" for="is_primary">
Основной контакт клиента
</label>
</div>
</div>
<div class="d-flex justify-content-end gap-2 pt-3 border-top">
<a href="{{ site_url('/crm/contacts') }}" class="btn btn-outline-secondary">Отмена</a>
<button type="submit" class="btn btn-primary">
<i class="fa-solid fa-check me-2"></i>
{{ contact is defined ? 'Сохранить' : 'Создать' }}
</button>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}