diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index e7b1afe2..88b9e3a1 100644 Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ diff --git a/osinaweb/osinacore/__pycache__/forms.cpython-310.pyc b/osinaweb/osinacore/__pycache__/forms.cpython-310.pyc index 8f6ca498..a4a9f5e6 100644 Binary files a/osinaweb/osinacore/__pycache__/forms.cpython-310.pyc and b/osinaweb/osinacore/__pycache__/forms.cpython-310.pyc differ diff --git a/osinaweb/osinacore/__pycache__/models.cpython-310.pyc b/osinaweb/osinacore/__pycache__/models.cpython-310.pyc index fa23cbf2..e653eb11 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/__pycache__/views.cpython-310.pyc b/osinaweb/osinacore/__pycache__/views.cpython-310.pyc index 2bd27f66..57bedd8a 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/forms.py b/osinaweb/osinacore/forms.py index 0a782d2c..a10612dc 100644 --- a/osinaweb/osinacore/forms.py +++ b/osinaweb/osinacore/forms.py @@ -16,4 +16,4 @@ class SignUpForm(forms.ModelForm): class StaffSignUpForm(forms.ModelForm): class Meta: model = StaffProfile - fields = ['first_name', 'last_name', 'image', 'email', 'mobile_number', 'password', 'position', 'intern', 'active'] \ No newline at end of file + fields = ['first_name', 'last_name', 'image', 'email', 'mobile_number', 'password', 'staff_position', 'intern', 'active'] \ No newline at end of file diff --git a/osinaweb/osinacore/migrations/0035_business_business_id.py b/osinaweb/osinacore/migrations/0035_business_business_id.py new file mode 100644 index 00000000..8c0829e3 --- /dev/null +++ b/osinaweb/osinacore/migrations/0035_business_business_id.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.5 on 2023-09-23 10:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0034_alter_point_date_completed_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='business', + name='business_id', + field=models.CharField(blank=True, max_length=20, null=True), + ), + ] diff --git a/osinaweb/osinacore/migrations/0036_staffposition_alter_staffprofile_position.py b/osinaweb/osinacore/migrations/0036_staffposition_alter_staffprofile_position.py new file mode 100644 index 00000000..948c5a4c --- /dev/null +++ b/osinaweb/osinacore/migrations/0036_staffposition_alter_staffprofile_position.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.5 on 2023-09-23 10:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0035_business_business_id'), + ] + + operations = [ + migrations.CreateModel( + name='StaffPosition', + 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='position', + field=models.CharField(max_length=100, null=True), + ), + ] diff --git a/osinaweb/osinacore/migrations/0037_remove_staffprofile_position.py b/osinaweb/osinacore/migrations/0037_remove_staffprofile_position.py new file mode 100644 index 00000000..3fce076b --- /dev/null +++ b/osinaweb/osinacore/migrations/0037_remove_staffprofile_position.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.5 on 2023-09-23 10:49 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0036_staffposition_alter_staffprofile_position'), + ] + + operations = [ + migrations.RemoveField( + model_name='staffprofile', + name='position', + ), + ] diff --git a/osinaweb/osinacore/migrations/0038_staffprofile_staff_position.py b/osinaweb/osinacore/migrations/0038_staffprofile_staff_position.py new file mode 100644 index 00000000..a5ac5def --- /dev/null +++ b/osinaweb/osinacore/migrations/0038_staffprofile_staff_position.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.5 on 2023-09-23 10:49 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0037_remove_staffprofile_position'), + ] + + operations = [ + migrations.AddField( + model_name='staffprofile', + name='staff_position', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='osinacore.staffposition'), + ), + ] diff --git a/osinaweb/osinacore/migrations/0039_alter_staffprofile_staff_position.py b/osinaweb/osinacore/migrations/0039_alter_staffprofile_staff_position.py new file mode 100644 index 00000000..24ca581f --- /dev/null +++ b/osinaweb/osinacore/migrations/0039_alter_staffprofile_staff_position.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.5 on 2023-09-23 10:50 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0038_staffprofile_staff_position'), + ] + + operations = [ + migrations.AlterField( + model_name='staffprofile', + name='staff_position', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='osinacore.staffposition'), + ), + ] diff --git a/osinaweb/osinacore/migrations/0040_staffprofile_staff_id.py b/osinaweb/osinacore/migrations/0040_staffprofile_staff_id.py new file mode 100644 index 00000000..f2417c7e --- /dev/null +++ b/osinaweb/osinacore/migrations/0040_staffprofile_staff_id.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.5 on 2023-09-23 11:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('osinacore', '0039_alter_staffprofile_staff_position'), + ] + + operations = [ + migrations.AddField( + model_name='staffprofile', + name='staff_id', + field=models.CharField(blank=True, max_length=20, null=True), + ), + ] diff --git a/osinaweb/osinacore/migrations/__pycache__/0035_business_business_id.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0035_business_business_id.cpython-310.pyc new file mode 100644 index 00000000..1dbcfc37 Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0035_business_business_id.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0036_staffposition_alter_staffprofile_position.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0036_staffposition_alter_staffprofile_position.cpython-310.pyc new file mode 100644 index 00000000..e38ed1e3 Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0036_staffposition_alter_staffprofile_position.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0037_alter_staffprofile_position.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0037_alter_staffprofile_position.cpython-310.pyc new file mode 100644 index 00000000..bea2d61e Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0037_alter_staffprofile_position.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0037_remove_staffprofile_position.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0037_remove_staffprofile_position.cpython-310.pyc new file mode 100644 index 00000000..7bf632e8 Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0037_remove_staffprofile_position.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0038_staffprofile_staff_position.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0038_staffprofile_staff_position.cpython-310.pyc new file mode 100644 index 00000000..b332cbac Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0038_staffprofile_staff_position.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0039_alter_staffprofile_staff_position.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0039_alter_staffprofile_staff_position.cpython-310.pyc new file mode 100644 index 00000000..abc9c4bc Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0039_alter_staffprofile_staff_position.cpython-310.pyc differ diff --git a/osinaweb/osinacore/migrations/__pycache__/0040_staffprofile_staff_id.cpython-310.pyc b/osinaweb/osinacore/migrations/__pycache__/0040_staffprofile_staff_id.cpython-310.pyc new file mode 100644 index 00000000..fa75ee10 Binary files /dev/null and b/osinaweb/osinacore/migrations/__pycache__/0040_staffprofile_staff_id.cpython-310.pyc differ diff --git a/osinaweb/osinacore/models.py b/osinaweb/osinacore/models.py index f0337950..f4774585 100644 --- a/osinaweb/osinacore/models.py +++ b/osinaweb/osinacore/models.py @@ -43,10 +43,20 @@ class Business(models.Model): ) business_type = models.CharField(max_length=200, choices=BUSINESS_TYPE) logo = models.ImageField() + business_id = models.CharField(max_length=20, null=True, blank=True) # Allow null and blank for initial creation class Meta: verbose_name_plural = u'Businesses' def __str__(self): return self.name + def save(self, *args, **kwargs): + if not self.business_id: + # Get the last two digits of the current year + current_year = str(datetime.now().year)[-2:] + # Find the maximum project ID in the database and increment it + max_id = Business.objects.aggregate(models.Max('business_id'))['business_id__max'] + new_id = str(int(max_id[-4:]) + 1).zfill(4) if max_id else '0001' # If no existing records, start with '0001' + self.business_id = 'B' + current_year + new_id # Add 'p' prefix + super(Business, self).save(*args, **kwargs) @@ -82,6 +92,13 @@ class CustomerProfile(models.Model): +class StaffPosition(models.Model): + name = models.CharField(max_length=100) + def __str__(self): + return self.name + + + class StaffProfile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) @@ -90,13 +107,23 @@ class StaffProfile(models.Model): image = models.ImageField(null=True, blank=True) email = models.EmailField(unique=True) mobile_number = models.CharField(max_length=50) + staff_position = models.ForeignKey(StaffPosition, on_delete=models.CASCADE, null=True, blank=True) password = models.CharField(max_length=128) - position = models.CharField(max_length=100) 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 def __str__(self): return self.user.username + def save(self, *args, **kwargs): + if not self.staff_id: + # Get the last two digits of the current year + current_year = str(datetime.now().year)[-2:] + # Find the maximum project ID in the database and increment it + max_id = StaffProfile.objects.aggregate(models.Max('staff_id'))['staff_id__max'] + new_id = str(int(max_id[-4:]) + 1).zfill(4) if max_id else '0001' # If no existing records, start with '0001' + self.staff_id = 'O' + current_year + new_id # Add 'p' prefix + super(StaffProfile, self).save(*args, **kwargs) diff --git a/osinaweb/osinacore/views.py b/osinaweb/osinacore/views.py index 0fb7d5e7..6950dee3 100644 --- a/osinaweb/osinacore/views.py +++ b/osinaweb/osinacore/views.py @@ -226,8 +226,10 @@ def addbusiness(request): @login_required -def businessdetails(request): +def businessdetails(request, business_id): + business = get_object_or_404(Business, business_id=business_id) context = { + 'business' : business, } return render(request, 'business-details.html', context) @@ -235,7 +237,9 @@ def businessdetails(request): @login_required def businesses(request): - context = { + businesses = Business.objects.all().order_by('-id') + context = { + 'businesses' : businesses, } return render(request, 'businesses.html', context) @@ -244,8 +248,12 @@ def businesses(request): @login_required def addstaff(request): + staffpositions = StaffPosition.objects.all().order_by('-id') + context = { + 'staffpositions' : staffpositions, + } return render(request, 'add-staff.html', context) @@ -253,11 +261,11 @@ def addstaff(request): @login_required -def staffdetails(request): +def staffdetails( request, staff_id): + staff = get_object_or_404(StaffProfile, staff_id=staff_id) context = { - - + 'staff' : staff, } return render(request, 'staff-details.html', context) @@ -265,8 +273,12 @@ def staffdetails(request): @login_required def staff_positions(request): + staffpositions = StaffPosition.objects.all().order_by('-id') + context = { + 'staffpositions' : staffpositions, + } return render(request, 'staff-positions.html', context) @@ -907,6 +919,27 @@ def save_tag(request): return redirect('tags') +@login_required +def save_staffposition(request): + if request.method == 'POST': + name = request.POST.get('name') + + + + staffposition = StaffPosition( + name = name, + + + ) + staffposition.save() + + # Reload the parent page + return HttpResponse('') + + return redirect('staffpositions') + + + @login_required def save_point(request): diff --git a/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc b/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc index 2fe6baf7..cb8398cf 100644 Binary files a/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc and b/osinaweb/osinaweb/__pycache__/urls.cpython-310.pyc differ diff --git a/osinaweb/osinaweb/urls.py b/osinaweb/osinaweb/urls.py index d99d804a..9f4a736f 100644 --- a/osinaweb/osinaweb/urls.py +++ b/osinaweb/osinaweb/urls.py @@ -32,10 +32,10 @@ urlpatterns = [ path('addcustomer/', views.add_customer, name='addcustomer'), path('customerdetails//', views.customerdetails, name='customerdetails'), path('addbusiness/', views.addbusiness, name='addbusiness'), - path('businessdetails/', views.businessdetails, name='businessdetails'), + path('businessdetails//', views.businessdetails, name='businessdetails'), path('businesses/', views.businesses, name='businesses'), path('addstaff/', views.addstaff, name='adduser'), - path('staffdetails/', views.staffdetails, name='userdetails'), + path('staffdetails//', views.staffdetails, name='userdetails'), path('staffs/', views.staffs, name='users'), path('staffpositions/', views.staff_positions, name='staffpositions'), path('projectdetails//', views.detailed_project, name='detailed-project'), @@ -89,6 +89,7 @@ urlpatterns = [ path('save_reference/', views.save_reference, name='save_reference'), path('save_tag/', views.save_tag, name='save_tag'), path('save_point/', views.save_point, name='save_point'), + path('save_staffposition/', views.save_staffposition, name='save_staffposition'), diff --git a/osinaweb/static/images/1686063290067.jpeg b/osinaweb/static/images/1686063290067.jpeg new file mode 100644 index 00000000..14728f36 Binary files /dev/null and b/osinaweb/static/images/1686063290067.jpeg differ diff --git a/osinaweb/static/images/WinaBig-logo.bfee8ead0476c4ee6291_9Ch4jp9.png b/osinaweb/static/images/WinaBig-logo.bfee8ead0476c4ee6291_9Ch4jp9.png new file mode 100644 index 00000000..c074d154 Binary files /dev/null and b/osinaweb/static/images/WinaBig-logo.bfee8ead0476c4ee6291_9Ch4jp9.png differ diff --git a/osinaweb/templates/add-staff.html b/osinaweb/templates/add-staff.html index 04058c4c..383826af 100644 --- a/osinaweb/templates/add-staff.html +++ b/osinaweb/templates/add-staff.html @@ -87,11 +87,12 @@ -
diff --git a/osinaweb/templates/add-staffposition-modal.html b/osinaweb/templates/add-staffposition-modal.html index 51425668..ae71469f 100644 --- a/osinaweb/templates/add-staffposition-modal.html +++ b/osinaweb/templates/add-staffposition-modal.html @@ -13,7 +13,7 @@ -
+ {% csrf_token %}

