<?php $__env->startSection('css'); ?>
<style>
	.tabs-left,
	.tabs-right {
		border-bottom: none;
		padding-top: 2px;
	}

	.tabs-left {
		border-right: 1px solid #ddd;
	}

	.tabs-right {
		border-left: 1px solid #ddd;
	}

	.tabs-left>li,
	.tabs-right>li {
		float: none;
		margin-bottom: 2px;
	}

	.tabs-left>li {
		margin-right: -1px;
	}

	.tabs-right>li {
		margin-left: -1px;
	}

	ul li {
		margin-left: 30px
	}

	ul li.row-list {
		width: 300px !important;
		float: left
	}

	.tabs-left>li.active>a,
	.tabs-left>li.active>a:hover,
	.tabs-left>li.active>a:focus {
		border-bottom-color: #ddd;
		border-right-color: transparent;
	}

	.tabs-right>li.active>a,
	.tabs-right>li.active>a:hover,
	.tabs-right>li.active>a:focus {
		border-bottom: 1px solid #ddd;
		border-left-color: transparent;
	}

	.tabs-left>li>a {
		border-radius: 4px 0 0 4px;
		margin-right: 0;
		display: block;
	}

	.tabs-right>li>a {
		border-radius: 0 4px 4px 0;
		margin-right: 0;
	}
	ul{
		margin-bottom: 100px
	}
</style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<?php 
	Fun::lang();
	$index = 1;
?>
<div class="title-add">
	<div class="page-bar">
		<ul class="page-breadcrumb">
			<li> <a class="ng-binding" href="#"><i class="fa fa-dashboard"></i> Dashboard</a> </li>
			<li><a href="#">Manage User</a></li>
			<li><a href="#">Branch Role</a></li>
		</ul>
	</div>
</div>
<div class="page">
	<div class="top-content">
		<div class="row">
			<div class="col-sm-12 col-xs-12">
				<div class="title-page">
					<div class="pull-left">
						<h3>Branch Role</h3>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-12">
			<div class="form-wrapper">
				<?php echo Form::model($role, ['method' => 'PATCH','route' => ['branch-role.update', $role->id]]); ?>

				<div class="form-group col-sm-6 col-xs-12">
					<label class="required">Title</label>
					<?php if( $role->name == 'Branches Management' || $role->name == 'Administrator' ): ?>
					<?php echo Form::text('name', null, array('placeholder' => 'Title','class' => 'form-control','readonly')); ?>

					<?php else: ?>
					<?php echo Form::text('name', null, array('placeholder' => 'Title','class' => 'form-control')); ?>

					<?php endif; ?>
				</div>
				<div class="col-md-12">
					<h3>Select Permission</h3>
					<hr />
					<div class="col-xs-9">
						<div class="tab-content">
							<?php $__currentLoopData = $prefixes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $prefix): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
							<div class="tab-pane <?php echo e(($key==0)?'active':''); ?>" id="<?php echo e($key); ?>-tab">
								<div class="col-sm-12 col-xs-12">
									<?php $__currentLoopData = $groups; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $j => $group): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
										<?php if($group->prefix_name== $prefix->prefix_name): ?>
										<ul>
											<label style="width: 100%;color: #2445a9;margin-bottom:20px" class="checkbox-list">
												<input type="checkbox" class="main-box" id="<?php echo e($index); ?>-box" value="checked" name="checkbox_1[]">
												Check All <?php echo e($group->group_name); ?>

												<span class="checkmark"></span>
											</label>
											<?php $__currentLoopData = $permission; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value => $perm): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
												<?php if($perm->group_name == $group->group_name): ?>
													<li class="row-list">
														<label style="width: 100%;font-size: 14px" class="checkbox-list">
															<?php echo e(Form::checkbox('permission[]', $perm->id, in_array($perm->id, $rolePermissions) ? true : false, array('class' => 'name '.$index.'-box'))); ?>

															<?php echo e($perm->name); ?><span class="checkmark"></span>
														</label>
													</li>
												<?php endif; ?>
											<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
										</ul>
										<hr>
										<?php 
											$index++;
										?>
										<?php endif; ?>
									<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
									
								</div>
							</div>
							<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
						</div>
					</div>
					<div class="col-xs-3">
						<ul class="nav nav-tabs tabs-right sideways">
							<?php $__currentLoopData = $prefixes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $prefix): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
							<li class="<?php echo e(($index==0)?'active':''); ?>"><a href="#<?php echo e($index); ?>-tab" data-toggle="tab"><?php echo e($prefix->prefix_name); ?></a></li>
							<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
						</ul>
					</div>
				</div>
				<div class="col-sm-12 col-xs-12">
					<div class="form-group">
						
						<button type="submit" class="button_sm button_primary pull-right"><span class="fa fa-save"></span> Save</button>
						<button type="button" onClick="javascript:history.go(-1)" class="button_primary pull-right">
							<span class=" fa fa-arrow-circle-left"></span> Back</button>
					</div>
				</div>
				<?php echo Form::close(); ?>

			</div>
		</div>
	</div>
