<!-- MAIN CONTENT WRAPPER -->
<script src="assets/js/king-table.js"></script>

			<div class="content">
				<div class="main-content">
					<div class="row">
                    	
                        <div class="col-md-4">
							<!-- ADVANCED VALIDATION -->
							<div class="widget">
								<div class="widget-header">
									<h3><i class="fa fa-check-circle"></i> <?php echo e(__('fundtype.fundtype')); ?></h3></div>
								<div class="widget-content">
                    <form id="frmmain" name="frmmain" data-parsley-validate novalidate>
					<?php echo csrf_field(); ?>

	<input type="hidden" class="form-control" id="ftyp_id" name="ftyp_id" value="0" > 
	<input type="hidden" class="form-control" id="ftyp_module" name="ftyp_module" value="Jamath" >
<div class="alert  alert-info " >
    <ul><li class="fa fa-cog  fa-1x fa-fw"></li><?php echo e(__('fundtype.fundtype')); ?> ..</ul>
</div>						
<div class="alert alert-success print-success-msg" style="display:none">
    <ul></ul>
</div>	
<div class="alert alert-danger print-error-msg" style="display:none">
    <ul></ul>
</div>
						
<div class="form-group">
	<label for="text-input1"><?php echo e(__('fundtype.fundtype')); ?>*</label>
	<input type="text" name="ftyp_fundtype" id="ftyp_fundtype" class="form-control" >
	<small class="text-danger" id="errftyp_fundtype"></small>
</div>               
<div class="form-group">
	<label><?php echo e(__('fundtype.description')); ?></label>
	<textarea class="form-control" name="ftyp_description" id="ftyp_description" rows="5" cols="30" ></textarea>
	<small class="text-danger" id="errftyp_description" ></small>
</div>
                
<div class="form-group">
	<label for="multiselect1"><?php echo e(__('fundtype.status')); ?>*</label>
	<br/>
	<select name="ftyp_status" id="ftyp_status" class="form-control" required>
		<option value="Active"><?php echo e(__('fundtype.Active')); ?></option>
		<option value="Inactive"><?php echo e(__('fundtype.Inactive')); ?></option>
	</select>
	<small class="text-danger" id="errftyp_status"></small>
</div>
<br/>
<button type="submit" id="submit" name="submit" class="btn btn-primary submit">Submit</button>
                    </form>
								</div>
							</div>
							<!-- END ADVANCED VALIDATION -->
						</div>
                    
						<div class="col-md-8">
							<!-- BASIC VALIDATION -->
								<div class="widget widget-table">
						<div class="widget-header">
							<h3><i class="fa fa-table"></i> <?php echo e(__('fundtype.viewfundtype')); ?></h3> 
                        </div>
						<div class="widget-content">
<table id="datatable-data-export" class="table table-sorting table-striped table-hover table-bordered datatable">
	<thead>
		<tr>
			<th><?php echo e(__('fundtype.fundtype')); ?></th>
			<th><?php echo e(__('fundtype.description')); ?></th>
			<th><?php echo e(__('fundtype.status')); ?></th>
			<th><?php echo e(__('fundtype.action')); ?></th>
		</tr>
	</thead>
	<tbody>
	<?php $__currentLoopData = $data['fundtype']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $fundtype): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
		<tr>
			<td><?php echo e($fundtype->ftyp_fundtype); ?></td>
			<td><?php echo e($fundtype->ftyp_description); ?></td>
			<td><?php echo e($fundtype->ftyp_status); ?></td>
			<?php 
			if($data['edit']=='1' || $data['delete']=='1'){ echo'<td>';}
			?>
			<?php 
			if($data['edit']=='1'){echo'<button class="btn btn-default btn-xs print" onclick="Edit('.$fundtype->ftyp_id.')"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>' . __("mylanguage.edit") . '</button>'; } if($data['delete']=='1'){echo' <button class="btn btn-default btn-xs print" onclick="Delete('.$fundtype->ftyp_id.')"><i class="fa fa-trash" aria-hidden="true"></i>' . __("mylanguage.delete") . '</button>';} echo '</td>';
			?>
		</tr>
	<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
	</tbody>
</table>
							
						</div>
					</div>
							<!-- END BASIC VALIDATION -->
						</div>

					</div>
				</div>
			</div>
			<!-- /main -->

<script type="application/javascript">
i=0;
	$('.submit').click(function()
	{
			$(".alert-info").find("ul").html('<li class="fa fa-cog fa-spin fa-1x fa-fw"></li>Processing...');
		   
			var _token = $("input[name='_token']").val();
			var ftyp_fundtype =  $('#ftyp_fundtype').val();
			var ftyp_description = $("#ftyp_description").val();
			var ftyp_status = $("#ftyp_status").val();			
			var ftyp_fundtype = $("#ftyp_fundtype").val();			
			document.getElementById("errftyp_fundtype").innerHTML = "";
			
			if(ftyp_fundtype == "")
			{
				document.getElementById("errftyp_fundtype").innerHTML = "Kindly Enter Fund type...";
				$(".alert-info").find("ul").html('<li class="fa fa-cog fa-1x fa-fw"></li>Kindly check the error...');				
			}
			else
			{
				if(i==0)
				{
					i++;
					$.ajax({
						url: "/fundtype",
						type:'POST',
						data: /* {_token:_token,branch:branch, usertype:usertype, description:description, status:status} */
						$('#frmmain').serialize(),
						success: function(data) {											
							if(data.status == 1)
							{
								printSuccessMsg(data.message);
								$('#sideMenu').load('loadfundtype');
							}
							else
							{
								printErrorMsg(data.message)
							}
						}
					});					   
				}						
			}
		return false;
	});    
		function printErrorMsg (msg) {
			$(".alert-info").css('display','none');
			$(".print-success-msg").css('display','none');
			$(".print-error-msg").find("ul").html('');
			$(".print-error-msg").css('display','block');
			$(".print-error-msg").find("ul").append('<li class="fa fa-times-circle fa-1x fa-fw"></li>'+msg);
		}
		function printSuccessMsg (msg) {
			$(".alert-info").css('display','none');
			$(".print-error-msg").css('display','none');
			$(".print-success-msg").find("ul").html('');
			$(".print-success-msg").css('display','block');
			$(".print-success-msg").find("ul").append('<li class="fa fa-check  fa-1x fa-fw"></li>'+msg);
		}
</script>	
<script>
	function Edit(id)
	{
		$.ajax({
			type: "GET",
			url:"/editfundtype",
			dataType: "json",
			data: {
				'_token': $('input[name=_token]').val(),
				'id': id
			},
			success: function (data) {
				$.each(data,function(i,obj)
				{	   				
					$('#ftyp_id').val(obj.ftyp_id);
					$('#ftyp_fundtype').val(obj.ftyp_fundtype);
					$('#ftyp_description').val(obj.ftyp_description);
					$('#ftyp_status').val(obj.ftyp_status);
				});  
			}
		});
	}
	function Delete(id)
	{
		if(confirm("Are you sure want to delete this record?") == true)
		{
			k = 0;
			if(k == 0)
			{
				k++;
				$.ajax({
					type: "GET",
					url:"/delfundtype",
					dataType: "json",
					data: {
						'_token': $('input[name=_token]').val(),
						'id': id
					},
					success: function (sdata) {
						if(sdata.status == 1)
						{
							printSuccessMsg(sdata.message);
							$('#sideMenu').load('loadfundtype');
						}
						else
						{
							printErrorMsg(sdata.message)
						}
					}
				});
			}
		}
	}
</script>				  