	// Javscripts para a listagem de clientes inicio

                    var DatatableHtmlTableClientes = function() {
                    	//== Private functions
                    
                    	// inicializar tabela clientes
                    	var clientes = function() {
                    
                    		var datatable = $('.m-datatable').mDatatable({
                    			data: {
                    				saveState: {cookie: true},
                    			},
                    			search: {
                    				input: $('#generalSearch'),
                    			},
                    			columns: [
                    				{
                    					field: 'Data de cadastro',
                    					type: 'date',
                    					format: 'DD-MM-YYYY',
                    				}
                    			],
                    		});
                    		
                    	
                    		$('#m_form_status, #m_form_type').selectpicker();
                    
                    	};
                    
                    	return {
                    		//== Public functions
                    		init: function() {
                    			// init dmeo
                    			clientes();
                    		},
                    	};
                    }();
    
                    
                    
// Fim javascript  parte listagem de clientes

// Inicio Jvascript para edição / cadastro de clientes formulários, etc
  
  
    var FormControls = function () {
    //== Private functions
    
    var form_cliente = function () {
        $( "#form_clientes" ).validate({
            // define validation rules
            rules: {
                email: {
                    required: true,
                    email: true,
                    minlength: 10
                },
                cli_email: {
                    required: true,
                    email: true,
                    minlength: 10, 
                },
                cli_uf: {
                    required: true,
                    minlength: 2, 
                },
                url: {
                    required: true 
                },
                digits: {
                    required: true,
                    digits: true
                }
            },
            
            //display error alert on form submit  
            invalidHandler: function(event, validator) {     
                var alert = $('#form_clientes');
                alert.removeClass('m--hide').show();
                mApp.scrollTo(alert, -200);
            },

            submitHandler: function (form) {
                form[0].submit(); // submit the form
            }
        });    
        
        $("#cli_telefone1").inputmask({
            "mask": "(99) 9999-9999"
        });  
        
         $("#cli_cep").inputmask({
            "mask": "99999-999"
        }); 
        
          $("#cli_uf").inputmask({
            "mask": "AA"
        }); 
        
         $("#cli_data_cad").inputmask({
            "mask": "99/99/9999"
        }); 
        
         $("#cli_telefone2").inputmask({
            "mask": "(99) 99999-9999"
        });
           $("#cli_cnpj").inputmask({
            "mask": "99.999.999/9999-99"
        });
        
        
    }

   

    return {
        // public functions
        init: function() {
            form_cliente(); 

        }
    };
}();
        
        jQuery(document).ready(function() {    
            FormControls.init();
            
            	DatatableHtmlTableClientes.init();
        });
