summaryrefslogtreecommitdiffstats
path: root/engagements/templates/engagements/engagement_detail.html
blob: f98191e52f70ea21c8d8f86e424afcc61f102e2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
{% extends "core/base.html" %}
{% load table_extras %}
{% load static %}

{% block title %}{{ engagement }}{% endblock title %}

{% block content %}
    <div class="container mx-auto px-4 py-8">
        <h3 class="font-semibold text-3xl">{{ engagement.friendly_type }}
            at {{ engagement.external_party }}</h3>
        <h4 class="text-gray-600">{{ engagement.proposed_start_date|date:"l j M Y" }}</h4>
        <p class="py-2">{% lorem %}</p>

        <h3 class="text-2xl">Executive summary</h3>

        <blockquote>
            <p class="mt-4 px-5">
                <q>{% lorem %}</q>
            </p>
        </blockquote>

        <div class="flex flex-col md:flex-row gap-8">
            <div class="bg-white shadow overflow-hidden sm:rounded-lg mt-8 w-full border border-gray-400">
                <div class="px-4 py-2 sm:px-6 text-white bg-blue-500">
                    <h3 class="font-semibold">{{ engagement.engagement_type|lower|capfirst }} Data</h3>
                </div>
                <table class="border-collapse border rounded border-slate-400 min-w-full divide-y divide-gray-200">
                    <thead class="bg-gray-50">
                    <tr>
                        <th class="px-6 py-3 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">
                            DSC
                        </th>
                        <th class="px-6 py-3 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">
                            Outcome
                        </th>
                        <th class="px-6 py-3 text-left text-xs font-bold text-gray-500 uppercase tracking-wider">
                            Comments
                        </th>
                    </tr>
                    </thead>
                    <tbody class="bg-white divide-y divide-gray-200">
                    <tr>
                        <td class="px-6 py-2 whitespace-nowrap text-sm font-bold text-gray-900">DSC 1</td>
                        <td class="px-6 py-2 whitespace-nowrap text-sm font-medium text-white bg-green-500">ADEQUATE</td>
                        <td class="px-6 py-2 text-sm font-medium text-gray-900">{% lorem 30 w random %}</td>
                    </tr>
                    <tr>
                        <td class="px-6 py-2 whitespace-nowrap text-sm font-bold text-gray-900">DSC 5</td>
                        <td class="px-6 py-2 whitespace-nowrap text-sm font-medium text-gray-900 bg-yellow-300">BELOW ADEQUATE</td>
                        <td class="px-6 py-2 text-sm font-medium text-gray-900">{% lorem %}</td>
                    </tr>
                    <tr>
                        <td class="px-6 py-2 whitespace-nowrap text-sm font-bold text-gray-900">DSC 12</td>
                        <td class="px-6 py-2 whitespace-nowrap text-sm font-medium text-white bg-red-500">UNSUSTAINABLE</td>
                        <td class="px-6 py-2 text-sm font-medium text-gray-900">{% lorem 50 w random %}</td>
                    </tr>
                    <tr>
                        <td class="px-6 py-2 whitespace-nowrap text-sm font-bold text-gray-900">DSC 16</td>
                        <td class="px-6 py-2 whitespace-nowrap text-sm font-medium text-white bg-yellow-500">NEAR ADEQUATE</td>
                        <td class="px-6 py-2 text-sm font-medium text-gray-900">{% lorem 50 w random %}</td>
                    </tr>
                    </tbody>
                </table>

            </div>
        </div>

        <div class="flex flex-col md:flex-row gap-8">
            <div class="bg-white shadow overflow-hidden sm:rounded-lg mt-8 md:w-1/3 border border-gray-400">
                <div class="px-4 py-2 sm:px-6 text-white bg-blue-500">
                    <h3 class="font-semibold">Summary</h3>
                </div>
                <div class="border-t border-gray-200">
                    <div class="px-4 py-5 sm:p-2">
                        <div class="w-full p-4 space-y-4">
                            <!-- Date -->
                            <div class="flex items-center space-x-2">
                                <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
                                     stroke-width="1.5"
                                     stroke="currentColor" class="size-6 mr-2">
                                    <path stroke-linecap="round" stroke-linejoin="round"
                                          d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"/>
                                </svg>
                                    <span class="text-black">
                                        {{ day_duration }}
                                    </span>
                            </div>

                            <!-- Site/Operation -->
                            <div class="flex items-center space-x-2">
                                <svg id="map-pin" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
                                     stroke-width="1.5"
                                     stroke="currentColor"
                                     class="size-6 mr-2">
                                    <path stroke-linecap="round" stroke-linejoin="round"
                                          d="M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"/>
                                    <path stroke-linecap="round" stroke-linejoin="round"
                                          d="M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z"/>
                                </svg>

                                <span class="text-black">{{ engagement.external_party.name }}</span>
                            </div>

                            <!-- Subject of Activity -->
                            <! TODO - fix this grid ->
                            <div class="grid grid-cols-2 gap-2">

                                <div>
                                    <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
                                         stroke-width="1.5" stroke="currentColor" width="24" height="24">
                                        <path stroke-linecap="round" stroke-linejoin="round"
                                              d="M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0 1 18 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3 1.5 1.5 3-3.75"/>
                                    </svg>
                                </div>

                                <div>
                                    {% if not engagement.dscs %}
                                        <p>
                                            No DSCs. Add Regulation effort.
                                        </p>
                                    {% else %}
                                         <span class="text-black">{{ engagement.dscs|join:", " }}</span>
                                    {% endif %}
                                </div>
                            </div>

                            <!-- Inspectors -->
                            <div class="grid grid-cols-2 gap-2">
                                <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
                                     stroke-width="1.5" stroke="currentColor" class="size-6 mr-2">
                                    <path stroke-linecap="round" stroke-linejoin="round"
                                          d="M18 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0ZM3 19.235v-.11a6.375 6.375 0 0 1 12.75 0v.109A12.318 12.318 0 0 1 9.374 21c-2.331 0-4.512-.645-6.374-1.766Z"/>
                                </svg>

                                <div>
                                    {% if effort %}
                                        <span class="text-black">{{ engagement.get_officers|join:", " }}</span>
                                    {% else %}
                                    <p>
                                        No Inspectors. Add effort.
                                    </p>
                                    {% endif %}
                                </div>

                            </div>

                            <div>
                                <a href="{% url 'engagements:edit' engagement.pk %}"
                                   class="text-blue-600 hover:underline">Edit
                                    Engagement</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="bg-white shadow overflow-hidden sm:rounded-lg mt-8 md:w-2/3 border border-gray-400">
                <div class="px-4 py-2 sm:px-6 text-white bg-blue-500">
                    <h3 class="font-semibold">Effort</h3>
                </div>
                <div class="border-t border-gray-200">
                    <div class="px-4 py-5 sm:p-6">
                        <div class="mb-4">
                            <span class="font-medium">Add:</span>
                            <a href="{% url 'engagements:effort_create' engagement.pk 'TRAVEL' %}"
                               class="text-blue-600 hover:underline ml-2">Travel</a>
                            <a href="{% url 'engagements:effort_create' engagement.pk 'PLANNING' %}"
                               class="text-blue-600 hover:underline ml-2">Planning</a>
                            <a href="{% url 'engagements:effort_create' engagement.pk "REGULATION" %}"
                               class="text-blue-600 hover:underline ml-2">Regulation</a>
                            <a href="{% url 'engagements:effort_create' engagement.pk "REPORTING" %}"
                               class="text-blue-600 hover:underline ml-2">Reporting</a>
                        </div>

                        {% if effort %}
                            <table class="border-collapse border border-slate-400 min-w-full divide-y divide-gray-200">
                                <thead class="bg-gray-50">
                                <tr>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                        Type
                                    </th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                        Date
                                    </th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                        Planned Hours
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                        Actual Hours
                                    </th>
                                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                        Actions
                                    </th>
                                </tr>
                                </thead>
                                <tbody class="bg-white divide-y divide-gray-200">
                                {% for e in effort.all %}
                                    <tr>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">{{ e.effort_type|lower|capfirst }}</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                                            {{ e.proposed_start_date|date:"d M Y" }}</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ e.effort_ }}</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{{ e.effort_actual }}</td>
                                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
                                            <button class="text-indigo-600 hover:text-indigo-900"
                                                    hx-get="{% url 'engagements:effort_detail' e.id %}"
                                                    hx-target="#effort-detail-{{ e.id }}"
                                                    hx-swap="outerHTML"
                                                    hx-trigger="click">
                                                View Details
                                            </button>

                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="5">
                                            <div id="effort-detail-{{ e.id }}"
                                                 class="hidden bg-gray-100 p-4"></div>
                                        </td>
                                    </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                            <!-- Total Effort -->
                            <div class="flex items-center space-x-2 my-2">
                                <span class="text-black text-sm font-semibold">Total Actual Effort: {{ effort_total }} hrs</span>
                            </div>

                        {% else %}
                            <p class="text-gray-500">No effort records found for this engagement.</p>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        function toggleEffortDetail(button, effortId) {
            const detailDiv = document.getElementById(`effort-detail-${effortId}`);
            if (detailDiv.classList.contains('hidden')) {
                button.textContent = 'Hide Details';
            } else {
                button.textContent = 'Show Details';
                detailDiv.classList.add('hidden');
            }
        }

    </script>
{% endblock content %}