{% extends 'base.html.twig' %}

{% block body %}
	{{ block('nav', 'internal/libs/nav.html.twig') }}

	<main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg ">
		{{ block('topnav', 'internal/libs/top-nav.html.twig') }}

		<div class="container-fluid py-2">
			<div class="row">
				<div class="col-12">
					<div class="card my-4">
						<div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2">
							<div class="d-flex justify-content-between bg-gradient-dark shadow-dark border-radius-lg pt-4 pb-3 ps-3 p-2">
								<div>
									<h6 class="text-white text-capitalize ps-3">{{ case.caseName }}</h6>
								</div>
								{% if app.user.id == staffId %}
									<div>
										<button type="button" class="btn btn-block btn-light mb-3" onclick="window.open('{{ path('app_staff_add_note', {caseId: case.id}) }}', '_self')">Add Staff Note</button>
									</div>
								{% endif %}
							</div>
						</div>
						<div class="card-body px-0 pb-2">
							<div class="table-responsive p-0">
								<table class="table align-items-center mb-0">
									<thead>
										<tr>
											<th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Date</th>
											<th class='text-uppercase text-secondary text-xxs font-weight-bolder opacity-7'>Supervisor Signed</th>
											<th class='text-uppercase text-secondary text-xxs font-weight-bolder opacity-7'>Signed</th>
											<th class="text-secondary opacity-7"></th>
										</tr>
									</thead>
									<tbody id='case-list'>
										{% for n in staffNotes %}
											<tr>
												<td>
													<div class='d-flex px-2 py-1'>
														<div class='d-flex flex-column justify-content-center'>
															<h6 class='mb-0 text-small'>{{ n.date|date('F j, Y', company_timezone) }}</h6>
														</div>
													</div>
												</td>
												<td>
													{% if n.supervisorSignDateTime %}
														{{ n.supervisorSignDateTime|date('F j, Y h:i a', company_timezone) }}
													{% endif %}
												</td>
												<td>
													{% if n.workerSignDatetime %}
														{{ n.workerSignDatetime|date('F j, Y h:i a', company_timezone) }}
													{% endif %}
												</td>
												<td class='align-right'>
													{% if isWorker and not n.workerSignDatetime %}
														<a href='{{ path('app_staff_edit_note', {noteId: n.id}) }}' class='text-secondary' title='Edit Note'>
															<i class='material-symbols-rounded opacity-5'>edit</i>
														</a>
														<a href='{{ path('app_staff_sign_my_note', {noteId: n.id}) }}' class='text-secondary' title='Sign Note'>
															<i class='material-symbols-rounded opacity-5'>draw</i>
														</a>
													{% endif %}
													{% if isWorker and n.workerSignDatetime %}
														<a href='{{ path('app_staff_view_note', {noteId: n.id}) }}' class='text-secondary' title='View Note'>
															<i class='material-symbols-rounded opacity-5'>visibility</i>
														</a>
													{% endif %}
													{% if not isWorker and not n.supervisorSignDateTime %}
														<a href='{{ path('app_staff_sign_worker_note', {noteId: n.id}) }}' class='text-secondary' title='Sign Note'>
															<i class='material-symbols-rounded opacity-5'>draw</i>
														</a>
													{% endif %}
													{% if not isWorker and n.supervisorSignDateTime %}
														<a href='{{ path('app_staff_view_note', {noteId: n.id}) }}' class='text-secondary' title='View Note'>
															<i class='material-symbols-rounded opacity-5'>visibility</i>
														</a>
													{% endif %}
												</td>
											</tr>
										{% endfor %}
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</main>
{% endblock %}