<section class="content-header">
	<div class="container-fluid">
		<div class="row mb-2">
			<div class="col-sm-12">
				<h1>FORM PROSES PERBAIKAN</h1>
			</div>

		</div>
	</div>
</section>

<div id="flash" data-flash="<?= $this->session->flashdata('success'); ?>"></div>

<!-- Main content -->
<section class="content">

	<div class="card w-100">
		<div type="button" class="card-header" href="#collapseCard1" data-toggle="collapse" role="button" aria-expanded="true" aria-controls="collapseCard2">
			<h3 class=" fa-1x text-center font-bold">DAFTAR MOBIL PERBAIKAN</h3>
		</div>
		<div class="collapse" id="collapseCard1">
			<div class="card-body">
				<div class="row">


					<?php foreach ($bmproses->result() as $am => $data) : ?>
						<div class="col-12 col-md-6 col-sm-12 mt-1 ">
							<a href="<?= site_url('ssProses/editBM/' . $data->id_sell) ?>" class="btn btn-block btn-lg <?= $data->sell_tgl == date('d / m / Y') ? 'btn-outline-primary' : 'btn-primary' ?> text-uppercase"> <?= $data->car_plat ?> : <?= $data->car_merek ?> <?= $data->car_model ?> <?= $data->car_th ?>
							</a>
						</div>
					<?php endforeach ?>

				</div>
			</div>
		</div>
	</div>

	<div class="row">

		<div class="col-12 mt-2 ">
			<div class="card card-outline card-primary p-2">
				<div class="row">
					<?php foreach ($get_id->result() as $am => $data) : ?>
						<?php $idsell = $data->id_sell ?>
						<div class="col-12 col-lg-12 col-sm-12 text-bold fa-2x text-center text-primary ">
							KLINIK MOBIL App V.1.0
						</div>
						<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text"><i class="fas fa-calendar-alt"></i></span>
								</div>
								<input readonly="on" name="sell_tgl" type="text" class="form-control " value="<?= $data->sell_tgl ?>">
								<input readonly="on" name="sell_bln" type="hidden" class="form-control " value="<?php echo date('m / Y') ?>">
								<input readonly="on" name="sell_th" type="hidden" class="form-control " value="<?php echo date('Y') ?>">

							</div>
						</div>
						<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text"><i class="fas fa-file-invoice"></i></span>
								</div>
								<input readonly="on" type='text' class='form-control' name="invoice_no" value="<?= $data->invoice_no ?>">
							</div>
						</div>



						<div class="col-12 col-lg-12 col-sm-12 mt-2 ">
							<hr class=" badge-primary mb-1 mt-2">
						</div>

						<div class="col-12 col-lg-12 col-sm-12 mt-2 ">
							<div type="button" class=" btn btn-lg btn-outline-primary w-100 card-header shadow" href="#collapseCard1" data-toggle="collapse" role="button" aria-expanded="true" aria-controls="collapseCard2">
								<h3 class="  fa-1x text-center font-bold">CEK DATA KENDARAAN ( <a class="text-uppercase"><?= $data->car_plat ?></a> )
							</div>
							<div class="collapse" id="collapseCard1">

								<div class="row">
									<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-file-invoice"></i> &nbsp;</span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="pel_nama" value="<?= $data->pel_nama ?>" type="text" placeholder="Nama Pelangan">
										</div>
									</div>

									<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-phone"></i></span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="pel_hp" value="<?= $data->pel_hp ?>" type="text" placeholder="No. handpone">
										</div>
									</div>
								</div>

								<div class="row">
									<div class="col-12 col-lg-12 col-sm-12 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-map-marked-alt"></i></span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="pel_alamat" value="<?= $data->pel_alamat ?>" type="text" placeholder="alamat">
										</div>
									</div>
								</div>

								<hr class=" badge-primary mb-1 mt-2">

								<div class="row">
									<div class="col-12 col-lg-3 col-sm-3 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-car"></i> &nbsp;</span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="car_plat" value="<?= $data->car_plat ?>" type="text" placeholder="BM 1234 SS">

										</div>
									</div>

									<div class="col-12 col-lg-3 col-sm-3 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-car"></i> </span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="car_merek" value="<?= $data->car_merek ?>" type="text" placeholder="Brand Mobil">

										</div>
									</div>

									<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-car"></i></span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="car_model" value="<?= $data->car_model ?>" type="text" placeholder="Model Mobil">

										</div>
									</div>

									<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-car-side"></i></span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="car_modelcode" value="<?= $data->car_modelcode ?>" type="text" placeholder="Model Code">

										</div>
									</div>

									<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-calendar-alt"></i> &nbsp;</span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="car_th" value="<?= $data->car_th ?>" type="text" placeholder="Model Code">
										</div>
									</div>

									<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-vote-yea"></i></span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="car_engine" value="<?= $data->car_engine ?>" type="text" placeholder="Engine">

										</div>
									</div>

									<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-car-alt"></i></span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="car_volume" value="<?= $data->car_volume ?>" type="text" placeholder="Volume">

										</div>
									</div>

									<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-crop-alt"></i> &nbsp;</span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="car_frameno" value="<?= $data->car_frameno ?>" type="text" placeholder="Frame No">

										</div>
									</div>

									<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-tint"></i> &nbsp; </span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="car_color" value="<?= $data->car_color ?>" type="text" placeholder="Colour">

										</div>
									</div>

									<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-cog"></i> &nbsp; </span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="car_axle" value="<?= $data->car_axle ?>" type="text" placeholder="Trans / Axle">

										</div>
									</div>

									<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
										<div class="input-group align-center">
											<div class="input-group-prepend">
												<span class="input-group-text"><i class="fas fa-tachometer-alt"></i></span>
											</div>
											<input required autocomplete="off" class="form-control text-uppercase" name="car_odometer" value="<?= $data->car_odometer ?>" type="text" placeholder="Odometer">

										</div>
									</div>
								<?php endforeach ?>

								</div>
							</div>
						</div>
				</div>
			</div>
		</div>
	</div>

	<div class="row">
		<div class="col-12 ">
			<div class="card card-outline card-primary p-3">
				<button class="btn btn-secondary" data-toggle="modal" data-target="#tambahanalisa">Input Data Kerusakan</button>
				<div class="card-body table-responsive p-0" style="height: 250px;">
					<table class="table table-sm table-head-fixed text-nowrap">
						<tr>
							<th scope=" col ">No</th>
							<th class=" text-left" style="width: 60%" scope="col">Job Description / Keluhan Pelangan</th>
							<th style="width: 40px  text-right" scope="col">Jam</th>
							<th scope="col">Flate Rate</th>
							<th scope="col">Total</th>
							<th scope="col">Proses</th>
							<th scope="col">Status</th>

						</tr>
						<tbody class=" table-sm" id="cart_tabel">
							<?php $no = 1;
							if ($getrusak->num_rows() > 0) {
								foreach ($getrusak->result() as $c => $data) { ?>
									<tr style="font-size: 15px">
										<td style="width: 50px" scope="row"><?= $no++ ?>.</td>
										<td class=" text-left " scope="col"> <?= $data->nama_rusak ?></td>
										<td style="width: 50px;" scope="col"><?= $data->jam_rusak ?></td>
										<td scope="col"><?= indo_currency($data->harga_rusak) ?></td>
										<td scope="col" id="totala"><?= indo_currency($data->total_rusak) ?></td>
										<td scope="col">
											<?= $data->status_rusak > 0 ? '
											<button class="btn btn-success btn-sm disabled" >Selesai</button>'
												:
												'
												<button class="btn btn-danger btn-sm disabled" >Proses</button>
											'
											?>
										</td>
										<td scope="col">
											<div class="btn-group" role="group" aria-label="Basic example">
												<button type="button" data-toggle="modal" data-target="#exampleModal" id="select" data-id_sell_rusak="<?= $data->id_sell_rusak ?>" data-nama_rusak="<?= $data->nama_rusak ?>" data-jam_rusak="<?= $data->jam_rusak ?>" data-harga_rusak="<?= $data->harga_rusak ?>" data-status_rusak="<?= $data->status_rusak ?>" class="btn btn-secondary btn-sm"><i class="fas fa-edit"></i></button>

												<a id="btn-hapus" href="<?= site_url('ssProses/delrusk/' . $data->id_sell_rusak) ?>">
													<button type="button" class="btn btn-warning btn-sm"><i class="fas fa-trash-alt"></i></button>
												</a>
											</div>
										</td>
									</tr>
							<?php
								}
							} else {
								echo '<tr>
										<td colspan="8" class="text-center"> Tidak Data Kerusakan yang di catat </td>
									</tr>';
							} ?>
						</tbody>
					</table>

				</div>
			</div>
		</div>
	</div>

	<div class="row">
		<div class="col-12 ">
			<div class="card card-outline card-primary p-3">
				<button class="btn btn-secondary w-100 mb-2 " type="submit" data-toggle="modal" data-target="#tambahperbakan">Input Data Spearpart</button>
				<div class="card-body table-responsive p-0" style="height: 250px;">
					<table class="table table-sm table-head-fixed text-nowrap">
						<tr>
							<th scope=" col ">No</th>
							<th class=" text-left" style="width: 15%" scope="col">Part number</th>
							<th class=" text-left" style="width: 50%" scope="col">Part Name</th>
							<th style="width: 40px  text-right" scope="col">Qty</th>
							<th scope="col">total</th>
							<th scope="col">Terpasang</th>
							<th scope="col">Status</th>

						</tr>
						<tbody class=" table-sm">
							<?php $no = 1;
							if ($getsparepart->num_rows() > 0) {
								foreach ($getsparepart->result() as $c => $data) { ?>
									<tr>
										<td style="width: 50px" scope="row"><?= $no++ ?>.</td>
										<td class=" text-left " scope="col"> <?= $data->barcode_brg ?></td>
										<td class=" text-left " style="width: 50px;" scope="col"><?= $data->name_brg ?></td>
										<td style="width: 50px;" scope="col"><?= $data->stok_brg ?></td>
										<td scope="col"><?= indo_currency($data->stok_brg  *  $data->hargau_brg) ?></td>
										<td scope="col">
											<?= $data->sell_part_status > 0 ? '
											<button class="btn btn-success btn-sm disabled" >selesai</button>'
												:
												'
												<button class="btn btn-primary btn-sm disabled" >Belum</button>
											'
											?>
										<td scope="col">
											<div class="btn-group" role="group" aria-label="Basic example">
												<button type="button" data-toggle="modal" data-target="#editpart" id="selectitem" class="btn btn-secondary btn-sm" data-name_brg="<?= $data->name_brg ?>" data-hargam_brg="<?= $data->hargam_brg ?>" data-hargau_brg="<?= $data->hargau_brg ?>" data-barcode_brg="<?= $data->barcode_brg ?>" data-stok_brg="<?= $data->stok_brg ?>" data-id_katbrgstok="<?= $data->id_katbrgstok ?>" data-id_sell_part="<?= $data->id_sell_part ?>" data-pasang_brg="<?= $data->pasang_brg ?>"><i class="fas fa-user"></i></button>

												<a id="btn-hapus" href="<?= site_url('ssProses/delpart/' . $data->id_sell_part) ?>">
													<button type="button" class="btn btn-warning btn-sm"><i class="fas fa-trash-alt"></i></button>
												</a>
											</div>
										</td>

										</td>
									</tr>
							<?php
								}
							} else {
								echo '<tr>
										<td colspan="8" class="text-center"> Tidak Data Sparepart yang di catat </td>
									</tr>';
							} ?>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>

