93 lines
3.6 KiB
PHP
93 lines
3.6 KiB
PHP
<h1 class="h3 mb-3">Создание поля</h1>
|
|
|
|
<?php if (!empty($_SESSION['error'])): ?>
|
|
<div class="alert alert-danger">
|
|
<?= htmlspecialchars($_SESSION['error']) ?>
|
|
</div>
|
|
<?php unset($_SESSION['error']); ?>
|
|
<?php endif; ?>
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<div>
|
|
<h1 class="h3 mb-0">Поля доски</h1>
|
|
<div class="text-muted small">
|
|
<?= htmlspecialchars((string)$board['name']) ?> (<?= htmlspecialchars((string)$board['code']) ?>)
|
|
</div>
|
|
</div>
|
|
|
|
<a href="/admin/boards/fields/create?board_id=<?= (int)$board['id'] ?>" class="btn btn-primary">
|
|
+ Создать поле
|
|
</a>
|
|
</div>
|
|
|
|
<?php if (!empty($_SESSION['success'])): ?>
|
|
<div class="alert alert-success">
|
|
<?= htmlspecialchars($_SESSION['success']) ?>
|
|
</div>
|
|
<?php unset($_SESSION['success']); ?>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($_SESSION['error'])): ?>
|
|
<div class="alert alert-danger">
|
|
<?= htmlspecialchars($_SESSION['error']) ?>
|
|
</div>
|
|
<?php unset($_SESSION['error']); ?>
|
|
<?php endif; ?>
|
|
|
|
<div class="card shadow-sm">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover align-middle mb-0">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Код</th>
|
|
<th>Название</th>
|
|
<th>Тип</th>
|
|
<th>Обязательное</th>
|
|
<th>Активно</th>
|
|
<th>Порядок</th>
|
|
<th style="width: 220px;">Действия</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($fields as $field): ?>
|
|
<tr>
|
|
<td><?= (int)$field['id'] ?></td>
|
|
<td><?= htmlspecialchars((string)$field['code']) ?></td>
|
|
<td><?= htmlspecialchars((string)$field['name']) ?></td>
|
|
<td><?= htmlspecialchars((string)$field['field_type']) ?></td>
|
|
<td><?= (int)$field['is_required'] ? 'Да' : 'Нет' ?></td>
|
|
<td><?= (int)$field['is_active'] ? 'Да' : 'Нет' ?></td>
|
|
<td><?= (int)$field['sort_order'] ?></td>
|
|
<td>
|
|
<div class="d-flex gap-2">
|
|
<a href="/admin/boards/fields/edit?id=<?= (int)$field['id'] ?>" class="btn btn-sm btn-outline-primary">
|
|
Изменить
|
|
</a>
|
|
|
|
<form method="post" action="/admin/boards/fields/delete" onsubmit="return confirm('Удалить поле и все его значения у задач?');" class="d-inline">
|
|
<input type="hidden" name="id" value="<?= (int)$field['id'] ?>">
|
|
<button type="submit" class="btn btn-sm btn-outline-danger">
|
|
Удалить
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
|
|
<?php if (empty($fields)): ?>
|
|
<tr>
|
|
<td colspan="8" class="text-center text-muted py-4">Поля пока не созданы</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('field_type').addEventListener('change', function () {
|
|
document.getElementById('select_options_wrap').style.display = this.value === 'select' ? 'block' : 'none';
|
|
});
|
|
</script>
|