Skip to content

Commit

Permalink
Changed the Customer module requirement to 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
fulopattila122 committed Jan 13, 2025
1 parent 188a35d commit e61a6be
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# AppShell Changelog

## Unreleased
##### 2025-XX-YY

- Added the `customer_number` field to the customer views and forms

## 4.7.0
##### 2025-01-09

Expand Down
1 change: 1 addition & 0 deletions src/Http/Requests/CreateCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function rules()
'timezone' => 'sometimes|nullable|timezone',
'ltv' => 'sometimes|nullable|numeric',
'currency' => ['sometimes', 'nullable', Rule::in(array_keys((new DefaultCurrency())->options()))],
'customer_number' => 'sometimes|nullable|max:255',
];
}

Expand Down
1 change: 1 addition & 0 deletions src/Http/Requests/UpdateCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function rules()
'timezone' => 'sometimes|nullable|timezone',
'ltv' => 'sometimes|nullable|numeric',
'currency' => ['sometimes', 'nullable', Rule::in(array_keys((new DefaultCurrency())->options()))],
'customer_number' => 'sometimes|nullable|max:255',
];
}

Expand Down
16 changes: 16 additions & 0 deletions src/resources/views/customer/_form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@
@include('appshell::customer._organization')
</div>

<div class="mb-3 row">
<label for="customer_number" class="col-form-label col-form-label-sm col-md-2">{{ __('Customer Number') }}</label>
<div class="col-md-10">
{{ Form::text('customer_number', null, [
'class' => 'form-control form-control-sm' . ($errors->has('customer_number') ? ' is-invalid': ''),
'placeholder' => __('E.g. the ERP customer code'),
'maxlength' => 255,
'id' => 'customer_number',
])
}}
@if ($errors->has('customer_number'))
<div class="invalid-feedback">{{ $errors->first('customer_number') }}</div>
@endif
</div>
</div>

<hr>

<div class="mb-4 row">
Expand Down
5 changes: 4 additions & 1 deletion src/resources/views/customer/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
@endif

<x-slot:subtitle>
{{ $customer->type->label() }}
@if($customer->customer_number)
<span title="{{ __('Customer Number') }}">{{ $customer->customer_number }}</span> |
@endif
<span title="{{ __('Customer type') }}">{{ $customer->type->label() }}</span>
</x-slot:subtitle>
</x-appshell::card-with-icon>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/resources/widgets/customer/index/table.widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'onlyIfCan' => 'view customers',
],
'secondary' => [
'text' => '$model.firstname $model.lastname'
'text' => static fn ($customer) => $customer->customer_number ?? "$customer->firstname $customer->lastname",
],
],
'title' => __('Name'),
Expand Down

0 comments on commit e61a6be

Please sign in to comment.