{**
 * Copyright 2024-2025 Simply.IN Sp. z o.o.
 *
 * NOTICE OF LICENSE
 *
 * Licensed under the EUPL-1.2 or later.
 * You may not use this work except in compliance with the Licence.
 *
 * Copy of the Licence is available at:
 * https://joinup.ec.europa.eu/software/page/eupl
 * It is bundled with this package in the file LICENSE.txt
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the Licence is distributed on an as is basis,
 * without warranties or conditions of any kind, either express or implied.
 * Check the Licence for the specific language governing permissions
 * and limitations under the License.
 *
 * @author    Simply.IN Sp. z o.o.
 * @copyright 2024-2025 Simply.IN Sp. z o.o.
 * @license   https://joinup.ec.europa.eu/software/page/eupl
 *}
<div class="simplyin-popup-overlay"></div>
<div class="simplyin-popup">
    <div class="simplyin-popup-header">
        <img width="39" height="40" src="{$module_path|escape:'html':'UTF-8'}views/img/logo_smalln.svg"/>
        <div class="popup-header-strong">{l s='Choose your data' mod='simplyin'}</div>
        <div class="simplyin-popup-close-button">
            <img width="24" height="24" src="{$module_path|escape:'html':'UTF-8'}views/img/close_icon.svg"/>
        </div>
    </div>
    <div class="simplyin-popup-container">
        <div class="simplyin-popup-content">
            <div class="popup-address-label-header">
                <span>{l s='Billing' mod='simplyin'}</span>
                <button class="popup-address-actions-add" data-type="billingAddresses">
                    <img width="18" height="18" src="{$module_path|escape:'html':'UTF-8'}views/img/add_icon.svg"/>
                    <div class="popup-address-actions-label">{l s='Add new data' mod='simplyin'}</div>
                </button>
            </div>
            <div
                class="popup-address-selector"
                id="popup-invoice-address"
                data-edit="1"
                data-delete="1"
                data-force-delete="0"
            >
                {if !empty($billing_addresses)}
                    {foreach from=$billing_addresses item='address'}
                        {if $address['selected']}
                            <div class="popup-selected-address-group">
                                <div class="popup-selected-address">
                                    <span class="popup-selected-address-line-1">
                                        {$address['addressName']|escape:'htmlall':'UTF-8'}
                                    </span>
                                    <span class="popup-selected-address-line-2">
                                        {$address['street']|escape:'htmlall':'UTF-8'}{if $address['appartmentNumber'] != ''}/{$address['appartmentNumber']|escape:'htmlall':'UTF-8'}{/if}, {$address['city']|escape:'htmlall':'UTF-8'}
                                    </span>
                                </div>
                            </div>
                        {/if}
                    {/foreach}
                    {foreach from=$billing_addresses item='address'}
                        <div class="popup-address-select-group popup-address-select-group-invoice">
                            <div class="popup-address-select" data-id="{$address['_id']|escape:'htmlall':'UTF-8'}">
                                <label class="popup-address-select-label-group">
                                    <span class="popup-address-checkbox">
                                        <input
                                            type="radio"
                                            name="simplyin-invoice-address"
                                            data-id="{$address['_id']|escape:'htmlall':'UTF-8'}"
                                            data-address-1="{$address['addressName']|escape:'htmlall':'UTF-8'}"
                                            data-address-2="{$address['street']|escape:'htmlall':'UTF-8'}{if $address['appartmentNumber'] != ''}/{$address['appartmentNumber']|escape:'htmlall':'UTF-8'}{/if}, {$address['city']|escape:'htmlall':'UTF-8'}"
                                            {if $address['selected']} checked{/if}
                                        />
                                    </span>
                                    <span class="popup-image-max-width">
                                        <span class="icon">
                                            <img draggable="false" width="16" height="16" role="img" class="emoji" alt="{$address['icon']|escape:'htmlall':'UTF-8'}" src="https://s.w.org/images/core/emoji/16.0.1/svg/1f3e2.svg">
                                        </span>
                                    </span>
                                    <span class="popup-address-label">
                                        <span class="popup-address-label-line-1">
                                            {$address['addressName']|escape:'htmlall':'UTF-8'}
                                        </span>
                                        <span class="popup-address-label-line-2">
                                            {$address['street']|escape:'htmlall':'UTF-8'}{if $address['appartmentNumber'] != ''}/{$address['appartmentNumber']|escape:'htmlall':'UTF-8'}{/if}, {$address['city']|escape:'htmlall':'UTF-8'}
                                        </span>
                                    </span>
                                </label>
                                <span class="popup-address-actions">
                                    <img width="24" height="24" src="{$module_path|escape:'html':'UTF-8'}views/img/dots_icon.svg" alt="Edit"/>
                                </span>
                            </div>
                        </div>
                    {/foreach}
                {/if}
            </div>
            <div class="popup-address-label-header">
                <span>{l s='Delivery' mod='simplyin'}</span>
            </div>
            <div class="popup-address-selector popup-type-delivery-selector">
                <div class="popup-address-select-group">
                    <div class="popup-address-select">
                        <label class="popup-address-select-label-group">
                            <span class="popup-address-checkbox">
                                <input
                                    type="radio"
                                    name="simplyin-delivery-type"
                                    class="simplyin-delivery-type"
                                    value="address"{if $service_type === false} checked{/if}
                                />
                            </span>
                            <span class="popup-address-label">
                                <span class="popup-address-label-line-3">
                                    {l s='Delivery to your door' mod='simplyin'}{if isset($carriers_cost['default'])} - {$carriers_cost['default']}{/if}
                                </span>
                                <span class="popup-address-label-line-4">
                                    {l s='Door-to-door delivery' mod='simplyin'}
                                </span>
                            </span>
                        </label>
                    </div>
                    <div class="popup-address-select">
                        <label class="popup-address-select-label-group">
                            <span class="popup-address-checkbox">
                                <input
                                    type="radio"
                                    name="simplyin-delivery-type"
                                    class="simplyin-delivery-type"
                                    value="parcel_locker"{if $service_type !== false} checked{/if}
                                />
                            </span>
                            <span class="popup-address-label">
                                <span class="popup-address-label-line-3">
                                    {l s='Delivery to a parcel locker - from %s' sprintf=[$parcel_lockers_min_price] mod='simplyin'}
                                </span>
                                <span class="popup-address-label-line-4">
                                    {l s='or collection point' mod='simplyin'}
                                </span>
                            </span>
                        </label>
                    </div>
                </div>
            </div>
            <div class="popup-delivery-address-box" {if $service_type === false}style="display: block;"{else}style="display: none;"{/if}>
                <div class="popup-address-label-header">
                    <span>Dane dostawy</span>
                    <span class="popup-button-expand{if $delivery_address != $billing_address} expanded{/if}" data-target="popup-delivery-address">
                        <button>
                            <img width="24" height="24" src="{$module_path|escape:'html':'UTF-8'}views/img/expand_icon.svg"/>
                            <span class="popup-muitouch-ripple-root"></span>
                        </button>
                    </span>
                </div>
                <div class="popup-address-selector" id="popup-delivery-address" data-edit="1" data-delete="1" data-force-delete="0">
                    <div class="popup-address-checkbox">
                        <label class="popup-address-select-label-group" data-target="popup-delivery-address" id="simplyin-the-same-address">
                            <span class="popup-address-checkbox">
                                <input type="checkbox" {if $delivery_address == $billing_address} checked{/if} />
                            </span>
                            <span class="popup-address-checkbox-label">
                                {l s='Billing data is the same as delivery data' mod='simplyin'}
                            </span>
                        </label>
                    </div>
                    <div class="popup-selected-address-group">
                    {if !empty($shipping_addresses)}
                        {foreach from=$shipping_addresses item='address'}
                            {if $address['selected']}
                                <div class="popup-selected-address">
                                    <span class="popup-selected-address-line-1">
                                        {$address['addressName']|escape:'htmlall':'UTF-8'}
                                    </span>
                                    <span class="popup-selected-address-line-2">
                                        {$address['street']|escape:'htmlall':'UTF-8'}{if $address['appartmentNumber'] != ''}/{$address['appartmentNumber']|escape:'htmlall':'UTF-8'}{/if}, {$address['city']|escape:'htmlall':'UTF-8'}
                                    </span>
                                </div>
                            {/if}
                        {/foreach}
                    </div>
                    {/if}
                    <div class="popup-address-select-group" {if $delivery_address != $billing_address} style="display: block;"{else}} style="display: none;"{/if}>
                    {if !empty($shipping_addresses)}
                        {foreach from=$shipping_addresses item='address'}
                        <div class="popup-address-select" data-id="{$address['_id']|escape:'htmlall':'UTF-8'}">
                            <label class="popup-address-select-label-group">
                                <span class="popup-address-checkbox">
                                    <input
                                        type="radio"
                                        name="simplyin-delivery-address"
                                        data-id="{$address['_id']|escape:'htmlall':'UTF-8'}"
                                        data-id="{$address['_id']|escape:'htmlall':'UTF-8'}"
                                        data-address-1="{$address['addressName']|escape:'htmlall':'UTF-8'}"
                                        data-address-2="{$address['street']|escape:'htmlall':'UTF-8'}{if $address['appartmentNumber'] != ''}/{$address['appartmentNumber']|escape:'htmlall':'UTF-8'}{/if}, {$address['city']|escape:'htmlall':'UTF-8'}"
                                        {if $address['selected']} checked{/if}
                                    />
                                </span>
                                <span class="popup-image-max-width">
                                    <span class="icon">
                                            <img draggable="false" role="img" class="emoji" alt="{$address['icon']|escape:'htmlall':'UTF-8'}" src="https://s.w.org/images/core/emoji/16.0.1/svg/1f3e2.svg">
                                        </span>
                                </span>
                                <span class="popup-address-label">
                                    <span class="popup-address-label-line-1">
                                        {$address['addressName']|escape:'htmlall':'UTF-8'}
                                    </span>
                                    <span class="popup-address-label-line-2">
                                        {$address['street']|escape:'htmlall':'UTF-8'}{if $address['appartmentNumber'] != ''}/{$address['appartmentNumber']|escape:'htmlall':'UTF-8'}{/if}, {$address['city']|escape:'htmlall':'UTF-8'}
                                    </span>
                                </span>
                            </label>
                            <span class="popup-address-actions">
                                <img width="24" height="24" src="{$module_path|escape:'html':'UTF-8'}views/img/dots_icon.svg" alt="Edit"/>
                            </span>
                        </div>
                        {/foreach}
                    {/if}
                    </div>
                    <button class="popup-address-actions-add" data-type="shippingAddresses">
                        <img width="18" height="18" src="{$module_path|escape:'html':'UTF-8'}views/img/add_icon.svg"/>
                        <div class="popup-address-actions-label">
                            {l s='Add new data' mod='simplyin'}
                        </div>
                    </button>
                </div>
            </div>
            <div class="popup-delivery-parcel-locker-box" {if $service_type !== false}style="display: block;"{else}style="display: none;"{/if}>
                <div class="popup-address-label-header">
                    <span>{l s='Choose a parcel locker or pickup point' mod='simplyin'}</span>
                    <span class="popup-button-expand expanded" data-target="popup-delivery-parcel-locker-address">
                        <button>
                            <img width="24" height="24" src="{$module_path|escape:'html':'UTF-8'}views/img/expand_icon.svg"/>
                            <span class="popup-muitouch-ripple-root"></span>
                        </button>
                    </span>
                </div>
                <div class="popup-address-selector-header">
                    <button {if $service_type == 'parcel' || $service_type === false}class="active"{/if} data-target="simplyin-parcel-lockers">
                        {l s='Parcel lockers' mod='simplyin'}
                    </button>
                    <button {if $service_type == 'delivery'}class="active"{/if} data-target="simplyin-delivery-points">
                        {l s='Pickup points' mod='simplyin'}
                    </button>
                </div>
                <div class="popup-address-selector" id="popup-delivery-parcel-locker-address" data-delete="1" data-edit="0" data-force-delete="1">
                    {if !empty($parcel_lockers)}
                        {foreach from=$parcel_lockers item='parcel'}
                            {if $parcel['selected']}
                                <div class="popup-selected-address-group" style="display: none;">
                                    <div class="popup-selected-address">
                                        <span class="popup-selected-address-line-1">
                                            <span class="popup-address-label-line-1">{$parcel['addressName']|escape:'htmlall':'UTF-8'}</span>
                                        </span>
                                    </div>
                                </div>
                                {break}
                            {/if}
                        {/foreach}
                    {/if}
                    <div class="popup-address-select-group" id="simplyin-parcel-lockers" {if $service_type == 'parcel' || $service_type === false}style="display: block;"{else}style="display: none;"{/if}>
                        {if !empty($parcel_lockers)}
                            {foreach from=$parcel_lockers item='parcel'}
                                {if $parcel['service_type'] == 'parcel_machine'}
                                    <div class="popup-address-select" data-id="{$parcel['_id']|escape:'htmlall':'UTF-8'}">
                                        <label class="popup-address-select-label-group">
                                            <span class="popup-address-checkbox">
                                                <input
                                                    type="radio"
                                                    name="simplyin-parcel-locker-selected"{if $parcel['selected']} checked{/if}
                                                    data-id="{$parcel['_id']|escape:'htmlall':'UTF-8'}"
                                                    data-address-1="{$parcel['addressName']|escape:'htmlall':'UTF-8'}"
                                                />
                                            </span>
                                            <span class="popup-image-max-width">
                                                <img src="{$parcel['logoUrl']|escape:'htmlall':'UTF-8'}">
                                            </span>
                                            <span class="popup-address-label-max-width">
                                                <span class="popup-address-label-line-1">{$parcel['addressName']|escape:'htmlall':'UTF-8'}</span>
                                                <span class="popup-address-label-line-2">{$parcel['address']|escape:'htmlall':'UTF-8'}</span>
                                                {if isset($carriers_cost[$parcel['providerName']])}
                                                    <span class="popup-cost">{$carriers_cost[$parcel['providerName']]|escape:'htmlall':'UTF-8'}</span>
                                                {/if}
                                            </span>
                                            <span class="popup-image-max-width">
                                                <div class="popup-icon">{$parcel['icon']|escape:'htmlall':'UTF-8'}</div>
                                            </span>
                                        </label>
                                        <span class="popup-address-actions">
                                            <img width="24" height="24" src="{$module_path|escape:'html':'UTF-8'}views/img/dots_icon.svg" alt="Edit"/>
                                        </span>
                                    </div>
                                {/if}
                            {/foreach}
                        {/if}
                    </div>
                    <div class="popup-address-select-group" id="simplyin-delivery-points" {if $service_type == 'delivery'}style="display: block;"{else}style="display: none;"{/if}>
                        {if !empty($parcel_lockers)}
                            {foreach from=$parcel_lockers item='parcel'}
                                {if $parcel['service_type'] != 'parcel_machine'}
                                    <div class="popup-address-select"  data-id="{$parcel['_id']|escape:'htmlall':'UTF-8'}">
                                        <label class="popup-address-select-label-group">
                                            <span class="popup-address-checkbox">
                                                <input
                                                    type="radio"
                                                    name="simplyin-delivery-point-selected"
                                                    data-id="{$parcel['_id']|escape:'htmlall':'UTF-8'}"
                                                    data-address-1="{$parcel['addressName']|escape:'htmlall':'UTF-8'}"
                                                    {if $parcel['selected']} checked{/if}
                                                />
                                            </span>
                                            <span class="popup-image-max-width">
                                                <img src="{$parcel['logoUrl']|escape:'htmlall':'UTF-8'}">
                                            </span>
                                            <span class="popup-address-label-max-width">
                                                <span class="popup-address-label-line-1">{$parcel['addressName']|escape:'htmlall':'UTF-8'}</span>
                                                <span class="popup-address-label-line-2">{$parcel['address']|escape:'htmlall':'UTF-8'}</span>
                                                {if isset($carriers_cost[$parcel['providerName']])}
                                                    <span class="popup-cost">{$carriers_cost[$parcel['providerName']]|escape:'htmlall':'UTF-8'}</span>
                                                {/if}
                                            </span>
                                            <span class="popup-image-max-width">
                                                <div class="popup-icon">{$parcel['icon']|escape:'htmlall':'UTF-8'}</div>
                                            </span>
                                        </label>
                                        <span class="popup-address-actions">
                                            <img width="24" height="24" src="{$module_path|escape:'html':'UTF-8'}views/img/dots_icon.svg" alt="Edit"/>
                                        </span>
                                    </div>
                                {/if}
                            {/foreach}
                        {/if}
                    </div>
                </div>
                <button class="popup-address-actions-add last" data-type="parcel">
                    <img width="18" height="18" src="{$module_path|escape:'html':'UTF-8'}views/img/add_icon.svg" />
                    <div class="popup-address-actions-label">
                        {l s='Add new data' mod='simplyin'}
                    </div>
                </button>
            </div>
        </div>
    <div class="popup-buttons-footer">
        <button class="popup-select-address" type="button">
            {l s='Select data' mod='simplyin'}
        </button>
    </div>
</div>
</div>