mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Refactor registration form layout and add dynamic fields
This commit is contained in:
parent
3c9f366872
commit
46f904f4b9
@ -93,18 +93,110 @@
|
|||||||
<form wire:submit="register(Object.fromEntries(new FormData($event.target)))" class="space-y-3">
|
<form wire:submit="register(Object.fromEntries(new FormData($event.target)))" class="space-y-3">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
@foreach($this->registrationFields() as $field)
|
<div class="grid grid-cols-12 gap-4 mt-10">
|
||||||
<div>
|
@if($subscription->company->client_registration_fields)
|
||||||
<span class="input-label">{{ $field['label'] }}</span>
|
@foreach($subscription->company->client_registration_fields as $field)
|
||||||
<input type="{{ $field['type'] }}" name="{{ $field['key'] }}" value="{{ $field['defaultValue'] }}" class="input w-full" />
|
@if($field['visible'])
|
||||||
|
<div class="col-span-12 md:col-span-6">
|
||||||
|
<section class="flex items-center">
|
||||||
|
<label
|
||||||
|
for="{{ $field['key'] }}"
|
||||||
|
class="input-label">
|
||||||
|
@if(in_array($field['key'], ['custom_value1','custom_value2','custom_value3','custom_value4']))
|
||||||
|
{{ (new App\Utils\Helpers())->makeCustomField($subscription->company->custom_fields, str_replace("custom_value","client", $field['key']))}}
|
||||||
|
@else
|
||||||
|
{{ ctrans("texts.{$field['key']}") }}
|
||||||
|
@endif
|
||||||
|
</label>
|
||||||
|
|
||||||
@error($field['key'])
|
@if($field['required'])
|
||||||
<p class="validation validation-fail block w-full" role="alert">
|
<section class="text-red-400 ml-1 text-sm">*</section>
|
||||||
{{ $message }}
|
@endif
|
||||||
</p>
|
</section>
|
||||||
@enderror
|
|
||||||
</div>
|
@if($field['key'] === 'email')
|
||||||
@endforeach
|
<input
|
||||||
|
id="{{ $field['key'] }}"
|
||||||
|
class="input w-full"
|
||||||
|
type="email"
|
||||||
|
name="{{ $field['key'] }}"
|
||||||
|
value="{{ old($field['key']) }}"
|
||||||
|
/>
|
||||||
|
@elseif($field['key'] === 'password')
|
||||||
|
<input
|
||||||
|
id="{{ $field['key'] }}"
|
||||||
|
class="input w-full"
|
||||||
|
type="password"
|
||||||
|
name="{{ $field['key'] }}"
|
||||||
|
/>
|
||||||
|
@elseif($field['key'] === 'currency_id')
|
||||||
|
<select
|
||||||
|
id="currency_id"
|
||||||
|
class="input w-full form-select bg-white"
|
||||||
|
name="currency_id">
|
||||||
|
@foreach(App\Utils\TranslationHelper::getCurrencies() as $currency)
|
||||||
|
<option
|
||||||
|
{{ $currency->id == $subscription->company->settings->currency_id ? 'selected' : null }} value="{{ $currency->id }}">
|
||||||
|
{{ $currency->name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
@elseif($field['key'] === 'country_id')
|
||||||
|
<select
|
||||||
|
id="shipping_country"
|
||||||
|
class="input w-full form-select bg-white"
|
||||||
|
name="country_id">
|
||||||
|
<option value="none"></option>
|
||||||
|
@foreach(App\Utils\TranslationHelper::getCountries() as $country)
|
||||||
|
<option
|
||||||
|
{{ $country == isset(auth()->user()->client->shipping_country->id) ? 'selected' : null }} value="{{ $country->id }}">
|
||||||
|
{{ $country->iso_3166_2 }}
|
||||||
|
({{ $country->name }})
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
@else
|
||||||
|
<input
|
||||||
|
id="{{ $field['key'] }}"
|
||||||
|
class="input w-full"
|
||||||
|
name="{{ $field['key'] }}"
|
||||||
|
value="{{ old($field['key']) }}"
|
||||||
|
/>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@error($field['key'])
|
||||||
|
<div class="validation validation-fail">
|
||||||
|
{{ $message }}
|
||||||
|
</div>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if($field['key'] === 'password')
|
||||||
|
<div class="col-span-12 md:col-span-6">
|
||||||
|
<section class="flex items-center">
|
||||||
|
<label
|
||||||
|
for="password_confirmation"
|
||||||
|
class="input-label">
|
||||||
|
{{ ctrans('texts.password_confirmation') }}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
@if($field['required'])
|
||||||
|
<section class="text-red-400 ml-1 text-sm">*</section>
|
||||||
|
@endif
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<input
|
||||||
|
id="password_confirmation"
|
||||||
|
type="password"
|
||||||
|
class="input w-full"
|
||||||
|
name="password_confirmation"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user