I got 'CSRF token mismatch' error in console.
it works when i disabled the CSRF in laravel. but how to make it work when the CSRF enabled ?
this my route with post method
'Route::post('/sales/stock_free', 'StatusUnitSalesController@stock_free')->name('su_sales.stock_free');'
and this is my drilldown code
DrillDown::create(array(
"name"=>"hondaDrillDown",
"title"=>"Laporan Stock Free",
"scope" => array(
"_token" => csrf_token(),
),
"levels"=>array(
array(
"title"=>"Tipe Mobil",
"content"=>function($params,$scope)
{
Table::create(array(
"dataSource"=>(
$this->src("pgsql")->query("
SELECT a.nama_tipe AS tipe, COUNT(a.qty) AS stok,
(COUNT(CASE WHEN a.status='STOCK FREE' THEN 1 END) -
(SELECT COUNT(CASE WHEN statusspk='SPK Taking' THEN 1 END) -
COUNT(CASE WHEN statusspk='SPK DO' THEN 1 END)
FROM data_spk ds
WHERE ds.tipe = a.nama_tipe)) AS gap,
(SELECT COUNT (CASE WHEN statusspk='SPK Taking' THEN 1 END) -
COUNT(CASE WHEN statusspk='SPK DO' THEN 1 END) AS spk
FROM data_spk WHERE tipe = a.nama_tipe)
FROM inventory_stock_sales a
WHERE status='STOCK FREE'
GROUP BY tipe
ORDER BY tipe
")
),
"columns"=>array(
"tipe"=>array(
"type"=>"string",
"label"=>"Type"
),
"stok"=>array(
"label"=>"Free Stock"
),
"spk"=>array(
"label"=>"o/s SPK"
),
"gap"=>array(
"label"=>"Gap"
),
),
"clientEvents"=>array(
"rowClick"=>"function(params){
hondaDrillDown.next({tipe:params.rowData[0]});
}",
)
));
}
),
array(
"title"=>function($params,$scope)
{
return "Model ".$params["tipe"];
},
"content"=>function($params,$scope)
{
Table::create(array(
"dataSource"=>(
$this->src("pgsql")->query("
SELECT nama_tipe as tipe, nama_warna as warna, max(status) as status, count(qty) as stok
FROM inventory_stock_sales
WHERE status='STOCK FREE' and nama_tipe=:tipe
GROUP BY tipe, warna
ORDER BY tipe
")
->params(array(
":tipe"=>$params["tipe"]
))
)
,
"columns"=>array(
"warna"=>array(
"type"=>"string",
"label"=>"Warna Mobil"
),
"stok"=>array(
"label"=>"Free Stock"
),
),
"clientEvents"=>array(
"itemSelect"=>"function(params){
hondaDrillDown.next({month:params.selectedRow[0]});
}",
)
));
}
),
),
));