Add Staff Position

diff --git a/osinaweb/templates/business-details.html b/osinaweb/templates/business-details.html index 8f663711..d0a2b814 100644 --- a/osinaweb/templates/business-details.html +++ b/osinaweb/templates/business-details.html @@ -57,11 +57,11 @@
-
+
- +
-

Emile Ellye - Ositcom

+

{{business.name}}

@@ -77,45 +77,48 @@
-

Name: Ositcom +

Name: {{business.name}}

Email: info@ositcom.com

+ class="text-slate-800 text-xl font-semibold">{{business.email}}

-

VAT: Checked +

VAT: {{business.vat}}

Commercial Registration: 2022

+ class="text-slate-800 text-xl font-semibold">{{business.commercial_registration}}

Phone Number: 78987678

+ class="text-slate-800 text-xl font-semibold">{{business.phone_number}}

Website: ositcom.com

+ class="text-slate-800 text-xl font-semibold">{{business.website}}

Business Type: Association

+ class="text-slate-800 text-xl font-semibold">{{business.business_type}}

Related Customer: - - Emile Elliye - + {% for customer_profile in business.customerprofile_set.all %} + {{ customer_profile.user.first_name }} {{customer_profile.user.last_name}} + {% if not forloop.last %}, {% endif %} + + {%endfor%} +

@@ -128,88 +131,20 @@
+ {% for latest in latest_statuses %}
- user profile -
-
-

Nataly

-

11:30 AM

-
-
-
- -
-
- - -
-

Closed - Create the Osina home page

-
- - -
- - -
-
-
- - -
-
-
-
-
- user profile -
-
-

Salim

-

11:30 AM

-
-
-
- -
-
- - -
-

Closed - Create the Osina home page

-
- - -
- - -
-
-
- - -
-
-
-
-
- user profile + user profile
-

Emile

-

11:30 AM

+

{{latest.staff.first_name}} + {{latest.staff.last_name}}

+

{{latest.time}}

@@ -219,7 +154,7 @@
-

Closed - Create the Osina home page

+

{{latest.text}}

@@ -232,6 +167,7 @@
+ {% endfor %}
diff --git a/osinaweb/templates/businesses.html b/osinaweb/templates/businesses.html index 8ceea349..b0d2d586 100644 --- a/osinaweb/templates/businesses.html +++ b/osinaweb/templates/businesses.html @@ -102,18 +102,19 @@
+ {% for business in businesses %}
-

HII

+

{{business.name}}

-

Non-profit

+

{{business.business_type}}

-

2022

+

{{business.financial_number}}

+ {% endfor %}
diff --git a/osinaweb/templates/customer-details.html b/osinaweb/templates/customer-details.html index b5eeb0fe..4ffb256c 100644 --- a/osinaweb/templates/customer-details.html +++ b/osinaweb/templates/customer-details.html @@ -176,7 +176,7 @@

