<script src="<?= asset_url('assets/js/backend_locations_helper.js') ?>"></script>
<script src="<?= asset_url('assets/js/backend_categories_helper.js') ?>"></script>
<script src="<?= asset_url('assets/js/backend_locations.js') ?>"></script>
<script>
    var GlobalVariables = {
        csrfToken: <?= json_encode($this->security->get_csrf_hash()) ?>,
        baseUrl: <?= json_encode($base_url) ?>,
        dateFormat: <?= json_encode($date_format) ?>,
        timeFormat: <?= json_encode($time_format) ?>,
        services: <?= json_encode($services) ?>,
        categories: <?= json_encode($categories) ?>,
        timezones: <?= json_encode($timezones) ?>,
        user: {
            id: <?= $user_id ?>,
            email: <?= json_encode($user_email) ?>,
            timezone: <?= json_encode($timezone) ?>,
            role_slug: <?= json_encode($role_slug) ?>,
            privileges: <?= json_encode($privileges) ?>
        }
    };

    $(function () {
        BackendServices.initialize(true);
    });
</script>

<div class="container-fluid backend-page" id="services-page">

    <div class="tab-content">

        <!-- SERVICES TAB -->

        <div class="tab-pane active" id="services">
            <div class="row">
                <div id="filter-services" class="filter-records col col-12 col-md-5">
                    <form class="mb-4">
                        <div class="input-group">
                            <input type="text" class="key form-control">

                            <div class="input-group-addon">
                                <div>
                                    <button class="filter btn btn-outline-secondary" type="submit"
                                            data-tippy-content="<?= lang('filter') ?>">
                                        <i class="fas fa-search"></i>
                                    </button>
                                    <button class="clear btn btn-outline-secondary" type="button"
                                            data-tippy-content="<?= lang('clear') ?>">
                                        <i class="fas fa-redo-alt"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </form>

                    <h3><?= lang('locations') ?></h3>
                    <div class="results"></div>
                </div>

                <div class="record-details column col-12 col-md-5">
                    <div class="btn-toolbar mb-4">
                        <div class="add-edit-delete-group btn-group">
                            <button id="add-service" class="btn btn-primary">
                                <i class="fas fa-plus-square mr-2"></i>
                                <?= lang('add') ?>
                            </button>
                            <button id="edit-service" class="btn btn-outline-secondary" disabled="disabled">
                                <i class="fas fa-edit mr-2"></i>
                                <?= lang('edit') ?>
                            </button>
                            <button id="delete-service" class="btn btn-outline-secondary" disabled="disabled">
                                <i class="fas fa-trash-alt mr-2"></i>
                                <?= lang('delete') ?>
                            </button>
                        </div>

                        <div class="save-cancel-group btn-group" style="display:none;">
                            <button id="save-service" class="btn btn-primary">
                                <i class="fas fa-check-square mr-2"></i>
                                <?= lang('save') ?>
                            </button>
                            <button id="cancel-service" class="btn btn-outline-secondary">
                                <i class="fas fa-ban mr-2"></i>
                                <?= lang('cancel') ?>
                            </button>
                        </div>
                    </div>

                    <h3><?= lang('details') ?></h3>

                    <div class="form-message alert" style="display:none;"></div>

                    <input type="hidden" id="location-id">

                    <div class="form-group">
                        <label for="location-name">
                            Name
                            <span class="text-danger">*</span>
                        </label>
                        <input id="location-name" class="form-control required">
                    </div>

                    <div class="form-group">
                        <label for="location-contact">
                            Contact Name
                            <span class="text-danger">*</span>
                        </label>
                        <input id="location-contact" class="form-control required">
                    </div>

                    <div class="form-group">
                        <label for="location-email">
                            Email
                            <span class="text-danger">*</span>
                        </label>
                        <input id="location-email" class="form-control required">
                    </div>

                    <div class="form-group">
                        <label for="location-phone">
                            Phone
							<span class="text-danger">*</span>
                        </label>
                        <input id="location-phone" class="form-control required">
                    </div>

                    <div class="form-group">
                        <label for="location-address">
                            Address
							<span class="text-danger">*</span>
                        </label>
                        <input id="location-address" class="form-control required">
                    </div>

                    <div class="form-group">
                        <label for="location-city">
                            City
                            <span class="text-danger">*</span>
                        </label>
                        <input id="location-city" class="form-control required">
                    </div>

                    <div class="form-group">
                        <label for="location-state">
                            State
							<span class="text-danger">*</span>
                        </label>
                        <input id="location-state" class="form-control required">
                    </div>

                    <div class="form-group">
                        <label for="location-zip">
                            ZIP
							<span class="text-danger">*</span>
                        </label>
                        <input id="location-zip" class="form-control required">
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
