Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
8.0 kB
3
Indexable
            <div class="col-xs-12">  
              <div class="box">
                <div class="box-header">
                  <h3 class="box-title">Tambah Transaksi Peminjaman (PJ)</h3>
                </div><!-- /.box-header -->
				
				<div class="box-body">
                
				<?php 
                  $attributes = array('class'=>'form-horizontal','role'=>'form');
                  echo form_open_multipart('karyawan/tambah_peminjaman',$attributes); 
                  if ($rows['kd_pinjam']==''){
                    $kode_peminjaman = "";
                  }else{
                    $kode_peminjaman = $rows['kd_pinjam'];
                  }
                ?>
				
				<div class="col-xs-12">
				<?php if ($this->session->idp !=''){ ?>
				<table class="table table-bordered table-striped">
                    <thead>
                      <tr>
                        <th style='width:5%'>No</th>
                        <th style='width:30%'>Nama Item</th>
                        <th style='width:25%'>Deskripsi</th>
                        <!-- <th style='width:25%'>Dimesi</th> -->
                        <th style='width:5%'>Jumlah</th>
                        <th style='width:5%'>Satuan</th>
                        <th style='width:5%'>Action</th>
                      </tr>
                    </thead>
                    <?php 
                        echo "<tr>
                                <td></td>
                                <input type='hidden' value='".$this->uri->segment(3)."' name='idpd'>
                                <td><select name='aa' class='combobox form-control'  autofocus required>
                                                                      <option value='' selected> Cari Item </option>";
                                                                      foreach ($item as $r){
                                                                        if ($r['kode_item']==$row['kode_item']){
                                                                          echo "<option value='$r[kode_item]' selected>$r[nama_item]</option>";
                                                                        }else{
                                                                          echo "<option value='$r[kode_item]'>$r[nama_item]</option>";
                                                                        }
                                                                      }
                                                                   echo "</select></td>
                                <td><input class='form-control' type='text' name='bb' value='$row[keterangan_item]' id='harga'> </td>
                                
                                <td><input class='form-control' type='number' name='dd' value='$row[jumlah_pinjam]' required> </td>
                                <td><input class='form-control' type='text' name='ee'  value='$row[satuan_pinjam]' required> </td>
                                <td><button type='submit' name='submit' class='btn btn-success  btn-xs'><span class='glyphicon glyphicon-ok' aria-hidden='true'></span></button>
                                    <a class='btn btn-danger btn-xs' title='Delete Data' href='".base_url()."karyawan/tambah_peminjaman'><span class='glyphicon glyphicon-remove'></span></a>
                                </td>
                              </tr>";
                      ?>
                    <tbody>
                  <?php 
                    $no = 1;
                    foreach ($record as $row){
                    echo "<tr><td>$no</td>
                              <td>$row[nama_item]</td>
                              <td>$row[keterangan_item]</td>
                              <td>$row[jumlah_pinjam]</td>
                              <td>$row[satuan_pinjam]</td>
                              <td>
                                <a class='btn btn-danger btn-xs' title='Delete Data' href='".base_url()."karyawan/delete_peminjaman_tambah_detail/$row[id_peminjaman_detail]' onclick=\"return confirm('Apa anda yakin untuk hapus Data ini?')\"><span class='glyphicon glyphicon-remove'></span></a>
                              </td>
                          </tr>";
                      $no++;
                    }

                  ?>
                  </tbody>
                </table>
                <?php } ?>	
				</div>
				
				<div class="col-xs-12">  
				<table class='table table-condensed table-bordered'>
                  <tr><th width='140px' scope='row'>Kode Peminjaman</th>  <td><input type='text' class='form-control' value='<?php echo "$kode_peminjaman"; ?>' name='a' readonly></td></tr>
				   
				  <tr><th scope='row'>Lokasi</th>                 <td><select class='form-control' name='e' id='lokasi' required>
                                                                                <option value='' selected></option>
                                                                                <?php 
                                                                                  foreach ($lokasi as $r){
                                                                                    if ($r['value1']==$rows['lokasi']){
                                                                                      echo "<option value='$r[value1]' selected>$r[value1]</option>";
                                                                                    }else{
                                                                                      echo "<option value='$r[value1]'>$r[value1]</option>";
                                                                                    }
                                                                                  }
                                                                                ?>
                                                                               </select></td></tr>
                                                                          
<tr><th width='140px' scope='row'>No Projek</th>  <td><input type='text' class='form-control' value='<?php echo "$rows[no_projek]"; ?>' name='d' id='projek'></td></tr>
				  
				  </table>
				</div>
				  
                  <input class='btn btn-primary btn-sm' type="submit" name='submit1' value='Simpan Data'>
				 <?php if ($this->session->idp !=''){ ?>
				 <a class='btn btn-default btn-sm' href='<?php echo base_url(); ?>karyawan/peminjaman'>Simpan/Draft</a>
				 <a class='btn btn-default btn-sm' href='<?php echo base_url(); ?>karyawan/peminjaman_submit/<?php echo $this->session->idp?>'>Submit</a>
                  
				 <?php } ?>
				 
				 
                </div>
			<!-- Pembatas box 12 dalam -->	
                         
			   </div>
			<!-- Pembatas box 12 pixel -->	
           
		   </div>
			<!-- Pembatas akhir dari template -->	
              </div>
              

 <script>
        // Mengambil elemen ComboBox dan Field
        var comboBox = document.getElementById("lokasi");
        var projek = document.getElementById("projek");
        // var job = document.getElementById("job");

        // Menambahkan event listener untuk perubahan nilai ComboBox
        comboBox.addEventListener("change", function () {
            // Mengaktifkan Field jika nilai ComboBox adalah "2"
            if (comboBox.value === "Office") {
                projek.disabled = true;
                projek.required = false;
                job.disabled = true;
                job.required = false;
            } else {
                // Menonaktifkan Field untuk nilai lainnya
                projek.disabled = false;
                projek.required = true;
                job.disabled = false;
                job.required = true;
            }
        });
    </script>