diff --git a/CHANGELOG.md b/CHANGELOG.md
index af02429..1f2d55e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+### 15.03.2022
+- le presse-papier du planning n'est plus vidé après un collage
+
+### 08.03.2022 -> 1.08
+- passage à 8 slots dans le planning
+
+### 03.01.2022 -> 1.0.7
+- nouveau stockage pour le planning
+
### 01.12 -> 1.0.6
- Ajout d'un nouveau type de Ticket : Demande relative aux Newsletters
diff --git a/app/Http/Controllers/PlanningController.php b/app/Http/Controllers/PlanningController.php
deleted file mode 100644
index 9831221..0000000
--- a/app/Http/Controllers/PlanningController.php
+++ /dev/null
@@ -1,65 +0,0 @@
-startOfWeek();
- if ($request->p) {
- $date = Carbon::createFromTimestamp($request->p)->startOfWeek();
- }
- $userIds = User::where('role', Role::developper())->pluck('id');
- $weeks = WeekPlanning::whereDate('start', $date)
- ->with('user')->get();
- foreach ($userIds as $id) {
- // auto create missing planning for user
- if ($date >= Carbon::now()->startOfWeek() and !$weeks->contains('user.id', $id)) {
- $wp = new WeekPlanning([
- 'start' => $date,
- 'planning' => WeekPlanning::getWeekBlock($date),
- 'user_id' => $id
- ]);
- $wp->saveOrFail();
- $weeks->push($wp);
- }
- }
- return view('planning.index', compact('weeks', 'date'));
- }
-
- public function setCellContent(SetCellContentRequest $request)
- {
- $wp = WeekPlanning::findOrFail($request->id);
- if (!isset($wp->planning[$request->day][$request->row])) {
- abort(422, trans('Ce jour et ce moment n\'existent pas.'));
- }
- $planning = $wp->planning;
- $planning[$request->day][$request->row] =
- array_merge(WeekPlanning::getCell(), array_intersect_key($request->all(), WeekPlanning::getCell()));
- $wp->planning = $planning;
- $wp->saveOrFail();
- return \response()->json(['status' => true]);
- }
-
- public function eraseCellContent(EraseCellContentRequest $request)
- {
- $wp = WeekPlanning::findOrFail($request->id);
- if (!isset($wp->planning[$request->day][$request->row])) {
- abort(422, trans('Ce jour et ce moment n\'existent pas.'));
- }
- $planning = $wp->planning;
- $planning[$request->day][$request->row] = WeekPlanning::getCell();
- $wp->planning = $planning;
- $wp->saveOrFail();
- return \response()->json(['status' => true]);
- }
-}
diff --git a/app/Http/Controllers/TicketController.php b/app/Http/Controllers/TicketController.php
index f2815ed..c783d45 100644
--- a/app/Http/Controllers/TicketController.php
+++ b/app/Http/Controllers/TicketController.php
@@ -72,7 +72,7 @@ class TicketController extends Controller
});
$tickets = $tickets->where('is_internal', 0);
}
- $tickets = $tickets->where('status', ($request->status == TicketStatus::archived()) ?
+ $tickets = $tickets->where('status', ($request->st == TicketStatus::archived()) ?
'=' : '<>', TicketStatus::archived());
if ($request->search) {
$tickets = $this->searchTicket($tickets, $request);
diff --git a/app/Models/WeekPlanning.php b/app/Models/WeekPlanning.php
deleted file mode 100644
index bf8afd1..0000000
--- a/app/Models/WeekPlanning.php
+++ /dev/null
@@ -1,61 +0,0 @@
- 'date',
- 'planning' => 'array'
- ];
-
- protected $fillable = [
- 'start', 'planning', 'user_id'
- ];
-
- public static function getWeekBlock(Carbon $start): array
- {
- $start = $start->copy();
- $out = [];
- $daysOfWeek = 5;
- for ($i = 1; $i <= $daysOfWeek; $i++) {
- $out[$start->timestamp] = [];
- foreach (TableRow::toArray() as $tableRow) {
- $out[$start->timestamp][$tableRow->value] = \array_replace(
- self::getCell(),
- [
- 'row' => $tableRow->value
- ]
- );
- }
- $day = $start->addDay();
- }
- return $out;
- }
-
- public static function getCell(): array
- {
- return [
- /** @var \App\Enums\Planning\CellType */
- 'type' => null,
- /** @var \App\Enums\Planning\TableRow */
- 'row' => null,
- 'foreign' => null,
- /** @var \App\Enums\Planning\CellModel */
- 'cellModel' => null,
- 'text' => ''
- ];
- }
-
- public function user()
- {
- return $this->belongsTo(User::class);
- }
-}
diff --git a/composer.json b/composer.json
index 5648bdd..580f366 100644
--- a/composer.json
+++ b/composer.json
@@ -1,6 +1,6 @@
{
"name": "ldcweb/supportweb",
- "version": "1.0.6",
+ "version": "1.0.8",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
diff --git a/database/factories/WeekPlanningFactory.php b/database/factories/WeekPlanningFactory.php
deleted file mode 100644
index f3e3dee..0000000
--- a/database/factories/WeekPlanningFactory.php
+++ /dev/null
@@ -1,76 +0,0 @@
-states)->last());
- if (static::$user_id and $func->getStaticVariables()['state']['user_id'] != static::$user_id) {
- static::$currentDate = null;
- }
- if (!static::$currentDate) {
- static::$user_id = $func->getStaticVariables()['state']['user_id'];
- static::$currentDate = $func->getStaticVariables()['state']['start'];
- } else {
- static::$currentDate = static::$currentDate->endOfWeek()->addDay();
- }
- $wBlock = WeekPlanning::getWeekBlock(static::$currentDate);
- foreach ($wBlock as &$dayRows) {
- foreach ($dayRows as &$cell) {
- $cell['type'] = collect(CellType::toArray())->random()->value;
- if (rand(0, 3)) {
- $cellModel = collect(CellModel::toArray())->random();
- $cell['cellModel'] = $cellModel->value;
- switch ($cellModel) {
- case (new Ticket())->getTable():
- $cell['foreign'] = Ticket::select(['id'])
- ->inRandomOrder()->first()->id;
- break;
- case (new Site())->getTable():
- $cell['foreign'] = Site::select(['id'])
- ->inRandomOrder()->first()->id;
- break;
- case (new Project())->getTable():
- $cell['foreign'] = Project::select(['id'])
- ->inRandomOrder()->first()->id;
- break;
- }
- $cell['text'] = $this->faker->text(rand(20, 50));
- }
- }
- }
- return [
- 'start' => static::$currentDate,
- 'planning' => $wBlock
- ];
- }
-}
diff --git a/database/migrations/2022_03_15_164122_drop_week_plannings_table.php b/database/migrations/2022_03_15_164122_drop_week_plannings_table.php
new file mode 100644
index 0000000..f3dccd4
--- /dev/null
+++ b/database/migrations/2022_03_15_164122_drop_week_plannings_table.php
@@ -0,0 +1,37 @@
+id();
+
+ $table->date('start');
+ $table->text('planning');
+
+ $table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
+
+ $table->timestamps();
+ });
+ }
+}
diff --git a/resources/js/components/PlanningComponent.vue b/resources/js/components/PlanningComponent.vue
deleted file mode 100644
index 149540f..0000000
--- a/resources/js/components/PlanningComponent.vue
+++ /dev/null
@@ -1,582 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- {{ currentWeek.user.name }}
-
-
- S{{ moment(currentWeek.start).week() }}
- {{ moment(currentWeek.start).format('MMMM YYYY') }}
-
-
-
-
-
- {{ moment.unix(timestamp).format("dddd DD") }}
-
-
-
-
- {{ row.label }}
-
-
-
- {{ getCellObjectInfo(day[row.value]).text }}
-
- Rien
-
-
- {{ day[row.value]["text"] | str_limit(25) }}
-
-
-
-
- Pas de planning à afficher
-