('keyup', function () {

            var email   = $(this).val();
            var pass    = $('#password_umkm').val();
            var nama    = $('#nama_umkm').val();
            var aksi    = $('#aksi_umkm').val();

            if (validateEmail(email)) {
                if (validatePass(pass)) {
                    if (nama!= '') {
                        $('#simpan_user_umkm').attr('disabled', false); 
                    } else {
                        $('#simpan_user_umkm').attr('disabled', true);
                    }
                } else {
                    if (aksi == 'Ubah') {
                        $('#simpan_user_umkm').attr('disabled', false);
                    } else{
                        $('#simpan_user_umkm').attr('disabled', true);
                    }
                }
            } else {
                if (aksi == 'Ubah') {
                    $('#simpan_user_umkm').attr('disabled', false);
                } else{
                    $('#simpan_user_umkm').attr('disabled', true);
                }
            }

            $('#email_umkm_error').text(validateEmail(email)? "" : "Isi email dengan format yang benar!" );
            
        })

        $('#email_investor').on('keyup', function () {

            var email   = $(this).val();
            var pass    = $('#password_investor').val();
            var nama    = $('#nama_umkm2').val();
            var aksi    = $('#aksi_investor').val();

            if (validateEmail(email)) {
                if (validatePass(pass)) {
                    if (nama.length!= 0) {
                        $('#simpan_user_investor').attr('disabled', false); 
                    } else {
                        $('#simpan_user_investor').attr('disabled', true);
                    }
                } else {
                    if (aksi == 'Ubah') {
                        $('#simpan_user_investor').attr('disabled', false);
                    } else{
                        $('#simpan_user_investor').attr('disabled', true);
                    }
                }
            } else {
                if (aksi == 'Ubah') {
                    $('#simpan_user_investor').attr('disabled', false);
                } else{
                    $('#simpan_user_investor').attr('disabled', true);
                }
            }

            $('#email_investor_error').text(validateEmail(email)? "" : "Isi email dengan format yang benar!" );

        })

        // 17-11-2020
        $('#simpan_user_umkm').on('click', function () {
            
            var nama_umkm       = $('#nama_umkm').val();
            var username_umkm   = $('#username_umkm').val();
            var password_umkm   = $('#password_umkm').val();
            var email_umkm      = $('#email_umkm').val();
            var aksi_umkm       = $('#aksi_umkm').val();

            if (password_umkm == '') {

                if (aksi_umkm == 'Tambah') {
                    swal({
                        title               : "Peringatan",
                        text                : 'Password harus terisi!',
                        buttonsStyling      : false,
                        type                : 'warning',
                        showConfirmButton   : false,
                        timer               : 700
                    }); 
                    
                    $('#password_umkm').focus();  
                }

            } 

            if (nama_umkm == '') {
                
                swal({
                    title               : "Peringatan",
                    text                : 'Nama UMKM harus terisi!',
                    buttonsStyling      : false,
                    type                : 'warning',
                    showConfirmButton   : false,
                    timer               : 700
                }); 
                
                $('#nama_umkm').focus();

            } else if (username_umkm == '') {
                
                swal({
                    title               : "Peringatan",
                    text                : 'Username harus terisi!',
                    buttonsStyling      : false,
                    type                : 'warning',
                    showConfirmButton   : false,
                    timer               : 700
                }); 
                
                $('#username_umkm').focus();

            } else if (email_umkm == '') {
                
                swal({
                    title               : "Peringatan",
                    text                : 'Email harus terisi!',
                    buttonsStyling      : false,
                    type                : 'warning',
                    showConfirmButton   : false,
                    timer               : 700
                }); 
                
                $('#email_umkm').focus();

            } else {
                
                var form_user_umkm  = $('#form_user_umkm').serialize();

                $('#simpan_user_umkm').addClass('btn-progress disabled');
                
                $.ajax({
                    url     : "User/simpan_data_user",
                    type    : "POST",
                    data    : form_user_umkm,
                    dataType: "JSON",
                    success : function (data) {

                        $('#simpan_user_umkm').removeClass('btn-progress disabled');

                        $('#modal_user_umkm').modal('hide');
                        
                        swal({
                            title               : "Berhasil",
                            text                : 'Data berhasil disimpan',
                            buttonsStyling      : false,
                            confirmButtonClass  : "btn btn-success",
                            type                :'success',
                            showConfirmButton   : false,
                            timer               : 1000
                        });    
        
                        tabel_user.ajax.reload(null,false);        
                        
                        $('#form_user_umkm').trigger("reset");
                        
                        $('#aksi').val('Tambah');
                        
                    }
                })
        
                return false;

            }

        })

        // 17-11-2020
        $('#simpan_user_investor').on('click', function () {

            var nama_umkm   = $('#nama_umkm2').val();
            var username    = $('#username_investor').val();
            var password    = $('#password_<PASSWORD>').val();
            var email       = $('#email_investor').val();
            var aksi        = $('#aksi_investor').val();
            var password_lm = $('#password_lama').val();
            var id_investor = $('#id_investor').val();

            var nama_umkm2  = JSON.stringify(nama_umkm);

            if (password == '') {

                if (aksi == 'Tambah') {
                    swal({
                        title               : "Peringatan",
                        text                : 'Password harus terisi!',
                        buttonsStyling      : false,
                        type                : 'warning',
                        showConfirmButton   : false,
                        timer               : 700
                    }); 
                    
                    $('#password_investor').focus();  
                }

            } 

            if (nama_umkm.length == 0) {

                swal({
                    title               : "Peringatan",
                    text                : 'Nama UMKM harus terisi!',
                    buttonsStyling      : false,
                    type                : 'warning',
                    showConfirmButton   : false,
                    timer               : 700
                }); 

                $('#nama_umkm2').focus();  

            } else if (username == '') {

                swal({
                    title               : "Peringatan",
                    text                : 'Username harus terisi!',
                    buttonsStyling      : false,
                    type                : 'warning',
                    showConfirmButton   : false,
                    timer               : 700
                }); 

                $('#username_investor').focus();

            } else if (email == '') {

            swal({
                title               : "Peringatan",
                text                : 'Email harus terisi!',
                buttonsStyling      : false,
                type                : 'warning',
                showConfirmButton   : false,
                timer               : 700
            }); 

            $('#email_investor').focus();

            } else {

                var form_user_investor  = $('#form_user_investor').serialize();

                $('#simpan_user_investor').addClass('btn-progress disabled');

                $.ajax({
                    url     : "User/simpan_data_investor",
                    type    : "POST",
                    data    : {aksi_investor:aksi, username_investor:username,