website/hub/services/templates/services/service_list.html

121 lines
No EOL
6.5 KiB
HTML

{% extends 'services/base.html' %}
{% block content %}
<div class="row">
<div class="col-md-3">
<div class="card">
<div class="card-body">
<h5 class="card-title">Filters</h5>
<form method="get">
<div class="mb-3">
<label for="search" class="form-label">Search</label>
<input type="text" class="form-control" id="search" name="search" value="{{ request.GET.search }}">
</div>
<div class="mb-3">
<label for="category" class="form-label">Category</label>
<select class="form-select" id="category" name="category">
<option value="">All Categories</option>
{% for category in categories %}
<option value="{{ category.id }}" {% if request.GET.category == category.id|stringformat:'i' %}selected{% endif %}>
{{ category.name }}
</option>
{% for subcategory in category.children.all %}
<option value="{{ subcategory.id }}" {% if request.GET.category == subcategory.id|stringformat:'i' %}selected{% endif %}>
&nbsp;&nbsp;&nbsp;{{ subcategory.name }}
</option>
{% endfor %}
{% endfor %}
</select>
</div>
<div class="mb-3">
<label for="cloud_provider" class="form-label">Cloud Provider</label>
<select class="form-select" id="cloud_provider" name="cloud_provider">
<option value="">All Providers</option>
{% for provider in cloud_providers %}
<option value="{{ provider.id }}" {% if request.GET.cloud_provider == provider.id|stringformat:'i' %}selected{% endif %}>
{{ provider.name }}
</option>
{% endfor %}
</select>
</div>
<div class="mb-3">
<label for="country" class="form-label">Country</label>
<select class="form-select" id="country" name="country">
<option value="">All Countries</option>
{% for country in countries %}
<option value="{{ country.id }}" {% if request.GET.country == country.id|stringformat:'i' %}selected{% endif %}>
{{ country.name }}
</option>
{% endfor %}
</select>
</div>
<div class="mb-3">
<label for="service_level" class="form-label">Service Level</label>
<select class="form-select" id="service_level" name="service_level">
<option value="">All Levels</option>
{% for level in service_levels %}
<option value="{{ level.id }}" {% if request.GET.service_level == level.id|stringformat:'i' %}selected{% endif %}>
{{ level.name }}
</option>
{% endfor %}
</select>
</div>
<button type="submit" class="btn btn-primary">Apply Filters</button>
<a href="{% url 'services:service_list' %}" class="btn btn-secondary">Clear</a>
</form>
</div>
</div>
</div>
<div class="col-md-9">
<div class="row row-cols-1 row-cols-md-2 g-4">
{% for service in services %}
<div class="col">
<div class="card h-100">
<div class="card-body">
<div class="d-flex align-items-center mb-3">
{% if service.logo %}
<img src="{{ service.logo.url }}" alt="{{ service.name }} logo" class="me-3" style="max-height: 50px; max-width: 100px; object-fit: contain;">
{% endif %}
<div>
<h5 class="card-title mb-0">{{ service.name }}</h5>
<div class="d-flex align-items-center mt-2">
{% if service.cloud_provider.logo %}
<img src="{{ service.cloud_provider.logo.url }}" alt="{{ service.cloud_provider.name }} logo" class="me-2" style="max-height: 25px; max-width: 50px; object-fit: contain;">
{% endif %}
<h6 class="card-subtitle text-muted mb-0">{{ service.cloud_provider.name }}</h6>
</div>
</div>
</div>
<p class="card-text">{{ service.description|safe|truncatewords:30 }}</p>
<div class="mb-2">
{% for category in service.categories.all %}
<span class="badge bg-secondary me-1">{{ category.full_path }}</span>
{% endfor %}
</div>
<p class="card-text">
<small class="text-muted">
Service Level: {{ service.service_level.name }}<br>
Price: ${{ service.price }}
</small>
</p>
<a href="{% url 'services:service_detail' service.pk %}" class="btn btn-primary">View Details</a>
</div>
</div>
</div>
{% empty %}
<div class="col">
<div class="alert alert-info">
No services found matching your criteria.
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endblock %}