{{customer.business.financial_number}}

diff --git a/osinaweb/templates/staff-details.html b/osinaweb/templates/staff-details.html index c62213ad..2b61df9b 100644 --- a/osinaweb/templates/staff-details.html +++ b/osinaweb/templates/staff-details.html @@ -60,9 +60,9 @@
diff --git a/osinaweb/templates/staffs.html b/osinaweb/templates/staffs.html index 99eab421..2ff0234d 100644 --- a/osinaweb/templates/staffs.html +++ b/osinaweb/templates/staffs.html @@ -117,7 +117,7 @@

{{staff.email}}

- +
diff --git a/osinaweb/templates/tags.html b/osinaweb/templates/tags.html index df71fbb7..10077c0d 100644 --- a/osinaweb/templates/tags.html +++ b/osinaweb/templates/tags.html @@ -121,54 +121,20 @@

USERS ACTIVITY

- + {% for latest in latest_statuses %}
- user profile -
-
-

Nataly

-

11:30 AM

-
-
-
- -
-
- - -
-

Closed - Create the Osina home page

-
- - -
- - -
-
-
- - -
-
-
-
-
- user profile + user profile
-

Salim

-

11:30 AM

+

{{latest.staff.first_name}} + {{latest.staff.last_name}}

+

{{latest.time}}

