{% 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') }}

		<section>
			<div class='page-header min-vh-100'>
				<div class='container'>
					<div class="row">
						<div class="col-6 d-lg-flex d-none h-100 my-auto pe-0 position-absolute top-0 start-0 text-center justify-content-center flex-column">
							<div class="position-relative bg-gradient-primary h-100 m-3 px-7 border-radius-lg d-flex flex-column justify-content-center" style="background-image: url('/assets/img/illustrations/illustration-signup.jpg'); background-size: cover;"></div>
						</div>
						<div class='col-xl-4 col-lg-5 col-md-7 d-flex flex-column ms-auto me-auto ms-lg-auto me-lg-5'>
							<div class="card card-plain">
								<div class="card-header">
									<h4 class="font-weight-bolder">Assign Case Worker</h4>
									<p>{{ case.level.name|lower|capitalize }}</p>
								</div>
								<div class="card-body">
									{{ form_start(form, {'attr': {'onsubmit': 'return validateAssignForm()'}}) }}

									{{ form_errors(form) }}

									<div class='input-group input-group-outline mb-3 is-filled'>
										<input type='hidden' id='caseId' value='{{ id }}'/>
										<input type='hidden' id='mustOverride' value="false"/>
										<label for='user_form_caseWorker' class='form-label'>Case Worker</label>
										<select name='{{ field_name(form.user) }}' id='user_form_caseWorker' class='form-control' onchange='javascript:checkLevels()'>
											<option value=''></option>
											{% for w in caseWorkers %}
												{% set selected = (w.id == assignedWorkerId) %}
												<option value='{{ w.id }}' {% if selected %} selected="true" {% endif %}>{{ w.name }} ({{ w.userCases|length }})</option>
											{% endfor %}
										</select>
									</div>

									<div class='input-group input-group-outline mb-3'>
										<input type='checkbox' name='{{ field_name(form.overrideLevel) }}' id='user_form_levelOverride' value='1'/>&nbsp;&nbsp;
										<label for='user_form_levelOverride' id='levelOverride-label'>Override Level</label>
									</div>

									<div class="text-center">
										<button type="submit" id='submit-btn' class="btn btn-lg bg-gradient-dark btn-lg w-100 mt-4 mb-0">Assign Case Worker</button>
									</div>
									{{ form_end(form) }}
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</section>
	</main>
{% endblock %}
