1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Allow client registration fields to be both visible and required

This commit is contained in:
David Bomba 2023-03-01 07:14:07 +11:00
parent cc6ae43f4a
commit 33df867438
3 changed files with 23 additions and 3 deletions

View File

@ -20,82 +20,102 @@ class ClientRegistrationFields
[
'key' => 'first_name',
'required' => true,
'visible' => true,
],
[
'key' => 'last_name',
'required' => true,
'visible' => true,
],
[
'key' => 'email',
'required' => true,
'visible' => true,
],
[
'key' => 'phone',
'required' => false,
'visible' => true,
],
[
'key' => 'password',
'required' => true,
'visible' => true,
],
[
'key' => 'name',
'required' => false,
'visible' => false,
],
[
'key' => 'website',
'required' => false,
'visible' => false,
],
[
'key' => 'address1',
'required' => false,
'visible' => false,
],
[
'key' => 'address2',
'required' => false,
'visible' => false,
],
[
'key' => 'city',
'required' => false,
'visible' => false,
],
[
'key' => 'state',
'required' => false,
'visible' => false,
],
[
'key' => 'postal_code',
'required' => false,
'visible' => false,
],
[
'key' => 'country_id',
'required' => false,
'visible' => false,
],
[
'key' => 'custom_value1',
'required' => false,
'visible' => false,
],
[
'key' => 'custom_value2',
'required' => false,
'visible' => false,
],
[
'key' => 'custom_value3',
'required' => false,
'visible' => false,
],
[
'key' => 'custom_value4',
'required' => false,
'visible' => false,
],
[
'key' => 'public_notes',
'required' => false,
'visible' => false,
],
[
'key' => 'vat_number',
'required' => false,
'visible' => false,
],
[
'key' => 'currency_id',
'required' => false,
'visible' => false,
],
];

View File

@ -40,8 +40,8 @@ class RegisterRequest extends FormRequest
$rules = [];
foreach ($this->company()->client_registration_fields as $field) {
if ($field['required']) {
$rules[$field['key']] = ['bail','required'];
if ($field['visible']) {
$rules[$field['key']] = $field['required'] ? ['bail','required'] : ['sometimes'];
}
}

View File

@ -29,7 +29,7 @@
<div class="grid grid-cols-12 gap-4 mt-10">
@if($register_company->client_registration_fields)
@foreach($register_company->client_registration_fields as $field)
@if($field['required'])
@if($field['visible'])
<div class="col-span-12 md:col-span-6">
<section class="flex items-center">
<label