Merge branch 'develop' into trunk
This commit is contained in:
commit
8dd9aba195
16 changed files with 121 additions and 56 deletions
|
|
@ -34,22 +34,16 @@ class AccountController extends Controller
|
|||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
* @throws \ErrorException If account is missing in url.
|
||||
*/
|
||||
public function indexQuery(Builder $query): Builder
|
||||
{
|
||||
/** @var \App\Models\User */
|
||||
$user = auth()->user();
|
||||
if (!$user->isAdmin()) {
|
||||
// Show only users brand(s) accounts.
|
||||
$brands = $user->sites()->with('brand')->get()->pluck('brand')
|
||||
->filter(function ($v) {
|
||||
return !\is_null($v);
|
||||
});
|
||||
return $query->whereHas('brand', function ($q) use ($brands) {
|
||||
$q->whereIn('id', $brands->pluck('id'));
|
||||
});
|
||||
/** @var \App\Models\Brand|null $brand */
|
||||
if (!($brand = request()->brand)) {
|
||||
throw new \ErrorException('Cannot get brand');
|
||||
}
|
||||
return $query;
|
||||
|
||||
return $query->where('brand_id', '=', $brand->id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -30,11 +30,20 @@ class CreditLogController extends Controller
|
|||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
* @throws \ErrorException If account is missing in url.
|
||||
*/
|
||||
public function indexQuery(Builder $query): Builder
|
||||
{
|
||||
$query->orderBy('created_at', 'DESC');
|
||||
return $query;
|
||||
|
||||
/** @var \App\Models\Credit\Account|null $account */
|
||||
if (!($account = request()->account)) {
|
||||
throw new \ErrorException('Cannot get account');
|
||||
}
|
||||
|
||||
return $query->whereHas('account', function ($q) use ($account) {
|
||||
$q->whereIn('id', $account->pluck('id'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"fideloper/proxy": "^4.4",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"kwaadpepper/crud-policies": "^0.4.3",
|
||||
"kwaadpepper/crud-policies": "^0.4.5",
|
||||
"kwaadpepper/enum": "^2.1",
|
||||
"kwaadpepper/exception-handler": "^0.0.9",
|
||||
"laravel-lang/lang": "~8.0",
|
||||
|
|
|
|||
14
composer.lock
generated
14
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "b47b6f2c87a223409cd7086412a4463b",
|
||||
"content-hash": "7231078f8b07ef175c85390302bb7298",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asm89/stack-cors",
|
||||
|
|
@ -1505,16 +1505,16 @@
|
|||
},
|
||||
{
|
||||
"name": "kwaadpepper/crud-policies",
|
||||
"version": "0.4.4",
|
||||
"version": "0.4.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Kwaadpepper/crud-policies.git",
|
||||
"reference": "9fb72a59a3d9699a79e0c8862fd95491bd2b768a"
|
||||
"reference": "c25ff96be976796a5447bd75d6ef16a0d7226f47"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Kwaadpepper/crud-policies/zipball/9fb72a59a3d9699a79e0c8862fd95491bd2b768a",
|
||||
"reference": "9fb72a59a3d9699a79e0c8862fd95491bd2b768a",
|
||||
"url": "https://api.github.com/repos/Kwaadpepper/crud-policies/zipball/c25ff96be976796a5447bd75d6ef16a0d7226f47",
|
||||
"reference": "c25ff96be976796a5447bd75d6ef16a0d7226f47",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -1565,9 +1565,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Kwaadpepper/crud-policies/issues",
|
||||
"source": "https://github.com/Kwaadpepper/crud-policies/tree/0.4.4"
|
||||
"source": "https://github.com/Kwaadpepper/crud-policies/tree/0.4.5"
|
||||
},
|
||||
"time": "2022-06-10T08:04:44+00:00"
|
||||
"time": "2022-06-15T15:42:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "kwaadpepper/enum",
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
6
resources/sass/app.scss
vendored
6
resources/sass/app.scss
vendored
|
|
@ -18,6 +18,12 @@ body {
|
|||
background-color: $body-bg;
|
||||
}
|
||||
|
||||
#planning {
|
||||
.sticky-top {
|
||||
z-index: 1 !important;
|
||||
}
|
||||
}
|
||||
|
||||
// FOOTER
|
||||
body {
|
||||
position: relative;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,14 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-1">
|
||||
<span class="fw-bold h4">{{ __('Marque')}}</span>
|
||||
</div>
|
||||
<div class="col">
|
||||
<b class="h4">{{ optional(request()->brand)->name }}</b>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table text-center">
|
||||
<thead class="thead-dark">
|
||||
@include('crud-policies::crud.modules.sorter')
|
||||
|
|
|
|||
|
|
@ -30,6 +30,14 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-1">
|
||||
<span class="fw-bold h4">{{ __('Compte')}}</span>
|
||||
</div>
|
||||
<div class="col">
|
||||
<b class="h4">{{ optional(request()->account)->label }}</b>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table text-center">
|
||||
<thead class="thead-dark">
|
||||
@include('crud-policies::crud.modules.sorter')
|
||||
|
|
@ -81,6 +89,12 @@
|
|||
@endif
|
||||
@endforeach
|
||||
|
||||
@if($model->estimation->count())
|
||||
<td>
|
||||
<a href="{{ route('ticket.show', ['ticket' => $model->estimation->first()->ticket]) }}">{{ __('Ticket :id', ['id' => $model->estimation->first()->ticket->id]) }}</a>
|
||||
</td>
|
||||
@endif
|
||||
|
||||
{{-- MODEL ACTIONS --}}
|
||||
<td>
|
||||
<div class="btn-group" role="group" aria-label="{{ Str::plural(__('crud-policies::crud.action')) }}">
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
<a href="{{ route('ticket.show', $ticket) }}" class="text-decoration-none btn btn-sm btn-primary" role="button" aria-roledescription="{{ _('Revenir en arrière') }}"><i class="fa-solid fa-arrow-left-long"></i></a>
|
||||
{{ $ticket->full_name }}
|
||||
@if ($ticket->is_internal)<i class="fa-solid fa-lock"></i>@endif
|
||||
<span class="badge {{ $ticket->type->class }}">{{ $ticket->type->label }}</span>
|
||||
<span class="text-decoration-underline">{{ __('Créer une estimation') }}</span>
|
||||
</h2>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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é.')
|
||||
])
|
||||
|
|
|
|||
|
|
@ -16,29 +16,27 @@
|
|||
<div class="card-body">
|
||||
<form action="{{ CrudController::getRoutePrefixed("$modelTable.store") }}" method="POST" @if($hasFile) enctype="multipart/form-data" @endif>
|
||||
@csrf
|
||||
<table class="table table-sm table-bordered border-primary align-middle table-striped text-center">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col" class="w-25">{{ __('crud-policies::crud.property') }}</th>
|
||||
<th scope="col" class="w-75">{{ __('crud-policies::crud.value') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($modelClass::getEditableProperties() as $fieldName => $prop)
|
||||
@php
|
||||
// create form cannot accept readonly field
|
||||
$prop['readonly'] = false;
|
||||
@endphp
|
||||
@if(in_array(CrudAction::create(), $prop['actions']))
|
||||
<tr>
|
||||
<div class="container text-center">
|
||||
<div class="row">
|
||||
<div class="col-3 border border-secondary py-1 px-1">{{ __('crud-policies::crud.property') }}</div>
|
||||
<div class="col-9 border border-secondary py-1 px-1">{{ __('crud-policies::crud.value') }}</div>
|
||||
</div>
|
||||
@foreach ($modelClass::getEditableProperties() as $fieldName => $prop)
|
||||
@php
|
||||
// create form cannot accept readonly field
|
||||
$prop['readonly'] = false;
|
||||
@endphp
|
||||
@if(in_array(CrudAction::create(), $prop['actions']))
|
||||
<div class="row">
|
||||
@include('crud-policies::crud.formfield')
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="col text-center">
|
||||
<button class="btn btn-info" type="submit">{{ __('crud-policies::crud.create') }}</button>
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<button class="btn btn-info" type="submit">{{ __('crud-policies::crud.create') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<td>
|
||||
<div class="col-3 border border-secondary py-1 px-1">
|
||||
<label class="form-label">{{ $prop['label'] }}</label>
|
||||
</td>
|
||||
<td>
|
||||
</div>
|
||||
<div class="col-9 border border-secondary py-1 px-1">
|
||||
@php
|
||||
$dataVue = [
|
||||
'name' => 'label',
|
||||
|
|
@ -13,4 +13,4 @@
|
|||
id="marker-label-select"
|
||||
class="sticky-top"
|
||||
data-json='@json($dataVue)'></div>
|
||||
</td>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,10 @@
|
|||
<div class="card-header">
|
||||
<h2 class="col h4">
|
||||
<a href="{{ route('ticket.index') }}" class="text-decoration-none btn btn-sm btn-primary" role="button" aria-roledescription="{{ _('Revenir en arrière') }}"><i class="fa-solid fa-arrow-left-long"></i></a>
|
||||
<span> {{ __('Modifier un ticket') }}</span>
|
||||
<span> {{ __('Modifier un ticket') }}</span> -
|
||||
{{ $ticket->full_name }}
|
||||
@if ($ticket->is_internal)<i class="fa-solid fa-lock"></i>@endif
|
||||
<span class="badge {{ $ticket->type->class }}">{{ $ticket->type->label }}</span>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<a href="{{ route('ticket.index') }}" class="text-decoration-none btn btn-sm btn-primary" role="button" aria-roledescription="{{ _('Revenir en arrière') }}"><i class="fa-solid fa-arrow-left-long"></i></a>
|
||||
{{ $ticket->full_name }}
|
||||
@if ($ticket->is_internal)<i class="fa-solid fa-lock"></i>@endif
|
||||
<span class="badge bg-info">{{ $ticket->status->label }}</span>
|
||||
<span class="badge {{ $ticket->type->class }}">{{ $ticket->type->label }}</span>
|
||||
</h2>
|
||||
<div class="col d-flex flex-row text-end">
|
||||
@can('suscribeToTicket', $ticket)
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
<input type="hidden" name="ticket_id" value="{{ $ticket->id }}">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="messageModalLabel">
|
||||
{{ __('Répondre au ticket n°:ticketId', ['ticketId' => $ticket->id]) }}
|
||||
{{ __('Répondre au ticket n°:ticketId', ['ticketId' => $ticket->id]) }} <span class="badge {{ $ticket->type->class }}">{{ $ticket->type->label }}</span>
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{{__('Fermer') }}"></button>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue