Click here to Skip to main content
15,849,785 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Does anyone knows about Laravel inventory management system? I am sharing one link of video. Please check https://youtu.be/1rOVrp2HgWA?si=qxOdMSGnKiBpOhza.
In this link when you move forward at time 10 minutes, he approves products. I do not know how to do that. Can anyone tell me please. The thing which I understand that he is not passing any ID and use jquery.

What I have tried:

This is my listing:
PHP
@extends('layouts.home')
@section('content')
<div class="content-wrapper">
<div class="card">
              <div class="card-header">
                <h3 class="card-title">DataTable with default features</h3>                
              </div>
              <!-- /.card-header -->
              <div class="card-body">            
              <div class="table-responsive">
                
                <table id="example1" 
                class="table table-bordered table-striped">
                  <thead>
                  <tr>               
      <th scope="col">Sr.N0</th>
      <th scope="col">Product Name</th>     
      <th scope="col">Catagory Name</th>
      <th scope="col">Supplier Name</th>
      <th scope="col">Purchase Date</th>  
       <th scope="col">PO NO</th>
       <th scope="col">QTY</th>
       <th scope="col">Status</th>
       <th scope="col">Action</th>
                  </tr>
                  </thead>
                  <tbody>  
                  @php($sr=0)
                  @foreach ( $request as $item)
                  @php($sr++)
 <tr > 
 <td>{{$sr}}</td>
   <td>{{$item->product_name}}</td>  
   <td>{{$item->name}}</td>
   <td>{{$item->sup_name}}</td>  
   <td>{{$item->purchase_product_date}}</td>
   <td>{{$item->productno}}</td>
   <td>{{$item->quantity}}</td>
   <td><a  href="" class="badge badge-success rounded-pill">{{$item->status}}</a></td>
   <td>   
    <a href="{{route('purchaseproductlist')}} " class="btn btn-primary delete-confirm">Action</a>
    
</td>
 </tr>
@endforeach
 </table>
                 </div>
</div>
              <!-- /.card-body -->
            </div>    
           
</div>
<script type="text/javascript">
  $('.delete-confirm').on('click', function (e) {
      e.preventDefault();
      const url = $(this).attr('href');
  //alert(url)
      swal({
          title: 'Are you sure?',
          text: 'You want to approve it!',
          icon: 'warning',
          buttons: ["cancel!","Approve it"],
      }).then(function(approve) {
          if (approve) {
            swal({
  title: "Approved",
  icon: "success",
  timer: 4000
});
         ///   $('#myTableRow').remove();
              window.location.href = url;
               
          }
    else {
  swal("Your  file is not updated!");
}
      });
  });

</script>
@endsection
           Here is controlller
<pre> function product_list(Request $request){
     
         $request=DB::table('product_purchase_orders')
        ->join('products','products.productid','=',
                  'product_purchase_orders.product_id')
         - 
 >join('catagories','catagories.catagoriesid','=',
          'product_purchase_orders.catid')
     ->join('suppliers','suppliers.supplierid','=',
               'product_purchase_orders.supid') 
      ->join('product_purchases','product_purchases.id','=',
                'product_purchase_orders.prod_puechase_id')      
->select('product_purchase_orders.id','product_purchases.id',
            'products.product_name','catagories.name',
            'suppliers.name as sup_name',
            'product_purchases.purchase_product_date',
            'product_purchases.productno',
            'product_purchase_orders.quantity','product_purchases.status')
        // ->where('suppliers.supplierid','=','product_purchases.supplier')
          
         ->get();
        // return $request;
        // $id=$request->id;
        // return $id;
         return view('Purchase.Purchase_product_listing',['request'=>$request]);
    
}
function approve_list(Request $request){
   
   $request=DB::table('product_purchase_orders')
  ->join('products','products.productid','=',
            'product_purchase_orders.product_id')
   ->join('catagories','catagories.catagoriesid','=',
             'product_purchase_orders.catid')
->join('suppliers','suppliers.supplierid','=',
          'product_purchase_orders.supid') 
->join('product_purchases','product_purchases.id','=',
          'product_purchase_orders.prod_puechase_id')      
->select('product_purchase_orders.id',
            'products.product_name',
            'product_purchase_orders.product_id',
            'catagories.name','suppliers.name as sup_name',
            'product_purchases.purchase_product_date',
            'product_purchases.productno',
            'product_purchase_orders.quantity',
            'product_purchases.status')
  // ->where('suppliers.supplierid','=','product_purchases.supplier')
    
   ->get();
  // return $request;
  // $id=$request->productid;
  //  return $id;
   return view('Purchase.Approve_product_listing',['request'=>$request]);

Here is web.php:
Python
All purchase Products
--------------------------------------------*/
Route::get('/addPurchaseProduct',[PurchaseProductController::class,"PurchaseProduct"])->name('productpurchase');
Route::get('/gert_catagory',[PurchaseProductController::class,"Getcatagory"])->name('get.catagory');
Route::get('/gert_product',[PurchaseProductController::class,"Getproduct"])->name('get.productname');
Route::post('/insert_product_purchase',[PurchaseProductController::class,"insertproduct"])->name('addproductpurchase');
Route::get('/get_approve',[PurchaseProductController::class,"product_list"])->name('purchaseproductlist');
// Route::get('/get_approve/{product_id}',[PurchaseProductController::class,"product_list_approve"])->name('purchaseproduct_approvelist');
Route::get('/approve_products',[PurchaseProductController::class,"approve_list"])->name('approve_productlist');

/*
}
Posted
Updated 2-Oct-23 3:37am
v2
Comments
Richard Deeming 29-Sep-23 7:27am    
YouTube videos have a "comments" section. Use that to ask the author of the video to explain his code.
KHAN WEB DEVELOPER 29-Sep-23 7:29am    
I have asked longtime ago but he did not reply
Richard Deeming 29-Sep-23 7:31am    
Then find a better source of learning. Most YT tutorials are utter rubbish published by people who don't know what they're doing just to get views.

1 solution

Quote:
Richard Deeming
:
YouTube videos have a "comments" section. Use that to ask the author of the video to explain his code.
This is absolutely the best advice we can give you with other people's code.
Quote:
KHAN WEB DEVELOPER
:
I have asked longtime ago but he did not reply
That should tell you something about his quality and commitment.
The problem is that most YouTube coding tutorials are produced by people who have no idea how to make a video, no idea how to teach and more often than not no idea how to code either. They have code that works - maybe - but no idea how it works.
YouTube videos are about Likes and Subscribes: because they give you money if you get enough of them. So if you need help and don;t get a reply, it's a damn good sign of incompetence on the part of the producer, and a good sign that the code he shows doesn't actually work, or isn't complete - and never has been!

So if you get a problem with a YouTube video, comment - and if you don't get a reply, throw it in the bin and find a better one. Nobody here is going to wade through cr@p to fix bad code for you!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900