From 0b4af8a3044652a1d5478ec283f93dfe00a06bc5 Mon Sep 17 00:00:00 2001
From: Reinout van Rees <reinout@vanrees.org>
Date: Mon, 16 Dec 2024 20:47:22 +0100
Subject: [PATCH] Added mpc to admin and templstes

---
 trs/admin.py                   | 15 +++++++++++----
 trs/templates/trs/person.html  |  5 +++++
 trs/templates/trs/project.html |  6 ++++++
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/trs/admin.py b/trs/admin.py
index 70c2b53..8a1bf12 100644
--- a/trs/admin.py
+++ b/trs/admin.py
@@ -6,17 +6,22 @@ class GroupAdmin(admin.ModelAdmin):
     list_display = ["name", "description"]
 
 
+class MPCAdmin(admin.ModelAdmin):
+    list_display = ["name", "description"]
+
+
 class PersonAdmin(admin.ModelAdmin):
     list_display = [
         "name",
         "group",
+        "mpc",
         "archived",
         "user",
         "is_office_management",
         "is_management",
     ]
-    list_editable = ["group", "archived", "is_office_management"]
-    list_filter = ["archived", "group", "is_management", "is_office_management"]
+    list_editable = ["group", "mpc", "archived", "is_office_management"]
+    list_filter = ["archived", "group", "mpc", "is_management", "is_office_management"]
     search_fields = ["name"]
 
 
@@ -25,13 +30,14 @@ class ProjectAdmin(admin.ModelAdmin):
         "code",
         "description",
         "group",
+        "mpc",
         "wbso_project",
         "wbso_percentage",
         "internal",
         "archived",
     ]
-    list_filter = ["internal", "archived", "group", "wbso_project"]
-    list_editable = ["group", "wbso_project", "wbso_percentage"]
+    list_filter = ["internal", "archived", "group", "mpc", "wbso_project"]
+    list_editable = ["group", "mpc", "wbso_project", "wbso_percentage"]
     search_fields = ["code", "description"]
 
 
@@ -76,6 +82,7 @@ class ThirdPartyEstimateAdmin(admin.ModelAdmin):
 
 
 admin.site.register(models.Group, GroupAdmin)
+admin.site.register(models.MPC, MPCAdmin)
 admin.site.register(models.Person, PersonAdmin)
 admin.site.register(models.Project, ProjectAdmin)
 admin.site.register(models.WbsoProject, WbsoProjectAdmin)
diff --git a/trs/templates/trs/person.html b/trs/templates/trs/person.html
index cbe33bd..225eb4d 100644
--- a/trs/templates/trs/person.html
+++ b/trs/templates/trs/person.html
@@ -39,6 +39,11 @@ <h1>
           <th>Groep</th>
           <td>{{ view.person.group }}</td>
         </tr>
+      {% if view.person.mpc %}
+        <tr>
+          <th>Markt-product-combinatie</th>
+          <td>{{ view.person.mpc }}</td>
+        </tr>
       {% endif %}
       <tr>
         <th>Extra rollen</th>
diff --git a/trs/templates/trs/project.html b/trs/templates/trs/project.html
index ea42c2e..dda7d7d 100644
--- a/trs/templates/trs/project.html
+++ b/trs/templates/trs/project.html
@@ -104,6 +104,12 @@ <h1>
           <td>{{ view.project.group }}</td>
         </tr>
       {% endif %}
+      {% if view.project.mpc %}
+        <tr>
+          <th>Markt-product-combinatie</th>
+          <td>{{ view.project.mpc }}</td>
+        </tr>
+      {% endif %}
       <tr>
         <th>Startweek</th>
         <td>{{ view.project.start.friendly|default:"Niet ingevuld" }}</td>