diff --git a/.DS_Store b/.DS_Store index 9aa77fe2..a6aaa87d 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/osinaweb/.DS_Store b/osinaweb/.DS_Store index 0627f6a2..caeca3b7 100644 Binary files a/osinaweb/.DS_Store and b/osinaweb/.DS_Store differ diff --git a/osinaweb/billing/.DS_Store b/osinaweb/billing/.DS_Store index a7b7da6a..7820bbd8 100644 Binary files a/osinaweb/billing/.DS_Store and b/osinaweb/billing/.DS_Store differ diff --git a/osinaweb/billing/__pycache__/admin.cpython-310.pyc b/osinaweb/billing/__pycache__/admin.cpython-310.pyc index f5e7768e..421a0ef4 100644 Binary files a/osinaweb/billing/__pycache__/admin.cpython-310.pyc and b/osinaweb/billing/__pycache__/admin.cpython-310.pyc differ diff --git a/osinaweb/billing/__pycache__/models.cpython-310.pyc b/osinaweb/billing/__pycache__/models.cpython-310.pyc index b9bacdf7..747080e5 100644 Binary files a/osinaweb/billing/__pycache__/models.cpython-310.pyc and b/osinaweb/billing/__pycache__/models.cpython-310.pyc differ diff --git a/osinaweb/billing/__pycache__/urls.cpython-310.pyc b/osinaweb/billing/__pycache__/urls.cpython-310.pyc index 086f52c5..284cf672 100644 Binary files a/osinaweb/billing/__pycache__/urls.cpython-310.pyc and b/osinaweb/billing/__pycache__/urls.cpython-310.pyc differ diff --git a/osinaweb/billing/__pycache__/views.cpython-310.pyc b/osinaweb/billing/__pycache__/views.cpython-310.pyc index 1d6101b5..ad7fcc94 100644 Binary files a/osinaweb/billing/__pycache__/views.cpython-310.pyc and b/osinaweb/billing/__pycache__/views.cpython-310.pyc differ diff --git a/osinaweb/billing/add/__pycache__/urls.cpython-310.pyc b/osinaweb/billing/add/__pycache__/urls.cpython-310.pyc index 6a160483..72e069af 100644 Binary files a/osinaweb/billing/add/__pycache__/urls.cpython-310.pyc and b/osinaweb/billing/add/__pycache__/urls.cpython-310.pyc differ diff --git a/osinaweb/billing/add/__pycache__/views.cpython-310.pyc b/osinaweb/billing/add/__pycache__/views.cpython-310.pyc index bfc0eeb9..1e22a89b 100644 Binary files a/osinaweb/billing/add/__pycache__/views.cpython-310.pyc and b/osinaweb/billing/add/__pycache__/views.cpython-310.pyc differ diff --git a/osinaweb/billing/add/urls.py b/osinaweb/billing/add/urls.py index 211da872..8639b6a7 100644 --- a/osinaweb/billing/add/urls.py +++ b/osinaweb/billing/add/urls.py @@ -6,11 +6,14 @@ urlpatterns = [ path('product', views.add_product, name='addproduct'), path('service', views.add_service, name='addservice'), path('order//', views.add_order, name='addorder'), - path('invoice//', views.add_invoice_pdf, name='addinvoice'), - path('payment//', views.add_payment_pdf, name='addpayment'), + 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'), - path('add_payment_comment', views.add_payment_comment_modal, name='add_payment_comment_modal'), - path('add_payment', views.add_payment_modal, name='add_payment_modal'), + path('payment_method_modal/', views.add_payment_method_modal, name='add_payment_method_modal'), + 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 919cfacb..3db2c169 100644 --- a/osinaweb/billing/add/views.py +++ b/osinaweb/billing/add/views.py @@ -82,8 +82,8 @@ def add_order(request, customer_id): services = Item.objects.filter(Q(type='Service') & (Q(customer=customer) | Q(customer__isnull=True))) if request.method == 'POST': - status = request.POST.get('status') business_id = request.POST.get('business') + date = request.POST.get('date') if business_id: business = get_object_or_404(Business, id=business_id) else: @@ -92,10 +92,20 @@ def add_order(request, customer_id): order = Order.objects.create( customer=customer, - status=status, business=business, + date=date ) - return redirect('orderdetails', order_id=order.id) + + selected_services_ids = request.POST.getlist('service') + for service_id in selected_services_ids: + service = get_object_or_404(Item, id=service_id) + order_item = OrderItem.objects.create( + order=order, + item=service, + purchased_at=datetime.now() + ) + + return redirect('orderdetails', order_id=order.order_id) context = { 'customer' : customer, @@ -118,28 +128,87 @@ def add_service_in_order(request, service_id, order_id): purchased_at = datetime.now() ) order_item.save() - return redirect('orderdetails', order_id=order.id) + return redirect('orderdetails', order_id=order.order_id) + @staff_login_required -def add_payment_comment_modal(request): +def add_payment_method_modal(request, *args, **kwargs): + if request.method == 'POST': + name = request.POST.get('name') + description = request.POST.get('description') + image = request.FILES.get('image') + + payment_method = PaymentType( + name = name, + description = description, + image = image + ) + payment_method.save() + + # Reload the parent page + return HttpResponse('') + return render(request, 'add_templates/add-payment-method-modal.html') + - context = { + +@staff_login_required +def add_payment_modal(request, order_id): + order = get_object_or_404(Order, id=order_id) + methods = PaymentType.objects.all().order_by('name') + if request.method == 'POST': + amount = request.POST.get('amount') + + if request.POST.get('date_paid'): + date_paid = request.POST.get('date_paid') + else: + date_paid = None + + if request.POST.get('date_due'): + date_due = request.POST.get('date_due') + else: + date_due = None + + comment = request.POST.get('comment') + selected_methods = request.POST.getlist('methods') + + payment = OrderPayment( + order = order, + amount = amount, + date_paid = date_paid, + date_due = date_due, + comment = comment + ) + payment.save() + + for method_id in selected_methods: + method = get_object_or_404(PaymentType, id=method_id) + payment.type.add(method) + + + # Reload the parent page + return HttpResponse('') + + context = { + 'methods': methods, + 'order': order } - return render(request, 'add_templates/add-payment-comment-modal.html', context) + return render(request, 'add_templates/add-payment-modal.html', context) + + @staff_login_required -def add_payment_modal(request): +def add_payment_comment_modal(request): context = { } - return render(request, 'add_templates/add-payment-modal.html', context) + return render(request, 'add_templates/add-payment-comment-modal.html', context) @@ -206,6 +275,10 @@ def add_invoice_pdf(request, order_id): 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 @@ -213,7 +286,7 @@ def add_payment_pdf(request, order_id): 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}) + 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}" @@ -249,5 +322,3 @@ def add_payment_pdf(request, order_id): - - diff --git a/osinaweb/billing/admin.py b/osinaweb/billing/admin.py index 3005339d..07960f29 100644 --- a/osinaweb/billing/admin.py +++ b/osinaweb/billing/admin.py @@ -6,6 +6,7 @@ from .models import * admin.site.register(RecurringCycle) admin.site.register(Item) admin.site.register(Order) +admin.site.register(OrderStatus) admin.site.register(OrderItem) admin.site.register(Invoice) admin.site.register(OrderPayment) diff --git a/osinaweb/billing/delete/__pycache__/urls.cpython-310.pyc b/osinaweb/billing/delete/__pycache__/urls.cpython-310.pyc index 812e90e6..02351a64 100644 Binary files a/osinaweb/billing/delete/__pycache__/urls.cpython-310.pyc and b/osinaweb/billing/delete/__pycache__/urls.cpython-310.pyc differ diff --git a/osinaweb/billing/delete/__pycache__/views.cpython-310.pyc b/osinaweb/billing/delete/__pycache__/views.cpython-310.pyc index 773248f8..22766744 100644 Binary files a/osinaweb/billing/delete/__pycache__/views.cpython-310.pyc and b/osinaweb/billing/delete/__pycache__/views.cpython-310.pyc differ diff --git a/osinaweb/billing/delete/urls.py b/osinaweb/billing/delete/urls.py index a81943e8..6fee66d8 100644 --- a/osinaweb/billing/delete/urls.py +++ b/osinaweb/billing/delete/urls.py @@ -3,5 +3,6 @@ from billing.delete import views urlpatterns = [ - path('orderitem/', views.delete_orderitem, name='deleteorderitem'), + path('orderitem//', views.delete_orderitem, name='deleteorderitem'), + path('paymentmethod//', views.delete_payment_method_modal, name='deletepaymentmethodmodal') ] diff --git a/osinaweb/billing/delete/views.py b/osinaweb/billing/delete/views.py index 4e927fbe..f9fce538 100644 --- a/osinaweb/billing/delete/views.py +++ b/osinaweb/billing/delete/views.py @@ -6,6 +6,22 @@ from osinacore.decorators import * @staff_login_required def delete_orderitem(request, orderitem_id): order_item = get_object_or_404(OrderItem, id=orderitem_id) - order_id = order_item.order.id + order_id = order_item.order.order_id order_item.delete() return redirect('orderdetails', order_id=order_id) + + +@staff_login_required +def delete_payment_method_modal(request, method_id): + method = get_object_or_404(PaymentType, id=method_id) + if request.method == 'POST': + method.delete() + return redirect('paymentmethods') + + + context = { + 'method': method + } + + return render(request, "delete_templates/delete-payment-method-modal.html", context) + diff --git a/osinaweb/billing/edit/__pycache__/urls.cpython-310.pyc b/osinaweb/billing/edit/__pycache__/urls.cpython-310.pyc index e2f6db77..8f83279a 100644 Binary files a/osinaweb/billing/edit/__pycache__/urls.cpython-310.pyc and b/osinaweb/billing/edit/__pycache__/urls.cpython-310.pyc differ diff --git a/osinaweb/billing/edit/__pycache__/views.cpython-310.pyc b/osinaweb/billing/edit/__pycache__/views.cpython-310.pyc index db113305..4a21aa49 100644 Binary files a/osinaweb/billing/edit/__pycache__/views.cpython-310.pyc and b/osinaweb/billing/edit/__pycache__/views.cpython-310.pyc differ diff --git a/osinaweb/billing/edit/urls.py b/osinaweb/billing/edit/urls.py index 7497a217..6a45915d 100644 --- a/osinaweb/billing/edit/urls.py +++ b/osinaweb/billing/edit/urls.py @@ -3,5 +3,6 @@ from billing.edit import views urlpatterns = [ - path('edit_payment_modal', views.edit_payment_modal, name='edit_payment_modal'), + path('paymentmethod//', views.edit_payment_method, name='editpaymentmethod'), + path('payment/', views.edit_payment_modal, name='edit_payment_modal'), ] diff --git a/osinaweb/billing/edit/views.py b/osinaweb/billing/edit/views.py index 8870b4cb..e044f77b 100644 --- a/osinaweb/billing/edit/views.py +++ b/osinaweb/billing/edit/views.py @@ -3,6 +3,28 @@ from osinacore.models import * from billing.models import * from osinacore.decorators import * + + +@staff_login_required +def edit_payment_method(request, method_id): + method = get_object_or_404(PaymentType, id=method_id) + if request.method == 'POST': + method.name = request.POST.get('name') + method.description = request.POST.get('description') + if request.FILES.get('image'): + method.image = request.FILES.get('image') + method.save() + return redirect('paymentmethods') + + context = { + 'method': method, + + } + return render(request, 'edit_templates/edit-payment-method.html', context) + + + + @staff_login_required def edit_payment_modal(request): diff --git a/osinaweb/billing/migrations/0047_paymenttype_description_paymenttype_image.py b/osinaweb/billing/migrations/0047_paymenttype_description_paymenttype_image.py new file mode 100644 index 00000000..7d67f2f4 --- /dev/null +++ b/osinaweb/billing/migrations/0047_paymenttype_description_paymenttype_image.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.5 on 2024-05-09 13:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('billing', '0046_remove_orderpayment_order_orderpayment_order'), + ] + + operations = [ + migrations.AddField( + model_name='paymenttype', + name='description', + field=models.TextField(blank=True, null=True), + ), + migrations.AddField( + model_name='paymenttype', + name='image', + field=models.ImageField(blank=True, null=True, upload_to=''), + ), + ] diff --git a/osinaweb/billing/migrations/0048_remove_order_status_orderstatus.py b/osinaweb/billing/migrations/0048_remove_order_status_orderstatus.py new file mode 100644 index 00000000..61a70a7c --- /dev/null +++ b/osinaweb/billing/migrations/0048_remove_order_status_orderstatus.py @@ -0,0 +1,27 @@ +# Generated by Django 4.2.5 on 2024-05-09 18:48 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('billing', '0047_paymenttype_description_paymenttype_image'), + ] + + operations = [ + migrations.RemoveField( + model_name='order', + name='status', + ), + migrations.CreateModel( + name='OrderStatus', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('status', models.CharField(choices=[('Completed', 'Completed'), ('Pending', 'Pending'), ('Failed', 'Failed'), ('Cancelled', 'Cancelled')], default='Pending', max_length=200)), + ('date', models.DateTimeField()), + ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.order')), + ], + ), + ] diff --git a/osinaweb/billing/migrations/0049_rename_due_date_order_date.py b/osinaweb/billing/migrations/0049_rename_due_date_order_date.py new file mode 100644 index 00000000..46c709f6 --- /dev/null +++ b/osinaweb/billing/migrations/0049_rename_due_date_order_date.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.5 on 2024-05-09 18:48 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('billing', '0048_remove_order_status_orderstatus'), + ] + + operations = [ + migrations.RenameField( + model_name='order', + old_name='due_date', + new_name='date', + ), + ] diff --git a/osinaweb/billing/migrations/0050_remove_orderpayment_type_orderpayment_type.py b/osinaweb/billing/migrations/0050_remove_orderpayment_type_orderpayment_type.py new file mode 100644 index 00000000..45faa151 --- /dev/null +++ b/osinaweb/billing/migrations/0050_remove_orderpayment_type_orderpayment_type.py @@ -0,0 +1,22 @@ +# Generated by Django 4.2.5 on 2024-05-09 19:32 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('billing', '0049_rename_due_date_order_date'), + ] + + operations = [ + migrations.RemoveField( + model_name='orderpayment', + name='type', + ), + migrations.AddField( + model_name='orderpayment', + name='type', + field=models.ManyToManyField(null=True, to='billing.paymenttype'), + ), + ] diff --git a/osinaweb/billing/migrations/0051_alter_orderpayment_amount.py b/osinaweb/billing/migrations/0051_alter_orderpayment_amount.py new file mode 100644 index 00000000..3619df12 --- /dev/null +++ b/osinaweb/billing/migrations/0051_alter_orderpayment_amount.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.5 on 2024-05-09 19:43 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('billing', '0050_remove_orderpayment_type_orderpayment_type'), + ] + + operations = [ + migrations.AlterField( + model_name='orderpayment', + name='amount', + field=models.FloatField(null=True), + ), + ] diff --git a/osinaweb/billing/migrations/__pycache__/0047_paymenttype_description_paymenttype_image.cpython-310.pyc b/osinaweb/billing/migrations/__pycache__/0047_paymenttype_description_paymenttype_image.cpython-310.pyc new file mode 100644 index 00000000..caa99420 Binary files /dev/null and b/osinaweb/billing/migrations/__pycache__/0047_paymenttype_description_paymenttype_image.cpython-310.pyc differ diff --git a/osinaweb/billing/migrations/__pycache__/0048_remove_order_status_orderstatus.cpython-310.pyc b/osinaweb/billing/migrations/__pycache__/0048_remove_order_status_orderstatus.cpython-310.pyc new file mode 100644 index 00000000..e761dd1b Binary files /dev/null and b/osinaweb/billing/migrations/__pycache__/0048_remove_order_status_orderstatus.cpython-310.pyc differ diff --git a/osinaweb/billing/migrations/__pycache__/0049_rename_due_date_order_date.cpython-310.pyc b/osinaweb/billing/migrations/__pycache__/0049_rename_due_date_order_date.cpython-310.pyc new file mode 100644 index 00000000..784799ce Binary files /dev/null and b/osinaweb/billing/migrations/__pycache__/0049_rename_due_date_order_date.cpython-310.pyc differ diff --git a/osinaweb/billing/migrations/__pycache__/0050_remove_orderpayment_type_orderpayment_type.cpython-310.pyc b/osinaweb/billing/migrations/__pycache__/0050_remove_orderpayment_type_orderpayment_type.cpython-310.pyc new file mode 100644 index 00000000..2d036dd9 Binary files /dev/null and b/osinaweb/billing/migrations/__pycache__/0050_remove_orderpayment_type_orderpayment_type.cpython-310.pyc differ diff --git a/osinaweb/billing/migrations/__pycache__/0051_alter_orderpayment_amount.cpython-310.pyc b/osinaweb/billing/migrations/__pycache__/0051_alter_orderpayment_amount.cpython-310.pyc new file mode 100644 index 00000000..79132a06 Binary files /dev/null and b/osinaweb/billing/migrations/__pycache__/0051_alter_orderpayment_amount.cpython-310.pyc differ diff --git a/osinaweb/billing/models.py b/osinaweb/billing/models.py index f3ef4d8d..ea777bfc 100644 --- a/osinaweb/billing/models.py +++ b/osinaweb/billing/models.py @@ -32,18 +32,10 @@ class RecurringCycle(models.Model): class Order(models.Model): - STATUS = ( - ('Completed', 'Completed'), - ('Failed', 'Failed'), - ('Cancelled', 'Cancelled'), - ('None', 'None'), - ('Pending', 'Pending'), - ) customer = models.ForeignKey(CustomerProfile, on_delete=models.CASCADE) business = models.ForeignKey(Business, on_delete=models.SET_NULL, null=True, blank=True) - status = models.CharField(max_length=200, choices=STATUS, default='None') order_id = models.CharField(max_length=100, null=True, blank=True) - due_date = models.DateField(null=True, blank=True) + date = models.DateField(null=True, blank=True) @property def get_cart_total(self): orderitems = self.orderitem_set.all() @@ -64,6 +56,19 @@ class Order(models.Model): super(Order, self).save(*args, **kwargs) + +class OrderStatus(models.Model): + STATUS = ( + ('Completed', 'Completed'), + ('Pending', 'Pending'), + ('Failed', 'Failed'), + ('Cancelled', 'Cancelled'), + ) + order = models.ForeignKey(Order, on_delete=models.CASCADE) + status = models.CharField(max_length=200, choices=STATUS, default='Pending') + date = models.DateTimeField() + + class OrderItem(models.Model): order = models.ForeignKey(Order, on_delete=models.CASCADE) item = models.ForeignKey(Item, on_delete=models.CASCADE) @@ -104,16 +109,18 @@ class Invoice(models.Model): class PaymentType(models.Model): name = models.CharField(max_length=100) + description = models.TextField(null=True, blank=True) + image = models.ImageField(null=True, blank=True) def __str__(self): return self.name class OrderPayment(models.Model): order = models.ForeignKey(Order, on_delete=models.SET_NULL, null=True) - amount = models.DecimalField(decimal_places=3, max_digits = 5) + amount = models.FloatField(null=True) date_paid = models.DateField(null=True,blank=True) date_due = models.DateField(null=True, blank=True) - type = models.ForeignKey(PaymentType, null=True, on_delete=models.SET_NULL) + type = models.ManyToManyField(PaymentType, null=True) comment = models.TextField(null=True, blank=True) def __str__(self): return f"Payment for {self.order}" diff --git a/osinaweb/billing/templates/.DS_Store b/osinaweb/billing/templates/.DS_Store index efbd10e1..e4ea3e2d 100644 Binary files a/osinaweb/billing/templates/.DS_Store and b/osinaweb/billing/templates/.DS_Store differ diff --git a/osinaweb/billing/templates/add_templates/.DS_Store b/osinaweb/billing/templates/add_templates/.DS_Store new file mode 100644 index 00000000..37d70df7 Binary files /dev/null and b/osinaweb/billing/templates/add_templates/.DS_Store differ diff --git a/osinaweb/billing/templates/add_templates/add-order.html b/osinaweb/billing/templates/add_templates/add-order.html index ea6d600c..34135d0a 100644 --- a/osinaweb/billing/templates/add_templates/add-order.html +++ b/osinaweb/billing/templates/add_templates/add-order.html @@ -18,6 +18,8 @@
{% csrf_token %}
+ +
+
+ + diff --git a/osinaweb/osinacore/templates/add_templates/add-payment-method-modal.html b/osinaweb/billing/templates/add_templates/add-payment-method-modal.html similarity index 82% rename from osinaweb/osinacore/templates/add_templates/add-payment-method-modal.html rename to osinaweb/billing/templates/add_templates/add-payment-method-modal.html index b0023ea8..fb2a3144 100644 --- a/osinaweb/osinacore/templates/add_templates/add-payment-method-modal.html +++ b/osinaweb/billing/templates/add_templates/add-payment-method-modal.html @@ -14,28 +14,28 @@ - + {% csrf_token %}

Add Payment Method

-
- + rows="4" >
- +
- + Upload Logo
-
-
- - + + {% for method in methods %} + + {% endfor %}
diff --git a/osinaweb/billing/templates/delete_templates/.DS_Store b/osinaweb/billing/templates/delete_templates/.DS_Store new file mode 100644 index 00000000..51e35cc0 Binary files /dev/null and b/osinaweb/billing/templates/delete_templates/.DS_Store differ diff --git a/osinaweb/osinacore/templates/delete_templates/delete-payment-method-modal.html b/osinaweb/billing/templates/delete_templates/delete-payment-method-modal.html similarity index 89% rename from osinaweb/osinacore/templates/delete_templates/delete-payment-method-modal.html rename to osinaweb/billing/templates/delete_templates/delete-payment-method-modal.html index 69486555..93ef8a3f 100644 --- a/osinaweb/osinacore/templates/delete_templates/delete-payment-method-modal.html +++ b/osinaweb/billing/templates/delete_templates/delete-payment-method-modal.html @@ -13,7 +13,7 @@ - + {% csrf_token %}
diff --git a/osinaweb/billing/templates/details_templates/invoice-details.html b/osinaweb/billing/templates/details_templates/invoice-details.html index b1ab4500..ba001759 100644 --- a/osinaweb/billing/templates/details_templates/invoice-details.html +++ b/osinaweb/billing/templates/details_templates/invoice-details.html @@ -161,7 +161,7 @@
-

Date: 2024-03-03

+

Date: {{order.date}}

OSITCOM LTD

CR. 2014057

diff --git a/osinaweb/billing/templates/details_templates/order-details.html b/osinaweb/billing/templates/details_templates/order-details.html index 00accf3e..31b54122 100644 --- a/osinaweb/billing/templates/details_templates/order-details.html +++ b/osinaweb/billing/templates/details_templates/order-details.html @@ -13,11 +13,16 @@

Order {{order.order_id}} - {{order.customer.user.first_name}} {{order.customer.user.last_name}}

+ + {% if order.orderstatus.set_all.last.status %}

{{order.status}} - - 12-02-2024 + class="uppercase text-green-700 font-semibold text-sm {% if order.orderstatus.set_all.last.status == 'Completed' %} text-green-700 {% elif order.orderstatus.set_all.last.status == 'Pending' %} text-yellow-500 {% elif order.orderstatus.set_all.last.status == 'Failed' %} text-red-500 {% endif %}">{{order.status}} + {{order.orderstatus.set_all.last.status}} - {{order.orderstatus.set_all.last.date}}

+ {% endif %} + +
@@ -26,10 +31,22 @@ class="w-full s: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"> Add Payment - + + {% if not order.invoice %} + + + + {% else %} + + + + {% endif %}
@@ -161,15 +178,25 @@ -

{{payment.date_due}}

+ {% if payment.date_due %} +

{{payment.date_due}}

+ {% else %} +

-

+ {% endif %} + {% if payment.date_paid %}

{{payment.date_paid}}

+ {% else %} +

UNPAID

+ {% endif %} -

{{payment.type}}

+ {% for type in payment.type.all %} +

{{type.name}}

+ {% endfor %} diff --git a/osinaweb/billing/templates/details_templates/payment-details.html b/osinaweb/billing/templates/details_templates/payment-details.html index cf6587f7..db2459f0 100644 --- a/osinaweb/billing/templates/details_templates/payment-details.html +++ b/osinaweb/billing/templates/details_templates/payment-details.html @@ -148,7 +148,7 @@
-

Payment

+

Payments

@@ -165,9 +165,27 @@ {% for payment in payments %} ${{payment.amount}} - {{payment.date_due}} - {{payment.date_paid}} - {{payment.type}} + + + {% if payment.date_due %} + {{payment.date_due}} + {% else %} + - + {% endif %} + + + {% if payment.date_paid %} + {{payment.date_paid}} + {% else %} +

UNPAID

+ {% endif %} + + + {% for type in payment.type.all %} + {{type.name}} + {% endfor %} + + {% endfor %} @@ -176,7 +194,7 @@
-

Remaining Amount: $0.00

+

Remaining Amount: ${{remaining_amount}}

diff --git a/osinaweb/billing/templates/edit_templates/.DS_Store b/osinaweb/billing/templates/edit_templates/.DS_Store new file mode 100644 index 00000000..d65a1bb7 Binary files /dev/null and b/osinaweb/billing/templates/edit_templates/.DS_Store differ diff --git a/osinaweb/osinacore/templates/edit_templates/edit-payment-method.html b/osinaweb/billing/templates/edit_templates/edit-payment-method.html similarity index 69% rename from osinaweb/osinacore/templates/edit_templates/edit-payment-method.html rename to osinaweb/billing/templates/edit_templates/edit-payment-method.html index 858cc5bd..450e9499 100644 --- a/osinaweb/osinacore/templates/edit_templates/edit-payment-method.html +++ b/osinaweb/billing/templates/edit_templates/edit-payment-method.html @@ -8,28 +8,30 @@ Edit Payment Method - + {% csrf_token %}
-
- + rows="4" required>{{method.description}}
- +
- + Upload Logo
+ + +
+ +
diff --git a/osinaweb/billing/templates/listing_pages/.DS_Store b/osinaweb/billing/templates/listing_pages/.DS_Store new file mode 100644 index 00000000..950d5c4c Binary files /dev/null and b/osinaweb/billing/templates/listing_pages/.DS_Store differ diff --git a/osinaweb/billing/templates/listing_pages/orders.html b/osinaweb/billing/templates/listing_pages/orders.html index ef134d50..7e3e96bb 100644 --- a/osinaweb/billing/templates/listing_pages/orders.html +++ b/osinaweb/billing/templates/listing_pages/orders.html @@ -64,13 +64,13 @@

${{order.get_cart_total}}

- -

{{order.status}}

+ +

{{order.orderstatus_set.all.last.status}}

- {% if order.status == 'Pending' and not order.invoice %} + {% if order.orderstatus_set.all.last.status == 'Pending' and not order.invoice %} @@ -86,7 +86,7 @@ {% endif %} - +
diff --git a/osinaweb/osinacore/templates/listing_pages/payment-methods.html b/osinaweb/billing/templates/listing_pages/payment-methods.html similarity index 91% rename from osinaweb/osinacore/templates/listing_pages/payment-methods.html rename to osinaweb/billing/templates/listing_pages/payment-methods.html index 082079b9..5d681197 100644 --- a/osinaweb/osinacore/templates/listing_pages/payment-methods.html +++ b/osinaweb/billing/templates/listing_pages/payment-methods.html @@ -48,28 +48,31 @@ + {% for method in methods %}
- -

Whish

+ {% if method.image %} + + {% endif %} +

{{method.name}}

-

Helo this is a description

+

{{method.description}}

- +
-
+
@@ -77,6 +80,7 @@
+ {% endfor %}
diff --git a/osinaweb/billing/urls.py b/osinaweb/billing/urls.py index c9f808fd..0db9dfc3 100644 --- a/osinaweb/billing/urls.py +++ b/osinaweb/billing/urls.py @@ -1,4 +1,3 @@ - from django.urls import path, include from billing import views @@ -6,16 +5,16 @@ from billing import views urlpatterns = [ path('add/', include('billing.add.urls')), path('delete/', include('billing.delete.urls')), - path('delete/', include('billing.edit.urls')), - + path('edit/', include('billing.edit.urls')), # LISTING path('items/', views.items, name='items'), path('orders/', views.orders, name='orders'), path('invoices/', views.invoices, name='invoices'), + path('paymentmethods/', views.payment_methods, name='paymentmethods'), # DETAILS path('invoices//', views.invoice_details, name='invoicedetails'), - path('orders//', views.order_details, name='orderdetails'), - path('paymyent//', views.payment_details, name='paymentdetails'), + path('orders//', views.order_details, name='orderdetails'), + path('payments//', views.payment_details, name='paymentdetails'), ] diff --git a/osinaweb/billing/views.py b/osinaweb/billing/views.py index 0b15c8b3..5c65b6b4 100644 --- a/osinaweb/billing/views.py +++ b/osinaweb/billing/views.py @@ -34,6 +34,19 @@ def invoices(request, *args, **kwargs): return render(request, 'listing_pages/invoices.html', context) + +def payment_methods(request): + methods = PaymentType.objects.all().order_by('-id') + + context = { + 'methods': methods, + } + + return render(request, 'listing_pages/payment-methods.html', context) + + + + #DETAILS def invoice_details(request, order_id): order = get_object_or_404(Order, id=order_id) @@ -46,7 +59,7 @@ def invoice_details(request, order_id): def order_details(request, order_id): - order = get_object_or_404(Order, id=order_id) + order = get_object_or_404(Order, order_id=order_id) order_items = OrderItem.objects.filter(order=order).order_by('-id') order_item_ids = order_items.values_list('item_id', flat=True) diff --git a/osinaweb/customercore/__pycache__/admin.cpython-310.pyc b/osinaweb/customercore/__pycache__/admin.cpython-310.pyc index 477bc615..cf27a1c0 100644 Binary files a/osinaweb/customercore/__pycache__/admin.cpython-310.pyc and b/osinaweb/customercore/__pycache__/admin.cpython-310.pyc differ diff --git a/osinaweb/customercore/__pycache__/custom_context.cpython-310.pyc b/osinaweb/customercore/__pycache__/custom_context.cpython-310.pyc index 9ac272fb..48846556 100644 Binary files a/osinaweb/customercore/__pycache__/custom_context.cpython-310.pyc and b/osinaweb/customercore/__pycache__/custom_context.cpython-310.pyc differ diff --git a/osinaweb/customercore/__pycache__/models.cpython-310.pyc b/osinaweb/customercore/__pycache__/models.cpython-310.pyc index 7dad84ca..c12ecab9 100644 Binary files a/osinaweb/customercore/__pycache__/models.cpython-310.pyc and b/osinaweb/customercore/__pycache__/models.cpython-310.pyc differ diff --git a/osinaweb/customercore/__pycache__/urls.cpython-310.pyc b/osinaweb/customercore/__pycache__/urls.cpython-310.pyc index ac79b757..7d67831e 100644 Binary files a/osinaweb/customercore/__pycache__/urls.cpython-310.pyc and b/osinaweb/customercore/__pycache__/urls.cpython-310.pyc differ diff --git a/osinaweb/customercore/__pycache__/views.cpython-310.pyc b/osinaweb/customercore/__pycache__/views.cpython-310.pyc index 9aa5d200..36e1ecda 100644 Binary files a/osinaweb/customercore/__pycache__/views.cpython-310.pyc and b/osinaweb/customercore/__pycache__/views.cpython-310.pyc differ diff --git a/osinaweb/customercore/admin.py b/osinaweb/customercore/admin.py index 52db7685..fa944c3e 100644 --- a/osinaweb/customercore/admin.py +++ b/osinaweb/customercore/admin.py @@ -7,4 +7,4 @@ admin.site.register(TicketStatusUpdate) admin.site.register(TicketRead) admin.site.register(TicketUpdate) admin.site.register(TicketAttachment) -admin.site.register(TicketReaction) \ No newline at end of file +admin.site.register(TicketUpdateReaction) \ No newline at end of file diff --git a/osinaweb/customercore/custom_context.py b/osinaweb/customercore/custom_context.py index 4f8fa6f1..e0bb04b1 100644 --- a/osinaweb/customercore/custom_context.py +++ b/osinaweb/customercore/custom_context.py @@ -9,7 +9,6 @@ def utilities(request): customer_open_tickets_count = None customer_open_projects = None customer_open_projects_count = None - customer_open_invoices = None customer_open_invoices_count = None if request.user.is_authenticated and CustomerProfile.objects.filter(user=request.user): customer = request.user.customerprofile @@ -18,8 +17,9 @@ def utilities(request): customer_open_projects = Project.objects.filter(Q(status='Active') | Q(status='Pending'), customer=customer) customer_open_projects_count = customer_open_projects.count() - customer_open_invoices = Invoice.objects.filter(order__status='Open') - customer_open_invoices_count = customer_open_invoices.count() + orders_with_invoice = Order.objects.filter(customer=customer, invoice__isnull=False) + orders_without_completed_status = orders_with_invoice.exclude(orderstatus__status='Completed') + customer_open_invoices_count = orders_without_completed_status.count() customer_open_tickets = Ticket.objects.filter( Q(status__in=['Open', 'Working On']) & Q(customer=request.user.customerprofile) @@ -42,6 +42,4 @@ def utilities(request): ticket.last_update_date_added = None - customer_open_invoices_count = customer_open_invoices.count() - customer_open_invoices_count = customer_open_invoices.count() return {'active_subscriptions': active_subscriptions, 'customer_open_tickets': customer_open_tickets, 'customer_open_tickets_count':customer_open_tickets_count, 'customer_open_projects_count': customer_open_projects_count, 'customer_open_invoices_count': customer_open_invoices_count} diff --git a/osinaweb/customercore/migrations/0010_rename_ticketreaction_ticketupdatereaction.py b/osinaweb/customercore/migrations/0010_rename_ticketreaction_ticketupdatereaction.py new file mode 100644 index 00000000..b22ef95a --- /dev/null +++ b/osinaweb/customercore/migrations/0010_rename_ticketreaction_ticketupdatereaction.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.5 on 2024-05-09 18:54 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('customercore', '0009_alter_ticketattachment_ticket'), + ] + + operations = [ + migrations.RenameModel( + old_name='TicketReaction', + new_name='TicketUpdateReaction', + ), + ] diff --git a/osinaweb/customercore/migrations/0011_ticketupdatereaction_customer.py b/osinaweb/customercore/migrations/0011_ticketupdatereaction_customer.py new file mode 100644 index 00000000..f11c5e99 --- /dev/null +++ b/osinaweb/customercore/migrations/0011_ticketupdatereaction_customer.py @@ -0,0 +1,21 @@ +# Generated by Django 4.2.5 on 2024-05-09 18:56 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('customercore', '0010_rename_ticketreaction_ticketupdatereaction'), + ] + + operations = [ + migrations.AddField( + model_name='ticketupdatereaction', + name='customer', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/osinaweb/customercore/migrations/__pycache__/0010_rename_ticketreaction_ticketupdatereaction.cpython-310.pyc b/osinaweb/customercore/migrations/__pycache__/0010_rename_ticketreaction_ticketupdatereaction.cpython-310.pyc new file mode 100644 index 00000000..b3a0c656 Binary files /dev/null and b/osinaweb/customercore/migrations/__pycache__/0010_rename_ticketreaction_ticketupdatereaction.cpython-310.pyc differ diff --git a/osinaweb/customercore/migrations/__pycache__/0011_ticketupdatereaction_customer.cpython-310.pyc b/osinaweb/customercore/migrations/__pycache__/0011_ticketupdatereaction_customer.cpython-310.pyc new file mode 100644 index 00000000..b370c54e Binary files /dev/null and b/osinaweb/customercore/migrations/__pycache__/0011_ticketupdatereaction_customer.cpython-310.pyc differ diff --git a/osinaweb/customercore/models.py b/osinaweb/customercore/models.py index b8a2ba3e..3d3dfa53 100644 --- a/osinaweb/customercore/models.py +++ b/osinaweb/customercore/models.py @@ -70,11 +70,12 @@ class TicketAttachment(models.Model): file = models.FileField() -class TicketReaction(models.Model): +class TicketUpdateReaction(models.Model): REACTION_CHOICES = ( ('Happy', 'Happy'), ('Indifferent', 'Indifferent'), ('Sad', 'Sad'), ) + customer = models.ForeignKey(User, on_delete=models.CASCADE, null=True) reaction = models.CharField(max_length=50, choices=REACTION_CHOICES, null=True) ticket_update = models.ForeignKey(TicketUpdate, on_delete=models.CASCADE) \ No newline at end of file diff --git a/osinaweb/customercore/templates/details_templates/inner-customer-ticket.html b/osinaweb/customercore/templates/details_templates/inner-customer-ticket.html index 07e58ee4..dc3fa817 100644 --- a/osinaweb/customercore/templates/details_templates/inner-customer-ticket.html +++ b/osinaweb/customercore/templates/details_templates/inner-customer-ticket.html @@ -130,20 +130,26 @@ did I do?
-
- -
- -
- -
- -
- -
+ +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
{% endif %} diff --git a/osinaweb/customercore/templates/listing_pages/customer-orders.html b/osinaweb/customercore/templates/listing_pages/customer-orders.html index d04a87f7..355dfdf6 100644 --- a/osinaweb/customercore/templates/listing_pages/customer-orders.html +++ b/osinaweb/customercore/templates/listing_pages/customer-orders.html @@ -30,7 +30,7 @@ Status - Date purchased + Date Created @@ -55,7 +55,7 @@ -

{{order.status}}

+

{{ order.orderstatus_set.last.status }}

diff --git a/osinaweb/customercore/urls.py b/osinaweb/customercore/urls.py index f8dbfe8a..beff0be1 100644 --- a/osinaweb/customercore/urls.py +++ b/osinaweb/customercore/urls.py @@ -20,6 +20,7 @@ urlpatterns = [ # DETAILS path('my-tickets//', views.customer_ticket_details, name='customerticketdetails'), + path('addticketupdatereaction///', views.customer_add_ticket_update_reaction, name='customeraddticketupdatereaction'), # PRODUCTS URL diff --git a/osinaweb/customercore/views.py b/osinaweb/customercore/views.py index 0767cbd4..cb67807f 100644 --- a/osinaweb/customercore/views.py +++ b/osinaweb/customercore/views.py @@ -12,6 +12,7 @@ from billing.add.views import * from .models import * from django.db.models import Q from django.http import Http404 +from django.db.models import OuterRef, Subquery # Create your views here. @@ -88,6 +89,7 @@ def customer_add_ticket(request, *args, **kwargs): return render(request, 'add_templates/customer-add-ticket.html', context) + @customer_login_required def customer_add_ticket_update(request, ticket_id): ticket = get_object_or_404(Ticket, id=ticket_id) @@ -118,6 +120,38 @@ def customer_add_ticket_update(request, ticket_id): return render(request, 'add_templates/customer-add-ticket.html', context) + +@customer_login_required +def customer_add_ticket_update_reaction(request, reaction_type, ticketupdate_id): + ticket_update = get_object_or_404(TicketUpdate, id=ticketupdate_id) + + existing_reaction = TicketUpdateReaction.objects.filter(ticket_update=ticket_update, customer=request.user).first() + + if existing_reaction: + # If the existing reaction type is equal to the new reaction, delete it + if existing_reaction.reaction == reaction_type: + existing_reaction.delete() + else: + # If not, delete all previous reactions and add a new one + TicketUpdateReaction.objects.filter(ticket_update=ticket_update, customer=request.user).delete() + reaction = TicketUpdateReaction.objects.create( + ticket_update=ticket_update, + reaction=reaction_type, + customer=request.user + ) + else: + # If there's no existing reaction, simply add the new one + reaction = TicketUpdateReaction.objects.create( + ticket_update=ticket_update, + reaction=reaction_type, + customer=request.user + ) + + return redirect('customerticketdetails', ticket_number=ticket_update.ticket.ticket_number) + + + + # LISTING @customer_login_required def customer_invoices(request, *args, **kwargs): @@ -144,7 +178,7 @@ def all_products(request, *args, **kwargs): @customer_login_required def customer_orders(request, *args, **kwargs): customer = request.user.customerprofile - orders = Order.objects.filter(customer=customer, status='Completed').order_by('-order_id') + orders = Order.objects.filter(customer=customer, orderstatus__isnull=False).order_by('-order_id') context = { @@ -211,7 +245,15 @@ def customer_ticket_details(request, ticket_number): if ticket.customer != request.user.customerprofile: raise Http404("Page not found.") - ticket_updates = TicketUpdate.objects.filter(ticket=ticket).order_by('id') + # Subquery to get the last reaction added by the logged-in customer for each ticket update + last_reaction_subquery = TicketUpdateReaction.objects.filter( + ticket_update=OuterRef('pk'), + customer=request.user + ).order_by('-id').values('reaction')[:1] + + ticket_updates = TicketUpdate.objects.filter(ticket=ticket).annotate( + last_customer_reaction=Subquery(last_reaction_subquery) + ).order_by('id') # Mark updates as read for the current user for update in TicketUpdate.objects.filter(ticket=ticket).exclude(added_by=request.user).order_by('id'): @@ -233,6 +275,35 @@ def customer_ticket_details(request, ticket_number): return render(request, 'details_templates/inner-customer-ticket.html', context) +@customer_login_required +def customer_add_ticket_update_reaction(request, reaction_type, ticketupdate_id): + ticket_update = get_object_or_404(TicketUpdate, id=ticketupdate_id) + + existing_reaction = TicketUpdateReaction.objects.filter(ticket_update=ticket_update, customer=request.user).first() + + if existing_reaction: + # If the existing reaction type is equal to the new reaction, delete it + if existing_reaction.reaction == reaction_type: + existing_reaction.delete() + else: + # If not, delete all previous reactions and add a new one + TicketUpdateReaction.objects.filter(ticket_update=ticket_update, customer=request.user).delete() + reaction = TicketUpdateReaction.objects.create( + ticket_update=ticket_update, + reaction=reaction_type, + customer=request.user + ) + else: + # If there's no existing reaction, simply add the new one + reaction = TicketUpdateReaction.objects.create( + ticket_update=ticket_update, + reaction=reaction_type, + customer=request.user + ) + + return redirect('customerticketdetails', ticket_number=ticket_update.ticket.ticket_number) + + # PRODUCTS @@ -357,14 +428,14 @@ def initiate_checkout(request): price = cycle.cycle_price - existing_order = Order.objects.filter(customer=customer, status='None').first() + existing_order = Order.objects.filter(customer=customer, orderstatus__isnull=True).first() if existing_order: existing_order.orderitem_set.all().delete() order = existing_order else: - order = Order.objects.create(status='None', customer=customer) + order = Order.objects.create(customer=customer) order.save() order_id = order.order_id @@ -425,8 +496,11 @@ def check_order_status(request, merchant_id, order_id): if response.status_code == 200: order_details = response.json() if order_details.get('result') == 'SUCCESS': - order.status = 'Completed' - order.save() + OrderStatus.objects.create( + order = order, + status = 'Completed', + date = datetime.now() + ) order_items = OrderItem.objects.filter(order=order) for order_item in order_items: order_item.purchased_at = datetime.now() @@ -452,7 +526,7 @@ def check_order_status(request, merchant_id, order_id): } response = requests.post(api_url, json=api_data) order_item.active = True - old_order_items = OrderItem.objects.exclude(order__id=order.id).filter(item__item_type__name='OSIMENU') + old_order_items = OrderItem.objects.exclude(order__id=order.id).filter(item__item_type__name='OSIMENU', order__customer=request.user.customerprofile) for item in old_order_items: item.active = False item.save() @@ -489,7 +563,12 @@ def buy_free_osimenu(request): order = Order.objects.create( customer = request.user.customerprofile, - status = 'Completed' + ) + + order_status = OrderStatus.objects.create( + order=order, + status = 'Completed', + date = datetime.now() ) order_item = OrderItem.objects.create( @@ -499,7 +578,7 @@ def buy_free_osimenu(request): active = True, ) - old_order_items = OrderItem.objects.exclude(order__id=order.id).filter(item__item_type__name='OSIMENU') + old_order_items = OrderItem.objects.exclude(order__id=order.id).filter(item__item_type__name='OSIMENU', order__customer=request.user.customerprofile) for item in old_order_items: item.active = False item.save() @@ -532,7 +611,12 @@ def buy_free_osicard(request): order = Order.objects.create( customer = request.user.customerprofile, - status = 'Completed' + ) + + order_status = OrderStatus.objects.create( + order=order, + status = 'Completed', + date = datetime.now() ) order_item = OrderItem.objects.create( @@ -542,7 +626,7 @@ def buy_free_osicard(request): active = True, ) - old_order_items = OrderItem.objects.exclude(order__id=order.id).filter(item__item_type__name='OSICARD') + old_order_items = OrderItem.objects.exclude(order__id=order.id).filter(item__item_type__name='OSICARD', order__customer=request.user.customerprofile) for item in old_order_items: item.active = False item.save() diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index 6ffa2b04..2e2ef2a9 100644 Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ diff --git a/osinaweb/osinacore/.DS_Store b/osinaweb/osinacore/.DS_Store index f3099d35..5f204903 100644 Binary files a/osinaweb/osinacore/.DS_Store and b/osinaweb/osinacore/.DS_Store differ diff --git a/osinaweb/osinacore/__pycache__/urls.cpython-310.pyc b/osinaweb/osinacore/__pycache__/urls.cpython-310.pyc index 3d7cc598..81ee75c3 100644 Binary files a/osinaweb/osinacore/__pycache__/urls.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/urls.cpython-310.pyc differ diff --git a/osinaweb/osinacore/__pycache__/views.cpython-310.pyc b/osinaweb/osinacore/__pycache__/views.cpython-310.pyc index 5d4856e9..7a853f94 100644 Binary files a/osinaweb/osinacore/__pycache__/views.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/views.cpython-310.pyc differ diff --git a/osinaweb/osinacore/add/__pycache__/urls.cpython-310.pyc b/osinaweb/osinacore/add/__pycache__/urls.cpython-310.pyc index 101b3a87..c5a6944c 100644 Binary files a/osinaweb/osinacore/add/__pycache__/urls.cpython-310.pyc and b/osinaweb/osinacore/add/__pycache__/urls.cpython-310.pyc differ diff --git a/osinaweb/osinacore/add/__pycache__/views.cpython-310.pyc b/osinaweb/osinacore/add/__pycache__/views.cpython-310.pyc index 7d783ccf..eb46fe6d 100644 Binary files a/osinaweb/osinacore/add/__pycache__/views.cpython-310.pyc and b/osinaweb/osinacore/add/__pycache__/views.cpython-310.pyc differ diff --git a/osinaweb/osinacore/add/urls.py b/osinaweb/osinacore/add/urls.py index 77afad4f..d891802e 100644 --- a/osinaweb/osinacore/add/urls.py +++ b/osinaweb/osinacore/add/urls.py @@ -31,5 +31,4 @@ urlpatterns = [ path('ticket//', views.add_ticket, name='addticket'), path('ticketupdate//', views.add_ticket_update, name='addticketupdate'), - path('add_payment_method_modal', views.add_payment_method_modal, name='add_payment_method_modal'), ] \ No newline at end of file diff --git a/osinaweb/osinacore/add/views.py b/osinaweb/osinacore/add/views.py index 7a89ef2f..fe612c9e 100644 --- a/osinaweb/osinacore/add/views.py +++ b/osinaweb/osinacore/add/views.py @@ -719,11 +719,17 @@ def add_ticket_update(request, ticket_id): @staff_login_required def add_payment_method_modal(request, *args, **kwargs): + if request.method == 'POST': + name = request.POST.get('name') + image = request.POST.get('method') + + payment = Paymw( + name = name, + ) + tag.save() - context = { - - } - + # Reload the parent page + return HttpResponse('') return render(request, 'add_templates/add-payment-method-modal.html', context) diff --git a/osinaweb/osinacore/delete/__pycache__/urls.cpython-310.pyc b/osinaweb/osinacore/delete/__pycache__/urls.cpython-310.pyc index 2d5eaf3f..ce1fab12 100644 Binary files a/osinaweb/osinacore/delete/__pycache__/urls.cpython-310.pyc and b/osinaweb/osinacore/delete/__pycache__/urls.cpython-310.pyc differ diff --git a/osinaweb/osinacore/delete/__pycache__/views.cpython-310.pyc b/osinaweb/osinacore/delete/__pycache__/views.cpython-310.pyc index bb74bb89..b8d8deae 100644 Binary files a/osinaweb/osinacore/delete/__pycache__/views.cpython-310.pyc and b/osinaweb/osinacore/delete/__pycache__/views.cpython-310.pyc differ diff --git a/osinaweb/osinacore/delete/urls.py b/osinaweb/osinacore/delete/urls.py index 991de119..bb091acc 100644 --- a/osinaweb/osinacore/delete/urls.py +++ b/osinaweb/osinacore/delete/urls.py @@ -16,6 +16,5 @@ urlpatterns = [ path('taskpoint///', views.delete_task_point_modal, name='deletetaskpointmodal'), path('note/', views.delete_note_modal, name='deletenotemodal'), path('payment/', views.delete_payment_modal, name='deletepaymentmodal'), - path('paymentmethod/', views.delete_payment_method_modal, name='deletepaymentmethodmodal') ] \ No newline at end of file diff --git a/osinaweb/osinacore/delete/views.py b/osinaweb/osinacore/delete/views.py index e8a0b75c..55f2adb0 100644 --- a/osinaweb/osinacore/delete/views.py +++ b/osinaweb/osinacore/delete/views.py @@ -164,12 +164,3 @@ def delete_payment_modal(request): return render(request, "delete_templates/delete-payment-modal.html", context) -@staff_login_required -def delete_payment_method_modal(request): - - context = { - - } - - return render(request, "delete_templates/delete-payment-method-modal.html", context) - diff --git a/osinaweb/osinacore/edit/__pycache__/urls.cpython-310.pyc b/osinaweb/osinacore/edit/__pycache__/urls.cpython-310.pyc index 74a54b6e..5760d0fd 100644 Binary files a/osinaweb/osinacore/edit/__pycache__/urls.cpython-310.pyc and b/osinaweb/osinacore/edit/__pycache__/urls.cpython-310.pyc differ diff --git a/osinaweb/osinacore/edit/__pycache__/views.cpython-310.pyc b/osinaweb/osinacore/edit/__pycache__/views.cpython-310.pyc index d9ca5137..13b32e5c 100644 Binary files a/osinaweb/osinacore/edit/__pycache__/views.cpython-310.pyc and b/osinaweb/osinacore/edit/__pycache__/views.cpython-310.pyc differ diff --git a/osinaweb/osinacore/edit/urls.py b/osinaweb/osinacore/edit/urls.py index 6bd07c8b..c8ef0e2f 100644 --- a/osinaweb/osinacore/edit/urls.py +++ b/osinaweb/osinacore/edit/urls.py @@ -17,7 +17,6 @@ urlpatterns = [ path('businesstype//', views.edit_business_type, name='editbusinesstype'), path('reference//', views.edit_reference, name='editreference'), path('tag//', views.edit_tag, name='edittag'), - path('editpaymentmethod/', views.edit_payment_method, name='editpaymentmethod'), #Mark Points diff --git a/osinaweb/osinacore/edit/views.py b/osinaweb/osinacore/edit/views.py index 8f442652..4caac75e 100644 --- a/osinaweb/osinacore/edit/views.py +++ b/osinaweb/osinacore/edit/views.py @@ -378,18 +378,6 @@ def edit_tag(request, tag_id): -@staff_login_required -def edit_payment_method(request, *args, **kwargs): - - context = { - - } - return render(request, 'edit_templates/edit-payment-method.html', context) - - - - - #Mark points @staff_login_required diff --git a/osinaweb/osinacore/templates/.DS_Store b/osinaweb/osinacore/templates/.DS_Store index 8e010a73..fa2cbac9 100644 Binary files a/osinaweb/osinacore/templates/.DS_Store and b/osinaweb/osinacore/templates/.DS_Store differ diff --git a/osinaweb/osinacore/templates/add-edit-main.html b/osinaweb/osinacore/templates/add-edit-main.html index b68a0f85..21c3d08b 100644 --- a/osinaweb/osinacore/templates/add-edit-main.html +++ b/osinaweb/osinacore/templates/add-edit-main.html @@ -272,7 +272,7 @@
- +

Payment Methods/p> @@ -564,7 +564,7 @@

- +

Payment Methods/p> diff --git a/osinaweb/osinacore/templates/add_templates/.DS_Store b/osinaweb/osinacore/templates/add_templates/.DS_Store index 412c7c5d..c631ee62 100644 Binary files a/osinaweb/osinacore/templates/add_templates/.DS_Store and b/osinaweb/osinacore/templates/add_templates/.DS_Store differ diff --git a/osinaweb/osinacore/templates/delete_templates/.DS_Store b/osinaweb/osinacore/templates/delete_templates/.DS_Store new file mode 100644 index 00000000..cdd79188 Binary files /dev/null and b/osinaweb/osinacore/templates/delete_templates/.DS_Store differ diff --git a/osinaweb/osinacore/templates/edit_templates/.DS_Store b/osinaweb/osinacore/templates/edit_templates/.DS_Store index 02e90256..163380e5 100644 Binary files a/osinaweb/osinacore/templates/edit_templates/.DS_Store and b/osinaweb/osinacore/templates/edit_templates/.DS_Store differ diff --git a/osinaweb/osinacore/templates/listing_pages/.DS_Store b/osinaweb/osinacore/templates/listing_pages/.DS_Store new file mode 100644 index 00000000..98ebf4f1 Binary files /dev/null and b/osinaweb/osinacore/templates/listing_pages/.DS_Store differ diff --git a/osinaweb/osinacore/templates/main.html b/osinaweb/osinacore/templates/main.html index e1d2d405..cdd90b18 100644 --- a/osinaweb/osinacore/templates/main.html +++ b/osinaweb/osinacore/templates/main.html @@ -425,7 +425,7 @@ - +

- +

Payment Methods/p> diff --git a/osinaweb/osinacore/urls.py b/osinaweb/osinacore/urls.py index ea2039a5..038caf27 100644 --- a/osinaweb/osinacore/urls.py +++ b/osinaweb/osinacore/urls.py @@ -52,7 +52,7 @@ urlpatterns = [ path('businesstypes/', views.business_types, name='businesstypes'), path('references/', views.references, name='references'), path('tags/', views.tags, name='tags'), - path('payment_methods/', views.payment_methods, name='payment_methods'), + #Details Templates diff --git a/osinaweb/osinacore/views.py b/osinaweb/osinacore/views.py index b960a118..6e0c3c68 100644 --- a/osinaweb/osinacore/views.py +++ b/osinaweb/osinacore/views.py @@ -107,7 +107,7 @@ def signup(request): }) send_mail(mail_subject, message, settings.EMAIL_HOST_USER, [user.email], html_message=message) - return render(request, 'email-confirmation-sent.html', context) + return render(request, 'email-confirmation-sent.html') else: print('Form is not valid. Errors:') @@ -475,16 +475,6 @@ def tags(request): -@staff_login_required -def payment_methods(request): - - context = { - - } - - return render(request, 'listing_pages/payment-methods.html', context) - - diff --git a/osinaweb/static/images/eHcWZi3-_400x400_3.jpg b/osinaweb/static/images/eHcWZi3-_400x400_3.jpg new file mode 100644 index 00000000..b7004b8c Binary files /dev/null and b/osinaweb/static/images/eHcWZi3-_400x400_3.jpg differ diff --git a/osinaweb/static/images/generated_invoices/invoice_024-1427.pdf b/osinaweb/static/images/generated_invoices/invoice_024-1427.pdf new file mode 100644 index 00000000..498cfb73 Binary files /dev/null and b/osinaweb/static/images/generated_invoices/invoice_024-1427.pdf differ diff --git a/osinaweb/static/images/unnamed.png b/osinaweb/static/images/unnamed.png new file mode 100644 index 00000000..c4a31004 Binary files /dev/null and b/osinaweb/static/images/unnamed.png differ diff --git a/osinaweb/static/js/pop-modals.js b/osinaweb/static/js/pop-modals.js index fec63eb6..5a861c9a 100644 --- a/osinaweb/static/js/pop-modals.js +++ b/osinaweb/static/js/pop-modals.js @@ -67,7 +67,7 @@ document.addEventListener("DOMContentLoaded", function () { addButtonClickListener("reactionDetailsButton", "400px", "300px"); addButtonClickListener("addPaymentCommentButton", "500px", "250px"); - addButtonClickListener("addPaymentButton", "500px", "400px"); + addButtonClickListener("addPaymentButton", "500px", "600px"); addButtonClickListener("editPaymentButton", "500px", "400px"); addButtonClickListener("addPaymentMethodButton", "500px", "400px");