New changes

main
emile 1 year ago
parent 69a36f560f
commit 2d7cc7b4ba

BIN
.DS_Store vendored

Binary file not shown.

BIN
osinaweb/.DS_Store vendored

Binary file not shown.

Binary file not shown.

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

@ -0,0 +1,6 @@
from django.apps import AppConfig
class CustomercoreConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'customercore'

@ -0,0 +1,13 @@
from functools import wraps
from django.shortcuts import redirect
from osinacore.models import *
def customer_login_required(view_func):
@wraps(view_func)
def _wrapped_view(request, *args, **kwargs):
# Check if the user is logged in and is a staff member
if not request.user.is_authenticated or not CustomerProfile.objects.filter(user=request.user):
return redirect('signout') # Redirect to login URL if not staff
return view_func(request, *args, **kwargs)
return _wrapped_view

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

Binary file not shown.

@ -1,4 +1,4 @@
{% extends "customer_dashboard/customer_main.html" %} {% extends "customer_main.html" %}
{%load static%} {%load static%}
{% block content %} {% block content %}

@ -1,4 +1,4 @@
{% extends "customer_dashboard/customer_main.html" %} {% extends "customer_main.html" %}
{%load static%} {%load static%}
{% block modules_section %} {% block modules_section %}

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

@ -0,0 +1,13 @@
from django.urls import path
from . import views
urlpatterns = [
path('invoices/', views.customer_invoices, name='customerinvoices'),
path('products/', views.customer_products, name='customerproducts'),
path('pricing/', views.pricing, name='pricing'),
path('initiate_checkout/', views.initiate_checkout, name='initiatecheckout'),
]

@ -0,0 +1,79 @@
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse
import requests
from .decorators import *
# Create your views here.
@customer_login_required
def customer_invoices(request, *args, **kwargs):
context = {
}
return render(request, 'listing_pages/customer-invoices.html', context)
@customer_login_required
def customer_products(request, *args, **kwargs):
context = {
}
return render(request, 'listing_pages/customer-products.html', context)
@customer_login_required
def pricing(request, *args, **kwargs):
context = {
}
return render(request, 'pricing.html', context)
@customer_login_required
def initiate_checkout(request):
# Your Mastercard API credentials
api_username = "merchant.TEST06127800"
api_password = "37846250a67c70e7fe9f82cf6ca81f93"
merchant_id = "TEST06127800"
merchant_name = "Ositcom Sal"
# Data for Initiate Checkout operation
data = {
"apiOperation": "INITIATE_CHECKOUT",
"apiUsername": api_username,
"apiPassword": api_password,
"merchant": merchant_id,
"interaction.operation": "PURCHASE",
"interaction.merchant.name": merchant_name,
"order.id": "123",
"order.amount": "100.00",
"order.currency": "USD",
"order.description": "description_of_order"
}
try:
response = requests.post("https://creditlibanais-netcommerce.gateway.mastercard.com/api/nvp/version/72", data=data)
print("Response Content:", response.content.decode()) # Print response content
if response.status_code == 200:
response_data = response.text
parsed_data = dict(item.split("=") for item in response_data.split("&"))
session_id = parsed_data.get("session.id")
success_indicator = parsed_data.get("successIndicator")
return JsonResponse({"session_id": session_id, "success_indicator": success_indicator})
else:
print("Response Status Code:", response.status_code) # Print status code
return JsonResponse({"error": "Failed to initiate checkout"}, status=500)
except Exception as e:
print("Exception:", e) # Print exception traceback
return JsonResponse({"error": "Internal Server Error"}, status=500)

Binary file not shown.

Binary file not shown.

