

<?php $__env->startSection('content'); ?>

  <div class="row">
        <div class="col-12">
            <div class="card me-2">
                    <div class="card-body">
                        <div class="d-flex justify-content-end align-items-center mb-3 px-3">
                            <form method="GET" action="<?php echo e(route('product-Report')); ?>" class="d-flex align-items-center">

                                <div class="form-group me-3">
                                    <input type="date" class="form-control <?php $__errorArgs = ['start_date'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                        id="start_date" name="start_date"
                                        value="<?php echo e(old('start_date', request()->get('start_date'))); ?>">

                                    <!-- Display error message for start_date -->
                                    <?php $__errorArgs = ['start_date'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <div class="invalid-feedback">
                                            <?php echo e($message); ?>

                                        </div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>

                                <div class="form-group me-3">
                                    <input type="date" class="form-control <?php $__errorArgs = ['end_date'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                                        id="end_date" name="end_date"
                                        value="<?php echo e(old('end_date', request()->get('end_date'))); ?>">

                                    <!-- Display error message for end_date -->
                                    <?php $__errorArgs = ['end_date'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <div class="invalid-feedback">
                                            <?php echo e($message); ?>

                                        </div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                </div>

                                <div class="form-group me-3">

                                    <select name="status" id="status" class="form-control">
                                        <option value="">Filters</option>
                                        <option value=" " <?php echo e(request()->get('status') == 'all' ? 'selected' : ''); ?>>All
                                        </option>
                                        <option value="current" <?php echo e(request()->get('status') == 'current' ? 'selected' : ''); ?>>
                                            Current
                                            Products</option>
                                        <option value="A" <?php echo e(request()->get('status') == 'added' ? 'selected' : ''); ?>>Added
                                        </option>
                                        <option value="D" <?php echo e(request()->get('status') == 'deleted' ? 'selected' : ''); ?>>
                                            Deleted
                                        </option>
                                        <option value="E" <?php echo e(request()->get('status') == 'updated' ? 'selected' : ''); ?>>
                                            Updated
                                        </option>
                                    </select>
                                </div>
                                <button type="submit" class="btn btn-primary">Filter</button>
                            </form>
                        </div>

                        <div class="table-responsive">
                            <table class="table align-items-center mb-0 table-hover text-sm" id="myTable">
                                <thead>
                                    <tr>
                                        <th class="text-uppercase text-secondary  font-weight-bolder opacity-7">Branch
                                        </th>
                                        <th class="text-uppercase text-secondary  font-weight-bolder opacity-7">Product Name
                                        </th>
                                        <th class="text-uppercase text-secondary  font-weight-bolder opacity-7">Category
                                        </th>
                                        <th class="text-uppercase text-secondary  font-weight-bolder opacity-7">Avl. Qty
                                        </th>
                                        <th class="text-uppercase text-secondary  font-weight-bolder opacity-7">Price</th>
                                        

                                        <?php if($status != 'current'): ?>
                                            <th class="text-uppercase text-secondary  font-weight-bolder opacity-7">Created by
                                            </th>
                                            <th class="text-uppercase text-secondary  font-weight-bolder opacity-7">Date</th>
                                        <?php endif; ?>


                                    </tr>
                                </thead>
                                <tbody>

                                    <?php $__currentLoopData = $results; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td class="ps-4">
                                                <p class="text-xs font-weight-bold mb-0"><?php echo e($data->branch->name ?? ''); ?></p>
                                            </td>
                                            <td class="ps-4">
                                                <p class="text-xs font-weight-bold mb-0"><?php echo e($data->branch->native_name_flag == 'A' ? ($data->native_name ?? $data->name) : ($data->name ?? '')); ?></p>
                                            </td>
                                            <td class="ps-4">
                                                <p class="text-xs font-weight-bold mb-0"><?php echo e($data->category->name ?? ''); ?></p>
                                            </td>
                                            <td class="ps-4">
                                                <p class="text-xs font-weight-bold mb-0"><?php echo e($data->qty ?? ''); ?></p>
                                            </td>
                                            <td class="ps-4">
                                                <p class="text-xs font-weight-bold mb-0"><?php echo e($data->unit_price ?? ''); ?></p>
                                            </td>
                                            
                                            <?php if($status != 'current'): ?>
                                                <td class="ps-4">
                                                    <p class="text-xs font-weight-bold mb-0">
                                                        <?php echo e($data->user ? $data->user->name : 'Unknown'); ?>

                                                    </p>
                                                </td>
                                                <?php if($status == 'E'): ?>
                                                    <td class="ps-4">
                                                        <p class="text-xs font-weight-bold mb-0">
                                                            <?php echo e($data->updated_at->toDateString() ? \Carbon\Carbon::parse($data->updated_at->toDateString())->format('d-m-Y') : ''); ?>

                                                        </p>
                                                    </td>
                                                <?php else: ?>
                                                    <td class="ps-4">
                                                        <p class="text-xs font-weight-bold mb-0">
                                                            <?php echo e($data->created_at->toDateString() ? \Carbon\Carbon::parse($data->created_at->toDateString())->format('d-m-Y') : ''); ?>

                                                        </p>
                                                    </td>
                                                <?php endif; ?>
                                            <?php endif; ?>

                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                </tbody>
                            </table>

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

<?php echo $__env->make('layouts.layoutapp', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /opt/lampp/htdocs/lara_commonbilling_new/resources/views/reports/productReport.blade.php ENDPATH**/ ?>