From a178d2e891a70c684fd6f08f777536892a822e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Wed, 15 Jun 2022 18:19:26 +0200 Subject: [PATCH] Autoriser un multiple de 0.125 sur estimation de ticket --- .../Requests/Credit/CreateEstimateRequest.php | 4 +-- app/Models/Ticket.php | 5 ++- ...t_floating_point_on_credit_estimations.php | 33 +++++++++++++++++++ .../views/estimations/form-inputs.blade.php | 2 +- 4 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 database/migrations/2022_06_15_182442_change_amout_floating_point_on_credit_estimations.php diff --git a/app/Http/Requests/Credit/CreateEstimateRequest.php b/app/Http/Requests/Credit/CreateEstimateRequest.php index 453c293..36e0cd3 100644 --- a/app/Http/Requests/Credit/CreateEstimateRequest.php +++ b/app/Http/Requests/Credit/CreateEstimateRequest.php @@ -34,8 +34,8 @@ class CreateEstimateRequest extends FormRequest return [ 'amount' => [ 'required', 'numeric', 'gt:0', function ($attribute, $value, $fail) { - if ((\floatval($value) * 10) % 5 !== 0) { - $fail("$attribute doit être un multiple de 5 (comptez par demi journées, soit 0.5)"); + if ((\floatval($value) * 1000) % 125 !== 0) { + $fail("$attribute doit être un multiple de 125 (soit 0.125)"); } } ], diff --git a/app/Models/Ticket.php b/app/Models/Ticket.php index d703d0f..a415e11 100644 --- a/app/Models/Ticket.php +++ b/app/Models/Ticket.php @@ -223,10 +223,9 @@ class Ticket extends Model */ public function getFullNameAttribute(): string { - return trans('Ticket n° :ticketId : :ticketSiteName - :ticketTypeLabel', [ + return trans('Ticket n° :ticketId : :ticketSiteName', [ 'ticketId' => $this->id, - 'ticketSiteName' => $this->site->name, - 'ticketTypeLabel' => $this->type->label + 'ticketSiteName' => $this->site->name ]); } diff --git a/database/migrations/2022_06_15_182442_change_amout_floating_point_on_credit_estimations.php b/database/migrations/2022_06_15_182442_change_amout_floating_point_on_credit_estimations.php new file mode 100644 index 0000000..e60f793 --- /dev/null +++ b/database/migrations/2022_06_15_182442_change_amout_floating_point_on_credit_estimations.php @@ -0,0 +1,33 @@ +unsignedFloat('amount', 8, 3) + ->comment('Estimation amount')->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('credit_estimations', function ($table) { + $table->unsignedFloat('amount') + ->comment('Estimation amount')->change(); + }); + } +} diff --git a/resources/views/estimations/form-inputs.blade.php b/resources/views/estimations/form-inputs.blade.php index 3b9e639..b4c2961 100644 --- a/resources/views/estimations/form-inputs.blade.php +++ b/resources/views/estimations/form-inputs.blade.php @@ -1,6 +1,6 @@
- + @include('modules.input-error', [ 'inputName' => 'amount', 'helperId' => 'amountHelper' , 'helper' => __('Le montant en homme jour estimé.') ])