{% 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="card card-plain">
				<div class="card-header">
					<h4 class="font-weight-bolder">Case Info</h4>
					<p class="mb-0"></p>
				</div>
				<div class="card-body">
					<div class="container">
						{{ form_errors(form) }}

						{{ form_start(form) }}
						<div class="row">
							<div class='col'>
								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='case_form_caseNumber' class='form-label'>Case #</label>
									<input type='text' name='{{ field_name(form.caseNumber) }}' id='case_form_caseNumber' value='{{ case.caseNumber }}' class='form-control' required='required'/>
								</div>

								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='case_form_dcsCaseId' class='form-label'>DCS Case ID</label>
									<input type='text' name='{{ field_name(form.dcsCaseId) }}' id='case_form_dcsCaseId' value='{{ case.dcsCaseId }}' class='form-control' required='required'/>
								</div>

								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='case_form_admitDate' class='form-label'>Admit Date</label>
									<input type='date' name='{{ field_name(form.admitDate) }}' id='case_form_admitDate' value='{{ case.admitDate|date('Y-m-d', company_timezone) }}' class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3{% if case.closeDate %} is-filled{% endif %}'>
									<label for='case_form_closeDate' class='form-label'>Close Date</label>
									<input type='date' name='{{ field_name(form.closeDate) }}' id='case_form_closeDate' value='{% if case.closeDate %}{{ case.closeDate|date('Y-m-d', company_timezone) }}{% endif %}' class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3'>
									<label for='case_form_caseEmail' class='form-label'>Case Email</label>
									<input type='text' name='{{ field_name(form.caseEmail) }}' id='case_form_caseEmail' value='{{ case.caseEmail }}' class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='case_form_referralType' class='form-label'>Referral Type</label>
									<input type='text' name='{{ field_name(form.referralType) }}' id='case_form_referralType' value='{{ case.referralType }}' class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='case_form_level' class='form-label'>Level</label>
									<select name='{{ field_name(form.level) }}' id='case_form_level' class='form-control'>
										<option value=''></option>
										{% for l in enum('App\\Enums\\CaseLevel').cases() %}
											<option value='{{ l.value }}' {% if case.level.value == l.value %} selected='selected'{% endif %}>{{ l.name }}</option>
										{% endfor %}
									</select>
								</div>

								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='case_form_referralSource' class='form-label'>Referral Source</label>
									<select name='{{ field_name(form.referralSource) }}' id='case_form_referralSource' class='form-control'>
										<option value=''></option>

										{% for src in sources %}
											{% set selected="" %}
											{% if case.referralSource.id == src.id %}
												{% set selected=" selected='selected'" %}
											{% endif %}
											<option value='{{ src.id }}' {{ selected }}>{{ src.name}}</option>
										{% endfor %}
									</select>
								</div>

								<div class='input-group input-group-outline mb-3 {% if case.referralSource2 %}is-filled{% endif %}'>
									<label for='case_form_referralSources2' class='form-label'>2nd Referral Source</label>
									<select name='{{ field_name(form.referralSource2) }}' id='case_form_referralSources2' class='form-control'>
										<option value=''></option>

										{% for src in sources %}
											{% set selected="" %}
											{% if case.referralSource2 and case.referralSource2.id == src.id %}
												{% set selected=" selected='selected'" %}
											{% endif %}
											<option value='{{ src.id }}' {{ selected }}>{{ src.name }}</option>
										{% endfor %}
									</select>
								</div>
							</div>
							<div class='col'>
								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='case_form_firstName' class='form-label'>First Name</label>
									<input type='text' name='{{ field_name(form.firstName) }}' id='case_form_firstName' value='{{ case.firstName }}' class='form-control' required='required'/>
								</div>

								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='case_form_lastName' class='form-label'>Last Name</label>
									<input type='text' name='{{ field_name(form.lastName) }}' id='case_form_lastName' value='{{ case.lastName }}' class='form-control' required='required'/>
								</div>

								<div class='input-group input-group-outline mb-3{% if case.address %} is-filled{% endif %}'>
									<label for='case_form_address' class='form-label'>Address</label>
									<input type='text' name='{{ field_name(form.address) }}' id='case_form_address' value='{{ case.address }}' class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3{% if case.address2 %} is-filled{% endif %}'>
									<label for='case_form_address2' class='form-label'>Address 2</label>
									<input type='text' name='{{ field_name(form.address2) }}' id='case_form_address2' value='{{ case.address2 }}' class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3{% if case.city %} is-filled{% endif %}'>
									<label for='case_form_city' class='form-label'>City</label>
									<input type='text' name='{{ field_name(form.city) }}' id='case_form_city' value='{{ case.city }}' class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3{% if case.state %} is-filled{% endif %}'>
									<label for='case_form_state' class='form-label'>State</label>
									<input type='text' name='{{ field_name(form.state) }}' id='case_form_state' value='{{ case.state }}' class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3{% if case.zip %} is-filled{% endif %}'>
									<label for='case_form_zip' class='form-label'>Zip</label>
									<input type='text' name='{{ field_name(form.zip) }}' id='case_form_zip' value='{{ case.zip }}' class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='case_form_county' class='form-label'>County</label>
									<select name='{{ field_name(form.county) }}' id='case_form_county' class='form-control'>
										<option value=''></option>
										{% for c in enum('App\\Enums\\County').cases() %}
											{% set selected="" %}
											{% if case.county.value %}
												{% set selected=" selected='selected'" %}
											{% endif %}
											<option value='{{ c.value }}' {{ selected }}>{{ c.name }}</option>
										{% endfor %}
									</select>
								</div>

								<div class='input-group input-group-outline mb-3{% if case.insurance %} is-filled{% endif %}'>
									<label for='case_form_insurance' class='form-label'>Insurance</label>
									<input type='text' name='{{ field_name(form.insurance) }}' id='case_form_insurance' value='{{ case.insurance }}' class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3{% if case.medicaid %} is-filled{% endif %}'>
									<label for='case_form_medicaid' class='form-label'>Medicaid</label>
									<input type='text' name='{{ field_name(form.medicaid) }}' id='case_form_medicaid' value='{{ case.medicaid }}' class='form-control'/>
								</div>
							</div>
						</div>
						<div class='row'>
							<div class="text-center">
								<button type="submit" class="btn btn-lg bg-gradient-dark btn-lg w-100 mt-4 mb-0">Update Case</button>
							</div>
						</div>
						{{ form_end(form) }}
					</div>
				</div>
			</div>
		</section>
	</main>
{% endblock %}
