<?php
  echo form_open(base_url('biayappdb/edit'));
  $biayappdb = $this->setting_model->biayappdb();
 
?>
<script src="<?php echo base_url() ?>assets/admin/plugins/jquery/jquery.min.js"></script>

<section class="content">
	<div class="container-fluid">
		<div class="row">
			<div class="col-12">
				<!-- Default box -->
				<div class="card">
					<div class="card-header">
						<h3 class="card-title"><b><span class="text-blue">BIAYA PPDB PROGRAM KEAHLIAN<span></b></h3>
						<div class="card-tools">
							<button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
								<i class="fas fa-minus"></i>
							</button>
						</div>
					</div>
          <div class="card-body">

            <div class="form-group row">
                <label for="biaya_otkp" class="col-sm-2 col-form-label">Biaya MPLB</label>:
                <div class="col-sm-6">
                  <input type="text" name="biaya_otkp" id="biaya_otkp" class="form-control" placeholder="Biaya MPLB" value="<?php echo number_format($biayappdb->biaya_otkp, 0, ',', '.')?>" onkeypress="return event.charCode >= 48 && event.charCode <=57" maxlength="10" oninput="formatCurrency(this)"   >
                </div>
            </div>

            <div class="form-group row">
                <label for="biaya_tkj" class="col-sm-2 col-form-label">Biaya TJKT</label>:
                <div class="col-sm-6">
                  <input type="text" name="biaya_tkj" id="biaya_tkj"  class="form-control" placeholder=" Biaya TJKT" value="<?php  echo number_format($biayappdb->biaya_tkj, 0, ',', '.')?>" onkeypress="return event.charCode >= 48 && event.charCode <=57" oninput="formatCurrency(this)"  required>
                </div>
            </div>

            <div class="form-group row">
                <label for="biaya_animasi" class="col-sm-2 col-form-label">Biaya Animasi</label>:
                <div class="col-sm-6">
                  <input type="text" name="biaya_animasi" id="biaya_animasi"  class="form-control" placeholder="Biaya Animasi" value="<?php echo number_format($biayappdb->biaya_animasi, 0, ',', '.'); ?>" " onkeypress="return event.charCode >= 48 && event.charCode <=57" oninput="formatCurrency(this)" required>
                </div>
            </div>

            <div class="form-group row">
                <label for="biaya_kuliner" class="col-sm-2 col-form-label">Biaya Kuliner</label>:
                <div class="col-sm-6">
                  <input type="text" name="biaya_kuliner" id="biaya_kuliner"  class="form-control" placeholder="Biaya Kuliner" value="<?php echo number_format($biayappdb->biaya_kuliner, 0, ',', '.')?>" onkeypress="return event.charCode >= 48 && event.charCode <=57" oninput="formatCurrency(this)"  required>
                </div>
            </div>
          </div>
          
					<div class="card-header">
						<h3 class="card-title"><b><span class="text-danger">POTONGAN KHUSUS</span></b></h3>
						<div class="card-tools">
							<button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
								<i class="fas fa-minus"></i>
							</button>
						</div>
					</div>
          <div class="card-body">

            <div class="form-group row">
                <label for="pot_gel" class="col-sm-2 col-form-label">Potongan Gelombang</label>:
                <div class="col-sm-6">
                  <input type="text" name="pot_gel" id="pot_gel"  class="form-control" placeholder="Potongan Gelombang" value="<?php echo number_format($biayappdb->pot_gel, 0, ',', '.')?>" onkeypress="return event.charCode >= 48 && event.charCode <=57" oninput="formatCurrency(this)" required>
                </div>
            </div>

            <div class="form-group row">
                <label for="pot_dp" class="col-sm-2 col-form-label">Potongan Dharma Pertiwi</label>:
                <div class="col-sm-6">
                  <input type="text" name="pot_dp" id="pot_dp"  class="form-control" placeholder="Potongan Dharma Pertiwi" value="<?php echo number_format($biayappdb->pot_dp, 0, ',', '.')?>" onkeypress="return event.charCode >= 48 && event.charCode <=57" oninput="formatCurrency(this)" required>
                </div>
            </div>

            <div class="form-group row">
                <label for="pot_yatim" class="col-sm-2 col-form-label">Potongan Yatim</label>:
                <div class="col-sm-6">
                  <input type="text" name="pot_yatim" id="pot_yatim"  class="form-control" placeholder="Potongan Yatim" value="<?php echo number_format($biayappdb->pot_yatim, 0, ',', '.')?>" onkeypress="return event.charCode >= 48 && event.charCode <=57" oninput="formatCurrency(this)" required>
                </div>
            </div>

            <div class="form-group row">
                <label for="pot_spp" class="col-sm-2 col-form-label">Potongan SPP MPLB</label>:
                <div class="col-sm-6">
                  <input type="text" name="pot_spp" id="pot_spp"  class="form-control" placeholder="Potongan SPP MPLB" value="<?php echo number_format($biayappdb->pot_spp, 0, ',', '.')?>" onkeypress="return event.charCode >= 48 && event.charCode <=57" oninput="formatCurrency(this)" required>
                </div>
            </div>

            <div class="form-group row">
                <label for="pot_spp_tkj" class="col-sm-2 col-form-label">Potongan SPP TJKT</label>:
                <div class="col-sm-6">
                  <input type="text" name="pot_spp_tkj" id="pot_spp_tkj"  class="form-control" placeholder="Potongan SPP TJKT" value="<?php echo number_format($biayappdb->pot_spp_tkj, 0, ',', '.')?>" onkeypress="return event.charCode >= 48 && event.charCode <=57" oninput="formatCurrency(this)" required>
                </div>
            </div>

            <div class="form-group row">
                <label for="pot_spp_animasi" class="col-sm-2 col-form-label">Potongan SPP Animasi</label>:
                <div class="col-sm-6">
                  <input type="text" name="pot_spp_animasi" id="pot_spp_animasi"  class="form-control" placeholder="Potongan SPP Animasi" value="<?php echo number_format($biayappdb->pot_spp_animasi, 0, ',', '.')?>" onkeypress="return event.charCode >= 48 && event.charCode <=57" oninput="formatCurrency(this)" required>
                </div>
            </div>

            <div class="form-group row">
                <label for="pot_spp_kuliner" class="col-sm-2 col-form-label">Potongan SPP Kuliner</label>:
                <div class="col-sm-6">
                  <input type="text" name="pot_spp_kuliner" id="pot_spp_kuliner"  class="form-control" placeholder="Potongan SPP Kuliner" value="<?php echo number_format($biayappdb->pot_spp_kuliner, 0, ',', '.')?>" onkeypress="return event.charCode >= 48 && event.charCode <=57" oninput="formatCurrency(this)" required>
                </div>
            </div>

            <div class="form-group row">
                <label for="pot_kembar" class="col-sm-2 col-form-label">Potongan Kembar</label>:
                <div class="col-sm-6">
                  <input type="text" name="pot_kembar" id="pot_kembar"  class="form-control" placeholder="Potongan Kembar" value="<?php echo number_format($biayappdb->pot_kembar, 0, ',', '.')?>" onkeypress="return event.charCode >= 48 && event.charCode <=57" oninput="formatCurrency(this)" required>
                </div>
            </div>          

          <!---simpan,reset,kembali-->
            <div class="form-group row">
              <label for="ok" class="col-sm-2 col-form-label"></label>
              <div class="col-sm-9">
                <button type="submit" class="btn btn-primary">
                    <i class="fa fa-save"></i> Simpan
                </button>
                <button type="reset" class="btn btn-info">
                    <i class="fa fa-cut"></i> Reset
                </button>
                <a href="<?php echo base_url('dashboard') ?>" class="btn btn-default">
                  <i class="fa fa-backward"></i> Kembali      	
                </a>
              </div>
            </div>

               </div>
              </div>
						</div>
					</div><!-- /.card -->
				</div>
			</div>
		</div>
</section><!-- /.content -->

<?php
//form close
echo form_close();
?>

<script>
function formatCurrency(input) {
    // Hapus semua titik
    let value = input.value.replace(/\./g, '');
    
    // Format angka dengan separator ribuan
    value = parseInt(value || 0).toLocaleString('id-ID');
    
    // Set kembali nilai input dengan format baru
    input.value = value;
}
</script>