<?php $__env->startSection('page-title','Add Item Page'); ?>
<?php $__env->startPush('page-css'); ?>
<link rel="stylesheet" href="<?php echo e(asset('public/backend_assets/vendor/libs/dropzone/dropzone.css')); ?>" />
<link rel="stylesheet" href="<?php echo e(asset('public/backend_assets/vendor/libs/flatpickr/flatpickr.css')); ?>" />
<link rel="stylesheet" href="<?php echo e(asset('public/backend_assets/vendor/css/pages/cropper.min.css')); ?>" />
<style>
    body {
        overflow-x: hidden;
    }
    .variation_generator .table-responsive thead th:first-child, .variation_generator .table-responsive tbody td:first-child {
        padding-left: 0px !important
    }
    .remove-variation-image i, .remove-image i {
        margin-right: 5px;
        font-size: 14px;
    }
    .add-medicine-field {
        height: 37px;
    }
    /* Hide unit information for Service_Product by default */
    /* #type[value="Service_Product"] ~ * .hide-for-service-product,
    body:has(#type option[value="Service_Product"]:checked) .hide-for-service-product {
        display: none !important;
    } */
</style>
<?php $__env->stopPush(); ?>
<?php $__env->startSection('page-content'); ?>

<div class="container-xxl flex-grow-1 container-p-y">
    <!-- Add Item -->
    <div class="d-flex flex-column flex-md-row justify-content-between align-items-start align-items-md-center mb-6 row-gap-4">
        <div class="d-flex flex-column justify-content-center">
            <h4 class="mb-0"><?php echo e(__('Add Item')); ?></h4>
        </div>
        <?php echo $__env->make('backend.components.breadcrumb', [
            'breadcrumbs' => [
                [
                    'label' => '<i class="ti tabler-home"></i>',
                    'link' => '#'
                ],
                [
                    'label' => __('Items'), 
                    'link' => '#'
                ],
                [
                    'label' => __('Add Item'),
                    'active' => true
                ]
            ]
        ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    </div>

    <div class="row">
        <div class="col-12">
            <div class="card">
                <form action="<?php echo e(route('item.store')); ?>" method="POST" id="itemForm" enctype="multipart/form-data" novalidate>
                    <?php echo csrf_field(); ?>
                    <div class="card-header">
                        <h5 class="card-tile mb-0"><?php echo e(__('Item Basic Information')); ?></h5>
                    </div>
                    
                    <div class="card-body">
                        <?php if($errors->has('package_limit')): ?>
                            <div class="alert alert-danger alert-dismissible" role="alert">
                                <i class="ti tabler-circle-x me-2"></i><?php echo e($errors->first('package_limit')); ?>

                                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                            </div>
                        <?php endif; ?>
                        <div class="row">
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="type"><?php echo e(__('Item Type')); ?>   <?php echo requiredField(); ?></label>
                                    <select id="type" name="type" class="select2 form-select item_type" data-placeholder="Item Type">
                                        <option value="General_Product" selected><?php echo e(__('General Product')); ?></option>
                                        <option value="Variation_Product"><?php echo e(__('Variation Product')); ?></option>
                                        <option value="IMEI_Product"><?php echo e(__('IMEI Product')); ?></option>
                                        <option value="Serial_Product"><?php echo e(__('Serial Product')); ?></option>
                                        <option value="Medicine_Product"><?php echo e(__('Medicine Product')); ?></option>
                                        <option value="Installment_Product"><?php echo e(__('Installment Product')); ?></option>
                                        <option value="Service_Product"><?php echo e(__('Service Product')); ?></option>
                                        <option value="Combo_Product"><?php echo e(__('Combo Product')); ?></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="name"><?php echo e(__('Item Name')); ?> <?php echo requiredField(); ?></label>
                                    <input type="text" class="form-control focus-select" placeholder="<?php echo e(__('Item Name')); ?>" name="name" id="name" />
                                </div>
                            </div>
                            
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="alternative_name"><?php echo e(__('Alternative Name')); ?></label>
                                    <input type="text" class="form-control" placeholder="<?php echo e(__('Alternative Name')); ?>" name="alternative_name" id="alternative_name" />
                                </div>
                            </div>

                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="code"><?php echo e(__('Item Code')); ?> <?php echo requiredField(); ?></label>
                                    <input type="text" class="form-control" placeholder="<?php echo e(__('Item Code')); ?>" name="code" id="code" value="<?php echo e($code); ?>" />
                                </div>
                            </div>

                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="d-flex justify-content-between">
                                    <div class="mb-5 w-100 validate_wrapper">
                                        <label class="form-label" for="category_id">
                                            <span><?php echo e(__('Category')); ?></span> <?php echo requiredField(); ?>

                                        </label>
                                        <select id="category_id" name="category_id" class="select2 form-select" data-placeholder="<?php echo e(__('Select Category')); ?>">
                                            <option value=""><?php echo e(__('Select Category')); ?></option>
                                            <?php $__currentLoopData = $categories ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($category->id); ?>"><?php echo e($category->name); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                    <a type="button" href="javascript:void(0);" class="fw-medium btn btn-icon btn-label-primary ms-4 add-plus-btn" data-bs-toggle="modal"
                                data-bs-target="#modal_category"
                                    ><i class="icon-base ti tabler-plus icon-md"></i></a>
                                </div>
                            </div>

                            <div class="col-12 col-md-6 col-lg-4 hide-for-service-product hide-for-combo-product">
                                <div class="d-flex justify-content-between">
                                    <div class="mb-5 w-100 validate_wrapper">
                                        <label class="form-label" for="brand_id">
                                            <span><?php echo e(__('Brand')); ?></span>
                                        </label>
                                        <select id="brand_id" name="brand_id" class="select2 form-select" data-placeholder="<?php echo e(__('Select Brand')); ?>">
                                            <option value=""><?php echo e(__('Select Brand')); ?></option>
                                            <?php $__currentLoopData = $brands ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $brand): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($brand->id); ?>"><?php echo e($brand->name); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                    <a type="button" href="javascript:void(0);" class="fw-medium btn btn-icon btn-label-primary ms-4 add-plus-btn" data-bs-toggle="modal"
                                data-bs-target="#modal_brand"
                                    ><i class="icon-base ti tabler-plus icon-md"></i></a>
                                </div>
                            </div>

                            <div class="col-12 col-md-6 col-lg-4 hide-for-service-product hide-for-combo-product">
                                <div class="d-flex justify-content-between">
                                    <div class="mb-5 w-100 validate_wrapper">
                                        <label class="form-label" for="supplier_id">
                                            <span><?php echo e(__('Supplier')); ?></span>
                                        </label>
                                        <select id="supplier_id" name="supplier_id" class="select2 form-select" data-placeholder="<?php echo e(__('Select Supplier')); ?>">
                                            <option value=""><?php echo e(__('Select Supplier')); ?></option>
                                            <?php $__currentLoopData = $suppliers ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $supplier): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($supplier->id); ?>"><?php echo e($supplier->name); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                    <a type="button" href="javascript:void(0);" class="fw-medium btn btn-icon btn-label-primary ms-4 add-plus-btn" data-bs-toggle="modal" data-bs-target="#modal_supplier"
                                    ><i class="icon-base ti tabler-plus icon-md"></i></a>
                                </div>
                            </div>

                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="loyalty_point"><?php echo e(__('Loyalty Point')); ?></label>
                                    <input type="text" class="form-control number-input" placeholder="<?php echo e(__('Loyalty Point')); ?>" name="loyalty_point" id="loyalty_point" />
                                </div>
                            </div>
                            <div class="col-12 col-md-6 col-lg-4 hide-for-service-product hide-for-combo-product">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="description"><?php echo e(__('Description')); ?></label>
                                    <textarea type="text" class="form-control" placeholder="<?php echo e(__('Description')); ?>" name="description" id="description"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>


                    <div class="card-header pt-0 pharmacy_section" style="display: none;">
                        <h5 class="card-tile mb-0"><?php echo e(__('Pharmacy Information')); ?></h5>
                    </div>
                    
                    <div class="card-body pharmacy_section" style="display: none;">
                        <div class="row">
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="expiry_date_maintain"><?php echo e(__('Expiry Date Maintain')); ?></label>
                                    <select id="expiry_date_maintain" name="expiry_date_maintain" class="select2 form-select" data-placeholder="Expiry Date Maintain">
                                        <option value="Yes"><?php echo e(__('Yes')); ?></option>
                                        <option value="No"><?php echo e(__('No')); ?></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="generic_name"><?php echo e(__('Generic Name')); ?></label>
                                    <input type="text" class="form-control" placeholder="<?php echo e(__('Generic Name')); ?>" name="generic_name" id="generic_name" />
                                </div>
                            </div>

                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="d-flex justify-content-between">
                                    <div class="mb-5 w-100 validate_wrapper">
                                        <label class="form-label" for="rack_id">
                                            <span><?php echo e(__('Rack')); ?></span>
                                        </label>
                                        <select id="rack_id" name="rack_id" class="select2 form-select" data-placeholder="<?php echo e(__('Select Rack')); ?>">
                                            <option value=""><?php echo e(__('Select Rack')); ?></option>
                                            <?php $__currentLoopData = $racks ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rack): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($rack->id); ?>"><?php echo e($rack->name); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                    <a type="button" href="javascript:void(0);" class="fw-medium btn btn-icon btn-label-primary ms-4 add-plus-btn" data-bs-toggle="modal"
                                data-bs-target="#modal_rack"
                                    ><i class="icon-base ti tabler-plus icon-md"></i></a>
                                </div>
                            </div>

                        </div>
                    </div>

                    <div class="card-header pt-0 hide-for-service-product hide-for-combo-product">
                        <h5 class="card-tile mb-0"><?php echo e(__('Unit Information')); ?></h5>
                    </div>
                    <div class="card-body hide-for-service-product hide-for-combo-product">
                        <div class="row">
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="unit_type"><?php echo e(__('Unit Type')); ?> <?php echo requiredField(); ?></label>
                                    <select id="unit_type" class="select2 form-select" name="unit_type" data-placeholder="Unit Type">
                                        <option value="1"><?php echo e(__('Single Unit')); ?></option>
                                        <option value="2"><?php echo e(__('Double Unit')); ?></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-12 col-md-6 col-lg-4 purchase_unit_wrap" style="display: none;">
                                <div class="d-flex justify-content-between">
                                    <div class="mb-5 w-100 validate_wrapper">
                                        <label class="form-label" for="purchase_unit_id">
                                            <span><?php echo e(__('Purchase Unit')); ?></span> <?php echo requiredField(); ?>

                                        </label>
                                        <select id="purchase_unit_id" name="purchase_unit_id" class="select2 form-select" data-placeholder="<?php echo e(__('Purchase Unit')); ?>">
                                            <option value=""><?php echo e(__('Purchase Unit')); ?></option>
                                            <?php $__currentLoopData = $units ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $unit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($unit->id); ?>"><?php echo e($unit->unit_name); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                    <a href="javascript:void(0);" class="fw-medium btn btn-icon btn-label-primary ms-4 purchase_unit add-plus-btn"
                                    data-bs-toggle="modal" data-bs-target="#modal_unit"
                                    ><i class="icon-base ti tabler-plus icon-md"></i></a>
                                </div>
                            </div>

                            <div class="col-12 col-md-6 col-lg-4 sale_unit_wrap">
                                <div class="d-flex justify-content-between">
                                    <div class="mb-5 w-100 validate_wrapper">
                                        <label class="form-label" for="sale_unit_id">
                                            <span class="sale_unit_label"><?php echo e(__('Unit')); ?></span> <?php echo requiredField(); ?>

                                        </label>
                                        <select id="sale_unit_id" name="sale_unit_id" class="select2 form-select" data-placeholder="<?php echo e(__('Unit')); ?>">
                                            <option value=""><?php echo e(__('Unit')); ?></option>
                                            <?php $__currentLoopData = $units ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $unit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($unit->id); ?>"><?php echo e($unit->unit_name); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                    <a href="javascript:void(0);" class="fw-medium btn btn-icon btn-label-primary ms-4 sale_unit add-plus-btn"
                                    data-bs-toggle="modal" data-bs-target="#modal_unit"
                                    ><i class="icon-base ti tabler-plus icon-md"></i></a>
                                </div>
                            </div>
                            <div class="col-12 col-md-6 col-lg-4 conversion_rate_wrap" style="display: none;">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="conversion_rate">
                                        <span><?php echo e(__('Conversion Rate')); ?></span> <?php echo requiredField(); ?>

                                    </label>
                                    <input type="text" class="form-control" placeholder="<?php echo e(__('Conversion Rate')); ?>" name="conversion_rate" id="conversion_rate" />
                                </div>
                            </div>
                            
                        </div>
                    </div>

                    <div class="card-header pt-0 hide-for-combo-product">
                        <h5 class="card-tile mb-0"><?php echo e(__('Price Information')); ?></h5>
                    </div>
                    <div class="card-body">
                        <div class="row">
                            <div class="col-12 col-md-6 col-lg-4 purchase_price_wrap hide-for-service-product hide-for-combo-product">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="purchase_price"><?php echo e(__('Purchase Price')); ?></label>
                                    <input type="text" class="form-control number-input" placeholder="<?php echo e(__('Purchase Price')); ?>" name="purchase_price" id="purchase_price" />
                                </div>
                            </div>
                            <div class="col-12 col-md-6 col-lg-4 hide-for-service-product hide-for-combo-product">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="profit_margin"><?php echo e(__('Profit Margin')); ?></label>
                                    <div class="input-group">
                                        <input type="text" class="form-control number-input" id="profit_margin" placeholder="<?php echo e(__('Profit Margin')); ?>" name="profit_margin" aria-describedby="profit_margin">
                                        <span id="profit_margin" class="input-group-text cursor-pointer">%</span>
                                    </div>
                                </div>
                            </div>
                            <div class="col-12 col-md-6 col-lg-4 sale_price_wrap hide-for-combo-product">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="sale_price"><?php echo e(__('Sale Price')); ?> <?php echo requiredField(); ?></label>
                                    <input type="text" class="form-control number-input" placeholder="<?php echo e(__('Sale Price')); ?>" name="sale_price" id="sale_price" />
                                </div>
                            </div>
                            <div class="col-12 col-md-6 col-lg-4 whole_sale_price_wrap hide-for-service-product hide-for-combo-product">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="whole_sale_price"><?php echo e(__('Whole Sale Price')); ?></label>
                                    <input type="text" class="form-control number-input" placeholder="<?php echo e(__('Whole Sale Price')); ?>" name="whole_sale_price" id="whole_sale_price" />
                                </div>
                            </div>
                        </div>
                    </div>

                    

                    <!-- Variation Section -->
                    <div class="card-header pt-0 variation_section" style="display: none;">
                        <h5 class="card-tile mb-0"><?php echo e(__('Variation Information')); ?></h5>
                    </div>
                    <div class="card-body variation_section variation_generator" style="display: none;">
                        <div class="row">
                            <div class="col-12">
                                <div class="table-responsive">
                                    <table class="table table-bordered" id="variationAttributesTable">
                                        <thead>
                                            <tr>
                                                <th style="width: 45%;"><?php echo e(__('Variation Option')); ?></th>
                                                <th style="width: 45%;"><?php echo e(__('Variation Values')); ?></th>
                                                <th style="width: 10%;"><?php echo e(__('Action')); ?></th>
                                            </tr>
                                        </thead>
                                        <tbody id="variationAttributesBody">
                                            <tr class="variation-row">
                                                <td>
                                                    <select class="form-select select2 variation-option" data-placeholder="Select Variation">
                                                        <option value=""><?php echo e(__('Select Variation')); ?></option>
                                                    </select>
                                                </td>
                                                <td>
                                                    <select class="form-select select2 variation-values" multiple data-placeholder="Select Values" style="width: 100%;">
                                                    </select>
                                                </td>
                                                <td>
                                                    <button type="button" class="btn text-danger remove-variation-row">
                                                        <i class="icon-base ti tabler-trash"></i>
                                                    </button>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <div class="mt-3 d-flex gap-2">
                                    <button type="button" class="btn btn-outline-primary d-flex gap-1" id="addVariationRow">
                                        <i class="ti tabler-plus"></i> <?php echo e(__('Add Variation Row')); ?>

                                    </button>
                                    <button type="button" class="btn btn-primary d-flex gap-1" id="generateVariations">
                                        <i class="ti tabler-refresh"></i> <?php echo e(__('Generate Variations')); ?>

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

                    <!-- Generated Variations Section -->
                    <div class="card-header pt-0 generated_variations_section" style="display: none;">
                        <div class="d-flex justify-content-between align-items-center card-tile">
                            <h5 class="mb-0"><?php echo e(__('Generated Variations')); ?></h5>
                            <button type="button" class="btn btn-outline-danger d-flex gap-1 align-items-center" id="backToGenerate">
                                <i class="ti tabler-arrow-left"></i> <?php echo e(__('Back To Generate')); ?>

                            </button>
                        </div>
                    </div>
                    <div class="card-body generated_variations_section" style="display: none;">
                        <div class="row" id="generatedVariationsBody">
                        </div>
                    </div>

                    <!-- Combo Product Section -->
                    <div class="card-header pt-0 combo_product_section" style="display: none;">
                        <h5 class="card-tile mb-0"><?php echo e(__('Combo Items')); ?></h5>
                    </div>
                    <div class="card-body combo_product_section" style="display: none;">
                        <div class="row mb-3">
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-3">
                                    <label class="form-label" for="combo_item_select"><?php echo e(__('Select Item')); ?></label>
                                    <select id="combo_item_select" class="select2 form-select" data-placeholder="Select General Product">
                                        <option value=""><?php echo e(__('Select Item')); ?></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="table-responsive">
                            <table class="table table-bordered" id="comboItemsTable">
                                <thead>
                                    <tr>
                                        <th style="width: 5%;"><?php echo e(__('SN')); ?></th>
                                        <th style="width: 10%;"><?php echo e(__('Show In Invoice')); ?></th>
                                        <th style="width: 30%;"><?php echo e(__('Item Name - Code')); ?></th>
                                        <th style="width: 15%;"><?php echo e(__('Quantity')); ?></th>
                                        <th style="width: 15%;"><?php echo e(__('Amount')); ?></th>
                                        <th style="width: 15%;"><?php echo e(__('Total')); ?></th>
                                        <th style="width: 10%;"><?php echo e(__('Action')); ?></th>
                                    </tr>
                                </thead>
                                <tbody id="comboItemsBody">
                                    <!-- Combo items will be added here dynamically -->
                                </tbody>
                            </table>
                        </div>
                        <div class="row mt-3">
                            <div class="col-12 text-end">
                                <div class="mb-3">
                                    <label class="form-label" for="combo_sale_price"><strong><?php echo e(__('Sale Price')); ?>:</strong></label>
                                    <input type="text" class="form-control text-end" id="combo_sale_price" name="combo_sale_price" placeholder="0.00" readonly style="max-width: 200px; display: inline-block; margin-left: 10px;">
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="card-header pt-0 stock_information_section hide-for-service-product hide-for-combo-product">
                        <h5 class="card-tile mb-0"><?php echo e(__('Stock Information')); ?></h5>
                    </div>
                    <div class="card-body stock_information_section hide-for-service-product hide-for-combo-product">
                        <div class="row">
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="opening_stock"><?php echo e(__('Opening Stock')); ?></label>
                                    <button type="button" class="btn btn-outline-primary w-100 set-opening-stock-btn" id="setOpeningStockBtn">
                                        <i class="ti tabler-settings me-1"></i> <?php echo e(__('Set Opening Stock')); ?>

                                    </button>
                                    <div class="opening-stock-summary mt-2" id="openingStockSummary" style="display: none;"></div>
                                </div>
                            </div>
                            
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="alert_quantity"><?php echo e(__('Alert Stock')); ?></label>
                                    <input type="text" class="form-control number-input" placeholder="<?php echo e(__('Alert Stock')); ?>" name="alert_quantity" id="alert_quantity" />
                                </div>
                            </div>
                            <div class="opening_stock_append d-none"></div>
                        </div>
                    </div>


                    <div class="card-header pt-0 hide-for-service-product hide-for-combo-product">
                        <h5 class="card-tile mb-0"><?php echo e(__('Warranty Information')); ?></h5>
                    </div>
                    <div class="card-body hide-for-service-product hide-for-combo-product">
                        <div class="row">
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="warranty"><?php echo e(__('Warranty')); ?></label>
                                    <div class="row">
                                        <div class="col-6">
                                            <input type="text" class="form-control number-input" placeholder="<?php echo e(__('Warranty')); ?>" name="warranty" id="warranty" />
                                        </div>
                                        <div class="col-6">
                                            <select id="warranty_date" class="select2 form-select" name="warranty_date" data-placeholder="Warranty Date">
                                                <option value="day"><?php echo e(__('Day')); ?></option>
                                                <option value="month"><?php echo e(__('Month')); ?></option>
                                                <option value="year"><?php echo e(__('Year')); ?></option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="guarantee"><?php echo e(__('Guarantee')); ?></label>
                                    <div class="row">
                                        <div class="col-6">
                                            <input type="text" class="form-control number-input" placeholder="<?php echo e(__('Guarantee')); ?>" name="guarantee" id="guarantee" />
                                        </div>
                                        <div class="col-6">
                                            <select id="guarantee_date" class="select2 form-select" name="guarantee_date" data-placeholder="Guarantee Date">
                                                <option value="day"><?php echo e(__('Day')); ?></option>
                                                <option value="month"><?php echo e(__('Month')); ?></option>
                                                <option value="year"><?php echo e(__('Year')); ?></option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    
                    <div class="card-header pt-0">
                        <h5 class="card-tile mb-0"><?php echo e(__('Tax Information')); ?></h5>
                    </div>
                    <div class="card-body">
                        <div class="row">
                            
                            <?php if(!empty($itemProfileTaxes)): ?>
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="applicable_tax_id"><?php echo e(__('Applicable Tax')); ?></label>
                                    <select id="applicable_tax_id" name="applicable_tax_id[]" class="select2 form-select" multiple data-placeholder="<?php echo e(__('Select Tax')); ?>">
                                        <?php $__currentLoopData = $itemProfileTaxes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tax): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($tax->id); ?>"><?php echo e($tax->tax_name); ?> (<?php echo e($tax->tax_rate); ?>%)</option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            </div>
                            <?php endif; ?>

                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="tax_type"><?php echo e(__('Tax Type')); ?></label>
                                    <select id="tax_type" name="tax_type" class="select2 form-select" data-placeholder="<?php echo e(__('Tax Type')); ?>">
                                        <option value="Exclusive" selected><?php echo e(__('Exclusive')); ?></option>
                                        <option value="Inclusive"><?php echo e(__('Inclusive')); ?></option>
                                    </select>
                                </div>
                            </div>

                            <?php if(isEnableGST()): ?>
                            <div class="col-12 col-md-6 col-lg-4">
                                <div class="mb-5 validate_wrapper">
                                    <label class="form-label" for="hsn_code"><?php echo e(__('HSN Code')); ?></label>
                                    <input type="text" class="form-control" placeholder="<?php echo e(__('HSN Code')); ?>" name="hsn_code" id="hsn_code" />
                                </div>
                            </div>
                            <?php endif; ?>

                        </div>
                    </div>


                    <!-- Media -->
                    <div class="card-header d-flex justify-content-between align-items-center card-title">
                        <h5 class="mb-0"><?php echo e(__('Item Image')); ?></h5>
                    </div>
                    <div class="card-body">
                        <div class="row">
                            <div class="col-md-6 col-12">
                                <div class="col-12 col-md-6 validate_wrapper">
                                    <label class="form-label mb-1" for="photo"><?php echo e(__('Item Image')); ?></label>
                                    <input type="file" class="form-control" id="photo" name="photo" accept="image/*">
                                    <div class="mt-2">
                                        <img id="photo_preview" src="<?php echo e(asset('public/uploads/dummy_images/default-picture.png')); ?>" alt="Item Image" style="border:1px dashed #d1d0d4; padding: 10px; border-radius: 5px; max-width: 200px; max-height: 200px; cursor: pointer;">
                                        <button type="button" class="btn btn-sm btn-danger mt-2 remove-image" style="display: none;">
                                            <i class="ti tabler-trash"></i> <?php echo e(__('Remove Image')); ?>

                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!-- /Media -->

                    <!-- Submit Button -->
                    <div class="card-footer">
                        <div class="d-flex">
                            <button type="submit" name="submit" value="submit" class="btn btn-primary add_item_submit me-4">
                                <?php echo submitIconWithText(''); ?>

                            </button>
                            <a href="<?php echo e(route('item.index')); ?>" class="btn btn-primary waves-effect waves-light">
                                <?php echo backIconWithText(); ?>

                            </a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>




