{% 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 Address</h4>
					<p class="mb-0">{{ location.name }}</p>
				</div>
				<div class="card-body">
					<div class="container">
						{{ form_start(form) }}

						{{ form_errors(form) }}
						<div class="row">
							<div class='col'>
								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='address_form_name' class='form-label'>Name</label>
									<input type='text' name='{{ field_name(form.name) }}' id='address_form_nameame' value='{{ field_value(form.name) }}' class='form-control' required='required'/>
								</div>

								<div class='input-group input-group-outline mb-3'>
									{% for c in cases %}
										<div>
											<input type='checkbox' name='cases[]' id='{{ c.id }}' value='{{ c.id }}' {% for id in inCases %} {% if c.id == id %} checked='checked' {% endif %} {% endfor %}/>
											<label for='{{ c.id }}' style='margin:5px'>{{ c.caseName }}</label>
										</div>
									{% endfor %}
								</div>
							</div>
							<div class='col'>
								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='address_form_address' class='form-label'>Address</label>
									<input type='text' name='{{ field_name(form.address) }}' id='address_form_address' value='{{ field_value(form.address) }}' class='form-control'/>
								</div>

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

								<div class='input-group input-group-outline mb-3'>
									<label for='address_form_state'></label>
									<select name='{{ field_name(form.state) }}' id='address_form_state' class='form-control'>
										<option value=''>-- Select State --</option>

										{% for s in enum('App\\Enums\\State').cases() %}
											<option value='{{ s.value }}' {% if s.value == location.state.value %} selected='selected' {% endif %}>{{ s.name }}</option>
										{% endfor %}
									</select>
								</div>

								<div class='input-group input-group-outline mb-3 is-filled'>
									<label for='address_form_zip' class='form-label'>Zip</label>
									<input type='text' name='{{ field_name(form.zip) }}' id='address_form_zip' value='{{ field_value(form.zip) }}' 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">Save Address</button>
							</div>
						</div>
						{{ form_end(form) }}
					</div>
				</div>
			</div>
		</section>
	</main>
{% endblock %}
