<div class="col-md-8">
    <div class="form-group">
        <label>المادة الخام</label>
        <input id="productID" type="hidden" value="">
        <input id="productName" type="hidden" value="">
        <input id="rawCost" type="hidden" value="">
        <input type="text" class="form-control rawInput typeahead" value="">
    </div>
</div>
<div class="col-md-4">
    <div class="form-group">
        <label for="">الكمية المستخدمه لتصنيع اصغر وحدة من الصنف</label>
        <div class="input-group">
            <input style=" min-width: 120px; " step="0.01" type="number" class="form-control rawInput rawqty" value="1">
            <span style="width: 100px;" class="unit input-group-addon">
                <select id="RawunitList" class="form-control rawunitList" required>
                    <?php $__currentLoopData = \App\Unit::get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $unit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($unit->id); ?>"><?php echo e($unit->name); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </span>
        </div>
    </div>
</div>
<div class="col-md-4 hide">
    <div class="form-group">
        <label for="">عدد اﻷلوان</label>
        <input type="number" step="0.01" class="form-control rawInput rawcolor" value="0">
    </div>
</div>
<div class="col-md-12">
    <table class="table table-bordered">
        <thead>
            <tr>
                <th>#</th>
                <th>الصنف الخام</th>
                <th>الكمية المستخدمة لتصنيع أصغر وحدة</th>
                <th>الوحدة</th>
                <th></th>
            </tr>
        </thead>
        <tbody id="rawTable">
            <?php
                $subtotal = 0;
                $totalraw = 0;
            ?>
            <?php $__currentLoopData = $product->rawMatrial; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php
                $rowClass = "rowelement".$item->pivot->raw_material_id;
            ?>
            <tr class="<?php echo e($rowClass); ?>">
                <td><input type="hidden" name="raw[<?php echo e($loop->iteration); ?>][raw_material_id]" value="<?php echo e($item->pivot->raw_material_id); ?>"><?php echo e($loop->iteration); ?></td>
                <td>
                    <input class="iteration" type="hidden" value="<?php echo e($loop->iteration); ?>">
                    <?php echo e($item->name); ?>

                    <input class="rawCost" type="hidden" value="<?php echo e($item->last_cost); ?>">
                </td>
                <?php
                    $subtotal = round($item->last_cost,2)*$item->pivot->qty;
                    $totalraw += $subtotal;
                ?>
                <td><input class="rawQty" type="hidden" name="raw[<?php echo e($loop->iteration); ?>][qty]" value="<?php echo e($item->pivot->qty); ?>"><?php echo e($item->pivot->qty); ?> ( <?php echo e(round($item->last_cost,2)); ?> ) ====> (<?php echo e($subtotal); ?>)</td>
                <td>
                    <input type="hidden" name="raw[<?php echo e($loop->iteration); ?>][raw_unit_text]" value="<?php echo e($item->pivot->raw_unit_text); ?>">
                    <input type="hidden" name="raw[<?php echo e($loop->iteration); ?>][raw_unit_id]" value="<?php echo e($item->pivot->raw_unit_id); ?>">
                    <input type="hidden" name="raw[<?php echo e($loop->iteration); ?>][color_number]" value="<?php echo e($item->pivot->color_number); ?>">
                    <?php echo e($item->pivot->raw_unit_text); ?>

                </td>
                <td><a href="#" class="btn btn-sm btn-danger"><i class="fa fa-trash"></i></a></td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </tbody>
        <tfoot>
            <tr class="bg-primary">
                <td colspan="2">الإجمالى</td>
                <td colspan="3"><?php echo e($totalraw); ?></td>
            </tr>
        </tfoot>
    </table>
</div>
