{% include 'header.twig' %}

<style>.body .form-control{width:0%;}.body a:focus {color: #fff;}.dropdown-menu {position: absolute;top: 100%;left: 0;z-index: 1000;display: none;float: left;min-width: 10rem;padding: 0;margin: .125rem 0 0;font-size: 1rem;color: #212529;text-align: left;list-style: none;background-color: #ffffff;margin-top:5px;border-radius:10px;max-height:380px;overflow-y:auto;max-width: 100%;min-width: 100%;border: 1.5px solid #ffffff82;box-shadow: 0 12px 24px 12px rgba(0, 0, 0,0.2);}.dropdown-item {display: block;width: 100%;padding: 0.3rem 0.7rem;clear: both;font-weight: 400;color: #212529;white-space: normal;background-color: transparent;border: 0;}.dropdown-menu a{color: #212529;}.dropdown-menu a:hover{color: #fff;}.dropdown-item:hover{background: #2cc9fd;color: #fff;}@media (min-width: 768px) {.dropdown-menu {max-width:900px;min-width:350px;}}.super-lud {transform: none;will-change: auto;}</style>
<style>
/* Divider Style */
.header-divider {
    width: 100%;
    height: 20px; /* Adjust height as needed */
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDBweCIgdmlld0JveD0iMCAwIDEyODAgMTQwIiBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogICAgICAgICAgICAgIDxnIGZpbGw9IiNmZmZmZmYiPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTg1My44OTMsODYuOTk4Yy0zOC44NTksMC01OC44MTEtMTYuNDU1LTc3Ljk1Ni0zNS4wNTFjMTguMjk1LTEwLjUzNiw0MC44OTEtMTguMjc2LDczLjM3OC0xOC4yNzYgYzM4LjY4NSwwLDY0LjEzMiwxMi41NjQsODUuNDg5LDI4LjM0N0M5MTYuMTkyLDcyLjAxMiw5MDAuOCw4Ni45OTgsODUzLjg5Myw4Ni45OTh6IE01MjYuMjY1LDgwLjk0NSBjLTYuNTE3LTAuNTYyLTEzLjU5OS0wLjg3OS0yMS40MS0wLjg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ICAgICA8L3N2Zz4='); /* Replace with the actual URL */
    background-size: cover;
    background-position: center;
    
}
/* Header divider */
.header-divider{
 height:37px !important;
 transform: rotateX(180deg);
 
}

/* Divider top */
#block_334 .services-list .bg{
 padding-top:20px !important;
}
/* Import Google Fonts */
{{ settings.user_font_import|raw }}

/* Division */
#block_334 .services-list .bg{
 font-family: '{{ settings.user_font }}', {{ settings.user_font_type }}  ;

}

/* Card */
.services-list .services_filters .card{
 font-family: '{{ settings.user_font }}', {{ settings.user_font_type }}  ;
}

/* Col */
.services-list .container > .row > .col{
 font-family: '{{ settings.user_font }}', {{ settings.user_font_type }}  ;
 padding-top:20px;
}

.table-bg tr .nowrap{
 text-transform:capitalize;
}

/* Division */
.wrapper-content .wrapper-content__body #block_334 .services-list .bg{
 padding-top:0px !important;
}
.body .modal .modal-content{
 font-family: '{{ settings.user_font }}', {{ settings.user_font_type }}  ;
}
.body h5 {
 font-family: '{{ settings.user_font }}', {{ settings.user_font_type }}  ;
}
{% if user['auth'] == 1 %}
/* Import Google Fonts */
{{ settings.user_font_import|raw }}

/* Wrapper content */
.wrapper-sidebar-navbar .wrapper-content{
 margin-top:20px;
 font-family: '{{ settings.user_font }}', {{ settings.user_font_type }}  ;
}

{% endif %}
{% if user['auth'] == 0 %}

/* Wrapper content  body */
.wrapper-content__body{
 margin-top:-15px;
}




{% endif %}


</style>
<div class="wrapper-content">
	<div class="wrapper-content__header"></div>
	<div
		class="wrapper-content__body">


			


		<!-- Main variables *content* -->
		{% if user["auth"] != 1 %}
			<div id="block_334">

				<div class="services-list ">
					<div class="bg"></div>
					<div class="divider-top"></div>
					<div class="divider-bottom"></div>
					<div class="container">
						<div class="row">
							<div class="col">
