{#
 # For the full copyright and license information, please view the
 # docs/licenses/LICENSE.txt file that was distributed with this source code.
 #}

<div class="card customer-personal-informations-card">
  <h3 class="card-header">
    <i class="material-icons">person</i> {{ 'Basic information'|trans({}, 'Admin.Global') }}

    <a href="{{ getAdminLink('AdminCustomers', true, {id_customer: customerInformation.customerId.value, updatecustomer: 1, back: app.request.uri}) }}"
       class="tooltip-link float-right edit-link"
       data-toggle="pstooltip"
       title=""
       data-placement="top"
       data-original-title="{{ 'Edit'|trans({}, 'Admin.Actions') }}"
    >
      <i class="material-icons">edit</i>
    </a>
  </h3>
  <div class="card-body">

    <div class="row mb-1">
      <div class="col-sm-4 text-sm-right font-weight-bold">
        {{ 'ID'|trans({}, 'Admin.Global') }}
      </div>
      <div class="customer-id col-sm-8">
        {{ customerInformation.customerId.value }}
      </div>
    </div>

    <div class="row mb-1">
      <div class="col-sm-4 text-sm-right font-weight-bold">
        {{ 'Name'|trans({}, 'Admin.Global') }}
      </div>
      <div class="customer-name col-sm-8">
        {{ customerInformation.personalInformation.firstName }} {{ customerInformation.personalInformation.lastName }}
      </div>
    </div>

    <div class="row mb-1">
      <div class="col-sm-4 text-sm-right font-weight-bold">
        {{ 'Email'|trans({}, 'Admin.Global') }}
      </div>
      <div class="customer-email col-sm-8">
        <a href="mailto:{{ customerInformation.personalInformation.email }}">
          {{ customerInformation.personalInformation.email }}
        </a>
      </div>
    </div>

    <div class="row mb-1">
      <div class="col-sm-4 text-sm-right font-weight-bold">
        {{ 'Social Title'|trans({}, 'Admin.Global') }}
      </div>
      <div class="customer-social-title col-sm-8">
        {{ customerInformation.personalInformation.socialTitle }}
      </div>
    </div>

    <div class="row mb-1">
      <div class="col-sm-4 text-sm-right font-weight-bold">
        {{ 'Age'|trans({}, 'Admin.Orderscustomers.Feature') }}
      </div>
      <div class="col-sm-8 customer-birthday">
        {{ customerInformation.personalInformation.birthday }}
      </div>
    </div>

    <div class="row mb-1">
      <div class="col-sm-4 text-sm-right font-weight-bold">
        {{ 'Registration Date'|trans({}, 'Admin.Orderscustomers.Feature') }}
      </div>
      <div class="col-sm-8 customer-registration-date">
        {{ customerInformation.personalInformation.registrationDate }}
      </div>
    </div>

    <div class="row mb-1">
      <div class="col-sm-4 text-sm-right font-weight-bold">
        {{ 'Last Visit'|trans({}, 'Admin.Orderscustomers.Feature') }}
      </div>
      <div class="col-sm-8 customer-last-visit-date">
        {{ customerInformation.personalInformation.lastVisitDate }}
      </div>
    </div>

    {% if customerInformation.personalInformation.rankBySales %}
      <div class="row mb-1">
        <div class="col-sm-4 text-sm-right font-weight-bold">
          {{ 'Best Customer Rank'|trans({}, 'Admin.Orderscustomers.Feature') }}
        </div>
        <div class="col-sm-8 customer-sales-rank">
          {{ customerInformation.personalInformation.rankBySales }}
        </div>
      </div>
    {% endif %}

    {% if isMultistoreEnabled %}
      <div class="row mb-1">
        <div class="col-sm-4 text-sm-right font-weight-bold">
          {{ 'Store'|trans({}, 'Admin.Global') }}
        </div>
        <div class="customer-shop-name col-sm-8">
          {{ customerInformation.personalInformation.shopName }}
        </div>
      </div>
    {% endif %}

    <div class="row mb-1">
      <div class="col-sm-4 text-sm-right font-weight-bold">
        {{ 'Language'|trans({}, 'Admin.Global') }}
      </div>
      <div class="col-sm-8 customer-language-name">
        {{ customerInformation.personalInformation.languageName }}
      </div>
    </div>

    <div class="row mb-1">
      <div class="col-sm-4 text-sm-right font-weight-bold">
        {{ 'Registrations'|trans({}, 'Admin.Orderscustomers.Feature') }}
      </div>
      <div class="col-sm-8">
        {% set isNewsletterSubscribed = customerInformation.personalInformation.subscriptions.newsletterSubscribed %}
        {% set isPartnerOffersSubscribed = customerInformation.personalInformation.subscriptions.partnerOffersSubscribed %}

        <span class="customer-newsletter-subscription-status badge badge-{% if isNewsletterSubscribed %}success{% else %}danger{% endif %} rounded">
          <i class="material-icons">{% if isNewsletterSubscribed %}check{% else %}cancel{% endif %}</i>
          {{ 'Newsletter'|trans({}, 'Admin.Global') }}
        </span>

        <span class="customer-partner-offers-status badge badge-{% if isPartnerOffersSubscribed %}success{% else %}danger{% endif %} rounded">
          <i class="material-icons">{% if isPartnerOffersSubscribed %}check{% else %}cancel{% endif %}</i>
          {{ 'Partner offers'|trans({}, 'Admin.Orderscustomers.Feature') }}
        </span>
      </div>
    </div>

    <div class="row mb-1">
      <div class="col-sm-4 text-sm-right font-weight-bold">
        {{ 'Latest Update'|trans({}, 'Admin.Orderscustomers.Feature') }}
      </div>
      <div class="customer-latest-update col-sm-8">
        {{ customerInformation.personalInformation.lastUpdateDate }}
      </div>
    </div>

    <div class="row mb-1">
      <div class="col-sm-4 text-sm-right font-weight-bold">
        {{ 'Status'|trans({}, 'Admin.Global') }}
      </div>
      <div class="col-sm-8">
        {% set isCustomerActive = customerInformation.personalInformation.active %}

        <span class="customer-status badge badge-{% if isCustomerActive %}success{% else %}danger{% endif %} rounded">
          {% if isCustomerActive %}
            <i class="material-icons">check</i>
            {{ 'Active'|trans({}, 'Admin.Global') }}
          {% else %}
            <i class="material-icons">cancel</i>
            {{ 'Inactive'|trans({}, 'Admin.Global') }}
          {% endif %}
        </span>
      </div>
    </div>

    <div class="customer-guest-status row mb-1">
      <div class="col-sm-4 text-sm-right font-weight-bold">
          {{ 'Customer type'|trans({}, 'Admin.Orderscustomers.Feature') }}
      </div>
      <div class="col-sm-8">
        {% if customerInformation.personalInformation.guest %}
            <p class="mb-0">{{ 'Guest customer'|trans({}, 'Admin.Orderscustomers.Feature') }}</p>
            {% if customerInformation.generalInformation.customerBySameEmailExists %}
              <p class="text-muted">{{ 'You can\'t transform this guest to a registered customer, because a registered customer with this email address already exists. '|trans({}, 'Admin.Orderscustomers.Notification') }}</p>
            {% else %}
              <p class="text-muted">{{ 'You can transform this guest to a registered customer. The customer will receive an email with a link to set a password.'|trans({}, 'Admin.Orderscustomers.Notification') }}</p>

              {% form_theme transferGuestAccountForm '@PrestaShop/Admin/TwigTemplateForm/prestashop_ui_kit.html.twig' %}
              {{ form_start(transferGuestAccountForm, {action: path('admin_customers_transform_guest_to_customer', {customerId: customerInformation.customerId.value})}) }}
                {{ form_widget(transferGuestAccountForm.transfer_guest_account) }}
              {{ form_end(transferGuestAccountForm) }}
            {% endif %}
        {% else %}
            <p>{{ 'Registered customer'|trans({}, 'Admin.Orderscustomers.Feature') }}</p>
        {% endif %}
      </div>
    </div>
  </div>
</div>