</div>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('js'); ?>
<script type="text/javascript">
	$(document).on('change', '.main-box', function() {
		var id = $(this).attr('id');
		if ($(this).is(":checked")) {
			$("." + id).prop('checked', true);
		} else {
			$("." + id).prop('checked', false);
		}
	});
	$("#setting_check").change(function() {
		$(".setting_checkbox").prop('checked', $(this).prop("checked"));
	});
	$('#setting_check').change(function() {
		if (false == $(this).prop("checked")) {
			$(".setting_checkbox").prop('checked', false);
		}
		if ($('.setting_checkbox:checked').length == $('.setting_checkbox').length) {
			$(".setting_checkbox").prop('checked', true);
		}
	});


	$("#user_magement_check").change(function() {
		$(".user_magement_checkbox").prop('checked', $(this).prop("checked"));
	});
	$('#user_magement_check').change(function() {
		if (false == $(this).prop("checked")) {
			$(".user_magement_checkbox").prop('checked', false);
		}
		if ($('.user_magement_checkbox:checked').length == $('.user_magement_checkbox').length) {
			$(".user_magement_checkbox").prop('checked', true);
		}
	});

	$("#manage_stock_check").change(function() {
		$(".manage_stock_checkbox").prop('checked', $(this).prop("checked"));
	});
	$('#manage_stock_check').change(function() {
		if (false == $(this).prop("checked")) {
			$(".manage_stock_checkbox").prop('checked', false);
		}
		if ($('.manage_stock_checkbox:checked').length == $('.manage_stock_checkbox').length) {
			$(".manage_stock_checkbox").prop('checked', true);
		}
	});

	$("#agency_check").change(function() {
		$(".agency_checkbox").prop('checked', $(this).prop("checked"));
	});
	$('#agency_check').change(function() {
		if (false == $(this).prop("checked")) {
			$(".agency_checkbox").prop('checked', false);
		}
		if ($('.agency_checkbox:checked').length == $('.agency_checkbox').length) {
			$(".agency_checkbox").prop('checked', true);
		}
	});

	$("#operation_check").change(function() {
		$(".operation_checkbox").prop('checked', $(this).prop("checked"));
	});
	$('#operation_check').change(function() {
		if (false == $(this).prop("checked")) {
			$(".operation_checkbox").prop('checked', false);
		}
		if ($('.operation_checkbox:checked').length == $('.operation_checkbox').length) {
			$(".operation_checkbox").prop('checked', true);
		}
	});

	$("#operation_external_check").change(function() {
		$(".operation_external_checkbox").prop('checked', $(this).prop("checked"));
	});
	$('#operation_external_check').change(function() {
		if (false == $(this).prop("checked")) {
			$(".operation_external_checkbox").prop('checked', false);
		}
		if ($('.operation_external_checkbox:checked').length == $('.operation_external_checkbox').length) {
			$(".operation_external_checkbox").prop('checked', true);
		}
	});

	$("#accounting_check").change(function() {
		$(".accounting_checkbox").prop('checked', $(this).prop("checked"));
	});
	$('#accounting_check').change(function() {
		if (false == $(this).prop("checked")) {
			$(".accounting_checkbox").prop('checked', false);
		}
		if ($('.accounting_checkbox:checked').length == $('.accounting_checkbox').length) {
			$(".accounting_checkbox").prop('checked', true);
		}
	});

	$("#account_report_check").change(function() {
		$(".account_report_checkbox").prop('checked', $(this).prop("checked"));
	});
	$('#account_report_check').change(function() {
		if (false == $(this).prop("checked")) {
			$(".account_report_checkbox").prop('checked', false);
		}
		if ($('.account_report_checkbox:checked').length == $('.account_report_checkbox').length) {
			$(".account_report_checkbox").prop('checked', true);
		}
	});
	$("#booking_report_check").change(function() {
		$(".booking_report_checkbox").prop('checked', $(this).prop("checked"));
	});
	$('#booking_report_check').change(function() {
		if (false == $(this).prop("checked")) {
			$(".booking_report_checkbox").prop('checked', false);
		}
		if ($('.booking_report_checkbox:checked').length == $('.booking_report_checkbox').length) {
			$(".booking_report_checkbox").prop('checked', true);
		}
	});

	$("#operation_report_check").change(function() {
		$(".operation_report_checkbox").prop('checked', $(this).prop("checked"));
	});
	$('#operation_report_check').change(function() {
		if (false == $(this).prop("checked")) {
			$(".operation_report_checkbox").prop('checked', false);
		}
		if ($('.operation_report_checkbox:checked').length == $('.operation_report_checkbox').length) {
			$(".operation_report_checkbox").prop('checked', true);
		}
	});

	$("#report_stock_check").change(function() {
		$(".report_stock_checkbox").prop('checked', $(this).prop("checked"));
	});
	$('#report_stock_check').change(function() {
		if (false == $(this).prop("checked")) {
			$(".report_stock_checkbox").prop('checked', false);
		}
		if ($('.report_stock_checkbox:checked').length == $('.report_stock_checkbox').length) {
			$(".report_stock_checkbox").prop('checked', true);
		}
	});
	$("#account_setting_check").change(function() {
		$(".account_setting_checkbox").prop('checked', $(this).prop("checked"));
	});
	$('#account_setting_check').change(function() {
		if (false == $(this).prop("checked")) {
			$(".account_setting_checkbox").prop('checked', false);
		}
		if ($('.account_setting_checkbox:checked').length == $('.account_setting_checkbox').length) {
			$(".account_setting_checkbox").prop('checked', true);
		}
	});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('adminlte::page', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>