<!-- Category Modal -->
<div class="modal fade" id="modal_category" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <form id="categoryForm">
                <div class="modal-header">
                    <h5 class="modal-title"><?php echo e(__('Category')); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-12 mb-4 validate_wrapper">
                            <label for="name" class="form-label"><?php echo e(__('Category')); ?> <?php echo e(__('Name')); ?> <?php echo requiredField(); ?></label>
                            <input type="text" id="name" name="name" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Category')); ?> <?php echo e(__('Name')); ?>" />
                        </div>
                        <div class="col-12 mb-4 validate_wrapper">
                            <label for="description" class="form-label"><?php echo e(__('Category')); ?> <?php echo e(__('Description')); ?></label>
                            <textarea type="text" id="description" name="description" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Category')); ?> <?php echo e(__('Description')); ?>"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary add_category">
                        <?php echo submitIconWithText(''); ?>

                    </button>
                    <button type="button" class="btn btn-danger" data-bs-dismiss="modal">
                        <?php echo closeIconWithText(); ?>

                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- Category Modal End -->

<!-- Brand Modal -->
<div class="modal fade" id="modal_brand" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <form id="brandForm">
                <div class="modal-header">
                    <h5 class="modal-title"><?php echo e(__('Brand')); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-12 mb-4 validate_wrapper">
                            <label for="name" class="form-label"><?php echo e(__('Brand')); ?> <?php echo e(__('Name')); ?> <?php echo requiredField(); ?></label>
                            <input type="text" id="name" name="name" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Brand')); ?> <?php echo e(__('Name')); ?>" />
                        </div>
                        <div class="col-12 mb-4 validate_wrapper">
                            <label for="description" class="form-label"><?php echo e(__('Brand')); ?> <?php echo e(__('Description')); ?></label>
                            <textarea type="text" id="description" name="description" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Brand')); ?> <?php echo e(__('Description')); ?>"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary add_brand">
                        <?php echo submitIconWithText(''); ?>

                    </button>
                    <button type="button" class="btn btn-danger" data-bs-dismiss="modal">
                        <?php echo closeIconWithText(); ?>

                    </button>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- Brand Modal End -->


