Compare commits
4 Commits
0217c1c947
...
36ec099cd9
| Author | SHA1 | Date | |
|---|---|---|---|
| 36ec099cd9 | |||
| c7e0b57ad6 | |||
| a101b55279 | |||
| c075457053 |
210
app/Http/Controllers/ConfDistributionController.php
Normal file
210
app/Http/Controllers/ConfDistributionController.php
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Validator;
|
||||||
|
use Hidehalo\Nanoid\Client as Nanoid;
|
||||||
|
use Hidehalo\Nanoid\GeneratorInterface as NanoidInterface;
|
||||||
|
use App\Responses;
|
||||||
|
use App\Helper;
|
||||||
|
use App\Models\ConfRates;
|
||||||
|
use App\Models\ConfTruckTypes;
|
||||||
|
use App\Models\Vehicles;
|
||||||
|
|
||||||
|
class ConfDistributionController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function view_distribution_category(Request $req)
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
return view("menu_v1.configs.distribution_category", $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function api_add_distribution_category(Request $req)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$now = time();
|
||||||
|
// new or edit
|
||||||
|
$tipe = $req->tipe ?? "new";
|
||||||
|
|
||||||
|
$input = [
|
||||||
|
"dc_code" => $req->dc_code,
|
||||||
|
"dc_name" => $req->dc_name,
|
||||||
|
];
|
||||||
|
$rulesInput = [
|
||||||
|
"dc_code" => "required|string|max:10",
|
||||||
|
"dc_name" => "required|string|max:100",
|
||||||
|
];
|
||||||
|
|
||||||
|
// validasi input
|
||||||
|
$isValidInput = Validator::make($input, $rulesInput);
|
||||||
|
if (!$isValidInput->passes()) {
|
||||||
|
$apiResp = Responses::bad_input($isValidInput->messages()->first());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($tipe == "new"){
|
||||||
|
$uniqCode = DB::select("SELECT * FROM t_conf_distribution_category WHERE dc_code = ?", [$req->dc_code]);
|
||||||
|
}
|
||||||
|
if($tipe == "edit"){
|
||||||
|
$uniqCode = DB::select("SELECT * FROM t_conf_distribution_category WHERE dc_code = ? AND id != ?", [$req->dc_code, $req->id]);
|
||||||
|
}
|
||||||
|
if (count($uniqCode) > 0) {
|
||||||
|
$apiResp = Responses::bad_request("type code has been used");
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
$insD = [
|
||||||
|
"dc_code" => $req->dc_code,
|
||||||
|
"dc_name" => $req->dc_name,
|
||||||
|
"crt" => $now,
|
||||||
|
"crt_by" => $req->auth->uid,
|
||||||
|
"updt" => $now,
|
||||||
|
"updt_by" => $req->auth->uid,
|
||||||
|
];
|
||||||
|
// $insQ = DB::insert("INSERT
|
||||||
|
// INTO t_conf_distribution_category (dc_code, dc_name, crt, crt_by, updt, updt_by)
|
||||||
|
// VALUES (?, ?, ?, ?, ?, ?)
|
||||||
|
// ", array_values($insD));
|
||||||
|
$insQ = DB::insert("INSERT into t_conf_distribution_category set
|
||||||
|
dc_code = ?,
|
||||||
|
dc_name = ?,
|
||||||
|
crt = ?,
|
||||||
|
crt_by = ?,
|
||||||
|
updt = ?,
|
||||||
|
updt_by = ?
|
||||||
|
on duplicate key update
|
||||||
|
dc_code = values(dc_code),
|
||||||
|
dc_name = values(dc_name),
|
||||||
|
updt = values(updt),
|
||||||
|
updt_by = values(updt_by)
|
||||||
|
", array_values($insD));
|
||||||
|
|
||||||
|
|
||||||
|
$apiResp = Responses::created("success " . ($tipe == "new" ? "add new" : "edit") . " distribution category");
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
$apiResp = Responses::error($e->getMessage());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function api_list_distribution_category(Request $req)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$now = time();
|
||||||
|
|
||||||
|
$list = DB::select("SELECT * FROM t_conf_distribution_category WHERE dlt IS NULL ORDER BY dc_code ASC");
|
||||||
|
foreach ($list as $key => $row) {
|
||||||
|
$list[$key]->DT_RowIndex = $key + 1;
|
||||||
|
$list[$key]->action = "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
$apiResp = Responses::success("success list distribution category");
|
||||||
|
$apiResp["count"] = count($list);
|
||||||
|
$apiResp["data"] = $list;
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$apiResp = Responses::error($e->getMessage());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function api_show_distribution_category(Request $req, $id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$input = [
|
||||||
|
"id" => $id,
|
||||||
|
];
|
||||||
|
$rulesInput = [
|
||||||
|
"id" => "required|integer|not_in:0",
|
||||||
|
];
|
||||||
|
|
||||||
|
// validasi input
|
||||||
|
$isValidInput = Validator::make($input, $rulesInput);
|
||||||
|
if (!$isValidInput->passes()) {
|
||||||
|
$apiResp = Responses::bad_input($isValidInput->messages()->first());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$dtl = DB::select("SELECT * FROM t_conf_distribution_category WHERE id = ? AND dlt IS NULL limit 1", [$id]);
|
||||||
|
if (count($dtl) < 1) {
|
||||||
|
$apiResp = Responses::not_found("truck type not found");
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$apiResp = Responses::success("success get detail vehicle type");
|
||||||
|
$apiResp["data"] = $dtl[0];
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$apiResp = Responses::error($e->getMessage());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function api_del_distribution_category(Request $req, $id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$now = time();
|
||||||
|
|
||||||
|
$input = [
|
||||||
|
"id" => $id,
|
||||||
|
];
|
||||||
|
$rulesInput = [
|
||||||
|
"id" => "required|integer|not_in:0",
|
||||||
|
];
|
||||||
|
|
||||||
|
// validasi input
|
||||||
|
$isValidInput = Validator::make($input, $rulesInput);
|
||||||
|
if (!$isValidInput->passes()) {
|
||||||
|
$apiResp = Responses::bad_input($isValidInput->messages()->first());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$dtl = DB::select("SELECT * FROM t_conf_distribution_category WHERE id = ? AND dlt IS NULL limit 1", [$id]);
|
||||||
|
if (count($dtl) < 1) {
|
||||||
|
$apiResp = Responses::not_found("vehicle type not found");
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
$updtQ = DB::update("UPDATE t_conf_distribution_category
|
||||||
|
SET
|
||||||
|
dlt = ?,
|
||||||
|
dlt_by = ?,
|
||||||
|
updt = ?,
|
||||||
|
updt_by = ?
|
||||||
|
WHERE id = ? AND dlt IS NULL
|
||||||
|
", [1, $req->user()->id, $now, $req->user()->id, $id]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
$apiResp = Responses::success("success delete vehicle type");
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
$apiResp = Responses::error($e->getMessage());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
210
app/Http/Controllers/ConfPoolController.php
Normal file
210
app/Http/Controllers/ConfPoolController.php
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Validator;
|
||||||
|
use Hidehalo\Nanoid\Client as Nanoid;
|
||||||
|
use Hidehalo\Nanoid\GeneratorInterface as NanoidInterface;
|
||||||
|
use App\Responses;
|
||||||
|
use App\Helper;
|
||||||
|
use App\Models\ConfRates;
|
||||||
|
use App\Models\ConfTruckTypes;
|
||||||
|
use App\Models\Vehicles;
|
||||||
|
|
||||||
|
class ConfPoolController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function view_pool(Request $req)
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
return view("menu_v1.configs.pool", $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function api_add_pool(Request $req)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$now = time();
|
||||||
|
// new or edit
|
||||||
|
$tipe = $req->tipe ?? "new";
|
||||||
|
|
||||||
|
$input = [
|
||||||
|
"pool_code" => $req->pool_code,
|
||||||
|
"pool_name" => $req->pool_name,
|
||||||
|
];
|
||||||
|
$rulesInput = [
|
||||||
|
"pool_code" => "required|string|max:10",
|
||||||
|
"pool_name" => "required|string|max:100",
|
||||||
|
];
|
||||||
|
|
||||||
|
// validasi input
|
||||||
|
$isValidInput = Validator::make($input, $rulesInput);
|
||||||
|
if (!$isValidInput->passes()) {
|
||||||
|
$apiResp = Responses::bad_input($isValidInput->messages()->first());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($tipe == "new"){
|
||||||
|
$uniqCode = DB::select("SELECT * FROM t_conf_pool WHERE pool_code = ?", [$req->pool_code]);
|
||||||
|
}
|
||||||
|
if($tipe == "edit"){
|
||||||
|
$uniqCode = DB::select("SELECT * FROM t_conf_pool WHERE pool_code = ? AND id != ?", [$req->pool_code, $req->id]);
|
||||||
|
}
|
||||||
|
if (count($uniqCode) > 0) {
|
||||||
|
$apiResp = Responses::bad_request("type code has been used");
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
$insD = [
|
||||||
|
"pool_code" => $req->pool_code,
|
||||||
|
"pool_name" => $req->pool_name,
|
||||||
|
"crt" => $now,
|
||||||
|
"crt_by" => $req->auth->uid,
|
||||||
|
"updt" => $now,
|
||||||
|
"updt_by" => $req->auth->uid,
|
||||||
|
];
|
||||||
|
// $insQ = DB::insert("INSERT
|
||||||
|
// INTO t_conf_pool (pool_code, pool_name, crt, crt_by, updt, updt_by)
|
||||||
|
// VALUES (?, ?, ?, ?, ?, ?)
|
||||||
|
// ", array_values($insD));
|
||||||
|
$insQ = DB::insert("INSERT into t_conf_pool set
|
||||||
|
pool_code = ?,
|
||||||
|
pool_name = ?,
|
||||||
|
crt = ?,
|
||||||
|
crt_by = ?,
|
||||||
|
updt = ?,
|
||||||
|
updt_by = ?
|
||||||
|
on duplicate key update
|
||||||
|
pool_code = values(pool_code),
|
||||||
|
pool_name = values(pool_name),
|
||||||
|
updt = values(updt),
|
||||||
|
updt_by = values(updt_by)
|
||||||
|
", array_values($insD));
|
||||||
|
|
||||||
|
|
||||||
|
$apiResp = Responses::created("success " . ($tipe == "new" ? "add new" : "edit") . " distribution category");
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
$apiResp = Responses::error($e->getMessage());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function api_list_pool(Request $req)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$now = time();
|
||||||
|
|
||||||
|
$list = DB::select("SELECT * FROM t_conf_pool WHERE dlt IS NULL ORDER BY pool_code ASC");
|
||||||
|
foreach ($list as $key => $row) {
|
||||||
|
$list[$key]->DT_RowIndex = $key + 1;
|
||||||
|
$list[$key]->action = "-";
|
||||||
|
}
|
||||||
|
|
||||||
|
$apiResp = Responses::success("success list distribution category");
|
||||||
|
$apiResp["count"] = count($list);
|
||||||
|
$apiResp["data"] = $list;
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$apiResp = Responses::error($e->getMessage());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function api_show_pool(Request $req, $id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$input = [
|
||||||
|
"id" => $id,
|
||||||
|
];
|
||||||
|
$rulesInput = [
|
||||||
|
"id" => "required|integer|not_in:0",
|
||||||
|
];
|
||||||
|
|
||||||
|
// validasi input
|
||||||
|
$isValidInput = Validator::make($input, $rulesInput);
|
||||||
|
if (!$isValidInput->passes()) {
|
||||||
|
$apiResp = Responses::bad_input($isValidInput->messages()->first());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$dtl = DB::select("SELECT * FROM t_conf_pool WHERE id = ? AND dlt IS NULL limit 1", [$id]);
|
||||||
|
if (count($dtl) < 1) {
|
||||||
|
$apiResp = Responses::not_found("truck type not found");
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$apiResp = Responses::success("success get detail vehicle type");
|
||||||
|
$apiResp["data"] = $dtl[0];
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$apiResp = Responses::error($e->getMessage());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function api_del_pool(Request $req, $id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$now = time();
|
||||||
|
|
||||||
|
$input = [
|
||||||
|
"id" => $id,
|
||||||
|
];
|
||||||
|
$rulesInput = [
|
||||||
|
"id" => "required|integer|not_in:0",
|
||||||
|
];
|
||||||
|
|
||||||
|
// validasi input
|
||||||
|
$isValidInput = Validator::make($input, $rulesInput);
|
||||||
|
if (!$isValidInput->passes()) {
|
||||||
|
$apiResp = Responses::bad_input($isValidInput->messages()->first());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$dtl = DB::select("SELECT * FROM t_conf_pool WHERE id = ? AND dlt IS NULL limit 1", [$id]);
|
||||||
|
if (count($dtl) < 1) {
|
||||||
|
$apiResp = Responses::not_found("vehicle type not found");
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
$updtQ = DB::update("UPDATE t_conf_pool
|
||||||
|
SET
|
||||||
|
dlt = ?,
|
||||||
|
dlt_by = ?,
|
||||||
|
updt = ?,
|
||||||
|
updt_by = ?
|
||||||
|
WHERE id = ? AND dlt IS NULL
|
||||||
|
", [1, $req->user()->id, $now, $req->user()->id, $id]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
$apiResp = Responses::success("success delete vehicle type");
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
$apiResp = Responses::error($e->getMessage());
|
||||||
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -61,7 +61,10 @@ class MenuController extends Controller
|
|||||||
|
|
||||||
public function view_vehicles(Request $req)
|
public function view_vehicles(Request $req)
|
||||||
{
|
{
|
||||||
$data = [
|
$listPool = DB::select("SELECT * FROM t_conf_pool WHERE dlt IS NULL ORDER BY pool_code ASC");
|
||||||
|
$listDistribution = DB::select("SELECT * FROM t_conf_distribution_category WHERE dlt IS NULL ORDER BY dc_code ASC");
|
||||||
|
|
||||||
|
$data = [
|
||||||
// 'cats' => Vehicles::listCats(), // default Truck
|
// 'cats' => Vehicles::listCats(), // default Truck
|
||||||
"brands" => Vehicles::listBrands(),
|
"brands" => Vehicles::listBrands(),
|
||||||
"types" => Vehicles::listTypes(),
|
"types" => Vehicles::listTypes(),
|
||||||
@ -73,6 +76,8 @@ class MenuController extends Controller
|
|||||||
"is_idle_yes" => 1,
|
"is_idle_yes" => 1,
|
||||||
"is_available" => Devices::IS_AVAIL,
|
"is_available" => Devices::IS_AVAIL,
|
||||||
]),
|
]),
|
||||||
|
"listPool" => $listPool,
|
||||||
|
"listDistribution" => $listDistribution
|
||||||
];
|
];
|
||||||
// dd($data);
|
// dd($data);
|
||||||
return view("menu_v1.vehicles", $data);
|
return view("menu_v1.vehicles", $data);
|
||||||
|
|||||||
@ -173,6 +173,7 @@ class UsersController extends Controller
|
|||||||
"bank_acc_number" => $req->bank_acc_number,
|
"bank_acc_number" => $req->bank_acc_number,
|
||||||
"bank_acc_name" => $req->bank_acc_name,
|
"bank_acc_name" => $req->bank_acc_name,
|
||||||
"status" => $req->status,
|
"status" => $req->status,
|
||||||
|
"status_sms" => $req->status_sms,
|
||||||
"is_tracking" => $req->is_tracking,
|
"is_tracking" => $req->is_tracking,
|
||||||
"vehicles" => $req->vehicles,
|
"vehicles" => $req->vehicles,
|
||||||
"is_vdr_bcng" => $req->is_vdr_bcng,
|
"is_vdr_bcng" => $req->is_vdr_bcng,
|
||||||
@ -195,6 +196,7 @@ class UsersController extends Controller
|
|||||||
"bank_acc_number" => "nullable|numeric",
|
"bank_acc_number" => "nullable|numeric",
|
||||||
"bank_acc_name" => "nullable|string|max:255",
|
"bank_acc_name" => "nullable|string|max:255",
|
||||||
"status" => "required|integer|not_in:0",
|
"status" => "required|integer|not_in:0",
|
||||||
|
"status_sms" => "required|integer",
|
||||||
"is_tracking" => "nullable|numeric",
|
"is_tracking" => "nullable|numeric",
|
||||||
"vehicles" => "nullable|array",
|
"vehicles" => "nullable|array",
|
||||||
"is_vdr_bcng" => "nullable|numeric",
|
"is_vdr_bcng" => "nullable|numeric",
|
||||||
@ -294,6 +296,7 @@ class UsersController extends Controller
|
|||||||
"crt_by" => $req->auth->uid,
|
"crt_by" => $req->auth->uid,
|
||||||
"updt" => $now,
|
"updt" => $now,
|
||||||
"updt_by" => $req->auth->uid,
|
"updt_by" => $req->auth->uid,
|
||||||
|
"status_sms" => $req->status_sms,
|
||||||
];
|
];
|
||||||
if ($req->roles == Users::ROLE_CHECKER) {
|
if ($req->roles == Users::ROLE_CHECKER) {
|
||||||
// $data['chk_type'] = $req->chk_type;
|
// $data['chk_type'] = $req->chk_type;
|
||||||
@ -352,6 +355,7 @@ class UsersController extends Controller
|
|||||||
"bank_acc_number" => $req->bank_acc_number,
|
"bank_acc_number" => $req->bank_acc_number,
|
||||||
"bank_acc_name" => $req->bank_acc_name,
|
"bank_acc_name" => $req->bank_acc_name,
|
||||||
"is_vdr_bcng" => $req->is_vdr_bcng,
|
"is_vdr_bcng" => $req->is_vdr_bcng,
|
||||||
|
"status_sms" => $req->status_sms,
|
||||||
];
|
];
|
||||||
$rulesInput = [
|
$rulesInput = [
|
||||||
"uid" => "required|integer|not_in:0",
|
"uid" => "required|integer|not_in:0",
|
||||||
@ -365,6 +369,7 @@ class UsersController extends Controller
|
|||||||
"bank_acc_number" => "nullable|numeric",
|
"bank_acc_number" => "nullable|numeric",
|
||||||
"bank_acc_name" => "nullable|string|max:255",
|
"bank_acc_name" => "nullable|string|max:255",
|
||||||
"is_vdr_bcng" => "nullable|numeric",
|
"is_vdr_bcng" => "nullable|numeric",
|
||||||
|
"status_sms" => "required|integer",
|
||||||
];
|
];
|
||||||
$data = [
|
$data = [
|
||||||
"id" => $req->uid,
|
"id" => $req->uid,
|
||||||
@ -440,6 +445,7 @@ class UsersController extends Controller
|
|||||||
return new Response($apiResp, $apiResp["meta"]["code"]);
|
return new Response($apiResp, $apiResp["meta"]["code"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$data["status_sms"] = $req->status_sms;
|
||||||
|
|
||||||
// validasi input
|
// validasi input
|
||||||
$isValidInput = Validator::make($input, $rulesInput);
|
$isValidInput = Validator::make($input, $rulesInput);
|
||||||
|
|||||||
@ -152,6 +152,8 @@ class VehiclesController extends Controller
|
|||||||
"tax_exp" => $req->tax_exp,
|
"tax_exp" => $req->tax_exp,
|
||||||
// "kir_exp" => $req->kir_exp,
|
// "kir_exp" => $req->kir_exp,
|
||||||
// "vendor_id" => $req->vendor_id,
|
// "vendor_id" => $req->vendor_id,
|
||||||
|
"dc_code" => $req->dc_code,
|
||||||
|
"pool_code" => $req->pool_code,
|
||||||
];
|
];
|
||||||
$rulesInput = [
|
$rulesInput = [
|
||||||
"front_vehicle_photo" => "required|string",
|
"front_vehicle_photo" => "required|string",
|
||||||
@ -184,6 +186,8 @@ class VehiclesController extends Controller
|
|||||||
"tax_exp" => "required|date_format:Y-m-d",
|
"tax_exp" => "required|date_format:Y-m-d",
|
||||||
// "kir_exp" => "required|date_format:Y-m-d",
|
// "kir_exp" => "required|date_format:Y-m-d",
|
||||||
// "vendor_id" => "nullable|integer|not_in:0",
|
// "vendor_id" => "nullable|integer|not_in:0",
|
||||||
|
"dc_code" => "nullable|string",
|
||||||
|
"pool_code" => "nullable|string",
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($req->auth->role == Users::ROLE_VENDOR) {
|
if ($req->auth->role == Users::ROLE_VENDOR) {
|
||||||
@ -249,6 +253,7 @@ class VehiclesController extends Controller
|
|||||||
"crt_by" => $req->auth->uid,
|
"crt_by" => $req->auth->uid,
|
||||||
"updt" => $now,
|
"updt" => $now,
|
||||||
"updt_by" => $req->auth->uid,
|
"updt_by" => $req->auth->uid,
|
||||||
|
|
||||||
];
|
];
|
||||||
// dd($insVhc);
|
// dd($insVhc);
|
||||||
if ($req->model_id) {
|
if ($req->model_id) {
|
||||||
@ -316,6 +321,9 @@ class VehiclesController extends Controller
|
|||||||
"regis_year" => $req->regis_year,
|
"regis_year" => $req->regis_year,
|
||||||
"tax_exp" => $req->tax_exp,
|
"tax_exp" => $req->tax_exp,
|
||||||
"kir_exp" => $req->kir_exp,
|
"kir_exp" => $req->kir_exp,
|
||||||
|
"dc_code" => $req->dc_code,
|
||||||
|
"pool_code" => $req->pool_code,
|
||||||
|
|
||||||
];
|
];
|
||||||
VehiclesDetail::addDetail($insDetail);
|
VehiclesDetail::addDetail($insDetail);
|
||||||
|
|
||||||
@ -375,6 +383,8 @@ class VehiclesController extends Controller
|
|||||||
"tax_exp" => $req->tax_exp,
|
"tax_exp" => $req->tax_exp,
|
||||||
// "kir_exp" => $req->kir_exp,
|
// "kir_exp" => $req->kir_exp,
|
||||||
// "vendor_id" => $req->vendor_id,
|
// "vendor_id" => $req->vendor_id,
|
||||||
|
"dc_code" => $req->dc_code,
|
||||||
|
"pool_code" => $req->pool_code,
|
||||||
];
|
];
|
||||||
$rulesInput = [
|
$rulesInput = [
|
||||||
"vid" => "required|integer|not_in:0",
|
"vid" => "required|integer|not_in:0",
|
||||||
@ -409,6 +419,8 @@ class VehiclesController extends Controller
|
|||||||
"tax_exp" => "required|date_format:Y-m-d",
|
"tax_exp" => "required|date_format:Y-m-d",
|
||||||
// "kir_exp" => "required|date_format:Y-m-d",
|
// "kir_exp" => "required|date_format:Y-m-d",
|
||||||
// "vendor_id" => "nullable|integer|not_in:0",
|
// "vendor_id" => "nullable|integer|not_in:0",
|
||||||
|
"dc_code" => "nullable|string",
|
||||||
|
"pool_code" => "nullable|string",
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($req->auth->role == Users::ROLE_VENDOR) {
|
if ($req->auth->role == Users::ROLE_VENDOR) {
|
||||||
@ -563,6 +575,8 @@ class VehiclesController extends Controller
|
|||||||
"regis_year" => $req->regis_year,
|
"regis_year" => $req->regis_year,
|
||||||
"tax_exp" => $req->tax_exp,
|
"tax_exp" => $req->tax_exp,
|
||||||
"kir_exp" => $req->kir_exp,
|
"kir_exp" => $req->kir_exp,
|
||||||
|
"dc_code" => $req->dc_code,
|
||||||
|
"pool_code" => $req->pool_code,
|
||||||
];
|
];
|
||||||
if ($req->fvhc_base64) {
|
if ($req->fvhc_base64) {
|
||||||
$updtDetail["fvhc_img"] = $url_fvhc;
|
$updtDetail["fvhc_img"] = $url_fvhc;
|
||||||
|
|||||||
390
resources/views/menu_v1/configs/distribution_category.blade.php
Normal file
390
resources/views/menu_v1/configs/distribution_category.blade.php
Normal file
@ -0,0 +1,390 @@
|
|||||||
|
@extends('app.app')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
Conf Distribution Categorys
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('customcss')
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="content">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="row d-flex align-items-center">
|
||||||
|
<div class="col-3">
|
||||||
|
<p class="card-title text-bold mb-0">Distribution Category</p>
|
||||||
|
</div>
|
||||||
|
@can('config_distribution_category.create')
|
||||||
|
<div class="col text-end">
|
||||||
|
<button id="btnMdlNew" class="btn btn-sm btn-danger">Add New Distribution Category</button>
|
||||||
|
</div>
|
||||||
|
@endcan
|
||||||
|
|
||||||
|
<div class="col-auto text-end ps-0">
|
||||||
|
{{-- <button class="btn btn-sm btn-danger">Upload</button> --}}
|
||||||
|
{{-- <button class="btn btn-sm btn-danger">Download</button> --}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table id="tList" class="table table-hover dataTable w-100">
|
||||||
|
<thead>
|
||||||
|
<tr class="">
|
||||||
|
<th class="">#</th>
|
||||||
|
<th class="text-center">Action</th>
|
||||||
|
<th class="">Code</th>
|
||||||
|
<th class="">Name</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" id="mdlNew" aria-labelledby="mdlLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog modal-dialog-centered modal-dialog-scrollable">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="mdlLabel">Add New Category</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="fNew">
|
||||||
|
<!--input hidden -->
|
||||||
|
<input type="hidden" name="tipe" id="tipe" value="new">
|
||||||
|
<input type="hidden" name="id" id="id">
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<label for="dc_code" class="col-form-label">Code:</label>
|
||||||
|
<input type="text" name="dc_code" id="dc_code" class="form-control" placeholder="Category code, example: VF, VO, etc">
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<label for="dc_name" class="col-form-label">Name:</label>
|
||||||
|
<input type="text" name="dc_name" id="dc_name" class="form-control" placeholder="Category name">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
@can('config_distribution_category.delete')
|
||||||
|
<button type="button" id="btnDel" class="btn btn-sm btn-warning">Delete ?</button>
|
||||||
|
@endcan
|
||||||
|
<button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||||
|
<button id="btnSubmit" type="button" class="btn btn-sm btn-danger">Submit data</button>
|
||||||
|
@can('config_distribution_category.edit')
|
||||||
|
<button id="btnEdit" type="button" class="btn btn-sm btn-danger">Update data</button>
|
||||||
|
@endcan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" id="mdlDel" aria-labelledby="mdlDelLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered modal-sm">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="mdlDelLabel">Delete TruckType</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="d-flex justify-content-center">
|
||||||
|
<p class="mb-0">
|
||||||
|
Are you sure want to delete this Distribution Category
|
||||||
|
<a href="#" class="text-danger">
|
||||||
|
<span id="del-type_name"></span>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-sm btn-danger" data-bs-dismiss="modal">Close</button>
|
||||||
|
<button id="btnSubmitDel" type="button" class="btn btn-sm btn-secondary">Yes, delete</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('customjs')
|
||||||
|
<script src="{{ asset('assets/js/load-image.all.min.js') }}"></script>
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
const State = {
|
||||||
|
file_jimp_worker: "{{ asset('assets/js/worker/jimp.js') }}",
|
||||||
|
storage_lara: "{{ asset('storage') }}/",
|
||||||
|
delay_typing_front: 1000,
|
||||||
|
};
|
||||||
|
|
||||||
|
const Wrapper = {
|
||||||
|
activate: function() {
|
||||||
|
Wrapper.event();
|
||||||
|
DTable.activate();
|
||||||
|
},
|
||||||
|
event: function() {
|
||||||
|
$('#btnMdlNew').on('click', function() {
|
||||||
|
$('#fNew')[0].reset();
|
||||||
|
$('#btnDel').hide();
|
||||||
|
$('#btnEdit').hide();
|
||||||
|
$('#btnSubmit').show();
|
||||||
|
$('#mdlLabel').text('New Distribution Category');
|
||||||
|
$('#dc_code').focus();
|
||||||
|
|
||||||
|
$('#mdlNew').modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btnSubmit, #btnEdit').on('click', function() {
|
||||||
|
let data=$("#fNew").serialize()
|
||||||
|
Wrapper.submitData(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#tList').on('click', '.btnUpdt', function(e) {
|
||||||
|
// console.log("updt klik");
|
||||||
|
const id = $(this).data('id');
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('api_conf_show_distribution_category', '') }}/" + id,
|
||||||
|
method: 'GET',
|
||||||
|
crossDomain: true,
|
||||||
|
processData: true,
|
||||||
|
headers: {
|
||||||
|
'x-api-key': Helper.getCookie('_trtk'),
|
||||||
|
},
|
||||||
|
// data: params,
|
||||||
|
success: (data, textStatus, jqXHR) => {
|
||||||
|
console.log("res data", data);
|
||||||
|
|
||||||
|
if (data.meta.type != 'success') {
|
||||||
|
resolve({
|
||||||
|
type: 'fail'
|
||||||
|
});
|
||||||
|
Helper.toast('Warning', 'just now', data.meta.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert value
|
||||||
|
$('#mdlLabel').text('Edit Distribution Category');
|
||||||
|
$('#btnDel').show();
|
||||||
|
$('#btnEdit').show();
|
||||||
|
$('#btnSubmit').hide();
|
||||||
|
|
||||||
|
$('#tipe').val("edit");
|
||||||
|
$('#id').val(id);
|
||||||
|
$('#dc_code').val(data.data.dc_code);
|
||||||
|
$('#dc_name').val(data.data.dc_name);
|
||||||
|
},
|
||||||
|
error: (jqXHR, textStatus, error) => {
|
||||||
|
if (jqXHR.status >= 500) {
|
||||||
|
Helper.toast('Error', 'just now', 'please try again');
|
||||||
|
} else {
|
||||||
|
Helper.toast('Error', 'just now', jqXHR.responseJSON.meta
|
||||||
|
.message);
|
||||||
|
}
|
||||||
|
resolve({
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#mdlNew').modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btnDel').on('click', function(e) {
|
||||||
|
$('#mdlDel').modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btnSubmitDel').on('click', function(e) {
|
||||||
|
const id = $('#id').val()
|
||||||
|
const data = {
|
||||||
|
id: $('#mdlDel').data('id'),
|
||||||
|
};
|
||||||
|
$('#btnSubmitDel').attr('disabed', true);
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('api_conf_del_distribution_category', '') }}/" + id,
|
||||||
|
method: 'DELETE',
|
||||||
|
crossDomain: true,
|
||||||
|
processData: true,
|
||||||
|
headers: {
|
||||||
|
'x-api-key': Helper.getCookie('_trtk'),
|
||||||
|
'x-csrf-token': $('meta[name="csrf-token"]').attr('content'),
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
success: (data, textStatus, jqXHR) => {
|
||||||
|
$('#btnSubmitDel').removeAttr('disabed');
|
||||||
|
if (data.meta.type != 'success') {
|
||||||
|
resolve({
|
||||||
|
type: 'fail'
|
||||||
|
});
|
||||||
|
Helper.toast('Warning', 'just now', data.meta.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Helper.toast('Success', 'just now', 'success delete Distribution Category');
|
||||||
|
$('#mdlDel').modal('hide');
|
||||||
|
$('#mdlNew').modal('hide');
|
||||||
|
$('#tList').DataTable().ajax.reload();
|
||||||
|
resolve({
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: (jqXHR, textStatus, error) => {
|
||||||
|
$('#btnSubmitDel').removeAttr('disabed');
|
||||||
|
if (jqXHR.status >= 500) {
|
||||||
|
Helper.toast('Error', 'just now', 'Please try again');
|
||||||
|
} else {
|
||||||
|
Helper.toast('Error', 'just now', jqXHR.responseJSON.meta
|
||||||
|
.message);
|
||||||
|
}
|
||||||
|
resolve({
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#mdlDel').on('show.bs.modal', function () {
|
||||||
|
$('#mdlNew').css('opacity', '0.5'); // fade background modal
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#mdlDel').on('hidden.bs.modal', function () {
|
||||||
|
$('#mdlNew').css('opacity', '1');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
submitData: async function(data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (typeof $('#btnSubmit').attr('disabed') != 'undefined') {
|
||||||
|
resolve({
|
||||||
|
type: 'fail'
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$('#btnSubmit').attr('disabed', true);
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('api_conf_add_distribution_category') }}",
|
||||||
|
method: 'POST',
|
||||||
|
crossDomain: true,
|
||||||
|
processData: true,
|
||||||
|
headers: {
|
||||||
|
'x-api-key': Helper.getCookie('_trtk'),
|
||||||
|
'x-csrf-token': $('meta[name="csrf-token"]').attr('content'),
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
success: (data, textStatus, jqXHR) => {
|
||||||
|
$('#btnSubmit').removeAttr('disabed');
|
||||||
|
if (data.meta.type != 'success') {
|
||||||
|
resolve({
|
||||||
|
type: 'fail'
|
||||||
|
});
|
||||||
|
Helper.toast('Warning', 'just now', data.meta.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Helper.toast('Success', 'just now', 'success add new Distribution Category');
|
||||||
|
$('#mdlNew').modal('hide');
|
||||||
|
$('#tList').DataTable().ajax.reload();
|
||||||
|
resolve({
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: (jqXHR, textStatus, error) => {
|
||||||
|
$('#btnSubmit').removeAttr('disabed');
|
||||||
|
if (jqXHR.status >= 500) {
|
||||||
|
Helper.toast('Error', 'just now', 'Please try again');
|
||||||
|
} else {
|
||||||
|
Helper.toast('Error', 'just now', jqXHR.responseJSON.meta
|
||||||
|
.message);
|
||||||
|
}
|
||||||
|
resolve({
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const DTable = {
|
||||||
|
activate: function() {
|
||||||
|
DTable.reload();
|
||||||
|
},
|
||||||
|
reload: function() {
|
||||||
|
// $('#tList').DataTable();
|
||||||
|
// if (Driver.Table.firstInitDataTable == 1) { loadTableSkeletonLoading() } else { Driver.Table.firstInitDataTable = 1; }
|
||||||
|
$('#tList').DataTable({
|
||||||
|
processing: true,
|
||||||
|
serverSide: false,
|
||||||
|
bLengthChange: true,
|
||||||
|
deferRender: true,
|
||||||
|
destroy: true,
|
||||||
|
ajax: {
|
||||||
|
url: "{{ route('api_conf_list_distribution_category') }}",
|
||||||
|
type: 'GET',
|
||||||
|
complete: function(jqXHR, textStatus, c) {
|
||||||
|
let count = jqXHR.responseJSON.count;
|
||||||
|
if (typeof count != 'undefined') {
|
||||||
|
$('#count_trucktypes').text(count);
|
||||||
|
}
|
||||||
|
// removeTableSkeletonLoading()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
deferRender: true,
|
||||||
|
columns: [{
|
||||||
|
data: 'DT_RowIndex',
|
||||||
|
className: 'text-end',
|
||||||
|
visible: true,
|
||||||
|
orderable: true,
|
||||||
|
searchable: true,
|
||||||
|
width: "30px"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'action',
|
||||||
|
className: 'text-center',
|
||||||
|
visible: true,
|
||||||
|
orderable: true,
|
||||||
|
searchable: true,
|
||||||
|
width: "100px",
|
||||||
|
render: function(data, type, row, meta) {
|
||||||
|
let action = `
|
||||||
|
<a href="#" class="text-decoration-none me-1 btnUpdt" data-id="${row.id}" title="Update" data-bs-toggle="tooltip" data-bs-placement="top">
|
||||||
|
<span class="icon ion-eye fz-16"></span>
|
||||||
|
</a>
|
||||||
|
`;
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'dc_code',
|
||||||
|
className: 'text-left text-nowrap',
|
||||||
|
visible: true,
|
||||||
|
orderable: true,
|
||||||
|
searchable: true,
|
||||||
|
createdCell: function(td, cellData, rowData, row, col) {
|
||||||
|
$(td).attr('data-ttid', rowData.id);
|
||||||
|
$(td).attr('data-type_name', rowData.type_name);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'dc_name',
|
||||||
|
className: 'text-left',
|
||||||
|
visible: true,
|
||||||
|
orderable: true,
|
||||||
|
searchable: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Wrapper.activate();
|
||||||
|
</script>
|
||||||
|
@endsection
|
||||||
390
resources/views/menu_v1/configs/pool.blade.php
Normal file
390
resources/views/menu_v1/configs/pool.blade.php
Normal file
@ -0,0 +1,390 @@
|
|||||||
|
@extends('app.app')
|
||||||
|
|
||||||
|
@section('title')
|
||||||
|
Conf Pools
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('customcss')
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="content">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="row d-flex align-items-center">
|
||||||
|
<div class="col-3">
|
||||||
|
<p class="card-title text-bold mb-0">Pool / Area</p>
|
||||||
|
</div>
|
||||||
|
@can('config_pool.create')
|
||||||
|
<div class="col text-end">
|
||||||
|
<button id="btnMdlNew" class="btn btn-sm btn-danger">Add New Pool</button>
|
||||||
|
</div>
|
||||||
|
@endcan
|
||||||
|
|
||||||
|
<div class="col-auto text-end ps-0">
|
||||||
|
{{-- <button class="btn btn-sm btn-danger">Upload</button> --}}
|
||||||
|
{{-- <button class="btn btn-sm btn-danger">Download</button> --}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table id="tList" class="table table-hover dataTable w-100">
|
||||||
|
<thead>
|
||||||
|
<tr class="">
|
||||||
|
<th class="">#</th>
|
||||||
|
<th class="text-center">Action</th>
|
||||||
|
<th class="">Code</th>
|
||||||
|
<th class="">Name</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" id="mdlNew" aria-labelledby="mdlLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog modal-dialog-centered modal-dialog-scrollable">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="mdlLabel">Add New Pool</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="fNew">
|
||||||
|
<!--input hidden -->
|
||||||
|
<input type="hidden" name="tipe" id="tipe" value="new">
|
||||||
|
<input type="hidden" name="id" id="id">
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<label for="pool_code" class="col-form-label">Code:</label>
|
||||||
|
<input type="text" name="pool_code" id="pool_code" class="form-control" placeholder="Pool code, example: VF, VO, etc">
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<label for="pool_name" class="col-form-label">Name:</label>
|
||||||
|
<input type="text" name="pool_name" id="pool_name" class="form-control" placeholder="Pool name">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
@can('config_pool.delete')
|
||||||
|
<button type="button" id="btnDel" class="btn btn-sm btn-warning">Delete ?</button>
|
||||||
|
@endcan
|
||||||
|
<button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||||
|
<button id="btnSubmit" type="button" class="btn btn-sm btn-danger">Submit data</button>
|
||||||
|
@can('config_pool.edit')
|
||||||
|
<button id="btnEdit" type="button" class="btn btn-sm btn-danger">Update data</button>
|
||||||
|
@endcan
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" id="mdlDel" aria-labelledby="mdlDelLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered modal-sm">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="mdlDelLabel">Delete TruckType</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="d-flex justify-content-center">
|
||||||
|
<p class="mb-0">
|
||||||
|
Are you sure want to delete this Pool
|
||||||
|
<a href="#" class="text-danger">
|
||||||
|
<span id="del-type_name"></span>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-sm btn-danger" data-bs-dismiss="modal">Close</button>
|
||||||
|
<button id="btnSubmitDel" type="button" class="btn btn-sm btn-secondary">Yes, delete</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('customjs')
|
||||||
|
<script src="{{ asset('assets/js/load-image.all.min.js') }}"></script>
|
||||||
|
<script>
|
||||||
|
'use strict';
|
||||||
|
const State = {
|
||||||
|
file_jimp_worker: "{{ asset('assets/js/worker/jimp.js') }}",
|
||||||
|
storage_lara: "{{ asset('storage') }}/",
|
||||||
|
delay_typing_front: 1000,
|
||||||
|
};
|
||||||
|
|
||||||
|
const Wrapper = {
|
||||||
|
activate: function() {
|
||||||
|
Wrapper.event();
|
||||||
|
DTable.activate();
|
||||||
|
},
|
||||||
|
event: function() {
|
||||||
|
$('#btnMdlNew').on('click', function() {
|
||||||
|
$('#fNew')[0].reset();
|
||||||
|
$('#btnDel').hide();
|
||||||
|
$('#btnEdit').hide();
|
||||||
|
$('#btnSubmit').show();
|
||||||
|
$('#mdlLabel').text('New Pool');
|
||||||
|
$('#pool_code').focus();
|
||||||
|
|
||||||
|
$('#mdlNew').modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btnSubmit, #btnEdit').on('click', function() {
|
||||||
|
let data=$("#fNew").serialize()
|
||||||
|
Wrapper.submitData(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#tList').on('click', '.btnUpdt', function(e) {
|
||||||
|
// console.log("updt klik");
|
||||||
|
const id = $(this).data('id');
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('api_conf_show_pool', '') }}/" + id,
|
||||||
|
method: 'GET',
|
||||||
|
crossDomain: true,
|
||||||
|
processData: true,
|
||||||
|
headers: {
|
||||||
|
'x-api-key': Helper.getCookie('_trtk'),
|
||||||
|
},
|
||||||
|
// data: params,
|
||||||
|
success: (data, textStatus, jqXHR) => {
|
||||||
|
console.log("res data", data);
|
||||||
|
|
||||||
|
if (data.meta.type != 'success') {
|
||||||
|
resolve({
|
||||||
|
type: 'fail'
|
||||||
|
});
|
||||||
|
Helper.toast('Warning', 'just now', data.meta.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert value
|
||||||
|
$('#mdlLabel').text('Edit Pool');
|
||||||
|
$('#btnDel').show();
|
||||||
|
$('#btnEdit').show();
|
||||||
|
$('#btnSubmit').hide();
|
||||||
|
|
||||||
|
$('#tipe').val("edit");
|
||||||
|
$('#id').val(id);
|
||||||
|
$('#pool_code').val(data.data.pool_code);
|
||||||
|
$('#pool_name').val(data.data.pool_name);
|
||||||
|
},
|
||||||
|
error: (jqXHR, textStatus, error) => {
|
||||||
|
if (jqXHR.status >= 500) {
|
||||||
|
Helper.toast('Error', 'just now', 'please try again');
|
||||||
|
} else {
|
||||||
|
Helper.toast('Error', 'just now', jqXHR.responseJSON.meta
|
||||||
|
.message);
|
||||||
|
}
|
||||||
|
resolve({
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#mdlNew').modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btnDel').on('click', function(e) {
|
||||||
|
$('#mdlDel').modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#btnSubmitDel').on('click', function(e) {
|
||||||
|
const id = $('#id').val()
|
||||||
|
const data = {
|
||||||
|
id: $('#mdlDel').data('id'),
|
||||||
|
};
|
||||||
|
$('#btnSubmitDel').attr('disabed', true);
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('api_conf_del_pool', '') }}/" + id,
|
||||||
|
method: 'DELETE',
|
||||||
|
crossDomain: true,
|
||||||
|
processData: true,
|
||||||
|
headers: {
|
||||||
|
'x-api-key': Helper.getCookie('_trtk'),
|
||||||
|
'x-csrf-token': $('meta[name="csrf-token"]').attr('content'),
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
success: (data, textStatus, jqXHR) => {
|
||||||
|
$('#btnSubmitDel').removeAttr('disabed');
|
||||||
|
if (data.meta.type != 'success') {
|
||||||
|
resolve({
|
||||||
|
type: 'fail'
|
||||||
|
});
|
||||||
|
Helper.toast('Warning', 'just now', data.meta.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Helper.toast('Success', 'just now', 'success delete Pool');
|
||||||
|
$('#mdlDel').modal('hide');
|
||||||
|
$('#mdlNew').modal('hide');
|
||||||
|
$('#tList').DataTable().ajax.reload();
|
||||||
|
resolve({
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: (jqXHR, textStatus, error) => {
|
||||||
|
$('#btnSubmitDel').removeAttr('disabed');
|
||||||
|
if (jqXHR.status >= 500) {
|
||||||
|
Helper.toast('Error', 'just now', 'Please try again');
|
||||||
|
} else {
|
||||||
|
Helper.toast('Error', 'just now', jqXHR.responseJSON.meta
|
||||||
|
.message);
|
||||||
|
}
|
||||||
|
resolve({
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#mdlDel').on('show.bs.modal', function () {
|
||||||
|
$('#mdlNew').css('opacity', '0.5'); // fade background modal
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#mdlDel').on('hidden.bs.modal', function () {
|
||||||
|
$('#mdlNew').css('opacity', '1');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
submitData: async function(data) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (typeof $('#btnSubmit').attr('disabed') != 'undefined') {
|
||||||
|
resolve({
|
||||||
|
type: 'fail'
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$('#btnSubmit').attr('disabed', true);
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('api_conf_add_pool') }}",
|
||||||
|
method: 'POST',
|
||||||
|
crossDomain: true,
|
||||||
|
processData: true,
|
||||||
|
headers: {
|
||||||
|
'x-api-key': Helper.getCookie('_trtk'),
|
||||||
|
'x-csrf-token': $('meta[name="csrf-token"]').attr('content'),
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
success: (data, textStatus, jqXHR) => {
|
||||||
|
$('#btnSubmit').removeAttr('disabed');
|
||||||
|
if (data.meta.type != 'success') {
|
||||||
|
resolve({
|
||||||
|
type: 'fail'
|
||||||
|
});
|
||||||
|
Helper.toast('Warning', 'just now', data.meta.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Helper.toast('Success', 'just now', 'success add new Pool');
|
||||||
|
$('#mdlNew').modal('hide');
|
||||||
|
$('#tList').DataTable().ajax.reload();
|
||||||
|
resolve({
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: (jqXHR, textStatus, error) => {
|
||||||
|
$('#btnSubmit').removeAttr('disabed');
|
||||||
|
if (jqXHR.status >= 500) {
|
||||||
|
Helper.toast('Error', 'just now', 'Please try again');
|
||||||
|
} else {
|
||||||
|
Helper.toast('Error', 'just now', jqXHR.responseJSON.meta
|
||||||
|
.message);
|
||||||
|
}
|
||||||
|
resolve({
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const DTable = {
|
||||||
|
activate: function() {
|
||||||
|
DTable.reload();
|
||||||
|
},
|
||||||
|
reload: function() {
|
||||||
|
// $('#tList').DataTable();
|
||||||
|
// if (Driver.Table.firstInitDataTable == 1) { loadTableSkeletonLoading() } else { Driver.Table.firstInitDataTable = 1; }
|
||||||
|
$('#tList').DataTable({
|
||||||
|
processing: true,
|
||||||
|
serverSide: false,
|
||||||
|
bLengthChange: true,
|
||||||
|
deferRender: true,
|
||||||
|
destroy: true,
|
||||||
|
ajax: {
|
||||||
|
url: "{{ route('api_conf_list_pool') }}",
|
||||||
|
type: 'GET',
|
||||||
|
complete: function(jqXHR, textStatus, c) {
|
||||||
|
let count = jqXHR.responseJSON.count;
|
||||||
|
if (typeof count != 'undefined') {
|
||||||
|
$('#count_trucktypes').text(count);
|
||||||
|
}
|
||||||
|
// removeTableSkeletonLoading()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
deferRender: true,
|
||||||
|
columns: [{
|
||||||
|
data: 'DT_RowIndex',
|
||||||
|
className: 'text-end',
|
||||||
|
visible: true,
|
||||||
|
orderable: true,
|
||||||
|
searchable: true,
|
||||||
|
width: "30px"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'action',
|
||||||
|
className: 'text-center',
|
||||||
|
visible: true,
|
||||||
|
orderable: true,
|
||||||
|
searchable: true,
|
||||||
|
width: "100px",
|
||||||
|
render: function(data, type, row, meta) {
|
||||||
|
let action = `
|
||||||
|
<a href="#" class="text-decoration-none me-1 btnUpdt" data-id="${row.id}" title="Update" data-bs-toggle="tooltip" data-bs-placement="top">
|
||||||
|
<span class="icon ion-eye fz-16"></span>
|
||||||
|
</a>
|
||||||
|
`;
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'pool_code',
|
||||||
|
className: 'text-left text-nowrap',
|
||||||
|
visible: true,
|
||||||
|
orderable: true,
|
||||||
|
searchable: true,
|
||||||
|
createdCell: function(td, cellData, rowData, row, col) {
|
||||||
|
$(td).attr('data-ttid', rowData.id);
|
||||||
|
$(td).attr('data-type_name', rowData.type_name);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: 'pool_name',
|
||||||
|
className: 'text-left',
|
||||||
|
visible: true,
|
||||||
|
orderable: true,
|
||||||
|
searchable: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Wrapper.activate();
|
||||||
|
</script>
|
||||||
|
@endsection
|
||||||
@ -7,8 +7,8 @@
|
|||||||
@section('customcss')
|
@section('customcss')
|
||||||
<style>
|
<style>
|
||||||
/* .select2-container {
|
/* .select2-container {
|
||||||
z-index: 99999;
|
z-index: 99999;
|
||||||
} */
|
} */
|
||||||
</style>
|
</style>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@ -200,6 +200,13 @@
|
|||||||
<label class="form-check-label" for="add-status"><span class="text-dark" id="add-txtStatus">Inactive</span></label>
|
<label class="form-check-label" for="add-status"><span class="text-dark" id="add-txtStatus">Inactive</span></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="add-status-sms" class="form-label">SMS Notification</label>
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" id="add-status-sms">
|
||||||
|
<label class="form-check-label" for="add-status-sms"><span class="text-dark" id="add-txtStatusSms">Inactive</span></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="add-group_track_vhc" class="row">
|
<div id="add-group_track_vhc" class="row">
|
||||||
@ -382,6 +389,13 @@
|
|||||||
<label class="form-check-label" for="updt-status"><span class="text-dark" id="updt-txtStatus">Inactive</span></label>
|
<label class="form-check-label" for="updt-status"><span class="text-dark" id="updt-txtStatus">Inactive</span></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="updt-status-sms" class="form-label">SMS Notification</label>
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" id="updt-status-sms">
|
||||||
|
<label class="form-check-label" for="updt-status-sms"><span class="text-dark" id="updt-txtStatusSMS">Inactive</span></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -456,18 +470,20 @@
|
|||||||
Filter.activate();
|
Filter.activate();
|
||||||
},
|
},
|
||||||
event: function() {
|
event: function() {
|
||||||
$('#add-status').bind('change', function() {
|
$('#add-status, #add-status-sms, #updt-status, #updt-status-sms').bind('change', function() {
|
||||||
if ($(this).is(':checked'))
|
const labelSpan = $(this).closest('.form-check').find('span');
|
||||||
$('#add-txtStatus').html('Active')
|
labelSpan.html($(this).is(':checked') ? 'Active' : 'Inactive');
|
||||||
else
|
// if ($(this).is(':checked'))
|
||||||
$('#add-txtStatus').html('Inactive')
|
// $('#add-txtStatus').html('Active')
|
||||||
});
|
// else
|
||||||
$('#updt-status').bind('change', function() {
|
// $('#add-txtStatus').html('Inactive')
|
||||||
if ($(this).is(':checked'))
|
|
||||||
$('#updt-txtStatus').html('Active')
|
|
||||||
else
|
|
||||||
$('#updt-txtStatus').html('Inactive')
|
|
||||||
});
|
});
|
||||||
|
// $('#updt-status').bind('change', function() {
|
||||||
|
// if ($(this).is(':checked'))
|
||||||
|
// $('#updt-txtStatus').html('Active')
|
||||||
|
// else
|
||||||
|
// $('#updt-txtStatus').html('Inactive')
|
||||||
|
// });
|
||||||
// $('#add-roles').on('change', function() {
|
// $('#add-roles').on('change', function() {
|
||||||
// let role = $('#add-roles').val();
|
// let role = $('#add-roles').val();
|
||||||
// if (role == State.user_roles.checker) {
|
// if (role == State.user_roles.checker) {
|
||||||
@ -781,6 +797,8 @@
|
|||||||
data.status = State.user_status.inactive;
|
data.status = State.user_status.inactive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.status_sms = ($('#add-status-sms').prop('checked')) ? 1 : 0;
|
||||||
|
|
||||||
data.is_tracking = $('#add-is_tracking').val();
|
data.is_tracking = $('#add-is_tracking').val();
|
||||||
data.vehicles = $('#add-vehicles').val();
|
data.vehicles = $('#add-vehicles').val();
|
||||||
return data;
|
return data;
|
||||||
@ -920,6 +938,8 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
passDataToView: function(data) {
|
passDataToView: function(data) {
|
||||||
|
console.log("data", data);
|
||||||
|
|
||||||
$('#updt-first_name').val(data.first_name);
|
$('#updt-first_name').val(data.first_name);
|
||||||
$('#updt-fulladdress').val(data.fulladdress);
|
$('#updt-fulladdress').val(data.fulladdress);
|
||||||
$('#updt-phone').val(data.phone);
|
$('#updt-phone').val(data.phone);
|
||||||
@ -961,6 +981,8 @@
|
|||||||
|
|
||||||
$('#updtUserModal').data('id', data.id);
|
$('#updtUserModal').data('id', data.id);
|
||||||
$('#updtUserModal').modal('show');
|
$('#updtUserModal').modal('show');
|
||||||
|
|
||||||
|
$('#updt-status-sms').prop('checked', (data.status_sms == 1) ? true : false).trigger('change');
|
||||||
},
|
},
|
||||||
getData: function() {
|
getData: function() {
|
||||||
let data = {};
|
let data = {};
|
||||||
@ -996,6 +1018,8 @@
|
|||||||
data.is_tracking = $('#updt-is_tracking').val();
|
data.is_tracking = $('#updt-is_tracking').val();
|
||||||
data.vehicles = $('#updt-vehicles').val();
|
data.vehicles = $('#updt-vehicles').val();
|
||||||
|
|
||||||
|
data.status_sms = ($('#updt-status-sms').prop('checked')) ? 1 : 0;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
submitData: async function(data) {
|
submitData: async function(data) {
|
||||||
|
|||||||
@ -148,7 +148,31 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="mb-0">
|
||||||
|
<label for="add-dc_code" class="col-form-label">Distribution Category:</label>
|
||||||
|
<select id="add-dc_code" class="form-control" style="width:100%;">
|
||||||
|
<option value="">Choose</option>
|
||||||
|
@foreach ($listDistribution as $distribution)
|
||||||
|
<option value="{{ $distribution->dc_code }}">{{ $distribution->dc_code }} - {{ $distribution->dc_name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="mb-0">
|
||||||
|
<label for="add-pool_code" class="col-form-label">Pool:</label>
|
||||||
|
<select id="add-pool_code" class="form-control" style="width:100%;">
|
||||||
|
<option value="">Choose</option>
|
||||||
|
@foreach ($listPool as $pool)
|
||||||
|
<option value="{{ $pool->pool_code }}">{{ $pool->pool_code }} - {{ $pool->pool_name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{-- Job Data --}}
|
{{-- Job Data --}}
|
||||||
@ -365,6 +389,31 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="mb-0">
|
||||||
|
<label for="edt-dc_code" class="col-form-label">Distribution Category:</label>
|
||||||
|
<select id="edt-dc_code" class="form-control" style="width:100%;">
|
||||||
|
<option value="">Choose</option>
|
||||||
|
@foreach ($listDistribution as $distribution)
|
||||||
|
<option value="{{ $distribution->dc_code }}">{{ $distribution->dc_code }} - {{ $distribution->dc_name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="mb-0">
|
||||||
|
<label for="edt-pool_code" class="col-form-label">Pool:</label>
|
||||||
|
<select id="edt-pool_code" class="form-control" style="width:100%;">
|
||||||
|
<option value="">Choose</option>
|
||||||
|
@foreach ($listPool as $pool)
|
||||||
|
<option value="{{ $pool->pool_code }}">{{ $pool->pool_code }} - {{ $pool->pool_name }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -1044,6 +1093,9 @@
|
|||||||
|
|
||||||
data.append('vendor_id', safeVal('#add-vendor_id'));
|
data.append('vendor_id', safeVal('#add-vendor_id'));
|
||||||
|
|
||||||
|
data.append('dc_code', safeVal('#add-dc_code'));
|
||||||
|
data.append('pool_code', safeVal('#add-pool_code'));
|
||||||
|
|
||||||
// File input (cek ada file atau tidak)
|
// File input (cek ada file atau tidak)
|
||||||
const fvhcFile = $('#add-fvhc-file')[0].files[0];
|
const fvhcFile = $('#add-fvhc-file')[0].files[0];
|
||||||
if (fvhcFile) data.append('fvhc_file', fvhcFile);
|
if (fvhcFile) data.append('fvhc_file', fvhcFile);
|
||||||
@ -1314,6 +1366,9 @@
|
|||||||
// data.kir_exp = $('#edt-kirexp').val().split('-').reverse().join('-');
|
// data.kir_exp = $('#edt-kirexp').val().split('-').reverse().join('-');
|
||||||
|
|
||||||
data.vendor_id = $('#edt-vendor_id').val();
|
data.vendor_id = $('#edt-vendor_id').val();
|
||||||
|
|
||||||
|
data.dc_code = $('#edt-dc_code').val();
|
||||||
|
data.pool_code = $('#edt-pool_code').val();
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
submitData: async function(data) {
|
submitData: async function(data) {
|
||||||
|
|||||||
@ -42,18 +42,22 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@endcan
|
@endcan
|
||||||
@if (auth()->user()->can('config_truck_type.view') || auth()->user()->can('config_master_device.view') || auth()->user()->can('config_logs_gps.view'))
|
@if (auth()->user()->can('report_vehicle_trip.view') || auth()->user()->can('report_abnormality.view'))
|
||||||
<li class="nav-item dropdown {{ Request::segment(1) == 'reports' ? 'active' : '' }}">
|
<li class="nav-item dropdown {{ Request::segment(1) == 'reports' ? 'active' : '' }}">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="dropdownConfig" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
<a class="nav-link dropdown-toggle" href="#" id="dropdownConfig" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
Reports
|
Reports
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu" style="right: 0; left: auto;" aria-labelledby="dropdownConfig">
|
<ul class="dropdown-menu" style="right: 0; left: auto;" aria-labelledby="dropdownConfig">
|
||||||
<li>
|
@can('report_vehicle_trip.view')
|
||||||
<a class="dropdown-item {{ Request::segment(2) == 'vehicle-trips' ? 'active' : '' }}" href="{{ route('view_report_vehicle_trips') }}" title="">Vehicle Trips</a>
|
<li>
|
||||||
</li>
|
<a class="dropdown-item {{ Request::segment(2) == 'vehicle-trips' ? 'active' : '' }}" href="{{ route('view_report_vehicle_trips') }}" title="">Vehicle Trips</a>
|
||||||
<li>
|
</li>
|
||||||
<a class="dropdown-item {{ Request::segment(2) == 'abnormalities' ? 'active' : '' }}" href="{{ route('view_report_abnormalities') }}" title="">Abnormalities</a>
|
@endcan
|
||||||
</li>
|
@can('report_abnormality.view')
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item {{ Request::segment(2) == 'abnormalities' ? 'active' : '' }}" href="{{ route('view_report_abnormalities') }}" title="">Abnormalities</a>
|
||||||
|
</li>
|
||||||
|
@endcan
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@endif
|
@endif
|
||||||
@ -74,10 +78,20 @@
|
|||||||
</li>
|
</li>
|
||||||
@endcan
|
@endcan
|
||||||
@can('config_logs_gps.view')
|
@can('config_logs_gps.view')
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item {{ Request::segment(2) == 'logs_gps' ? 'active' : '' }}" href="{{ route('view_config_logs_gps') }}" title="">Logs Gps</a>
|
<a class="dropdown-item {{ Request::segment(2) == 'logs_gps' ? 'active' : '' }}" href="{{ route('view_config_logs_gps') }}" title="">Logs Gps</a>
|
||||||
</li>
|
</li>
|
||||||
@endcan
|
@endcan
|
||||||
|
@can('config_distribution_category.view')
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item {{ Request::segment(2) == 'distribution_category' ? 'active' : '' }}" href="{{ route('view_config_distribution_category') }}" title="">Distribution Category</a>
|
||||||
|
</li>
|
||||||
|
@endcan
|
||||||
|
@can('config_pool.view')
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item {{ Request::segment(2) == 'pool' ? 'active' : '' }}" href="{{ route('view_config_pool') }}" title="">Pool</a>
|
||||||
|
</li>
|
||||||
|
@endcan
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@ -153,9 +153,29 @@ Route::middleware(["auth", "auth.user"])->group(function () {
|
|||||||
);
|
);
|
||||||
Route::get("/config/logbook_keys", "LogbookKeysController@view_lgb_keys")->name("view_config_lgb_keys");
|
Route::get("/config/logbook_keys", "LogbookKeysController@view_lgb_keys")->name("view_config_lgb_keys");
|
||||||
|
|
||||||
|
// config distribution category
|
||||||
|
Route::get("/config/distribution_category", "ConfDistributionController@view_distribution_category")
|
||||||
|
->name("view_config_distribution_category")
|
||||||
|
->middleware("permission:config_distribution_category.view");
|
||||||
|
Route::post("/api/conf/distribution_category", "ConfDistributionController@api_add_distribution_category")->name("api_conf_add_distribution_category");
|
||||||
|
Route::get("/api/conf/distribution_category", "ConfDistributionController@api_list_distribution_category")->name("api_conf_list_distribution_category");
|
||||||
|
Route::get("/api/conf/distribution_category/{id}", "ConfDistributionController@api_show_distribution_category")->name("api_conf_show_distribution_category");
|
||||||
|
Route::delete("/api/conf/distribution_category/{id}", "ConfDistributionController@api_del_distribution_category")->name("api_conf_del_distribution_category");
|
||||||
|
|
||||||
|
// config pool
|
||||||
|
Route::get("/config/pool", "ConfPoolController@view_pool")
|
||||||
|
->name("view_config_pool")
|
||||||
|
->middleware("permission:config_pool.view");
|
||||||
|
Route::post("/api/conf/pool", "ConfPoolController@api_add_pool")->name("api_conf_add_pool");
|
||||||
|
Route::get("/api/conf/pool", "ConfPoolController@api_list_pool")->name("api_conf_list_pool");
|
||||||
|
Route::get("/api/conf/pool/{id}", "ConfPoolController@api_show_pool")->name("api_conf_show_pool");
|
||||||
|
Route::delete("/api/conf/pool/{id}", "ConfPoolController@api_del_pool")->name("api_conf_del_pool")->middleware("permission:config_pool.delete");
|
||||||
|
|
||||||
|
|
||||||
// reports
|
// reports
|
||||||
Route::get("/reports/vehicle-trips", "ReportsController@view_report_vehicle_trips")->name("view_report_vehicle_trips");
|
Route::get("/reports/vehicle-trips", "ReportsController@view_report_vehicle_trips")->name("view_report_vehicle_trips");
|
||||||
Route::get("/reports/vehicle-trips-list", "ReportsController@api_report_vehicle_trips_list")->name("api_report_vehicle_trips_list");
|
Route::get("/reports/vehicle-trips-list", "ReportsController@api_report_vehicle_trips_list")->name("api_report_vehicle_trips_list");
|
||||||
|
Route::get("/reports/vehicle-trip-detail", "ReportsController@view_report_trip_detail")->name("view_report_trip_detail");
|
||||||
Route::get("/reports/abnormalities", "ReportsController@view_report_abnormalities")->name("view_report_abnormalities");
|
Route::get("/reports/abnormalities", "ReportsController@view_report_abnormalities")->name("view_report_abnormalities");
|
||||||
Route::get("/reports/abnormalities-list", "ReportsController@api_report_abnormalities_list")->name("api_report_abnormalities_list");
|
Route::get("/reports/abnormalities-list", "ReportsController@api_report_abnormalities_list")->name("api_report_abnormalities_list");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user