diff --git a/osinaweb/billing/__pycache__/models.cpython-310.pyc b/osinaweb/billing/__pycache__/models.cpython-310.pyc index a6926e1e..095a8b64 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 ea549ec9..b7ce50d9 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/add/__pycache__/views.cpython-310.pyc b/osinaweb/billing/add/__pycache__/views.cpython-310.pyc index 31911899..fae73479 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/views.py b/osinaweb/billing/add/views.py index ce70902e..ca27fd2b 100644 --- a/osinaweb/billing/add/views.py +++ b/osinaweb/billing/add/views.py @@ -6,6 +6,7 @@ from django.template.loader import get_template from django.conf import settings import os from weasyprint import HTML, CSS +from django.core.files.base import ContentFile @@ -110,7 +111,6 @@ def add_order (request, *args, **kwargs): - def add_invoice_pdf(request, order_id): order = get_object_or_404(Order, id=order_id) @@ -160,15 +160,10 @@ def add_invoice_pdf(request, order_id): ) - # Save PDF to a file - pdf_file_path = os.path.join(settings.MEDIA_ROOT, f'invoice_{invoice.id}.pdf') - with open(pdf_file_path, 'wb') as pdf_file: - pdf_file.write(pdf) - # Associate PDF file path with the Invoice object - invoice.pdf = pdf_file_path - invoice.save() - + pdf_content = ContentFile(pdf) + filename = f'invoice_{invoice.invoice_number}.pdf' + invoice.pdf.save(filename, pdf_content, save=True) # Return PDF response = HttpResponse(pdf, content_type='application/pdf') response['Content-Disposition'] = 'attachment; filename="my_pdf.pdf"' diff --git a/osinaweb/billing/migrations/0043_alter_invoice_pdf.py b/osinaweb/billing/migrations/0043_alter_invoice_pdf.py new file mode 100644 index 00000000..1b0e646f --- /dev/null +++ b/osinaweb/billing/migrations/0043_alter_invoice_pdf.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.5 on 2024-04-24 18:05 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('billing', '0042_order_due_date'), + ] + + operations = [ + migrations.AlterField( + model_name='invoice', + name='pdf', + field=models.FileField(blank=True, null=True, upload_to='generated_invoices'), + ), + ] diff --git a/osinaweb/billing/migrations/0044_alter_orderitem_active.py b/osinaweb/billing/migrations/0044_alter_orderitem_active.py new file mode 100644 index 00000000..ab6a4264 --- /dev/null +++ b/osinaweb/billing/migrations/0044_alter_orderitem_active.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.5 on 2024-04-24 18:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('billing', '0043_alter_invoice_pdf'), + ] + + operations = [ + migrations.AlterField( + model_name='orderitem', + name='active', + field=models.BooleanField(blank=True, null=True), + ), + ] diff --git a/osinaweb/billing/migrations/__pycache__/0043_alter_invoice_pdf.cpython-310.pyc b/osinaweb/billing/migrations/__pycache__/0043_alter_invoice_pdf.cpython-310.pyc new file mode 100644 index 00000000..f001cdff Binary files /dev/null and b/osinaweb/billing/migrations/__pycache__/0043_alter_invoice_pdf.cpython-310.pyc differ diff --git a/osinaweb/billing/migrations/__pycache__/0044_alter_orderitem_active.cpython-310.pyc b/osinaweb/billing/migrations/__pycache__/0044_alter_orderitem_active.cpython-310.pyc new file mode 100644 index 00000000..b319ee0f Binary files /dev/null and b/osinaweb/billing/migrations/__pycache__/0044_alter_orderitem_active.cpython-310.pyc differ diff --git a/osinaweb/billing/models.py b/osinaweb/billing/models.py index 6522c06d..1ebc4883 100644 --- a/osinaweb/billing/models.py +++ b/osinaweb/billing/models.py @@ -58,7 +58,7 @@ class Order(models.Model): class OrderItem(models.Model): order = models.ForeignKey(Order, on_delete=models.CASCADE) item = models.ForeignKey(Item, on_delete=models.CASCADE) - active = models.BooleanField(default=False, null=True) + active = models.BooleanField(null=True, blank=True) purchased_at = models.DateField(null=True, blank=True) end_at = models.DateField(blank=True, null=True) terminated_at = models.DateField(blank=True, null=True) @@ -98,7 +98,7 @@ class Invoice(models.Model): invoice_number = models.CharField(max_length=100, null=True, blank=True) order = models.OneToOneField(Order, on_delete=models.SET_NULL, null=True) date_created = models.DateField() - pdf = models.FileField(upload_to='uploaded_images', null=True, blank=True) + pdf = models.FileField(upload_to='generated_invoices', null=True, blank=True) def __str__(self): return self.invoice_number def save(self, *args, **kwargs): diff --git a/osinaweb/billing/templates/details_templates/invoice-details.html b/osinaweb/billing/templates/details_templates/invoice-details.html index eddea3bb..b1ab4500 100644 --- a/osinaweb/billing/templates/details_templates/invoice-details.html +++ b/osinaweb/billing/templates/details_templates/invoice-details.html @@ -135,7 +135,7 @@
- +
diff --git a/osinaweb/billing/templates/listing_pages/invoices.html b/osinaweb/billing/templates/listing_pages/invoices.html index 01a14386..4b999768 100644 --- a/osinaweb/billing/templates/listing_pages/invoices.html +++ b/osinaweb/billing/templates/listing_pages/invoices.html @@ -77,14 +77,18 @@