<!-- Supplier Modal -->
<div class="modal fade" id="modal_supplier" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-xl" role="document">
        <div class="modal-content">
            <form id="supplierForm">
                <div class="modal-header">
                    <h5 class="modal-title"><?php echo e(__('Add')); ?> <?php echo e(__('Supplier')); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-4 col-md-6 col-12 mb-4 validate_wrapper">
                            <label for="name" class="form-label"><?php echo e(__('Name')); ?> <?php echo requiredField(); ?></label>
                            <input type="text" name="name" id="name" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Name')); ?>" />
                        </div>
                        <div class="col-lg-4 col-md-6 col-12 mb-4 validate_wrapper">
                            <label for="contact_person" class="form-label"><?php echo e(__('contact_person')); ?> <?php echo requiredField(); ?></label>
                            <input type="text" name="contact_person" id="contact_person" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('contact_person')); ?>" />
                        </div>
                        <div class="col-lg-4 col-md-6 col-12 mb-4 validate_wrapper">
                            <label for="phone" class="form-label"><?php echo e(__('Phone')); ?> <?php echo requiredField(); ?></label>
                            <input type="text" name="phone" id="phone" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Phone')); ?>" />
                        </div>
                        <div class="col-lg-4 col-md-6 col-12 mb-4 validate_wrapper">
                            <label for="email" class="form-label"><?php echo e(__('Email')); ?></label>
                            <input type="email" name="email" id="email" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Email')); ?>" />
                        </div>
                        <div class="col-lg-4 col-md-6 col-12 mb-4">
                            <label for="opening_balance" class="form-label"><?php echo e(__('opening_balance')); ?></label>
                            <div class="row">
                                <div class="col-7 validate_wrapper">
                                    <input type="text" name="opening_balance" id="opening_balance" class="form-control" placeholder="<?php echo e(__('opening_balance')); ?>" />
                                </div>
                                <div class="col-5 validate_wrapper">
                                    <select name="opening_balance_type" id="opening_balance_type" class="select2 form-select" data-placeholder="<?php echo e(__('opening_balance_type')); ?>">
                                        <option value="Debit"><?php echo e(__('Debit')); ?></option>
                                        <option value="Credit"><?php echo e(__('Credit')); ?></option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-4 col-md-6 col-12 mb-4 validate_wrapper">
                            <label for="description" class="form-label"><?php echo e(__('Description')); ?></label>
                            <textarea name="description" id="description" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Description')); ?>"></textarea>
                        </div>
                        <div class="col-lg-4 col-md-6 col-12 mb-4 validate_wrapper">
                            <label for="address" class="form-label"><?php echo e(__('Address')); ?></label>
                            <textarea name="address" id="address" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Address')); ?>"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary add_supplier">
                        <?php echo submitIconWithText(''); ?>

                    </button>
                    <button type="button" class="btn btn-danger" data-bs-dismiss="modal">
                        <?php echo closeIconWithText(); ?>

                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- Supplier Modal End -->


