|
|
@@ -0,0 +1,113 @@
|
|
|
+@extends('layouts.app')
|
|
|
+
|
|
|
+@section('content')
|
|
|
+ <div class="row mb-3">
|
|
|
+ <div class="col-6">
|
|
|
+ <h3>График монтажей</h3>
|
|
|
+ </div>
|
|
|
+ <div class="col-6 text-end">
|
|
|
+ <div class="d-flex flex-row justify-content-end">
|
|
|
+ <div class="p-2">
|
|
|
+ <button @disabled($weekNumber == 1) class="btn btn-sm btn-primary"
|
|
|
+ onclick="document.location = '{{ route('schedule.index', ['week' => $weekNumber - 1]) }}'">
|
|
|
+ <i class="bi bi-arrow-left"></i>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <label class="p-2 d-block small mt-1">Неделя №</label>
|
|
|
+ <div class="p-2">
|
|
|
+ <input type="number" style="width: 3rem" value="{{ $weekNumber }}" class="form-control form-control-sm"
|
|
|
+ onchange="document.location = '{{ route('schedule.index') }}?week='+this.value"
|
|
|
+ min="1" max="53" title="№ недели">
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="p-2">
|
|
|
+ <input type="date" min="{{ year() . '-01-01' }}" max="{{ year() . '-12-31' }}"
|
|
|
+ class="form-control form-control-sm" value="{{ $weekDates['mon'] }}" title="начало недели"
|
|
|
+ onchange="document.location = '{{ route('schedule.index') }}?week=' + getWeekNumber(this.value)">
|
|
|
+ </div>
|
|
|
+ <div class="p-2">
|
|
|
+ <input type="date" disabled
|
|
|
+ class="form-control form-control-sm" value="{{ $weekDates['sun'] }}" title="конец недели">
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="p-2">
|
|
|
+ <button @disabled($weekNumber > 52) class="btn btn-sm btn-primary"
|
|
|
+ onclick="document.location = '{{ route('schedule.index', ['week' => $weekNumber + 1]) }}'">
|
|
|
+ <i class="bi bi-arrow-right"></i>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="schedule">
|
|
|
+ <table class="table">
|
|
|
+ <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>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ @foreach($schedules as $dow => $orders)
|
|
|
+ <tr>
|
|
|
+ <td rowspan="{{ ($orders) ? count($orders) : '1' }}" class="vertical">{{ \App\Helpers\DateHelper::getHumanDayOfWeek($dow) }}</td>
|
|
|
+ <td rowspan="{{ ($orders) ? count($orders) : '1' }}" class="vertical">{{ \App\Helpers\DateHelper::getHumanDate($dow) }}</td>
|
|
|
+ @if($orders)
|
|
|
+ @foreach($orders as $order)
|
|
|
+ @if(!$loop->first) <tr> @endif
|
|
|
+ <td>{{ $order->id }}</td>
|
|
|
+ <td>{{ $order->district->shortname }}</td>
|
|
|
+ <td>{{ $order->area->name }}</td>
|
|
|
+ <td>{{ $order->object_address }}</td>
|
|
|
+ <td>{{ $order->objectType->name }}</td>
|
|
|
+ <td>{!! $order->productsWithCount !!}</td>
|
|
|
+ <td>{{ $order->products_sku()->count() }}</td>
|
|
|
+ <td>{{ $order->brigadier->name }}</td>
|
|
|
+ <td></td>
|
|
|
+ @if(!$loop->first) </tr> @endif
|
|
|
+
|
|
|
+ @endforeach
|
|
|
+ @endif
|
|
|
+
|
|
|
+ </tr>
|
|
|
+
|
|
|
+ @endforeach
|
|
|
+
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ @if($errors->any())
|
|
|
+ @dump($errors)
|
|
|
+ @endif
|
|
|
+@endsection
|
|
|
+
|
|
|
+@push('scripts')
|
|
|
+ <script type="text/javascript">
|
|
|
+ function getWeekNumber(d) {
|
|
|
+ // Copy date so don't modify original
|
|
|
+ d = new Date(Date.parse(d));
|
|
|
+ // Set to nearest Thursday: current date + 4 - current day number
|
|
|
+ // Make Sunday's day number 7
|
|
|
+ d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay()||7));
|
|
|
+ // Get first day of year
|
|
|
+ let yearStart = new Date(Date.UTC(d.getUTCFullYear(),0,1));
|
|
|
+ // Calculate and return week number
|
|
|
+ return Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
|
|
|
+ }
|
|
|
+
|
|
|
+ </script>
|
|
|
+@endpush
|