
<div class='row'>
    <div class='col-md-12'>
        <div class="box box-solid">
            <!-- Add the bg color to the header using any of the bg-* classes -->
            <div class="box-header with-border">
                <h3 class="box-title"><i class="fas fa-tools  fa-fw"></i> Pengaturan Tabungan</h3>
            </div>
            <div class="box-body no-padding ">
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        
						 <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true">Seting Menu</a></li>
                        <li class=""><a href="#tab_2" data-toggle="tab" aria-expanded="false">Hapus Data</a></li>
                       
                    </ul>
                    <div class="tab-content">
                        
                       
                        <div class="tab-pane" id="tab_2">
                            <form id='formhapusdata' action='' method='post'>
                                <div class='box-body'>
                                    <?= $info4 ?>

                                    <div class='form-group'>
                                        <label>Pilih Data</label>
                                        <div class='row'>
                                            <div class='col-md-5'>
                                                <div class='checkbox'>
                                                    <small class='label bg-purple'>Pilih Data</small><br />
                                                    <label><input type='checkbox' name='data[]' value='penabung' /> Data Konsumen</label><br />
                                                    <label><input type='checkbox' name='data[]' value='tabungan' /> Data Tabungan</label><br />
                                                   
                                                </div>
                                            </div>
                                            <div class='col-md-7'>
                                                <button type='submit' name='submit3' class='btn btn-sm bg-maroon'><i class='fa fa-trash-o'></i> Kosongkan</button>
                                                <div class='form-group'>
                                                    <label>Password Admin</label>
                                                    <input type='password' name='password' class='form-control' required='true' />
                                                </div>

                                                <p class='text-danger'><i class='fa fa-warning'></i> <strong>Mohon di ingat!</strong> Data yang telah dikosongkan tidak dapat dikembalikan.</p>
                                            </div>
                                        </div>
                                    </div>
                                </div><!-- /.box-body -->
                            </form>
                        </div>
                        <!-- /.tab-pane -->
                        
						<?php
						if($setting['tab_siswa']=='0'){{$siswa="Non Aktif";}}elseif($setting['tab_siswa']=='1'){{$siswa="Aktif";}}
						if($setting['tab_staff']=='0'){{$staff="Non Aktif";}}elseif($setting['tab_staff']=='1'){{$staff="Aktif";}}
						
						?>
                        <div class="tab-pane active" id="tab_1">
                            <div class="row">
                                <div class='col-md-12 notif_mapel'></div>
                                <div class='col-md-12'>
                                    <form id='formmenu' action='' method='post'>
								   <div class="panel panel-default">
                                        <div class="panel-body">
                                            <label for="mapel" class="col-sm-2">Tampil di Siswa</label>
                                            <div class="col-sm-10">
                                                <select name="siswa" id="siswa" class="form-control select2" style="width: 100%;" required>
                                                        <option value="<?= $setting['tab_siswa']  ?>"><?= $siswa  ?></option>
                                                       <option value=""></option>
													   <option value="0">Non Aktif</option>
														 <option value="1">Aktif</option>
                                                </select>
                                            </div>
                                        </div>
										
                                        <div class="panel-body">
                                            <label for="mapel" class="col-sm-2">Tampil di Staff</label>
                                            <div class="col-sm-10">
                                                <select name="staff" id="staff" class="form-control select2" style="width: 100%;" required>
                                                    
                                                        <option value="<?= $setting['tab_staff']  ?>"><?= $staff  ?></option>
														 <option value=""></option>
                                                        <option value="0">Non Aktif</option>
														 <option value="1">Aktif</option>
                                                </select>
                                            </div>
                                        </div>
										
                                        <div class="panel-footer clearfix">
                                            <div class="pull-right">
                                                <button id='m' class='btn btn-flat btn-success'><i class='fa fa-check'></i> Ubah</button>
                                            </div>
                                        </div>
                                    </div>
									</form>
                                </div>
                            </div>
                        </div>

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

<script>
  
    $('#formhapusdata').submit(function(e) {
        e.preventDefault();
        $.ajax({
            type: 'POST',
            url: 'mod_setting/crud_setting.php?pg=setting_clear',
            data: $(this).serialize(),
            success: function(data) {
                console.log(data);
                if (data == "ok") {
                    iziToast.success({
                        title: 'Mantap!',
                        message: 'data berhasil dikosongkan',
                        position: 'topRight'
                    });
                } else {
                    iziToast.error({
                        title: 'Gagal!',
                        message: data,
                        position: 'topRight'
                    });
                }

            }
        });
        return false;
    });
	 $('#formmenu').submit(function(e) {
        e.preventDefault();
        var data = new FormData(this);
        //console.log(data);
        $.ajax({
            type: 'POST',
            url: 'mod_tabungan/crud_setting.php?pg=setting_menu',
            enctype: 'multipart/form-data',
            data: data,
            cache: false,
            contentType: false,
            processData: false,
            success: function(data) {
                iziToast.success({
                    title: 'Mantap!',
                    message: 'data berhasil diperbarui',
                    position: 'topRight'
                });
                setTimeout(function() {
                    window.location.replace('?pg=settingtabungan');
                }, 2000);

            }
        });
        return false;
    });
</script>