<!-- Rack Modal -->
<div class="modal fade" id="modal_rack" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <form id="rackForm">
                <div class="modal-header">
                    <h5 class="modal-title"><?php echo e(__('Rack')); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-12 mb-4 validate_wrapper">
                            <label for="name" class="form-label"><?php echo e(__('Rack')); ?> <?php echo e(__('Name')); ?> <?php echo requiredField(); ?></label>
                            <input type="text" id="name" name="name" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Rack')); ?> <?php echo e(__('Name')); ?>" />
                        </div>
                        <div class="col-12 mb-4 validate_wrapper">
                            <label for="description" class="form-label"><?php echo e(__('Rack')); ?> <?php echo e(__('Description')); ?></label>
                            <textarea type="text" id="description" name="description" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Rack')); ?> <?php echo e(__('Description')); ?>"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary add_rack">
                        <?php echo submitIconWithText(''); ?>

                    </button>
                    <button type="button" class="btn btn-danger" data-bs-dismiss="modal">
                        <?php echo closeIconWithText(); ?>

                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- Rack Modal End -->


<!-- Unit Modal -->
<div class="modal fade" id="modal_unit" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <form id="unitForm">
                <input type="hidden" class="sale_or_purchase" name="sale_or_purchase">
                <div class="modal-header">
                    <h5 class="modal-title"><?php echo e(__('Unit')); ?></h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-12 mb-4 validate_wrapper">
                            <label for="name" class="form-label"><?php echo e(__('Unit')); ?> <?php echo e(__('Name')); ?> <?php echo requiredField(); ?></label>
                            <input type="text" id="name" name="name" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Unit')); ?> <?php echo e(__('Name')); ?>" />
                        </div>
                        <div class="col-12 mb-4 validate_wrapper">
                            <label for="description" class="form-label"><?php echo e(__('Unit')); ?> <?php echo e(__('Description')); ?></label>
                            <textarea type="text" id="description" name="description" class="form-control" placeholder="<?php echo e(__('Enter')); ?> <?php echo e(__('Unit')); ?> <?php echo e(__('Description')); ?>"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary add_unit">
                        <?php echo submitIconWithText(''); ?>

                    </button>
                    <button type="button" class="btn btn-danger" data-bs-dismiss="modal">
                        <?php echo closeIconWithText(); ?>

                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- Unit Modal End -->

