Skip to content

Commit

Permalink
refactor(ui): Adding errors messages
Browse files Browse the repository at this point in the history
- Lead errors
- Customer errors
  • Loading branch information
gnovaro committed Mar 9, 2024
1 parent 0603174 commit 01fdfec
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
4 changes: 3 additions & 1 deletion app/Http/Controllers/Customer/CustomerSaveController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
use App\Http\Controllers\MainController;
use App\Http\Requests\CustomerRequest;
use App\Repositories\CustomerRepository;
use Illuminate\Http\Request;

class CustomerSaveController extends MainController
{
private CustomerRepository $customerSaveRepository;

public function __construct(CustomerRepository $customerSaveRepository)
public function __construct(CustomerRepository $customerSaveRepository, Request $request)
{
parent::__construct($request);
$this->customerSaveRepository = $customerSaveRepository;
}

Expand Down
2 changes: 1 addition & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"Product" : "Product",
"Products" : "Products",
"Profile" : "Profile",
"Profile saved successfully" : "Profile saved successfull",
"Profile saved successfully" : "Profile saved successfully",
"Promote" : "Promote",
"Province" : "Province",
"Quantity" : "Quantity",
Expand Down
14 changes: 13 additions & 1 deletion resources/views/customer/customer.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
<header>
<h1>{{ __('Customer') }} @if($customer->id) #{{ $customer->id }} @endif</h1>
</header>

@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif

<form method="POST" action="{{ url('/customer/save') }}" class="form">
{{ csrf_field() }}
<div class="card mt-2">
Expand Down Expand Up @@ -370,7 +381,8 @@ class="form-control form-control-lg">
<div class="col">
{{ __('Contacts') }}

<a class="btn btn-primary btn-sm" style="border-radius: 40px;" href="{{ url('/contact/create', ['customer', $customer->id]) }}">
<a class="btn btn-primary btn-sm" style="border-radius: 40px;"
href="{{ url('/contact/create', ['customer', $customer->id]) }}">
<i class="las la-plus fw-bold"></i>
</a>
</div>
Expand Down
17 changes: 15 additions & 2 deletions resources/views/lead/lead.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
<header>
<h1>{{ __('Lead') }} @if($lead->id) #{{ $lead->id }} @endif</h1>
</header>

@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif

<form method="POST" action="{{ url('/lead/save') }}" class="form">
{{ csrf_field() }}
<div class="card mt-2">
Expand All @@ -24,7 +35,8 @@ class="form-control form-control-lg">
<div class="row">
<div class="col-12 col-md-6">
<label for="external_id">{{ __('External ID') }}</label>
<input type="text" name="external_id" id="external_id" value="{{ old('external_id', $lead->external_id) }}"
<input type="text" name="external_id" id="external_id"
value="{{ old('external_id', $lead->external_id) }}"
maxlength="50" class="form-control form-control-lg">
</div>
<div class="col-12 col-md-6">
Expand Down Expand Up @@ -52,7 +64,8 @@ class="form-control form-control-lg">
<label for="extension">{{ __('Extension') }}</label>
<div class="input-group">
<span class="input-group-text"><i class="lab la-buromobelexperte"></i></span>
<input type="text" name="extension" id="extension" value="{{ old('extension', $lead->extension) }}"
<input type="text" name="extension" id="extension"
value="{{ old('extension', $lead->extension) }}"
maxlength="6" class="form-control form-control-lg">
</div>
</div>
Expand Down

0 comments on commit 01fdfec

Please sign in to comment.