emile 11 months ago
parent d55c8495ab
commit cd3efc29b7

@ -5,5 +5,5 @@ from billing.edit import views
urlpatterns = [
path('paymentmethod/<int:method_id>/', views.edit_payment_method, name='editpaymentmethod'),
path('payment/', views.edit_payment_modal, name='edit_payment_modal'),
path('update_order_status/', views.update_order_status, name='update_order_status'),
path('order/<int:order_id>/status/', views.update_order_status, name='update_order_status'),
]

@ -2,6 +2,7 @@ from django.shortcuts import render, get_object_or_404
from osinacore.models import *
from billing.models import *
from osinacore.decorators import *
from django.http import HttpResponse
@ -37,10 +38,18 @@ def edit_payment_modal(request):
@staff_login_required
def update_order_status(request):
def update_order_status(request, order_id):
order = get_object_or_404(Order, id=order_id)
if request.method == 'POST':
status = OrderStatus(
status = request.POST.get('status'),
order = order,
date = request.POST.get('date'),
)
status.save()
return HttpResponse('<script>window.top.location.reload();</script>')
context = {
'order': order
}
return render(request, 'edit_templates/update-order-status-modal.html', context)

@ -31,6 +31,11 @@
<div
class="w-full bg-gray-50 px-3 py-3 border border-gray-100 shadow-md rounded-md flex flex-col md:flex-row justify-end items-center gap-2 mt-3">
<button data-modal-url="{% url 'update_order_status' order.id %}"
class="w-full md:w-fit text-base px-3 py-2 bg-osiblue text-white outline-none border border-osiblue rounded-md cursor-pointer hover:bg-white hover:text-osiblue duration-300 updateOrderStatusButton">
Update Status
</button>
<button data-modal-url="{% url 'add_payment_modal' order.id %}"
class="w-full md:w-fit text-base px-3 py-2 bg-osiblue text-white outline-none border border-osiblue rounded-md cursor-pointer hover:bg-white hover:text-osiblue duration-300 addPaymentButton">
Add Payment
@ -52,10 +57,6 @@
</a>
{% endif %}
<button data-modal-url="{% url 'update_order_status' %}"
class="w-full md:w-fit text-base px-3 py-2 bg-osiblue text-white outline-none border border-osiblue rounded-md cursor-pointer hover:bg-white hover:text-osiblue duration-300 updateOrderStatusButton">
Update Status
</button>
<a href="{% url 'addpayment' order.id %}" class="w-full md:w-fit">
<button

@ -14,17 +14,22 @@
</head>
<body class="font-poppinsLight">
<form id="hiddenContent" method="POST" action="">
<form id="hiddenContent" method="POST" action="{% url 'update_order_status' order.id %}">
{% csrf_token %}
<h1 class="text-secondosiblue text-2xl font-semibold text-center">Update Order Status</h1>
<select name="" id="" class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md mt-4">
<select name="status" id="" class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md mt-4">
<option value="Completed">Completed</option>
<option value="Pending">Pending</option>
<option value="Failed">Failed</option>
<option value="Cancelled">Cancelled</option>
</select>
<div class="w-full mt-4">
<input name="date" type="datetime-local"
class="w-full h-[50px] py-1 px-3 border border-gray-300 outline-none rounded-md mt-1">
</div>
<div class="w-full flex justify-center items-center mt-4">
<button type="submit"
class="w-fit bg-osiblue border border-osiblue rounded-md text-white text-xl px-5 py-1 hover:bg-white hover:text-osiblue">Save</button>

@ -6,7 +6,7 @@
<div class="w-full flex flex-col gap-5">
<div class="w-full p-9 flex flex-col justify-center items-center gap-5 shadow-md bg-white rounded-md">
<div class="w-[80px] s:w-[100px] h-[80px] s:h-[100px] rounded-full border border-gray-50 shadow-md">
<img src="{% static 'images/ositcom_logos/full-logo-blue-bg.png' %}" class="w-full h-full object-cover rounded-full">
<img src="{% static 'images/ositcom_logos/logobluebg-o.jpg' %}" class="w-full h-full object-cover rounded-full">
</div>
<div class="text-gray-500 font-light flex flex-col justify-center items-center">

Binary file not shown.

