{% import 'shared/componnents/_macros/_alerts.html.twig' as alerts %}
{% set form = form ?? null %}
{% set hotel_contract = hotel_contract ?? null %}
{% set hotel = hotel ?? null %}
{% set formHasNoErrors = false %}
{% set error_calendar = '' %}
{% set error_reduction = '' %}
{% set errors_validator = '' %}
{% set error_number_of_days = '' %}
{% if form.calendar.start.vars.errors|length %}
{% set error_calendar = form_errors(form.calendar.start) %}
{% endif %}
{% if form.reduction.vars.errors|length %}
{% set error_reduction = form_errors(form.reduction) %}
{% endif %}
{% if form.numberOfDays.vars.errors|length %}
{% set error_number_of_days = form_errors(form.numberOfDays) %}
{% endif %}
{% if
form.calendar.start.vars.errors|length or
form.reduction.vars.errors|length
%}
{% set errors_validator = error_calendar ~ ' ' ~ error_reduction ~ ' ' ~ error_number_of_days %}
{{ alerts.notification(errors_validator, 'info') }}
{% endif %}
{% if false == hasAtLeastOneAgency() %}
{% set formHasNoErrors = true %}
{{ alerts.alert('please_create_at_least_one_agency'|trans, 'danger', 'fa fa-fw fa-warning', 'Warning !', path('app_agency_index')) }}
{% endif %}
{% if not formHasNoErrors %}
{% include 'hotel_contract_early_booking/_form.html.twig' with {
'path': path('app_hotel_contract_early_booking_index', {'hotelId': hotel.id, 'hotelContractId': hotel_contract.id}),
'path_list': path('app_hotel_contract_detail', {'hotelId': hotel.id, 'hotelContractId': hotel_contract.id}),
'label_btn': 'Ajouter',
'class_alert': 'success',
'entity_name': 'HotelContractEarlyBooking'
} %}
{% endif %}