<div class="col-md-12 unitRow">

    <?php if($i==1): ?>

        <div class="col-md-12 ">
            <?php if(count($units) > 1): ?>
            <div class="form-group col-md-5">
                <label for="autocal">
                    <input class="flat-red" name="autocal" checked type="checkbox" id="autoCalcualtion">
                    <?php echo app('translator')->getFromJson('front.Automatic price calculation for different units'); ?>
                </label>
            </div>
            <?php endif; ?>
            <div class="form-group col-md-4">
                <div class="input-group">
                    <div class="input-group-addon"><?php echo app('translator')->getFromJson('front.Calculate price increase'); ?> <input class="flat-red" id="priceCalcualtion" name="product[is_price_percent]" <?php if($product->is_price_percent): ?> checked <?php endif; ?> type="checkbox"></div>
                    <input class="form-control" id="pricePercentage" value="<?php echo e($product->price_percent); ?>" name="product[price_percent]" step="0.01" type="number" placeholder="<?php echo app('translator')->getFromJson('front.The percentage of the sectoral price increase over the wholesale'); ?>">
                    <div class="input-group-addon"><i class="fa fa-percent"></i></div>
                </div>
            </div>
            <div class="form-group col-md-3">
                <div class="input-group">
                    <input class="form-control" id="pricePercentagegomla" value="<?php echo e($product->gomla_price_percent); ?>" name="product[gomla_price_percent]" step="0.01" type="number" placeholder="<?php echo app('translator')->getFromJson('front.Wholesale'); ?>">
                    <div class="input-group-addon"><i class="fa fa-percent"></i></div>
                    <div title="لو علمت عليها زيادة سعر المنتج فقط اللى هتسمع وليست الفئة" class="input-group-addon">
                        <input class="flat-red" name="product_percent_only" <?php if($product->product_percent_only): ?> checked <?php endif; ?> type="checkbox">
                    </div>
                </div>
            </div>
        </div>
    <?php endif; ?>
    <div class="col-md-2">
        <div class="form-group">
            <label><?php echo e($unittitle); ?></label>
            <select style="width: 100%;" name="unit[<?php echo e($i); ?>][unit_id]" class="form-control productUnitSelector">
                <?php if($i!=1): ?>
                    <option value=""></option>
                <?php endif; ?>
                <?php $__currentLoopData = $units; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option <?php echo e(isset($unit->id) && $unit->id==$u->id?'selected':''); ?> value="<?php echo e($u->id); ?>"><?php echo e($u->name); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
        </div>
    </div>
    <div class="col-md-1">
        <div class="form-group">
            <label title="<?php echo e($description); ?>" for=""><?php echo app('translator')->getFromJson('front.pieces count'); ?></label>
            <?php
                if(isset($unit3->pivot->pieces_num) && $i==3 && $unit2->pivot->pieces_num>0){
                    $unitpicesNum = $unit3->pivot->pieces_num/$unit2->pivot->pieces_num;
                }
            ?>
            <?php if($i==3): ?>
                <input <?php if(count($units)==1 || $i==1): ?> readonly  <?php endif; ?> required="" type="text" name="unit[<?php echo e($i); ?>][pieces_num]" class="form-control pieces_num" value="<?php echo e($unitpicesNum??0); ?>">
            <?php else: ?>
            <input title="<?php echo e($description); ?>" <?php if(count($units)==1 || $i==1 && !isset($unit->pivot->pieces_num)): ?> readonly  <?php endif; ?> required="" type="text" name="unit[<?php echo e($i); ?>][pieces_num]" class="form-control pieces_num" value="<?php echo e(isset($unit->pivot->pieces_num)?(int)$unit->pivot->pieces_num:($i==1?1:0)); ?>">
            <?php endif; ?>
        </div>
    </div>
    <div class="col-md-2">
        <div class="form-group">
            <label for=""><?php echo app('translator')->getFromJson('front.cost'); ?></label>
            <input required="" min="0" type="number" step="0.01" name="unit[<?php echo e($i); ?>][cost_price]" class="form-control cost_price" value="<?php echo e(isset($unit->pivot->cost_price)?round($unit->pivot->cost_price,2):0); ?>">
        </div>
    </div>
    <div class="col-md-2">
        <div class="form-group">
            <label for=""><?php echo app('translator')->getFromJson('front.Sector price'); ?></label>
            <input required="" min="0" type="number" step="0.01" name="unit[<?php echo e($i); ?>][sale_price]" class="form-control sale_price" value="<?php echo e(isset($unit->pivot->sale_price)?$unit->pivot->sale_price:0); ?>">
        </div>
    </div>
    <div class="col-md-2">
        <div class="form-group">
            <label for=""><?php echo app('translator')->getFromJson('front.Half wholesale'); ?></label>
            <input required="" min="0" type="number" step="0.01" name="unit[<?php echo e($i); ?>][half_gomla_price]" class="form-control half_gomla_price" value="<?php echo e(isset($unit->pivot->half_gomla_price)?$unit->pivot->half_gomla_price:0); ?>">
        </div>
    </div>
    <div class="col-md-2">
        <div class="form-group">
            <label for=""><?php echo app('translator')->getFromJson('front.Wholesale Price'); ?></label>
            <input required="" min="0" type="number" step="0.01" name="unit[<?php echo e($i); ?>][gomla_price]" class="form-control gomla_price" value="<?php echo e(isset($unit->pivot->gomla_price)?$unit->pivot->gomla_price:0); ?>">
        </div>
    </div>
    <div class="col-md-2">
        <div class="form-group">
            <label for=""> <?php echo app('translator')->getFromJson('front.Wholesale Wholesale'); ?></label>
            <input required="" min="0" type="number" step="0.01" name="unit[<?php echo e($i); ?>][gomla_gomla_price]" class="form-control gomla_gomla_price" value="<?php echo e(isset($unit->pivot->gomla_gomla_price)?$unit->pivot->gomla_gomla_price:0); ?>">
        </div>
    </div>
    <?php if(isset($settings['ShowCustomerPrice']) && $settings['ShowCustomerPrice']==1): ?>
    <div class="col-md-4">
        <div class="form-group">
            <label for="">سعر المستهلك</label>
            <input min="0" type="number" step="0.01" name="unit[<?php echo e($i); ?>][customer_price]" class="form-control" value="<?php echo e(isset($unit->pivot->customer_price)?$unit->pivot->customer_price:0); ?>">
        </div>
    </div>
    <?php endif; ?>

    
</div>