</section>

<div class="modal fade bd-example-modal-lg" id="tambahperbakan" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
	<div class="modal-dialog modal-dialog-centered modal-lg " role="document">
		<div class="modal-content">

			<div class="modal-body">

				<button class="btn btn-outline-primary w-100" data-toggle="modal" data-target="#exampleModal1">Cek Data Sparepart Gudang</button>
				<form action="<?= base_url('ssProses/addpart'); ?>" method="post">
					<div class='row'>

						<div class="col-12 col-lg-4 col-sm-12 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text "><i class="fas fa-tools"></i></span>
								</div>
								<input id="barcodebrg" autocomplete="off" placeholder="Part Number" name="barcode_brg" type="text" class="form-control ">
							</div>
						</div>

						<div class="col-12 col-lg-8 col-sm-12 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text "><i class="fas fa-archive"></i></span>
								</div>
								<input id="merekbrg" value="" autocomplete="off" placeholder="Part Name" name="name_brg" type="text" class="form-control ">
							</div>
						</div>

						<div class="col-12 col-lg-4 col-sm-12 mt-2 ">
							<div class="input-group">
								<div class="input-group-prepend">
									<span class="input-group-text"><i class="fas fa-box-open"></i></span>
								</div>
								<select name="stok_brg" class="custom-select" value="<?= set_value('stok_brg'); ?>" required>
									<?php $mer = $this->input->post('stok_brg') ?>
									<option value=''>- Jumlah -</option>
									<option value="0.5">0.5</option>
									<option value="1">1</option>
									<option value="1.5">1.5</option>
									<option value="2">2</option>
									<option value="2.5">2.5</option>
									<option value="3">3</option>
									<option value="3.5">3.5</option>
									<option value="4">4</option>
									<option value="4.5">4.5</option>
									<option value="5">5</option>
									<option value="6">6</option>
									<option value="7">7</option>
									<option value="8">8</option>
									<option value="9">9</option>
									<option value="10">10</option>
									<option value="11">11</option>
									<option value="12">12</option>
									<option value="13">13</option>
									<option value="14">14</option>
									<option value="15">15</option>

								</select>
							</div>
						</div>

						<div class="col-12 col-lg-8 col-sm-12 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text mb-2"><i class="fas fa-money-bill-wave-alt"></i></span>
								</div>
								<input id="hargaubrg" value="" autocomplete="off" placeholder="Harga Part" name="hargau_brg" type="text" class="form-control mb-2 ">

							</div>
						</div>
					</div>
					<form action="<?= base_url('ssProsesedit/addpart'); ?>" method="post">
						<input name="id_sell" value="<?= $idsell ?>" type="hidden" class="form-control mb-2 ">

						<input id="hargambrg" value="" autocomplete="off" placeholder="modal Part" name="hargam_brg" type="hidden" class="form-control mb-2 ">
						<input id="idkatbrgstok" value="" autocomplete="off" placeholder="id Part" name="id_katbrgstok" type="hidden" class="form-control mb-2 ">
						<button type="submit" class="btn btn-secondary w-100">Tambah Item Perbaikan</button>
					</form>

			</div>

		</div>
	</div>