{{invoice.date_created}}

+ -
- - - - -
+ +
+ + + + +
+
+ {% endfor %} diff --git a/osinaweb/billing/templates/listing_pages/orders.html b/osinaweb/billing/templates/listing_pages/orders.html index 1f27d697..0a993721 100644 --- a/osinaweb/billing/templates/listing_pages/orders.html +++ b/osinaweb/billing/templates/listing_pages/orders.html @@ -95,10 +95,12 @@ {% endif %} {% if order.invoice %} - - - - + + + + + + {% endif %} diff --git a/osinaweb/customercore/__pycache__/models.cpython-310.pyc b/osinaweb/customercore/__pycache__/models.cpython-310.pyc index 850794c8..e2a38eae 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__/views.cpython-310.pyc b/osinaweb/customercore/__pycache__/views.cpython-310.pyc index 6ba494b8..0ff5b63a 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/migrations/0001_initial.py b/osinaweb/customercore/migrations/0001_initial.py new file mode 100644 index 00000000..45f72185 --- /dev/null +++ b/osinaweb/customercore/migrations/0001_initial.py @@ -0,0 +1,59 @@ +# Generated by Django 4.2.5 on 2024-04-24 19:30 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('osinacore', '0075_remove_ticketattachment_ticket_and_more'), + ('billing', '0044_alter_orderitem_active'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Ticket', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=400)), + ('description', models.TextField(blank=True, null=True)), + ('regarding', models.CharField(choices=[('General/Account/Billing', 'General/Account/Billing'), ('Project/Product', 'Project/Product')], max_length=50, null=True)), + ('opened_date', models.DateTimeField()), + ('department', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='osinacore.department')), + ('opened_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), + ('product', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='billing.item')), + ('project', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='osinacore.project')), + ], + ), + migrations.CreateModel( + name='TicketUpdate', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('description', models.TextField(blank=True, null=True)), + ('date_added', models.DateTimeField()), + ('added_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), + ('ticket', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='customercore.ticket')), + ], + ), + migrations.CreateModel( + name='TicketReaction', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('ticket_update', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='customercore.ticketupdate')), + ], + ), + migrations.CreateModel( + name='TicketAttachment', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('file', models.FileField(upload_to='')), + ('ticket', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='customercore.ticket')), + ('ticket_update', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='customercore.ticketupdate')), + ], + ), + ] diff --git a/osinaweb/customercore/migrations/__pycache__/0001_initial.cpython-310.pyc b/osinaweb/customercore/migrations/__pycache__/0001_initial.cpython-310.pyc new file mode 100644 index 00000000..a9fcf9b5 Binary files /dev/null and b/osinaweb/customercore/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/osinaweb/customercore/models.py b/osinaweb/customercore/models.py index 71a83623..c4a7c957 100644 --- a/osinaweb/customercore/models.py +++ b/osinaweb/customercore/models.py @@ -1,3 +1,39 @@ from django.db import models - +from billing.models import * # Create your models here. + +class Ticket(models.Model): + REGARDING_CHOICES = ( + ('General/Account/Billing', 'General/Account/Billing'), + ('Project/Product', 'Project/Product'), + ) + title = models.CharField(max_length=400) + description = models.TextField(null=True, blank=True) + regarding = models.CharField(max_length=50, choices=REGARDING_CHOICES, null=True) + project = models.ForeignKey(Project, on_delete=models.SET_NULL, blank=True, null=True) + product = models.ForeignKey(Item, on_delete=models.SET_NULL, blank=True, null=True) + department = models.ForeignKey(Department, on_delete=models.SET_NULL,null=True) + opened_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) + opened_date = models.DateTimeField() + + +class TicketUpdate(models.Model): + ticket = models.ForeignKey(Ticket, on_delete=models.CASCADE) + description = models.TextField(null=True, blank=True) + added_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) + date_added = models.DateTimeField() + + +class TicketAttachment(models.Model): + ticket = models.ForeignKey(Ticket, on_delete=models.CASCADE) + ticket_update = models.ForeignKey(TicketUpdate, on_delete=models.CASCADE) + file = models.FileField() + + +class TicketReaction(models.Model): + REGARDING_CHOICES = ( + ('Happy', 'Happy'), + ('Indifferent', 'Indifferent'), + ('Sad', 'Sad'), + ) + ticket_update = models.ForeignKey(TicketUpdate, on_delete=models.CASCADE) \ No newline at end of file diff --git a/osinaweb/customercore/templates/add_templates/customer-add-ticket.html b/osinaweb/customercore/templates/add_templates/customer-add-ticket.html index 04029264..9fcea554 100644 --- a/osinaweb/customercore/templates/add_templates/customer-add-ticket.html +++ b/osinaweb/customercore/templates/add_templates/customer-add-ticket.html @@ -6,14 +6,14 @@

