emile 12 months ago
parent 33a8689592
commit 2d2f3f7694

@ -95,6 +95,13 @@ class Invoice(models.Model):
pdf = models.FileField(upload_to='generated_invoices', null=True, blank=True)
def __str__(self):
return self.invoice_number
@property
def status(self):
payments = OrderPayment.objects.filter(order=self.order)
if all(payment.date_paid for payment in payments):
return "Completed"
else:
return "Not Completed"
def save(self, *args, **kwargs):
if not self.invoice_number:
current_year = str(timezone.now().year)[-2:]

@ -46,7 +46,12 @@
</td>
<td class="px-6 py-4 text-center text-sm border-r border-gray-300">
<p class="text-secondosiblue">{{invoice.order.due_date}}</p>
<p class="text-secondosiblue">
{% if invoice.order.orderpayment_set.all.last.date_due %}
{{invoice.order.orderpayment_set.all.last.date_due}}
{% else %}
-
{% endif %}</p>
</td>
<td class="px-6 py-4 text-center text-sm border-r border-gray-300">
@ -59,8 +64,8 @@
</div>
</td>
<td class="px-6 py-4 text-center text-sm border-r border-gray-300 {% if invoice.order.status == 'Pending' %}bg-yellow-500{% endif %} {% if invoice.order.status == 'Completed' %}bg-green-700{% endif %}">
<p class="text-white">{{invoice.order.status}}</p>
<td class="px-6 py-4 text-center text-sm border-r border-gray-300 {% if invoice.status == 'Not Completed' %}bg-red-500{% elif invoice.status == 'Completed' %}bg-green-700{% endif %}">
<p class="text-white">{{invoice.status}}</p>
</td>
<td class="px-6 py-4 text-center text-sm border-r border-gray-300">
@ -81,12 +86,19 @@
</button>
</a>
{% if invoice.status == 'Not Completed' %}
<a href="{% url 'customerorderdetails' invoice.order.id %}">
<button
class="flex justify-center items-center gap-2 px-3 py-1 rounded-md bg-osiblue text-white border border-osiblue cursor-pointer hover:bg-white hover:text-osiblue duration-300">
Pay Now
</button>
</a>
{% else %}
<button
class="flex justify-center items-center gap-2 px-3 py-1 rounded-md bg-osiblue text-white bg-opacity-40" disabled>
Pay Now
</button>
{% endif %}
</div>
</td>
</tr>

@ -8,24 +8,26 @@
<h1 class="text-secondosiblue text-[25px]">My Projects</h1>
<div class="w-full grid grid-cols-1 l:grid-cols-2 gap-5 mt-4">
{% for project in projects %}
<a href="{% url 'customerprojectdetails' %}">
<div
class="w-full rounded-md flex flex-col justify-between items-center gap-3 px-5 py-9 h-[250px] bg-gray-50 shadow-md relative hover:bg-gray-100 duration-300">
<div class="flex flex-col justify-center items-center gap-5">
<div
class="w-[70px] h-[70px] rounded-full shadow-md">
<img src="{% static 'images/ositcom_logos/full-logo.png' %}" class="w-full h-full rounded-full object-cover">
<img src="{{project.logo.url}}" class="w-full h-full rounded-full object-cover">
</div>
<div>
<p class="text-secondosiblue font-poppinsBold text-center text-xl">Geologist Safwat</p>
<p class="text-sm uppercase font-light text-secondosiblue text-center">P240022</p>
<p class="text-secondosiblue font-poppinsBold text-center text-xl">{{project.name}}</p>
<p class="text-sm uppercase font-light text-secondosiblue text-center">{{project.project_id}}</p>
</div>
</div>
<div
class="bg-orange-500 px-3 py-2 rounded-r-md text-xs text-white font-light uppercase absolute top-5 left-0">
<p>Active</p>
<p>{{project.projectstatus_set.all.last.status}}</p>
</div>
@ -43,43 +45,7 @@
</div>
</a>
<a href="{% url 'customerprojectdetails' %}">
<div
class="w-full rounded-md flex flex-col justify-between items-center gap-3 px-5 py-9 h-[250px] bg-gray-50 shadow-md relative hover:bg-gray-100 duration-300">
<div class="flex flex-col justify-center items-center gap-5">
<div
class="w-[70px] h-[70px] rounded-full shadow-md">
<img src="{% static 'images/ositcom_logos/full-logo.png' %}" class="w-full h-full rounded-full object-cover">
</div>
<div>
<p class="text-secondosiblue font-poppinsBold text-center text-xl">Geologist Safwat</p>
<p class="text-sm uppercase font-light text-secondosiblue text-center">P240022</p>
</div>
</div>
<div
class="bg-yellow-500 px-3 py-2 rounded-r-md text-xs text-white font-light uppercase absolute top-5 left-0">
<p>Pending</p>
</div>
<div class="w-full mt-5 flex flex-col gap-2">
<div class="w-full flex justify-between items-center gap-3 text-gray-500 font-light text-xs">
<p>May,2,2023</p>
<p>June,30,2023</p>
</div>
<div class="w-full rounded-md bg-white shadow-md h-[8px]">
<div class="w-[90%] h-full bg-red-500 rounded-md">
</div>
</div>
</div>
</div>
</a>
{% endfor %}
</div>
</div>

@ -150,6 +150,7 @@ def customer_add_ticket_update_reaction(request, reaction_type, ticketupdate_id)
def customer_invoices(request, *args, **kwargs):
invoices = Invoice.objects.filter(order__customer = request.user.customerprofile)
context = {
'invoices' : invoices,
}
@ -388,8 +389,10 @@ def dedicated_servers_plans(request, *args, **kwargs):
@customer_login_required
def customer_projects(request, *args, **kwargs):
projects = Project.objects.filter(customer=request.user.customerprofile)
context = {
'projects': projects,
}

Binary file not shown.

@ -0,0 +1,18 @@
# Generated by Django 4.2.5 on 2024-05-12 13:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('osinacore', '0079_alter_project_end_date_alter_project_start_date'),
]
operations = [
migrations.AddField(
model_name='project',
name='logo',
field=models.ImageField(blank=True, null=True, upload_to=''),
),
]

@ -139,6 +139,7 @@ class ProjectType(models.Model):
class Project(models.Model):
name = models.CharField(max_length=50)
logo = models.ImageField(null=True, blank=True)
customer = models.ForeignKey(CustomerProfile, on_delete=models.CASCADE, null=True)
manager = models.ForeignKey(StaffProfile, on_delete=models.CASCADE, null=True)
project_type = models.ManyToManyField('ProjectType', default='', related_name='manager_project')

@ -417,6 +417,9 @@
{% block modules_section %}
<!-- MODULES SECTION -->
<div class="w-full h-fit grid grid-cols-1 xxlg1:grid-cols-3 gap-5 px-5 s:px-9 py-5">
<a href="{% url 'customerinvoices' %}">
<div class="bg-white shadow-md rounded-md p-5">
<div class="w-full h-full flex flex-col justify-between items-center">
<div class="w-full flex justify-between items-center">
@ -445,7 +448,10 @@
</div>
</div>
</div>
</a>
<a href="{% url 'customerprojects' %}">
<div class="bg-white shadow-md rounded-md p-5">
<div class="w-full h-full flex flex-col justify-between items-center">
<div class="w-full flex justify-between items-center">
@ -482,7 +488,9 @@
</div>
</div>
</div>
</a>
<a href="{% url 'customertickets' %}">
<div class="bg-white shadow-md rounded-md p-5">
<div class="w-full h-full flex flex-col justify-between items-center">
<div class="w-full flex justify-between items-center">
@ -512,6 +520,7 @@
</div>
</div>
</div>
</a>
</div>
{% endblock modules_section %}

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Loading…
Cancel
Save