<input type="hidden" name="location_id" value="1">
                    <input type="hidden" name="status" id="purchase-status">
                        <div class="grid grid-cols-2 gap-5" style="margin-bottom: 20px;">
                            <div style="display: flex; align-items: center; gap: 20px;">
                                <label style="width: 20%;" for="referenceNo">Reference No</label>
                                <input class="form-input"  type="text" id="referenceNo" name="ref_no" readonly value="<?php echo e($transaction->ref_no ?? ''); ?>">
                            </div>
                            <div style="display: flex; align-items: center; gap: 20px;">
                                <label style="width: 20%;" for="datepicker">Purchase Date <span>*</span></label>
                                <input class="form-input" type="date" id="transaction_date" name="transaction_date" value="<?php echo e(isset($transaction) ? date('Y-m-d', strtotime($transaction->transaction_date)) :  date('Y-m-d')); ?>">
                            </div>
                        </div>
                        <input type="hidden" name="return_id[]" value="" id="purchase_return">
                        <div style="margin-top: 20px;">
                            <div class="customer-table">
                                <table  id="purchase_entry_table" class="whitespace-nowrap">
                                    <thead class="tble-head">
                                        <tr>
                                            <th>No</th>
                                            <th>SKU</th>
                                            <th>Description</th>
                                            <th>Purchase Price</th>
                                            <th>Quantity</th>
                                            <!-- <th>Discount</th> -->
                                            <!-- <th>Product Val</th> -->
                                            <th>Line Total</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        
                                    <?php $__currentLoopData = $transaction->lines_of_purchase ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $line): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php 
                                        $return_line = 0;
                                        if($line->is_return == 1)
                                        {
                                            $return_line = App\Models\PurchaseReturnLine::where('removed_purchase_line', $line->id)->where('status', 1)->sum('quantity');
                                        }
                                        $quantity = $line->quantity - $return_line;
                                        ?>
                                        <?php if($quantity > 0): ?>
                                        <tr data-id="<?php echo e($line->id); ?>">
                                            <input type="hidden" name="purchases[<?php echo e($row_count); ?>][line_id]" value="<?php echo e($line->id); ?>">
                                            <td>
                                                <input type="checkbox" id="check-box" class="form-checkbox" value="<?php echo e($line->id); ?>"/>
                                            </td>
                                            <td>
                                                <?php echo e($line->product->sku_code); ?>

                                            </td>
                                            <td>
                                                <?php echo e($line->product->name); ?>

                                            </td>
                                            
                                            <td>
                                                <?php echo Form::text('purchases[' . $row_count . '][purchase_price]',
                                                number_format($line->purchase_price, 2, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-input input-sm purchase_cost input_number']); ?>

                                            </td>
                                            <!-- <td>
                                                <?php echo Form::text('purchases[' . $row_count . '][sale_price]',
                                                number_format($line->product->sale_price, 2, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-input input-sm input_number']); ?>

                                            </td> -->
                                            <td>
                                                <?php echo Form::hidden('purchases[' . $row_count . '][product_id]', $line->product->id ); ?>


                                                <?php
                                                    $check_decimal = 'false';
                                                    if($line->product->pur_unit->allow_decimal == 0){
                                                        $check_decimal = 'true';
                                                    }
                                                    
                                                ?>
                                                <?php echo Form::number('purchases[' . $row_count . '][quantity]', number_format($quantity, 2, $currency_details->decimal_separator, $currency_details->thousand_separator), ['class' => 'form-input input-sm purchase_quantity input_number mousetrap', 'required', 'id' => 'product_quantity_'.$row_count, 'data-rule-abs_digit' => $check_decimal, 'data-msg-abs_digit' => __('lang_v1.decimal_value_not_allowed' ), 'width' => '80%', 'min' => '1', 'max' => $quantity ]); ?><?php echo e($line->product->pur_unit->short_code); ?>

                                            </td>
                                            <!-- <td>
                                            <?php echo Form::hidden('purchases[' . $row_count . '][discount_type]',
                                                'percentage', ['class' => 'form-input input-sm product_discount_type input_number']); ?>

                                            <?php echo Form::text('purchases[' . $row_count . '][discount]',
                                                $line->discount, ['class' => 'form-input input-sm inline_discounts input_number']); ?>

                                            </td> -->
                                            <!-- <td>
                                            <?php echo Form::number('purchases[' . $row_count . '][product_value]',
                                                null, ['class' => 'form-input input-sm product_value input_number']); ?>

                                            </td> -->
                                            <td>
                                                <span class="row_subtotal"><?php echo e($line->line_total); ?></span>
                                                <input type="hidden" class="row_subtotal_hidden" name="purchases[<?php echo e($row_count); ?>][line_total]" value="<?php echo e($line->line_total); ?>">
                                            </td>
                                            
                                            <?php $row_count++ ;?>
                                        </tr>
                                        <?php endif; ?>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    <input type="hidden" id="row_count" value="<?php echo e($row_count); ?>">
                                    </tbody>
                                </table>
                                
                            </div>
                        </div>

                        <div class="grid grid-cols-2" style="margin-top: 20px; gap: 150px;">
                            <div class="left" style="padding: 20px;">
                            <div>
                                    <label style="width: 40%;" for="returnType">Note</label>
                                    <textarea class="form-input" placeholder="Note..." name="details" id="" cols="30"
                                        rows="4"></textarea>
                                </div>
                                <!-- <div class="grid grid-cols-2">
                                    <div style="align-items: center; gap: 10px; margin-bottom: 10px;width:90%;">
                                        <label for="discountType">Discount Type</label>
                                        <select class="form-select" name="discount_type" id="discount_type">
                                            <option value="percentage">Percentage</option>
                                            <option value="fixed">Fixed</option>
                                        </select>
                                    </div>
                                    <div style="align-items: center; gap: 20px; margin-bottom: 10px;width:90%;">
                                        <?php echo Form::label('discount_amount', __( 'Discount Amount' ) . ':'); ?>

							            <?php echo Form::text('discount_amount', 0, ['class' => 'form-input input_number']); ?>

                                    </div>
                                </div>
                                <div class="grid grid-cols-1">    
                                    <div style="align-items: center; gap: 20px; margin-bottom: 10px;width:95%;">
                                        <label style="width: 40%;" for="tax">Tax</label>
                                        <select class="form-select" name="tax_id" id="tax_id">
                                            <option value="" data-tax_amount="0" data-tax_type="fixed" selected>None</option>
                                            <?php $__currentLoopData = $taxes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tax): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($tax->id); ?>" data-tax_amount="<?php echo e($tax->amount); ?>" data-tax_type="<?php echo e($tax->calculation_type); ?>"><?php echo e($tax->name); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                        <?php echo Form::hidden('tax_amount', 0, ['id' => 'tax_amount']); ?>

                                    </div>
                                </div> -->
                            </div>
                            <div class="right" style="background-color: #f9f9f9; border-radius: 5px; padding: 20px;">
                                <div style="display: flex; align-items: center; gap: 20px; margin-bottom: 10px;">
                                    <label style="width: 30%;" for="returnType">Sub Total</label>
                                    <span id="total_subtotal_return" class="display_currency"></span>
									<!-- This is total before purchase tax-->
                                    <?php echo Form::hidden('final_total', 0 , ['id' => 'grand_total_hidden_return']); ?>

									<input type="hidden" id="total_subtotal_input_return" value=0  name="total_before_tax">
                                    <!-- <input type="text" class="form-input" > -->
                                </div>
                                
                                <div style="display: flex; align-items: center; gap: 20px;">
                                    <label style="width: 30%;" for="returnType">Grand Total</label>
                                    <span id="grand_total_text_return" class="display_currency">0</span>
                                </div>
                            </div>
                        </div>
<?php /**PATH /home/loopdigim/public_html/sabari_hotel/resources/views/purchase_return/partial/row_data_form.blade.php ENDPATH**/ ?>