<?php
$created = can_action('186', 'created');
$edited = can_action('186', 'edited');


$permissionL = !empty($warehouse_info->permission) ? $warehouse_info->permission : null;
$status_value = !empty($warehouse_info) && $warehouse_info->status == 'published' ? 'published' : 'unpublished';

if (!empty($created) || !empty($edited)) {
?>
	<div class="panel panel-custom">
			<div class="modal-body wrap-modal wrap">
				<?php
				$warehouse_id = !empty($warehouse_info->warehouse_id) ? $warehouse_info->warehouse_id : 0;
				$save_url = 'admin/warehouse/save_warehouse/' . $warehouse_id;
				if (!empty($inline)) {
					$save_url .= '/' . $inline;
				}
			echo form_open(base_url($save_url), array('class' => 'p-0 space-y-6 ', 'enctype' => 'multipart/form-data', 'data-parsley-validate' => 'true', 'role' => 'form'));
			?>

			<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
				<!-- Left: primary fields -->
				<div class="lg:col-span-2 space-y-5">
					<div class="bg-slate-50 p-4 rounded-xl border border-slate-200 dark:bg-slate-800 dark:border-slate-700">
						<h4 class="text-sm font-semibold text-foreground flex items-center gap-2 font-semibold text-sm text-slate-900 mb-3 border-b border-slate-200 pb-2 dark:text-slate-100 dark:border-slate-700">
							<i data-lucide="info" class="h-5 w-5"></i>
							<?= lang('general'); ?>
						</h4>
						<div class="grid grid-cols-1 md:grid-cols-2 gap-5 mb-4">
							<?= form_input_group('warehouse_code', lang('warehouse_code'), (!empty($warehouse_info->warehouse_code) ? $warehouse_info->warehouse_code : ''), 'text', true); ?>
							<?= form_input_group('warehouse_name', lang('warehouse_name'), (!empty($warehouse_info->warehouse_name) ? $warehouse_info->warehouse_name : ''), 'text', true); ?>
							<?= form_input_group('phone', lang('phone'), (!empty($warehouse_info->phone) ? $warehouse_info->phone : ''), 'text', true); ?>
							<?= form_input_group('mobile', lang('mobile'), (!empty($warehouse_info->mobile) ? $warehouse_info->mobile : ''), 'text', true); ?>
							<?= form_input_group('email', lang('email'), (!empty($warehouse_info->email) ? $warehouse_info->email : ''), 'text', true); ?>
							<?= form_input_group('address', lang('address'), (!empty($warehouse_info->address) ? $warehouse_info->address : ''), 'text', true); ?>
							<?= form_textarea_group('address', lang('address'), !empty($warehouse_info->address) ? $warehouse_info->address : '', 4); ?>
							<?= form_switch_radio('status', lang('status'), $status_value, true, [], 'stacked', ['published' => lang('yes'), 'unpublished' => lang('no')]); ?>

						</div>
						<div class="flex items-center gap-2 mt-6">
							<?= btn_update(!empty($warehouse_info) ? lang('updates') : lang('save'), 'md') ?>

						</div>
					</div>

				</div>
				<!-- Right: side panels -->
				<div class="space-y-5">
					<div class="bg-slate-50 p-4 rounded-xl border border-slate-200 dark:bg-slate-800 dark:border-slate-700">
						<h4 class="text-sm font-semibold text-foreground flex items-center gap-2 font-semibold text-sm text-slate-900 mb-3 border-b border-slate-200 pb-2 dark:text-slate-100 dark:border-slate-700">
							<i data-lucide="dollar-sign" class="h-5 w-5"></i>
							<?= lang('profile_image'); ?>
						</h4>
						<div class="space-y-3">
							<?= form_attachment_group('image', lang('image'), 'photo'); ?>
							<?= form_permission_modern($assign_user, $permissionL, lang('assined_to')); ?>
						</div>
					</div>

				</div>
				<?php echo form_close(); ?>

			</div>
		</div>
	</div>
<?php } ?>
