From ea8b4e939e34d00780c2a320cecebfc0c6156822 Mon Sep 17 00:00:00 2001 From: dbarzin Date: Mon, 16 Mar 2026 09:56:24 +0100 Subject: [PATCH 1/4] npm build --- package-lock.json | 4 ++-- package.json | 2 +- version.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index a00ad75c..5e90c75c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "Deming", - "version": "2026.03.04", + "version": "2026.03.16", "lockfileVersion": 3, "requires": true, "packages": { "": { - "version": "2026.03.04", + "version": "2026.03.16", "license": "GPL-3.0", "dependencies": { "@emotion/react": "^11.14.0", diff --git a/package.json b/package.json index b4127a26..81fc291d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "2026.03.04", + "version": "2026.03.16", "license": "GPL-3.0", "author": "Didier Barzin", "repository": "https://www.github.com/dbarzin/deming", diff --git a/version.txt b/version.txt index cd5e0f93..d8f6b6eb 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2026.03.04 +2026.03.16 From ffdbe1889e71caa602896689771c26b908d778db Mon Sep 17 00:00:00 2001 From: dbarzin Date: Wed, 18 Mar 2026 09:47:55 +0100 Subject: [PATCH 2/4] add weekly periodicity --- app/Http/Controllers/ControlController.php | 86 ++++++++++++++-------- app/Http/Controllers/HomeController.php | 32 +++++--- resources/lang/de/common.php | 1 + resources/lang/en/common.php | 1 + resources/lang/fr/common.php | 1 + resources/views/actions/index.blade.php | 4 +- resources/views/controls/create.blade.php | 1 + resources/views/controls/edit.blade.php | 1 + resources/views/controls/make.blade.php | 4 +- resources/views/controls/plan.blade.php | 3 +- resources/views/controls/show.blade.php | 1 + resources/views/measures/plan.blade.php | 1 + 12 files changed, 93 insertions(+), 43 deletions(-) diff --git a/app/Http/Controllers/ControlController.php b/app/Http/Controllers/ControlController.php index b087f81f..35c15e27 100644 --- a/app/Http/Controllers/ControlController.php +++ b/app/Http/Controllers/ControlController.php @@ -791,17 +791,31 @@ public function history() foreach ($controls as $control) { $expandedControls->push($control); - if (($control->realisation_date === null) && - ($control->periodicity > 0) && ($control->periodicity <= 12)) { - for ($i = 1; $i <= 12 / $control->periodicity; $i++) { - $repeatedControl = clone $control; - $repeatedControl->id = null; - $repeatedControl->score = null; - $repeatedControl->observations = null; - $repeatedControl->realisation_date = null; - $repeatedControl->plan_date = Carbon::parse($control->plan_date)->addMonthsNoOverflow($i * $control->periodicity); - $expandedControls->push($repeatedControl); + if ($control->realisation_date === null) { + if ($control->periodicity === -1) { + // weekly + for ($i = 1; $i <= 52; $i++) { + $repeatedControl = clone $control; + $repeatedControl->id = null; + $repeatedControl->score = null; + $repeatedControl->observations = null; + $repeatedControl->realisation_date = null; + $repeatedControl->plan_date = Carbon::parse($control->plan_date)->addDays($i * 7); + $expandedControls->push($repeatedControl); + } } + else if (($control->periodicity > 0) && ($control->periodicity <= 12)) { + // Monthly + for ($i = 1; $i <= 12 / $control->periodicity; $i++) { + $repeatedControl = clone $control; + $repeatedControl->id = null; + $repeatedControl->score = null; + $repeatedControl->observations = null; + $repeatedControl->realisation_date = null; + $repeatedControl->plan_date = Carbon::parse($control->plan_date)->addMonthsNoOverflow($i * $control->periodicity); + $expandedControls->push($repeatedControl); + } + } } } // Return view with controls @@ -1357,10 +1371,19 @@ public function make(Request $request) $next_date = null; } else { // Computer next Date - $next_date = - Carbon::createFromFormat('Y-m-d', $control->plan_date) - ->addMonthsNoOverflow($control->periodicity) - ->format('Y-m-d'); + if ($control->periodicity === -1) { + // One week + $next_date = + Carbon::createFromFormat('Y-m-d', $control->plan_date) + ->addDays(7) + ->format('Y-m-d'); + } + else + // Add months + $next_date = + Carbon::createFromFormat('Y-m-d', $control->plan_date) + ->addMonthsNoOverflow($control->periodicity) + ->format('Y-m-d'); } // return view @@ -1461,16 +1484,19 @@ public function doMake(Request $request) $new_control->score = null; $new_control->status = 0; // only admin and user can update the plan_date, realisation_date and action_plan - if (Auth::User()->role === 1 || Auth::User()->role === 2) { + if (Auth::User()->isAdmin() || Auth::User()->isUser()) { $new_control->plan_date = request('next_date'); } else { - $new_control->plan_date = date( - 'Y-m-d', - strtotime( - $control->periodicity . ' months', - strtotime($control->plan_date) - ) - ); + if ($control->periodicity === -1) + // One week + $new_control->plan_date = Carbon::parse($control->plan_date) + ->addDays(7) + ->toDateString(); + else + // Months + $new_control->plan_date = Carbon::parse($control->plan_date) + ->addMonths($control->periodicity) + ->toDateString(); } $new_control->save(); @@ -1505,13 +1531,13 @@ public function save(Request $request) { // Only for CISO abort_if( - Auth::User()->role !== 1, + ! Auth::User()->isAdmin(), Response::HTTP_FORBIDDEN, '403 Forbidden' ); // Get the control - $control = Control::find($request->id); + $control = Control::query()->find($request->id); // Control not found abort_if($control === null, Response::HTTP_NOT_FOUND, '404 Not Found'); @@ -1583,7 +1609,7 @@ public function draft(Request $request) { // Not for API abort_if( - Auth::User()->role === 4, + Auth::User()->isAPI(), Response::HTTP_FORBIDDEN, '403 Forbidden' ); @@ -1611,7 +1637,7 @@ public function draft(Request $request) $control->score = request('score') === 0 ? null : request('score'); // only admin and user can update the plan_date and action_plan - if (Auth::User()->role === 1 || Auth::User()->role === 2) { + if (Auth::User()->isAdmin() || Auth::User()->isUser()) { $control->plan_date = request('plan_date'); $control->action_plan = request('action_plan'); // do not save the realisation date as it is in draft @@ -1632,7 +1658,7 @@ public function reject(Request $request) { // Only for Admin and user abort_if( - ! (Auth::User()->role === 1 || Auth::User()->role === 2), + ! (Auth::User()->isAdmin() || Auth::User()->isUser()), Response::HTTP_FORBIDDEN, '403 Forbidden' ); @@ -1766,7 +1792,7 @@ public function tempo(Request $request) { // For administrators and users only abort_if( - Auth::User()->role !== 1 && Auth::User()->role !== 2, + ! Auth::User()->isAdmin() && !Auth::User()->isUser(), Response::HTTP_FORBIDDEN, '403 Forbidden' ); @@ -1774,7 +1800,7 @@ public function tempo(Request $request) // get measures if ($request->id !== null) { // Find associate control - $measures = Measure::where('clause', '=', $request->id)->get(); + $measures = Measure::query()->where('clause', '=', $request->id)->get(); } else { $measures = Collect(); } @@ -1795,7 +1821,7 @@ public function template(Request $request) { // Not for API abort_if( - Auth::User()->role === 4, + Auth::User()->isAPI(), Response::HTTP_FORBIDDEN, '403 Forbidden' ); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index adabd822..43b06bd9 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -419,18 +419,30 @@ private function getExpandedControls() return $controls->flatMap(function ($control) { $expanded = collect([$control]); - if ($control->realisation_date === null && $control->periodicity > 0 && $control->periodicity <= 12) { - for ($i = 1; $i <= 12 / $control->periodicity; $i++) { - $repeatedControl = clone $control; - $repeatedControl->id = null; - $repeatedControl->score = null; - $repeatedControl->observations = null; - $repeatedControl->realisation_date = null; - $repeatedControl->plan_date = Carbon::parse($control->plan_date)->addMonthsNoOverflow($i * $control->periodicity); - $expanded->push($repeatedControl); + if ($control->realisation_date === null) { + if ($control->periodicity === -1) { + for ($i = 1; $i <= 32; $i++) { + $repeatedControl = clone $control; + $repeatedControl->id = null; + $repeatedControl->score = null; + $repeatedControl->observations = null; + $repeatedControl->realisation_date = null; + $repeatedControl->plan_date = Carbon::parse($control->plan_date)->addDays($i * 7); + $expanded->push($repeatedControl); + } + } + else if ($control->periodicity > 0 && $control->periodicity <= 12) { + for ($i = 1; $i <= 12 / $control->periodicity; $i++) { + $repeatedControl = clone $control; + $repeatedControl->id = null; + $repeatedControl->score = null; + $repeatedControl->observations = null; + $repeatedControl->realisation_date = null; + $repeatedControl->plan_date = Carbon::parse($control->plan_date)->addMonthsNoOverflow($i * $control->periodicity); + $expanded->push($repeatedControl); + } } } - return $expanded; }); } diff --git a/resources/lang/de/common.php b/resources/lang/de/common.php index b80df9aa..603a0f33 100644 --- a/resources/lang/de/common.php +++ b/resources/lang/de/common.php @@ -21,6 +21,7 @@ 'validate' => 'Validieren', 'once' => 'einmalig', + 'weekly' => 'wöchentlich', 'monthly' => 'monatlich', 'quarterly' => 'quartal', 'biannually' => 'halbjährlich', diff --git a/resources/lang/en/common.php b/resources/lang/en/common.php index c4159b0f..f9e62649 100644 --- a/resources/lang/en/common.php +++ b/resources/lang/en/common.php @@ -24,6 +24,7 @@ 'validate' => 'Validate', 'once' => 'Once', + 'weekly' => 'Weekly', 'monthly' => 'Monthly', 'quarterly' => 'Quarterly', 'biannually' => 'Biannually', diff --git a/resources/lang/fr/common.php b/resources/lang/fr/common.php index 12d6b104..ea482362 100644 --- a/resources/lang/fr/common.php +++ b/resources/lang/fr/common.php @@ -24,6 +24,7 @@ 'validate' => 'Valider', 'once' => 'Une fois', + 'weekly' => 'Hebdomadaire', 'monthly' => 'Mensuel', 'quarterly' => 'Trimestriel', 'biannually' => 'Bisanuel', diff --git a/resources/views/actions/index.blade.php b/resources/views/actions/index.blade.php index 3668e794..338e0323 100644 --- a/resources/views/actions/index.blade.php +++ b/resources/views/actions/index.blade.php @@ -98,7 +98,9 @@ @foreach($actions as $action) - {{ $action->reference==null ? ("ACT-".$action->id) : $action->reference }} + + {{ $action->reference==null ? ("ACT-".$action->id) : $action->reference }} +

diff --git a/resources/views/controls/create.blade.php b/resources/views/controls/create.blade.php index 078b096e..d98ac8d9 100644 --- a/resources/views/controls/create.blade.php +++ b/resources/views/controls/create.blade.php @@ -117,6 +117,7 @@

+ diff --git a/resources/views/controls/make.blade.php b/resources/views/controls/make.blade.php index 20b22108..19342084 100644 --- a/resources/views/controls/make.blade.php +++ b/resources/views/controls/make.blade.php @@ -209,7 +209,9 @@ {{ $next_date }} @endif ( - @if ($control->periodicity==1) + @if ($control->periodicity==-1) + {{ trans("common.weekly") }} + @elseif ($control->periodicity==1) {{ trans("common.monthly") }} @elseif ($control->periodicity==3) {{ trans("common.quarterly") }} diff --git a/resources/views/controls/plan.blade.php b/resources/views/controls/plan.blade.php index 3ceb4313..4eba279d 100644 --- a/resources/views/controls/plan.blade.php +++ b/resources/views/controls/plan.blade.php @@ -76,7 +76,8 @@
+ From 4f5269c6a08af3819cfb0e1555820c0964e1bed4 Mon Sep 17 00:00:00 2001 From: dbarzin Date: Wed, 18 Mar 2026 10:29:51 +0100 Subject: [PATCH 3/4] add icons to actions list --- app/Http/Controllers/ActionController.php | 2 +- resources/views/actions/index.blade.php | 32 +++++++++-------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/app/Http/Controllers/ActionController.php b/app/Http/Controllers/ActionController.php index 5f2292a9..f2be660a 100644 --- a/app/Http/Controllers/ActionController.php +++ b/app/Http/Controllers/ActionController.php @@ -278,7 +278,7 @@ public function edit(int $id) ); // Get the action - $action = Action::find($id); + $action = Action::query()->find($id); // Control not found abort_if($action === null, Response::HTTP_NOT_FOUND, '404 Not Found'); diff --git a/resources/views/actions/index.blade.php b/resources/views/actions/index.blade.php index 338e0323..02ad5d9f 100644 --- a/resources/views/actions/index.blade.php +++ b/resources/views/actions/index.blade.php @@ -103,26 +103,18 @@ -

- @if ($action->type==1) -

- {{ trans('cruds.action.types.major') }} -

- @elseif ($action->type==2) -

- {{ trans('cruds.action.types.minor') }} -

- @elseif ($action->type==3) -

- {{ trans('cruds.action.types.observation') }} -

- @elseif ($action->type==4) -

- {{ trans('cruds.action.types.opportunity') }} -

- @endif -

- +
+ @if ($action->type==1) + + @elseif ($action->type==2) + + @elseif ($action->type==3) + + @elseif ($action->type==4) + + @endif + +
@if ($action->status==0) {{ trans('cruds.action.fields.status_open') }} From 2bc8982d7546d75506b4841fc62146939f37ec4c Mon Sep 17 00:00:00 2001 From: dbarzin Date: Wed, 18 Mar 2026 10:41:17 +0100 Subject: [PATCH 4/4] fixes --- app/Http/Controllers/ControlController.php | 6 +++--- app/Http/Controllers/MeasureController.php | 2 +- resources/views/actions/index.blade.php | 2 +- resources/views/controls/edit.blade.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/ControlController.php b/app/Http/Controllers/ControlController.php index 35c15e27..68e5ac3e 100644 --- a/app/Http/Controllers/ControlController.php +++ b/app/Http/Controllers/ControlController.php @@ -379,7 +379,7 @@ public function store(Request $request) 'scope' => 'max:32', 'objective' => 'required', 'plan_date' => 'required', - 'periodicity' => 'required|integer', + 'periodicity' => 'required|integer|in:-1,0,1,3,6,12', ] ); @@ -1299,7 +1299,7 @@ public function doPlan(Request $request) // Validate fields $this->validate($request, [ 'plan_date' => 'required', - 'periodicity' => 'required', + 'periodicity' => 'required|integer|in:-1,0,1,3,6,12', ]); // Find the control @@ -1549,7 +1549,7 @@ public function save(Request $request) 'scope' => 'max:32', 'objective' => 'required', 'plan_date' => 'required', - 'periodicity' => 'required|integer', + 'periodicity' => 'required|integer|in:-1,0,1,3,6,12', ] ); diff --git a/app/Http/Controllers/MeasureController.php b/app/Http/Controllers/MeasureController.php index ea4b6bd0..ade59423 100644 --- a/app/Http/Controllers/MeasureController.php +++ b/app/Http/Controllers/MeasureController.php @@ -558,7 +558,7 @@ public function activate(Request $request) : RedirectResponse $request, [ 'plan_date' => 'required', - 'periodicity' => 'required', + 'periodicity' => 'required|integer|in:-1,0,1,3,6,12', 'measures' => 'array|min:1', ] ); diff --git a/resources/views/actions/index.blade.php b/resources/views/actions/index.blade.php index 02ad5d9f..6be107e0 100644 --- a/resources/views/actions/index.blade.php +++ b/resources/views/actions/index.blade.php @@ -113,8 +113,8 @@ @elseif ($action->type==4) @endif - + @if ($action->status==0) {{ trans('cruds.action.fields.status_open') }} diff --git a/resources/views/controls/edit.blade.php b/resources/views/controls/edit.blade.php index 8f217ffa..26f016a2 100644 --- a/resources/views/controls/edit.blade.php +++ b/resources/views/controls/edit.blade.php @@ -189,7 +189,7 @@