{% extends 'page-base.twig' %}
{% block content %}
    <div class="page-columns">
        <div class="column">
            <!-- General Settings -->
            <div class="content-box">
                <div class="box-header">
                <span class="box-header-title">
                    <span class="box-header-icon">
                        <i class="fa-solid fa-euro-sign"></i>
                    </span>
                    {{ _e('Update Prices', 'scf-price') }}
                </span>
                </div>
                <div class="box-content">
                    <form class="box-form" id="price-updater-form" method="post" enctype="multipart/form-data">
                        <span class="form-item-description">
                            {{ _e('When submitting this form it will look through the CSV file to look for prices,
                                if there is another comment/string instead of a numbered price it will set the product
                                to private.') }}
                        </span>
                        <input type="hidden" name="_wpnonce" value="{{ function('wp_create_nonce', 'scf-price-updater') }}" />
                        <div class="form-item" style="margin-top: 1rem;">
                            <label for="form-data-separator" class="form-item-label">{{ _e('Separator', 'scf-price') }}</label>
                            <input
                                type="text"
                                id="form-data-separator"
                                class="form-input"
                                name="file_separator"
                                placeholder="{{ _e('For example , or ;', 'geodata') }}"
                                value="{{ separator }}"
                            />
                            <span class="form-item-description">{{ _e('String seperator for the CSV file.') }}</span>
                        </div>
                        <div class="form-item" style="margin-top: 1rem;">
                            <label for="form-data-delete-product" class="form-item-label">{{ _e('Delete products', 'scf-price') }}</label>
                            <label class="switch">
                                <input
                                    type="checkbox"
                                    class="form-switch"
                                    name="delete_empty"
                                    {% if deleteEmpty %}
                                        checked
                                    {% endif %}
                                />
                                <span class="slider round"></span>
                            </label>
                            <span class="form-item-description">{{ _e('Enabling this will remove all products marked with "xxx" after it, if this option is disabled it will set the product to private.') }}</span>
                        </div>
                        <div class="form-item" style="margin-top: 1rem;">
                            <label for="form-data-skip-trash" class="form-item-label">{{ _e('Skip trash', 'scf-price') }}</label>
                            <label class="switch">
                                <input
                                    type="checkbox"
                                    class="form-switch"
                                    name="skip_trash"
                                    {% if skipTrash %}
                                        checked
                                    {% endif %}
                                />
                                <span class="slider round"></span>
                            </label>
                            <span class="form-item-description">{{ _e('You can skip products from going to trash if this option is enabled. The products will be deleted permenantly.') }}</span>
                        </div>
                        <div class="form-item">
                            <label class="form-item-label">{{ _e('Price list file', 'scf-price') }}</label>
                            <label for="form-data-file" class="form-upload form-button">
                                <i class="fa fa-cloud-upload"></i> {{ _e('Upload File') }}
                            </label>
                            <input
                                type="file"
                                id="form-data-file"
                                class="form-upload"
                                name="price_file"
                                accept="text/csv"
                            />
                            <span id="form-data-file-response" class="form-item-description"></span>
                            <span class="form-item-description">{{ _e('CSV File that contains a list of prices', 'scf-price') }}</span>
                        </div>
                        <div class="form-item">
                            <button
                                    type="button"
                                    id="submit-update-prices"
                                    name="update_prices"
                                    class="form-button button-primary"
                            >
                                {{ _e('Update prices', 'scf-price') }}
                            </button>
                            <span id="form-data-response" class="form-item-description"></span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="column"></div>
    </div>
{% endblock %}