            <div class="block-header">
                <h2>
                  
                     <ol class="breadcrumb breadcrumb-bg-teal">
                                <li><a href="index.php?home"><i class="material-icons">home</i> Home</a></li>
                               <li><a href="index.php?setjajan"><i class="material-icons">widgets</i> Setting Batas Belanja </a></li>
                                <li class="active"> Pengaturan Batas belanja Santri -  Add/Edit</li>
                            </ol>
                </h2>
            </div>
			<?php 
			if(isset($_POST['submit'])){
			$kategori=noninjection($koneksi,$_POST['kategori']);
			$maximal=noninjection($koneksi,$_POST['maximal']);
			$kelompok=noninjection($koneksi,$_POST['kelompok']);
			$status=noninjection($koneksi,$_POST['status']);
			if(($kategori<>'') and ($maximal<>'') and ($kelompok<>'') and ($status<>'')){
				if(isset($_GET['edit']))
			{
			//edit data
			$id=noninjection($koneksi,$_GET['edit']);
			
			$res=mysqli_query($koneksi,"UPDATE tb_set_out SET `kat`='".$kategori."', `maximal`='".$maximal."', `kelompok`='".$kelompok."',`status`='".$status."' WHERE id='".$id."'");
			
			if($res){echo ' <div class="alert bg-green alert-dismissible" role="alert">
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <strong>Well done!</strong> Edit Data Sukses.
                            </div>';
							}else {
							echo '<div class="alert bg-pink alert-dismissible" role="alert">
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                               <strong>Warning!</strong> Edit Data Gagal.
                            </div>';
							}
			
			} else{
			//tambah data
			
				
					
					$qry_cari=mysqli_query($koneksi,"SELECT * FROM `tb_set_out` WHERE (kat='".$kategori."') AND (maximal='".$maximal."') AND (kelompok='".$kelompok."') ");
					$N=mysqli_num_rows($qry_cari);
					if($N==0)
					{
					
					$res=mysqli_query($koneksi,"INSERT INTO `tb_set_out` (`kat`, `maximal`, `kelompok`, `status`, `tgl`) VALUES ('".$kategori."', '".$maximal."', '".$kelompok."', '".$status."', current_timestamp());");
					
					if($res){echo ' <div class="alert bg-green alert-dismissible" role="alert">
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <strong>Well done!</strong> Simpan Data Sukses.
                            </div>';
							}else {
							echo '<div class="alert bg-pink alert-dismissible" role="alert">
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                               <strong>Warning!</strong> Simpan Data Gagal.
                            </div>';
							}
					}
			}} else {echo '<div class="alert bg-pink alert-dismissible" role="alert">
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                               <strong>Warning!</strong> Input Data dengan lengkap.
                            </div>';}
			}
			
			if(isset($_GET['edit']))
			{
			$edit=noninjection($koneksi,$_GET['edit']);
			$qry_cari=mysqli_query($koneksi,"SELECT * FROM `tb_set_out` WHERE id='".$edit."'");
			$row=mysqli_fetch_array($qry_cari);
			$kategori=$row['kat'];
			$maximal=$row['maximal'];
			$kelompok=$row['kelompok'];
		
			$status=$row['status'];
			
			}else {
			$kategori='';
			$maximal='';
			$kelompok='';
			
			$status='';
			
			}
			
			?>
 <div class="row clearfix">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="card">
                        <div class="header">
                            <h2>PENGATURAN BATAS BELANJA -ADD</h2>
                           
                        </div>
                        <div class="body">
						
						
                            <form id="form_advanced_validation" method="POST" action="index.php?setjajan&mn=setjajan_add<?php if(isset($_GET['edit'])){$edit=noninjection($koneksi,$_GET['edit']);echo "&edit=".$edit;}?>">
							<div class="form-group form-float">
                                    <div class="form-line">
                                       <div class="form-group">
									   
									 <input type="radio" name="kategori" value="Jajan" id="jajan" class="with-gap" <?php if(($kategori=='Jajan') or ($kategori=='')){?>checked="checked"<?php }?>>
                                    <label for="jajan">Jajan</label>
									   
                                    <input type="radio" name="kategori" value="Kebutuhan_Pribadi" id="kebutuhan" class="with-gap" <?php if($kategori=='Kebutuhan_Pribadi'){?>checked="checked"<?php }?>>
                                    <label for="kebutuhan">Kebutuhan Pribadi</label>

                                   
                                </div>
                                       
                                    </div>
									
                                    <div class="help-info">Kategori</div>
                                </div>
							
                                <div class="form-group form-float">
                                    <div class="form-line">
                                        <input type="text" class="form-control" name="maximal" maxlength="10" minlength="4" onkeypress="return isNumberKey(event);" value="<?php echo $maximal;?>" required>
                                        <label class="form-label">Batas Belanja</label>
                                    </div>
                                    <div class="help-info">isi dengan batas belanja, Min. Value : 4 Digit, Max. Value : 10 digit [Numeric] <b>Ex: 20000</b></div>
                                </div>
								
								
								<div class="form-group form-float">
                                    <div class="form-line">
                                       <div class="form-group">
									   
									 <input type="radio" name="kelompok" value="Harian" id="harian" class="with-gap" <?php if(($kelompok=='Harian') or ($kelompok=='')){?>checked="checked"<?php }?>>
                                    <label for="harian">Harian</label>
									   
                                    <input type="radio" name="kelompok" value="Mingguan" id="mingguan" class="with-gap" <?php if($kelompok=='Mingguan'){?>checked="checked"<?php }?>>
                                    <label for="mingguan">Mingguan</label>

                                   
                                </div>
                                       
                                    </div>
									
                                    <div class="help-info">Kelompok</div>
                                </div>
							
								
								
                                
								
                              <div class="form-group form-float">
                                    <div class="form-line">
                                       <div class="form-group">
									 <input type="radio" name="status" value="OPEN" id="on" class="with-gap" <?php if(($status=='OPEN') or ($status=='')){?>checked="checked"<?php }?>>
                                    <label for="on">OPEN</label>
									   
                                    <input type="radio" name="status" value="SUSPEND" id="suspend" class="with-gap" <?php if($status=='SUSPEND'){?>checked="checked"<?php }?>>
                                    <label for="suspend">SUSPEND</label>

                                    <input type="radio" name="status" value="CLOSE" id="close" class="with-gap" <?php if($status=='CLOSE'){?>checked="checked"<?php }?>>
                                    <label for="close" class="m-l-20">CLOSE</label>
                                </div>
                                       
                                    </div>
									
                                    <div class="help-info">Status</div>
                                </div>
								
								
								
                                <button class="btn btn-primary waves-effect" name="submit" type="submit" data-toggle="tooltip" data-placement="right" title="Simpan Data">SUBMIT</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <!-- #END# Advanced Validation -->