diff --git a/app/Http/Controllers/ScheduleController.php b/app/Http/Controllers/ScheduleController.php index dd61ad6..42e0036 100644 --- a/app/Http/Controllers/ScheduleController.php +++ b/app/Http/Controllers/ScheduleController.php @@ -2,13 +2,10 @@ namespace App\Http\Controllers; -use App\Enums\Planning\ActivityType; use App\Enums\Role; use App\Http\Requests\StoreScheduleRequest; use App\Models\Schedule; use App\Models\User; -use App\Models\WeekPlanning; -use Carbon\Carbon; use Illuminate\Http\Request; use Carbon\CarbonImmutable; @@ -23,7 +20,7 @@ class ScheduleController extends Controller public function index(Request $request) { $date = CarbonImmutable::now()->startOfWeek(); - $nbweeks = 2; + $nbweeks = config('schedules.shownWeeks'); if ($request->p) { $date = CarbonImmutable::createFromFormat('d/m/Y', $request->p)->startOfWeek(); } diff --git a/config/schedules.php b/config/schedules.php new file mode 100644 index 0000000..3930479 --- /dev/null +++ b/config/schedules.php @@ -0,0 +1,6 @@ + 2, + 'daySlots' => 8, +]; diff --git a/database/migrations/2022_03_08_101614_migrate_schedules_to_eight_slots_per_day.php b/database/migrations/2022_03_08_101614_migrate_schedules_to_eight_slots_per_day.php new file mode 100644 index 0000000..5f82835 --- /dev/null +++ b/database/migrations/2022_03_08_101614_migrate_schedules_to_eight_slots_per_day.php @@ -0,0 +1,40 @@ + 0; $i--) { + $schedules = Schedule::where('slot', $i)->get(); + + foreach ($schedules as $oneschedule) { + $newschedule = $oneschedule->replicate(); + $newschedule->slot = $i * 2; + $newschedule->save(); + $oneschedule->slot = ($i * 2) - 1; + $oneschedule->save(); + } + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + //not reversible + } +} diff --git a/resources/js/components/ScheduleComponent.vue b/resources/js/components/ScheduleComponent.vue index d8210e6..734b96a 100644 --- a/resources/js/components/ScheduleComponent.vue +++ b/resources/js/components/ScheduleComponent.vue @@ -25,11 +25,11 @@ @@ -162,6 +163,10 @@ export default { weeks: { type: String, }, + daySlots: { + type: Number, + default: 4 + }, browseDate: { type: String, default: function() { @@ -682,10 +687,18 @@ table.schedules_table { } .cellsizer { - height: 150px; + height: 50px; + &:hover { + height: 150px; + position: absolute; + width: 200%; + left: -50%; + top: -50%; + z-index: 20; + border: 1px solid; + } text-overflow: ellipsis; overflow: hidden; - b { width: 90%; } @@ -694,7 +707,6 @@ table.schedules_table { .dynCell{ position: relative; - &.day { //position: relative; &:hover .btn { diff --git a/resources/views/schedule/index.blade.php b/resources/views/schedule/index.blade.php index 61913ed..d184438 100644 --- a/resources/views/schedule/index.blade.php +++ b/resources/views/schedule/index.blade.php @@ -24,6 +24,7 @@ db-models='@json(CellModel::toArray())' db-users='@json($users)' weeks='@json($weekCells)' + v-bind:day-slots='{{ Config::get('schedules.daySlots') }}' v-bind:show-weekends='false'> @endsection @@ -64,5 +65,8 @@ .absence, .Sat, .Sun { background-color: {{CellType::absence()->value}} !important; } + .empty { + background-color: #FFF !important; + } @endpush diff --git a/resources/views/users/stats.blade.php b/resources/views/users/stats.blade.php index 920a3ad..3966087 100644 --- a/resources/views/users/stats.blade.php +++ b/resources/views/users/stats.blade.php @@ -28,15 +28,15 @@ @foreach ($stat as $data) {{ $data->activity->label }} - {{ $data->nb * 0.25 }} - {{ round((($data->nb * 0.25) / $workdays) * 100) }}% + {{ $data->nb / Config::get('schedules.daySlots') }} + {{ round((($data->nb / Config::get('schedules.daySlots')) / $workdays) * 100) }}% @php $sum += $data->nb; @endphp @endforeach {{ __('Total') }} - {{ $sum * 0.25 }} / {{ $workdays }} - {{ round((($sum * 0.25) / $workdays) * 100) }}% + {{ $sum / Config::get('schedules.daySlots') }} / {{ $workdays }} + {{ round((($sum / 8) / $workdays) * 100) }}% @@ -46,4 +46,4 @@ -@endsection \ No newline at end of file +@endsection