diff --git a/app/Enums/Credit/EstimationTimeEnum.php b/app/Enums/Credit/EstimationTimeEnum.php new file mode 100644 index 0000000..86fb130 --- /dev/null +++ b/app/Enums/Credit/EstimationTimeEnum.php @@ -0,0 +1,49 @@ +name => "Une demi-heure", + self::hour->name => "Une heure", + self::hourAndHalf->name => "Une heure et demie", + self::twoHours->name => "Deux heures", + self::twoHoursAndHalf->name => "Deux heures et demie", + self::threeHours->name => "Trois heures", + self::twoHoursAndHalf->name => "Trois heures et demie", + self::fourHours->name => "Quatre heures", + self::fourHoursAndHalf->name => "Quatre heures et demie", + self::fiveHours->name => "Cinq heures", + self::fiveHoursAndHalf->name => "Cinq heures et demie", + self::sixHours->name => "Six heures", + self::sixHoursAndHalf->name => "Six heures et demie", + self::sevenHours->name => "Sept heures", + self::sevenHoursAndHalf->name => "Sept heures et demi", + self::eightHours->name => "Huit heures", + ]; +} diff --git a/app/Enums/Tickets/TicketFileTypeEnum.php b/app/Enums/Tickets/TicketFileTypeEnum.php new file mode 100644 index 0000000..7665508 --- /dev/null +++ b/app/Enums/Tickets/TicketFileTypeEnum.php @@ -0,0 +1,67 @@ +name => "Fichier png", + self::jpeg->name => "Fichier jpeg", + self::jpg->name => "Fichier jpg", + self::pdf->name => "Fichier pdf", + self::pptx->name => "Fichier pptx", + self::docx->name => "Fichier docx", + self::xlsx->name => "Fichier xlsx", + self::csv->name => "Fichier csv", + ]; + + /** + * Custom added mimes type definition + */ + private const MIMETYPE = [ + self::png->name => 'image/png', + self::jpeg->name => 'image/jpeg', + self::jpg->name => 'image/jpeg', + self::pdf->name => 'application/pdf', + self::pptx->name => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + self::docx->name => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + self::xlsx->name => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + self::csv->name => 'text/csv', + ]; + + /** + * Get Class + * + * @return string + */ + public function mimetypes(): string + { + return self::MIMETYPE[$this->name]; + } + + /** + * Get enum classes + * + * @return array + */ + public static function toMimetypes(): array + { + return self::MIMETYPE; + } +} diff --git a/app/Enums/Users/GitlabUsersEnum.php b/app/Enums/Users/GitlabUsersEnum.php index 5a6d2d3..9a6777f 100644 --- a/app/Enums/Users/GitlabUsersEnum.php +++ b/app/Enums/Users/GitlabUsersEnum.php @@ -9,12 +9,14 @@ enum GitlabUsersEnum: int use BaseEnum; // Each user is associated to his ID on gitlab. - case olivier = 11; + case olivier = 11; + case sebastien = 15; /** * Optionnal labels definition */ private const LABELS = [ - self::olivier->name => "Olivier LEGAT", + self::olivier->name => "Olivier LEGAT", + self::sebastien->name => "Sebastien Hattry", ]; } diff --git a/app/Http/Controllers/Bo/TicketController.php b/app/Http/Controllers/Bo/TicketController.php index 26ee400..9e272ad 100644 --- a/app/Http/Controllers/Bo/TicketController.php +++ b/app/Http/Controllers/Bo/TicketController.php @@ -661,7 +661,7 @@ class TicketController extends Controller 'c-support', $cLabel ]), - 'assignee_id' => GitlabUsersEnum::olivier, + 'assignee_id' => GitlabUsersEnum::sebastien, ]); } catch (\Exception $e) { \report($e); diff --git a/app/Http/Requests/Bo/CreateMessage.php b/app/Http/Requests/Bo/CreateMessage.php index 995bcb3..59d3e23 100644 --- a/app/Http/Requests/Bo/CreateMessage.php +++ b/app/Http/Requests/Bo/CreateMessage.php @@ -3,6 +3,7 @@ namespace App\Http\Requests\Bo; use App\Enums\MessageTypeEnum; +use App\Enums\Tickets\TicketFileTypeEnum; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Validation\Rules\Enum; @@ -39,7 +40,7 @@ class CreateMessage extends FormRequest { $this->merge([ 'subscribe' => $this->subscribe ? true : false, - 'type' => $this->is_private ? MessageTypeEnum::private->value : MessageTypeEnum::public->value + 'type' => $this->is_private ? MessageTypeEnum::private->value : MessageTypeEnum::public->value ]); } @@ -53,13 +54,12 @@ class CreateMessage extends FormRequest /** @var \App\Models\User */ $user = auth()->user(); return [ - 'subscribe' => 'required|boolean', - 'message' => 'required|min:' . ($user->isAdmin() ? '5' : '20'), - 'file_message' => 'sometimes|mimes:jpeg,jpg,png,pdf|max:2048', - 'type' => [ - 'required', - new Enum(MessageTypeEnum::class) - ] + 'subscribe' => 'required|boolean', + 'message' => 'required|min:' . ($user->isAdmin() ? '5' : '20'), + 'file_message' => ['sometimes', new Enum(TicketFileTypeEnum::class), 'max:2048'], + 'file_message2' => ['sometimes', new Enum(TicketFileTypeEnum::class), 'max:2048'], + 'file_message3' => ['sometimes', new Enum(TicketFileTypeEnum::class), 'max:2048'], + 'type' => ['required', new Enum(MessageTypeEnum::class)] ]; } } diff --git a/app/Http/Requests/Bo/Credit/CreateEstimateRequest.php b/app/Http/Requests/Bo/Credit/CreateEstimateRequest.php index 0aa3dd7..0c30c4e 100644 --- a/app/Http/Requests/Bo/Credit/CreateEstimateRequest.php +++ b/app/Http/Requests/Bo/Credit/CreateEstimateRequest.php @@ -34,8 +34,8 @@ class CreateEstimateRequest extends FormRequest return [ 'amount' => [ 'required', 'numeric', 'gt:0', function ($attribute, $value, $fail) { - if ((\floatval($value) * 1000) % 125 !== 0) { - $fail("$attribute doit être un multiple de 125 (soit 0.125)"); + if ((\floatval($value) * 1000) % 62.5 !== 0) { + $fail("$attribute doit être un multiple de 62.5 (soit 0.0625)"); } } ], diff --git a/app/Http/Requests/Bo/EraseCellContentRequest.php b/app/Http/Requests/Bo/EraseCellContentRequest.php deleted file mode 100644 index 3e149be..0000000 --- a/app/Http/Requests/Bo/EraseCellContentRequest.php +++ /dev/null @@ -1,37 +0,0 @@ -check() and $this->ajax(); - } - - /** - * Get the validation rules that apply to the request. - * - * @return array - */ - public function rules() - { - return [ - 'id' => 'required|exists:week_plannings,id', - 'day' => 'required|numeric', - 'row' => [ - 'required', - new Enum(TableRowEnum::class) - ], - ]; - } -} diff --git a/app/Http/Requests/Bo/Invoices/StoreInvoiceRequest.php b/app/Http/Requests/Bo/Invoices/StoreInvoiceRequest.php index 0bb858d..6a4d839 100644 --- a/app/Http/Requests/Bo/Invoices/StoreInvoiceRequest.php +++ b/app/Http/Requests/Bo/Invoices/StoreInvoiceRequest.php @@ -28,7 +28,7 @@ class StoreInvoiceRequest extends FormRequest protected function prepareForValidation() { $this->merge([ - 'tasks' => request()->tasks ? \collect(json_decode(request()->tasks)) + 'tasks' => request()->tasks ? \collect(json_decode(request()->tasks)) ->map(function ($task) { return \array_intersect_key((array)$task, Invoice::getTaskStructure()); })->toArray() : [], @@ -44,24 +44,24 @@ class StoreInvoiceRequest extends FormRequest public function rules() { return [ - 'firstname' => 'required|string|min:3|max:255', - 'lastname' => 'required|string|min:3|max:255', - 'object' => 'required|string|min:3|max:255', - 'tasks' => 'required|array|min:1', - 'tasks.*' => 'required|array', - 'tasks.*.days' => 'required|numeric', + 'firstname' => 'required|string|min:3|max:255', + 'lastname' => 'required|string|min:3|max:255', + 'object' => 'required|string|min:3|max:255', + 'tasks' => 'required|array|min:1', + 'tasks.*' => 'required|array', + 'tasks.*.days' => 'required|numeric', 'tasks.*.amount' => 'required|numeric', - 'tasks.*.desc' => 'required|string|min:10', - 'tasks.*.type' => [ + 'tasks.*.desc' => 'required|string|min:10', + 'tasks.*.type' => [ 'required', new Enum(TaskTypeEnum::class) ], 'tasks.*.package' => 'required_if:tasks.*.type,' . TaskTypeEnum::package->value . '|nullable|exists:packages,id', - 'comment' => 'sometimes|nullable|string|min:15', - 'show_days' => 'required|boolean', - 'site_id' => 'required|integer|exists:sites,id', - 'company_id' => 'required|integer|exists:companies,id', - 'invoiced_to_id' => 'required|integer|exists:companies,id', + 'comment' => 'sometimes|nullable|string|min:15', + 'show_days' => 'required|boolean', + 'site_id' => 'required|integer|exists:sites,id', + 'company_id' => 'required|integer|exists:companies,id', + 'invoiced_to_id' => 'required|integer|exists:companies,id', ]; } diff --git a/app/Http/Requests/Bo/Invoices/UpdateInvoiceRequest.php b/app/Http/Requests/Bo/Invoices/UpdateInvoiceRequest.php index cf39a53..fe65552 100644 --- a/app/Http/Requests/Bo/Invoices/UpdateInvoiceRequest.php +++ b/app/Http/Requests/Bo/Invoices/UpdateInvoiceRequest.php @@ -21,11 +21,11 @@ class UpdateInvoiceRequest extends StoreInvoiceRequest $rules = array_merge($rules, parent::rules()); } $rules = array_merge($rules, [ - 'comment' => 'sometimes|nullable|string|min:15', - 'sent_client_date' => 'required_with:signed_date,sent_accounting_date|sometimes|nullable|date', - 'signed_date' => 'required_with:sent_accounting_date|sometimes|nullable|date', + 'comment' => 'sometimes|nullable|string|min:15', + 'sent_client_date' => 'required_with:signed_date,sent_accounting_date|sometimes|nullable|date', + 'signed_date' => 'required_with:sent_accounting_date|sometimes|nullable|date', 'sent_accounting_date' => 'sometimes|nullable|date', - 'status' => [ + 'status' => [ 'required', new Enum(InvoiceStatusEnum::class), //phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed diff --git a/app/Http/Requests/Bo/SetCellContentRequest.php b/app/Http/Requests/Bo/SetCellContentRequest.php deleted file mode 100644 index a2f608f..0000000 --- a/app/Http/Requests/Bo/SetCellContentRequest.php +++ /dev/null @@ -1,68 +0,0 @@ -merge([ - 'model' => $this->model ?? null, - 'foreign' => $this->foreign ?? null, - 'text' => $this->text ?? '' - ]); - return auth()->check() and $this->ajax(); - } - - /** - * Get the validation rules that apply to the request. - * - * @return array - */ - public function rules(): array - { - return [ - 'id' => 'required|exists:week_plannings,id', - 'day' => 'required|numeric', - 'row' => [ - 'required', - new Enum(TableRowEnum::class) - ], - 'type' => [ - 'required', - new Enum(CellTypeEnum::class) - ], - 'CellModelEnum' => \sprintf( - 'nullable', - new Enum(CellModelEnum::class) - ), - 'foreign' => 'required_with:CellModelEnum|nullable|numeric', - 'text' => 'required|string|min:5|max:90' - ]; - } - - /** - * Get custom attributes for validator errors. - * - * @return array - */ - public function attributes(): array - { - return [ - 'CellModelEnum' => 'Type d\'élément lié', - 'foreign' => 'Élément lié', - 'text' => 'Description courte' - ]; - } -} diff --git a/app/Http/Requests/Bo/StoreTicket.php b/app/Http/Requests/Bo/StoreTicket.php index 753984a..a532a4b 100644 --- a/app/Http/Requests/Bo/StoreTicket.php +++ b/app/Http/Requests/Bo/StoreTicket.php @@ -96,13 +96,16 @@ class StoreTicket extends FormRequest } } ], - 'text' => 'required|string|min:40', - 'title' => 'required|string|between:3,255', - 'file_ticket' => 'mimes:jpeg,jpg,png,pdf|max:2048', - 'file_ticket2' => 'mimes:jpeg,jpg,png,pdf|max:2048', - 'is_internal' => 'required|boolean', - 'labels' => 'sometimes|array', - 'labels.*' => [ + 'text' => 'required|string|min:40', + 'title' => 'required|string|between:3,255', + 'file_ticket' => 'mimes:pptx,docx,xlsx,csv,jpeg,jpg,png,pdf|max:2048', + 'file_ticket2' => 'mimes:pptx,docx,xlsx,csv,jpeg,jpg,png,pdf|max:2048', + 'file_ticket3' => 'mimes:pptx,docx,xlsx,csv,jpeg,jpg,png,pdf|max:2048', + 'file_ticket4' => 'mimes:pptx,docx,xlsx,csv,jpeg,jpg,png,pdf|max:2048', + 'file_ticket5' => 'mimes:pptx,docx,xlsx,csv,jpeg,jpg,png,pdf|max:2048', + 'is_internal' => 'required|boolean', + 'labels' => 'sometimes|array', + 'labels.*' => [ // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed 'required', 'exists:labels,id', function ($attribute, $value, $fail) use ($user) { if (!$user->can('assignLabels', Ticket::class)) { diff --git a/app/Models/Ticket.php b/app/Models/Ticket.php index 136672f..4fe561e 100644 --- a/app/Models/Ticket.php +++ b/app/Models/Ticket.php @@ -44,9 +44,9 @@ class Ticket extends Model * @var array */ protected $casts = [ - 'is_internal' => 'bool', - 'type' => TicketTypeEnum::class, - 'status' => TicketStatusEnum::class, + 'is_internal' => 'bool', + 'type' => TicketTypeEnum::class, + 'status' => TicketStatusEnum::class, 'last_activity' => 'timestamp', ]; diff --git a/database/factories/InvoiceFactory.php b/database/factories/InvoiceFactory.php index d41b89c..cb1f232 100644 --- a/database/factories/InvoiceFactory.php +++ b/database/factories/InvoiceFactory.php @@ -70,7 +70,7 @@ class InvoiceFactory extends Factory \mt_srand(); $lines = \mt_rand(2, 9); for ($i = 0; $i < $lines; $i++) { - $days = 0.125 * $this->faker->numberBetween(1, 4); + $days = 0.0625 * $this->faker->numberBetween(1, 4); $type = \collect(TaskTypeEnum::cases())->random(); $amount = 0; switch ($type) { diff --git a/database/migrations/2024_07_19_150414_add_files_to_tickets_table.php b/database/migrations/2024_07_19_150414_add_files_to_tickets_table.php new file mode 100644 index 0000000..8ad73b2 --- /dev/null +++ b/database/migrations/2024_07_19_150414_add_files_to_tickets_table.php @@ -0,0 +1,38 @@ +string('file3')->after('file2')->comment('Pièce jointes n°3'); + $table->string('file4')->after('file3')->comment('Pièce jointes n°4'); + $table->string('file5')->after('file4')->comment('Pièce jointes n°5'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::table('tickets', function (Blueprint $table) { + $table->dropColumn('file3'); + $table->dropColumn('file4'); + $table->dropColumn('file5'); + }); + } +}; diff --git a/database/migrations/2024_07_19_151553_add_files_to_messages_table.php b/database/migrations/2024_07_19_151553_add_files_to_messages_table.php new file mode 100644 index 0000000..460d7e3 --- /dev/null +++ b/database/migrations/2024_07_19_151553_add_files_to_messages_table.php @@ -0,0 +1,36 @@ +string('file2')->after('file')->comment('Pièce jointes n°2'); + $table->string('file3')->after('file2')->comment('Pièce jointes n°3'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('messages', function (Blueprint $table) { + $table->dropColumn('file3'); + $table->dropColumn('file4'); + }); + } +} diff --git a/package-lock.json b/package-lock.json index 73a6148..572ab94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "support-web", + "name": "srcs", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/resources/ts/bo/components/InvoiceTasksComponent.vue b/resources/ts/bo/components/InvoiceTasksComponent.vue index 93b573f..92015a7 100644 --- a/resources/ts/bo/components/InvoiceTasksComponent.vue +++ b/resources/ts/bo/components/InvoiceTasksComponent.vue @@ -82,7 +82,7 @@ v-model="task.days" @change="updateAmount(index)" type="number" - step="0.125" + step="0.0625" > diff --git a/resources/views/bo/pages/tickets/form-inputs.blade.php b/resources/views/bo/pages/tickets/form-inputs.blade.php index 0abe56d..dcd7a46 100644 --- a/resources/views/bo/pages/tickets/form-inputs.blade.php +++ b/resources/views/bo/pages/tickets/form-inputs.blade.php @@ -107,7 +107,7 @@

