introduce service offering status
This commit is contained in:
parent
a4850683c9
commit
5eb40ffc4f
6 changed files with 65 additions and 6 deletions
|
@ -143,7 +143,7 @@ class PlanInline(admin.StackedInline):
|
|||
|
||||
@admin.register(ServiceOffering)
|
||||
class ServiceOfferingAdmin(admin.ModelAdmin):
|
||||
list_display = ("service", "cloud_provider")
|
||||
list_display = ("service", "cloud_provider", "status")
|
||||
list_filter = ("service", "cloud_provider")
|
||||
search_fields = ("service__name", "cloud_provider__name", "description")
|
||||
inlines = [PlanInline]
|
||||
|
|
26
hub/services/migrations/0003_serviceoffering_status.py
Normal file
26
hub/services/migrations/0003_serviceoffering_status.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
# Generated by Django 5.1.5 on 2025-01-31 15:45
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("services", "0002_lead_offering"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="serviceoffering",
|
||||
name="status",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("available", "Available"),
|
||||
("planned", "Planned"),
|
||||
("on_request", "On Request"),
|
||||
],
|
||||
default="available",
|
||||
max_length=20,
|
||||
),
|
||||
),
|
||||
]
|
|
@ -166,6 +166,15 @@ class ServiceOffering(models.Model):
|
|||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
STATUS_CHOICES = [
|
||||
("available", "Available"),
|
||||
("planned", "Planned"),
|
||||
("on_request", "On Request"),
|
||||
]
|
||||
status = models.CharField(
|
||||
max_length=20, choices=STATUS_CHOICES, default="available"
|
||||
)
|
||||
|
||||
class Meta:
|
||||
unique_together = ["service", "cloud_provider"]
|
||||
ordering = ["service__name", "cloud_provider__name"]
|
||||
|
|
|
@ -107,15 +107,16 @@
|
|||
<div class="mt-auto d-flex gap-2">
|
||||
<a href="{{ offering.get_absolute_url }}" class="btn btn-primary">View Details</a>
|
||||
{% if offering.plans.exists %}
|
||||
{% if offering.status == 'available' %}
|
||||
{% if offering.plans.count == 1 %}
|
||||
{% with plan=offering.plans.first %}
|
||||
<a href="{% url 'services:create_lead' offering.service.slug %}?offering={{ offering.id }}&plan={{ plan.id }}"
|
||||
class="btn btn-success">Show Interest</a>
|
||||
class="btn btn-success">Order</a>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-success dropdown-toggle" type="button" data-bs-toggle="dropdown">
|
||||
Show Interest
|
||||
Order
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{% for plan in offering.plans.all %}
|
||||
|
@ -130,9 +131,24 @@
|
|||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% elif offering.status == 'planned' %}
|
||||
<a href="{% url 'services:create_lead' offering.service.slug %}?offering={{ offering.id }}"
|
||||
class="btn btn-success">Show Interest</a>
|
||||
{% else %}
|
||||
<a href="{% url 'services:create_lead' offering.service.slug %}?offering={{ offering.id }}"
|
||||
class="btn btn-success">Request Information</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if offering.status == 'available' %}
|
||||
<a href="{% url 'services:create_lead' offering.service.slug %}?offering={{ offering.id }}"
|
||||
class="btn btn-success">Order</a>
|
||||
{% elif offering.status == 'planned' %}
|
||||
<a href="{% url 'services:create_lead' offering.service.slug %}?offering={{ offering.id }}"
|
||||
class="btn btn-success">Show Interest</a>
|
||||
{% else %}
|
||||
<a href="{% url 'services:create_lead' offering.service.slug %}?offering={{ offering.id }}"
|
||||
class="btn btn-success">Request Information</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -83,7 +83,15 @@
|
|||
{% endif %}
|
||||
|
||||
<a href="{% url 'services:create_lead' service.slug %}?offering={{ offering.id }}"
|
||||
class="btn btn-success">Show Interest</a>
|
||||
class="btn btn-success">
|
||||
{% if offering.status == 'available' %}
|
||||
Order
|
||||
{% elif offering.status == 'planned' %}
|
||||
Show Interest
|
||||
{% else %}
|
||||
Request Information
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
{% if service.offerings.exists %}
|
||||
<div class="dropdown d-inline-block">
|
||||
<button class="btn btn-success dropdown-toggle" type="button" data-bs-toggle="dropdown">
|
||||
Show Interest
|
||||
Order
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{% for offering in service.offerings.all %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue