171 lines
9.8 KiB
PHP
171 lines
9.8 KiB
PHP
<form action="{{ $type->equals(ContactFormType::complain()) ? route('product-request.submit') : route('contact-us.submit') }}" class="form-contact" method="post" enctype="multipart/form-data">
|
|
@csrf
|
|
|
|
<p id="contactFormError" @if(count($errors))class="display" @endif>
|
|
<i class="fa fa-exclamation-triangle"></i>
|
|
{{ __('coord_please_complete') }}
|
|
</p>
|
|
|
|
<h4>{{ __('my_coord') }}</h4>
|
|
|
|
<div class="clearfix cvc">
|
|
<label>{{ __('civilty') }}</label>
|
|
@foreach(ContactFormCivility::toArray() as $ctCiv)
|
|
<div>
|
|
<input class="magic-radio" value="{{ $ctCiv->value }}" type="radio" name="civility" id="civ{{ $ctCiv->value }}" @if(old('civility')==$ctCiv->value)checked @endif required>
|
|
<label for="civ{{ $ctCiv->value }}">{{ $ctCiv->label }}</label>
|
|
</div>
|
|
@endforeach
|
|
@if($errors->default->has('civility'))<small class="text-danger">{{ implode('<br>', $errors->default->get('civility')) }}</small>@endif
|
|
</div>
|
|
|
|
<p class="clearfix">
|
|
{{-- // TODO test user data from logged --}}
|
|
<input type="text" name="lastname" value="@if(!is_null($user)){{ $user->lastname }}@endif{{ old('lastname') }}" placeholder="{{ __('lastname') }}*" minlength="2" required>
|
|
@if($errors->default->has('lastname'))<small class="text-danger">{{ implode('<br>', $errors->default->get('lastname')) }}</small>@endif
|
|
<input type="text" name="firstname" value="@if(!is_null($user)){{ $user->firstname }}@endif{{ old('firstname') }}" placeholder="{{ __('firstname') }}*" minlength="2" required>
|
|
@if($errors->default->has('firstname'))<small class="text-danger">{{ implode('<br>', $errors->default->get('firstname')) }}</small>@endif
|
|
<input type="text" name="address" value="@if(!is_null($user)){{ $user->address }}@endif{{ old('address') }}" placeholder="{{ __('address') }}*" minlength="4" required>
|
|
@if($errors->default->has('address'))<small class="text-danger">{{ implode('<br>', $errors->default->get('address')) }}</small>@endif
|
|
<input type="email" name="email" value="@if(!is_null($user)){{ $user->email }}@endif{{ old('email') }}" placeholder="{{ __('email') }}*" required>
|
|
@if($errors->default->has('email'))<small class="text-danger">{{ implode('<br>', $errors->default->get('email')) }}</small>@endif
|
|
<input type="text" name="postal" value="@if(!is_null($user)){{ $user->postal }}@endif{{ old('postal') }}" placeholder="{{ __('postal') }}*" minlength="4" maxlength="10" required>
|
|
@if($errors->default->has('postal'))<small class="text-danger">{{ implode('<br>', $errors->default->get('postal')) }}</small>@endif
|
|
<input type="text" name="town" value="@if(!is_null($user)){{ $user->town }}@endif{{ old('town') }}" placeholder="{{ __('town') }}*" minlength="3" maxlength="90" required>
|
|
@if($errors->default->has('town'))<small class="text-danger">{{ implode('<br>', $errors->default->get('town')) }}</small>@endif
|
|
<input type="tel" name="phone" value="@if(!is_null($user)){{ $user->phone }}@endif{{ old('phone') }}" placeholder="{{ __('phone') }}" minlength="8" maxlength="14" />
|
|
@if($errors->default->has('phone'))<small class="text-danger">{{ implode('<br>', $errors->default->get('phone')) }}</small>@endif
|
|
</p>
|
|
|
|
<hr />
|
|
|
|
@if($type->equals(ContactFormType::recipe()))
|
|
<h4>{{ __('propose_recipe') }} :</h4>
|
|
@elseif($type->equals(ContactFormType::abuse()))
|
|
<h4>{{ __('report_abuse') }} :</h4>
|
|
@elseif($type->equals(ContactFormType::complain()) or $type->equals(ContactFormType::onepage()))
|
|
<h4>{{ __('complain') }} :</h4>
|
|
@else
|
|
<h4>{{ __('question_concern')}} :</h4>
|
|
@endif
|
|
@if(
|
|
$type->equals(ContactFormType::complain()) or
|
|
$type->equals(ContactFormType::onepage()) or
|
|
$type->equals(ContactFormType::recipe()) or
|
|
$type->equals(ContactFormType::abuse())
|
|
)
|
|
<input type="text" class="display-none" name="type" value="{{ $type->value }}" readonly />
|
|
@else
|
|
<div class="styled-select">
|
|
<i class="fa fa-chevron-down"></i>
|
|
<select name="type" placeholder="{{ __('ask_concern') }}" required>
|
|
<option disabled @if(!old('type'))selected @endif>{{ __('select_ask') }}</option>
|
|
@foreach(ContactFormType::toArray() as $ct)
|
|
@if(
|
|
!$ct->equals(ContactFormType::complain()) &&
|
|
!$ct->equals(ContactFormType::recipe()) &&
|
|
!$ct->equals(ContactFormType::onepage()) &&
|
|
!$ct->equals(ContactFormType::none())
|
|
)
|
|
<option value="{{ $ct->value }}" @if($type->value === old('type') or $type->equals($ct))selected @endif>{{ $ct->label }}</option>
|
|
@endif
|
|
@endforeach
|
|
</select>
|
|
@if($errors->default->has('type'))<small class="text-danger">{{ implode('<br>', $errors->default->get('type')) }}</small>@endif
|
|
</div>
|
|
@endif
|
|
|
|
@if($type->equals(ContactFormType::complain()) or $type->equals(ContactFormType::onepage()))
|
|
<div>
|
|
<p class="clearfix">
|
|
<input type="text" name="productName" value="{{ old('productName') }}" minlength="2" maxlength="100" placeholder="{{ __('product_name') }}*" required>
|
|
<input type="number" name="productCode" value="{{ old('productCode') }}" min="1" max="9999999999999" placeholder="{{ __('product_code') }}*" required>
|
|
<input type="text" name="buyPlace" value="{{ old('buyPlace') }}" minlength="2" maxlength="100" placeholder="{{ __('buy_place') }}*" required>
|
|
<input type="text" name="lotNumberName" value="{{ old('lotNumberName') }}" minlength="2" maxlength="50" placeholder="{{ __('lot_number') }}*" required>
|
|
</p>
|
|
|
|
<p class="infoLot">
|
|
<i class="fa fa-info-circle"></i>
|
|
{{ __('lot_number_tip') }}
|
|
</p>
|
|
|
|
<p class="formDateQualite">
|
|
<label for="limitDateDay">{{ __('limit_date') }}*</label>
|
|
<input type="number" id="limitDateDay" name="limitDateDay" value="{{ old('limitDateDay') }}" min="1" max="31" placeholder="{{ __('jj') }}" required>
|
|
<input type="number" name="limitDateMonth" value="{{ old('limitDateMonth') }}" min="1" max="12" placeholder="{{ __('mm') }}" required>
|
|
<input type="number" name="limitDateYear" value="{{ old('limitDateYear') }}" min="2010" max="2050" placeholder="{{ __('aaaa') }}" required>
|
|
</p>
|
|
<p class="formDateQualite">
|
|
<label for="consumptionDateDay">{{ __('consumption_date') }}*</label>
|
|
<input type="number" id="consumptionDateDay" name="consumptionDateDay" value="{{ old('consumptionDateDay') }}" min="1" max="31" placeholder="{{ __('jj') }}" required>
|
|
<input type="number" name="consumptionDateMonth" value="{{ old('consumptionDateMonth') }}" min="1" max="12" placeholder="{{ __('mm') }}" required>
|
|
<input type="number" name="consumptionDateYear" value="{{ old('consumptionDateYear') }}" min="2010" max="2050" placeholder="{{ __('aaaa') }}" required>
|
|
</p>
|
|
</div>
|
|
|
|
<div class="champPj">
|
|
<label for="joinFile">{{ __('joinedfile') }}</label>
|
|
<div class="fileUpload">
|
|
<input type="file" name="joinFile" id="joinFile" accept=".jpg,.jpeg,.png,.pdf, image/jpg,image/png,application/pdf" />
|
|
<span id="btnup">
|
|
@include('front.icons.icon-upload')
|
|
{{ __('add_joinedfile') }}
|
|
</span>
|
|
<span>{{ __('format_joinedfile') }} : jpg, png, pdf<br>{{ __('max_joinedfile_size') }} : {{ __('data_size_mo', ['datasize' => 2]) }}</span>
|
|
</div>
|
|
<span id="returnFile"></span>
|
|
@if($errors->default->has('joinFile'))<small class="text-danger">{{ implode('<br>', $errors->default->get('joinFile')) }}</small>@endif
|
|
</div>
|
|
@endif
|
|
|
|
<p class="clearfix">
|
|
<textarea name="message" id="contactMessage" cols="1" rows="1" minlength="20" maxlength="1900" placeholder="{{ __('your_message') }}..." required>{{
|
|
old('message')
|
|
}}@if($type->equals(ContactFormType::recipe()) and !old('message')){!!
|
|
sprintf(
|
|
'%s : %s : %s : %s : %s : %s : %s : ',
|
|
__('Titre de la recette'),
|
|
__('Ingrédients'),
|
|
__('Préparation'),
|
|
__('Nombre de personne'),
|
|
__('Temps de préparation'),
|
|
__('Temps de cuisson'),
|
|
__('Difficulté')
|
|
) !!}@endif @if($type->equals(ContactFormType::abuse())){{
|
|
__('report_abuse_message', ['username' => $username ?? ''])
|
|
}}@endif</textarea>
|
|
@if($errors->default->has('message'))<small class="text-danger">{{ implode('<br>', $errors->default->get('message')) }}</small>@endif
|
|
</p>
|
|
|
|
<p class="envoyer">
|
|
<span><sup>*</sup>{{ __('mandatory_fields') }}</span>
|
|
<button title="Envoyer" class="btn btn-red btn-arronded-20 text-uppercase">{{ __('send') }}</button>
|
|
</p>
|
|
</form>
|
|
|
|
@push('scripts')
|
|
<script>
|
|
document.getElementById('contactMessage').addEventListener('onkeypress', function(e) {
|
|
this.value = this.value.substr(0, 1900);
|
|
});
|
|
@if($type->equals(ContactFormType::complain()))
|
|
document.getElementById('joinFile').onchange = function(e) {
|
|
let joinfFile = document.getElementById('joinFile');
|
|
let returnFile = document.getElementById('returnFile');
|
|
let ext = e.target.files[0].name.split('.').pop();
|
|
|
|
returnFile.innerText = joinfFile.value;
|
|
|
|
if (['png', 'jpg', 'jpeg', 'pdf'].indexOf(ext) === -1) {
|
|
returnFile.classList.add('unValid');
|
|
returnFile.classList.remove('valid');
|
|
} else {
|
|
returnFile.classList.add('valid');
|
|
returnFile.classList.remove('unValid');
|
|
}
|
|
};
|
|
@endif
|
|
|
|
</script>
|
|
@endpush
|
|
|