- Open Ticket + Create Ticket

{% csrf_token %}
- +
@@ -21,12 +21,18 @@
- + diff --git a/osinaweb/customercore/templates/listing_pages/customer-invoices.html b/osinaweb/customercore/templates/listing_pages/customer-invoices.html index 99b091b6..8db65278 100644 --- a/osinaweb/customercore/templates/listing_pages/customer-invoices.html +++ b/osinaweb/customercore/templates/listing_pages/customer-invoices.html @@ -69,14 +69,17 @@
- + + + + {% if not invoice.order.status == 'Completed' %} diff --git a/osinaweb/customercore/templates/listing_pages/customer-orders.html b/osinaweb/customercore/templates/listing_pages/customer-orders.html index 42e44180..fdbfcebe 100644 --- a/osinaweb/customercore/templates/listing_pages/customer-orders.html +++ b/osinaweb/customercore/templates/listing_pages/customer-orders.html @@ -59,12 +59,14 @@ -
- - - - -
+ +
+ + + + +
+
{% endfor %} diff --git a/osinaweb/customercore/templates/listing_pages/customer-tickets.html b/osinaweb/customercore/templates/listing_pages/customer-tickets.html index 0de1c871..d840de15 100644 --- a/osinaweb/customercore/templates/listing_pages/customer-tickets.html +++ b/osinaweb/customercore/templates/listing_pages/customer-tickets.html @@ -18,7 +18,7 @@
diff --git a/osinaweb/customercore/views.py b/osinaweb/customercore/views.py index 8bc58a60..f40e6451 100644 --- a/osinaweb/customercore/views.py +++ b/osinaweb/customercore/views.py @@ -31,8 +31,12 @@ def redirect_osicard(request): # ADD @customer_login_required def customer_add_ticket(request, *args, **kwargs): + customer_products = OrderItem.objects.filter(order__status='Completed', active__in=[True, None], item__type = 'Product', order__customer = request.user.customerprofile) + customer_projects = Project.objects.filter(customer=request.user.customerprofile) context = { + 'customer_products': customer_products, + 'customer_projects': customer_projects, } @@ -160,6 +164,15 @@ def dedicated_servers_plans(request, *args, **kwargs): + + + + + + + + +#Products Payment views @customer_login_required def payment(request, item_id): item = get_object_or_404(Item, id=item_id) @@ -305,7 +318,7 @@ def check_order_status(request, merchant_id, order_id): item.save() order_item.save() add_invoice_pdf(request, order_id=order.id) - return redirect('orders') + return redirect('customerorders') error_message = 'Failed to retrieve order details: ' + response.text return JsonResponse({'error': error_message}, status=500) except Exception as e: @@ -399,6 +412,20 @@ def buy_free_osicard(request): return redirect('customerorders') + + + + + + + + + + + + + + #Invoice Payment views @customer_login_required def invoice_payment(request, invoice_id): invoice = get_object_or_404(Invoice, id = invoice_id) diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index 4008f834..afc6de8d 100644 Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ diff --git a/osinaweb/osinacore/__pycache__/admin.cpython-310.pyc b/osinaweb/osinacore/__pycache__/admin.cpython-310.pyc index dc7c9d64..5ff64959 100644 Binary files a/osinaweb/osinacore/__pycache__/admin.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/admin.cpython-310.pyc differ diff --git a/osinaweb/osinacore/__pycache__/models.cpython-310.pyc b/osinaweb/osinacore/__pycache__/models.cpython-310.pyc index f8a9f8ce..00ce4f4b 100644 Binary files a/osinaweb/osinacore/__pycache__/models.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/models.cpython-310.pyc differ diff --git a/osinaweb/osinacore/admin.py b/osinaweb/osinacore/admin.py index 70367cb4..7fb00bd5 100644 --- a/osinaweb/osinacore/admin.py +++ b/osinaweb/osinacore/admin.py @@ -31,6 +31,7 @@ class PointAdmin(admin.ModelAdmin): admin.site.register(Reference) admin.site.register(Business) admin.site.register(CustomerProfile) +admin.site.register(Department) admin.site.register(StaffProfile) admin.site.register(ProjectType) admin.site.register(Project, ProjectAdmin) diff --git a/osinaweb/osinacore/migrations/0070_department_alter_staffprofile_staff_position_and_more.py b/osinaweb/osinacore/migrations/0070_department_alter_staffprofile_staff_position_and_more.py new file mode 100644 index 00000000..d9551d63 --- /dev/null +++ b/osinaweb/osinacore/migrations/0070_department_alter_staffprofile_staff_position_and_more.py @@ -0,0 +1,31 @@ +# Generated by Django 4.2.5 on 2024-04-24 18:31 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0069_alter_business_logo_alter_projectfile_file_and_more'), + ] + + operations = [ + migrations.CreateModel( + name='Department', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100)), + ], + ), + migrations.AlterField( + model_name='staffprofile', + name='staff_position', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='osinacore.staffposition'), + ), + migrations.AddField( + model_name='staffposition', + name='department', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='osinacore.department'), + ), + ] diff --git a/osinaweb/osinacore/migrations/0071_projecttype_department_ticket.py b/osinaweb/osinacore/migrations/0071_projecttype_department_ticket.py new file mode 100644 index 00000000..328d8cd0 --- /dev/null +++ b/osinaweb/osinacore/migrations/0071_projecttype_department_ticket.py @@ -0,0 +1,33 @@ +# Generated by Django 4.2.5 on 2024-04-24 18:36 + +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), + ('osinacore', '0070_department_alter_staffprofile_staff_position_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='projecttype', + name='department', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='osinacore.department'), + ), + migrations.CreateModel( + name='Ticket', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=400)), + ('description', models.TextField(blank=True, null=True)), + ('regarding', models.CharField(choices=[('General/Account/Billing', 'General/Account/Billing'), ('Service/Product', 'Service/Product')], max_length=50, null=True)), + ('opened_date', models.DateTimeField()), + ('department', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='osinacore.department')), + ('opened_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/osinaweb/osinacore/migrations/0072_ticketupdate_ticketreaction_ticketattachment.py b/osinaweb/osinacore/migrations/0072_ticketupdate_ticketreaction_ticketattachment.py new file mode 100644 index 00000000..168903a8 --- /dev/null +++ b/osinaweb/osinacore/migrations/0072_ticketupdate_ticketreaction_ticketattachment.py @@ -0,0 +1,42 @@ +# Generated by Django 4.2.5 on 2024-04-24 18:41 + +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), + ('osinacore', '0071_projecttype_department_ticket'), + ] + + operations = [ + migrations.CreateModel( + name='TicketUpdate', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('description', models.TextField(blank=True, null=True)), + ('dare_added', models.DateTimeField()), + ('added_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), + ('ticket', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='osinacore.ticket')), + ], + ), + migrations.CreateModel( + name='TicketReaction', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('ticket_update', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='osinacore.ticketupdate')), + ], + ), + migrations.CreateModel( + name='TicketAttachment', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('file', models.FileField(upload_to='')), + ('ticket', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='osinacore.ticket')), + ('ticket_update', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='osinacore.ticketupdate')), + ], + ), + ] diff --git a/osinaweb/osinacore/migrations/0073_alter_ticket_regarding.py b/osinaweb/osinacore/migrations/0073_alter_ticket_regarding.py new file mode 100644 index 00000000..7faf1e72 --- /dev/null +++ b/osinaweb/osinacore/migrations/0073_alter_ticket_regarding.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.5 on 2024-04-24 19:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0072_ticketupdate_ticketreaction_ticketattachment'), + ] + + operations = [ + migrations.AlterField( + model_name='ticket', + name='regarding', + field=models.CharField(choices=[('General/Account/Billing', 'General/Account/Billing'), ('Project/Product', 'Project/Product')], max_length=50, null=True), + ), + ] diff --git a/osinaweb/osinacore/migrations/0074_rename_dare_added_ticketupdate_date_added.py b/osinaweb/osinacore/migrations/0074_rename_dare_added_ticketupdate_date_added.py new file mode 100644 index 00000000..2cd20d39 --- /dev/null +++ b/osinaweb/osinacore/migrations/0074_rename_dare_added_ticketupdate_date_added.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.5 on 2024-04-24 19:14 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0073_alter_ticket_regarding'), + ] + + operations = [ + migrations.RenameField( + model_name='ticketupdate', + old_name='dare_added', + new_name='date_added', + ), + ] diff --git a/osinaweb/osinacore/migrations/0075_remove_ticketattachment_ticket_and_more.py b/osinaweb/osinacore/migrations/0075_remove_ticketattachment_ticket_and_more.py new file mode 100644 index 00000000..8ca0fa18 --- /dev/null +++ b/osinaweb/osinacore/migrations/0075_remove_ticketattachment_ticket_and_more.py @@ -0,0 +1,45 @@ +# Generated by Django 4.2.5 on 2024-04-24 19:29 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0074_rename_dare_added_ticketupdate_date_added'), + ] + + operations = [ + migrations.RemoveField( + model_name='ticketattachment', + name='ticket', + ), + migrations.RemoveField( + model_name='ticketattachment', + name='ticket_update', + ), + migrations.RemoveField( + model_name='ticketreaction', + name='ticket_update', + ), + migrations.RemoveField( + model_name='ticketupdate', + name='added_by', + ), + migrations.RemoveField( + model_name='ticketupdate', + name='ticket', + ), + migrations.DeleteModel( + name='Ticket', + ), + migrations.DeleteModel( + name='TicketAttachment', + ), + migrations.DeleteModel( + name='TicketReaction', + ), + migrations.DeleteModel( + name='TicketUpdate', + ), + ] diff --git a/osinaweb/osinacore/migrations/__pycache__/0070_department_alter_staffprofile_staff_position_and_more.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0070_department_alter_staffprofile_staff_position_and_more.cpython-310.pyc new file mode 100644 index 00000000..d5291fc5 Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0070_department_alter_staffprofile_staff_position_and_more.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0071_projecttype_department_ticket.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0071_projecttype_department_ticket.cpython-310.pyc new file mode 100644 index 00000000..5d98edde Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0071_projecttype_department_ticket.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0072_ticketupdate_ticketreaction_ticketattachment.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0072_ticketupdate_ticketreaction_ticketattachment.cpython-310.pyc new file mode 100644 index 00000000..079bf66d Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0072_ticketupdate_ticketreaction_ticketattachment.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0073_alter_ticket_regarding.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0073_alter_ticket_regarding.cpython-310.pyc new file mode 100644 index 00000000..091cbdaf Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0073_alter_ticket_regarding.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0074_rename_dare_added_ticketupdate_date_added.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0074_rename_dare_added_ticketupdate_date_added.cpython-310.pyc new file mode 100644 index 00000000..7d114edb Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0074_rename_dare_added_ticketupdate_date_added.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0075_remove_ticketattachment_ticket_and_more.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0075_remove_ticketattachment_ticket_and_more.cpython-310.pyc new file mode 100644 index 00000000..2ed88f07 Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0075_remove_ticketattachment_ticket_and_more.cpython-310.pyc differ diff --git a/osinaweb/osinacore/models.py b/osinaweb/osinacore/models.py index d9b96476..f369d091 100644 --- a/osinaweb/osinacore/models.py +++ b/osinaweb/osinacore/models.py @@ -8,6 +8,8 @@ from django.db.models import Sum, F from datetime import timedelta + + # Create your models here. class Reference(models.Model): @@ -93,9 +95,15 @@ class Business(models.Model): +class Department(models.Model): + name = models.CharField(max_length=100) + def __str__(self): + return self.name + class StaffPosition(models.Model): name = models.CharField(max_length=100) + department = models.ForeignKey(Department, on_delete=models.SET_NULL, null=True) def __str__(self): return self.name @@ -106,7 +114,7 @@ class StaffProfile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) image = models.ImageField(upload_to='uploaded_images', null=True, blank=True) mobile_number = models.CharField(max_length=50) - staff_position = models.ForeignKey(StaffPosition, on_delete=models.CASCADE, null=True, blank=True) + staff_position = models.ForeignKey(StaffPosition, on_delete=models.SET_NULL, null=True, blank=True) intern = models.BooleanField(default=False) active = models.BooleanField(default=True) staff_id = models.CharField(max_length=20, null=True, blank=True) # Allow null and blank for initial creation @@ -126,6 +134,7 @@ class StaffProfile(models.Model): class ProjectType(models.Model): name = models.CharField(max_length=50) + department = models.ForeignKey(Department, on_delete=models.SET_NULL, null=True) def __str__(self): return self.name @@ -310,10 +319,6 @@ class PointActivity(models.Model): return 0, 0, 0 - - - - class Status(models.Model): text = models.TextField(blank=True) date = models.CharField(max_length=40) @@ -346,4 +351,6 @@ class Connection(models.Model): ) status = models.CharField(max_length=200, choices=STATUS_CHOICES, null=True) date = models.DateTimeField(null=True) - user = models.ForeignKey(User, on_delete=models.CASCADE) \ No newline at end of file + user = models.ForeignKey(User, on_delete=models.CASCADE) + + diff --git a/osinaweb/osinacore/templates/add_templates/add-project.html b/osinaweb/osinacore/templates/add_templates/add-project.html index 9ed573c7..894c8ca3 100644 --- a/osinaweb/osinacore/templates/add_templates/add-project.html +++ b/osinaweb/osinacore/templates/add_templates/add-project.html @@ -22,8 +22,8 @@
@@ -101,7 +101,7 @@
diff --git a/osinaweb/static/images/generated_invoices/invoice_$24-1425.pdf b/osinaweb/static/images/generated_invoices/invoice_$24-1425.pdf new file mode 100644 index 00000000..c0e33d96 Binary files /dev/null and b/osinaweb/static/images/generated_invoices/invoice_$24-1425.pdf differ diff --git a/osinaweb/static/images/generated_invoices/invoice_24-1425.pdf b/osinaweb/static/images/generated_invoices/invoice_24-1425.pdf new file mode 100644 index 00000000..73bc9532 Binary files /dev/null and b/osinaweb/static/images/generated_invoices/invoice_24-1425.pdf differ