<script type="text/javascript">
    $(document).ready(function(){
<!-- page script -->
        $('.datatables').DataTable();
        $('.datetimepicker').datetimepicker({
            viewMode: 'months',
            format: 'DD-MM-YYYY'
        });

    });
    
	function insertmemberNo()
	{
		
		var noAhli = $('#noAhli').val();
		var password = $('#password').val();
		
    	if(noAhli == ""){
			
			
			var opt = '';
			
				opt = "<p style='font-size:16px; font-family:roboto'><?php echo $this->lang->line('cannotempty1'); ?></p>";
				
				$('#message').empty();
				$('#message').append(opt);
				$('#popup_modal').modal('show');
			
		}
		else if(password == ""){
			
			var opt = '';
			
				opt = "<p style='font-size:16px; font-family:roboto'><?php echo $this->lang->line('cannotempty2'); ?></p>";
				
				$('#message').empty();
				$('#message').append(opt);
				$('#popup_modal').modal('show');
			
		}
		else{
			$.ajax({
				type: "POST",
				url: "<?php echo base_url(); ?>voting/checkvote",
				data: {
					'noAhli' : noAhli,
					'password' : password,
					'projectID' : '<?php echo $projectID; ?>'
				},
				dataType:'json',
				success: function(data){
					
					var opt = '';
					
					if(data.status == 'failed1'){
						opt = "<p style='font-size:16px; font-family:roboto'><?php echo $this->lang->line('failed1') ?></p>";
				
						$('#message').empty();
						$('#message').append(opt);
						$('#popup_modal').modal('show');
						
					}
					else if(data.status == 'failed3'){
						opt = "<p style='font-size:16px; font-family:roboto'><?php echo $this->lang->line('failed9') ?></p>";
				
						$('#message').empty();
						$('#message').append(opt);
						$('#popup_modal').modal('show');
					}
					else if(data.status == 'failed2'){
						opt = "<p style='font-size:16px; font-family:roboto'><?php echo $this->lang->line('failed2') ?></p>";
				
						$('#message').empty();
						$('#message').append(opt);
						$('#popup_modal').modal('show');
					}
					else if(data.status == 'failed10'){
						opt = "<p style='font-size:16px; font-family:roboto'><?php echo $this->lang->line('failed10') ?></p>";
				
						$('#message').empty();
						$('#message').append(opt);
						$('#popup_modal').modal('show');
					}
					else if(data.status == 'failed11'){
						opt = "<p style='font-size:16px; font-family:roboto'><?php echo $this->lang->line('failed11') ?></p>";
				
						$('#message').empty();
						$('#message').append(opt);
						$('#popup_modal').modal('show');
					}
					else if(data.status == 'failed12'){
						opt = "<p style='font-size:16px; font-family:roboto'><?php echo $this->lang->line('failed12') ?></p>";
				
						$('#message').empty();
						$('#message').append(opt);
						$('#popup_modal').modal('show');
					}
					else if(data.status == 'failed13'){
						opt = "<p style='font-size:16px; font-family:roboto'><?php echo $this->lang->line('failed13') ?></p>";
				
						$('#message').empty();
						$('#message').append(opt);
						$('#popup_modal').modal('show');
					}
					else{
						location.replace('<?php echo base_url(); ?>voting/confirmvoter/' + data.message);
					}
					
				}
			 });
		}
		
	}
	
	function deletePosition(){
	
		var positionID = $('#deleteID').val();
		//if (confirm("Are you sure?")) {
        
			$.ajax({
				type: "POST",
				url: "<?php echo base_url(); ?>position/deletePosition",
				data: {
					'positionID' : positionID
				},
				dataType:'json',
				success: function(data){
					if(data.status = 'success'){
						
						location.reload();
						
					}
				}
			 });
		
		 //}
    	//return false;
	
	}
	
	function isNumberKey(evt){
    	var charCode = (evt.which) ? evt.which : event.keyCode
    	if (charCode > 31 && (charCode < 48 || charCode > 57)){
			return false;
		}
		else{
			return true;
		}
	}
	
</script>
<style>
 
 	.modal-content{
    	border-top-left-radius: 2em;
		border-top-right-radius: 2em;
		border-bottom-left-radius: 2em;
		border-bottom-right-radius: 2em;
	}
	.modal-header{
		color:#F0F;
	}
	
	
	
</style>


                <div id="popup_modal" class="modal fade in">
                  <div class="modal-dialog">
                    <div class="modal-content">
                      <div class="modal-header">
                        <h3 class="modal-title"><?php echo $this->lang->line('message') ?></h3>
                      </div>
                      <div class="modal-body" id="message">
                      	<p style="font-size:16px; font-family:roboto"></p>
                      </div>
                      <div class="modal-footer">
                        <button type="button" class="btn btn-warning" data-dismiss="modal"><i class="fa fa-minus-circle"></i> <?php echo $this->lang->line('close') ?></button>
                      </div>
                      
                    </div><!-- /.modal-content -->
                  </div><!-- /.modal-dialog -->
                </div><!-- end addRowModal -->


<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1 style="font-family:roboto">
            <b>&nbsp;</b>
        </h1>
    </section>

    <!-- Main content -->
    <section class="content">
        


        <div class="row">
            <div class="col-md-12">
                <!-- Horizontal Form -->

                <!-- general form elements disabled -->
                <div class="box box-info">
                    <div class="box-header with-border ">
                        <h3  class="box-title">
                            <h4 class="pull-left" style="font-family:roboto; color:#C66"><b><?php echo $this->lang->line('login');?></b></h4>
                        </h3>
                    </div><!-- /.box-header -->
                    
                    
                    <div class="box-body">
                    	<div class="row">
                        	<div class="col-md-12">
                            	<div class="form-group">
                                	<h5><b><?php echo $this->lang->line('memberNo');?></b></h5>
                                	<input style="border-color:#C0F" type="text" placeholder="<?php echo $this->lang->line('insertmemberno');?>" id="noAhli" name="noAhli" class="form-control" onkeypress="" required="required">
                                </div>
                            </div>
          				</div>
                        <div class="row">
                        	<div class="col-md-12">
                            	<div class="form-group">
                                	<h5 class="pull-left" style="font-family:roboto"><b><?php echo $this->lang->line('password');?></b></h5>
                                	<input style="border-color:#C0F" type="password" placeholder="<?php echo $this->lang->line('pleaseinsertpassword'); ?>" id="password" name="password" class="form-control" onkeypress="" required="required">
                                </div>
                            </div>
          				</div>
                        <button type="button" onclick="insertmemberNo()" class="btn bg-purple btn-lg fad" title="Submit"><?php echo $this->lang->line('submit');?> <i class="fa fa-mail-forward"></i></button>
                    </div><!-- /.box-body -->
                    
                    
                </div><!-- /.box -->
                
                
            </div>
        </div>


    </section><!-- /.content -->
</div><!-- /.content-wrapper -->
