diff --git a/osinaweb/billing/add/__pycache__/urls.cpython-312.pyc b/osinaweb/billing/add/__pycache__/urls.cpython-312.pyc
index fa3eb0f8..1928ca12 100644
Binary files a/osinaweb/billing/add/__pycache__/urls.cpython-312.pyc and b/osinaweb/billing/add/__pycache__/urls.cpython-312.pyc differ
diff --git a/osinaweb/billing/add/__pycache__/views.cpython-312.pyc b/osinaweb/billing/add/__pycache__/views.cpython-312.pyc
index e3344495..11a293a8 100644
Binary files a/osinaweb/billing/add/__pycache__/views.cpython-312.pyc and b/osinaweb/billing/add/__pycache__/views.cpython-312.pyc differ
diff --git a/osinaweb/billing/add/urls.py b/osinaweb/billing/add/urls.py
index 860eb6fe..97dc4702 100644
--- a/osinaweb/billing/add/urls.py
+++ b/osinaweb/billing/add/urls.py
@@ -7,8 +7,7 @@ urlpatterns = [
path('service', views.add_service, name='addservice'),
path('order//', views.add_order, name='addorder'),
- path('invoice-pdf//', views.add_invoice_pdf, name='addinvoice'),
- path('payment-pdf//', views.add_payment_pdf, name='addpayment'),
+
path('service///', views.add_service_in_order, name='addserviceinorder'),
@@ -16,5 +15,4 @@ urlpatterns = [
path('payment//', views.add_payment_modal, name='add_payment_modal'),
path('payment_comment/', views.add_payment_comment_modal, name='add_payment_comment_modal'),
-
]
diff --git a/osinaweb/billing/add/views.py b/osinaweb/billing/add/views.py
index c1b41a70..1c79925c 100644
--- a/osinaweb/billing/add/views.py
+++ b/osinaweb/billing/add/views.py
@@ -8,7 +8,7 @@ import os
from osinacore.decorators import *
from django.core.files.base import ContentFile
from django.db.models import Q
-from weasyprint import HTML, CSS
+
@staff_login_required
@@ -211,116 +211,7 @@ def add_payment_comment_modal(request):
-def add_invoice_pdf(request, order_id):
- order = get_object_or_404(Order, id=order_id)
-
- current_year = str(timezone.now().year)[-2:]
- last_invoice = Invoice.objects.all().last()
- if last_invoice:
- last_invoice_number = int(last_invoice.invoice_number.split('-')[1].split('+')[0])
- new_invoice_number = f"$0{current_year}-{last_invoice_number + 1}"
- else:
- new_invoice_number = f"$0{current_year}-1425"
-
-
-
- invoice = Invoice.objects.create(
- invoice_number = new_invoice_number,
- order=order,
- date_created=datetime.now(),
- )
-
- template = get_template('details_templates/invoice-details.html')
- context = {'order': order}
- html_string = template.render(context)
-
- # Define the CSS string with Poppins font
- css_string = '''
- @font-face {
- font-family: 'Poppins';
- src: url('path_to_poppins_font_file.ttf') format('truetype'); /* Update the path to the font file */
- }
-
- body {
- font-family: 'Poppins', sans-serif; /* Use Poppins font for the entire document */
- }
-
- /* Your existing CSS styles */
- /* Add or modify styles as needed */
- '''
-
- # Generate PDF
- pdf = HTML(string=html_string).write_pdf(
- stylesheets=[
- CSS(string=css_string),
- CSS(string='@page { margin: 30px; }')
- ],
- presentational_hints=True
- )
-
- filename = f'invoice_{invoice.invoice_number}.pdf'
- pdf_content = ContentFile(pdf)
- invoice.pdf.save(filename, pdf_content, save=True)
-
-
- # Return PDF
- response = HttpResponse(pdf, content_type='application/pdf')
- response['Content-Disposition'] = 'attachment; filename="my_pdf.pdf"'
- return response
-
-
-
-
-
-
-
-def add_payment_pdf(request, order_id):
- order = get_object_or_404(Order, id=order_id)
- payments = OrderPayment.objects.filter(order = order)
- paid_amount = OrderPayment.objects.filter(order=order, date_paid__isnull=False).aggregate(total_paid=Sum('amount'))['total_paid'] or 0
- cart_total = order.get_cart_total
- remaining_amount = cart_total - paid_amount
-
-
- invoice = order.invoice
-
- # Render both invoice and payment details templates to HTML
- invoice_template = get_template('details_templates/invoice-details.html')
- payment_template = get_template('details_templates/payment-details.html')
- invoice_html = invoice_template.render({'order': order})
- payment_html = payment_template.render({'order': order, 'payments':payments, 'remaining_amount':remaining_amount,})
-
- # Combine the HTML content of both templates
- combined_html = f"{invoice_html}{payment_html}"
-
- # Define CSS
- css_string = '''
- @font-face {
- font-family: 'Poppins';
- src: url('path_to_poppins_font_file.ttf') format('truetype'); /* Update the path to the font file */
- }
-
- body {
- font-family: 'Poppins', sans-serif; /* Use Poppins font for the entire document */
- }
-
- /* Your existing CSS styles */
- /* Add or modify styles as needed */
- '''
-
- # Generate PDF
- pdf = HTML(string=combined_html).write_pdf(
- stylesheets=[
- CSS(string=css_string),
- CSS(string='@page { margin: 30px; }')
- ],
- presentational_hints=True
- )
- # Return PDF
- response = HttpResponse(pdf, content_type='application/pdf')
- response['Content-Disposition'] = 'attachment; filename="my_pdf.pdf"'
- return response
diff --git a/osinaweb/customercore/__pycache__/urls.cpython-312.pyc b/osinaweb/customercore/__pycache__/urls.cpython-312.pyc
index 4199a252..bd22ffbe 100644
Binary files a/osinaweb/customercore/__pycache__/urls.cpython-312.pyc and b/osinaweb/customercore/__pycache__/urls.cpython-312.pyc differ
diff --git a/osinaweb/customercore/__pycache__/views.cpython-312.pyc b/osinaweb/customercore/__pycache__/views.cpython-312.pyc
index cf81886a..3499ee7c 100644
Binary files a/osinaweb/customercore/__pycache__/views.cpython-312.pyc and b/osinaweb/customercore/__pycache__/views.cpython-312.pyc differ
diff --git a/osinaweb/customercore/payment/__pycache__/views.cpython-312.pyc b/osinaweb/customercore/payment/__pycache__/views.cpython-312.pyc
index 88f4b939..7fe5263e 100644
Binary files a/osinaweb/customercore/payment/__pycache__/views.cpython-312.pyc and b/osinaweb/customercore/payment/__pycache__/views.cpython-312.pyc differ
diff --git a/osinaweb/customercore/templates/listing_pages/customer-invoices.html b/osinaweb/customercore/templates/listing_pages/customer-invoices.html
index b7702622..7ea4ce9c 100644
--- a/osinaweb/customercore/templates/listing_pages/customer-invoices.html
+++ b/osinaweb/customercore/templates/listing_pages/customer-invoices.html
@@ -51,7 +51,8 @@
{{invoice.order.orderpayment_set.all.last.date_due}}
{% else %}
-
- {% endif %}
+ {% endif %}
+
diff --git a/osinaweb/customercore/templates/user_profile_pages/user-profile.html b/osinaweb/customercore/templates/user_profile_pages/user-profile.html
new file mode 100644
index 00000000..fe40a080
--- /dev/null
+++ b/osinaweb/customercore/templates/user_profile_pages/user-profile.html
@@ -0,0 +1,91 @@
+{% extends "customer_main.html" %}
+{%load static%}
+{% block content %}
+
+
+
+
+
+ 
+
+
+
+ {{request.user.first_name}} {{request.user.last_name}}
+ {{request.user.email}}
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/osinaweb/customercore/templates/user_profile_pages/user-settings.html b/osinaweb/customercore/templates/user_profile_pages/user-settings.html
new file mode 100644
index 00000000..5bb372f7
--- /dev/null
+++ b/osinaweb/customercore/templates/user_profile_pages/user-settings.html
@@ -0,0 +1,90 @@
+{% extends "customer_main.html" %}
+{%load static%}
+{% block content %}
+
+
+
+
+
+ 
+
+
+
+ {{request.user.first_name}} {{request.user.last_name}}
+ {{request.user.email}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/osinaweb/customercore/urls.py b/osinaweb/customercore/urls.py
index 290267c5..fef96de9 100644
--- a/osinaweb/customercore/urls.py
+++ b/osinaweb/customercore/urls.py
@@ -29,4 +29,12 @@ urlpatterns = [
path('shared-hosting-plans/', views.shared_hosting_plans, name='sharedhostingplans'),
path('cloud-vps-hosting-plans/', views.cloud_vps_hosting_plans, name='cloudvpshostingplans'),
path('dedicated-servers-plans/', views.dedicated_servers_plans, name='dedicatedserversplans'),
+
+
+ # USER PROFILE
+ path('user-profile/', views.user_profile, name='userprofile'),
+ path('user-settings/', views.user_settings, name='usersettings'),
+
+ path('changepassword/', views.change_password, name="changepassword"),
+ path('check_current_password/', views.check_current_password, name='check_current_password'),
]
diff --git a/osinaweb/customercore/views.py b/osinaweb/customercore/views.py
index 90978f35..1fcf363e 100644
--- a/osinaweb/customercore/views.py
+++ b/osinaweb/customercore/views.py
@@ -7,6 +7,9 @@ from django.db.models import Q
from django.http import Http404
from django.db.models import OuterRef, Subquery
from customercore.views import *
+from django.contrib.auth.hashers import check_password
+from django.contrib.auth import update_session_auth_hash, logout
+import json
@@ -264,3 +267,61 @@ def dedicated_servers_plans(request, *args, **kwargs):
+# USER PROFILE
+@customer_login_required
+def user_profile(request, *args, **kwargs):
+
+ context = {
+
+ }
+
+ return render(request, 'user_profile_pages/user-profile.html', context)
+
+
+
+@customer_login_required
+def user_settings(request, *args, **kwargs):
+
+ context = {
+
+ }
+
+ return render(request, 'user_profile_pages/user-settings.html', context)
+
+
+
+
+def change_password(request):
+ if request.method == 'POST':
+ current_password = request.POST['current_password']
+ new_password = request.POST['new_password']
+ confirm_password = request.POST['confirm_password']
+
+ if check_password(current_password, request.user.password):
+ if new_password == confirm_password:
+ request.user.set_password(new_password)
+ request.user.save()
+ update_session_auth_hash(request, request.user)
+ logout(request)
+ return redirect('home')
+
+ return render(request, 'accounts/change_password.html')
+
+
+
+def check_current_password(request):
+ if request.method == 'POST':
+ try:
+ data = json.loads(request.body.decode('utf-8'))
+ current_password = data.get('current_password')
+ except json.JSONDecodeError:
+ return JsonResponse({'is_current_password_correct': False})
+
+ user = request.user
+
+ if check_password(current_password, request.user.password):
+ return JsonResponse({'is_current_password_correct': True})
+ else:
+ return JsonResponse({'is_current_password_correct': False})
+
+ return JsonResponse({'error': 'Invalid request method'}, status=400)
\ No newline at end of file
diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3
index 9e91a117..bb6f86a7 100644
Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ
diff --git a/osinaweb/osinacore/__pycache__/admin.cpython-312.pyc b/osinaweb/osinacore/__pycache__/admin.cpython-312.pyc
index 29a208db..c446b54e 100644
Binary files a/osinaweb/osinacore/__pycache__/admin.cpython-312.pyc and b/osinaweb/osinacore/__pycache__/admin.cpython-312.pyc differ
diff --git a/osinaweb/osinacore/__pycache__/models.cpython-312.pyc b/osinaweb/osinacore/__pycache__/models.cpython-312.pyc
index a959616e..9f2d29f6 100644
Binary files a/osinaweb/osinacore/__pycache__/models.cpython-312.pyc and b/osinaweb/osinacore/__pycache__/models.cpython-312.pyc differ
diff --git a/osinaweb/osinacore/__pycache__/views.cpython-312.pyc b/osinaweb/osinacore/__pycache__/views.cpython-312.pyc
index 2e27dc4a..fd84b944 100644
Binary files a/osinaweb/osinacore/__pycache__/views.cpython-312.pyc and b/osinaweb/osinacore/__pycache__/views.cpython-312.pyc differ
diff --git a/osinaweb/osinacore/edit/__pycache__/urls.cpython-312.pyc b/osinaweb/osinacore/edit/__pycache__/urls.cpython-312.pyc
index 618e110f..09f93300 100644
Binary files a/osinaweb/osinacore/edit/__pycache__/urls.cpython-312.pyc and b/osinaweb/osinacore/edit/__pycache__/urls.cpython-312.pyc differ
diff --git a/osinaweb/osinacore/edit/__pycache__/views.cpython-312.pyc b/osinaweb/osinacore/edit/__pycache__/views.cpython-312.pyc
index f8de4577..5bc1f328 100644
Binary files a/osinaweb/osinacore/edit/__pycache__/views.cpython-312.pyc and b/osinaweb/osinacore/edit/__pycache__/views.cpython-312.pyc differ
diff --git a/osinaweb/osinacore/migrations/__pycache__/0082_pinnedproject.cpython-312.pyc b/osinaweb/osinacore/migrations/__pycache__/0082_pinnedproject.cpython-312.pyc
new file mode 100644
index 00000000..23d9c4fe
Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0082_pinnedproject.cpython-312.pyc differ
diff --git a/osinaweb/osinacore/templates/customer_main.html b/osinaweb/osinacore/templates/customer_main.html
index d5fc138a..533fde89 100644
--- a/osinaweb/osinacore/templates/customer_main.html
+++ b/osinaweb/osinacore/templates/customer_main.html
@@ -189,13 +189,23 @@
@@ -384,13 +394,23 @@
style="display: none;" id="userProfileDropdown">
+ class="w-full py-3 flex items-center gap-2 text-white hover:text-osiblue duration-300 cursor-pointer border-b border-white border-opacity-10">
Logout
+
+
+
diff --git a/osinaweb/osinacore/templates/details_templates/customer-details.html b/osinaweb/osinacore/templates/details_templates/customer-details.html
index 1f5cad7b..8d442925 100644
--- a/osinaweb/osinacore/templates/details_templates/customer-details.html
+++ b/osinaweb/osinacore/templates/details_templates/customer-details.html
@@ -71,6 +71,13 @@
Email: {{customer.user.email}}
+
+
+ Mobile Number: {{customer.mobile_number}}
+
+
+
{% if customer.personal_website %}
Personal Website:
{% if user_offline %}
-
+
You are Currently Offline
diff --git a/osinaweb/osinacore/templates/projects-by-status.html b/osinaweb/osinacore/templates/projects-by-status.html
index 45154c65..36e2f7a9 100644
--- a/osinaweb/osinacore/templates/projects-by-status.html
+++ b/osinaweb/osinacore/templates/projects-by-status.html
@@ -74,6 +74,14 @@
{% if project.open_user_tasks_count == 1 %} Task {% else %} Tasks {% endif %}
+
+
+ {{project.ticket_set.all.count}} Open {% if project.ticket_set.all.count == 1 %} Ticket {% else %} Tickets {% endif %}
+
+
-
-
-
@@ -109,7 +106,7 @@
{% if project.note_set.exists %}
{% with last_note=project.note_set.last %}
- {{ last_note.text }}
+ {{ last_note.text }}
|