</div>

<div class="modal fade bd-example-modal-lg" id="editpart" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
	<div class="modal-dialog modal-dialog-centered modal-lg " role="document">
		<div class="modal-content">

			<div class="modal-body">

				<form action="<?= base_url('ssProses/editpart'); ?>" method="post">
					<div class='row'>

						<div class="col-12 col-lg-4 col-sm-12 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text mb-2"><i class="fas fa-tools"></i></span>
								</div>
								<input id="barcodebrg2" readonly value="" autocomplete="off" placeholder="Part Number" name="barcode_brg" type="text" class="form-control mb-2 ">
							</div>
						</div>

						<div class="col-12 col-lg-8 col-sm-12 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text mb-2"><i class="fas fa-archive"></i></span>
								</div>
								<input id="namebrg2" readonly value="" autocomplete="off" placeholder="Part Name" name="name_brg" type="text" class="form-control mb-2 ">
							</div>
						</div>

						<div class="col-12 col-lg-4 col-sm-12 mt-2 ">
							<div class="input-group">
								<div class="input-group-prepend">
									<span class="input-group-text"><i class="fas fa-box-open"></i></span>
								</div>
								<select id="stokbrg2" name="stok_brg" disabled class="custom-select" value="<?= set_value('stok_brg'); ?>" required>
									<?php $mer = $this->input->post('stok_brg') ?>
									<option value=''>- Pilih Jumlah -</option>
									<option value="1" <?= $mer == '1' ? "selected" : null ?>>1</option>
									<option value="1.5" <?= $mer == '1.5' ? "selected" : null ?>>3</option>
									<option value="2" <?= $mer == '2' ? "selected" : null ?>>2</option>
									<option value="2.5" <?= $mer == '2.5' ? "selected" : null ?>>3</option>
									<option value="3" <?= $mer == '3' ? "selected" : null ?>>3</option>
									<option value="3.5" <?= $mer == '3.5' ? "selected" : null ?>>3</option>

									<option value="4" <?= $mer == '4' ? "selected" : null ?>>4</option>
									<option value="4.5" <?= $mer == '4.5' ? "selected" : null ?>>3</option>
									<option value="5" <?= $mer == '5' ? "selected" : null ?>>5</option>
									<option value="6" <?= $mer == '6' ? "selected" : null ?>>6</option>
									<option value="7" <?= $mer == '7' ? "selected" : null ?>>7</option>
									<option value="8" <?= $mer == '8' ? "selected" : null ?>>8</option>
									<option value="9" <?= $mer == '9' ? "selected" : null ?>>9</option>
									<option value="10" <?= $mer == '10' ? "selected" : null ?>>10</option>
									<option value="11" <?= $mer == '11' ? "selected" : null ?>>11</option>
									<option value="12" <?= $mer == '12' ? "selected" : null ?>>13</option>
									<option value="13" <?= $mer == '13' ? "selected" : null ?>>13</option>
									<option value="14" <?= $mer == '14' ? "selected" : null ?>>14</option>
									<option value="15" <?= $mer == '15' ? "selected" : null ?>>15</option>

								</select>
							</div>
						</div>

						<div class="col-12 col-lg-8 col-sm-12 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text mb-2"><i class="fas fa-money-bill-wave-alt"></i></span>
								</div>
								<input id="hargaubrg2" readonly value="" autocomplete="off" placeholder="Harga Part" name="hargau_brg" type="text" class="form-control mb-2 ">

							</div>
						</div>

						<input id="idsellpart" name="id_sell_part" value="" type="hidden" class="form-control mb-2 ">

						<input id="hargambrg2" value="" autocomplete="off" placeholder="modal Part" name="hargam_brg" type="hidden" class="form-control mb-2 ">
						<input id="idkatbrgstok2" value="" autocomplete="off" placeholder="id Part" name="id_katbrgstok" type="hidden" class="form-control mb-2 ">

						<div class="col-12 col-lg-12 col-sm-12 mt-2 ">
							<div class="input-group">
								<select id="pasangbrg" name="pasang_brg" class="custom-select" value="<?= set_value('pasang_brg'); ?>" required>
									<?php $mek = $this->input->post('pasang_brg') ?>

									<option value="">PEMASANGAN PART</option>
									<?php foreach ($mekanik->result() as $key => $data) { ?>
										<option value="<?= $data->nama  ?>" <?= $mek == $data->nama  ? "selected" : null ?>> <?= $data->nama ?></option>
									<?php } ?>
								</select>
								<div class="input-group-append">
									<button class="btn btn-secondary" type="submit">Laporkan Pemasangan</button>
								</div>
							</div>
						</div>
					</div>

				</form>

			</div>

		</div>
	</div>
