Autoriser un multiple de 0.125 sur estimation de ticket
This commit is contained in:
parent
abcee7b301
commit
a178d2e891
4 changed files with 38 additions and 6 deletions
|
|
@ -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)");
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -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
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ChangeAmoutFloatingPointOnCreditEstimations extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('credit_estimations', function ($table) {
|
||||
$table->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();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<div class="form-group mb-5">
|
||||
<label for="amount" class="col-form-label text-md-right">{{ __('Montant estimé') }}</label>
|
||||
<input class="form-control" name="amount" id="amount" type="number" min="0.5" step="0.5" value="{{ old('number', 0.5) }}" aria-describedby="amountHelper"/>
|
||||
<input class="form-control" name="amount" id="amount" type="number" min="0.125" step="0.125" value="{{ old('number', 0.125) }}" aria-describedby="amountHelper"/>
|
||||
@include('modules.input-error', [
|
||||
'inputName' => 'amount', 'helperId' => 'amountHelper' , 'helper' => __('Le montant en homme jour estimé.')
|
||||
])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue