i'm new to Laravel and coding
i have a page that contain tabs and each tab has a table
[as you can see in the picture][1]
the active tab has a table and when i click on a row a sweetalert popup appear for a confirmation of the row selected, when i click the confirm button another popup sweetalert appear and ask the user to write truck number
what i want to do is: [picture 2][2]
1- do a condition to the input of sweetalert (the form of truck number "XXX TU YYYY"
2- save the input into the database [enter image description here][3]
3- when you finish this the row selected will go from that tab and goes to the next tab
the DB name: PFE
the table name: fournisseursjour
here's the code of the 2 popup msg in the blade:
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script>
$(document).ready(function(){
$('.servipopupmsg').click(function(e){
var namefourn = $(this).find(".namefourn").text( );
e.preventDefault();
swal("are you sure you want to continue with "+namefourn+"? ", {
buttons: ["Cancel ", "confirm "],
}).then((result) => {
if( result){
console.log("User confirmed!" );
swal("Taper Matricule Camion:", {
content: "input",
})
.then((value) => {
console.log("Value to check for valid matricule: "+ value );
});
}else{
console.log( "User Not confirmed!" );
}
})
})
});
</script>
the code of the controller:
<?php
namespace App\Http\Controllers;
use DB;
use Illuminate\Http\Request;
use App\User;
use App\Http\Controllers\Controller;
class FournisseursController extends Controller
{
public function fournisseurP(){
$data['data']=DB::table('fournisseursjour')->where('FCY_0', 'BAR')->get();
if(count($data) > 0){
return view('LogBook.FournisseurAziza', $data);
}else{
return view('LogBook.FournisseurAziza');
}
}
}
the route:
Route::get('/FournisseurAziza','FournisseursController@fournisseurP');
please help [1]: https://i.stack.imgur.com/bTxzm.png [2]: https://i.stack.imgur.com/gnre6.png [3]: https://i.stack.imgur.com/CsD21.png