/
home
/
sjslayjy
/
public_html
/
tabson_test
/
storage
/
framework
/
views
/
Upload File
HOME
<?php $__env->startSection('content'); ?> <div class="container"> <h2>BOM Management</h2> <form id="bomForm"> <div class="form-group"> <label for="product_id">Product</label> <select name="product_id" id="product_id" class="form-control" required> <option value="">Select Product</option> <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($product->id); ?>"><?php echo e($product->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> <div class="form-group"> <label for="item_id">Item</label> <select name="item_id" id="item_id" class="form-control" required> <option value="">Select Item</option> <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($item->id); ?>"><?php echo e($item->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> <div class="form-group"> <label for="quantity">Quantity</label> <input type="number" name="quantity" id="quantity" class="form-control" required min="0"> </div> <button type="submit" class="btn btn-primary">Add BOM Item</button> </form> <h3>BOM Items</h3> <table class="table"> <thead> <tr> <th>Product</th> <th>Item</th> <th>Quantity</th> <th>Actions</th> </tr> </thead> <tbody id="bomItemsList"> <!-- BOM items will be loaded here --> </tbody> </table> </div> <script> $(document).ready(function() { $('#bomForm').on('submit', function(e) { e.preventDefault(); $.ajax({ url: '/user/add-bom-item', method: 'POST', data: $(this).serialize(), success: function(response) { if (response.flag) { alert(response.message); loadBomItems(); } else { alert(response.error); } } }); }); function loadBomItems() { $.ajax({ url: '/user/get-bom-items', method: 'POST', data: { product_id: $('#product_id').val() }, success: function(response) { let html = ''; response.forEach(function(item) { html += `<tr> <td>${item.name}</td> <td>${item.code}</td> <td>${item.bom_quantity}</td> <td> <button class="btn btn-sm btn-warning" onclick="editBomItem(${item.id})">Edit</button> <button class="btn btn-sm btn-danger" onclick="deleteBomItem(${item.id})">Delete</button> </td> </tr>`; }); $('#bomItemsList').html(html); } }); } $('#product_id').change(function() { loadBomItems(); }); }); function editBomItem(id) { // Implement edit functionality } function deleteBomItem(id) { if (confirm('Are you sure you want to delete this BOM item?')) { $.ajax({ url: `/user/delete-bom-item/${id}`, method: 'GET', success: function(response) { if (response.flag) { alert(response.message); loadBomItems(); } else { alert(response.message); } } }); } } </script> <?php $__env->stopSection(); ?> <?php echo $__env->make('dashboard.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/sjslayjy/public_html/tabson/resources/views/dashboard/bom/index.blade.php ENDPATH**/ ?>