<!-- Content Header (Page header) -->
<section class="content-header">
	<div class="container-fluid">
		<div class="row mb-2">
			<div class="col-sm-6">
				<h1 class="m-0">User</h1>
			</div>

			<div class="col-sm-6">
				<ol class="breadcrumb float-sm-right">
					<li class="breadcrumb-item"><a href="dashboard">Dashboard</a></li>
					<li class="breadcrumb-item"><a href="user">User</a></li>
					<li class="breadcrumb-item active">Privilege</li>
				</ol>
			</div>
		</div>
	</div>
</section>

<!-- Main content -->
<section class="content">
	<div class="container-fluid">
		<!-- Small boxes (Stat box) -->
		<div class="row">
			<div class="col-md-12">
				<?php $this->load->view( 'flash_message' );?>
			</div>
		</div>
		<div class="row">
			<div class="col-md-12">
				<form id="frmPrivileges" action="user/privileges" method="post">
					<div class="card card-primary">
						<div class="card-header">
							<h3 class="card-title">Set user privilege of <span class="text-bold"><?php echo $ref_user['name']; ?></span></h3>
						</div>

						<div class="card-body">
							<div class="row">
								<div class="col-md-6">
									<div class="card card-default">
										<div class="card-header">
											<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
												<input type="checkbox" class="custom-control-input" id="inventory_menu" name="inventory_menu" value="1" <?php if ( $privilege ) {if ( $privilege['inventory_menu'] == 1 ) {echo 'checked';}}?>>
												<label class="custom-control-label" for="inventory_menu">Inventory Menu</label>
											</div>
										</div>

										<div class="card-body">
											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="sales" name="sales" value="1" <?php if ( $privilege ) {if ( $privilege['sales'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="sales">Sales Section</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="sales_return" name="sales_return" value="1" <?php if ( $privilege ) {if ( $privilege['sales_return'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="sales_return">Sales Return Section</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="item" name="item" value="1" <?php if ( $privilege ) {if ( $privilege['item'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="item">Item Section</label>
														</div>
													</div>
												</div>
											</div>

											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="purchase" name="purchase" value="1" <?php if ( $privilege ) {if ( $privilege['purchase'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="purchase">Purchase Section</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="purchase_return" value="1" name="purchase_return" <?php if ( $privilege ) {if ( $privilege['purchase_return'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="purchase_return">Purchase Return Section</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="supplier" name="supplier" value="1" <?php if ( $privilege ) {if ( $privilege['supplier'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="supplier">Supplier Section</label>
														</div>
													</div>
												</div>
											</div>

											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="customer" name="customer" value="1" <?php if ( $privilege ) {if ( $privilege['customer'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="customer">Customer Section</label>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>

									<div class="card card-default">
										<div class="card-header">
											<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
												<input type="checkbox" class="custom-control-input" id="accounts_menu" name="accounts_menu" value="1" <?php if ( $privilege ) {if ( $privilege['accounts_menu'] == 1 ) {echo 'checked';}}?>>
												<label class="custom-control-label" for="accounts_menu">Accounts Menu</label>
											</div>
										</div>

										<div class="card-body">
											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="journal" name="journal" value="1" <?php if ( $privilege ) {if ( $privilege['journal'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="journal">Journal Section</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="ac_head" name="ac_head" value="1" <?php if ( $privilege ) {if ( $privilege['ac_head'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="ac_head">Chart of Account Section</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="money_receipt" name="money_receipt" value="1" <?php if ( $privilege ) {if ( $privilege['money_receipt'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="money_receipt">Money Receipt Section</label>
														</div>
													</div>
												</div>
											</div>

											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="payment_receipt" name="payment_receipt" value="1" <?php if ( $privilege ) {if ( $privilege['payment_receipt'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="payment_receipt">Payment Receipt Section</label>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>

									<div class="card card-default">
										<div class="card-header">
											<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
												<input type="checkbox" class="custom-control-input" id="hr_menu" name="hr_menu" value="1" <?php if ( $privilege ) {if ( $privilege['hr_menu'] == 1 ) {echo 'checked';}}?>>
												<label class="custom-control-label" for="hr_menu">HR Menu</label>
											</div>
										</div>

										<div class="card-body">
											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="employee" name="employee" value="1" <?php if ( $privilege ) {if ( $privilege['employee'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="employee">Employee Section</label>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>

								<div class="col-md-6">
									<div class="card card-default">
										<div class="card-header">
											<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
												<input type="checkbox" class="custom-control-input" id="settings_menu" name="settings_menu" value="1" <?php if ( $privilege ) {if ( $privilege['settings_menu'] == 1 ) {echo 'checked';}}?>>
												<label class="custom-control-label" for="settings_menu">Settings Menu</label>
											</div>
										</div>

										<div class="card-body">
											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="currency_settings" name="currency_settings" value="1" <?php if ( $privilege ) {if ( $privilege['currency_settings'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="currency_settings">Currency Section</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="company_settings" name="company_settings" value="1" <?php if ( $privilege ) {if ( $privilege['company_settings'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="company_settings">Company Section</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="basic_settings" name="basic_settings" value="1" <?php if ( $privilege ) {if ( $privilege['basic_settings'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="basic_settings">Basic Section</label>
														</div>
													</div>
												</div>
											</div>

											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="default_ac_head_settings" name="default_ac_head_settings" value="1" <?php if ( $privilege ) {if ( $privilege['default_ac_head_settings'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="default_ac_head_settings">Default Chart of Account Section</label>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>

									<div class="card card-default">
										<div class="card-header">
											<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
												<input type="checkbox" class="custom-control-input" id="report_menu" name="report_menu" value="1" <?php if ( $privilege ) {if ( $privilege['report_menu'] == 1 ) {echo 'checked';}}?>>
												<label class="custom-control-label" for="report_menu">Report Menu</label>
											</div>
										</div>

										<div class="card-body">
											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="sales_report" name="sales_report" value="1" <?php if ( $privilege ) {if ( $privilege['sales_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="sales_report">Sales Report</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="sales_return_report" name="sales_return_report" value="1" <?php if ( $privilege ) {if ( $privilege['sales_return_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="sales_return_report">Sales Return Report</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="purchase_report" name="purchase_report" value="1" <?php if ( $privilege ) {if ( $privilege['purchase_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="purchase_report">Purchase Report</label>
														</div>
													</div>
												</div>
											</div>

											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="purchase_return_report" name="purchase_return_report" value="1" <?php if ( $privilege ) {if ( $privilege['purchase_return_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="purchase_return_report">Purchase Return Report</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="inventory_report" name="inventory_report" value="1" <?php if ( $privilege ) {if ( $privilege['inventory_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="inventory_report">Inventory Report</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="ledger_report" name="ledger_report" value="1" <?php if ( $privilege ) {if ( $privilege['ledger_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="ledger_report">Ledger Report</label>
														</div>
													</div>
												</div>
											</div>

											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="trial_balance_report" name="trial_balance_report" value="1" <?php if ( $privilege ) {if ( $privilege['trial_balance_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="trial_balance_report">Trial Balance Report</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="balance_sheet_report" name="balance_sheet_report" value="1" <?php if ( $privilege ) {if ( $privilege['balance_sheet_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="balance_sheet_report">Balance Sheet Report</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="income_statement_report" name="income_statement_report" value="1" <?php if ( $privilege ) {if ( $privilege['income_statement_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="income_statement_report">Income Statement Report</label>
														</div>
													</div>
												</div>
											</div>

											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="bills_receivable_report" name="bills_receivable_report" value="1" <?php if ( $privilege ) {if ( $privilege['bills_receivable_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="bills_receivable_report">Bills Receivable Report</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="bills_payable_report" name="bills_payable_report" value="1" <?php if ( $privilege ) {if ( $privilege['bills_payable_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="bills_payable_report">Bills Payable Report</label>
														</div>
													</div>
												</div>
											</div>

											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="cash_book_report" name="cash_book_report" value="1" <?php if ( $privilege ) {if ( $privilege['cash_book_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="cash_book_report">Cash Book Report</label>
														</div>
													</div>
												</div>

												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="bank_book_report" name="bank_book_report" value="1" <?php if ( $privilege ) {if ( $privilege['bank_book_report'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="bank_book_report">Bank Book Report</label>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>

									<div class="card card-default">
										<div class="card-header">
											<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
												<input type="checkbox" class="custom-control-input" id="user_menu" name="user_menu" value="1" <?php if ( $privilege ) {if ( $privilege['user_menu'] == 1 ) {echo 'checked';}}?>>
												<label class="custom-control-label" for="user_menu">User Menu</label>
											</div>
										</div>

										<div class="card-body">
											<div class="row">
												<div class="col-md-4">
													<div class="form-group">
														<div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success">
															<input type="checkbox" class="custom-control-input" id="user_section" name="user_section" value="1" <?php if ( $privilege ) {if ( $privilege['user_section'] == 1 ) {echo 'checked';}}?>>
															<label class="custom-control-label" for="user_section">User Section</label>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>

						<input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
						<?php if ( count( $privilege ) > 0 ): ?>
							<input type="hidden" name="id" value="<?php echo $privilege['id']; ?>">
						<?php endif;?>
						<input type="hidden" name="ref_user" value="<?php echo $ref_user['id']; ?>">

						<div class="card-footer">
							<input type="submit" class="btn btn-primary pull-right" value="Save Changes">
							<input type="reset" class="btn btn-danger" value="Cancel">
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</section>