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)
|
@admin.register(ServiceOffering)
|
||||||
class ServiceOfferingAdmin(admin.ModelAdmin):
|
class ServiceOfferingAdmin(admin.ModelAdmin):
|
||||||
list_display = ("service", "cloud_provider")
|
list_display = ("service", "cloud_provider", "status")
|
||||||
list_filter = ("service", "cloud_provider")
|
list_filter = ("service", "cloud_provider")
|
||||||
search_fields = ("service__name", "cloud_provider__name", "description")
|
search_fields = ("service__name", "cloud_provider__name", "description")
|
||||||
inlines = [PlanInline]
|
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)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
updated_at = models.DateTimeField(auto_now=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:
|
class Meta:
|
||||||
unique_together = ["service", "cloud_provider"]
|
unique_together = ["service", "cloud_provider"]
|
||||||
ordering = ["service__name", "cloud_provider__name"]
|
ordering = ["service__name", "cloud_provider__name"]
|
||||||
|
|
|
@ -107,15 +107,16 @@
|
||||||
<div class="mt-auto d-flex gap-2">
|
<div class="mt-auto d-flex gap-2">
|
||||||
<a href="{{ offering.get_absolute_url }}" class="btn btn-primary">View Details</a>
|
<a href="{{ offering.get_absolute_url }}" class="btn btn-primary">View Details</a>
|
||||||
{% if offering.plans.exists %}
|
{% if offering.plans.exists %}
|
||||||
|
{% if offering.status == 'available' %}
|
||||||
{% if offering.plans.count == 1 %}
|
{% if offering.plans.count == 1 %}
|
||||||
{% with plan=offering.plans.first %}
|
{% with plan=offering.plans.first %}
|
||||||
<a href="{% url 'services:create_lead' offering.service.slug %}?offering={{ offering.id }}&plan={{ plan.id }}"
|
<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 %}
|
{% endwith %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button class="btn btn-success dropdown-toggle" type="button" data-bs-toggle="dropdown">
|
<button class="btn btn-success dropdown-toggle" type="button" data-bs-toggle="dropdown">
|
||||||
Show Interest
|
Order
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
{% for plan in offering.plans.all %}
|
{% for plan in offering.plans.all %}
|
||||||
|
@ -130,10 +131,25 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% elif offering.status == 'planned' %}
|
||||||
<a href="{% url 'services:create_lead' offering.service.slug %}?offering={{ offering.id }}"
|
<a href="{% url 'services:create_lead' offering.service.slug %}?offering={{ offering.id }}"
|
||||||
class="btn btn-success">Show Interest</a>
|
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 %}
|
||||||
|
{% 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>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -83,7 +83,15 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<a href="{% url 'services:create_lead' service.slug %}?offering={{ offering.id }}"
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
{% if service.offerings.exists %}
|
{% if service.offerings.exists %}
|
||||||
<div class="dropdown d-inline-block">
|
<div class="dropdown d-inline-block">
|
||||||
<button class="btn btn-success dropdown-toggle" type="button" data-bs-toggle="dropdown">
|
<button class="btn btn-success dropdown-toggle" type="button" data-bs-toggle="dropdown">
|
||||||
Show Interest
|
Order
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
{% for offering in service.offerings.all %}
|
{% for offering in service.offerings.all %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue