From 8591fafd84682adb040433ba37cde45d0b925811 Mon Sep 17 00:00:00 2001
From: arifal hidayat
Date: Thu, 30 Jan 2025 01:28:36 +0700
Subject: [PATCH] fix datatable using token api and paginate when searching,
fix skrd_amount column to decimal 20
---
.../Api/GlobalSettingsController.php | 7 +-
.../Api/ImportDatasourceController.php | 2 +-
.../Api/RequestAssignmentController.php | 5 +-
app/Http/Controllers/Api/UsersController.php | 15 +-
.../Auth/AuthenticatedSessionController.php | 17 +-
.../Controllers/Master/UsersController.php | 8 +-
.../Resources/RequestAssignmentResouce.php | 1 +
app/Http/Resources/UserResource.php | 28 +
app/Providers/RouteServiceProvider.php | 2 +-
app/ServiceSIMBG.php | 12 +-
config/cors.php | 2 +-
...01_29_220149_change_skrd_amount_column.php | 28 +
resources/js/dashboards/bigdata.js | 1572 +++++++++--------
resources/js/master/users/users.js | 60 +
.../request-assignment/request-assignment.js | 67 +
.../js/settings/general/general-settings.js | 22 +-
.../js/settings/syncronize/syncronize.js | 107 +-
resources/js/tables/common-table.js | 170 +-
resources/views/auth/signin.blade.php | 12 +-
.../views/layouts/partials/sidebar.blade.php | 10 +-
.../layouts/partials/title-meta.blade.php | 1 +
.../views/layouts/partials/topbar.blade.php | 13 +-
resources/views/master/users/index.blade.php | 6 +-
.../views/request-assignment/index.blade.php | 6 +-
.../views/settings/general/index.blade.php | 4 +-
routes/api.php | 33 +-
routes/web.php | 30 +-
27 files changed, 1228 insertions(+), 1012 deletions(-)
create mode 100644 app/Http/Resources/UserResource.php
create mode 100644 database/migrations/2025_01_29_220149_change_skrd_amount_column.php
create mode 100644 resources/js/master/users/users.js
create mode 100644 resources/js/request-assignment/request-assignment.js
diff --git a/app/Http/Controllers/Api/GlobalSettingsController.php b/app/Http/Controllers/Api/GlobalSettingsController.php
index 6afc896..fe1d87d 100644
--- a/app/Http/Controllers/Api/GlobalSettingsController.php
+++ b/app/Http/Controllers/Api/GlobalSettingsController.php
@@ -8,6 +8,7 @@ use App\Http\Resources\GlobalSettingResource;
use App\Models\GlobalSetting;
use App\Traits\GlobalApiResponse;
use Exception;
+use Illuminate\Http\Request;
class GlobalSettingsController extends Controller
{
@@ -15,9 +16,13 @@ class GlobalSettingsController extends Controller
/**
* Display a listing of the resource.
*/
- public function index()
+ public function index(Request $request)
{
$query = GlobalSetting::query()->orderBy('id','desc');
+ if($request->has('search') && !empty($request->get("search"))){
+ $query->where('key', 'LIKE', '%'.$request->get('search').'%');
+ }
+
return GlobalSettingResource::collection($query->paginate());
}
diff --git a/app/Http/Controllers/Api/ImportDatasourceController.php b/app/Http/Controllers/Api/ImportDatasourceController.php
index ba365e7..dd634a6 100644
--- a/app/Http/Controllers/Api/ImportDatasourceController.php
+++ b/app/Http/Controllers/Api/ImportDatasourceController.php
@@ -20,7 +20,7 @@ class ImportDatasourceController extends Controller
$search = $request->get("search");
$query->where('status', 'like', "%".$search."%");
}
- return ImportDatasourceResource::collection($query->paginate(10));
+ return ImportDatasourceResource::collection($query->paginate());
}
/**
diff --git a/app/Http/Controllers/Api/RequestAssignmentController.php b/app/Http/Controllers/Api/RequestAssignmentController.php
index 193dcec..10d4319 100644
--- a/app/Http/Controllers/Api/RequestAssignmentController.php
+++ b/app/Http/Controllers/Api/RequestAssignmentController.php
@@ -12,9 +12,12 @@ class RequestAssignmentController extends Controller
/**
* Display a listing of the resource.
*/
- public function index()
+ public function index(Request $request)
{
$query = PbgTask::query();
+ if($request->has('search') && !empty($request->get("search"))){
+ $query->where('name', 'LIKE', '%'.$request->get('search').'%');
+ }
return RequestAssignmentResouce::collection($query->paginate());
}
diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php
index a79a949..2985421 100644
--- a/app/Http/Controllers/Api/UsersController.php
+++ b/app/Http/Controllers/Api/UsersController.php
@@ -4,12 +4,15 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
+use App\Http\Resources\UserResource;
use App\Models\User;
+use App\Traits\GlobalApiResponse;
use Illuminate\Support\Facades\Hash;
use Illuminate\Http\Request;
class UsersController extends Controller
{
+ use GlobalApiResponse;
public function login(LoginRequest $request){
$user = User::where('email', $request->email)->first();
@@ -21,7 +24,15 @@ class UsersController extends Controller
return response(['user' => $user, 'token' => $token], 200);
}
- public function index(){
- return response()->json(User::all());
+ public function index(Request $request){
+ $query = User::query();
+ if($request->has('search') && !empty($request->get("search"))){
+ $query->where('name', 'LIKE', '%'.$request->get('search').'%');
+ }
+ return UserResource::collection($query->paginate());
+ }
+ public function logout(Request $request){
+ $request->user()->tokens()->delete();
+ return response()->json(['message' => 'logged out successfully']);
}
}
diff --git a/app/Http/Controllers/Auth/AuthenticatedSessionController.php b/app/Http/Controllers/Auth/AuthenticatedSessionController.php
index 54bf875..9b638b8 100755
--- a/app/Http/Controllers/Auth/AuthenticatedSessionController.php
+++ b/app/Http/Controllers/Auth/AuthenticatedSessionController.php
@@ -33,6 +33,15 @@ class AuthenticatedSessionController extends Controller
$request->session()->regenerate();
+ // Ambil user yang sedang login
+ $user = Auth::user();
+
+ // Buat token untuk API
+ $token = $user->createToken(env('APP_KEY'))->plainTextToken;
+
+ // Simpan token di session (bisa digunakan di JavaScript)
+ session(['api_token' => $token]);
+
return redirect()->intended(RouteServiceProvider::HOME);
}
@@ -44,12 +53,16 @@ class AuthenticatedSessionController extends Controller
*/
public function destroy(Request $request)
{
+ if($request->user()){
+ $request->user()->tokens()->delete();
+ }
+
Auth::guard('web')->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
-
- return redirect('/');
+
+ return redirect()->route('login');
}
}
diff --git a/app/Http/Controllers/Master/UsersController.php b/app/Http/Controllers/Master/UsersController.php
index df6941a..166fe49 100644
--- a/app/Http/Controllers/Master/UsersController.php
+++ b/app/Http/Controllers/Master/UsersController.php
@@ -7,12 +7,18 @@ use Illuminate\Http\Request;
use Illuminate\Validation\Rules;
use Illuminate\Support\Facades\Hash;
use App\Models\User;
+use App\Traits\GlobalApiResponse;
use Illuminate\Auth\Events\Registered;
class UsersController extends Controller
{
+ use GlobalApiResponse;
+ public function allUsers(Request $request){
+ $users = User::all();
+ return $this->resSuccess($users);
+ }
public function index(){
- $users = User::paginate(20);
+ $users = User::paginate();
return view('master.users.index', compact('users'));
}
public function create(){
diff --git a/app/Http/Resources/RequestAssignmentResouce.php b/app/Http/Resources/RequestAssignmentResouce.php
index baa5acc..2d10d7b 100644
--- a/app/Http/Resources/RequestAssignmentResouce.php
+++ b/app/Http/Resources/RequestAssignmentResouce.php
@@ -15,6 +15,7 @@ class RequestAssignmentResouce extends JsonResource
public function toArray(Request $request): array
{
return [
+ 'id' => $this->id,
'uuid' => $this->uuid,
'name' => $this->name,
'owner_name' => $this->owner_name,
diff --git a/app/Http/Resources/UserResource.php b/app/Http/Resources/UserResource.php
new file mode 100644
index 0000000..bbe7c69
--- /dev/null
+++ b/app/Http/Resources/UserResource.php
@@ -0,0 +1,28 @@
+
+ */
+ public function toArray(Request $request): array
+ {
+ return [
+ 'id' =>$this->id,
+ 'name' =>$this->name,
+ 'email' =>$this->email,
+ 'created_at' =>$this->created_at->toDateTimeString(),
+ 'updated_at' =>$this->updated_at->toDateTimeString(),
+ 'position' => $this->position,
+ 'firstname' => $this->firstname,
+ 'lastname' => $this->lastname,
+ ];
+ }
+}
diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php
index 1cf5f15..ad012c7 100755
--- a/app/Providers/RouteServiceProvider.php
+++ b/app/Providers/RouteServiceProvider.php
@@ -17,7 +17,7 @@ class RouteServiceProvider extends ServiceProvider
*
* @var string
*/
- public const HOME = '/home';
+ public const HOME = '/dashboards/bigdata';
/**
* Define your route model bindings, pattern filters, and other route configuration.
diff --git a/app/ServiceSIMBG.php b/app/ServiceSIMBG.php
index af45fc2..6c2d206 100644
--- a/app/ServiceSIMBG.php
+++ b/app/ServiceSIMBG.php
@@ -143,7 +143,7 @@ class ServiceSIMBG
'page' => $currentPage,
'size' => 20,
'sort' => 'ASC',
- 'type' => 'task',
+ 'type' => 'task'
]);
$url = "/api/pbg/v1/list/?" . $queryParams;
@@ -192,15 +192,15 @@ class ServiceSIMBG
$this->syncTaskDetailSubmit($item['uid']);
$savedCount++;
} catch (Exception $e) {
+ $importDatasource->update([
+ 'status' => ImportDatasourceStatus::Failed->value,
+ 'message' => 'failed to save',
+ 'response_body' => $item
+ ]);
Log::error("Failed to process task", [
'error' => $e->getMessage(),
'task' => $item,
]);
- $importDatasource->update([
- 'status' => ImportDatasourceStatus::Failed->value,
- 'message' => $e->getMessage(),
- 'response_body' => $item
- ]);
$failedCount++;
}
}
diff --git a/config/cors.php b/config/cors.php
index 8a39e6d..94f07be 100644
--- a/config/cors.php
+++ b/config/cors.php
@@ -29,6 +29,6 @@ return [
'max_age' => 0,
- 'supports_credentials' => false,
+ 'supports_credentials' => true,
];
diff --git a/database/migrations/2025_01_29_220149_change_skrd_amount_column.php b/database/migrations/2025_01_29_220149_change_skrd_amount_column.php
new file mode 100644
index 0000000..f200f2f
--- /dev/null
+++ b/database/migrations/2025_01_29_220149_change_skrd_amount_column.php
@@ -0,0 +1,28 @@
+decimal('skrd_amount',20,2)->nullable()->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('pbg_task_retributions', function (Blueprint $table) {
+ $table->decimal('skrd_amount', 20,2)->nullable()->change();
+ });
+ }
+};
diff --git a/resources/js/dashboards/bigdata.js b/resources/js/dashboards/bigdata.js
index 92a68bd..4d63b0c 100644
--- a/resources/js/dashboards/bigdata.js
+++ b/resources/js/dashboards/bigdata.js
@@ -1,868 +1,920 @@
import ApexCharts from "apexcharts";
import jsVectorMap from "jsvectormap/dist/jsvectormap.js";
-import 'jsvectormap/dist/maps/world-merc.js';
-import 'jsvectormap/dist/maps/world.js';
-import GlobalConfig, {addThousandSeparators} from '../global-config.js';
+import "jsvectormap/dist/maps/world-merc.js";
+import "jsvectormap/dist/maps/world.js";
+import GlobalConfig, { addThousandSeparators } from "../global-config.js";
class BigData {
- init(){
- this.initAllChart();
- this.initChartTargetPAD();
- this.initChartUsaha();
- this.initChartNonUsaha();
- }
+ init() {
+ this.initAllChart();
+ this.initChartTargetPAD();
+ this.initChartUsaha();
+ this.initChartNonUsaha();
+ }
- initChartTargetPAD() {
- console.log("api host : " + GlobalConfig.apiHost);
- fetch(`${GlobalConfig.apiHost}/api/all-task-documents`)
- .then(response => {
- if(!response.ok){
- throw new Error("Network response was not ok");
- }
- return response.json();
- })
- .then(data => {
- const seriesData = data.data.series;
- document.getElementById("countTargetPAD").innerText = `${data.data.count} Berkas`;
- document.getElementById("totalTargetPAD").innerText = `Rp.${addThousandSeparators(data.data.total)}`;
+ initChartTargetPAD() {
+ console.log("api host : " + GlobalConfig.apiHost);
+ fetch(`${GlobalConfig.apiHost}/api/all-task-documents`)
+ .then((response) => {
+ if (!response.ok) {
+ throw new Error("Network response was not ok");
+ }
+ return response.json();
+ })
+ .then((data) => {
+ const seriesData = data.data.series;
+ document.getElementById(
+ "countTargetPAD"
+ ).innerText = `${data.data.count} Berkas`;
+ document.getElementById(
+ "totalTargetPAD"
+ ).innerText = `Rp.${addThousandSeparators(data.data.total)}`;
+ var options1 = {
+ chart: {
+ type: "area",
+ height: 50,
+ sparkline: {
+ enabled: true,
+ },
+ },
+ series: [
+ {
+ data: seriesData,
+ },
+ ],
+ stroke: {
+ width: 2,
+ curve: "smooth",
+ },
+ markers: {
+ size: 0,
+ },
+ colors: ["#7e67fe"],
+ tooltip: {
+ fixed: {
+ enabled: false,
+ },
+ x: {
+ show: false,
+ },
+ y: {
+ title: {
+ formatter: function (seriesName) {
+ return "";
+ },
+ },
+ },
+ marker: {
+ show: false,
+ },
+ },
+ fill: {
+ opacity: [1],
+ type: ["gradient"],
+ gradient: {
+ type: "vertical",
+ // shadeIntensity: 1,
+ inverseColors: false,
+ opacityFrom: 0.5,
+ opacityTo: 0,
+ stops: [0, 100],
+ },
+ },
+ };
+
+ new ApexCharts(
+ document.querySelector("#chart12"),
+ options1
+ ).render();
+ })
+ .catch((error) => {
+ console.error("error fetching chart dara : ", error);
+ });
+ }
+
+ initChartUsaha() {
+ fetch(`${GlobalConfig.apiHost}/api/business-documents`)
+ .then((response) => {
+ if (!response.ok) {
+ throw new Error("Network response was not ok");
+ }
+ return response.json();
+ })
+ .then((data) => {
+ const seriesData = data.data.series;
+ document.getElementById(
+ "countBusinessDocuments"
+ ).innerText = `${data.data.count} Berkas`;
+ document.getElementById(
+ "totalBusinessDocuments"
+ ).innerText = `Rp.${addThousandSeparators(data.data.total)}`;
+ var options1 = {
+ chart: {
+ type: "area",
+ height: 50,
+ sparkline: {
+ enabled: true,
+ },
+ },
+ series: [
+ {
+ data: seriesData,
+ },
+ ],
+ stroke: {
+ width: 2,
+ curve: "smooth",
+ },
+ markers: {
+ size: 0,
+ },
+ colors: ["#7e67fe"],
+ tooltip: {
+ fixed: {
+ enabled: false,
+ },
+ x: {
+ show: false,
+ },
+ y: {
+ title: {
+ formatter: function (seriesName) {
+ return "";
+ },
+ },
+ },
+ marker: {
+ show: false,
+ },
+ },
+ fill: {
+ opacity: [1],
+ type: ["gradient"],
+ gradient: {
+ type: "vertical",
+ // shadeIntensity: 1,
+ inverseColors: false,
+ opacityFrom: 0.5,
+ opacityTo: 0,
+ stops: [0, 100],
+ },
+ },
+ };
+
+ new ApexCharts(
+ document.querySelector("#chartBusinessDocuments"),
+ options1
+ ).render();
+ })
+ .catch((error) => {
+ console.error("error fetching chart dara : ", error);
+ });
+ }
+
+ initChartNonUsaha() {
+ fetch(`${GlobalConfig.apiHost}/api/non-business-documents`)
+ .then((response) => {
+ if (!response.ok) {
+ throw new Error("Network response was not ok");
+ }
+ return response.json();
+ })
+ .then((data) => {
+ const seriesData = data.data.series;
+ document.getElementById(
+ "countNonUsaha"
+ ).innerText = `${data.data.count} Berkas`;
+ document.getElementById(
+ "totalNonUsaha"
+ ).innerText = `Rp.${addThousandSeparators(data.data.total)}`;
+ var options1 = {
+ chart: {
+ type: "area",
+ height: 50,
+ sparkline: {
+ enabled: true,
+ },
+ },
+ series: [
+ {
+ data: seriesData,
+ },
+ ],
+ stroke: {
+ width: 2,
+ curve: "smooth",
+ },
+ markers: {
+ size: 0,
+ },
+ colors: ["#7e67fe"],
+ tooltip: {
+ fixed: {
+ enabled: false,
+ },
+ x: {
+ show: false,
+ },
+ y: {
+ title: {
+ formatter: function (seriesName) {
+ return "";
+ },
+ },
+ },
+ marker: {
+ show: false,
+ },
+ },
+ fill: {
+ opacity: [1],
+ type: ["gradient"],
+ gradient: {
+ type: "vertical",
+ // shadeIntensity: 1,
+ inverseColors: false,
+ opacityFrom: 0.5,
+ opacityTo: 0,
+ stops: [0, 100],
+ },
+ },
+ };
+
+ new ApexCharts(
+ document.querySelector("#chartNonUsaha"),
+ options1
+ ).render();
+ })
+ .catch((error) => {
+ console.error("error fetching chart dara : ", error);
+ });
+ }
+
+ initAllChart() {
var options1 = {
chart: {
- type: 'area',
+ type: "area",
height: 50,
sparkline: {
- enabled: true
- }
+ enabled: true,
+ },
},
- series: [{
- data: seriesData
- }],
+ series: [
+ {
+ data: [80, 100, 50, 30, 90],
+ },
+ ],
stroke: {
width: 2,
- curve: 'smooth'
+ curve: "smooth",
},
markers: {
- size: 0
+ size: 0,
},
colors: ["#7e67fe"],
tooltip: {
fixed: {
- enabled: false
+ enabled: false,
},
x: {
- show: false
+ show: false,
},
y: {
title: {
formatter: function (seriesName) {
- return ''
- }
- }
+ return "";
+ },
+ },
},
marker: {
- show: false
- }
+ show: false,
+ },
},
fill: {
opacity: [1],
- type: ['gradient'],
+ type: ["gradient"],
gradient: {
type: "vertical",
// shadeIntensity: 1,
inverseColors: false,
opacityFrom: 0.5,
opacityTo: 0,
- stops: [0, 100]
+ stops: [0, 100],
},
},
- }
-
- new ApexCharts(document.querySelector("#chart12"), options1).render();
- })
- .catch(error => {
- console.error("error fetching chart dara : ", error);
- });
- }
+ };
+
+ new ApexCharts(document.querySelector("#chart01"), options1).render();
- initChartUsaha(){
- fetch(`${GlobalConfig.apiHost}/api/business-documents`)
- .then(response => {
- if(!response.ok){
- throw new Error("Network response was not ok");
- }
- return response.json();
- })
- .then(data => {
- const seriesData = data.data.series;
- document.getElementById("countBusinessDocuments").innerText = `${data.data.count} Berkas`;
- document.getElementById("totalBusinessDocuments").innerText = `Rp.${addThousandSeparators(data.data.total)}`;
var options1 = {
chart: {
- type: 'area',
+ type: "area",
height: 50,
sparkline: {
- enabled: true
- }
+ enabled: true,
+ },
},
- series: [{
- data: seriesData
- }],
+ series: [
+ {
+ data: [87, 54, 4, 76, 31, 95, 70, 92, 53, 9, 6],
+ },
+ ],
stroke: {
width: 2,
- curve: 'smooth'
+ curve: "smooth",
},
markers: {
- size: 0
+ size: 0,
},
colors: ["#7e67fe"],
tooltip: {
fixed: {
- enabled: false
+ enabled: false,
},
x: {
- show: false
+ show: false,
},
y: {
title: {
formatter: function (seriesName) {
- return ''
- }
- }
+ return "";
+ },
+ },
},
marker: {
- show: false
- }
+ show: false,
+ },
},
fill: {
opacity: [1],
- type: ['gradient'],
+ type: ["gradient"],
gradient: {
type: "vertical",
// shadeIntensity: 1,
inverseColors: false,
opacityFrom: 0.5,
opacityTo: 0,
- stops: [0, 100]
+ stops: [0, 100],
},
},
- }
-
- new ApexCharts(document.querySelector("#chartBusinessDocuments"), options1).render();
- })
- .catch(error => {
- console.error("error fetching chart dara : ", error);
- });
- }
+ };
+
+ new ApexCharts(document.querySelector("#chart02"), options1).render();
- initChartNonUsaha(){
- fetch(`${GlobalConfig.apiHost}/api/non-business-documents`)
- .then(response => {
- if(!response.ok){
- throw new Error("Network response was not ok");
- }
- return response.json();
- })
- .then(data => {
- const seriesData = data.data.series;
- document.getElementById("countNonUsaha").innerText = `${data.data.count} Berkas`;
- document.getElementById("totalNonUsaha").innerText = `Rp.${addThousandSeparators(data.data.total)}`;
var options1 = {
chart: {
- type: 'area',
+ type: "area",
height: 50,
sparkline: {
- enabled: true
- }
+ enabled: true,
+ },
},
- series: [{
- data: seriesData
- }],
+ series: [
+ {
+ data: [41, 42, 35, 42, 6, 12, 13, 22, 42, 94, 95],
+ },
+ ],
stroke: {
width: 2,
- curve: 'smooth'
+ curve: "smooth",
},
markers: {
- size: 0
+ size: 0,
},
colors: ["#7e67fe"],
tooltip: {
fixed: {
- enabled: false
+ enabled: false,
},
x: {
- show: false
+ show: false,
},
y: {
title: {
formatter: function (seriesName) {
- return ''
- }
- }
+ return "";
+ },
+ },
},
marker: {
- show: false
- }
+ show: false,
+ },
},
fill: {
opacity: [1],
- type: ['gradient'],
+ type: ["gradient"],
gradient: {
type: "vertical",
// shadeIntensity: 1,
inverseColors: false,
opacityFrom: 0.5,
opacityTo: 0,
- stops: [0, 100]
+ stops: [0, 100],
},
},
- }
-
- new ApexCharts(document.querySelector("#chartNonUsaha"), options1).render();
- })
- .catch(error => {
- console.error("error fetching chart dara : ", error);
- });
- }
+ };
- initAllChart(){
- var options1 = {
- chart: {
- type: 'area',
- height: 50,
- sparkline: {
- enabled: true
- }
- },
- series: [{
- data: [80, 100, 50, 30, 90]
- }],
- stroke: {
- width: 2,
- curve: 'smooth'
- },
- markers: {
- size: 0
- },
- colors: ["#7e67fe"],
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- },
- fill: {
- opacity: [1],
- type: ['gradient'],
- gradient: {
- type: "vertical",
- // shadeIntensity: 1,
- inverseColors: false,
- opacityFrom: 0.5,
- opacityTo: 0,
- stops: [0, 100]
- },
- },
+ new ApexCharts(document.querySelector("#chart03"), options1).render();
+
+ // var options1 = {
+ // chart: {
+ // type: 'area',
+ // height: 50,
+ // sparkline: {
+ // enabled: true
+ // }
+ // },
+ // series: [{
+ // data: [8, 41, 40, 48, 77, 35, 0, 77, 63, 100, 71]
+ // }],
+ // stroke: {
+ // width: 2,
+ // curve: 'smooth'
+ // },
+ // markers: {
+ // size: 0
+ // },
+ // colors: ["#7e67fe"],
+ // tooltip: {
+ // fixed: {
+ // enabled: false
+ // },
+ // x: {
+ // show: false
+ // },
+ // y: {
+ // title: {
+ // formatter: function (seriesName) {
+ // return ''
+ // }
+ // }
+ // },
+ // marker: {
+ // show: false
+ // }
+ // },
+ // fill: {
+ // opacity: [1],
+ // type: ['gradient'],
+ // gradient: {
+ // type: "vertical",
+ // // shadeIntensity: 1,
+ // inverseColors: false,
+ // opacityFrom: 0.5,
+ // opacityTo: 0,
+ // stops: [0, 100]
+ // },
+ // },
+ // }
+
+ // new ApexCharts(document.querySelector("#chart04"), options1).render();
+
+ // var options1 = {
+ // chart: {
+ // type: 'area',
+ // height: 50,
+ // sparkline: {
+ // enabled: true
+ // }
+ // },
+ // series: [{
+ // data: [80, 100, 50, 30, 90]
+ // }],
+ // stroke: {
+ // width: 2,
+ // curve: 'smooth'
+ // },
+ // markers: {
+ // size: 0
+ // },
+ // colors: ["#7e67fe"],
+ // tooltip: {
+ // fixed: {
+ // enabled: false
+ // },
+ // x: {
+ // show: false
+ // },
+ // y: {
+ // title: {
+ // formatter: function (seriesName) {
+ // return ''
+ // }
+ // }
+ // },
+ // marker: {
+ // show: false
+ // }
+ // },
+ // fill: {
+ // opacity: [1],
+ // type: ['gradient'],
+ // gradient: {
+ // type: "vertical",
+ // // shadeIntensity: 1,
+ // inverseColors: false,
+ // opacityFrom: 0.5,
+ // opacityTo: 0,
+ // stops: [0, 100]
+ // },
+ // },
+ // }
+
+ // new ApexCharts(document.querySelector("#chart05"), options1).render();
+
+ var options1 = {
+ chart: {
+ type: "area",
+ height: 50,
+ sparkline: {
+ enabled: true,
+ },
+ },
+ series: [
+ {
+ data: [87, 54, 4, 76, 31, 95, 70, 92, 53, 9, 6],
+ },
+ ],
+ stroke: {
+ width: 2,
+ curve: "smooth",
+ },
+ markers: {
+ size: 0,
+ },
+ colors: ["#7e67fe"],
+ tooltip: {
+ fixed: {
+ enabled: false,
+ },
+ x: {
+ show: false,
+ },
+ y: {
+ title: {
+ formatter: function (seriesName) {
+ return "";
+ },
+ },
+ },
+ marker: {
+ show: false,
+ },
+ },
+ fill: {
+ opacity: [1],
+ type: ["gradient"],
+ gradient: {
+ type: "vertical",
+ // shadeIntensity: 1,
+ inverseColors: false,
+ opacityFrom: 0.5,
+ opacityTo: 0,
+ stops: [0, 100],
+ },
+ },
+ };
+
+ new ApexCharts(document.querySelector("#chart06"), options1).render();
+
+ var options1 = {
+ chart: {
+ type: "area",
+ height: 50,
+ sparkline: {
+ enabled: true,
+ },
+ },
+ series: [
+ {
+ data: [41, 42, 35, 42, 6, 12, 13, 22, 42, 94, 95],
+ },
+ ],
+ stroke: {
+ width: 2,
+ curve: "smooth",
+ },
+ markers: {
+ size: 0,
+ },
+ colors: ["#7e67fe"],
+ tooltip: {
+ fixed: {
+ enabled: false,
+ },
+ x: {
+ show: false,
+ },
+ y: {
+ title: {
+ formatter: function (seriesName) {
+ return "";
+ },
+ },
+ },
+ marker: {
+ show: false,
+ },
+ },
+ fill: {
+ opacity: [1],
+ type: ["gradient"],
+ gradient: {
+ type: "vertical",
+ // shadeIntensity: 1,
+ inverseColors: false,
+ opacityFrom: 0.5,
+ opacityTo: 0,
+ stops: [0, 100],
+ },
+ },
+ };
+
+ new ApexCharts(document.querySelector("#chart07"), options1).render();
+
+ var options1 = {
+ chart: {
+ type: "area",
+ height: 50,
+ sparkline: {
+ enabled: true,
+ },
+ },
+ series: [
+ {
+ data: [8, 41, 40, 48, 77, 35, 0, 77, 63, 100, 71],
+ },
+ ],
+ stroke: {
+ width: 2,
+ curve: "smooth",
+ },
+ markers: {
+ size: 0,
+ },
+ colors: ["#7e67fe"],
+ tooltip: {
+ fixed: {
+ enabled: false,
+ },
+ x: {
+ show: false,
+ },
+ y: {
+ title: {
+ formatter: function (seriesName) {
+ return "";
+ },
+ },
+ },
+ marker: {
+ show: false,
+ },
+ },
+ fill: {
+ opacity: [1],
+ type: ["gradient"],
+ gradient: {
+ type: "vertical",
+ // shadeIntensity: 1,
+ inverseColors: false,
+ opacityFrom: 0.5,
+ opacityTo: 0,
+ stops: [0, 100],
+ },
+ },
+ };
+
+ new ApexCharts(document.querySelector("#chart08"), options1).render();
+
+ var options1 = {
+ chart: {
+ type: "area",
+ height: 50,
+ sparkline: {
+ enabled: true,
+ },
+ },
+ series: [
+ {
+ data: [80, 100, 50, 30, 90],
+ },
+ ],
+ stroke: {
+ width: 2,
+ curve: "smooth",
+ },
+ markers: {
+ size: 0,
+ },
+ colors: ["#7e67fe"],
+ tooltip: {
+ fixed: {
+ enabled: false,
+ },
+ x: {
+ show: false,
+ },
+ y: {
+ title: {
+ formatter: function (seriesName) {
+ return "";
+ },
+ },
+ },
+ marker: {
+ show: false,
+ },
+ },
+ fill: {
+ opacity: [1],
+ type: ["gradient"],
+ gradient: {
+ type: "vertical",
+ // shadeIntensity: 1,
+ inverseColors: false,
+ opacityFrom: 0.5,
+ opacityTo: 0,
+ stops: [0, 100],
+ },
+ },
+ };
+
+ new ApexCharts(document.querySelector("#chart09"), options1).render();
+
+ var options1 = {
+ chart: {
+ type: "area",
+ height: 50,
+ sparkline: {
+ enabled: true,
+ },
+ },
+ series: [
+ {
+ data: [87, 54, 4, 76, 31, 95, 70, 92, 53, 9, 6],
+ },
+ ],
+ stroke: {
+ width: 2,
+ curve: "smooth",
+ },
+ markers: {
+ size: 0,
+ },
+ colors: ["#7e67fe"],
+ tooltip: {
+ fixed: {
+ enabled: false,
+ },
+ x: {
+ show: false,
+ },
+ y: {
+ title: {
+ formatter: function (seriesName) {
+ return "";
+ },
+ },
+ },
+ marker: {
+ show: false,
+ },
+ },
+ fill: {
+ opacity: [1],
+ type: ["gradient"],
+ gradient: {
+ type: "vertical",
+ // shadeIntensity: 1,
+ inverseColors: false,
+ opacityFrom: 0.5,
+ opacityTo: 0,
+ stops: [0, 100],
+ },
+ },
+ };
+
+ new ApexCharts(document.querySelector("#chart10"), options1).render();
+
+ var options1 = {
+ chart: {
+ type: "area",
+ height: 50,
+ sparkline: {
+ enabled: true,
+ },
+ },
+ series: [
+ {
+ data: [41, 42, 35, 42, 6, 12, 13, 22, 42, 94, 95],
+ },
+ ],
+ stroke: {
+ width: 2,
+ curve: "smooth",
+ },
+ markers: {
+ size: 0,
+ },
+ colors: ["#7e67fe"],
+ tooltip: {
+ fixed: {
+ enabled: false,
+ },
+ x: {
+ show: false,
+ },
+ y: {
+ title: {
+ formatter: function (seriesName) {
+ return "";
+ },
+ },
+ },
+ marker: {
+ show: false,
+ },
+ },
+ fill: {
+ opacity: [1],
+ type: ["gradient"],
+ gradient: {
+ type: "vertical",
+ // shadeIntensity: 1,
+ inverseColors: false,
+ opacityFrom: 0.5,
+ opacityTo: 0,
+ stops: [0, 100],
+ },
+ },
+ };
+
+ new ApexCharts(document.querySelector("#chart11"), options1).render();
+
+ // var options1 = {
+ // chart: {
+ // type: 'area',
+ // height: 50,
+ // sparkline: {
+ // enabled: true
+ // }
+ // },
+ // series: [{
+ // data: [8, 41, 40, 48, 77, 35, 0, 77, 63, 100, 71]
+ // }],
+ // stroke: {
+ // width: 2,
+ // curve: 'smooth'
+ // },
+ // markers: {
+ // size: 0
+ // },
+ // colors: ["#7e67fe"],
+ // tooltip: {
+ // fixed: {
+ // enabled: false
+ // },
+ // x: {
+ // show: false
+ // },
+ // y: {
+ // title: {
+ // formatter: function (seriesName) {
+ // return ''
+ // }
+ // }
+ // },
+ // marker: {
+ // show: false
+ // }
+ // },
+ // fill: {
+ // opacity: [1],
+ // type: ['gradient'],
+ // gradient: {
+ // type: "vertical",
+ // // shadeIntensity: 1,
+ // inverseColors: false,
+ // opacityFrom: 0.5,
+ // opacityTo: 0,
+ // stops: [0, 100]
+ // },
+ // },
+ // }
+
+ // new ApexCharts(document.querySelector("#chart12"), options1).render();
}
-
- new ApexCharts(document.querySelector("#chart01"), options1).render();
-
- var options1 = {
- chart: {
- type: 'area',
- height: 50,
- sparkline: {
- enabled: true
- }
- },
- series: [{
- data: [87, 54, 4, 76, 31, 95, 70, 92, 53, 9, 6]
- }],
- stroke: {
- width: 2,
- curve: 'smooth'
- },
- markers: {
- size: 0
- },
- colors: ["#7e67fe"],
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- },
- fill: {
- opacity: [1],
- type: ['gradient'],
- gradient: {
- type: "vertical",
- // shadeIntensity: 1,
- inverseColors: false,
- opacityFrom: 0.5,
- opacityTo: 0,
- stops: [0, 100]
- },
- },
- }
-
- new ApexCharts(document.querySelector("#chart02"), options1).render();
-
- var options1 = {
- chart: {
- type: 'area',
- height: 50,
- sparkline: {
- enabled: true
- }
- },
- series: [{
- data: [41, 42, 35, 42, 6, 12, 13, 22, 42, 94, 95]
- }],
- stroke: {
- width: 2,
- curve: 'smooth'
- },
- markers: {
- size: 0
- },
- colors: ["#7e67fe"],
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- },
- fill: {
- opacity: [1],
- type: ['gradient'],
- gradient: {
- type: "vertical",
- // shadeIntensity: 1,
- inverseColors: false,
- opacityFrom: 0.5,
- opacityTo: 0,
- stops: [0, 100]
- },
- },
- }
-
- new ApexCharts(document.querySelector("#chart03"), options1).render();
-
- // var options1 = {
- // chart: {
- // type: 'area',
- // height: 50,
- // sparkline: {
- // enabled: true
- // }
- // },
- // series: [{
- // data: [8, 41, 40, 48, 77, 35, 0, 77, 63, 100, 71]
- // }],
- // stroke: {
- // width: 2,
- // curve: 'smooth'
- // },
- // markers: {
- // size: 0
- // },
- // colors: ["#7e67fe"],
- // tooltip: {
- // fixed: {
- // enabled: false
- // },
- // x: {
- // show: false
- // },
- // y: {
- // title: {
- // formatter: function (seriesName) {
- // return ''
- // }
- // }
- // },
- // marker: {
- // show: false
- // }
- // },
- // fill: {
- // opacity: [1],
- // type: ['gradient'],
- // gradient: {
- // type: "vertical",
- // // shadeIntensity: 1,
- // inverseColors: false,
- // opacityFrom: 0.5,
- // opacityTo: 0,
- // stops: [0, 100]
- // },
- // },
- // }
-
- // new ApexCharts(document.querySelector("#chart04"), options1).render();
-
- // var options1 = {
- // chart: {
- // type: 'area',
- // height: 50,
- // sparkline: {
- // enabled: true
- // }
- // },
- // series: [{
- // data: [80, 100, 50, 30, 90]
- // }],
- // stroke: {
- // width: 2,
- // curve: 'smooth'
- // },
- // markers: {
- // size: 0
- // },
- // colors: ["#7e67fe"],
- // tooltip: {
- // fixed: {
- // enabled: false
- // },
- // x: {
- // show: false
- // },
- // y: {
- // title: {
- // formatter: function (seriesName) {
- // return ''
- // }
- // }
- // },
- // marker: {
- // show: false
- // }
- // },
- // fill: {
- // opacity: [1],
- // type: ['gradient'],
- // gradient: {
- // type: "vertical",
- // // shadeIntensity: 1,
- // inverseColors: false,
- // opacityFrom: 0.5,
- // opacityTo: 0,
- // stops: [0, 100]
- // },
- // },
- // }
-
- // new ApexCharts(document.querySelector("#chart05"), options1).render();
-
- var options1 = {
- chart: {
- type: 'area',
- height: 50,
- sparkline: {
- enabled: true
- }
- },
- series: [{
- data: [87, 54, 4, 76, 31, 95, 70, 92, 53, 9, 6]
- }],
- stroke: {
- width: 2,
- curve: 'smooth'
- },
- markers: {
- size: 0
- },
- colors: ["#7e67fe"],
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- },
- fill: {
- opacity: [1],
- type: ['gradient'],
- gradient: {
- type: "vertical",
- // shadeIntensity: 1,
- inverseColors: false,
- opacityFrom: 0.5,
- opacityTo: 0,
- stops: [0, 100]
- },
- },
- }
-
- new ApexCharts(document.querySelector("#chart06"), options1).render();
-
- var options1 = {
- chart: {
- type: 'area',
- height: 50,
- sparkline: {
- enabled: true
- }
- },
- series: [{
- data: [41, 42, 35, 42, 6, 12, 13, 22, 42, 94, 95]
- }],
- stroke: {
- width: 2,
- curve: 'smooth'
- },
- markers: {
- size: 0
- },
- colors: ["#7e67fe"],
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- },
- fill: {
- opacity: [1],
- type: ['gradient'],
- gradient: {
- type: "vertical",
- // shadeIntensity: 1,
- inverseColors: false,
- opacityFrom: 0.5,
- opacityTo: 0,
- stops: [0, 100]
- },
- },
- }
-
- new ApexCharts(document.querySelector("#chart07"), options1).render();
-
- var options1 = {
- chart: {
- type: 'area',
- height: 50,
- sparkline: {
- enabled: true
- }
- },
- series: [{
- data: [8, 41, 40, 48, 77, 35, 0, 77, 63, 100, 71]
- }],
- stroke: {
- width: 2,
- curve: 'smooth'
- },
- markers: {
- size: 0
- },
- colors: ["#7e67fe"],
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- },
- fill: {
- opacity: [1],
- type: ['gradient'],
- gradient: {
- type: "vertical",
- // shadeIntensity: 1,
- inverseColors: false,
- opacityFrom: 0.5,
- opacityTo: 0,
- stops: [0, 100]
- },
- },
- }
-
- new ApexCharts(document.querySelector("#chart08"), options1).render();
-
- var options1 = {
- chart: {
- type: 'area',
- height: 50,
- sparkline: {
- enabled: true
- }
- },
- series: [{
- data: [80, 100, 50, 30, 90]
- }],
- stroke: {
- width: 2,
- curve: 'smooth'
- },
- markers: {
- size: 0
- },
- colors: ["#7e67fe"],
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- },
- fill: {
- opacity: [1],
- type: ['gradient'],
- gradient: {
- type: "vertical",
- // shadeIntensity: 1,
- inverseColors: false,
- opacityFrom: 0.5,
- opacityTo: 0,
- stops: [0, 100]
- },
- },
- }
-
- new ApexCharts(document.querySelector("#chart09"), options1).render();
-
- var options1 = {
- chart: {
- type: 'area',
- height: 50,
- sparkline: {
- enabled: true
- }
- },
- series: [{
- data: [87, 54, 4, 76, 31, 95, 70, 92, 53, 9, 6]
- }],
- stroke: {
- width: 2,
- curve: 'smooth'
- },
- markers: {
- size: 0
- },
- colors: ["#7e67fe"],
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- },
- fill: {
- opacity: [1],
- type: ['gradient'],
- gradient: {
- type: "vertical",
- // shadeIntensity: 1,
- inverseColors: false,
- opacityFrom: 0.5,
- opacityTo: 0,
- stops: [0, 100]
- },
- },
- }
-
- new ApexCharts(document.querySelector("#chart10"), options1).render();
-
- var options1 = {
- chart: {
- type: 'area',
- height: 50,
- sparkline: {
- enabled: true
- }
- },
- series: [{
- data: [41, 42, 35, 42, 6, 12, 13, 22, 42, 94, 95]
- }],
- stroke: {
- width: 2,
- curve: 'smooth'
- },
- markers: {
- size: 0
- },
- colors: ["#7e67fe"],
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- },
- fill: {
- opacity: [1],
- type: ['gradient'],
- gradient: {
- type: "vertical",
- // shadeIntensity: 1,
- inverseColors: false,
- opacityFrom: 0.5,
- opacityTo: 0,
- stops: [0, 100]
- },
- },
- }
-
- new ApexCharts(document.querySelector("#chart11"), options1).render();
-
- // var options1 = {
- // chart: {
- // type: 'area',
- // height: 50,
- // sparkline: {
- // enabled: true
- // }
- // },
- // series: [{
- // data: [8, 41, 40, 48, 77, 35, 0, 77, 63, 100, 71]
- // }],
- // stroke: {
- // width: 2,
- // curve: 'smooth'
- // },
- // markers: {
- // size: 0
- // },
- // colors: ["#7e67fe"],
- // tooltip: {
- // fixed: {
- // enabled: false
- // },
- // x: {
- // show: false
- // },
- // y: {
- // title: {
- // formatter: function (seriesName) {
- // return ''
- // }
- // }
- // },
- // marker: {
- // show: false
- // }
- // },
- // fill: {
- // opacity: [1],
- // type: ['gradient'],
- // gradient: {
- // type: "vertical",
- // // shadeIntensity: 1,
- // inverseColors: false,
- // opacityFrom: 0.5,
- // opacityTo: 0,
- // stops: [0, 100]
- // },
- // },
- // }
-
- // new ApexCharts(document.querySelector("#chart12"), options1).render();
- }
}
-document.addEventListener('DOMContentLoaded', function (e) {
- new BigData().init();
-});
\ No newline at end of file
+document.addEventListener("DOMContentLoaded", function (e) {
+ let apiTokenMeta = document.querySelector("meta[name='api-token']");
+
+ if (apiTokenMeta && apiTokenMeta.content) {
+ let apiToken = apiTokenMeta.content;
+ localStorage.setItem("token", apiToken); // Simpan token ke localStorage
+ console.log("Token berhasil disimpan:", apiToken);
+ }
+ new BigData().init();
+});
diff --git a/resources/js/master/users/users.js b/resources/js/master/users/users.js
new file mode 100644
index 0000000..bd42f27
--- /dev/null
+++ b/resources/js/master/users/users.js
@@ -0,0 +1,60 @@
+import { Grid } from "gridjs/dist/gridjs.umd.js";
+import gridjs from "gridjs/dist/gridjs.umd.js";
+import "gridjs/dist/gridjs.umd.js";
+import GlobalConfig from "../../global-config";
+
+class UsersTable {
+ init() {
+ this.initTableUsers();
+ }
+
+ initTableUsers() {
+ new Grid({
+ columns: [
+ "ID",
+ "Name",
+ "Email",
+ "Firstname",
+ "Lastname",
+ "Position",
+ ],
+ pagination: {
+ limit: 15,
+ server: {
+ url: (prev, page) =>
+ `${prev}${prev.includes("?") ? "&" : "?"}page=${
+ page + 1
+ }`,
+ },
+ },
+ sort: true,
+ search: {
+ server: {
+ url: (prev, keyword) => `${prev}?search=${keyword}`,
+ },
+ },
+ server: {
+ url: `${GlobalConfig.apiHost}/api/users`,
+ credentials: "include",
+ headers: {
+ Authorization: `Bearer ${localStorage.getItem("token")}`,
+ "Content-Type": "application/json",
+ },
+ then: (data) =>
+ data.data.map((item) => [
+ item.id,
+ item.name,
+ item.email,
+ item.firstname,
+ item.lastname,
+ item.position,
+ ]),
+ total: (data) => data.meta.total,
+ },
+ }).render(document.getElementById("table-users"));
+ }
+}
+
+document.addEventListener("DOMContentLoaded", function (e) {
+ new UsersTable().init();
+});
diff --git a/resources/js/request-assignment/request-assignment.js b/resources/js/request-assignment/request-assignment.js
new file mode 100644
index 0000000..3c7ec21
--- /dev/null
+++ b/resources/js/request-assignment/request-assignment.js
@@ -0,0 +1,67 @@
+import { Grid } from "gridjs/dist/gridjs.umd.js";
+import "gridjs/dist/gridjs.umd.js";
+import GlobalConfig from "../global-config";
+
+class RequestAssignment {
+ init() {
+ this.initTableRequestAssignment();
+ }
+
+ initTableRequestAssignment() {
+ new Grid({
+ columns: [
+ "ID",
+ "Name",
+ "Condition",
+ "Registration Number",
+ "Document Number",
+ "Address",
+ "Status",
+ "Function Type",
+ "Consultation Type",
+ "Due Date",
+ ],
+ search: {
+ server: {
+ url: (prev, keyword) => `${prev}?search=${keyword}`,
+ },
+ },
+ pagination: {
+ limit: 15,
+ server: {
+ url: (prev, page) =>
+ `${prev}${prev.includes("?") ? "&" : "?"}page=${
+ page + 1
+ }`,
+ },
+ },
+ sort: true,
+ server: {
+ url: `${GlobalConfig.apiHost}/api/request-assignments`,
+ credentials: "include",
+ headers: {
+ Authorization: `Bearer ${localStorage.getItem("token")}`,
+ "Content-Type": "application/json",
+ },
+ then: (data) =>
+ data.data.map((item) => [
+ item.id,
+ item.name,
+ item.condition,
+ item.registration_number,
+ item.document_number,
+ item.address,
+ item.status_name,
+ item.function_type,
+ item.consultation_type,
+ item.due_date,
+ ]),
+ total: (data) => data.meta.total,
+ },
+ }).render(document.getElementById("table-request-assignment"));
+ }
+}
+
+document.addEventListener("DOMContentLoaded", function (e) {
+ new RequestAssignment().init();
+});
diff --git a/resources/js/settings/general/general-settings.js b/resources/js/settings/general/general-settings.js
index d205482..ef29a76 100644
--- a/resources/js/settings/general/general-settings.js
+++ b/resources/js/settings/general/general-settings.js
@@ -29,24 +29,26 @@ class SyncronizeTask {
},
},
],
+ search: {
+ server: {
+ url: (prev, keyword) => `${prev}?search=${keyword}`,
+ },
+ },
pagination: {
limit: 15,
server: {
- url: (prev, page, limit) => `${prev}?page=${page}`,
+ url: (prev, page) =>
+ `${prev}${prev.includes("?") ? "&" : "?"}page=${
+ page + 1
+ }`,
},
},
sort: true,
- search: {
- server: {
- url: (prev, page, keyword) =>
- `${prev}?page=${page}&search=${keyword}`,
- },
- },
server: {
url: `${GlobalConfig.apiHost}/api/global-settings`,
headers: {
Authorization: `Bearer ${document
- .querySelector('meta[name="csrf-token"]')
+ .querySelector('meta[name="api-token"]')
.getAttribute("content")}`,
"Content-Type": "application/json",
},
@@ -59,6 +61,7 @@ class SyncronizeTask {
item.created_at,
item.id,
]),
+ total: (data) => data.meta.total,
},
});
table.render(document.getElementById("general-setting-table"));
@@ -100,9 +103,6 @@ class SyncronizeTask {
}
}
}
-document.addEventListener("click", function (e) {
- handleDelete(e); // Call the function on click event
-});
document.addEventListener("DOMContentLoaded", function (e) {
new SyncronizeTask().init();
});
diff --git a/resources/js/settings/syncronize/syncronize.js b/resources/js/settings/syncronize/syncronize.js
index c16e9b1..eb10c58 100644
--- a/resources/js/settings/syncronize/syncronize.js
+++ b/resources/js/settings/syncronize/syncronize.js
@@ -1,52 +1,67 @@
import { Grid } from "gridjs/dist/gridjs.umd.js";
-import gridjs from 'gridjs/dist/gridjs.umd.js'
-import 'gridjs/dist/gridjs.umd.js'
+import gridjs from "gridjs/dist/gridjs.umd.js";
+import "gridjs/dist/gridjs.umd.js";
import GlobalConfig from "../../global-config.js";
class SyncronizeTask {
- init(){
- this.initTableImportDatasources();
- this.onSyncSubmit();
- }
- initTableImportDatasources(){
- new Grid({
- columns: [
- "ID", "Message", "Response", "Status", "Created",
- ],
- pagination: {
- limit: 15,
- server: {
- url: (prev, page, limit) => `${prev}?page=${page}`
- }
- },
- sort: true,
- search: {
- server: {
- url: (prev, page, keyword) => `${prev}?page=${page}&search=${keyword}`
- }
- },
- server: {
- url: `${GlobalConfig.apiHost}/api/import-datasource`,
- then: data => data.data.map((item) => [item.id, item.message, item.response_body, item.status, item.created_at])
- }
- }).render(document.getElementById("table-import-datasources"));
- }
- onSyncSubmit(){
- const form = document.getElementById("sync-form");
- if(form){
- form.addEventListener("submit", function (event) {
- event.preventDefault(); // Prevent the default form submission
-
- const button = document.getElementById("btn-sync-submit");
- if (button) {
- button.disabled = true;
- button.innerText = "Processing...";
- }
- form.submit();
- });
+ init() {
+ this.initTableImportDatasources();
+ this.onSyncSubmit();
+ }
+ initTableImportDatasources() {
+ new Grid({
+ columns: ["ID", "Message", "Response", "Status", "Created"],
+ search: {
+ server: {
+ url: (prev, keyword) => `${prev}?search=${keyword}`,
+ },
+ },
+ pagination: {
+ limit: 15,
+ server: {
+ url: (prev, page) =>
+ `${prev}${prev.includes("?") ? "&" : "?"}page=${
+ page + 1
+ }`,
+ },
+ },
+ sort: true,
+ server: {
+ url: `${GlobalConfig.apiHost}/api/import-datasource`,
+ headers: {
+ Authorization: `Bearer ${document
+ .querySelector('meta[name="api-token"]')
+ .getAttribute("content")}`,
+ "Content-Type": "application/json",
+ },
+ then: (data) =>
+ data.data.map((item) => [
+ item.id,
+ item.message,
+ item.response_body,
+ item.status,
+ item.created_at,
+ ]),
+ total: (data) => data.meta.total,
+ },
+ }).render(document.getElementById("table-import-datasources"));
+ }
+ onSyncSubmit() {
+ const form = document.getElementById("sync-form");
+ if (form) {
+ form.addEventListener("submit", function (event) {
+ event.preventDefault(); // Prevent the default form submission
+
+ const button = document.getElementById("btn-sync-submit");
+ if (button) {
+ button.disabled = true;
+ button.innerText = "Processing...";
+ }
+ form.submit();
+ });
+ }
}
- }
}
-document.addEventListener('DOMContentLoaded', function (e) {
- new SyncronizeTask().init();
-});
\ No newline at end of file
+document.addEventListener("DOMContentLoaded", function (e) {
+ new SyncronizeTask().init();
+});
diff --git a/resources/js/tables/common-table.js b/resources/js/tables/common-table.js
index f6d640a..997d554 100644
--- a/resources/js/tables/common-table.js
+++ b/resources/js/tables/common-table.js
@@ -1,128 +1,70 @@
import { Grid } from "gridjs/dist/gridjs.umd.js";
-import gridjs from 'gridjs/dist/gridjs.umd.js'
-import 'gridjs/dist/gridjs.umd.js'
+import gridjs from "gridjs/dist/gridjs.umd.js";
+import "gridjs/dist/gridjs.umd.js";
import GlobalConfig from "../global-config";
class CommonTable {
- init() {
- // this.CommonTableInit();
- this.CommonTableInitWithFetchApi();
- }
+ init() {
+ // this.CommonTableInit();
+ this.CommonTableInitWithFetchApi();
+ }
- CommonTableInit() {
- new Grid({
- columns: [
- {
- name: 'ID',
- formatter: (function (cell) {
- return gridjs.html('' + cell + ' ');
- })
- },
- "Name",
- {
- name: 'Email',
- formatter: (function (cell) {
- return gridjs.html('' + cell + ' ');
- })
- },
- "Position", "Company", "Country",
- {
- name: 'Actions',
- width: '120px',
- formatter: (function (cell) {
- return gridjs.html(`
+ CommonTableInitWithFetchApi() {
+ fetch(`${GlobalConfig.apiHost}/api/users`)
+ .then((response) => response.json())
+ .then((data) => {
+ console.log("check log response");
+ console.log(data.data);
+ new Grid({
+ columns: [
+ {
+ name: "id",
+ formatter: function (cell) {
+ return gridjs.html(
+ '' +
+ cell +
+ " "
+ );
+ },
+ },
+ "name",
+ {
+ name: "email",
+ formatter: function (cell) {
+ return gridjs.html(
+ '' + cell + " "
+ );
+ },
+ },
+ "position",
+ "firstname",
+ "lastname",
+ {
+ name: "Actions",
+ width: "120px",
+ formatter: function (cell) {
+ return gridjs.html(`
`);
- })
- },
- ],
- pagination: {
- limit: 10
- },
- sort: true,
- search: true,
- data: [
- ["11", "Alice", "alice@example.com", "Software Engineer", "ABC Company", "United States"],
- ["12", "Bob", "bob@example.com", "Product Manager", "XYZ Inc", "Canada"],
- ["13", "Charlie", "charlie@example.com", "Data Analyst", "123 Corp", "Australia"],
- ["14", "David", "david@example.com", "UI/UX Designer", "456 Ltd", "United Kingdom"],
- ["15", "Eve", "eve@example.com", "Marketing Specialist", "789 Enterprises", "France"],
- ["11", "Alice", "alice@example.com", "Software Engineer", "ABC Company", "United States"],
- ["12", "Bob", "bob@example.com", "Product Manager", "XYZ Inc", "Canada"],
- ["13", "Charlie", "charlie@example.com", "Data Analyst", "123 Corp", "Australia"],
- ["14", "David", "david@example.com", "UI/UX Designer", "456 Ltd", "United Kingdom"],
- ["15", "Eve", "eve@example.com", "Marketing Specialist", "789 Enterprises", "France"],
- ["11", "Alice", "alice@example.com", "Software Engineer", "ABC Company", "United States"],
- ["12", "Bob", "bob@example.com", "Product Manager", "XYZ Inc", "Canada"],
- ["13", "Charlie", "charlie@example.com", "Data Analyst", "123 Corp", "Australia"],
- ["14", "David", "david@example.com", "UI/UX Designer", "456 Ltd", "United Kingdom"],
- ["15", "Eve", "eve@example.com", "Marketing Specialist", "789 Enterprises", "France"],
- ["11", "Alice", "alice@example.com", "Software Engineer", "ABC Company", "United States"],
- ["12", "Bob", "bob@example.com", "Product Manager", "XYZ Inc", "Canada"],
- ["13", "Charlie", "charlie@example.com", "Data Analyst", "123 Corp", "Australia"],
- ["14", "David", "david@example.com", "UI/UX Designer", "456 Ltd", "United Kingdom"],
- ["15", "Eve", "eve@example.com", "Marketing Specialist", "789 Enterprises", "France"],
- ["16", "Frank", "frank@example.com", "HR Manager", "ABC Company", "Germany"],
- ["17", "Grace", "grace@example.com", "Financial Analyst", "XYZ Inc", "Japan"],
- ["18", "Hannah", "hannah@example.com", "Sales Representative", "123 Corp", "Brazil"],
- ["19", "Ian", "ian@example.com", "Software Developer", "456 Ltd", "India"],
- ["20", "Jane", "jane@example.com", "Operations Manager", "789 Enterprises", "China"]
- ]
- }).render(document.getElementById("common-table"));
- }
-
- CommonTableInitWithFetchApi(){
- fetch(`${GlobalConfig.apiHost}/api/users`)
- .then((response) => response.json())
- .then((data) => {
- console.log("check log response");
- console.log(data.data);
- new Grid({
- columns: [
- {
- name: 'id',
- formatter: (function (cell) {
- return gridjs.html('' + cell + ' ');
+ },
+ },
+ ],
+ pagination: {
+ limit: 10,
+ },
+ sort: true,
+ search: true,
+ data: data,
+ }).render(document.getElementById("common-table"));
})
- },
- "name",
- {
- name: 'email',
- formatter: (function (cell) {
- return gridjs.html('' + cell + ' ');
- })
- },
- "position", "firstname", "lastname",
- {
- name: 'Actions',
- width: '120px',
- formatter: (function (cell) {
- return gridjs.html(`
-
- `);
- })
- },
- ],
- pagination: {
- limit: 10
- },
- sort: true,
- search: true,
- data: data
- }).render(document.getElementById("common-table"));
- })
- .catch((error) => console.error("Error fetching data: " + error));
- }
+ .catch((error) => console.error("Error fetching data: " + error));
+ }
}
-document.addEventListener('DOMContentLoaded', function (e) {
- new CommonTable().init();
-});
\ No newline at end of file
+document.addEventListener("DOMContentLoaded", function (e) {
+ new CommonTable().init();
+});
diff --git a/resources/views/auth/signin.blade.php b/resources/views/auth/signin.blade.php
index d031bca..a7fe03b 100755
--- a/resources/views/auth/signin.blade.php
+++ b/resources/views/auth/signin.blade.php
@@ -39,25 +39,25 @@ class="authentication-bg"
- --}}
Sign In
- Don't have an account?
+ {{--
Don't have an account?
Sign Up
-
+
--}}
diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php
index 23d45f3..4652c90 100644
--- a/resources/views/layouts/partials/sidebar.blade.php
+++ b/resources/views/layouts/partials/sidebar.blade.php
@@ -29,7 +29,7 @@
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/resources/views/master/users/index.blade.php b/resources/views/master/users/index.blade.php
index c5a58e0..bc43da0 100644
--- a/resources/views/master/users/index.blade.php
+++ b/resources/views/master/users/index.blade.php
@@ -10,16 +10,16 @@
@endsection
@section('scripts')
-@vite(['resources/js/tables/common-table.js'])
+@vite(['resources/js/master/users/users.js'])
@endsection
\ No newline at end of file
diff --git a/resources/views/request-assignment/index.blade.php b/resources/views/request-assignment/index.blade.php
index 8b3e623..21460d5 100644
--- a/resources/views/request-assignment/index.blade.php
+++ b/resources/views/request-assignment/index.blade.php
@@ -10,14 +10,12 @@
-
Request Assignment Page
-
-
@endsection
@section('scripts')
+@vite(['resources/js/request-assignment/request-assignment.js'])
@endsection
\ No newline at end of file
diff --git a/resources/views/settings/general/index.blade.php b/resources/views/settings/general/index.blade.php
index 0917f4c..93cefed 100644
--- a/resources/views/settings/general/index.blade.php
+++ b/resources/views/settings/general/index.blade.php
@@ -1,4 +1,4 @@
-@extends('layouts.vertical', ['subtitle' => 'Syncronize'])
+@extends('layouts.vertical', ['subtitle' => 'General'])
@section('css')
@vite(['node_modules/gridjs/dist/theme/mermaid.min.css'])
@@ -6,7 +6,7 @@
@section('content')
-@include('layouts.partials/page-title', ['title' => 'Settings', 'subtitle' => 'Syncronize'])
+@include('layouts.partials/page-title', ['title' => 'Settings', 'subtitle' => 'General'])
diff --git a/routes/api.php b/routes/api.php
index 0ecdcf3..d674cf2 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -11,12 +11,24 @@ use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
-Route::get('/user', function (Request $request) {
- return $request->user();
-})->middleware('auth:sanctum');
+// Route::get('/user', function (Request $request) {
+// return $request->user();
+// })->middleware('auth:sanctum');
-Route::group(['middleware' => 'auth:scantum'], function (){
+Route::post('/login', [UsersController::class, 'login'])->name('api.user.login');
+Route::group(['middleware' => 'auth:sanctum'], function (){
+ // users
+ Route::get('/users', [UsersController::class, 'index'])->name('users');
+ Route::post('/logout', [UsersController::class, 'logout'])->name('api.user.logout');
+
+ // global settings
Route::apiResource('global-settings', GlobalSettingsController::class);
+
+ // import datasource
+ Route::apiResource('import-datasource',ImportDatasourceController::class);
+
+ // request assignments
+ Route::apiResource('request-assignments',RequestAssignmentController::class);
});
Route::controller(DashboardController::class)->group(function(){
Route::get('/business-documents','businnessDocument');
@@ -24,19 +36,8 @@ Route::controller(DashboardController::class)->group(function(){
Route::get('/all-task-documents', 'allTaskDocuments');
});
-Route::get('/users', [UsersController::class, 'index'])->name('users');
-Route::post('/login', [UsersController::class, 'login'])->name('api.user.login');
Route::get('/sync-task', [SyncronizeController::class, 'syncPbgTask'])->name('api.task');
Route::get('/get-user-token', [SyncronizeController::class, 'getUserToken'])->name('api.task.token');
Route::get('/get-index-integration-retribution/{uuid}', [SyncronizeController::class, 'syncIndexIntegration'])->name('api.task.inntegration');
-Route::get('/sync-task-submit/{uuid}', [SyncronizeController::class, 'syncTaskDetailSubmit'])->name('api.task.submit');
-
-// import datasource
-Route::apiResource('import-datasource',ImportDatasourceController::class);
-
-// global setting
-
-
-// request assignment
-Route::apiResource('request-assignments',RequestAssignmentController::class);
\ No newline at end of file
+Route::get('/sync-task-submit/{uuid}', [SyncronizeController::class, 'syncTaskDetailSubmit'])->name('api.task.submit');
\ No newline at end of file
diff --git a/routes/web.php b/routes/web.php
index 5a18bc9..e923b62 100755
--- a/routes/web.php
+++ b/routes/web.php
@@ -10,52 +10,28 @@ use Illuminate\Support\Facades\Route;
require __DIR__ . '/auth.php';
-// Route::group(['prefix' => '/', 'middleware' => 'auth'], function () {
-// // Route::get('', [RoutingController::class, 'index'])->name('root');
-// Route::get('{first}/{second}/{third}', [RoutingController::class, 'thirdLevel'])->name('third');
-// Route::get('{first}/{second}', [RoutingController::class, 'secondLevel'])->name('second');
-// // Route::get('{any}', [RoutingController::class, 'root'])->name('any');
-// });
-
// auth
Route::group(['middleware' => 'auth'], function(){
-
- // landing page
- Route::get('', [HomeController::class, 'index'])->name('home');
//dashboards
Route::group(['prefix' => '/dashboards'], function(){
- Route::get('/bigdata', [BigDataController::class, 'index'])->name('dashboards.bigdata');
+ Route::get('/bigdata', [BigDataController::class, 'index'])->name('home');
});
// settings
Route::group(['prefix' => '/settings'], function(){
Route::resource('/general', SettingsController::class);
Route::get('/syncronize', [SyncronizeController::class, 'index'])->name('settings.syncronize');
- // Route::get('/general', [SettingsController::class, 'index'])->name('settings.general');
Route::post('/syncronize', [SyncronizeController::class, 'syncronizeTask'])->name('settings.sync');
});
// masters
Route::group(['prefix' => '/master'], function (){
- // Route::controller(UsersController::class)->group(function(){
- // Route::get('/users', 'index')->name('master.users');
- // Route::get('/users/create', 'create')->name('master.users.create');
- // Route::post('/users/store', 'store')->name('master.users.store');
- // Route::get('/users/edit/{id}', 'edit')->name('master.users.edit');
- // Route::put('/users/update/{id}', 'edit')->name('master.users.edit');
- // });
- Route::get('/users', [UsersController::class, 'index'])->name('master.users');
- Route::get('/users/create', [UsersController::class, 'create'])->name('master.users.create');
- Route::post('/users/store', [UsersController::class, 'store'])->name('master.users.store');
- Route::get('/users/edit/{id}', [UsersController::class, 'edit'])->name('master.users.edit');
- Route::put('/users/update', [UsersController::class, 'update'])->name('master.users.update');
- Route::delete('/users/delete/{id}', [UsersController::class, 'delete'])->name('master.users.delete');
- Route::delete('/users/show/{id}', [UsersController::class, 'show'])->name('master.users.show');
+ Route::resource('/users', UsersController::class);
+ Route::get('/all-users', [UsersController::class, 'allUsers'])->name('users.all');
});
// request assignments
-
Route::group(['prefix' => '/request-assignments'], function(){
Route::controller(PbgTaskController::class)->group(function(){
Route::get('/index', 'index')->name('request-assignments.index');