service listing

This commit is contained in:
Tobias Brunner 2025-01-27 14:58:23 +01:00
parent ea44f6f54a
commit b367012d5c
No known key found for this signature in database
22 changed files with 615 additions and 7 deletions

View file

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Services Marketplace</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="{% url 'services:service_list' %}">Services Marketplace</a>
</div>
</nav>
<div class="container mt-4">
{% block content %}
{% endblock %}
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View file

@ -0,0 +1,40 @@
{% extends 'services/base.html' %}
{% block content %}
<div class="card">
<div class="card-body">
<h2 class="card-title">{{ service.name }}</h2>
<h6 class="card-subtitle mb-3 text-muted">{{ service.cloud_provider.name }}</h6>
<div class="row mb-4">
<div class="col-md-8">
<h5>Description</h5>
<p>{{ service.description }}</p>
<h5>Features</h5>
<p>{{ service.features|linebreaks }}</p>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">Service Details</h5>
<p><strong>Price:</strong> ${{ service.price }}</p>
<p><strong>Service Level:</strong> {{ service.service_level.name }}</p>
<p><strong>Response Time:</strong> {{ service.service_level.response_time }}</p>
<h6>Available Countries</h6>
<ul>
{% for country in service.countries.all %}
<li>{{ country.name }}</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
<a href="{% url 'services:service_list' %}" class="btn btn-secondary">Back to Services</a>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,89 @@
{% 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="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">
<h5 class="card-title">{{ service.name }}</h5>
<h6 class="card-subtitle mb-2 text-muted">{{ service.cloud_provider.name }}</h6>
<p class="card-text">{{ service.description|truncatewords:30 }}</p>
<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 %}