@ -6,9 +6,10 @@ from django.urls import reverse
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from datetime import date from datetime import date
from django.http import JsonResponse from django.http import JsonResponse
from osinacore.decorators import *
@staff_login_required
def add_status_modal(request, *args, **kwargs): def add_status_modal(request, *args, **kwargs):
if request.method == 'POST': if request.method == 'POST':
text = request.POST.get('text') text = request.POST.get('text')
@ -36,7 +37,7 @@ def add_status_modal(request, *args, **kwargs):
@login_required @staff_login_required
def add_customer(request): def add_customer(request):
businesses = Business.objects.all().order_by('-id') businesses = Business.objects.all().order_by('-id')
references = Reference.objects.all().order_by('-id') references = Reference.objects.all().order_by('-id')
@ -89,7 +90,7 @@ def add_customer(request):
@login_required @staff_login_required
def add_business(request): def add_business(request):
business_types = BusinessType.objects.all().order_by('-id') business_types = BusinessType.objects.all().order_by('-id')
if request.method == 'POST': if request.method == 'POST':
@ -136,7 +137,7 @@ def add_business(request):
@login_required @staff_login_required
def add_business_modal(request): def add_business_modal(request):
if request.method == 'POST': if request.method == 'POST':
name = request.POST.get('name') name = request.POST.get('name')
@ -180,7 +181,7 @@ def add_business_modal(request):
return render(request, 'add_templates/addbusiness-modal.html') return render(request, 'add_templates/addbusiness-modal.html')
@login_required @staff_login_required
def add_staff(request): def add_staff(request):
staffpositions = StaffPosition.objects.all().order_by('-id') staffpositions = StaffPosition.objects.all().order_by('-id')
if request.method == 'POST': if request.method == 'POST':
@ -224,7 +225,7 @@ def add_staff(request):
@login_required @staff_login_required
def add_project(request): def add_project(request):
staffs = StaffProfile.objects.all().order_by('-id') staffs = StaffProfile.objects.all().order_by('-id')
project_types = ProjectType.objects.all() project_types = ProjectType.objects.all()
@ -279,6 +280,8 @@ def add_project(request):
return render(request, 'add_templates/add-project.html', context) return render(request, 'add_templates/add-project.html', context)
@staff_login_required
def add_user_story_modal(request, project_id): def add_user_story_modal(request, project_id):
project = get_object_or_404(Project, project_id=project_id) project = get_object_or_404(Project, project_id=project_id)
if request.method == 'POST': if request.method == 'POST':
@ -305,7 +308,7 @@ def add_user_story_modal(request, project_id):
@staff_login_required
def add_project_note_modal(request, project_id): def add_project_note_modal(request, project_id):
project = get_object_or_404(Project, project_id=project_id) project = get_object_or_404(Project, project_id=project_id)
if request.method == 'POST': if request.method == 'POST':
@ -333,7 +336,7 @@ def add_project_note_modal(request, project_id):
@staff_login_required
def add_file_modal(request, *args, **kwargs): def add_file_modal(request, *args, **kwargs):
context = { context = {
@ -350,7 +353,7 @@ def add_credential_modal(request, *args, **kwargs):
@login_required @staff_login_required
def add_task(request, project_id=None, requirement_id=None): def add_task(request, project_id=None, requirement_id=None):
project = None project = None
requirement = None requirement = None
@ -430,7 +433,7 @@ def add_task(request, project_id=None, requirement_id=None):
@staff_login_required
def add_point_modal(request, task_id): def add_point_modal(request, task_id):
task = get_object_or_404(Task, task_id=task_id) task = get_object_or_404(Task, task_id=task_id)
if request.method == 'POST': if request.method == 'POST':
@ -455,7 +458,7 @@ def add_point_modal(request, task_id):
@login_required @staff_login_required
def add_epic(request, project_id): def add_epic(request, project_id):
project = get_object_or_404(Project, project_id=project_id) project = get_object_or_404(Project, project_id=project_id)
if request.method == 'POST': if request.method == 'POST':
@ -494,7 +497,7 @@ def add_epic(request, project_id):
@staff_login_required
def add_note_modal(request, *args, **kwargs): def add_note_modal(request, *args, **kwargs):
if request.method == 'POST': if request.method == 'POST':
text = request.POST.get('note_text') text = request.POST.get('note_text')
@ -516,6 +519,7 @@ def add_note_modal(request, *args, **kwargs):
@staff_login_required
def add_daily_report(request): def add_daily_report(request):
user = request.user user = request.user
today = date.today() today = date.today()
@ -546,7 +550,7 @@ def add_daily_report(request):
return render(request, 'add_templates/add-daily-report.html', context) return render(request, 'add_templates/add-daily-report.html', context)
@staff_login_required
def add_projecttype_modal(request, *args, **kwargs): def add_projecttype_modal(request, *args, **kwargs):
if request.method == 'POST': if request.method == 'POST':
name = request.POST.get('name') name = request.POST.get('name')
@ -561,7 +565,7 @@ def add_projecttype_modal(request, *args, **kwargs):
return render(request, 'add_templates/add-projecttype-modal.html') return render(request, 'add_templates/add-projecttype-modal.html')
@staff_login_required
def add_staffposition_modal(request): def add_staffposition_modal(request):
if request.method == 'POST': if request.method == 'POST':
name = request.POST.get('name') name = request.POST.get('name')
@ -577,7 +581,7 @@ def add_staffposition_modal(request):
return render(request, 'add_templates/add-staffposition-modal.html') return render(request, 'add_templates/add-staffposition-modal.html')
@staff_login_required
def add_businesstype_modal(request, *args, **kwargs): def add_businesstype_modal(request, *args, **kwargs):
if request.method == 'POST': if request.method == 'POST':
name = request.POST.get('name') name = request.POST.get('name')
@ -597,7 +601,7 @@ def add_businesstype_modal(request, *args, **kwargs):
@staff_login_required
def add_reference_modal(request, *args, **kwargs): def add_reference_modal(request, *args, **kwargs):
if request.method == 'POST': if request.method == 'POST':
name = request.POST.get('name') name = request.POST.get('name')

@ -0,0 +1,13 @@
from functools import wraps
from django.shortcuts import redirect
from .models import *
def staff_login_required(view_func):
@wraps(view_func)
def _wrapped_view(request, *args, **kwargs):
# Check if the user is logged in and is a staff member
if not request.user.is_authenticated or not StaffProfile.objects.filter(user=request.user):
return redirect('signout') # Redirect to login URL if not staff
return view_func(request, *args, **kwargs)
return _wrapped_view

@ -3,9 +3,10 @@ from osinacore.models import *
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.urls import reverse from django.urls import reverse
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from osinacore.decorators import *
@login_required @staff_login_required
def delete_customer_modal(request, customer_id): def delete_customer_modal(request, customer_id):
customer = get_object_or_404(CustomerProfile, id=customer_id) customer = get_object_or_404(CustomerProfile, id=customer_id)
@ -19,7 +20,7 @@ def delete_customer_modal(request, customer_id):
return render(request, "delete_templates/delete-customer-modal.html", context) return render(request, "delete_templates/delete-customer-modal.html", context)
@login_required @staff_login_required
def delete_business_modal(request, business_id): def delete_business_modal(request, business_id):
business = get_object_or_404(Business, id=business_id) business = get_object_or_404(Business, id=business_id)
@ -32,8 +33,7 @@ def delete_business_modal(request, business_id):
} }
return render(request, "delete_templates/delete-business-modal.html", context) return render(request, "delete_templates/delete-business-modal.html", context)
@staff_login_required
@login_required
def delete_staff_modal(request, staff_id): def delete_staff_modal(request, staff_id):
staff = get_object_or_404(StaffProfile, id=staff_id) staff = get_object_or_404(StaffProfile, id=staff_id)
@ -47,7 +47,7 @@ def delete_staff_modal(request, staff_id):
return render(request, "delete_templates/delete-staff-modal.html", context) return render(request, "delete_templates/delete-staff-modal.html", context)
@login_required @staff_login_required
def delete_project_modal(request, project_id): def delete_project_modal(request, project_id):
project = get_object_or_404(Project, id=project_id) project = get_object_or_404(Project, id=project_id)
@ -61,7 +61,7 @@ def delete_project_modal(request, project_id):
return render(request, "delete_templates/delete-project-modal.html", context) return render(request, "delete_templates/delete-project-modal.html", context)
@login_required @staff_login_required
def delete_project_note_modal(request, note_id): def delete_project_note_modal(request, note_id):
note = get_object_or_404(Note, id=note_id) note = get_object_or_404(Note, id=note_id)
@ -80,7 +80,7 @@ def delete_project_note_modal(request, note_id):
@login_required @staff_login_required
def delete_task_modal(request, task_id): def delete_task_modal(request, task_id):
task = get_object_or_404(Task, id=task_id) task = get_object_or_404(Task, id=task_id)
@ -95,7 +95,7 @@ def delete_task_modal(request, task_id):
@login_required @staff_login_required
def delete_point_modal(request, point_id, task_id): def delete_point_modal(request, point_id, task_id):
task = get_object_or_404(Task, id=task_id) task = get_object_or_404(Task, id=task_id)
point = get_object_or_404(Point, id=point_id) point = get_object_or_404(Point, id=point_id)
@ -110,7 +110,7 @@ def delete_point_modal(request, point_id, task_id):
@login_required @staff_login_required
def delete_task_point_modal(request, point_id, task_id): def delete_task_point_modal(request, point_id, task_id):
task = get_object_or_404(Task, id=task_id) task = get_object_or_404(Task, id=task_id)
point = get_object_or_404(Point, id=point_id) point = get_object_or_404(Point, id=point_id)
@ -125,7 +125,7 @@ def delete_task_point_modal(request, point_id, task_id):
@login_required @staff_login_required
def delete_note_modal(request, note_id): def delete_note_modal(request, note_id):
note = get_object_or_404(Note, id=note_id) note = get_object_or_404(Note, id=note_id)