@@ -178,7 +144,7 @@
-

Closed - Create the Osina home page

+

{{latest.text}}

@@ -191,42 +157,7 @@
- - -
-
-
-
-
- user profile -
-
-

Emile

-

11:30 AM

-
-
-
- -
-
- - -
-

Closed - Create the Osina home page

-
- - -
- - -
-
-
- + {% endfor %}
diff --git a/osinaweb/templates/task-details.html b/osinaweb/templates/task-details.html index 5ea8054b..9d7d6f6b 100644 --- a/osinaweb/templates/task-details.html +++ b/osinaweb/templates/task-details.html @@ -352,135 +352,43 @@

USERS ACTIVITY

+ {% for latest in latest_statuses %} +
-
-
- user profile -
-
-

Nataly

-

11:30 AM

-

Closed - Create the Osina home page

-
-
- -
-
- -
- - -
-
- -
-
-
- user profile -
-
-

Salim

-

11:30 AM

-

Closed - Create the Osina home page

-
-
- -
-
- -
- - -
-
- -
-
-
- user profile -
-
-

Emile

-

12:30 PM

-

Working - Create the Osina home page

-
-
- -
-
- -
- - -
-
- -
-
-
- user profile -
-
-

Nataly

-

11:30 AM

-

Closed - Create Enooma home page

-
-
- -
-
- -
- - -
-
- -
-
-
- user profile +
+
+
+
+ user profile +
+
+

{{latest.staff.first_name}} + {{latest.staff.last_name}}

+

{{latest.time}}

+
+
+
+ +
-
-

Salim

-

11:30 AM

-

Closed - Create the Osina home page

+ + +
+

{{latest.text}}

-
- + + +
+ +
- -
- - -
+ {% endfor %}