94 lines
2.6 KiB
PHP
94 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Enums\Planning\CellType;
|
|
use App\Enums\Role;
|
|
use App\Models\User;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Carbon;
|
|
use Carbon\CarbonImmutable;
|
|
|
|
class ScheduleController extends Controller
|
|
{
|
|
public function index(Request $request)
|
|
{
|
|
$date = CarbonImmutable::now()->startOfWeek();
|
|
$nbweek = 2;
|
|
$users = User::where('role', Role::developper())->get();
|
|
if ($request->p) {
|
|
$date = CarbonImmutable::createFromFormat('d/m/Y',$request->p)->startOfWeek();
|
|
}
|
|
|
|
$schedules = array(
|
|
//userid
|
|
1 =>
|
|
array(
|
|
//day
|
|
'29/11/2021'=>
|
|
array(
|
|
//slot
|
|
0 => array(
|
|
//elements
|
|
'text'=>'item1',
|
|
'type'=>'projects'
|
|
),
|
|
1 => array(
|
|
'text'=>'item2',
|
|
'type'=>'dev'
|
|
),
|
|
2 => array(
|
|
'text'=>'item3',
|
|
'type'=>'dev'
|
|
),
|
|
),
|
|
'01/12/2021' =>
|
|
array(
|
|
1 => array(
|
|
'text'=>'item2',
|
|
'type'=>'rnd'
|
|
),
|
|
2 => array(
|
|
'text'=>'item3',
|
|
'type'=>'support'
|
|
),
|
|
),
|
|
),
|
|
7 =>
|
|
array(
|
|
//day
|
|
'03/12/2021'=>
|
|
array(
|
|
//slot
|
|
0 => array(
|
|
//elements
|
|
'text'=>'item1',
|
|
'type'=>'projects'
|
|
),
|
|
1 => array(
|
|
'text'=>'item2',
|
|
'type'=>'projects'
|
|
),
|
|
3 => array(
|
|
'text'=>'item3',
|
|
'type'=>'dev'
|
|
),
|
|
),
|
|
'06/12/2021' =>
|
|
array(
|
|
1 => array(
|
|
'text'=>'item2',
|
|
'type'=>'support'
|
|
),
|
|
2 => array(
|
|
'text'=>'item3',
|
|
'type'=>'projects'
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
|
|
return view('schedule.index', compact('users','date','nbweek','schedules'));
|
|
}
|
|
}
|