{% 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">Edit Case Member</h4>
					<p class="mb-0">
						{{ member.firstName }}
						{{ member.lastName }}
					</p>
				</div>
				<div class="card-body">
					<div class="container">
						{{ form_errors(form) }}

						{{ form_start(form) }}
						<input type='hidden' name='member_form_case_id' value='{{ caseId }}'/>
						<div class="row">
							<div class='col'>
								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='member_form_lastName' class='form-label'>Last Name</label>
									<input type='text' name='{{ field_name(form.lastName) }}' id='member_form_lastName' value='{{ member.lastName }}' class='form-control' required='required'/>
								</div>

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

								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='member_form_personalId' class='form-label'>ID</label>
									<input type='text' name='{{ field_name(form.personalId) }}' id='member_form_personalId' value='{{ member.personalId }}' class='form-control' required="required"/>
								</div>

								<div class='input-group input-group-outline mb-3{% if member.dob %} is-filled{% endif %}'>
									<label for='member_form_dob' class='form-label'></label>
									<input type='date' name='{{ field_name(form.dob) }}' id='member_form_dob' {% if member.dob %} value='{{ member.dob|date('Y-m-d') }}{% endif %}' class='form-control' required="required"/>
								</div>

								<div class='input-group input-group-outline mb-3{% if member.emergencyContact %} is-filled{% endif %}'>
									<label for='member_form_emergencyContact' class='form-label'>Emergency Contact</label>
									<input type='text' name='{{ field_name(form.emergencyContact) }}' id='member_form_emergencyContact' {% if member.emergencyContact %} value='{{ member.emergencyContact }}' {% endif %} class='form-control'/>
								</div>

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

								<div class='input-group input-group-outline mb-3{% if member.dayPhone %} is-filled{% endif %}'>
									<label for='member_form_dayPhone' class='form-label'>Day Phone</label>
									<input type='text' name='{{ field_name(form.dayPhone) }}' id='member_form_dayPhone' {% if member.dayPhone %} value='{{ member.dayPhone }}' {% endif %} class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3{% if member.eveningPhone %} is-filled{% endif %}'>
									<label for='member_form_eveningPhone' class='form-label'>Evening Phone</label>
									<input type='text' name='{{ field_name(form.eveningPhone) }}' id='member_form_eveningPhone' {% if member.eveningPhone %} value='{{ member.eveningPhone }}' {% endif %} class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3{% if member.cellPhone %} is-filled{% endif %}'>
									<label for='member_form_cellPhone' class='form-label'>Cell Phone</label>
									<input type='text' name='{{ field_name(form.cellPhone) }}' id='member_form_cellPhone' {% if member.cellPhone %} value='{{ member.cellPhone }}' {% endif %} class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3{% if member.email %} is-filled{% endif %}'>
									<label for='member_form_email' class='form-label'>Email</label>
									<input type='email' name='{{ field_name(form.email) }}' id='member_form_email' {% if member.email %} value='{{ member.email }}' {% endif %} class='form-control'/>
								</div>

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

								<div class='input-group input-group-outline mb-3'>
									{% for d in docs %}
										<span class='check'>
											<input type='checkbox' name='{{ field_name(form.docs) }}[]' id='member_form_docs_{{ d.id }}' value='{{ d.id }}' {% if d.isSelected() %} checked='checked' {% endif %} />
											<label for='member_form_docs_{{ d.id }}'>{{ d.title }}</label>
										</span>
									{% endfor %}
								</div>
							</div>
							<div class='col'>
								<div class='input-group input-group-outline mb-3{% if member.address %} is-filled{% endif %}'>
									<label for='member_form_address' class='form-label'>Address</label>
									<input type='text' name='{{ field_name(form.address) }}' id='member_form_address' {% if member.address %} value='{{ member.address }}' {% endif %} class='form-control'/>
								</div>

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

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

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

								<div class='input-group input-group-outline mb-3{% if member.maritalStatus %} is-filled{% endif %}'>
									<label for='member_form_maritalStatus' class='form-label'>Marital Status</label>
									<input type='text' name='{{ field_name(form.maritalStatus) }}' id='member_form_maritalStatus' {% if member.maritalStatus %} value='{{ member.maritalStatus }}' {% endif %} class='form-control'/>
								</div>

								<div class='input-group input-group-outline mb-3{% if member.relationship %} is-filled{% endif %}'>
									<select name="{{ field_name(form.relationship) }}" id='member_form_relationship' class='form-control' required="required">
										<option value=''>-- Select Ralationship --</option>

										{% for rel in enum('App\\Enums\\RelationshipType').cases() %}
											<option value='{{ rel.value }}' {% if rel.name == member.relationship.name %} selected='selected' {% endif %}>{{ rel.name }}</option>
										{% endfor %}
									</select>
								</div>

								<div class='input-group input-group-outline mb-3'>
									<select name="{{ field_name(form.gender) }}" id='member_form_gender' class='form-control' required="required">
										<option value=''>-- Select Gender --</option>

										{% for gen in enum('App\\Enums\\GenderType').cases() %}
											<option value='{{ gen.value }}' {% if gen.name == member.gender.name %} selected='selected' {% endif %}>{{ gen.name }}</option>
										{% endfor %}
									</select>
								</div>

								<div class='input-group input-group-outline mb-3'>
									<select name="{{ field_name(form.race) }}" id='member_form_race' class='form-control'>
										<option value=''>-- Select Race --</option>

										{% for r in enum('App\\Enums\\RaceType').cases() %}
											<option value='{{ r.value }}' {% if r.name == member.race.name %} selected='selected' {% endif %}>{{ r.name }}</option>
										{% endfor %}
									</select>
								</div>

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

								<div class='input-group input-group-outline mb-3'>
									<input type='checkbox' name='{{ field_name(form.isChild) }}' id='member_form_isChild' {% if member.isChild %} checked='checked' {% endif %}/>&nbsp;&nbsp;
									<label for='member_form_isChild'>Child?</label>
								</div>

								<div class='input-group input-group-outline mb-3'>
									<input type='checkbox' name='{{ field_name(form.isParent) }}' id='member_form_isParent' {% if member.isParent %} checked='checked' {% endif %}/>&nbsp;&nbsp;
									<label for='member_form_isParent'>Parent?</label>
								</div>

								<div class='input-group input-group-outline mb-3'>
									<input type='checkbox' name='{{ field_name(form.isAdultChild) }}' id='member_form_isAdultChild' {% if member.isAdultChild %} checked='checked' {% endif %}/>&nbsp;&nbsp;
									<label for='member_form_isAdultChild'>Adult Child?</label>
								</div>

								<div class='input-group input-group-outline mb-3'>
									<input type='checkbox' name='{{ field_name(form.isLegalGuardian) }}' id='member_form_isLegalGuardian' {% if member.isLegalGuardian %} checked='checked' {% endif %}/>&nbsp;&nbsp;
									<label for='member_form_isLegalGuardian'>Legal Guardian?</label>
								</div>

								<div class='input-group input-group-outline mb-3'>
									<input type='checkbox' name='{{ field_name(form.parentsLiveTogether) }}' id='member_form_parentsLiveTogether' {% if member.parentsLiveTogether %} checked='checked' {% endif %}/>&nbsp;&nbsp;
									<label for='member_form_parentsLiveTogether'>Parents Living Together?</label>
								</div>

								<div class='input-group input-group-outline mb-3'>
									<input type='checkbox' name='{{ field_name(form.dcsApproved) }}' id='member_form_dcsApproved' {% if member.dcsApproved %} checked='checked' {% endif %}/>&nbsp;&nbsp;
									<label for='member_form_dcsApproved'>DCS Approved?</label>
								</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">Save Member</button>
							</div>
						</div>
						{{ form_end(form) }}
					</div>
				</div>
			</div>
		</section>
	</main>
{% endblock %}