@ -4,9 +4,10 @@ from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.urls import reverse from django.urls import reverse
from django.http import HttpResponse from django.http import HttpResponse
from osinacore.decorators import *
@login_required @staff_login_required
def edit_customer(request, customer_id): def edit_customer(request, customer_id):
customer = get_object_or_404(CustomerProfile, customer_id=customer_id) customer = get_object_or_404(CustomerProfile, customer_id=customer_id)
@ -60,7 +61,7 @@ def edit_customer(request, customer_id):
@login_required @staff_login_required
def edit_business(request, business_id): def edit_business(request, business_id):
business = get_object_or_404(Business, business_id=business_id) business = get_object_or_404(Business, business_id=business_id)
business_types = BusinessType.objects.all().order_by('name') business_types = BusinessType.objects.all().order_by('name')
@ -102,7 +103,7 @@ def edit_business(request, business_id):
return render(request, 'edit_templates/edit-business.html', context) return render(request, 'edit_templates/edit-business.html', context)
@login_required @staff_login_required
def edit_staff(request, staff_id): def edit_staff(request, staff_id):
staff = get_object_or_404(StaffProfile, staff_id=staff_id) staff = get_object_or_404(StaffProfile, staff_id=staff_id)
positions = StaffPosition.objects.all().order_by('name') positions = StaffPosition.objects.all().order_by('name')
@ -148,7 +149,7 @@ def edit_staff(request, staff_id):
@login_required @staff_login_required
def edit_project(request, project_id): def edit_project(request, project_id):
project = get_object_or_404(Project, project_id=project_id) project = get_object_or_404(Project, project_id=project_id)
@ -210,7 +211,7 @@ def edit_project(request, project_id):
@login_required @staff_login_required
def edit_task(request, task_id): def edit_task(request, task_id):
task = get_object_or_404(Task, task_id=task_id) task = get_object_or_404(Task, task_id=task_id)
projects = Project.objects.all().order_by('-id') projects = Project.objects.all().order_by('-id')
@ -259,7 +260,7 @@ def edit_task(request, task_id):
@staff_login_required
def edit_task_status_modal(request, *, task_id): def edit_task_status_modal(request, *, task_id):
task = get_object_or_404(Task, task_id=task_id) task = get_object_or_404(Task, task_id=task_id)
@ -280,7 +281,7 @@ def edit_task_status_modal(request, *, task_id):
@login_required @staff_login_required
def edit_epic(request, *args, **kwargs): def edit_epic(request, *args, **kwargs):
context = { context = {
@ -290,7 +291,7 @@ def edit_epic(request, *args, **kwargs):
@login_required @staff_login_required
def edit_project_type(request, projecttype_id): def edit_project_type(request, projecttype_id):
projecttype = get_object_or_404(ProjectType, id=projecttype_id) projecttype = get_object_or_404(ProjectType, id=projecttype_id)
@ -304,7 +305,7 @@ def edit_project_type(request, projecttype_id):
return render(request, 'edit_templates/edit-project-type.html', {'projecttype': projecttype}) return render(request, 'edit_templates/edit-project-type.html', {'projecttype': projecttype})
@login_required @staff_login_required
def edit_staff_position(request): def edit_staff_position(request):
context = { context = {
@ -316,7 +317,7 @@ def edit_staff_position(request):
@login_required @staff_login_required
def edit_business_type(request, businesstype_id): def edit_business_type(request, businesstype_id):
businesstype = get_object_or_404(BusinessType, id=businesstype_id) businesstype = get_object_or_404(BusinessType, id=businesstype_id)
@ -330,7 +331,7 @@ def edit_business_type(request, businesstype_id):
return render(request, 'edit_templates/edit-business-type.html', {'businesstype': businesstype}) return render(request, 'edit_templates/edit-business-type.html', {'businesstype': businesstype})
@login_required @staff_login_required
def edit_reference(request, reference_id): def edit_reference(request, reference_id):
reference = get_object_or_404(Reference, id=reference_id) reference = get_object_or_404(Reference, id=reference_id)
@ -345,7 +346,7 @@ def edit_reference(request, reference_id):
@login_required @staff_login_required
def edit_tag(request, tag_id): def edit_tag(request, tag_id):
tag = get_object_or_404(Tag, id=tag_id) tag = get_object_or_404(Tag, id=tag_id)
@ -368,7 +369,7 @@ def edit_tag(request, tag_id):
#Mark points #Mark points
@login_required @staff_login_required
def mark_point_working_on(request, point_id, task_id): def mark_point_working_on(request, point_id, task_id):
task = get_object_or_404(Task, id=task_id) task = get_object_or_404(Task, id=task_id)
point = get_object_or_404(Point, id=point_id) point = get_object_or_404(Point, id=point_id)
@ -401,7 +402,7 @@ def mark_point_working_on(request, point_id, task_id):
@login_required @staff_login_required
def mark_point_working_on_task_page(request, point_id, task_id): def mark_point_working_on_task_page(request, point_id, task_id):
task = get_object_or_404(Task, id=task_id) task = get_object_or_404(Task, id=task_id)
point = get_object_or_404(Point, id=point_id) point = get_object_or_404(Point, id=point_id)
@ -431,7 +432,7 @@ def mark_point_working_on_task_page(request, point_id, task_id):
@login_required @staff_login_required
def mark_point_paused(request, point_id, task_id): def mark_point_paused(request, point_id, task_id):
task = get_object_or_404(Task, id=task_id) task = get_object_or_404(Task, id=task_id)
point = get_object_or_404(Point, id=point_id) point = get_object_or_404(Point, id=point_id)
@ -457,7 +458,7 @@ def mark_point_paused(request, point_id, task_id):
@login_required @staff_login_required
def mark_point_paused_task_page(request, point_id, task_id): def mark_point_paused_task_page(request, point_id, task_id):
task = get_object_or_404(Task, id=task_id) task = get_object_or_404(Task, id=task_id)
point = get_object_or_404(Point, id=point_id) point = get_object_or_404(Point, id=point_id)
@ -483,7 +484,7 @@ def mark_point_paused_task_page(request, point_id, task_id):
@login_required @staff_login_required
def mark_point_completed(request, point_id, task_id): def mark_point_completed(request, point_id, task_id):
task = get_object_or_404(Task, id=task_id) task = get_object_or_404(Task, id=task_id)
point = get_object_or_404(Point, id=point_id) point = get_object_or_404(Point, id=point_id)
@ -524,7 +525,7 @@ def mark_point_completed(request, point_id, task_id):
@login_required @staff_login_required
def mark_point_completed_task_page(request, point_id, task_id): def mark_point_completed_task_page(request, point_id, task_id):
task = get_object_or_404(Task, id=task_id) task = get_object_or_404(Task, id=task_id)
point = get_object_or_404(Point, id=point_id) point = get_object_or_404(Point, id=point_id)

Binary file not shown.

@ -1,4 +1,4 @@
{% extends "customer_dashboard/customer_main.html" %} {% extends "customer_main.html" %}
{%load static%} {%load static%}
{% block content %} {% block content %}

@ -0,0 +1,316 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %} Osina {% endblock %}</title>
<link rel="stylesheet" type="text/css" href='{% static "dist/output.css" %}'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body class="bg-gray-200">
<div class="w-full flex">
<!-- FIXED SIDE NAVBAR -->
<div class="fixed h-screen w-[300px] bg-osiblue pt-9 flex flex-col justify-between flex-grow overflow-y-auto fixedSideHeader"
id="fixedSideHeader">
<!-- Menu Items -->
<div>
<a href="{% url 'home' %}">
<div class="mb-10 w-full flex justify-center">
<img src="{% static 'images/osinaw.png' %}" class="w-[180px]">
</div>
</a>
<div class="w-full px-3 relative">
<input type="text"
class="w-full bg-transparent border border-white border-opacity-10 py-2 px-3 text-white outline-none rounded-md"
placeholder="Search...">
<div class="inset-y-0 absolute right-5 flex justify-center items-center text-white">
<i class="fa fa-search"></i>
</div>
</div>
<div
class="w-full flex flex-col items-center px-5 h-[400px] xxlg1:h-[500px] overflow-hidden overflow-y-auto mt-5">
<div class="w-full flex justify-start items-center gap-3 border-b border-slate-600 py-3">
<img src="{% static 'images/icons/projectswhite.svg' %}" class="w-[28px]">
<p class="text-white">My Projects</p>
</div>
<div class="w-full flex justify-start items-center gap-3 border-b border-slate-600 py-3">
<img src="{% static 'images/icons/ticket.svg' %}" src="" class="w-[30px]">
<p class="text-white">Tickets</p>
</div>
<div class="w-full flex justify-start items-center gap-3 border-b border-slate-600 py-3">
<img src="{% static 'images/icons/invoice.svg' %}" src="" class="w-[30px]">
<p class="text-white">Invoices</p>
</div>
<div class="w-full flex justify-start items-center gap-3 border-b border-slate-600 py-3">
<img src="{% static 'images/icons/products.svg' %}" class="w-[30px]">
<p class="text-white">Products</p>
</div>
<div class="w-full flex justify-start items-center gap-3 border-b border-slate-600 py-3">
<img src="{% static 'images/icons/about.svg' %}" class="w-[30px]">
<p class="text-white">Knowledgebase</p>
</div>
<div class="w-full flex justify-start items-center gap-3 py-3">
<img src="{% static 'images/icons/support.svg' %}" class="w-[30px]">
<p class="text-white">Contact Us</p>
</div>
</div>
</div>
<!-- Footer -->
<div
class="w-full xlg1:w-[300px] h-fit bg-secondosiblue flex flex-col items-center absolute xlg1:fixed justify-center gap-2 py-2 bottom-0 inset-x-0 mt-[100px]">
<div class="w-full flex flex-col justify-center gap-1 items-center">
<div class="flex justify-center items-center gap-1">
<img src="{% static 'images/banner-logo.png' %}" alt="Ositcom Logo" class="w-[30px] h-[25px]">
<p class="text-gray-200 font-light text-xs">Powered By OSITCOM</p>
</div>
<p class="text-gray-200 font-light text-xs">Copyrights © 2024 All Rights Reserved</p>
</div>
</div>
</div>
<!-- MOBILE FIXED SIDE BAR -->
<div class="w-full h-[100vh] absolute bg-black bg-opacity-40 z-50 mt-[80px] mobileFixedSideHeader hidden">
<div class="w-[70%] h-full bg-osiblue flex flex-col gap-3 relative">
<div class="w-full">
<!-- USER PROFILE -->
<div class="w-full flex justify-start items-center gap-2 cursor-pointer border border-white border-opacity-10 py-2 px-3 duration-300 bg-secondosiblue"
id="mobileUserProfile">
<div>
<div
class="w-[40px] h-[40px] border border-osiblue bg-osiblue text-white uppercase rounded-full flex justify-center items-center p-1 shadow-md">
{{ request.user.first_name.0 }}{{ request.user.last_name.0 }}
</div>
</div>
<div class="w-full flex justify-between items-center gap-2 text-white py-3">
<p>{{request.user.first_name}} {{request.user.last_name}}</p>
<i class="fa fa-angle-down"></i>
<i class="fa fa-angle-up" style="display: none;"></i>
</div>
</div>
<!-- USER PROFILE DROPDOWN -->
<div class="w-full h-fit bg-secondosiblue px-5 flex flex-col hidden" id="mobileUserProfileDropdown">
<a href="{% url 'signout' %}" class="w-full">
<div class="w-full py-3 flex items-center gap-2 text-white text-[16px]">
<img src="{% static 'images/icons/logout.png' %}" class="w-[22px]">
<p>Logout</p>
</div>
</a>
</div>
</div>
<!-- MOBILE MENU ITEMS -->
<div class="w-full flex flex-col items-center px-3 h-[400px] overflow-hidden overflow-y-auto">
<div class="w-full">
<div class="w-full flex justify-between items-center border-b border-slate-600 py-3">
<div class="w-full flex justify-start items-center gap-3">
<img src="" class="w-[30px]">
<p class="text-white">My Projects</p>
</div>
</div>
</div>
<div class="w-full">
<div class="w-full flex justify-between items-center border-b border-slate-600 py-3">
<div class="w-full flex justify-start items-center gap-3">
<img src="" class="w-[30px]">
<p class="text-white">Tickets</p>
</div>
</div>
</div>
<div class="w-full">
<div class="w-full flex justify-between items-center border-b border-slate-600 py-3">
<div class="w-full flex justify-start items-center gap-3">
<img src="" class="w-[30px]">
<p class="text-white">Invoices</p>
</div>
</div>
</div>
<div class="w-full">
<div class="w-full flex justify-between items-center border-b border-slate-600 py-3">
<div class="w-full flex justify-start items-center gap-3">
<img src="" class="w-[30px]">
<p class="text-white">Products</p>
</div>
</div>
</div>
<div class="w-full">
<div class="w-full flex justify-between items-center border-b border-slate-600 py-3">
<div class="w-full flex justify-start items-center gap-3">
<img src="" class="w-[30px]">
<p class="text-white">Knowledgebase</p>
</div>
</div>
</div>
<div class="w-full">
<div class="w-full flex justify-between items-center border-b border-slate-600 py-3">
<div class="w-full flex justify-start items-center gap-3">
<img src="" class="w-[30px]">
<p class="text-white">Contact Us</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- SCROLL PART -->
<div class="flex-1 ml-[300px] h-fit bg-gray-200" id="scrollPart">
<!-- TOP HEADER -->
<div
class="w-full h-[100px] bg-white shadow-md px-5 s:px-9 py-5 flex justify-between items-center topHeader">
<div class="w-fit flex justify-center items-center gap-10">
<div class="w-fit flex flex-col gap-2 cursor-pointer" id="burgerMenuButton">
<div class="burgerMenuLine w-[25px] h-[2px] bg-osiblue duration-300"></div>
<div class="burgerMenuLine w-[25px] h-[2px] bg-osiblue duration-300"></div>
<div class="burgerMenuLine w-[25px] h-[2px] bg-osiblue duration-300"></div>
</div>
</div>
<div class="relative">
<div class="w-fit flex justify-between items-center gap-2 cursor-pointer hover:bg-gray-50 rounded-md hover:p-2 duration-300"
id="userProfile">
<div
class="w-[40px] h-[40px] border border-osiblue bg-osiblue text-white uppercase rounded-full flex justify-center items-center p-1 shadow-md">
{{ request.user.first_name.0 }}{{ request.user.last_name.0 }}
</div>
<div class="flex justify-center items-center gap-2 text-gray-500">
<p>{{request.user.first_name}} {{request.user.last_name}}</p>
<i class="fa fa-angle-down" id="arrowDown"></i>
<i class="fa fa-angle-up" style="display: none;" id="arrowUp"></i>
</div>
</div>
<!-- USER PROFILE DROPDOWN -->
<div class="w-[250px] h-fit bg-osiblue bg-opacity-70 rounded-md shadow-md px-3 absolute right-0 mt-3 flex flex-col"
style="display: none;" id="userProfileDropdown">
<a href="{% url 'signout' %}" class="w-full">
<div
class="w-full py-3 flex items-center gap-2 text-white hover:text-osiblue duration-300 cursor-pointer">
<img src="{% static 'images/icons/logout.png' %}" class="w-[22px]">
<p>Logout</p>
</div>
</a>
</div>
</div>
</div>
<!-- MOBILE TOP HEADER -->
<div
class="w-full h-[80px] bg-osiblue shadow-md px-5 s:px-9 py-5 flex xlg1:hidden justify-between items-center mobileTopHeader">
<a href="{% url 'home' %}">
<img src="{% static 'images/osinaw.png' %}" class="w-[130px] h-auto">
</a>
<div class="w-fit flex flex-col gap-2 cursor-pointer" id="mobileBurgerMenuButton">
<div class="w-[25px] h-[2px] bg-white duration-300"></div>
<div class="w-[25px] h-[2px] bg-white duration-300"></div>
<div class="w-[25px] h-[2px] bg-white duration-300"></div>
</div>
<div class="w-fit cursor-pointer hidden" id="mobileCloseMenuButton">
<img src="{% static 'images/closeicon.png' %}" class="w-[25px]">
</div>
</div>
{% 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">
<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">
<p class="text-[22px] text-secondosiblue font-poppinsBold uppercase">Invoices</p>
<img src="{% static 'images/icons/tasks.png' %}" class="w-[50px]">
</div>
<div
class="w-[60px] h-[60px] bg-white border-2 rounded-full border-secondosiblue flex justify-center items-center">
<p class="text-secondosiblue text-xl font-semibold">2</p>
</div>
</div>
</div>
<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">
<p class="text-[22px] text-secondosiblue font-poppinsBold uppercase">Projects</p>
<img src="{% static 'images/icons/projects.png' %}" class="w-[50px]">
</div>
<div
class="w-[60px] h-[60px] bg-white border-2 rounded-full border-secondosiblue flex justify-center items-center">
<p class="text-secondosiblue text-xl font-semibold">2</p>
</div>
</div>
</div>
<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">
<p class="text-[22px] text-secondosiblue font-poppinsBold uppercase">Tickets</p>
<img src="{% static 'images/icons/tickets.png' %}" class="w-[50px]">
</div>
<div
class="w-[60px] h-[60px] bg-white border-2 rounded-full border-secondosiblue flex justify-center items-center">
<p class="text-secondosiblue text-xl font-semibold">2</p>
</div>
</div>
</div>
</div>
{% endblock modules_section %}
{% block content %}
replace me
{% endblock content %}
<!-- MOBILE FOOTER -->
<div class="bg-osiblue h-fit py-2 mobileFooter">
<div class="w-full flex flex-col justify-center items-center gap-1">
<div class="flex justify-center items-center gap-2">
<img src="{% static 'images/banner-logo.png' %}" alt="Ositcom Logo" class="w-[30px] h-[25px]">
<p class="text-gray-200 font-light text-xs">Powered By OSITCOM</p>
</div>
<p class="text-gray-200 font-light text-xs">Copyrights © 2024 All Rights Reserved</p>
</div>
</div>
</div>
</div>
<!---------------------- JS SCRIPTS -------------------->
<!-- SIDE BAR SCRIPT -->
<script type="text/javascript" src='{% static "js/side-bar.js" %}'></script>
</body>
</html>

@ -72,12 +72,6 @@ urlpatterns = [
path('add_reaction/<int:status_id>/<str:emoji>/', views.add_reaction, name='add_reaction'), path('add_reaction/<int:status_id>/<str:emoji>/', views.add_reaction, name='add_reaction'),
#CUSTOMER DASHBOARD
path('customerdashboard/', views.customer_index, name='customerdashboard'),
path('customerinvoices/', views.customer_invoices, name='customerinvoices'),
path('customerproducts/', views.customer_products, name='customerproducts'),
path('pricing/', views.pricing, name='pricing'),
path('initiate_checkout/', views.initiate_checkout, name='initiatecheckout'),
] ]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

@ -10,24 +10,26 @@ from django.http import JsonResponse
from .models import Task, Epic from .models import Task, Epic
from django.template.loader import render_to_string from django.template.loader import render_to_string
from .custom_context import calculate_time_ago from .custom_context import calculate_time_ago
import requests
from django.core.validators import validate_email from django.core.validators import validate_email
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.template.loader import get_template
from .decorators import *
def login_with_email(request, email): def login_with_email(request, email):
user = User.objects.filter(email=email).first() user = User.objects.filter(email=email).first()
if user is not None: if user is not None:
login(request, user) login(request, user)
return redirect('customerdashboard') return redirect('home')
else: else:
return render(request, 'lsogin.html') return render(request, 'login.html')
# Pages views # Pages views
def signin(request): def signin(request):
if request.user.is_authenticated: if request.user.is_authenticated:
return redirect('home') if StaffProfile.objects.filter(user=request.user) or CustomerProfile.objects.filter(user=request.user):
return redirect('home')
if request.method == 'POST': if request.method == 'POST':
form = CustomLoginForm(request.POST) form = CustomLoginForm(request.POST)
@ -46,10 +48,7 @@ def signin(request):
if user is not None: if user is not None:
login(request, user) login(request, user)
Connection.objects.create(status='Online', date=datetime.now(), user=user) Connection.objects.create(status='Online', date=datetime.now(), user=user)
if CustomerProfile.objects.filter(user=user): return redirect('home')
return redirect('customerdashboard')
else:
return redirect('home')
else: else:
form.add_error(None, 'Invalid email or password. Please try again.') form.add_error(None, 'Invalid email or password. Please try again.')
@ -76,28 +75,36 @@ def go_online(request):
@login_required @login_required
def home(request, *args, **kwargs): def home(request, *args, **kwargs):
notes = Note.objects.filter(user=request.user).order_by('-date')[:6] if StaffProfile.objects.filter(user=request.user):
recent_note = Note.objects.filter(user=request.user).last() notes = Note.objects.filter(user=request.user).order_by('-date')[:6]
recent_note = Note.objects.filter(user=request.user).last()
if request.user.is_superuser:
# Superadmin can see the last 8 tasks for all users
tasks = Task.objects.filter(Q(status='Open') | Q(status='Working On')).order_by('-status_date', '-id')[:8]
else:
# Non-superadmin user can only see their assigned tasks
tasks = Task.objects.filter(Q(assigned_to=request.user.staffprofile) & (Q(status='Open') | Q(status='Working On'))).order_by('-status_date', '-id')
context = {
'notes': notes,
'recent_note': recent_note,
'tasks': tasks,
}
return render(request, 'index.html', context)
if request.user.is_superuser:
# Superadmin can see the last 8 tasks for all users
tasks = Task.objects.filter(Q(status='Open') | Q(status='Working On')).order_by('-status_date', '-id')[:8]
else: else:
# Non-superadmin user can only see their assigned tasks context = {
tasks = Task.objects.filter(Q(assigned_to=request.user.staffprofile) & (Q(status='Open') | Q(status='Working On'))).order_by('-status_date', '-id') }
template = get_template('customer_index.html')
return HttpResponse(template.render(context, request))
context = {
'notes': notes,
'recent_note': recent_note,
'tasks': tasks,
}
return render(request, 'index.html', context)
@staff_login_required
def status_mobile_modal (request, *args, **kwargs): def status_mobile_modal (request, *args, **kwargs):
context = { context = {
@ -105,7 +112,7 @@ def status_mobile_modal (request, *args, **kwargs):
return render(request, 'details_templates/status-on-mobile-modal.html', context) return render(request, 'details_templates/status-on-mobile-modal.html', context)
@staff_login_required
def user_recent_activities_modal(request, user_id): def user_recent_activities_modal(request, user_id):
current_time = timezone.now() current_time = timezone.now()
@ -135,7 +142,7 @@ def user_recent_activities_modal(request, user_id):
@login_required @staff_login_required
def customers(request, *args, **kwargs): def customers(request, *args, **kwargs):
customers = CustomerProfile.objects.all().order_by('-customer_id') customers = CustomerProfile.objects.all().order_by('-customer_id')
@ -146,7 +153,7 @@ def customers(request, *args, **kwargs):
return render(request, 'listing_pages/customers.html', context) return render(request, 'listing_pages/customers.html', context)
@login_required @staff_login_required
def businesses(request): def businesses(request):
businesses = Business.objects.all().order_by('-business_id') businesses = Business.objects.all().order_by('-business_id')
context = { context = {
@ -155,7 +162,7 @@ def businesses(request):
} }
return render(request, 'listing_pages/businesses.html', context) return render(request, 'listing_pages/businesses.html', context)
@login_required @staff_login_required
def staffs(request): def staffs(request):
staffs = StaffProfile.objects.all().order_by('-staff_id') staffs = StaffProfile.objects.all().order_by('-staff_id')
@ -168,8 +175,7 @@ def staffs(request):
@staff_login_required
@login_required
def my_projects(request, *args, **kwargs): def my_projects(request, *args, **kwargs):
user = request.user user = request.user
@ -210,9 +216,7 @@ def my_projects(request, *args, **kwargs):
@staff_login_required
@login_required
def my_tasks(request, *args, **kwargs): def my_tasks(request, *args, **kwargs):
if request.user.is_superuser: if request.user.is_superuser:
# Superadmin can see all projects # Superadmin can see all projects
@ -229,7 +233,7 @@ def my_tasks(request, *args, **kwargs):
@login_required @staff_login_required
def my_notes(request): def my_notes(request):
my_notes = Note.objects.filter(user=request.user).order_by('-id') my_notes = Note.objects.filter(user=request.user).order_by('-id')
@ -241,6 +245,8 @@ def my_notes(request):
return render(request, 'listing_pages/notes.html', context) return render(request, 'listing_pages/notes.html', context)
@staff_login_required
def daily_reports(request): def daily_reports(request):
user = request.user user = request.user
@ -256,7 +262,7 @@ def daily_reports(request):
@login_required @staff_login_required
def project_types(request): def project_types(request):
projecttypes = ProjectType.objects.all().order_by('-id') projecttypes = ProjectType.objects.all().order_by('-id')
@ -267,7 +273,7 @@ def project_types(request):
@login_required @staff_login_required
def staff_positions(request): def staff_positions(request):
staffpositions = StaffPosition.objects.all().order_by('-id') staffpositions = StaffPosition.objects.all().order_by('-id')
@ -281,7 +287,7 @@ def staff_positions(request):
return render(request, 'listing_pages/staff-positions.html', context) return render(request, 'listing_pages/staff-positions.html', context)
@login_required @staff_login_required
def business_types(request): def business_types(request):
businesstypes = BusinessType.objects.all().order_by('-id') businesstypes = BusinessType.objects.all().order_by('-id')
@ -291,7 +297,7 @@ def business_types(request):
return render(request, 'listing_pages/business-types.html', context) return render(request, 'listing_pages/business-types.html', context)
@login_required @staff_login_required
def references(request): def references(request):
references = Reference.objects.all().order_by('-id') references = Reference.objects.all().order_by('-id')
@ -303,7 +309,7 @@ def references(request):
return render(request, 'listing_pages/references.html', context) return render(request, 'listing_pages/references.html', context)
@login_required @staff_login_required
def tags(request): def tags(request):
tags = Tag.objects.all().order_by('-id') tags = Tag.objects.all().order_by('-id')
@ -322,7 +328,7 @@ def tags(request):
#Details #Details
@login_required @staff_login_required
def customerdetails(request, customer_id): def customerdetails(request, customer_id):
customer = get_object_or_404(CustomerProfile, customer_id=customer_id) customer = get_object_or_404(CustomerProfile, customer_id=customer_id)
context = { context = {
@ -331,7 +337,7 @@ def customerdetails(request, customer_id):
} }
return render(request, 'details_templates/customer-details.html', context) return render(request, 'details_templates/customer-details.html', context)
@login_required @staff_login_required
def businessdetails(request, business_id): def businessdetails(request, business_id):
business = get_object_or_404(Business, business_id=business_id) business = get_object_or_404(Business, business_id=business_id)
context = { context = {
@ -340,7 +346,7 @@ def businessdetails(request, business_id):
} }
return render(request, 'details_templates/business-details.html', context) return render(request, 'details_templates/business-details.html', context)
@login_required @staff_login_required
def staffdetails( request, staff_id): def staffdetails( request, staff_id):
staff = get_object_or_404(StaffProfile, staff_id=staff_id) staff = get_object_or_404(StaffProfile, staff_id=staff_id)
@ -350,7 +356,7 @@ def staffdetails( request, staff_id):
return render(request, 'details_templates/staff-details.html', context) return render(request, 'details_templates/staff-details.html', context)
@login_required @staff_login_required
def taskdetails(request, task_id): def taskdetails(request, task_id):
task = get_object_or_404(Task, task_id=task_id) task = get_object_or_404(Task, task_id=task_id)
points = Point.objects.filter(task=task).order_by('-id') points = Point.objects.filter(task=task).order_by('-id')
@ -364,6 +370,7 @@ def taskdetails(request, task_id):
return render(request, 'details_templates/task-details.html', context) return render(request, 'details_templates/task-details.html', context)
@staff_login_required
def show_points_modal(request, task_id): def show_points_modal(request, task_id):
task = get_object_or_404(Task, task_id=task_id) task = get_object_or_404(Task, task_id=task_id)
points = Point.objects.filter(task=task).order_by('-id') points = Point.objects.filter(task=task).order_by('-id')
@ -375,9 +382,7 @@ def show_points_modal(request, task_id):
return render(request, 'details_templates/showpoints-modal.html', context) return render(request, 'details_templates/showpoints-modal.html', context)
@staff_login_required
def timeline_modal(request, task_id): def timeline_modal(request, task_id):
task = Task.objects.get(task_id=task_id) task = Task.objects.get(task_id=task_id)
point_activities = PointActivity.objects.filter(point__task=task) point_activities = PointActivity.objects.filter(point__task=task)
@ -412,7 +417,7 @@ def timeline_modal(request, task_id):
@login_required @staff_login_required
def projectdetails(request, project_id): def projectdetails(request, project_id):
project = get_object_or_404(Project, project_id=project_id) project = get_object_or_404(Project, project_id=project_id)
epics = Epic.objects.filter(project=project).order_by('-id') epics = Epic.objects.filter(project=project).order_by('-id')
@ -439,6 +444,7 @@ def projectdetails(request, project_id):
#FETCH EPIC RELATED TASKS #FETCH EPIC RELATED TASKS
@staff_login_required
def get_tasks(request, epic_id): def get_tasks(request, epic_id):
epic = get_object_or_404(Epic, id=epic_id) epic = get_object_or_404(Epic, id=epic_id)
related_tasks = Task.objects.filter(epic=epic).order_by('-id') related_tasks = Task.objects.filter(epic=epic).order_by('-id')
@ -452,6 +458,7 @@ def get_tasks(request, epic_id):
# TO DISPALY ALL THE OPEN TASKS OF THIS PROJECT # TO DISPALY ALL THE OPEN TASKS OF THIS PROJECT
@staff_login_required
def open_tasks_for_project(request, project_id): def open_tasks_for_project(request, project_id):
project = Project.objects.get(pk=project_id) project = Project.objects.get(pk=project_id)
open_tasks = Task.objects.filter(project=project, status='Open').order_by('-id') open_tasks = Task.objects.filter(project=project, status='Open').order_by('-id')
@ -466,6 +473,7 @@ def open_tasks_for_project(request, project_id):
# TO FETCH THE EPICS OF THE SELECTED PROJECT WHEN EDITING A TASK # TO FETCH THE EPICS OF THE SELECTED PROJECT WHEN EDITING A TASK
@staff_login_required
def fetch_epics(request): def fetch_epics(request):
project_id = request.GET.get('project_id') project_id = request.GET.get('project_id')
epics = Epic.objects.filter(project_id=project_id).values('id', 'title') epics = Epic.objects.filter(project_id=project_id).values('id', 'title')
@ -474,6 +482,7 @@ def fetch_epics(request):
# TO UPDATE THE STATUS CONTAINER # TO UPDATE THE STATUS CONTAINER
@staff_login_required
def get_updated_last_status(request): def get_updated_last_status(request):
if request.user.is_authenticated: if request.user.is_authenticated:
last_status = Status.objects.filter(staff=request.user.staffprofile).last() last_status = Status.objects.filter(staff=request.user.staffprofile).last()
@ -507,6 +516,7 @@ def get_updated_last_status(request):
# TO GET USER ACTIVITIES # TO GET USER ACTIVITIES
@staff_login_required
def get_latest_activities(request): def get_latest_activities(request):
latest_connections = Connection.objects.filter( latest_connections = Connection.objects.filter(
user__staffprofile__isnull=False user__staffprofile__isnull=False
@ -555,6 +565,7 @@ def get_latest_activities(request):
return HttpResponse(recent_activities) return HttpResponse(recent_activities)
@staff_login_required
def recent_activities_page(request): def recent_activities_page(request):
context = { context = {
@ -564,6 +575,7 @@ def recent_activities_page(request):
return render(request, 'recent-activities-page.html', context) return render(request, 'recent-activities-page.html', context)
@staff_login_required
def add_reaction(request, status_id, emoji): def add_reaction(request, status_id, emoji):
status = get_object_or_404(Status, pk=status_id) status = get_object_or_404(Status, pk=status_id)
user = request.user user = request.user
@ -577,112 +589,3 @@ def add_reaction(request, status_id, emoji):
# If the user hasn't reacted yet, create a new reaction # If the user hasn't reacted yet, create a new reaction
new_reaction = Reaction.objects.create(status=status, emoji=emoji, user=user) new_reaction = Reaction.objects.create(status=status, emoji=emoji, user=user)
return JsonResponse({'message': 'Reaction added successfully.'}) return JsonResponse({'message': 'Reaction added successfully.'})
# CUSTOMER DASHBOARD
# LISTING PAGES
@login_required
def customer_index(request, *args, **kwargs):
context = {
}
return render(request, 'customer_dashboard/customer_index.html', context)
@login_required
def customer_invoices(request, *args, **kwargs):
context = {
}
return render(request, 'customer_dashboard/listing_pages/customer-invoices.html', context)
@login_required
def customer_products(request, *args, **kwargs):
context = {
}
return render(request, 'customer_dashboard/listing/customer-products.html', context)
@login_required
def pricing(request, *args, **kwargs):
context = {
}
return render(request, 'customer_dashboard/pricing.html', context)
@login_required
def customer_products(request, *args, **kwargs):
context = {
}
return render(request, 'customer_dashboard/listing/payment.html', context)
def initiate_checkout(request):
# Your Mastercard API credentials
api_username = "merchant.TEST06127800"
api_password = "37846250a67c70e7fe9f82cf6ca81f93"
merchant_id = "TEST06127800"
merchant_name = "Ositcom Sal"
# Data for Initiate Checkout operation
data = {
"apiOperation": "INITIATE_CHECKOUT",
"apiUsername": api_username,
"apiPassword": api_password,
"merchant": merchant_id,
"interaction.operation": "PURCHASE",
"interaction.merchant.name": merchant_name,
"order.id": "123",
"order.amount": "100.00",
"order.currency": "USD",
"order.description": "description_of_order"
}
try:
response = requests.post("https://creditlibanais-netcommerce.gateway.mastercard.com/api/nvp/version/72", data=data)
print("Response Content:", response.content.decode()) # Print response content
if response.status_code == 200:
response_data = response.text
parsed_data = dict(item.split("=") for item in response_data.split("&"))
session_id = parsed_data.get("session.id")
success_indicator = parsed_data.get("successIndicator")
return JsonResponse({"session_id": session_id, "success_indicator": success_indicator})
else:
print("Response Status Code:", response.status_code) # Print status code
return JsonResponse({"error": "Failed to initiate checkout"}, status=500)
except Exception as e:
print("Exception:", e) # Print exception traceback
return JsonResponse({"error": "Internal Server Error"}, status=500)

@ -42,6 +42,7 @@ LOGIN_URL = 'signin'
INSTALLED_APPS = [ INSTALLED_APPS = [
'rest_framework', 'rest_framework',
'osinacore', 'osinacore',
'customercore',
'addressbook', 'addressbook',
'billing', 'billing',
'colorfield', 'colorfield',
@ -68,7 +69,10 @@ ROOT_URLCONF = 'osinaweb.urls'
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates'), os.path.join(BASE_DIR, 'osinacore', 'templates'),], 'DIRS': [
os.path.join(BASE_DIR, 'osinacore', 'templates'),
os.path.join(BASE_DIR, 'customercore', 'templates'),
],
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [

@ -21,6 +21,7 @@ from django.conf import settings
urlpatterns = [ urlpatterns = [
# Pages urls # Pages urls
path('', include('osinacore.urls')), path('', include('osinacore.urls')),
path('', include('customercore.urls')),
path('', include('billing.urls')), path('', include('billing.urls')),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),

Loading…
Cancel
Save