</div>

<!-- Modal katalog perbaikan -->
<div class="modal fade " id="exampleModal1" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
	<div class="modal-dialog modal-dialog-centered modal-xl " role="document">
		<div class="modal-content ">
			<div class="modal-body">

				<div class="table table-s p-1  ">
					<table style="font-size: 13px;" class=" table-hover  text-gray-900 table-responsive-lg w-100 " id="example1">
						<thead>
							<th class="text-left">Catalog</th>
							<th class="text-left">Part Number</th>
							<th class="text-left">Merek</th>
							<th class="text-left">Part name </th>
							<th class="text-left">Stok Awal</th>
							<th class="text-left">Harga</th>
							<th style="width: 10px" scope="col">Status</th>
							</tr>
						</thead>
						<?php foreach ($getpart->result() as $am => $data) : ?>

							<tr class=" table-sm ">
								<td class="text-left text-uppercase"><?= $data->nama_katbrg ?></td>

								<td class="text-left text-uppercase"><?= $data->barcode_brg ?></td>
								<td class="text-left text-uppercase w-25"><?= $data->merek_brg ?></td>
								<td class="text-left text-uppercase"><?= $data->name_brg ?></td>

								<td class="text-left text-uppercase"><?= $data->stok_brg ?></td>
								<td class="text-left text-uppercase "><?= $data->hargau_brg ?></td>

								<td>
									<button type="button" class="btn btn-success" id="selectpart" data-merek_brg="<?= $data->merek_brg ?> <?= $data->name_brg ?>" data-hargam_brg="<?= $data->hargam_brg ?>" data-hargau_brg="<?= $data->hargau_brg ?>" data-barcode_brg="<?= $data->barcode_brg ?>" data-id_katbrgstok="<?= $data->id_katbrgstok ?>">
										<i class=" fas fa-cart-arrow-down"></i>
									</button>
								</td>
							</tr>

						<?php endforeach ?>
						</tbody>

					</table>

				</div>
			</div>
		</div>
	</div>
