<section class="content-header">
	<div class="container-fluid">
		<div id="flash" data-flash="<?= $this->session->flashdata('success'); ?>"></div>
		<div class="row ">
			<div class="col-sm-6">
				<h1>MOTOR ID <button data-toggle="modal" data-target="#foammerek" class="btn btn-sm btn-warning align-middle ">
						<i class="fas fa-plus"></i>
					</button></h1>

			</div>
		</div>
	</div>
</section>
<section class="content">

	<!-- start pencarian -->
	<div class="container-fluid">
		<form action="" method="get">
			<div class="row mb-2 ">
				<div class="col-12">
					<?php if (isset($_GET['Seri'])) {
						$in = $_GET['Seri'];
					} else {
						$in = null;
					} ?>
					<div class="input-group align-center">
						<div class="input-group-prepend">
							<span class="input-group-text"><i class="fas fa-motorcycle"></i></span>
						</div>
						<select name="Seri" class="custom-select text-dark text-uppercase">
							<option value="0" selected>Melihat Data Motor Pilih merek </option>
							<?php foreach ($merekID->result() as $key => $data) { ?>
								<option value="<?= $data->id_merek ?>" <?= $in == $data->id_merek ? "selected" : null ?>> <?= $data->merek_kendaraan ?></option>
							<?php } ?>
						</select>
						<div style="width: 100px" class="input-group-prepend">
							<button type="submit" class="btn btn-outline-secondary w-100">Pilih</button>
						</div>
					</div>
				</div>
		</form>
	</div>
	<!-- ending pencarian -->
	<?= $in  > 0 ?
		'
	<div class="row mb-2 mt-2 ">
		<div class="col-12 col-lg-12 col-sm-12">
			<div class="btn-group mr-2 w-100" role="group" aria-label="First group">
				<button type="button" class="btn btn-secondary w-25 disabled"><i class="fas fa-plus"></i></button>
				<button data-toggle="modal" data-target="#foamtipe" type="button" class="btn btn-outline-secondary w-100 ">Tipe Motor</button>
				<button data-toggle="modal" data-target="#foamseri"type="button" class="btn btn-outline-secondary w-100">Seri Motor</button>
				<button type="button" class="btn btn-secondary w-25 disabled"><i class="fas fa-plus"></i></button>
			</div>
		</div>
	</div>
	'
		:
		''
	?>
	<!-- start data team -->
	<div class="card card-outline card-secondary mt-3">
		<div class="card-header ">
			<h3 class="card-title">Daftar Tipe dan Seri Motor
			</h3>

			<div class="card-tools">
				<button type="button" class="btn btn-tool" data-card-widget="collapse" data-toggle="tooltip" title="Collapse">
					<i class="fas fa-minus"></i></button>
				<button type="button" class="btn btn-tool" data-card-widget="remove" data-toggle="tooltip" title="Remove">
					<i class="fas fa-times"></i></button>
			</div>
		</div>
		<div class="card-body">
			<table id="example1" class="table  table-hover table-sm ">
				<thead>
					<tr class="text-center">
						<th class="text-left">Tipe</th>
						<th class="text-left">Seri</th>
						<th>Status</th>

					</tr>
				</thead>
				<tbody>
					<?php
					if ($seriM->num_rows() > 0) {
						foreach ($seriM->result() as $am => $data) {
					?>
							<tr class="text-center">
								<td class="text-left text-uppercase"><?= $data->tipeken ?></td>
								<td class="text-left text-uppercase"><?= $data->seriken ?></td>
								<td class=" w-25">
									<button data-toggle="modal" data-target="#absenket" class="btn btn-sm btn-warning">
										Detail
									</button>
								</td>
							</tr>
					<?php
						}
					} else {
						echo '<tr>
                                <td colspan="8" class="text-center"> Tidak Ada Tipe Dan Seri Motor Yang tersedia </td>
                                </tr>';
					}
					?>
				</tbody>
			</table>
		</div>
	</div>
	<!-- end data team -->
