|
@@ -15,7 +15,8 @@
|
|
|
</div>
|
|
</div>
|
|
|
<label class="p-2 d-block small mt-1">Неделя №</label>
|
|
<label class="p-2 d-block small mt-1">Неделя №</label>
|
|
|
<div class="p-2">
|
|
<div class="p-2">
|
|
|
- <input type="number" style="width: 3rem" value="{{ $weekNumber }}" class="form-control form-control-sm"
|
|
|
|
|
|
|
+ <input type="number" style="width: 3rem" value="{{ $weekNumber }}"
|
|
|
|
|
+ class="form-control form-control-sm"
|
|
|
onchange="document.location = '{{ route('schedule.index') }}?week='+this.value"
|
|
onchange="document.location = '{{ route('schedule.index') }}?week='+this.value"
|
|
|
min="1" max="53" title="№ недели">
|
|
min="1" max="53" title="№ недели">
|
|
|
</div>
|
|
</div>
|
|
@@ -43,50 +44,116 @@
|
|
|
<div class="schedule">
|
|
<div class="schedule">
|
|
|
<table class="table schedules">
|
|
<table class="table schedules">
|
|
|
<thead>
|
|
<thead>
|
|
|
- <tr>
|
|
|
|
|
- <th class="text-center vertical">День недели</th>
|
|
|
|
|
- <th class="text-center vertical">Дата</th>
|
|
|
|
|
- <th>Код адр</th>
|
|
|
|
|
- <th>Округ</th>
|
|
|
|
|
- <th>Район</th>
|
|
|
|
|
- <th>Адрес</th>
|
|
|
|
|
- <th>Тип объекта</th>
|
|
|
|
|
- <th>Артикулы МАФ</th>
|
|
|
|
|
- <th>Кол-во позиций</th>
|
|
|
|
|
- <th>Бригадир</th>
|
|
|
|
|
- <th>Примечание</th>
|
|
|
|
|
- </tr>
|
|
|
|
|
|
|
+ <tr>
|
|
|
|
|
+ <th class="text-center vertical">День недели</th>
|
|
|
|
|
+ <th class="text-center vertical">Дата</th>
|
|
|
|
|
+ <th>Код адр</th>
|
|
|
|
|
+ <th>Округ</th>
|
|
|
|
|
+ <th>Район</th>
|
|
|
|
|
+ <th>Адрес</th>
|
|
|
|
|
+ <th>Тип объекта</th>
|
|
|
|
|
+ <th>Артикулы МАФ</th>
|
|
|
|
|
+ <th>Кол-во позиций</th>
|
|
|
|
|
+ <th>Бригадир</th>
|
|
|
|
|
+ <th>Примечание</th>
|
|
|
|
|
+ <th></th>
|
|
|
|
|
+ </tr>
|
|
|
</thead>
|
|
</thead>
|
|
|
<tbody>
|
|
<tbody>
|
|
|
@foreach($schedules as $dow => $schs)
|
|
@foreach($schedules as $dow => $schs)
|
|
|
<tr>
|
|
<tr>
|
|
|
- <td rowspan="{{ ($schs) ? count($schs) : '1' }}" class="vertical">{{ \App\Helpers\DateHelper::getHumanDayOfWeek($dow) }}</td>
|
|
|
|
|
- <td rowspan="{{ ($schs) ? count($schs) : '1' }}" class="vertical">{{ \App\Helpers\DateHelper::getHumanDate($dow) }}</td>
|
|
|
|
|
|
|
+ <td rowspan="{{ ($schs) ? count($schs) : '1' }}"
|
|
|
|
|
+ class="vertical">{{ \App\Helpers\DateHelper::getHumanDayOfWeek($dow) }}
|
|
|
|
|
+ <i class="bi bi-calendar-plus text-primary ms-2 createSchedule"
|
|
|
|
|
+ title="Новая запись" data-schedule-date="{{ $dow }}"></i>
|
|
|
|
|
+ </td>
|
|
|
|
|
+ <td rowspan="{{ ($schs) ? count($schs) : '1' }}"
|
|
|
|
|
+ class="vertical">{{ \App\Helpers\DateHelper::getHumanDate($dow) }}</td>
|
|
|
@if($schs)
|
|
@if($schs)
|
|
|
@foreach($schs as $schedule)
|
|
@foreach($schs as $schedule)
|
|
|
{!! (!$loop->first) ? '<tr>':'' !!}
|
|
{!! (!$loop->first) ? '<tr>':'' !!}
|
|
|
- <td style="background: {{ $schedule->brigadier->color }}" class="align-middle">{{ $schedule->order_id }}</td>
|
|
|
|
|
- <td style="background: {{ $schedule->brigadier->color }}" class="align-middle">{{ $schedule->district->shortname }}</td>
|
|
|
|
|
- <td style="background: {{ $schedule->brigadier->color }}" class="align-middle">{{ $schedule->area->name }}</td>
|
|
|
|
|
- <td style="background: {{ $schedule->brigadier->color }}" class="align-middle">{{ $schedule->object_address }}</td>
|
|
|
|
|
- <td style="background: {{ $schedule->brigadier->color }}" class="align-middle">{{ $schedule->objectType->name }}</td>
|
|
|
|
|
- <td style="background: {{ $schedule->brigadier->color }}" class="align-middle">{!! $schedule->mafs !!}</td>
|
|
|
|
|
- <td style="background: {{ $schedule->brigadier->color }}" class="align-middle">{{ $schedule->mafs_count }}</td>
|
|
|
|
|
- <td style="background: {{ $schedule->brigadier->color }}" class="align-middle">{{ $schedule->brigadier->name }}</td>
|
|
|
|
|
- <td style="background: {{ $schedule->brigadier->color }}" class="align-middle">{{ $schedule->comment }}</td>
|
|
|
|
|
|
|
+ <td style="background: {{ $schedule->brigadier->color }}"
|
|
|
|
|
+ class="align-middle">{{ $schedule->order_id }}</td>
|
|
|
|
|
+ <td style="background: {{ $schedule->brigadier->color }}"
|
|
|
|
|
+ class="align-middle">{{ $schedule->district->shortname }}</td>
|
|
|
|
|
+ <td style="background: {{ $schedule->brigadier->color }}"
|
|
|
|
|
+ class="align-middle">{{ $schedule->area->name }}</td>
|
|
|
|
|
+ <td style="background: {{ $schedule->brigadier->color }}"
|
|
|
|
|
+ class="align-middle">{{ $schedule->object_address }}</td>
|
|
|
|
|
+ <td style="background: {{ $schedule->brigadier->color }}"
|
|
|
|
|
+ class="align-middle">{{ $schedule->objectType->name }}</td>
|
|
|
|
|
+ <td style="background: {{ $schedule->brigadier->color }}"
|
|
|
|
|
+ class="align-middle">{!! $schedule->mafs !!}</td>
|
|
|
|
|
+ <td style="background: {{ $schedule->brigadier->color }}"
|
|
|
|
|
+ class="align-middle">{{ $schedule->mafs_count }}</td>
|
|
|
|
|
+ <td style="background: {{ $schedule->brigadier->color }}"
|
|
|
|
|
+ class="align-middle">{{ $schedule->brigadier->name }}</td>
|
|
|
|
|
+ <td style="background: {{ $schedule->brigadier->color }}" class="align-middle comment-{{ $schedule->id }}">{{ $schedule->comment }}</td>
|
|
|
|
|
+ <td style="background: {{ $schedule->brigadier->color }}" class="align-middle">
|
|
|
|
|
+ <i class="bi bi-pencil ms-3 cursor-pointer text-primary editSchedule"
|
|
|
|
|
+ data-schedule-date="{{ $schedule->installation_date }}" data-schedule-id="{{ $schedule->id }}"></i>
|
|
|
|
|
+ </td>
|
|
|
</tr>
|
|
</tr>
|
|
|
@endforeach
|
|
@endforeach
|
|
|
- @endif
|
|
|
|
|
- {!! (!$schs) ? '</tr>': '' !!}
|
|
|
|
|
|
|
+ @endif
|
|
|
|
|
+ {!! (!$schs) ? '</tr>': '' !!}
|
|
|
|
|
|
|
|
@endforeach
|
|
@endforeach
|
|
|
|
|
|
|
|
</tbody>
|
|
</tbody>
|
|
|
</table>
|
|
</table>
|
|
|
|
|
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
|
|
+ <!-- Модальное окно редактирования графика -->
|
|
|
|
|
+ <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>
|
|
|
|
|
+ <input type="date" name="installation_date" value="" class="form-control form-control-sm mb-3">
|
|
|
|
|
+ <textarea name="comment" placeholder="Комментарий для графика"
|
|
|
|
|
+ class="form-control form-control-sm mb-3"></textarea>
|
|
|
|
|
+ <button type="submit" class="btn btn-primary btn-sm">Обновить</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
+ <!-- Модальное окно создания графика -->
|
|
|
|
|
+ <div class="modal fade" id="createSchedule" 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.create') }}" method="post" id="scheduleCreateForm">
|
|
|
|
|
+ @csrf
|
|
|
|
|
+ <input type="text" class="form-control mb-2" placeholder="Поиск площадки" id="search_order">
|
|
|
|
|
+ <select id="select_order" name="order_id" class="form-select mb-3" size="7" multiple
|
|
|
|
|
+ required></select>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <input type="date" name="installation_date" value="" class="form-control form-control-sm mb-3">
|
|
|
|
|
+ <textarea name="comment" placeholder="Комментарий для графика"
|
|
|
|
|
+ class="form-control form-control-sm mb-3"></textarea>
|
|
|
|
|
+ <button type="submit" class="btn btn-primary btn-sm">Создать</button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </form>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
|
|
|
@if($errors->any())
|
|
@if($errors->any())
|
|
|
@dump($errors)
|
|
@dump($errors)
|
|
@@ -94,18 +161,52 @@
|
|
|
@endsection
|
|
@endsection
|
|
|
|
|
|
|
|
@push('scripts')
|
|
@push('scripts')
|
|
|
|
|
+ <script type="module">
|
|
|
|
|
+ $('.editSchedule').on('click', function () {
|
|
|
|
|
+ let scheduleId = $(this).attr('data-schedule-id');
|
|
|
|
|
+ let scheduleDate = $(this).attr('data-schedule-date');
|
|
|
|
|
+ let scheduleComment = $('.comment-'+scheduleId).text();
|
|
|
|
|
+ $('form#scheduleEditForm input[name=id]').val(scheduleId);
|
|
|
|
|
+ $('form#scheduleEditForm input[name=installation_date]').val(scheduleDate);
|
|
|
|
|
+ $('form#scheduleEditForm textarea').text(scheduleComment);
|
|
|
|
|
+ let myModalEditSchedule = new bootstrap.Modal(document.getElementById("copySchedule"), {});
|
|
|
|
|
+ myModalEditSchedule.show();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ $('.createSchedule').on('click', function () {
|
|
|
|
|
+ let scheduleDate = $(this).attr('data-schedule-date');
|
|
|
|
|
+
|
|
|
|
|
+ $('form#scheduleCreateForm input[name=installation_date]').val(scheduleDate);
|
|
|
|
|
+ $('form#scheduleCreateForm textarea').text('');
|
|
|
|
|
+
|
|
|
|
|
+ let myModalCreateSchedule = new bootstrap.Modal(document.getElementById("createSchedule"), {});
|
|
|
|
|
+ myModalCreateSchedule.show();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // select order
|
|
|
|
|
+ $('#search_order').on('keyup', function () {
|
|
|
|
|
+ // search products on backend
|
|
|
|
|
+ $.get('{{ route('order.search') }}?s=' + $(this).val(),
|
|
|
|
|
+ function (data) {
|
|
|
|
|
+ $('#select_order').children().remove()
|
|
|
|
|
+ $.each(data, function (id, name) {
|
|
|
|
|
+ $('#select_order').append('<option value=\'' + id + '\'>' + name + '</option>');
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
+ }).trigger('keyup');
|
|
|
|
|
+ </script>
|
|
|
<script type="text/javascript">
|
|
<script type="text/javascript">
|
|
|
function getWeekNumber(d) {
|
|
function getWeekNumber(d) {
|
|
|
// Copy date so don't modify original
|
|
// Copy date so don't modify original
|
|
|
d = new Date(Date.parse(d));
|
|
d = new Date(Date.parse(d));
|
|
|
// Set to nearest Thursday: current date + 4 - current day number
|
|
// Set to nearest Thursday: current date + 4 - current day number
|
|
|
// Make Sunday's day number 7
|
|
// Make Sunday's day number 7
|
|
|
- d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay()||7));
|
|
|
|
|
|
|
+ d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
|
|
|
// Get first day of year
|
|
// Get first day of year
|
|
|
- let yearStart = new Date(Date.UTC(d.getUTCFullYear(),0,1));
|
|
|
|
|
|
|
+ let yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
|
|
|
// Calculate and return week number
|
|
// Calculate and return week number
|
|
|
return Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
|
|
return Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
</script>
|
|
</script>
|
|
|
@endpush
|
|
@endpush
|