<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>STOK GUDANG PUSAT </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['Part'])) {
						$in = $_GET['Part'];
					} else {
						$in = null;
					} ?>
					<div class="input-group align-center">
						<div class="input-group-prepend">
							<span class="input-group-text badge-primary"><i data-toggle="modal" data-target="#Kategoribarang">
									<i class="fas fa-plus"></i>
								</i></span>
							<span class="input-group-text"><i class="fas fa-box"></i></span>

						</div>
						<select name="Part" class="custom-select text-dark text-uppercase">
							<option value="0" selected>Pilih Katalog Barang </option>
							<?php foreach ($katbrg->result() as $key => $data) { ?>
								<option value="<?= $data->id_katalogbrg ?>" <?= $in == $data->id_katalogbrg ? "selected" : null ?>> <?= $data->nama_katbrg ?></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 mt-2 ">
		<div class="col-12 col-lg-12 col-sm-12">
				<button data-toggle="modal" data-target="#foamSparepart" type="button" class="btn btn-outline-secondary w-100 ">Tambah  Sparepart</button>
		</div>
	</div>
	'
		:
		''
	?>

	<div class="card card-outline card-secondary mt-3">
		<div class="card-header ">
			<h3 class="card-title">Daftar Stok Sparepart
			</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">Koder Rak</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>Status</th>

					</tr>
				</thead>
				<tbody>
					<?php
					if ($Part->num_rows() > 0) {
						foreach ($Part->result() as $am => $data) {
					?>
							<tr class="text-center">
								<td class="text-left text-uppercase"><?= $data->koderak_brg ?></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>
									<a href="" id="select" data-toggle="modal" data-target="#foameditSparepart" class="btn btn-sm btn-warning" data-id_katbrgstok="<?= $data->id_katbrgstok ?>" data-merek_brg="<?= $data->merek_brg ?>" data-hargam_brg="<?= $data->hargam_brg ?>" data-persen_brg="<?= $data->persen_brg ?>" data-hargau_brg="<?= $data->hargau_brg ?>" data-hargac_brg="<?= $data->hargac_brg ?>" data-stok_brg="<?= $data->stok_brg ?>" data-barcode_brg="<?= $data->barcode_brg ?>" data-koderak_brg="<?= $data->koderak_brg ?>" data-name_brg="<?= $data->name_brg ?>" data-img_brg="<?= $data->img_brg ?>" data-datetime="<?= $data->datetime ?>">
										<i class="fas fa-pencil-alt"></i>
									</a>
									<a id="btn-hapus" href="<?= site_url('kmgpusat/delpart/' . $data->id_katbrgstok) ?>" class="btn btn-sm btn-secondary">
										<i class="fas fa-trash-alt"></i>
									</a>
								</td>
							</tr>
					<?php
						}
					} else {
						echo '<tr>
                                <td colspan="8" class="text-center"> Tidak Ada Data Sparepart Yang Tersedia </td>
                                </tr>';
					}
					?>
				</tbody>
			</table>
		</div>
	</div>
</section>

<!-- modal addcatalog barang -->
<form action="<?= base_url('kmgpusat/addkatalog'); ?>" enctype="multipart/form-data" method="post">
	<div class="modal fade " id="Kategoribarang" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-dialog-centered">
			<div class="modal-content">
				<div class="modal-body">

					<div class="row">
						<div class="col-12  ">

							<div class="input-group mt-2 ">
								<div class="input-group-prepend">
									<span class="input-group-text"><i class="fas fa-box"></i></span>
								</div>
								<input autocomplete="off" name="nama_katbrg" type="text" class="form-control text-uppercase" placeholder="Nama Katalog Barang">
							</div>

						</div>

						<div class="col-12 col-lg-12 mt-2 ">
							<button type="submit" class="btn btn-secondary w-100  ">Simpan Katalog Terbaru</button>
						</div>
					</div>

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

</form>
<!-- modal addcatalog barang -->

<!-- modal addpart barang -->
<form action="<?= base_url('kmgpusat/addpart'); ?>" enctype="multipart/form-data" method="post">
	<div class="modal fade bd-example-modal-lg" id="foamSparepart" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg modal-dialog-centered">
			<div class="modal-content">
				<div class="modal-body">

					<div class="row">
						<input autocomplete="off" name="id_katalogbrg" value="<?= $in ?>" type="hidden" id="idkatbrgstok" class="form-control" readonly="on">

						<div class="col-12 col-lg-6 ">
							<img id="gambar" src="<?= base_url() ?>/assets/img/kl.jpg" class="rounded  float-left mb-2" style="width: 100%" alt="...">
							<input autocomplete="off" type="hidden" id="idkatbrgstok" class="form-control" readonly="on">

							<div class="input-group mt-2 ">
								<div class="input-group-prepend">
									<span class="input-group-text">
										<i class="fas fa-photo-video"></i>
									</span>
								</div>

								<div class="custom-file  ">
									<input type="file" name="img_brg" class="custom-file-input " id="file">
									<label id="pilih" class="custom-file-label ">Pilih Foto Sparepart</label>
								</div>
							</div>

							<div class="input-group mt-2">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Kode Rak &nbsp; &nbsp; &nbsp;</span>
								</div>
								<input name="koderak_brg" autocomplete="off" type="text" class="form-control">
							</div>

						</div>


						<div class="col-12 col-lg-6 ">

							<div class="input-group mt-2 ">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Part Number</span>
								</div>
								<input name="barcode_brg" autocomplete="off" type="text" class="form-control">
							</div>

							<div class="input-group mt-2 ">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Merek &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; </span>
								</div>
								<input name="merek_brg" autocomplete="off" type="text" class="form-control">
							</div>

							<div class="input-group mt-2 ">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Part name &nbsp; &nbsp;&nbsp;</span>
								</div>
								<input name="name_brg" autocomplete="off" type="text" class="form-control">
							</div>

							<div class="input-group mt-2 ">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Stok Awal &nbsp; &nbsp;&nbsp;</span>
								</div>
								<input name="stok_brg" autocomplete="off" type="text" class="form-control">
							</div>

							<div class="input-group mt-2">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Modal &nbsp; &nbsp; &nbsp;</span>
								</div>
								<input autocomplete="off" required type="text" name="hargam_brg" id="hargambrg" class="form-control" placeholder="Cth: 10000">
							</div>

							<div class="input-group mt-2 mb-2">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Persen %&nbsp;</span>
								</div>
								<select name="persen_brg" id="persentasejual" class="custom-select" required>
									<?php $persen_brg = $this->input->post('persen_brg') ?>

									<option value="5" <?= $persen_brg == '5' ? "selected" : null ?>>5</option>
									<option value="10" <?= $persen_brg == '10' ? "selected" : null ?>>10</option>
									<option value="15" <?= $persen_brg == '11' ? "selected" : null ?>>11</option>
									<option value="15" <?= $persen_brg == '12' ? "selected" : null ?>>12</option>
									<option value="15" <?= $persen_brg == '13' ? "selected" : null ?>>13</option>
									<option value="15" <?= $persen_brg == '14' ? "selected" : null ?>>14</option>
									<option value="15" <?= $persen_brg == '15' ? "selected" : null ?>>15</option>
									<option value="20" <?= $persen_brg == '20' ? "selected" : null ?>>20</option>
									<option value="20" <?= $persen_brg == '20' ? "selected" : null ?>>21</option>
									<option value="21" <?= $persen_brg == '21' ? "selected" : null ?>>22</option>
									<option value="23" <?= $persen_brg == '23' ? "selected" : null ?>>23</option>
									<option value="24" <?= $persen_brg == '24' ? "selected" : null ?>>24</option>
									<option value="25" <?= $persen_brg == '25' ? "selected" : null ?>>25</option>
									<option value="26" <?= $persen_brg == '26' ? "selected" : null ?>>26</option>
									<option value="27" <?= $persen_brg == '27' ? "selected" : null ?>>27</option>
									<option value="28" <?= $persen_brg == '28' ? "selected" : null ?>>28</option>
									<option value="29" <?= $persen_brg == '29' ? "selected" : null ?>>29</option>
									<option value="30" <?= $persen_brg == '30' ? "selected" : null ?>>30</option>
									<option value="31" <?= $persen_brg == '31' ? "selected" : null ?>>31</option>
									<option value="32" <?= $persen_brg == '32' ? "selected" : null ?>>32</option>
									<option value="33" <?= $persen_brg == '33' ? "selected" : null ?>>33</option>
									<option value="34" <?= $persen_brg == '34' ? "selected" : null ?>>34</option>
									<option value="35" <?= $persen_brg == '35' ? "selected" : null ?>>35</option>
									<option value="36" <?= $persen_brg == '36' ? "selected" : null ?>>36</option>
									<option value="37" <?= $persen_brg == '37' ? "selected" : null ?>>37</option>
									<option value="38" <?= $persen_brg == '38' ? "selected" : null ?>>38</option>
									<option value="39" <?= $persen_brg == '39' ? "selected" : null ?>>39</option>
									<option value="40" <?= $persen_brg == '40' ? "selected" : null ?>>40</option>
									<option value="41" <?= $persen_brg == '41' ? "selected" : null ?>>41</option>
									<option value="42" <?= $persen_brg == '42' ? "selected" : null ?>>42</option>
									<option value="43" <?= $persen_brg == '43' ? "selected" : null ?>>43</option>
									<option value="44" <?= $persen_brg == '44' ? "selected" : null ?>>44</option>
									<option value="45" <?= $persen_brg == '45' ? "selected" : null ?>>45</option>
									<option value="46" <?= $persen_brg == '46' ? "selected" : null ?>>46</option>
									<option value="47" <?= $persen_brg == '47' ? "selected" : null ?>>47</option>
									<option value="48" <?= $persen_brg == '48' ? "selected" : null ?>>48</option>
									<option value="49" <?= $persen_brg == '49' ? "selected" : null ?>>49</option>
									<option value="50" <?= $persen_brg == '50' ? "selected" : null ?>>50</option>
									<option value="51" <?= $persen_brg == '51' ? "selected" : null ?>>51</option>
									<option value="52" <?= $persen_brg == '52' ? "selected" : null ?>>52</option>
									<option value="53" <?= $persen_brg == '53' ? "selected" : null ?>>53</option>
									<option value="54" <?= $persen_brg == '54' ? "selected" : null ?>>54</option>
									<option value="55" <?= $persen_brg == '55' ? "selected" : null ?>>55</option>
									<option value="60" <?= $persen_brg == '60' ? "selected" : null ?>>60</option>
									<option value="65" <?= $persen_brg == '65' ? "selected" : null ?>>65</option>
									<option value="70" <?= $persen_brg == '70' ? "selected" : null ?>>70</option>
									<option value="75" <?= $persen_brg == '75' ? "selected" : null ?>>75</option>
									<option value="80" <?= $persen_brg == '80' ? "selected" : null ?>>80</option>
									<option value="85" <?= $persen_brg == '85' ? "selected" : null ?>>85</option>
									<option value="90" <?= $persen_brg == '90' ? "selected" : null ?>>90</option>
									<option value="95" <?= $persen_brg == '95' ? "selected" : null ?>>95</option>
									<option value="100" <?= $persen_brg == '100' ? "selected" : null ?>>100</option>
									<option value="105" <?= $persen_brg == '105' ? "selected" : null ?>>105</option>
									<option value="110" <?= $persen_brg == '110' ? "selected" : null ?>>110</option>
									<option value="115" <?= $persen_brg == '115' ? "selected" : null ?>>115</option>
									<option value="120" <?= $persen_brg == '120' ? "selected" : null ?>>120</option>
									<option value="125" <?= $persen_brg == '125' ? "selected" : null ?>>125</option>
									<option value="130" <?= $persen_brg == '130' ? "selected" : null ?>>130</option>
									<option value="135" <?= $persen_brg == '135' ? "selected" : null ?>>135</option>
									<option value="140" <?= $persen_brg == '140' ? "selected" : null ?>>140</option>
									<option value="155" <?= $persen_brg == '155' ? "selected" : null ?>>155</option>
									<option value="150" <?= $persen_brg == '150' ? "selected" : null ?>>150</option>
									<option value="155" <?= $persen_brg == '155' ? "selected" : null ?>>155</option>
									<option value="160" <?= $persen_brg == '160' ? "selected" : null ?>>160</option>
									<option value="165" <?= $persen_brg == '165' ? "selected" : null ?>>165</option>
									<option value="170" <?= $persen_brg == '170' ? "selected" : null ?>>170</option>
									<option value="175" <?= $persen_brg == '175' ? "selected" : null ?>>175</option>
									<option value="180" <?= $persen_brg == '180' ? "selected" : null ?>>180</option>
									<option value="185" <?= $persen_brg == '185' ? "selected" : null ?>>185</option>
									<option value="190" <?= $persen_brg == '190' ? "selected" : null ?>>190</option>
									<option value="195" <?= $persen_brg == '195' ? "selected" : null ?>>195</option>
									<option value="200" <?= $persen_brg == '200' ? "selected" : null ?>>200</option> ?>>345</option>
								</select>
							</div>

							<div class="input-group mt-2">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Umum &nbsp; &nbsp;&nbsp; </span>
								</div>
								<input autocomplete="off" name="hargau_brg" type="text" id="hargaubrg" class="form-control" readonly="on">
							</div>
							<div class="input-group mt-2">
								<!--
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Corp&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;</span>
								</div>
								-->
								<input autocomplete="off" name="hargac_brg" type="hidden" id="hargacbrg" class="form-control" readonly="on">

							</div>
						</div>

						<div class="col-12 col-lg-12 mt-2 ">
							<button type="submit" class="btn btn-secondary w-100  ">Simpan Harga Terbaru</button>
						</div>
					</div>

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

</form>
<!-- modal addpart barang -->

<!-- modal addpart barang -->
<form action="<?= base_url('kmgpusat/editpart'); ?>" enctype="multipart/form-data" method="post">
	<div class="modal fade bd-example-modal-lg" id="foameditSparepart" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg modal-dialog-centered">
			<div class="modal-content">
				<div class="modal-body">

					<div class="row">
						<input autocomplete="off" name="id_katalogbrg" value="<?= $in ?>" type="hidden" id="idkatbrgstok" class="form-control" readonly="on">
						<input autocomplete="off" name="id_katbrgstok" value="<?= $in ?>" type="hidden" id="idkatbrgstok1" class="form-control" readonly="on">


						<div class="col-12 col-lg-6 ">
							<img id="imgbrg" src="<?= base_url() ?>/assets/img/kl.jpg" class="rounded  float-left mb-2" style="width: 100%" alt="...">
							<input autocomplete="off" type="hidden" id="idkatbrgstok" class="form-control" readonly="on">

							<div class="input-group mt-2 ">
								<div class="input-group-prepend">
									<span class="input-group-text">
										<i class="fas fa-photo-video"></i>
									</span>
								</div>

								<div class="custom-file  ">
									<input type="file" name="img_brg" class="custom-file-input " id="file">
									<label id="pilih" class="custom-file-label ">Pilih Foto Sparepart</label>
								</div>
							</div>

							<div class="input-group mt-2">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Kode Rak &nbsp; &nbsp; &nbsp;</span>
								</div>
								<input id="koderakbrg" name="koderak_brg" autocomplete="off" type="text" class="form-control">
							</div>

						</div>


						<div class="col-12 col-lg-6 ">

							<div class="input-group mt-2 ">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Part Number</span>
								</div>
								<input id="barcodebrg" name="barcode_brg" autocomplete="off" type="text" class="form-control">
							</div>

							<div class="input-group mt-2 ">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Merek &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; </span>
								</div>
								<input id="merekbrg" name="merek_brg" autocomplete="off" type="text" class="form-control">
							</div>

							<div class="input-group mt-2 ">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Part name &nbsp; &nbsp;&nbsp;</span>
								</div>
								<input id="namebrg" name="name_brg" autocomplete="off" type="text" class="form-control">
							</div>

							<div class="input-group mt-2 ">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Stok Awal &nbsp; &nbsp;&nbsp;</span>
								</div>
								<input id="stokbrg" name="stok_brg" autocomplete="off" type="text" class="form-control" readonly="on">
							</div>

							<div class="input-group mt-2">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Modal &nbsp; &nbsp; &nbsp;</span>
								</div>
								<input autocomplete="off" required type="text" name="hargam_brg" id="hargambrg1" class="form-control" placeholder="Cth: 10000">
							</div>

							<div class="input-group mt-2 mb-2">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Persen %&nbsp;</span>
								</div>
								<select name="persen_brg" id="persentasejual1" class="custom-select" required>
									<?php $persen_brg = $this->input->post('persen_brg') ?>

									<option value="5" <?= $persen_brg == '5' ? "selected" : null ?>>5</option>
									<option value="10" <?= $persen_brg == '10' ? "selected" : null ?>>10</option>
									<option value="15" <?= $persen_brg == '11' ? "selected" : null ?>>11</option>
									<option value="15" <?= $persen_brg == '12' ? "selected" : null ?>>12</option>
									<option value="15" <?= $persen_brg == '13' ? "selected" : null ?>>13</option>
									<option value="15" <?= $persen_brg == '14' ? "selected" : null ?>>14</option>
									<option value="15" <?= $persen_brg == '15' ? "selected" : null ?>>15</option>
									<option value="20" <?= $persen_brg == '20' ? "selected" : null ?>>20</option>
									<option value="20" <?= $persen_brg == '20' ? "selected" : null ?>>21</option>
									<option value="21" <?= $persen_brg == '21' ? "selected" : null ?>>22</option>
									<option value="23" <?= $persen_brg == '23' ? "selected" : null ?>>23</option>
									<option value="24" <?= $persen_brg == '24' ? "selected" : null ?>>24</option>
									<option value="25" <?= $persen_brg == '25' ? "selected" : null ?>>25</option>
									<option value="26" <?= $persen_brg == '26' ? "selected" : null ?>>26</option>
									<option value="27" <?= $persen_brg == '27' ? "selected" : null ?>>27</option>
									<option value="28" <?= $persen_brg == '28' ? "selected" : null ?>>28</option>
									<option value="29" <?= $persen_brg == '29' ? "selected" : null ?>>29</option>
									<option value="30" <?= $persen_brg == '30' ? "selected" : null ?>>30</option>
									<option value="31" <?= $persen_brg == '31' ? "selected" : null ?>>31</option>
									<option value="32" <?= $persen_brg == '32' ? "selected" : null ?>>32</option>
									<option value="33" <?= $persen_brg == '33' ? "selected" : null ?>>33</option>
									<option value="34" <?= $persen_brg == '34' ? "selected" : null ?>>34</option>
									<option value="35" <?= $persen_brg == '35' ? "selected" : null ?>>35</option>
									<option value="36" <?= $persen_brg == '36' ? "selected" : null ?>>36</option>
									<option value="37" <?= $persen_brg == '37' ? "selected" : null ?>>37</option>
									<option value="38" <?= $persen_brg == '38' ? "selected" : null ?>>38</option>
									<option value="39" <?= $persen_brg == '39' ? "selected" : null ?>>39</option>
									<option value="40" <?= $persen_brg == '40' ? "selected" : null ?>>40</option>
									<option value="41" <?= $persen_brg == '41' ? "selected" : null ?>>41</option>
									<option value="42" <?= $persen_brg == '42' ? "selected" : null ?>>42</option>
									<option value="43" <?= $persen_brg == '43' ? "selected" : null ?>>43</option>
									<option value="44" <?= $persen_brg == '44' ? "selected" : null ?>>44</option>
									<option value="45" <?= $persen_brg == '45' ? "selected" : null ?>>45</option>
									<option value="46" <?= $persen_brg == '46' ? "selected" : null ?>>46</option>
									<option value="47" <?= $persen_brg == '47' ? "selected" : null ?>>47</option>
									<option value="48" <?= $persen_brg == '48' ? "selected" : null ?>>48</option>
									<option value="49" <?= $persen_brg == '49' ? "selected" : null ?>>49</option>
									<option value="50" <?= $persen_brg == '50' ? "selected" : null ?>>50</option>
									<option value="51" <?= $persen_brg == '51' ? "selected" : null ?>>51</option>
									<option value="52" <?= $persen_brg == '52' ? "selected" : null ?>>52</option>
									<option value="53" <?= $persen_brg == '53' ? "selected" : null ?>>53</option>
									<option value="54" <?= $persen_brg == '54' ? "selected" : null ?>>54</option>
									<option value="55" <?= $persen_brg == '55' ? "selected" : null ?>>55</option>
									<option value="60" <?= $persen_brg == '60' ? "selected" : null ?>>60</option>
									<option value="65" <?= $persen_brg == '65' ? "selected" : null ?>>65</option>
									<option value="70" <?= $persen_brg == '70' ? "selected" : null ?>>70</option>
									<option value="75" <?= $persen_brg == '75' ? "selected" : null ?>>75</option>
									<option value="80" <?= $persen_brg == '80' ? "selected" : null ?>>80</option>
									<option value="85" <?= $persen_brg == '85' ? "selected" : null ?>>85</option>
									<option value="90" <?= $persen_brg == '90' ? "selected" : null ?>>90</option>
									<option value="95" <?= $persen_brg == '95' ? "selected" : null ?>>95</option>
									<option value="100" <?= $persen_brg == '100' ? "selected" : null ?>>100</option>
									<option value="105" <?= $persen_brg == '105' ? "selected" : null ?>>105</option>
									<option value="110" <?= $persen_brg == '110' ? "selected" : null ?>>110</option>
									<option value="115" <?= $persen_brg == '115' ? "selected" : null ?>>115</option>
									<option value="120" <?= $persen_brg == '120' ? "selected" : null ?>>120</option>
									<option value="125" <?= $persen_brg == '125' ? "selected" : null ?>>125</option>
									<option value="130" <?= $persen_brg == '130' ? "selected" : null ?>>130</option>
									<option value="135" <?= $persen_brg == '135' ? "selected" : null ?>>135</option>
									<option value="140" <?= $persen_brg == '140' ? "selected" : null ?>>140</option>
									<option value="155" <?= $persen_brg == '155' ? "selected" : null ?>>155</option>
									<option value="150" <?= $persen_brg == '150' ? "selected" : null ?>>150</option>
									<option value="155" <?= $persen_brg == '155' ? "selected" : null ?>>155</option>
									<option value="160" <?= $persen_brg == '160' ? "selected" : null ?>>160</option>
									<option value="165" <?= $persen_brg == '165' ? "selected" : null ?>>165</option>
									<option value="170" <?= $persen_brg == '170' ? "selected" : null ?>>170</option>
									<option value="175" <?= $persen_brg == '175' ? "selected" : null ?>>175</option>
									<option value="180" <?= $persen_brg == '180' ? "selected" : null ?>>180</option>
									<option value="185" <?= $persen_brg == '185' ? "selected" : null ?>>185</option>
									<option value="190" <?= $persen_brg == '190' ? "selected" : null ?>>190</option>
									<option value="195" <?= $persen_brg == '195' ? "selected" : null ?>>195</option>
									<option value="200" <?= $persen_brg == '200' ? "selected" : null ?>>200</option>
								</select>
							</div>

							<div class="input-group mt-2">
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Umum &nbsp; &nbsp;&nbsp; </span>
								</div>
								<input autocomplete="off" name="hargau_brg" type="text" id="hargaubrg1" class="form-control" readonly="on">
							</div>
							<div class="input-group mt-2">
								<!--
								<div class="input-group-prepend">
									<span class="input-group-text text-bold">Corp&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;</span>
								</div>
								-->
								<input autocomplete="off" name="hargac_brg" type="hidden" id="hargacbrg1" class="form-control" readonly="on">
							</div>
						</div>

						<div class="col-12 col-lg-12 mt-2 ">
							<button type="submit" class="btn btn-secondary w-100  ">Simpan Harga Terbaru</button>
						</div>
					</div>

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

</form>
<!-- modal addpart barang -->

<script src="<?= base_url() ?>/assets/dist/js/jquery-2.1.1.js"></script>

<script>
	$(document).ready(function() {
		$(document).on('click', '#select', function() {
			var id_katbrgstok = $(this).data('id_katbrgstok');
			var merek_brg = $(this).data('merek_brg');
			var hargam_brg = $(this).data('hargam_brg');
			var persen_brg = $(this).data('persen_brg');
			var hargau_brg = $(this).data('hargau_brg');
			var hargac_brg = $(this).data('hargac_brg');
			var stok_brg = $(this).data('stok_brg');
			var barcode_brg = $(this).data('barcode_brg');
			var koderak_brg = $(this).data('koderak_brg');
			var name_brg = $(this).data('name_brg');
			var img_brg = $(this).data('img_brg');

			var datetime = $(this).data('datetime');
			$('#idkatbrgstok').val(id_katbrgstok);
			$('#idkatbrgstok1').val(id_katbrgstok);
			$('#merekbrg').val(merek_brg);
			$('#namebrg').val(name_brg);
			$('#hargambrg').val(hargam_brg);
			$('#hargambrg1').val(hargam_brg);
			$('#persentasejual').val(persen_brg);
			$('#persentasejual1').val(persen_brg);
			$('#hargaubrg1').val(hargau_brg);
			$('#hargaubrg').val(hargau_brg);
			$('#hargacbrg').val(hargac_brg);
			$('#hargacbrg1').val(hargac_brg);
			$('#stokbrg').val(stok_brg);
			$('#barcodebrg').val(barcode_brg);
			$('#koderakbrg').val(koderak_brg);
			$('#dtime').val(datetime);
			$('#imgbrg').attr("src", "upload/foto/part/" + img_brg);

		})
	})

	$("#persentasejual").change(function() {
		var beliProduk = eval($("#hargambrg").val());
		var persentasejual = eval($("#persentasejual").val());
		var pot1 = ((persentasejual) / 100) * beliProduk;
		jual = pot1 + beliProduk;
		document.getElementById('hargaubrg').value = jual;
		selisih = jual - beliProduk;
		var pot3 = (80 / 100) * selisih;
		jual2 = pot3 + beliProduk;
		document.getElementById('hargacbrg').value = jual2;
	});

	$("#persentasejual1").change(function() {
		var beliProduk = eval($("#hargambrg1").val());
		var persentasejual = eval($("#persentasejual1").val());
		var pot1 = ((persentasejual) / 100) * beliProduk;
		jual = pot1 + beliProduk;
		document.getElementById('hargaubrg1').value = jual;
		selisih = jual - beliProduk;
		var pot3 = (80 / 100) * selisih;
		jual2 = pot3 + beliProduk;
		document.getElementById('hargacbrg1').value = jual2;
	});
</script>

<script type="text/javascript">
	var tm_pilih = document.getElementById('pilih');
	var file = document.getElementById('file');
	tm_pilih.addEventListener('click', function() {
		file.click();
	})
	file.addEventListener('change', function() {
		gambar(this);
	})

	function gambar(a) {
		if (a.files && a.files[0]) {
			var reader = new FileReader();
			reader.onload = function(e) {
				document.getElementById('gambar').src = e.target.result;
			}
			reader.readAsDataURL(a.files[0]);
		}
	}
</script>