</div>

<!-- start laporan analisa Mobil -->
<form action="<?= base_url('ssProses/editanalisa'); ?>" method="post">
	<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
			<div class="modal-content">
				<div class="modal-body">
					<div class='row'>

						<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text mb-2"><i class="fas fa-tools"></i></span>
								</div>
								<input id="idsellrusak" name="id_sell_rusak" value="" type="hidden" class="form-control mb-2 ">
								<input id="namarusak" autocomplete="off" placeholder="Nama kerusakan" name="nama_rusak" type="text" class="form-control mb-2 ">
							</div>
						</div>
						<!--
						<div class="col-12 col-lg-4 col-sm-4 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text mb-2"><i class="fas fa-clock"></i></span>
								</div>
								<input id="jamrusak" value="" autocomplete="off" placeholder="Jam" name="jam_rusak" type="text" class="form-control mb-2 ">
							</div>
						</div>
						-->
						<input id="jamrusak" value="" autocomplete="off" placeholder="Jam" name="jam_rusak" type="hidden" class="form-control mb-2 ">

						<div class="col-12 col-lg-6 col-sm-6 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text mb-2"><i class="fas fa-money-bill-wave-alt"></i></span>
								</div>
								<input id="hargarusak" value="" autocomplete="off" placeholder="Flate Rate" name="harga_rusak" type="text" class="form-control mb-2 ">
							</div>
						</div>

						<div class="col-12 col-lg-12 col-sm-12 mt-2 ">
							<div class="input-group">
								<select id="statusrusak" name="status_rusak" class="custom-select" value="<?= $this->input->post('status_rusak') ?>" require>
									<?php $pass = $this->input->post('status_rusak') ?>
									<option selected>Status Pekerjaan</option>
									<option value="1" <?= $pass = 1 ? "selected" : null ?>>Pekerjaan Selesai</option>
									<option value="0" <?= $pass = 0 ? "selected" : null ?>>Pekerjaan Dalam Proses</option>
								</select>
								<div class="input-group-append">
									<button class="btn btn-secondary" type="submit">Laporkan Hasil Pekerjaan</button>
								</div>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>
	</div>