Fichier joint 1

- + @if (isset($ticket) and $ticket->file !== null)
@@ -117,7 +117,7 @@

Fichier joint 2

- + @if (isset($ticket) and $ticket->file2 !== null)
@@ -125,6 +125,36 @@
@endif
+

Fichier joint 3

+
+ + @if (isset($ticket) and $ticket->file3 !== null) +
+
+ +
+ @endif +
+

Fichier joint 4

+
+ + @if (isset($ticket) and $ticket->file4 !== null) +
+
+ +
+ @endif +
+

Fichier joint 5

+
+ + @if (isset($ticket) and $ticket->file5 !== null) +
+
+ +
+ @endif +
@can('changeInternalStatus', App\Model\Ticket::class)
is_internal)) checked @endif> diff --git a/resources/views/bo/pages/tickets/show.blade.php b/resources/views/bo/pages/tickets/show.blade.php index dd99bad..f575c69 100644 --- a/resources/views/bo/pages/tickets/show.blade.php +++ b/resources/views/bo/pages/tickets/show.blade.php @@ -121,8 +121,20 @@
- - + + +
+
+
+
+ + +
+
+
+
+ +
@endif diff --git a/resources/views/estimations/form-inputs.blade.php b/resources/views/estimations/form-inputs.blade.php index 50c9131..c467b0a 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é.') ])