|
|
@@ -303,40 +303,42 @@
|
|
|
}
|
|
|
</style>
|
|
|
|
|
|
- <!-- Модальное окно редактирования графика -->
|
|
|
- <div class="modal fade" id="copySchedule" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
|
|
- <div class="modal-dialog modal-fullscreen-sm-down modal-lg">
|
|
|
- <div class="modal-content">
|
|
|
- <div class="modal-header">
|
|
|
- <h1 class="modal-title fs-5" id="addModalLabel">Изменить/создать запись в графике</h1>
|
|
|
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
|
|
|
- </div>
|
|
|
- <div class="modal-body">
|
|
|
- <form action="{{ route('schedule.update') }}" method="post" id="scheduleEditForm">
|
|
|
- @csrf
|
|
|
- <input type="hidden" name="id" value="0">
|
|
|
- <div>
|
|
|
- @include('partials.input', ['name' => 'installation_date', 'title' => 'Дата монтажа', 'type' => 'date'])
|
|
|
- @include('partials.input', ['name' => 'address_code', 'title' => 'Код адреса'])
|
|
|
- @include('partials.select', ['name' => 'district_id', 'title' => 'Округ', 'options' => $districts, 'first_empty' => true])
|
|
|
- @include('partials.select', ['name' => 'area_id', 'title' => 'Район', 'options' => $areas, 'first_empty' => true])
|
|
|
- @include('partials.input', ['name' => 'object_address', 'title' => 'Адрес', 'required' => true])
|
|
|
- @include('partials.input', ['name' => 'object_type', 'title' => 'Тип объекта', 'required' => true])
|
|
|
- @include('partials.textarea', ['name' => 'mafs', 'title' => 'МАФы', 'required' => true])
|
|
|
- @include('partials.input', ['name' => 'mafs_count', 'title' => 'Кол-во МАФ', 'type' => 'number', 'required' => true])
|
|
|
- @include('partials.select', ['name' => 'brigadier_id', 'title' => 'Бригадир', 'options' => $brigadiers, 'required' => true, 'first_empty' => true])
|
|
|
- @include('partials.input', ['name' => 'transport', 'title' => 'Транспорт'])
|
|
|
- @include('partials.textarea', ['name' => 'admin_comment', 'title' => 'Комментарий'])
|
|
|
- @include('partials.textarea', ['name' => 'comment', 'title' => 'Примечание'])
|
|
|
- <div class="text-center">
|
|
|
- <button type="submit" class="btn btn-primary btn-sm">Сохранить</button>
|
|
|
+ @if(hasRole('admin'))
|
|
|
+ <!-- Модальное окно редактирования графика -->
|
|
|
+ <div class="modal fade" id="copySchedule" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
|
|
+ <div class="modal-dialog modal-fullscreen-sm-down modal-lg">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header">
|
|
|
+ <h1 class="modal-title fs-5" id="addModalLabel">Изменить/создать запись в графике</h1>
|
|
|
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <form action="{{ route('schedule.update') }}" method="post" id="scheduleEditForm">
|
|
|
+ @csrf
|
|
|
+ <input type="hidden" name="id" value="0">
|
|
|
+ <div>
|
|
|
+ @include('partials.input', ['name' => 'installation_date', 'title' => 'Дата монтажа', 'type' => 'date'])
|
|
|
+ @include('partials.input', ['name' => 'address_code', 'title' => 'Код адреса'])
|
|
|
+ @include('partials.select', ['name' => 'district_id', 'title' => 'Округ', 'options' => $districts, 'first_empty' => true])
|
|
|
+ @include('partials.select', ['name' => 'area_id', 'title' => 'Район', 'options' => $areas, 'first_empty' => true])
|
|
|
+ @include('partials.input', ['name' => 'object_address', 'title' => 'Адрес', 'required' => true])
|
|
|
+ @include('partials.input', ['name' => 'object_type', 'title' => 'Тип объекта', 'required' => true])
|
|
|
+ @include('partials.textarea', ['name' => 'mafs', 'title' => 'МАФы', 'required' => true])
|
|
|
+ @include('partials.input', ['name' => 'mafs_count', 'title' => 'Кол-во МАФ', 'type' => 'number', 'required' => true])
|
|
|
+ @include('partials.select', ['name' => 'brigadier_id', 'title' => 'Бригадир', 'options' => $brigadiers, 'required' => true, 'first_empty' => true])
|
|
|
+ @include('partials.input', ['name' => 'transport', 'title' => 'Транспорт'])
|
|
|
+ @include('partials.textarea', ['name' => 'admin_comment', 'title' => 'Комментарий'])
|
|
|
+ @include('partials.textarea', ['name' => 'comment', 'title' => 'Примечание'])
|
|
|
+ <div class="text-center">
|
|
|
+ <button type="submit" class="btn btn-primary btn-sm">Сохранить</button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </form>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ @endif
|
|
|
|
|
|
@if($errors->any())
|
|
|
@dump($errors)
|
|
|
@@ -352,66 +354,68 @@
|
|
|
document.location = '{{ route('schedule.index') }}?tab=week&week=' + week;
|
|
|
});
|
|
|
|
|
|
- $('.editSchedule').on('click', function () {
|
|
|
- let scheduleId = $(this).attr('data-schedule-id');
|
|
|
- let scheduleDate = $(this).attr('data-schedule-date');
|
|
|
- let scheduleDistrict = $(this).attr('data-schedule-district');
|
|
|
- let scheduleArea = $(this).attr('data-schedule-area');
|
|
|
- let scheduleBrigadier = $(this).attr('data-schedule-brigadier');
|
|
|
- let scheduleAddress = $(this).attr('data-schedule-address');
|
|
|
- let scheduleComment = $('.comment-' + scheduleId).text();
|
|
|
- let scheduleTransport = $('.transport-' + scheduleId).text();
|
|
|
- let scheduleAdminComment = $('.admin-comment-' + scheduleId).text();
|
|
|
- let scheduleMafs = $('.mafs-' + scheduleId).text();
|
|
|
- let scheduleObjectType = $('.object-type-' + scheduleId).text();
|
|
|
- let scheduleMafsCount = $('.mafs-count-' + scheduleId).text();
|
|
|
- let scheduleCode = $('.code-' + scheduleId).text();
|
|
|
- console.log(scheduleId, scheduleDate, scheduleDistrict, $(this).attr('data-schedule-brigadier'));
|
|
|
- $('form#scheduleEditForm input[name=id]').val(scheduleId);
|
|
|
- $('form#scheduleEditForm input[name=object_address]').val(scheduleAddress);
|
|
|
- $('form#scheduleEditForm input[name=object_type]').val(scheduleObjectType);
|
|
|
- $('form#scheduleEditForm input[name=installation_date]').val(scheduleDate);
|
|
|
- $('form#scheduleEditForm select[name=district_id]').val(scheduleDistrict);
|
|
|
- $('form#scheduleEditForm select[name=area_id]').val(scheduleArea);
|
|
|
- $('form#scheduleEditForm select[name=brigadier_id]').val(scheduleBrigadier);
|
|
|
- $('form#scheduleEditForm textarea[name=comment]').text(scheduleComment);
|
|
|
- $('form#scheduleEditForm input[name=transport]').val(scheduleTransport);
|
|
|
- $('form#scheduleEditForm textarea[name=admin_comment]').text(scheduleAdminComment);
|
|
|
- $('form#scheduleEditForm textarea[name=mafs]').text(scheduleMafs);
|
|
|
- $('form#scheduleEditForm input[name=mafs_count]').val(scheduleMafsCount);
|
|
|
- $('form#scheduleEditForm input[name=address_code]').val(scheduleCode);
|
|
|
+ @if(hasRole('admin'))
|
|
|
+ $('.editSchedule').on('click', function () {
|
|
|
+ let scheduleId = $(this).attr('data-schedule-id');
|
|
|
+ let scheduleDate = $(this).attr('data-schedule-date');
|
|
|
+ let scheduleDistrict = $(this).attr('data-schedule-district');
|
|
|
+ let scheduleArea = $(this).attr('data-schedule-area');
|
|
|
+ let scheduleBrigadier = $(this).attr('data-schedule-brigadier');
|
|
|
+ let scheduleAddress = $(this).attr('data-schedule-address');
|
|
|
+ let scheduleComment = $('.comment-' + scheduleId).text();
|
|
|
+ let scheduleTransport = $('.transport-' + scheduleId).text();
|
|
|
+ let scheduleAdminComment = $('.admin-comment-' + scheduleId).text();
|
|
|
+ let scheduleMafs = $('.mafs-' + scheduleId).text();
|
|
|
+ let scheduleObjectType = $('.object-type-' + scheduleId).text();
|
|
|
+ let scheduleMafsCount = $('.mafs-count-' + scheduleId).text();
|
|
|
+ let scheduleCode = $('.code-' + scheduleId).text();
|
|
|
+ console.log(scheduleId, scheduleDate, scheduleDistrict, $(this).attr('data-schedule-brigadier'));
|
|
|
+ $('form#scheduleEditForm input[name=id]').val(scheduleId);
|
|
|
+ $('form#scheduleEditForm input[name=object_address]').val(scheduleAddress);
|
|
|
+ $('form#scheduleEditForm input[name=object_type]').val(scheduleObjectType);
|
|
|
+ $('form#scheduleEditForm input[name=installation_date]').val(scheduleDate);
|
|
|
+ $('form#scheduleEditForm select[name=district_id]').val(scheduleDistrict);
|
|
|
+ $('form#scheduleEditForm select[name=area_id]').val(scheduleArea);
|
|
|
+ $('form#scheduleEditForm select[name=brigadier_id]').val(scheduleBrigadier);
|
|
|
+ $('form#scheduleEditForm textarea[name=comment]').text(scheduleComment);
|
|
|
+ $('form#scheduleEditForm input[name=transport]').val(scheduleTransport);
|
|
|
+ $('form#scheduleEditForm textarea[name=admin_comment]').text(scheduleAdminComment);
|
|
|
+ $('form#scheduleEditForm textarea[name=mafs]').text(scheduleMafs);
|
|
|
+ $('form#scheduleEditForm input[name=mafs_count]').val(scheduleMafsCount);
|
|
|
+ $('form#scheduleEditForm input[name=address_code]').val(scheduleCode);
|
|
|
|
|
|
- let myModalEditSchedule = new bootstrap.Modal(document.getElementById("copySchedule"), {});
|
|
|
- myModalEditSchedule.show();
|
|
|
- });
|
|
|
+ let myModalEditSchedule = new bootstrap.Modal(document.getElementById("copySchedule"), {});
|
|
|
+ myModalEditSchedule.show();
|
|
|
+ });
|
|
|
|
|
|
- $('.deleteSchedule').on('click', function () {
|
|
|
- customConfirm('Удалить запись?', function () {
|
|
|
- let scheduleId = $(this).attr('data-schedule-id');
|
|
|
- $('.deleteForm-' + scheduleId).submit();
|
|
|
- }.bind(this), 'Подтверждение удаления');
|
|
|
- });
|
|
|
+ $('.deleteSchedule').on('click', function () {
|
|
|
+ customConfirm('Удалить запись?', function () {
|
|
|
+ let scheduleId = $(this).attr('data-schedule-id');
|
|
|
+ $('.deleteForm-' + scheduleId).submit();
|
|
|
+ }.bind(this), 'Подтверждение удаления');
|
|
|
+ });
|
|
|
|
|
|
- $('.createSchedule').on('click', function () {
|
|
|
- let scheduleDate = $(this).attr('data-schedule-date');
|
|
|
+ $('.createSchedule').on('click', function () {
|
|
|
+ let scheduleDate = $(this).attr('data-schedule-date');
|
|
|
|
|
|
- $('form#scheduleEditForm input[name=id]').val('');
|
|
|
- $('form#scheduleEditForm input[name=object_address]').val('');
|
|
|
- $('form#scheduleEditForm input[name=object_type]').val('');
|
|
|
- $('form#scheduleEditForm input[name=installation_date]').val(scheduleDate);
|
|
|
- $('form#scheduleEditForm select[name=district_id]').val('');
|
|
|
- $('form#scheduleEditForm select[name=area_id]').val('');
|
|
|
- $('form#scheduleEditForm select[name=brigadier_id]').val('');
|
|
|
- $('form#scheduleEditForm textarea[name=comment]').text('');
|
|
|
- $('form#scheduleEditForm input[name=transport]').val('');
|
|
|
- $('form#scheduleEditForm textarea[name=admin_comment]').text('');
|
|
|
- $('form#scheduleEditForm textarea[name=mafs]').text('');
|
|
|
- $('form#scheduleEditForm input[name=mafs_count]').val('');
|
|
|
- $('form#scheduleEditForm input[name=address_code]').val('');
|
|
|
+ $('form#scheduleEditForm input[name=id]').val('');
|
|
|
+ $('form#scheduleEditForm input[name=object_address]').val('');
|
|
|
+ $('form#scheduleEditForm input[name=object_type]').val('');
|
|
|
+ $('form#scheduleEditForm input[name=installation_date]').val(scheduleDate);
|
|
|
+ $('form#scheduleEditForm select[name=district_id]').val('');
|
|
|
+ $('form#scheduleEditForm select[name=area_id]').val('');
|
|
|
+ $('form#scheduleEditForm select[name=brigadier_id]').val('');
|
|
|
+ $('form#scheduleEditForm textarea[name=comment]').text('');
|
|
|
+ $('form#scheduleEditForm input[name=transport]').val('');
|
|
|
+ $('form#scheduleEditForm textarea[name=admin_comment]').text('');
|
|
|
+ $('form#scheduleEditForm textarea[name=mafs]').text('');
|
|
|
+ $('form#scheduleEditForm input[name=mafs_count]').val('');
|
|
|
+ $('form#scheduleEditForm input[name=address_code]').val('');
|
|
|
|
|
|
- let myModalCreateSchedule = new bootstrap.Modal(document.getElementById("copySchedule"), {});
|
|
|
- myModalCreateSchedule.show();
|
|
|
- });
|
|
|
+ let myModalCreateSchedule = new bootstrap.Modal(document.getElementById("copySchedule"), {});
|
|
|
+ myModalCreateSchedule.show();
|
|
|
+ });
|
|
|
+ @endif
|
|
|
|
|
|
// select order
|
|
|
$('#search_order').on('keyup', function () {
|