<div class="services_filters services_filter-margin component_filter_button component_filter_form_group component_filter_card">
<div class="card">
<div class="row">
<div class="col-md-auto mb-3 mb-md-0">
<div class="dropdown">
<a class="btn filter-primary w-sm-auto w-100 dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="fas fa-filter"></span>
<span class="services-filter__active-category" data-filter-active-category="true"></span>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">

<a class="dropdown-item" data-filter-category-id="All">All</a>
{% for category in serviceCategory %}
<a class="dropdown-item" data-filter-category-id="{{ category["category_id"] }}" data-filter-category-name="{{ category["category_name"] }}">{{ category["category_name"] }}</a>
{% endfor %}
</div>
</div>
</div>

{% if user['auth'] == 0 %}

<br>

<div class="col-md-auto mb-3 mb-md-0">
<div class="component_filter_currency_button">
<div class="dropdown dropdown-currency">
<a class="btn filter-primary w-sm-auto w-100 dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="services-filter__active-currency">{{site_base_currency}}</span>
</a>
<div class="dropdown-menu w-100" id="curr_anchor">
<a class="dropdown-item" href="/services">{{site_base_currency}}{{" "}}{{ site_base_currency_symbol}}</a>
{{ without_login_currencies_item }}

</div>
</div>
</div></div>
<br>
{% endif %}


<div class="col">
												<div class="input-group">
													<input type="text" class="form-control" data-search-service="#service-table-21">
													<span class="input-group-append component_button_search">
														<button class="btn btn-secondary" type="button" data-filter-serch-btn="true">
															<i class="fas fa-search"></i>
														</button>
													</span>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>

						<div class="row">
							<div class="col">
								<div class="services-list__table">
									<div class="table-bg component_table" id="service-table-21">
										{% for category in serviceCategory %}
											<div class="table-wr table-responsive mb-3" data-filter-table-wrapper="{{ category["category_id"] }}">
												<table class="table">
													<thead>
														<tr>
														    {% if settings["fav_services"] == 1 %}
                                         <th class="nowrap"></th>
                                         {% endif %}
															<th>ID</th>
															<th class="nowrap">Service</th>
															<th class="nowrap">Rate per 1000</th>
															<th class="nowrap">Min order</th>
															<th class="nowrap">Max order</th>
															
		<th class="nowrap" nowrap>
                                                <div class="d-flex align-items-center">
                                                    <span>Average Time</span>
                                                    <span class="ml-1 mr-1 fa fa-exclamation-circle" data-toggle="tooltip" data-placement="top" title="The average time is based on 10 latest completed orders per 1000 quantity."></span>
                                                </div>
                                            </th>									
															<th class="hidden-xs hidden-sm service-description__th">Description</th>
														</tr>
													</thead>
													<thead>
														<th colspan="{% if settings['fav_services'] == 1 %}8{% else %}7{% endif %}" class="styles-services-default services-category">
															{{ category["category_name"] }}
														</th>
														
													</thead>
													<tbody>
														{% for service in category['services'] %}
															<tr data-filter-table-category-id="{{ category["category_id"] }}">
															{% if settings["fav_services"] == 1 %}
<td>
  <i class="favorite-toggle {% if service.is_fav %}fas text-warning{% else %}far text-muted{% endif %} fa-star"
     data-service-id="{{ service.service_id }}"
     style="cursor:pointer;"
     data-fav-status="{% if service.is_fav %}1{% else %}0{% endif %}"></i>
</td>