</form>
<!-- ending analisa Mobil -->

<!-- start analisa Mobil -->
<div class="modal fade bd-example-modal-lg" id="tambahanalisa" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
	<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
		<div class="modal-content">
			<div class="modal-body">
				<form action="<?= base_url('ssProses/addanalisa'); ?>" method="post">

					<div class='row'>
						<div class="col-12 col-lg-12 col-sm-12 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text mb-2"><i class="fas fa-tools"></i></span>
								</div>
								<input name="id_sell" value="<?= $idsell ?>" type="hidden" class="form-control mb-2 ">
								<input autocomplete="off" placeholder="Nama kerusakan" name="nama_rusak" type="text" class="form-control mb-2 ">
							</div>
						</div>
						<!--
						<div class="col-12 col-lg-12 col-sm-12 mt-2 ">
							<div class="input-group">
								<div class="input-group-prepend">
									<span class="input-group-text"><i class="fas fa-clock"></i></span>
								</div>
								<input autocomplete="off" placeholder="Jam" name="jam_rusak" type="text" class="form-control">
								<div class="input-group-append">
									<button type="submit" class="btn btn-secondary w-100">Tambah Analisa Kerusakan</button>
								</div>
							</div>
						</div>

		
						<div class="col-12 col-lg-8 col-sm-8 mt-2 ">
							<div class="input-group align-center">
								<div class="input-group-prepend">
									<span class="input-group-text mb-2"><i class="fas fa-money-bill-wave-alt"></i></span>
								</div>
								<input autocomplete="off" placeholder="Flate Rate" name="harga_rusak" type="text" class="form-control mb-2 ">
							</div>
						</div>
						-->
						<button type="submit" class="btn btn-secondary w-100">Tambah Analisa Kerusakan</button>

					</div>
				</form>

			</div>
		</div>
	</div>