</section>

<!-- Start modal add merek -->
<form action="<?= base_url('motor/addmerekken'); ?>" method="post">
	<div class="modal fade bd-example-modal-lg" id="foammerek" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg modal-dialog-centered">
			<div class="modal-content">
				<div class="modal-header bg-secondary">
					<h5 class="modal-title" id="exampleModalLabel">Foam Data Merek Motor</h5>
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
				</div>
				<div class="modal-body">

					<div class="input-group mt-2 col-sm-12 ">
						<div class="input-group-prepend">
							<span class="input-group-text">
								<i class="fas fa-motorcycle"></i>
							</span>
						</div>
						<input autocomplete="off" class="form-control text-uppercase" name="merek_kendaraan" type="text" placeholder="Merek Motor">

						<button type="submit" class="btn btn-secondary w-100 mt-3">Simpan Data Merek Motor </button>
					</div>
				</div>
			</div>
		</div>
	</div>
</form>
<!-- ending modal add merek -->

<!-- Start modal add tipe -->
<form action="<?= base_url('motor/addtipeken'); ?>" method="post">
	<div class="modal fade bd-example-modal-lg" id="foamtipe" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg modal-dialog-centered">
			<div class="modal-content">
				<div class="modal-header bg-secondary">
					<h5 class="modal-title" id="exampleModalLabel">Foam Data Seri Motor</h5>
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
				</div>
				<div class="modal-body">

					<div class="input-group mt-2 col-sm-12 ">
						<div class="input-group-prepend">
							<span class="input-group-text">
								<i class="fas fa-motorcycle"></i>
							</span>
						</div>
						<select name="id_merek" class="custom-select text-dark text-uppercase">
							<?php foreach ($merekID->result() as $key => $data) { ?>
								<option value="<?= $data->id_merek ?>" <?= $in == $data->id_merek ? "selected" : null ?>> <?= $data->merek_kendaraan ?></option>
							<?php } ?>
						</select> <input autocomplete="off" class="form-control text-uppercase" name="tipeken" type="text" placeholder="Tipe Motor">

						<button type="submit" class="btn btn-secondary w-100 mt-3">Simpan Data Seri Motor </button>
					</div>
				</div>
			</div>
		</div>
	</div>
</form>
<!-- ending modal add tipe -->

<!-- Start modal add Seri -->
<form action="<?= base_url('motor/addseriken'); ?>" method="post">
	<div class="modal fade bd-example-modal-lg" id="foamseri" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg modal-dialog-centered">
			<div class="modal-content">
				<div class="modal-header bg-secondary">
					<h5 class="modal-title" id="exampleModalLabel">Foam Data Seri Motor</h5>
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
				</div>
				<div class="modal-body">

					<div class="input-group mt-2 col-sm-12 ">
						<div class="input-group-prepend">
							<span class="input-group-text">
								<i class="fas fa-motorcycle"></i>
							</span>
						</div>
						<select name="id_merek" class="custom-select text-dark text-uppercase">
							<?php foreach ($merekID->result() as $key => $data) { ?>
								<option value="<?= $data->id_merek ?>" <?= $in == $data->id_merek ? "selected" : null ?>> <?= $data->merek_kendaraan ?></option>
							<?php } ?>
						</select>

						<select name="id_tipeken" class="custom-select text-dark text-uppercase">
							<?php foreach ($tipeID->result() as $key => $data) { ?>
								<option value="<?= $data->id_tipeken  ?>" ?> <?= $data->tipeken  ?></option>
							<?php } ?>
						</select>

						<input autocomplete="off" class="form-control text-uppercase" name="seriken" type="text" placeholder="Seri Motor">

						<button type="submit" class="btn btn-secondary w-100 mt-3">Simpan Data Seri Motor </button>
					</div>
				</div>
			</div>
		</div>
	</div>
</form>
<!-- ending modal add Seri -->