<!-- Opening Stock Modal -->
<div class="modal fade" id="modal_outlet" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-xl" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title"><?php echo e(__('opening_stock_set_for_outlet')); ?></h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body" id="openingStockModalBody">
                <div class="row" id="openingStockOutletsContainer">
                    <?php $__currentLoopData = $outlets; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $outlet): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="grid-change" data-outlet-id="<?php echo e($outlet->id); ?>">
                        <div class="card h-100 outlet-stock-card">
                            <div class="card-header pb-0">
                                <h6 class="card-title mb-0"><strong>Outlet:</strong> <?php echo e($outlet->outlet_name); ?></h6>
                            </div>
                            <div class="card-body outlet-stock-body" data-outlet-id="<?php echo e($outlet->id); ?>">
                                <!-- Content will be dynamically generated based on product type -->
                            </div>
                        </div>
                    </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary opening_stock_submit">
                    <?php echo submitIconWithText(''); ?>

                </button>
                <button type="button" class="btn btn-danger" data-bs-dismiss="modal">
                    <?php echo closeIconWithText(); ?>

                </button>
            </div>
        </div>
    </div>
</div>
<!-- Opening Stock Modal End -->


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

<?php $__env->startPush('page-js'); ?>
<?php echo app('Tighten\Ziggy\BladeRouteGenerator')->generate(); ?>
<script>
    // Pass outlets data to JavaScript
    window.outletsData = <?php echo json_encode($outlets ?? [], 15, 512) ?>;
</script>
<script src="<?php echo e(asset('public/backend_assets/vendor/libs/dropzone/dropzone.js')); ?>"></script>
<script src="<?php echo e(asset('public/backend_assets/vendor/libs/flatpickr/flatpickr.js')); ?>"></script>
<script src="<?php echo e(asset('public/backend_assets/vendor/js/cropper.js')); ?>"></script>
<script src="<?php echo e(asset('public/backend_assets/js/pages_js/add_item.js')); ?>"></script>
<?php $__env->stopPush(); ?>


<?php echo $__env->make('backend.backend_layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/uzbeacom/pos.uzbea.com/off_pos/Modules/Stock/resources/views/item/create.blade.php ENDPATH**/ ?>