</div>
<!-- ending analisa Mobil -->

<script src="<?php echo base_url(); ?>/assets/dist/js/jquery-2.1.1.js"></script>
<script>
	$(document).ready(function() {
		$(document).on('click', '#select', function() {
			var id_sell_rusak = $(this).data('id_sell_rusak');
			var nama_rusak = $(this).data('nama_rusak');
			var jam_rusak = $(this).data('jam_rusak');
			var harga_rusak = $(this).data('harga_rusak');
			var status_rusak = $(this).data('status_rusak');

			$('#idsellrusak').val(id_sell_rusak);
			$('#namarusak').val(nama_rusak);
			$('#jamrusak').val(jam_rusak);
			$('#hargarusak').val(harga_rusak);
			$('#statusrusak').val(status_rusak);
		})
	})

	$(document).ready(function() {
		$(document).on('click', '#selectitem', function() {
			var id_katbrgstok = $(this).data('id_katbrgstok');
			var id_sell_part = $(this).data('id_sell_part');
			var name_brg = $(this).data('name_brg');
			var hargam_brg = $(this).data('hargam_brg');
			var hargau_brg = $(this).data('hargau_brg');
			var barcode_brg = $(this).data('barcode_brg');
			var koderak_brg = $(this).data('koderak_brg');
			var stok_brg = $(this).data('stok_brg');
			var pasang_brg = $(this).data('pasang_brg');

			$('#idkatbrgstok2').val(id_katbrgstok);
			$('#idsellpart').val(id_sell_part);
			$('#stokbrg2').val(stok_brg);
			$('#namebrg2').val(name_brg);
			$('#hargambrg2').val(hargam_brg);
			$('#hargaubrg2').val(hargau_brg);
			$('#barcodebrg2').val(barcode_brg);
			$('#pasangbrg').val(pasang_brg);

		})
	})


	$(document).ready(function() {
		$(document).on('click', '#selectpart', function() {
			var id_katbrgstok = $(this).data('id_katbrgstok');
			var merek_brg = $(this).data('merek_brg');
			var hargam_brg = $(this).data('hargam_brg');
			var hargau_brg = $(this).data('hargau_brg');
			var barcode_brg = $(this).data('barcode_brg');
			var koderak_brg = $(this).data('koderak_brg');

			$('#idkatbrgstok').val(id_katbrgstok);
			$('#merekbrg').val(merek_brg);
			$('#hargambrg').val(hargam_brg);
			$('#hargaubrg').val(hargau_brg);
			$('#barcodebrg').val(barcode_brg);
			$('#exampleModal1').modal('hide');
		})
	})
</script>