{# **
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://devdocs.prestashop.com/ for more information.
 *
 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 * #}

<div class="card customer-personal-informations-card">
  <h3 class="card-header">
    <i class="material-icons">person</i>
    {{ customerInformation.personalInformation.firstName }}
    {{ customerInformation.personalInformation.lastName }}
    {{ '[%06d]'|format(customerInformation.customerId.value) }}
    -
    <a href="mailto:{{ customerInformation.personalInformation.email }}">
      {{ customerInformation.personalInformation.email }}
    </a>

    <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">
        {{ '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>