@ -5,7 +5,7 @@ from . import views
urlpatterns = [
path('customer/<str:customer_id>/', views.edit_customer, name='editcustomer'),
path('customerstatus', views.edit_customer_status_modal, name='editcustomerstatusmodal'),
path('customer/<str:customer_id>/status/', views.edit_customer_status_modal, name='editcustomerstatusmodal'),
path('business/<str:business_id>/', views.edit_business, name='editbusiness'),
path('staff/<str:staff_id>/', views.edit_staff, name='editstaff'),
path('project/<str:project_id>/', views.edit_project, name='editproject'),

@ -1,6 +1,5 @@
from osinacore.models import *
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.http import HttpResponse
@ -44,9 +43,15 @@ def edit_customer(request, customer_id):
return render(request, 'edit_templates/edit-customer.html', context)
@staff_login_required
def edit_customer_status_modal(request):
def edit_customer_status_modal(request, customer_id):
customer = get_object_or_404(CustomerProfile, id=customer_id)
if request.method == 'POST':
customer.status = request.POST.get('status')
customer.save()
return HttpResponse('<script>window.top.location.reload();</script>')
context = {
'customer': customer,
}

@ -28,7 +28,7 @@
<div class="w-full md:w-fit flex flex-col md:flex-row justify-end items-center gap-3">
<button
class="w-full md:w-fit text-base px-3 py-2 bg-osiblue text-white outline-none border border-osiblue rounded-md cursor-pointer hover:bg-white hover:text-osiblue duration-300 editCustomerStatusButton"
data-modal-url="{% url 'editcustomerstatusmodal' %}">Update
data-modal-url="{% url 'editcustomerstatusmodal' customer.id %}">Update
Status</button>
<a href="{% url 'addproject' %}" class="w-full md:w-fit">

@ -14,7 +14,7 @@
</head>
<body class="font-poppinsLight">
<form method="POST" action="">
<form method="POST" action="{% url 'editcustomerstatusmodal' customer.id %}">
{% csrf_token %}
<h1 class="text-secondosiblue text-2xl font-semibold text-center">Update Customer Status</h1>
@ -26,6 +26,7 @@
</select>
<div class="w-full flex justify-center items-center mt-4">
<button type="submit"
class="w-fit bg-osiblue border border-osiblue rounded-md text-white text-xl px-5 py-1 hover:bg-white hover:text-osiblue">Save</button>

@ -46,7 +46,7 @@
<h2>Activate your account at Ositcom</h2>
<p>Hello {{ user.first_name }},</p>
<p>Thank you for signing up! To help us confirm your identity, please click the button below to activate your account and verify your email address:</p>
<p><a class="btn" href="{{ domain }}{% url 'activate' uidb64=uid token=token %}">Activate Account</a></p>
<p><a class="btn" href="{{activate_link}}">Activate Account</a></p>
<p>If you didn't request this, you can safely ignore this email.</p>
<p>Regards,<br>The Ositcom Team</p>
</div>

@ -69,8 +69,8 @@
<p class="text-secondosiblue">{{customer.user.username}}</p>
</td>
<td class="px-6 py-4 text-center text-sm border-r border-gray-300 hover:bg-opacity-50 duration-300 cursor-pointer editCustomerStatusButton {% if customer.status == 'Active' %}bg-green-700{% endif %} {% if customer.status == 'Terminated' %}bg-gray-500{% endif %} {% if customer.status == 'Suspended' %}bg-red-500{% endif %}"
data-modal-url="{% url 'editcustomerstatusmodal' %}">
<td class="px-6 py-4 text-center text-sm border-r border-gray-300 hover:bg-opacity-50 duration-300 cursor-pointer editCustomerStatusButton {% if customer.status == 'Active' %}bg-green-700{% endif %} {% if customer.status == 'Terminated' %}bg-gray-500{% endif %} {% if customer.status == 'Suspended' %}bg-red-500{% endif %} {% if customer.status == 'Pending' %}bg-yellow-500{% endif %}"
data-modal-url="{% url 'editcustomerstatusmodal' customer.id %}">
<p class="text-white">{{customer.status}}</p>
</td>

@ -100,12 +100,14 @@ def signup(request):
token = default_token_generator.make_token(user)
current_site = get_current_site(request)
uid = urlsafe_base64_encode(force_bytes(user.pk)) #Encode the user id
token = token
activate_link = f"https://{current_site.domain}/activate/{uid}/{token}/"
mail_subject = 'Activate your account'
message = render_to_string('email_templates/account_activation_email.html', {
'user': user,
'domain': current_site.domain,
'uid': urlsafe_base64_encode(force_bytes(user.pk)), #Encode the user id
'token': token,
'activate_link': activate_link,
})
send_mail(mail_subject, message, settings.EMAIL_HOST_USER, [user.email], html_message=message)
@ -874,13 +876,14 @@ def forgot_password(request):
current_site = get_current_site(request)
uid = urlsafe_base64_encode(force_bytes(user.pk))
reset_link = f"{current_site}/reset-password/{uid}/{token}/"
reset_link = f"https://{current_site.domain}/reset-password/{uid}/{token}/"
mail_subject = 'Reset your password'
message = render_to_string('email_templates/forgot_password_email.html', {
'user': user,
'reset_link': reset_link,
})
print(reset_link)
send_mail(mail_subject, message, settings.EMAIL_HOST_USER, [user.email], html_message=message)
return render(request, 'forgot-password-sent.html')
else:

@ -78,7 +78,7 @@ function initializeModalButtons() {
addButtonClickListener("editPaymentButton", "500px", "400px");
addButtonClickListener("addPaymentMethodButton", "500px", "400px");
addButtonClickListener("updateOrderStatusButton", "400px", "160px");
addButtonClickListener("updateOrderStatusButton", "400px", "240px");
addButtonClickListener("editProjectStatusButton", "400px", "220px");
addButtonClickListener("editCustomerStatusButton", "400px", "160px");
addButtonClickListener("addProjectMemberModal", "400px", "280px");

Loading…
Cancel
Save