<script>
$(document).on("click", ".favorite-toggle", function () {
    {% if user["auth"] == "1" %}
    const icon = $(this);
    const serviceId = icon.data("service-id");

    // Prevent rapid multiple clicks
    if (icon.prop("disabled")) return;
    icon.prop('disabled', true);

    $.ajax({
        url: '/ajax_data',
        type: 'POST',
        data: {
            action: 'toggle_favorite',
            service_id: serviceId
        },
        success: function(response) {
            let json;
            try {
                json = JSON.parse(response);
            } catch (e) {
                console.error("Invalid JSON:", response);
                return;
            }

            if (!json.error) {
                if (json.status === "added") {
                    icon.removeClass("far text-muted").addClass("fas text-warning");
                } else {
                    icon.removeClass("fas text-warning").addClass("far text-muted");
                }
            }

            icon.prop('disabled', false);
        },
        error: function() {
            icon.prop('disabled', false);
        }
    });
    
    {% endif %}
});
</script>
{% endif %}
																<td data-label="ID" data-filter-table-service-id="{{ service["service_id"] }}">{{ service["service_id"] }}</td>
																<td data-label="Service" class="table-service" data-filter-table-service-name="true">{{ service["service_name"] }}</td>

																<td data-label="Rate per 1000">
{% if user["auth"] == "1" %} 
{{service["service_price"]}}
{% else %}
{{service["without_login_service_price"]}}
{% endif %}             


																</td>
																<td data-label="Min Order">{{ service["service_min"] }}</td>
																<td data-label="Max Order">{{ service["service_max"] }}</td>
															
                                        <td data-label="Average Time">{{ service["time"] }}</td>
										
																<td>
																	{% if service["service_description"] %}
																		<!-- Modal -->
																		<div class="modal fade" id="servis{{ service["service_id"] }}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
																			<div class="modal-dialog modal-dialog-centered" role="document">
																				<div class="modal-content">
																					<div class="modal-header">
																						<h5 class="modal-title" id="exampleModalLabel">{{ service["service_name"] }}
																						</h5>
																						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
																							<span aria-hidden="true">×</span>
																						</button>
																					</div>
																					<div class="modal-body text-left">
																						<p class="detail-data details-split-959">
																							{{ service["service_description"] }}</p>
																					</div>
																					<div class="modal-footer">
																						<button type="button" class="btn btn-actions" data-dismiss="modal">Close</button>
																					</div>
																				</div>
																			</div>
																		</div>
																		<a href="javascript:void(0)" class="btn btn-actions " data-toggle="modal" data-target="#servis{{ service["service_id"] }}">
																			View
																		</a>
																	{% endif %}
																</td>
															</tr>
														{% endfor %}
													</tbody>
												</table>
											</div>
										{% endfor %}


									</div>
								</div>
							</div>
						</div>
					</div>
				</div>


			</div>


		</div>
		<div class="wrapper-content__footer"></div>
	</div>
</div>{%  else %}


<!-- Main variables *content* -->
<div id="block_334">
	<div class="services-list ">
		<div class="bg"></div>
		<div class="divider-top"></div>
		<div class="divider-bottom"></div>
		<div class="container-fluid">
			<div class="row">
				<div class="col">
					<div class="services_filters services_filter-margin component_filter_button component_filter_form_group component_filter_card">
						{% if contentText %}
<div class="card mt-2 mb-3">
{{ contentText }}
</div>
{% endif %}<div class="card">
							<div class="row">
								<div class="col-md-auto mb-3 mb-md-0">
									<div class="dropdown">
										<a class="btn filter-primary w-sm-auto w-100 dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
											<span class="fas fa-filter"></span>
											<span class="services-filter__active-category" data-filter-active-category="true"></span>
										</a>
										<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
											<a class="dropdown-item" data-filter-category-id="All">All</a>

											{% for category in serviceCategory %}
												<a class="dropdown-item" data-filter-category-id="{{ category["category_id"] }}" data-filter-category-name="{{ category["category_name"] }}">{{ category["category_name"] }}</a>
											{% endfor %}
										</div>
									</div>
								</div>
								<div class="col">
									<div class="input-group">
										<input type="text" class="form-control" data-search-service="#service-table-334">
										<span class="input-group-append component_button_search">
											<button class="btn btn-secondary" type="button" data-filter-serch-btn="true">
												<i class="fas fa-search"></i>
											</button>
										</span>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col">
					<div class="services-list__table">
						<div class="table-bg component_table " id="service-table-334">
							<div class="table-wr table-responsive mb-3 " data-filter-table-wrapper="{{ category["category_id"] }}">
								{% for category in serviceCategory %}
									<div class="table-wr table-responsive mb-3" data-filter-table-wrapper="{{ category["category_id"] }}">
										<table class="table">
											<thead>
												<tr>
												    {% if settings["fav_services"] == 1 %}
                                         <th></th>
                                         {% endif %}
                                         
													<th>ID</th>
													<th class="nowrap">Service</th>
													<th class="nowrap">Rate Per 1000</th>
													<th class="nowrap">Min Order</th>
													<th class="nowrap">Max Order</th>
													
                                       <th class="nowrap" nowrap>
                                                <div class="d-flex align-items-center">
                                                    <span>Average Time</span>
                                                    <span class="ml-1 mr-1 fa fa-exclamation-circle" data-toggle="tooltip" data-placement="top" title="The average time is based on 10 latest completed orders per 1000 quantity."></span>
                                                </div>
                                            </th>	
										
													<th class="hidden-xs hidden-sm service-description__th">Description</th>
												</tr>
											</thead>
											<thead>
												<th colspan="{% if settings['fav_services'] == 1 %}8{% else %}7{% endif %}" class="styles-services-default services-category">
													{{ category["category_name"] }}
												</th>
											</thead>
											<tbody>
												{% for service in category['services'] %}
													<tr data-filter-table-category-id="{{ category["category_id"] }}">
													    {% if settings["fav_services"] == 1 %}
