<div class="row resoponsiveRow">
	<?php include APPPATH . 'views/backend/users/inc/leftsidebar.php'; ?>
	<div class="col-md-6">
		<form class="email_setting_form" action="<?= base_url('admin/auth/add_icon_settings') ?>" method="post" enctype="multipart/form-data" autocomplete="off">
			<?= csrf(); ?>
			<?php $icon = isJson($settings['icon_settings']) ? json_decode($settings['icon_settings'], true) : ""; ?>

			<div class="card">
				<div class="card-header">
					<h4><?= !empty(lang('icon_settings')) ? lang('icon_settings') : "Icon Settings"; ?></h4>
				</div>
				<div class="card-body">
					<table class="table">
						<thead>
							<tr>
								<th><?= lang('sl'); ?></th>
								<th><?= lang('icon'); ?></th>
								<th><?= lang('title'); ?></th>
								<th><?= lang('image_url'); ?></th>
								<th><?= lang(''); ?></th>
							</tr>
						</thead>
						<tbody>
							<?php for ($i = 1; $i <= 3; $i++) {  ?>
								<?php $j = $i - 1; ?>
								<tr>
									<td><?= $i; ?></td>
									<td>
										<div class="">
											<button class="btn btn-default picker" data-icon='<?= !empty($icon[$j]['icon']) ? get_icon($icon[$j]['icon']) : ''; ?>' data-id="<?= $i; ?>" role="iconpicker"></button>

											<input type="hidden" name="icon[]" class="icon_<?= $i; ?>" value='<?= !empty($icon[$j]['icon']) ? $icon[$j]['icon'] : ''; ?>'>
										</div>
									</td>
									<td>
										<input type="text" name="title[]" class="form-control" placeholder="<?= !empty(lang('title')) ? lang('title') : "title"; ?>" value="<?= !empty($icon[$j]['title']) ? $icon[$j]['title'] : ''; ?>" required>
									</td>

									<td>
										<input type="text" name="img_url[]" class="form-control" placeholder="<?= !empty(lang('img_url')) ? lang('img_url') : "img_url"; ?>" value="<?= !empty($icon[$j]['img_url']) ? $icon[$j]['img_url'] : ''; ?>">
									</td>
									<td>
										<label class="pointer mr-10 bg-primary-soft label"><input type="checkbox" name="is_img_<?= $i; ?>" class="" value="1" <?= isset($icon[$j]['is_img']) && $icon[$j]['is_img'] == 1 ? "checked" : ""; ?>> <?= lang('active_image'); ?></label>

									</td>
								</tr>
							<?php } ?>
						</tbody>
					</table>
				</div><!-- card-body -->
			</div><!-- card -->
			<div class="card mt-50 hidden">
				<div class="card-header">
					<h4><?= !empty(lang('menu_icon_settings')) ? lang('menu_icon_settings') : "Menu Icon Settings"; ?></h4>
				</div>

				<div class="card-body">
					<table class="table">
						<thead>
							<tr>
								<th><?= lang('sl'); ?></th>
								<th><?= !empty(lang('icon')) ? lang('icon') : "Icon"; ?></th>
								<th><?= !empty(lang('title')) ? lang('title') : "Title"; ?></th>
								<th><?= !empty(lang('img_url')) ? lang('img_url') : "Image URL"; ?></th>
								<th></th>
							</tr>
						</thead>
						<tbody>
							<?php $menuList = ['home', 'menu', 'call_waiter', 'login', 'cart']; ?>
							<?php for ($y = 1; $y <= 5; $y++): ?>
								<?php
								$x = $y - 1;
								$item = $icon['menu_icon_list'][$x] ?? [];
								?>
								<tr>
									<td><?= $y; ?></td>

									<td>
										<div class="input-group">
											<span class="input-group-addon">

											</span>
											<input type="text"
												name="menu_icon[]"
												class="form-control"
												value='<?= !empty($item['menu_icon']) ? $item['menu_icon'] : ''; ?>'
												placeholder="fas fa-home / icofont-home">
										</div>

										<input type="hidden"
											name="menu_slug[]"
											class="form-control"
											value='<?= !empty($item['menu_slug']) ? $item['menu_slug'] : ''; ?>'
											placeholder="fas fa-home / icofont-home">
									</td>

									<td>
										<input type="text"
											name="menu_title[]"
											class="form-control"
											placeholder="<?= !empty(lang('title')) ? lang('title') : "Title"; ?>"
											value="<?= $item['menu_title'] ?? ''; ?>"
											>
									</td>

									<td>
										<input type="text"
											name="menu_img_url[]"
											class="form-control"
											placeholder="your_path.jpg"
											value="<?= $item['menu_img_url'] ?? ''; ?>">
									</td>

									<td>
										<div class="d-flex align-items-center gap-10">
											<label class="pointer mr-10 bg-primary-soft label custom-checkbox">
												<input type="checkbox"
													name="is_menu_img_<?= $y; ?>"
													value="1"
													<?= !empty($item['is_menu_img']) ? 'checked' : ''; ?>>
												<?= !empty(lang('active_image')) ? lang('active_image') : "Active Image"; ?>
											</label>

											<label class="pointer bg-danger-soft custom-radio-2">
												<input type="radio"
													name="is_base_menu"
													value="<?= $x; ?>"
													<?= !empty($item['is_base_menu']) ? 'checked' : ''; ?>>
												<?= !empty(lang('base_menu')) ? lang('base_menu') : "Base Menu"; ?>
											</label>
										</div>
									</td>
								</tr>
							<?php endfor; ?>
						</tbody>
					</table>
				</div><!-- card-body -->
			</div><!-- card -->

			<div class="card-footer">
				<input type="hidden" name="id" value="<?= isset($settings['id']) && $settings['id'] != 0 ? $settings['id'] : 0 ?>">
				<button type="submit" class="btn btn-primary btn-block"><i class="fa fa-save"></i> &nbsp;<?= !empty(lang('save_change')) ? lang('save_change') : "Save Change"; ?></button>
			</div>
		</form>
	</div><!-- col-9 -->

</div>