



<div class="modal" tabindex="-1" role="dialog" id="<?=$id_modal?>">



  <div class="modal-dialog" role="document">



    <div class="modal-content">



      <form id="tambah">



      <div class="modal-header bg-primary text-light">



        <h5 class="modal-title">Tambah Jenis Kegiatan</h5>



        <button type="button" class="close" data-dismiss="modal" aria-label="Close">



          <span aria-hidden="true">&times;</span>



        </button>



      </div>



      <div class="modal-body">



        



          <div class="row">



            <div class="form-group col-md-12">



                      <label for="exampleInputEmail1">Nama Jenis Kegiatan</label>



                      <input type="text" class="form-control" id="nama" name="nama" required>



                      <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                    </div>



            <div class="form-group col-md-12">



              <label for="exampleInputEmail1">Kode Jenis Kegiatan</label>



                      <input type="text" class="form-control timepicker" id="kode" name="kode" aria-describedby="emailHelp" placeholder="" required>



                      <!-- <small id="emailHelp" class="form-text text-muted">kod</small> -->



              



            </div>



            <div class="form-group  col-md-12">



                      <label for="exampleFormControlTextarea1">Keterangan</label>



                      <textarea class="form-control" id="keterangan" name="keterangan" rows="3" ></textarea>



                    </div>



          </div>



      </div>



      <div class="modal-footer">



        <button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>



        <button type="submit" class="btn btn-primary"><i class="fas fa-save"></i> Simpan</button>



        



      </div>



    </form>



    </div>



  </div>



</div>



<script type="text/javascript">



  $(document).ready(function(){



    var base_url = "<?=base_url()?>";



    var id_modal = "<?=$id_modal?>";



    // var time = function(){



    //   $('.timepicker').datepicker({



    //       format: 'dd MM yyyy',



    //       todayHighlight:true,



    //       toggleActive:true,



    //       daysOfWeekDisabled:'0',



    //       autoclose:true,



    //       language:'id'



    //   });



    // }



    // time();



    $("#tambah").submit(function(){



      var form_data = new FormData($('#tambah')[0]);



      bootbox.confirm("Apakah Anda Yakin Akan Menyimpan Data?", function(result){ 



        if (result==true) {



          $.ajax({



                url             : base_url + 'jenis_kegiatan/simpan_jenis_kegiatan', 



                type            : "POST",



                dataType        : 'json',



                mimeType        : 'multipart/form-data',



                data            : form_data,



                contentType     : false,



                cache           : false,



                processData     : false,



                success         : function(response){



                  // alert(response)



                    if(response == true){



                        $('#'+id_modal).modal('hide');  



                        Command: toastr["success"]("Data Jenis Kegiatan Berhasil Disimpan", "Berhasil");



                        getcontens('page/data_jenis_kegiatan');



                    }else{



                        Command: toastr["error"]("Simpan error, data tidak berhasil disimpan", "Error");



                    }



                },



                error: function(jqXHR, textStatus, errorThrown) {



                  $('#loading').modal('hide');



                  Command: toastr["error"](errorThrown, "Error");



                },



                beforeSend: function () {



                  $('#loading').modal('show');



                },



                complete: function () {



                    $('#loading').modal('hide');



                }



          });



        }



      });



          



        return false;



    })



  



  })



</script>