<td>
  <i class="favorite-toggle {% if service.is_fav %}fas text-warning{% else %}far text-muted{% endif %} fa-star"
     data-service-id="{{ service.service_id }}"
     style="cursor:pointer;"
     data-fav-status="{% if service.is_fav %}1{% else %}0{% endif %}"></i>
</td>

<script>
$(document).on("click", ".favorite-toggle", function () {
    {% if user["auth"] == "1" %}
    const icon = $(this);
    const serviceId = icon.data("service-id");

    // Prevent rapid multiple clicks
    if (icon.prop("disabled")) return;
    icon.prop('disabled', true);

    $.ajax({
        url: '/ajax_data',
        type: 'POST',
        data: {
            action: 'toggle_favorite',
            service_id: serviceId
        },
        success: function(response) {
            let json;
            try {
                json = JSON.parse(response);
            } catch (e) {
                console.error("Invalid JSON:", response);
                return;
            }

            if (!json.error) {
                if (json.status === "added") {
                    icon.removeClass("far text-muted").addClass("fas text-warning");
                } else {
                    icon.removeClass("fas text-warning").addClass("far text-muted");
                }
            }

            icon.prop('disabled', false);
        },
        error: function() {
            icon.prop('disabled', false);
        }
    });
    
    {% endif %}
});
</script>
{% endif %}
														<td data-label="ID" data-filter-table-service-id="{{ service["service_id"] }}">{{ service["service_id"] }}</td>
														<td data-label="Service" class="table-service" data-filter-table-service-name="true">{{ service["service_name"] }}</td>

														<td data-label="Rate per 1000">
																                       {{ service["service_price"] }}              


																</td>
														<td data-label="Min order">{{ service["service_min"] }}</td>
														<td data-label="Max order">{{ service["service_max"] }}</td>
													
                                        <td data-label="Average Time">{{ service["time"] }}</td>
										
														<td>
															{% if service["service_description"] %}
																<!-- Modal -->
																<div class="modal fade" id="servis{{ service["service_id"] }}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
																	<div class="modal-dialog modal-dialog-centered" role="document">
																		<div class="modal-content">
																			<div class="modal-header">
																				<h5 class="modal-title" id="exampleModalLabel">{{ service["service_name"] }}
																				</h5>
																				<button type="button" class="close" data-dismiss="modal" aria-label="Close">
																					<span aria-hidden="true">×</span>
																				</button>
																			</div>
																			<div class="modal-body text-left">
																				<p class="detail-data details-split-959">
																					{{ service["service_description"] }}</p>
																			</div>
																			<div class="modal-footer">
																				<button type="button" class="btn btn-actions" data-dismiss="modal">Close</button>
																			</div>
																		</div>
																	</div>
																</div>
																<a href="javascript:void(0)" class="btn btn-actions " data-toggle="modal" data-target="#servis{{ service["service_id"] }}">
																	View
																</a>
															{% endif %}
														</td>
													</tr>
												{% endfor %}
											</tbody>
										</table>
									</div>
								{% endfor %}

							</div>

						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<div class="modal fade " tabindex="-1" role="dialog" id="service-description-334">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-body">
					<button class="close" type="button" data-dismiss="modal" aria-label="Close">
						<i style="color: #b4c6d3;" class="fas fa-times"></i>
					</button>
					<div class="service-description-content"></div>
				</div>
			</div>
		</div>
	</div>
</div></div>{%  endif %}{% include 'new-footer.twig' %}
