{% from 'utils.html.twig' import ico, imgUpload, switch %}
{# SETUP - IS BRAZILIAN #}
{% if user.document is null %}
{% set isBrazilSetup = (getConfig('checkout_default_region') == '1')? false : true %}
{% else %}
{% set isBrazilSetup = (user.country is not null and user.country.id == enum('AbstractEnum::COUNTRY_BRAZIL')) %}
{% endif %}
<div class="profile-edit">
<form action="{{ path('userEditInfoProfile') }}" method="POST"
id="formUserInfo" class="form-geral form-user"
data-is-brazil-active="{{ isBrazilSetup? '1':'0' }}">
{# WARN REQUIRED #}
<p class="warn-required">{{ getLanguage('required_fields', 'util')|raw }}</p>
{% set confreq = getConfig('complete_registration') ? 'required' : '' %}
{% set req = confreq ? ' <em>*</em>' :'' %}
{# PERFIL #}
<div class="cp-cols">
<div class="cp cp-4 cp-sm-md-2">
<label for="name">{{ getLanguage('name', 'profile') }} <em>*</em></label>
<input type="text" id="name" name="name" placeholder="{{ getLanguage('enter_full_name', 'profile') }}" value="{{ user.name }}" required>
</div>
<div class="cp cp-4 cp-sm-md-2">
<label for="profile-phone">{{ getLanguage('phone', 'profile') }} <em>*</em></label>
<input type="text" id="profile-phone" class="intlPhone" name="phone" value="{{ user.phone }}" required>
</div>
<div class="cp cp-4 cp-sm-md-2">
<label for="email">E-mail</label>
<input type="email" id="email" name="email" value="{{ user.email }}" disabled="disabled">
</div>
<div class="cp cp-4 cp-sm-md-2">
<label for="password">{{ getLanguage('password', 'profile') }} <em>*</em></label>
<input type="password" name="password" id="password" value="{{ user.password }}" required>
</div>
</div>
<div class="cp-cols">
<div class="cp cp-gd">
{# DOCUMENT #}
<label for="profile-document" data-country="{{ isBrazilSetup? 1:'' }}">
{{ getLanguage('document', 'profile') }}
<span class="document-type"> (CPF / CNPJ)</span>
{{ req|raw }}
</label>
<input type="text" name="document" id="profile-document" value="{{ user.document }}"
data-apply-validation="{{ isBrazilSetup? 'true':'false' }}"
data-alt-placeholder="{{ getLanguage('type_document', 'profile') }}" placeholder="{{ getLanguage('type_document', 'profile') }}" {{ confreq }}>
</div>
<div class="cp cp-gd">
<label for="profile-birth-date">{{ getLanguage('birth_date', 'profile') }}{{ req|raw }}</label>
<input type="text" id="profile-birth-date" name="birthDate" value="{{ user.birthDate ? user.birthDate|date('Y-m-d') : '' }}" {{ confreq }}>
</div>
<div class="cp cp-gd">
<label for="user-name">{{ getLanguage('username', 'profile') }}</label>
<div class="input-tag">
<label for="username">
<div class="domainMobile">{{ ico('user') }}</div>
<div class="domainDesktop">{{ eadDomain }}/p/</div>
</label>
<input type="text" name="username" id="username" value="{{ user.username }}" placeholder="username" required>
</div>
</div>
</div>
<section class="fotos">
{# PROFILE AVATAR #}
<div class="dropfile js--dropfile" data-status="{{ user.photo is empty? 'empty' }}">
<div class="label-help">
{{ getLanguage('profile_picture', 'profile') }}
</div>
<div class="avatar js--dropfile-area">
{% if user.photo %}
{{ imgUpload(user.photo, enum('AbstractEnum::PATH_PROFILES'), 'user-profile-big', user.name, 'js--dropfile-mini') }}
{% else %}
<img src="" class="js--dropfile-mini" onerror="imgError(this)">
{% endif %}
<div class="loader">{{ ico('loader-wish') }}</div>
</div>
<p class="filename js--dropfile-file-label">…</p>
<input type="file" id="photo" name="photo" class="js--dropfile-input" accept="image/*"
data-drop-url="{{ path('userEditTheme', {'id': user.id}) }}"
data-delete-url="{{ path('userDeletePhoto', {'id': user.id}) }}">
<nav class="actions">
<button type="button" class="js--dropfile-btn-edit btn-ed">{{ ico('edit') }}{{ getLanguage('edit', 'profile') }}</button>
<button type="button" class="js--dropfile-btn-delete btn-ed btn-delete">{{ ico('delete') }}{{ getLanguage('delete', 'profile') }}</button>
</nav>
</div>
{# PROFILE COVER #}
<div class="dropfile js--dropfile" data-status="{{ user.cover is empty? 'empty' }}">
<p class="label-help">{{ getLanguage('cover_photo', 'profile') }}</p>
<div class="cover js--dropfile-area">
{% if user.cover %}
{{ imgUpload(user.cover, enum('AbstractEnum::PATH_COVERS_PROFILE'), 'user-profile-cover', user.name, 'js--dropfile-mini') }}
{% else %}
<img src="" class="js--dropfile-mini" onerror="imgError(this)">
{% endif %}
<div class="drop-label">
{{ ico('upload') }}
<p>{{ getLanguage('drop_the_file', 'profile') }}</p>
</div>
<div class="loader">{{ ico('loader-wish') }}</div>
</div>
<p class="filename js--dropfile-file-label">…</p>
<input type="file" name="cover" class="js--dropfile-input" accept="image/*"
data-drop-url="{{ path('userEditTheme', {'id': user.id}) }}"
data-delete-url="{{ path('userDeleteCover', {'id': user.id}) }}">
<nav class="actions actions-dir">
<button type="button" class="js--dropfile-btn-edit btn-ed">{{ ico('edit') }}{{ getLanguage('edit', 'profile') }}</button>
<button type="button" class="js--dropfile-btn-delete btn-ed btn-delete">{{ ico('delete') }}{{ getLanguage('delete', 'profile') }}</button>
</nav>
</div>
</section>
{# BIOGRAPHY #}
<div class="cp-cols">
<div class="cp cp-1">
<label for="biography">{{ getLanguage('biography', 'profile') }}</label>
<input type="text" name="biography" id="biography" value="{{ user.biography }}" placeholder="{{ getLanguage('talk_about_you', 'profile') }}">
<p class="count-result-caracteres"><span class="caracteres"></span></p>
</div>
</div>
{# RESUME #}
<div class="cp-cols">
<div class="cp cp-1">
<label for="resume">{{ getLanguage('resume', 'profile') }}</label>
<textarea name="resume" id="resume" placeholder="{{ getLanguage('resume', 'profile') }}" class="js--editor">{{ user.resume }}</textarea>
<p class="count-result-caracteres"><span class="caracteres"></span></p>
</div>
</div>
{# ADDRESS #}
<h3>{{ getLanguage('address', 'profile') }}</h3>
<div class="cp-cols">
{# IS BRAZILIAN #}
<div class="cp cp-pq">
<label for="profile-country">{{ getLanguage('am_brazilian', 'util') }}</label>
{{ switch({
id: 'profile-country',
name: 'country',
checked: isBrazilSetup,
attribs: 'class="isBrazil_userProfile"',
})}}
</div>
{# ZIP CODE #}
<div class="cp cp-4 cp-sm-md-2">
<label for="profile-zipCode">{{ getLanguage('zipcode', 'profile') }}{{ req|raw }}</label>
<input type="text" id="profile-zipCode" name="zipCode" placeholder="{{ getLanguage('enter_zip_code', 'profile') }}" data-apply-search="true" value="{{ user.zipCode }}" {{ confreq }}>
</div>
{# STATE #}
<div class="cp cp-4 cp-sm-md-2" data-show-brazil>
<label for="profile-state">{{ getLanguage('state', 'profile') }}{{ req|raw }}</label>
<div class="select-wrap">
<select id="profile-state"
name="state"
class="custom-select custom-select--search"
request="{{ path('stateList') }}"
save="{{ user.state ? user.state.id }}"
{{ confreq }}>
</select>
<i class="loader">{{ ico('loader-wish') }}</i>
</div>
</div>
{# CITY #}
<div class="cp cp-4 cp-sm-md-2" data-show-brazil>
<label for="profile-city">{{ getLanguage('city', 'profile') }}{{ req|raw }}</label>
<div class="select-wrap">
<select id="profile-city"
name="city"
class="custom-select custom-select--search"
request="{{ path('cityList') }}"
save="{{ user.city ? user.city.id }}"
{{ confreq }}>
</select>
<i class="loader">{{ ico('loader-wish') }}</i>
</div>
</div>
{# ADDRESS #}
<div class="cp cp-4 cp-sm-md-2">
<label for="profile-address">{{ getLanguage('address', 'profile') }}{{ req|raw }}</label>
<input type="text" id="profile-address" name="address" placeholder="{{ getLanguage('type_your_address', 'profile') }}" value="{{ user.address }}" {{ confreq }}>
</div>
{# NUMBER #}
<div class="cp cp-4 cp-sm-md-2">
<label for="profile-addressNumber">{{ getLanguage('number', 'profile') }}<span data-show-brazil>{{ req|raw }}</span></label>
<input type="text" id="profile-addressNumber" name="addressNumber" placeholder="{{ getLanguage('type_your_number', 'profile') }}" value="{{ user.addressNumber }}" {{ confreq }}>
</div>
{# COMPLEMENT #}
<div class="cp cp-4 cp-sm-md-2">
<label for="profile-addressComplement">{{ getLanguage('complement', 'profile') }}</label>
<input type="text" id="profile-addressComplement" name="addressComplement" placeholder="{{ getLanguage('type_your_complement', 'profile') }}" value="{{ user.addressComplement }}">
</div>
{# NEIGHBORHOOD #}
<div class="cp cp-4 cp-sm-md-2">
<label for="profile-addressNeighborhood">{{ getLanguage('district', 'profile') }}{{ req|raw }}</label>
<input type="text" id="profile-addressNeighborhood" name="addressNeighborhood" placeholder="{{ getLanguage('enter_district', 'profile') }}" value="{{ user.addressNeighborhood }}" {{ confreq }}>
</div>
</div>
{# DADOS COMPLEMENTARES #}
{% if fields|length > 0 %}
<h3>{{ getLanguage('additional_data', 'profile') }}</h3>
<div class="cp-cols">
{% include 'website/user/profile/user-custom-form.html.twig' %}
</div>
{% endif %}
{# CONTATO #}
<h3>{{ getLanguage('contacts', 'profile') }}</h3>
<div class="cp-cols">
<div class="cp cp-3 cp-sm-1 cp-md-2">
<label for="linkedin">LinkedIn</label>
<div class="input-tag">
<label for="linkedin">
<div class="icon">
{{ ico('linkedin') }}
</div>
</label>
<input type="text" name="linkedin" id="linkedin" value="{{ user.linkedin }}">
</div>
</div>
<div class="cp cp-3 cp-sm-1 cp-md-2">
<label for="website">{{ getLanguage('website_or_portfolio', 'profile') }}</label>
<div class="input-tag">
<label for="website">
<div class="icon">
{{ ico('globe') }}
</div>
</label>
<input type="text" name="website" id="website" value="{{ user.website }}" >
</div>
</div>
<div class="cp cp-3 cp-sm-1 cp-md-2">
<label for="facebook">Facebook</label>
<div class="input-tag">
<label for="facebook">
<div class="icon">
{{ ico('facebook') }}
</div>
</label>
<input type="text" name="facebook" id="facebook" value="{{ user.facebook }}">
</div>
</div>
<div class="cp cp-3 cp-sm-1 cp-md-2">
<label for="twitter">Twitter</label>
<div class="input-tag">
<label for="twitter">
<div class="icon">
{{ ico('twitter') }}
</div>
</label>
<input type="text" name="twitter" id="twitter" value="{{ user.twitter }}">
</div>
</div>
<div class="cp cp-3 cp-sm-1 cp-md-2">
<label for="instagram">Instagram</label>
<div class="input-tag">
<label for="instagram">
<div class="icon">
{{ ico('instagram') }}
</div>
</label>
<input type="text" name="instagram" id="instagram" value="{{ user.instagram }}">
</div>
</div>
<div class="cp cp-3 cp-sm-1 cp-md-2">
<label for="youtube">Youtube</label>
<div class="input-tag">
<label for="youtube">
<div class="icon">
{{ ico('youtube') }}
</div>
</label>
<input type="text" name="youtube" id="youtube" value="{{ user.youtube }}">
</div>
</div>
<div class="cp cp-3 cp-sm-1 cp-md-2">
<label for="tiktok">Tiktok</label>
<div class="input-tag">
<label for="tiktok">
<div class="icon">
{{ ico('tiktok') }}
</div>
</label>
<input type="text" name="tiktok" id="tiktok" value="{{ user.tiktok }}">
</div>
</div>
</div>
<input type="hidden" name="customField" value="{{ user.customField }}">
<nav class="actions-confirm">
<a href="{{ path('userProfilePublic', { username: user.username }) }}" class="btn-visualizar-peq">{{ ico('eye') }} {{ getLanguage('view_profile', 'profile') }}</a>
<button type="button" id="btnUserInfo" class="btn-continuar-peq btn-load">
<span>{{ ico('check-circle') }} {{ getLanguage('save', 'profile') }}</span>
<span>{{ getLanguage('wait', 'util') }} … <i class="loader">{{ ico('loader-wish') }}</i></span>
</button>
</nav>
</form>
</div>