<?php

use Bookingor\Helper\HelperControl;
use Bookingor\Frontend\Controller\Service\ServiceControlFront;
use Bookingor\Frontend\Controller\Location\LocationControlFront;
// Exit if accessed directly
if (! defined('ABSPATH')) exit; ?>
<div id="selectService-6" class="select-list-1">
    <ul class="main-carousel all-services-shw row">
        <?php if (ServiceControlFront::check_wc_id_empty_db()) { ?>
            <div class="bookingor-alert-woocommerce">
                <div>
                    <?php esc_html_e('Connect WooCommerce to Bookingor Services', 'bookingor') ?>
                </div>
                <a href="https://youtu.be/20S6_k1g_gA" class="bookingor-btn" target="_blank">
                    <?php esc_html_e('checkout video', 'bookingor'); ?>
                </a>
            </div>
            <?php } else {

            foreach (ServiceControlFront::bp_front_services_view() as $key =>  $data) {   ?>
                <li data-get-location-id="<?php echo esc_attr($data['location_get_id']); ?>" data-get-category-id="<?php echo esc_attr($data['category_get_id']); ?>" <?php echo esc_attr(isset($data['subcategories']) ? 'data-subcategory-id="' . $data['subcategories'] . '"' : ''); ?> data-repeat-status="<?php echo esc_attr($data['recurring_status']); ?>" data-repeat-type="<?php echo esc_attr($data['recurring_type']); ?>" data-service-id="<?php echo esc_attr($data['service_id']); ?>" data-get-service-price="<?php echo esc_attr($data['service_cost']); ?>" data-get-duration="<?php echo esc_attr($data['service_duration']); ?>" class="full-service-2 bookingor-full-services get_all_data select_list service-list-view">
                    <?php if (get_option("bookingor_settings_service_images_icons") === "bookingor-service-images-show") {
                    ?>
                        <div class="service-card-contents">
                            <div class="service-heading-1"><?php echo esc_html($data['service_name']); ?></div>
                            <?php if (get_option('bookingor_settings_service_description_show') === 'on') { ?>
                                <div class="bookingor-f-content bookingor-line-h"><?php echo esc_html($data['service_description']); ?></div>
                            <?php } ?>
                        </div>
                        <div class="list-f-srvs w-100">
                            <div class="serv-detal  w-100">
                                <div class="service-duration mb-1">
                                    <div class="bookingor-d-flex gap-1 ">
                                        <div class="bookingor-d-flex"><svg xmlns="http://www.w3.org/2000/svg" class="bookingor-icon-duration" viewBox="0 0 24 24" fill="currentColor">
                                                <path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 12H17V14H11V7H13V12Z"></path>
                                            </svg></div>
                                        <div class="bookingor-f-15"><?php echo  esc_attr(HelperControl::convert_duration($data['service_duration'])); ?></div>
                                    </div>
                                </div>
                                <?php if (get_option('bookingor_settings_location_active') === 'on') { ?>
                                    <div class="service-location mb-1">
                                        <div class="bookingor-d-flex gap-1 align-items-start">
                                            <div class="bookingor-d-flex pt-1">
                                                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="bookingor-icon-location" fill="currentColor">
                                                    <path d="M12 20.8995L16.9497 15.9497C19.6834 13.2161 19.6834 8.78392 16.9497 6.05025C14.2161 3.31658 9.78392 3.31658 7.05025 6.05025C4.31658 8.78392 4.31658 13.2161 7.05025 15.9497L12 20.8995ZM12 23.7279L5.63604 17.364C2.12132 13.8492 2.12132 8.15076 5.63604 4.63604C9.15076 1.12132 14.8492 1.12132 18.364 4.63604C21.8787 8.15076 21.8787 13.8492 18.364 17.364L12 23.7279ZM12 13C13.1046 13 14 12.1046 14 11C14 9.89543 13.1046 9 12 9C10.8954 9 10 9.89543 10 11C10 12.1046 10.8954 13 12 13ZM12 15C9.79086 15 8 13.2091 8 11C8 8.79086 9.79086 7 12 7C14.2091 7 16 8.79086 16 11C16 13.2091 14.2091 15 12 15Z"></path>
                                                </svg>
                                            </div>
                                            <div class="bookingor-f-12 bookingor-f-location-address"><?php echo esc_html($data['location_address']); ?></div>
                                        </div>
                                    </div>
                                <?php } ?>
                                <div class="service-price">
                                    <div class="bokingor-f-cost <?php echo esc_attr(get_option('bookingor_currency_position_change')); ?> bookingor-flex">
                                        <div class="<?php echo esc_attr(get_option('bookingor_currency_position_change')); ?>">
                                            <?php echo esc_html($data['currency_symbol']); ?>

                                        </div>
                                        <div><?php echo esc_html(HelperControl::priceDecimal($data['price'])); ?></div>
                                    </div>
                                </div>
                            </div>
                            <div class="f-service-image <?php echo esc_attr(get_option('bookingor_settings_service_images_icons')); ?>">
                                <img class="serv-icon" src="<?php echo esc_attr($data['service_icon'] ? wp_get_attachment_url($data['service_icon']) : $this->f_image_default); ?>" alt="" />
                            </div>

                        </div>
                    <?php } else { ?>

                        <div class="list-f-srvs">
                            <div class="serv-detal bookingor-d-flex w-100">
                                <div class="service-card-contents">
                                    <div class="service-heading-1"><?php echo esc_html($data['name']); ?></div>
                                    <?php if (get_option('bookingor_settings_service_description_show') === 'on') { ?>
                                        <div class="bookingor-f-content bookingor-line-h"><?php echo esc_html($data['service_description']); ?></div>
                                    <?php } ?>
                                </div>
                                <div class="service-duration mb-1">
                                    <div class="bookingor-d-flex gap-1 ">
                                        <div class="bookingor-d-flex"><svg xmlns="http://www.w3.org/2000/svg" class="bookingor-icon-duration" viewBox="0 0 24 24" fill="currentColor">
                                                <path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM13 12H17V14H11V7H13V12Z"></path>
                                            </svg></div>
                                        <div class="bookingor-f-15"><?php echo  esc_attr(HelperControl::convert_duration($data['service_duration'])); ?></div>
                                    </div>
                                </div>
                                <?php if (get_option('bookingor_settings_location_active') === 'on') { ?>
                                    <div class="service-location mb-1">
                                        <div class="bookingor-d-flex gap-1 align-items-start">
                                            <div class="bookingor-d-flex pt-1">
                                                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="bookingor-icon-location" fill="currentColor">
                                                    <path d="M12 20.8995L16.9497 15.9497C19.6834 13.2161 19.6834 8.78392 16.9497 6.05025C14.2161 3.31658 9.78392 3.31658 7.05025 6.05025C4.31658 8.78392 4.31658 13.2161 7.05025 15.9497L12 20.8995ZM12 23.7279L5.63604 17.364C2.12132 13.8492 2.12132 8.15076 5.63604 4.63604C9.15076 1.12132 14.8492 1.12132 18.364 4.63604C21.8787 8.15076 21.8787 13.8492 18.364 17.364L12 23.7279ZM12 13C13.1046 13 14 12.1046 14 11C14 9.89543 13.1046 9 12 9C10.8954 9 10 9.89543 10 11C10 12.1046 10.8954 13 12 13ZM12 15C9.79086 15 8 13.2091 8 11C8 8.79086 9.79086 7 12 7C14.2091 7 16 8.79086 16 11C16 13.2091 14.2091 15 12 15Z"></path>
                                                </svg>
                                            </div>
                                            <div class="bookingor-f-12 bookingor-f-location-address"><?php echo esc_html($data['location_address']); ?></div>
                                        </div>
                                    </div>
                                <?php } ?>
                                <div class="service-price">
                                    <div class="bokingor-f-cost <?php echo esc_attr(get_option('bookingor_currency_position_change')); ?> bookingor-flex">
                                        <div class="<?php echo esc_attr(get_option('bookingor_currency_position_change')); ?>">
                                            <?php echo esc_html($data['currency_symbol']); ?>

                                        </div>
                                        <div><?php echo esc_html(HelperControl::priceDecimal($data['price'])); ?></div>
                                    </div>
                                </div>
                            </div>
                            <div class="f-service-image <?php echo esc_attr(get_option('bookingor_settings_service_images_icons')); ?>">
                                <img class="serv-icon" src="<?php echo esc_attr($data['service_icon'] ? wp_get_attachment_url($data['service_icon']) : $this->f_image_default); ?>" alt="" />
                            </div>
                        </div>
                    <?php  } ?>
                </li>
        <?php }
        } ?>
    </ul>
</div>