<?php $__env->startSection('content'); ?>
<!--breadcrumb-->
<div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3">
    <div class="breadcrumb-title pe-3">Main Body create</div>
    <div class="ps-3">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb mb-0 p-0">
                <li class="breadcrumb-item"><a href="javascript:;">
                    
                </a>
                </li>
                <li class="breadcrumb-item active" aria-current="page">Main Body</li>
            </ol>
        </nav>
    </div>
</div>
<!--end breadcrumb-->
<div class="row">
    <div class="col-lg-12 mx-auto">
        <div class="card">
            <div class="card-header px-4 py-3">
                <div class="row">
                    <div class="col-lg-10"></div>
                    <div class="col-lg-2"><button value="Back" type="Button" onclick="history.go(-1);" class="btn btn-grd btn-grd-branding px-5 btn-sm">Back</button></div>
                </div>
            </div>
            <div class="card-body p-4">
                <form action="<?php echo e(route('admin/bolts/msm/store')); ?>" method="post">
                    <?php echo csrf_field(); ?>
                    <div class="card-body">
                        <div class="row pb-2">
                            <div class="col-lg-10 col-md-10 col-10"></div>
                            <div class="col-lg-2 col-md-2 col-2 text-end"> <a href="javascript:void(0);" class="btn btn-success btn-sm" id="add_rowA"><i class="fa fa-plus"></i> Add Row</a></div>
                        </div>
                        <div class="row">
                            <table>
                                <thead>
                                    <tr>
                                        <th>Parts</th>
                                        <th>Dia/Width</th>
                                        <th>Length</th>
                                        <th>Thickness</th>
                                        <th>Moc</th>
                                        <th>Density</th>
                                        <th>Qty</th>
                                        <th>Surface Area</th>
                                        <th>Weigth</th>
                                        <th>Lab rate</th>
                                        <th>mat rate</th>
                                        <th>Total rate</th>
                                        <th>Del</th>
                                    </tr>
                                </thead>
                                <tbody id="row_body3">
                                    <input type="hidden" name="rep_amount" value="" id="rep_amount">
                                    <input type="hidden" value="7" id="row_countA">
                                    <tr id="rowA1">
                                        <td>
                                            <input type="hidden" name="items[1][partid]" id="partid1" value="1" readonly>
                                            <input type="text" style="width: 100%;" value="SHALL" readonly>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[1][dia_width]" id="diawidth1"></td>
                                        <td><input type="text" style="width: 100%;" name="items[1][length]" id="length1"></td>
                                        <td><input type="text" style="width: 100%;" name="items[1][thickness]" id="thickness1"></td>
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" name="items[1][moc]" id="moc1">
                                                <option selected value="">Choose...</option>
                                                <?php $__currentLoopData = $mocs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $moc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($moc->id); ?>"><?php echo e($moc->mocname); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[1][density]" id="density1" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[1][qty]" id="qty1"></td>
                                        <td><input type="text" style="width: 100%;" name="items[1][surface_area]" id="surfacearea1" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[1][weight]" id="weight1" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[1][labrate]" id="labrate1" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[1][matrate]" id="matrate1" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[1][totalrate]" id="totalrate1" value="0" readonly></td>
                                        <td class="table-option"><a href="javascript:void(0);" class="w-100 remove_row btn btn-danger btn-sm" data-row="1"><i class="lni lni-trash"></i></a></td>
                                    </tr>
                                    
                                    <tr id="rowA2">
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" name="items[2][partid]" id="partid2">
                                                <option selected value="">Choose...</option>
                                                <option value="2">TOP DISH ELLIPSOIDAL</option>
                                                <option value="3">TOP DISH TORISPHERICAL</option>
                                                <option value="4">TO DISH CONE ROOF</option>
                                                <option value="5">TOP DISH FLAT DISH</option>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[2][dia_width]" id="diawidth2"></td>
                                        <td><input type="text" style="width: 100%;" name="items[2][length]" id="length2"></td>
                                        <td><input type="text" style="width: 100%;" name="items[2][thickness]" id="thickness2"></td>
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" name="items[2][moc]" id="moc2">
                                                <option selected value="">Choose...</option>
                                                <?php $__currentLoopData = $mocs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $moc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($moc->id); ?>"><?php echo e($moc->mocname); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[2][density]" id="density2" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[2][qty]" id="qty2"></td>
                                        <td><input type="text" style="width: 100%;" name="items[2][surface_area]" id="surfacearea2" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[2][weight]" id="weight2" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[2][labrate]" id="labrate2" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[2][matrate]" id="matrate2" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[2][totalrate]" id="totalrate2" value="0" readonly></td>
                                        <td class="table-option"><a href="javascript:void(0);" class="w-100 remove_row btn btn-danger btn-sm" data-row="2"><i class="lni lni-trash"></i></a></td>
                                    </tr>
                                    
                                    <tr id="rowA3">
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" name="items[3][partid]" id="partid3">
                                                <option selected value="">Choose...</option>
                                                <option value="6">BOTTOM DISH ELLIPSOIDAL</option>
                                                <option value="7">BOTTOM DISH TORISPHERICAL</option>
                                                <option value="8">BOTTOM DISH CONE ROOF</option>
                                                <option value="9">BOTTOM DISH FLAT DISH</option>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[3][dia_width]" id="diawidth3"></td>
                                        <td><input type="text" style="width: 100%;" name="items[3][length]" id="length3"></td>
                                        <td><input type="text" style="width: 100%;" name="items[3][thickness]" id="thickness3"></td>
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" name="items[3][moc]" id="moc3">
                                                <option selected value="">Choose...</option>
                                                <?php $__currentLoopData = $mocs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $moc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($moc->id); ?>"><?php echo e($moc->mocname); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[3][density]" id="density3" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[3][qty]" id="qty3"></td>
                                        <td><input type="text" style="width: 100%;" name="items[3][surface_area]" id="surfacearea3" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[3][weight]" id="weight3" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[3][labrate]" id="labrate3" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[3][matrate]" id="matrate3" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[3][totalrate]" id="totalrate3" value="0" readonly></td>
                                        <td class="table-option"><a href="javascript:void(0);" class="w-100 remove_row btn btn-danger btn-sm" data-row="3"><i class="lni lni-trash"></i></a></td>
                                    </tr>
                                    
                                    <tr id="rowA4">
                                        <td>
                                            <input type="hidden" name="items[4][partid]" id="partid4" value="10" readonly>
                                            <input type="text" style="width: 100%;" value="BAFFLES" readonly>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[4][dia_width]" id="diawidth4"></td>
                                        <td><input type="text" style="width: 100%;" name="items[4][length]" id="length4"></td>
                                        <td><input type="text" style="width: 100%;" name="items[4][thickness]" id="thickness4"></td>
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" name="items[4][moc]" id="moc4">
                                                <option selected value="">Choose...</option>
                                                <?php $__currentLoopData = $mocs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $moc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($moc->id); ?>"><?php echo e($moc->mocname); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[4][density]" id="density4" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[4][qty]" id="qty4"></td>
                                        <td><input type="text" style="width: 100%;" name="items[4][surface_area]" id="surfacearea4" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[4][weight]" id="weight4" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[4][labrate]" id="labrate4" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[4][matrate]" id="matrate4" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[4][totalrate]" id="totalrate4" value="0" readonly></td>
                                        <td class="table-option"><a href="javascript:void(0);" class="w-100 remove_row btn btn-danger btn-sm" data-row="4"><i class="lni lni-trash"></i></a></td>
                                    </tr>
                                    
                                    <tr id="rowA5">
                                        <td>
                                            <input type="hidden" name="items[5][partid]" id="partid5" value="11" readonly>
                                            <input type="text" style="width: 100%;" value="BAFFLES CLEATS" readonly>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[5][dia_width]" id="diawidth5"></td>
                                        <td><input type="text" style="width: 100%;" name="items[5][length]" id="length5"></td>
                                        <td><input type="text" style="width: 100%;" name="items[5][thickness]" id="thickness5"></td>
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" name="items[5][moc]" id="moc5">
                                                <option selected value="">Choose...</option>
                                                <?php $__currentLoopData = $mocs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $moc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($moc->id); ?>"><?php echo e($moc->mocname); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[5][density]" id="density5" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[5][qty]" id="qty5"></td>
                                        <td><input type="text" style="width: 100%;" name="items[5][surface_area]" id="surfacearea5" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[5][weight]" id="weight5" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[5][labrate]" id="labrate5" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[5][matrate]" id="matrate5" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[5][totalrate]" id="totalrate5" value="0" readonly></td>
                                        <td class="table-option"><a href="javascript:void(0);" class="w-100 remove_row btn btn-danger btn-sm" data-row="5"><i class="lni lni-trash"></i></a></td>
                                    </tr>
                                    
                                    <tr id="rowA6">
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" name="items[6][partid]" id="partid6">
                                                <option selected value="">Choose...</option>
                                                <option value="12">L/COIL 40</option>
                                                <option value="13">L/COIL 80</option>
                                                <option value="14">JACKET RIBSF</option>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[6][dia_width]" id="diawidth6"></td>
                                        <td><input type="text" style="width: 100%;" name="items[6][length]" id="length6"></td>
                                        <td><input type="text" style="width: 100%;" name="items[6][thickness]" id="thickness6"></td>
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" name="items[6][moc]" id="moc6">
                                                <option selected value="">Choose...</option>
                                                <?php $__currentLoopData = $mocs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $moc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($moc->id); ?>"><?php echo e($moc->mocname); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[6][density]" id="density6" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[6][qty]" id="qty6"></td>
                                        <td><input type="text" style="width: 100%;" name="items[6][surface_area]" id="surfacearea6" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[6][weight]" id="weight6" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[6][labrate]" id="labrate6" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[6][matrate]" id="matrate6" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[6][totalrate]" id="totalrate6" value="0" readonly></td>
                                        <td class="table-option"><a href="javascript:void(0);" class="w-100 remove_row btn btn-danger btn-sm" data-row="6"><i class="lni lni-trash"></i></a></td>
                                    </tr>
                                    
                                    <tr id="rowA7">
                                        <td>
                                            <input type="hidden" name="items[7][partid]" id="partid7" value="15" readonly>
                                            <input type="text" style="width: 100%;" value="LUG" readonly>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[7][dia_width]" id="diawidth7"></td>
                                        <td><input type="text" style="width: 100%;" name="items[7][length]" id="length7"></td>
                                        <td><input type="text" style="width: 100%;" name="items[7][thickness]" id="thickness7"></td>
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" name="items[7][moc]" id="moc7">
                                                <option selected value="">Choose...</option>
                                                <?php $__currentLoopData = $mocs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $moc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($moc->id); ?>"><?php echo e($moc->mocname); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="items[7][density]" id="density7" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[7][qty]" id="qty7"></td>
                                        <td><input type="text" style="width: 100%;" name="items[7][surface_area]" id="surfacearea7" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[7][weight]" id="weight7" value="0" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="items[7][labrate]" id="labrate7" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[7][matrate]" id="matrate7" value="0"></td>
                                        <td><input type="text" style="width: 100%;" name="items[7][totalrate]" id="totalrate7" value="0" readonly></td>
                                        <td class="table-option"><a href="javascript:void(0);" class="w-100 remove_row btn btn-danger btn-sm" data-row="7"><i class="lni lni-trash"></i></a></td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <br>
                        <h5>Nozzel</h5>
                        <div class="row">
                            <table>
                                <thead>
                                    <tr>
                                        <th style="width: 52px;">NB</th>
                                        <th style="width: 52px;">SCH</th>
                                        <th style="width: 40px;">Moc</th>
                                        <th>length</th>
                                        <th>Pipe Weigth</th>
                                        <th>Pipe Rate</th>
                                        <th style="width: 55px;">Class</th>
                                        <th style="width: 55px;">Type</th>
                                        <th>flange Weigth</th>
                                        <th>flange Rate</th>
                                        <th>Fastner</th>
                                        <th>Bolt</th>
                                        <th>Nut</th>
                                        <th>Nut/Bold Rate</th>
                                        <th>Total Rate</th>
                                        <th>Total</th>
                                        <th>Del</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr id="rowB1">
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" class="pipeid" name="itemstwo[1][pipeid]" id="pipeid1">
                                                <option selected value="">Choose...</option>
                                                <?php $__currentLoopData = $pipes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pipe): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($pipe->nbname); ?>"><?php echo e($pipe->nbname); ?> NB</option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </td>
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" class="sch" name="itemstwo[1][pipe_sch]" id="pipe_sch1">
                                                <option selected value="">Choose...</option>                                                
                                            </select>
                                        </td>
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" class="moc" name="itemstwo[1][pipe_mocvalue]" id="pipe_mocvalue1">
                                                <option selected value="">Choose...</option>
                                                <?php $__currentLoopData = $mocs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $moc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($moc->mocvalue); ?>"><?php echo e($moc->mocname); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" class="length" name="itemstwo[1][pipe_length]" id="pipe_length1"></td>
                                        <td><input type="text" style="width: 100%;" class="weight" name="itemstwo[1][pipe_weight]" id="pipe_weight1" readonly></td>
                                        <td><input type="text" style="width: 100%;" class="pipeweightrate" name="itemstwo[1][pipe_weightrate]" id="pipe_weightrate1"></td>
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" class="pclass" name="itemstwo[1][pipe_class]" id="pipe_class1">
                                                <option selected value="">Choose...</option>
                                            </select>
                                        </td>
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" class="pipetype" name="itemstwo[1][pipe_type]" id="pipe_type1">
                                                <option selected value="">Choose...</option>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="itemstwo[1][flangeweight]" id="flangeweight1"></td>
                                        <td><input type="text" style="width: 100%;" class="flangerate" name="itemstwo[1][pipe_flangerate]" id="pipe_flangerate1"></td>
                                        <td>
                                            <select style="width: 100%;padding: 2.1px;" class="fastner" name="itemstwo[1][pipe_fastner]" id="pipe_fastner1">
                                                <option selected value="">Choose...</option>
                                            </select>
                                        </td>
                                        <td><input type="text" style="width: 100%;" name="itemstwo[1][pipe_bolt]" id="pipe_bolt1"></td>
                                        <td><input type="text" style="width: 100%;" name="itemstwo[1][pipe_nut]" id="pipe_nut1"></td>
                                        <td><input type="text" style="width: 100%;" class="pipenutboltrate" name="itemstwo[1][pipe_nutboltrate]" id="pipe_nutboltrate1"></td>
                                        <td><input type="text" style="width: 100%;" class="pipetotalrate" name="itemstwo[1][pipe_totalrate]" id="pipe_totalrate1" readonly></td>
                                        <td><input type="text" style="width: 100%;" name="itemstwo[1][pipe_total]" id="pipe_total1"></td>
                                        <td><a href="javascript:void(0);" class="w-100 remove_rowtwo btn btn-danger btn-sm" data-row="1"><i class="lni lni-trash"></i></a></td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="card-footer">
                        <button type="submit" class="btn btn-primary">Submit</button>
                    </div>
                    <!--end::Footer-->
                </form>
            </div>
        </div>
    </div>
</div>
<!--end row-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<?php echo $__env->make('mainbody.onejs', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php echo $__env->make('mainbody.twojs', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php echo $__env->make('mainbody.threejs', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php echo $__env->make('mainbody.fourjs', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php echo $__env->make('mainbody.fivejs', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php echo $__env->make('mainbody.sixjs', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php echo $__env->make('mainbody.sevenjs', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<?php echo $__env->make('mainbody.mainbodyjs', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

<script>
    $(document).ready(function(){
        jQuery(".pipeid").on("change", function(){
            var pipevalue = jQuery(this).val();
            var pipeid = $(this).attr('id');
            var rowid = pipeid.replace('pipeid','');
            $.ajax({
                url:'<?php echo e(route("getsch")); ?>',
                method:'POST',
                dataType:"json",
                data: {
                    "_token": "<?php echo e(csrf_token()); ?>",
                    pipevalue:pipevalue
                },
                success:function(response){
                    // console.log(response.pipes, 'response');
                    let html = '';
                    html += '';
                    html += '<option value="">Choose...</option>';
                    $.each(response.pipes ,function(i,v){
                        html += '<option value="'+v.wgt+'">'+v.swgt+'</option>';
                    });
                    $("#pipe_sch"+rowid).html(html);

                    let htmltwo = '';
                    htmltwo += '';
                    htmltwo += '<option value="">Choose...</option>';
                    $.each(response.flanges ,function(j,w){
                        htmltwo += '<option value="'+w.fclassvalue+'">'+w.fclassvalue+' Class </option>';
                    });
                    $("#pipe_class"+rowid).html(htmltwo);
                }
            })
        })
        // ischeck type
        jQuery(".pclass").on("change", function(){
            var classvalue = jQuery(this).val();
            var classid = $(this).attr('id');
            var rowthree = classid.replace('pipe_class','');
            // nb name value
            var nb = $("#pipeid"+rowthree).val();
            
            $.ajax({
                url:'<?php echo e(route("getflange")); ?>',
                method:'POST',
                dataType:"json",
                data: {
                    "_token": "<?php echo e(csrf_token()); ?>",
                    nb:nb,
                    classvalue:classvalue
                },
                success:function(response){
                    let html = '';
                    html += '';
                    html += '<option value="">Choose...</option>';
                    html += '<option value="wnrf">WNRF</option>';
                    html += '<option value="blind">Blind</option>';
                    html += '<option value="soft">SORF</option>';
                    $("#pipe_type"+rowthree).html(html);
                }
            })
        })
        // ischeck type
        jQuery(".pipetype").on("change", function(){
            var typevalue = jQuery(this).val();
            var typeid = $(this).attr('id');
            var rowfour = typeid.replace('pipe_type','');
            // nb name value
            var nb = $("#pipeid"+rowfour).val();
            var classvalue = $("#pipe_class"+rowfour).val();
                        
            $.ajax({
                url:'<?php echo e(route("getflange/weight")); ?>',
                method:'POST',
                dataType:"json",
                data: {
                    "_token": "<?php echo e(csrf_token()); ?>",
                    nbvalue:nb,
                    classvalue:classvalue,
                    typevalue:typevalue
                },
                success:function(responses){
                    $.each(responses ,function(response,x){
                        var flangeweight = $("#flangeweight"+rowfour).val(x.value);
                    });
                    
                    let htmlfour = '';
                    htmlfour += '';
                    htmlfour += '<option value="">Choose...</option>';
                    htmlfour += '<option value="stud">Stud</option>';
                    htmlfour += '<option value="machine">Machine</option>';
                    $("#pipe_fastner"+rowfour).html(htmlfour);
                }
            })
        })
        // ischeck fastner
        jQuery(".fastner").on("change", function(){
            var fastnervalue = jQuery(this).val();
            var fastnerid = $(this).attr('id');
            var rowfive = fastnerid.replace('pipe_fastner','');
            // nb name value
            var nb = $("#pipeid"+rowfive).val();
            var classvalue = $("#pipe_class"+rowfive).val();
            var typevalue = $("#pipe_type"+rowfive).val();
                        
            $.ajax({
                url:'<?php echo e(route("getflange/fastner")); ?>',
                method:'POST',
                dataType:"json",
                data: {
                    "_token": "<?php echo e(csrf_token()); ?>",
                    nbvalue:nb,
                    classvalue:classvalue,
                    typevalue:typevalue,
                    fastnervalue:fastnervalue
                },
                success:function(response){
                    $.each(response, function(index, item) {
                        // 150 stud
                        if (item.fcategoryid == 7) {
                            $("#pipe_bolt" + rowfive).val(item.value);
                        } else if (item.fcategoryid == 8) {
                            $("#pipe_nut" + rowfive).val(item.value);
                        }
                        // 150 machine
                        if (item.fcategoryid == 10) {
                            $("#pipe_bolt" + rowfive).val(item.value);
                        } else if (item.fcategoryid == 11) {
                            $("#pipe_nut" + rowfive).val(item.value);
                        }
                        // 300 stud
                        if (item.fcategoryid == 21) {
                            $("#pipe_bolt" + rowfive).val(item.value);
                        } else if (item.fcategoryid == 22) {
                            $("#pipe_nut" + rowfive).val(item.value);
                        }
                        // 300 machine
                        if (item.fcategoryid == 24) {
                            $("#pipe_bolt" + rowfive).val(item.value);
                        } else if (item.fcategoryid == 25) {
                            $("#pipe_nut" + rowfive).val(item.value);
                        }
                    });

                    var pipeweight = $("#pipe_weight"+rowfive).val();
                    var flangeweight = $("#flangeweight"+rowfive).val();
                    var pipebolt = $("#pipe_bolt"+rowfive).val();
                    var pipenut = $("#pipe_nut"+rowfive).val();
                    let totalcal = parseFloat(pipeweight)+parseFloat(flangeweight)+parseFloat(pipebolt)+parseFloat(pipenut);
                    let total = $("#pipe_total"+rowfive).val(totalcal);
                    // console.log('total', totalcal);
                }
            })            
        })
        // keyup length get calculate weight
        jQuery(".length").on("keyup", function(){
            var lengthvalue = jQuery(this).val();
            var lengthid = $(this).attr('id');
            var lrowid = lengthid.replace('pipe_length','');
            // get SCH value
            var schvalue = $("#pipe_sch"+lrowid).val();
            // get MOC value
            var mocvalue = $("#pipe_mocvalue"+lrowid).val();
            var calfirst =  schvalue*mocvalue/8000;
            // calculate with length value
            var calsecond = lengthvalue*calfirst/1000; 
            var weight = $("#pipe_weight"+lrowid).val(calsecond);
        })
        // select sch get calculate weight
        jQuery(".sch").on("change", function(){
            var schvalue = jQuery(this).val();
            var schid = $(this).attr('id');
            var lrowid = schid.replace('pipe_sch','');
            // get length value
            var lengthvalue = $("#pipe_length"+lrowid).val();
            // get MOC value
            var mocvalue = $("#pipe_mocvalue"+lrowid).val();
            var calfirst =  schvalue*mocvalue/8000;
            // calculate with length value
            var calsecond = lengthvalue*calfirst/1000; 
            var weight = $("#pipe_weight"+lrowid).val(calsecond);
        })
        // select moc get calculate weight
        jQuery(".moc").on("change", function(){
            var mocvalue = jQuery(this).val();
            var mocid = $(this).attr('id');
            var lrowid = mocid.replace('pipe_mocvalue','');
            // get length value
            var lengthvalue = $("#pipe_length"+lrowid).val();
            // get sch value
            var schvalue = $("#pipe_sch"+lrowid).val();
            var calfirst =  schvalue*mocvalue/8000;
            // calculate with length value
            var calsecond = lengthvalue*calfirst/1000; 
            var weight = $("#pipe_weight"+lrowid).val(calsecond);
        });
        // input pipe rate keyup
        jQuery(".pipeweightrate").on("keyup", function(){
            var pratevalue = jQuery(this).val();
            var prateid = $(this).attr('id');
            var pid = prateid.replace('pipe_weightrate','');

            var totalrate = $("#pipe_totalrate"+pid).val(pratevalue);
        });
        // input flange rate keyup
        jQuery(".flangerate").on("keyup", function(){
            var flangerate = jQuery(this).val();
            var flangeid = $(this).attr('id');
            var flangeid = flangeid.replace('pipe_flangerate','');
            // console.log('prate',pratevalue);
            var prate = $("#pipe_weightrate"+flangeid).val();
            var fcal = parseFloat(prate) + parseFloat(flangerate);
            var totalrate = $("#pipe_totalrate"+flangeid).val(fcal);
        });
        // input nut bolt rate keyup
        jQuery(".pipenutboltrate").on("keyup", function(){
            var nbrate = jQuery(this).val();
            var nutboltid = $(this).attr('id');
            var nbid = nutboltid.replace('pipe_nutboltrate','');
            var prate = $("#pipe_weightrate"+nbid).val();
            var flangerate = $("#pipe_flangerate"+nbid).val();
            var fcal = parseFloat(prate) + parseFloat(flangerate) + parseFloat(nbrate);
            var totalrate = $("#pipe_totalrate"+nbid).val(fcal);
        });
    })
</script>


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

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/ubmomanc/public_html/yugum.ubmoman.com/resources/views/mainbody/create.blade.php ENDPATH**/ ?>