diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 3666085..3d20250 100755 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,8 @@ namespace App\Providers; +use App\View\Components\Circle; +use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Carbon\Carbon; @@ -20,6 +22,6 @@ class AppServiceProvider extends ServiceProvider */ public function boot(): void { - + Blade::component('circle', Circle::class); } } diff --git a/app/View/Components/Circle.php b/app/View/Components/Circle.php new file mode 100644 index 0000000..1acfd0b --- /dev/null +++ b/app/View/Components/Circle.php @@ -0,0 +1,32 @@ +document_title = $document_title; + $this->document_color = $document_color; + $this->document_type = $document_type; + $this->document_id = $document_id; + $this->visible_small_circle = $visible_small_circle; + } + + /** + * Get the view / contents that represent the component. + */ + public function render(): View|Closure|string + { + return view('components.circle'); + } +} diff --git a/resources/js/dashboards/bigdata.js b/resources/js/dashboards/bigdata.js index ac928cb..4ea6c11 100644 --- a/resources/js/dashboards/bigdata.js +++ b/resources/js/dashboards/bigdata.js @@ -1,6 +1,5 @@ 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"; @@ -37,12 +36,18 @@ class BigData { }) .then((data) => { const seriesData = data.data.series; - document.getElementById( - "countTargetPAD" - ).innerText = `${data.data.count} Berkas`; + document.querySelectorAll('.document-count.chart-all-task').forEach((element) => { + element.innerText = `${data.data.count}`; + }); + document.querySelectorAll('.document-total.chart-all-task').forEach((element) => { + element.innerText = `Rp.${addThousandSeparators(data.data.total)}`; + }); document.getElementById( "totalTargetPAD" ).innerText = `Rp.${addThousandSeparators(data.data.total)}`; + document.getElementById( + "countTargetPAD" + ).innerText = `${data.data.count} Berkas`; var options1 = { chart: { type: "area", @@ -122,6 +127,12 @@ class BigData { }) .then((data) => { const seriesData = data.data.series; + document.querySelectorAll('.document-count.chart-non-business').forEach((element) => { + element.innerText = `${data.data.count}`; + }); + document.querySelectorAll('.document-total.chart-non-business').forEach((element) => { + element.innerText = `Rp.${addThousandSeparators(data.data.total)}`; + }); document.getElementById( "countBusinessDocuments" ).innerText = `${data.data.count} Berkas`; @@ -207,6 +218,12 @@ class BigData { }) .then((data) => { const seriesData = data.data.series; + document.querySelectorAll('.document-count.chart-business').forEach((element) => { + element.innerText = `${data.data.count}`; + }); + document.querySelectorAll('.document-total.chart-business').forEach((element) => { + element.innerText = `Rp.${addThousandSeparators(data.data.total)}`; + }); document.getElementById( "countNonUsaha" ).innerText = `${data.data.count} Berkas`; @@ -1036,6 +1053,63 @@ class BigData { } } +class ArrowConnectorCircles { + // Fungsi untuk membuat garis dengan panah + drawArrow(startElement, endElement) { + const svg = document.getElementById("arrow-svg"); + const startRect = startElement.getBoundingClientRect(); + const endRect = endElement.getBoundingClientRect(); + + // Hitung posisi pusat dari setiap lingkaran + const startX = startRect.left + startRect.width / 2; + const startY = startRect.top + startRect.height / 2; + const endX = endRect.left + endRect.width / 2; + const endY = endRect.top + endRect.height / 2; + + // Bersihkan isi SVG sebelum menggambar ulang + svg.innerHTML = ""; + + // Buat elemen garis + const arrowLine = document.createElementNS("http://www.w3.org/2000/svg", "line"); + arrowLine.setAttribute("x1", startX); + arrowLine.setAttribute("y1", startY); + arrowLine.setAttribute("x2", endX); + arrowLine.setAttribute("y2", endY); + arrowLine.setAttribute("stroke", "black"); + arrowLine.setAttribute("stroke-width", "2"); + + // Buat elemen panah + const arrowHead = document.createElementNS("http://www.w3.org/2000/svg", "polygon"); + const arrowSize = 10; + const angle = Math.atan2(endY - startY, endX - startX); + const arrowPoint1X = endX - arrowSize * Math.cos(angle - Math.PI / 6); + const arrowPoint1Y = endY - arrowSize * Math.sin(angle - Math.PI / 6); + const arrowPoint2X = endX - arrowSize * Math.cos(angle + Math.PI / 6); + const arrowPoint2Y = endY - arrowSize * Math.sin(angle + Math.PI / 6); + + arrowHead.setAttribute( + "points", + `${endX},${endY} ${arrowPoint1X},${arrowPoint1Y} ${arrowPoint2X},${arrowPoint2Y}` + ); + arrowHead.setAttribute("fill", "black"); + + // Tambahkan garis dan panah ke SVG + svg.appendChild(arrowLine); + svg.appendChild(arrowHead); + } + init(){ + const circle1 = document.getElementById("chart-not-verified"); + const circle2 = document.getElementById("chart-all-task"); + + // Gambar panah antara dua lingkaran + this.drawArrow(circle1, circle2); + + // Tambahkan event listener jika ingin garis berubah sesuai posisi dinamis (opsional) + document.addEventListener("resize", () => drawArrow(circle1, circle2)); + } +} + document.addEventListener("DOMContentLoaded", function (e) { new BigData().init(); + // new ArrowConnectorCircles().init(); }); diff --git a/resources/scss/components/_circle.scss b/resources/scss/components/_circle.scss new file mode 100644 index 0000000..c694291 --- /dev/null +++ b/resources/scss/components/_circle.scss @@ -0,0 +1,227 @@ +:root { + --circle-color: #c97a04; /* Default warna lingkaran */ +} + +.circle-container { + width: 250px; /* Ukuran lingkaran */ + height: 250px; + display: flex; + align-items: center; + justify-content: center; + background-color: var(--circle-color);; /* Warna lingkaran utama */ + border-radius: 50%; /* Membuat lingkaran */ + border: 6px solid white; /* Border putih */ + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Efek bayangan */ + position: relative; + + .circle-content { + width: 200px; /* Ukuran lingkaran dalam */ + height: 200px; + background-color: var(--circle-color); /* Warna lingkaran dalam */ + border-radius: 50%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + text-align: center; + color: white; /* Warna teks */ + border: 4px solid white; /* Border lingkaran dalam */ + padding: 10px; + box-sizing: border-box; + } + + .circle-content .document-title { + font-size: 14px; + font-weight: bold; + margin: 0 5px; + line-height: 1.5; + } + + .circle-content .document-total { + font-size: 14px; + font-weight: bold; + color: #000000; /* Warna biru gelap untuk total */ + background-color: white; /* Background putih untuk total */ + padding: 0 7px; + border-radius: 10px; + margin: 0; + } + + .circle-content .document-count { + font-size: 24px; + font-weight: bold; + margin: 0; + } + + .circle-content .document-type { + font-size: 14px; + margin: 0; + } + + .small-circle-container { + position: absolute; + bottom: 0; + right: 0; + width: 80px; /* Ukuran lingkaran kecil */ + height: 80px; + background-color: #2d4f90; /* Warna lingkaran kecil */ + border-radius: 50%; /* Membuat lingkaran */ + // border: 4px solid white; /* Border putih */ + display: flex; + align-items: center; + justify-content: center; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Efek bayangan */ + + .small-circle-content{ + width: 70px; + height: 70px; + background-color: #2d4f90; /* Warna lingkaran kecil */ + border-radius: 50%; /* Membuat lingkaran */ + border: 4px solid white; /* Border putih */ + display: flex; + align-items: center; + justify-content: center; + + .small-percentage { + font-size: 14px; + font-weight: bold; + color: white; /* Warna teks */ + margin: 0; + } + } + + } +} + + + +.arrow-container { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + pointer-events: none; /* Agar SVG tidak menghalangi interaksi */ +} + + +// .circle-container { +// width: 20vw; /* Responsif menggunakan unit viewport */ +// height: 20vw; /* Pastikan tinggi sama dengan lebar */ +// display: flex; +// align-items: center; +// justify-content: center; +// background-color: var(--circle-color); /* Warna lingkaran utama */ +// border-radius: 50%; /* Membuat lingkaran */ +// border: 0.4vw solid white; /* Border putih responsif */ +// box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Efek bayangan */ +// position: relative; +// min-width: 150px; /* Ukuran minimum untuk layar kecil */ +// min-height: 150px; +// } + +// .circle-content { +// width: 85%; /* 85% dari ukuran lingkaran luar */ +// height: 85%; +// background-color: var(--circle-color); /* Warna lingkaran dalam */ +// border-radius: 50%; +// display: flex; +// flex-direction: column; +// align-items: center; +// justify-content: center; +// text-align: center; +// color: white; /* Warna teks */ +// border: 0.4vw solid white; /* Border lingkaran dalam responsif */ +// padding: 10px; +// box-sizing: border-box; +// } + +// .circle-content .document-title { +// font-size: 1.2vw; /* Font responsif berbasis viewport */ +// font-weight: bold; +// margin: 0 10px; +// line-height: 1.5; +// } + +// .circle-content .document-total { +// font-size: 1.2vw; /* Font responsif */ +// font-weight: bold; +// color: #000000; /* Warna biru gelap untuk total */ +// background-color: white; /* Background putih untuk total */ +// padding: 0.5vw 0.2vw; +// border-radius: 10px; +// margin: 5px 0; +// } + +// .circle-content .document-count { +// font-size: 2vw; /* Font responsif besar */ +// font-weight: bold; +// margin: 0; +// } + +// .circle-content .document-type { +// font-size: 1.4vw; +// margin: 0; +// } + +// /* Media Query untuk layar lebih kecil (tablet) */ +// @media (max-width: 768px) { +// .circle-container { +// width: 40vw; +// height: 40vw; +// border-width: 2vw; /* Border lebih besar di layar kecil */ +// } + +// .circle-content { +// width: 90%; +// height: 90%; +// border-width: 1vw; +// } + +// .circle-content .document-title { +// font-size: 3vw; +// } + +// .circle-content .document-total { +// font-size: 2.5vw; +// padding: 1vw; +// } + +// .circle-content .document-count { +// font-size: 5vw; +// } + +// .circle-content .document-type { +// font-size: 3vw; +// } +// } + +// /* Media Query untuk layar sangat kecil (ponsel) */ +// @media (max-width: 480px) { +// .circle-container { +// width: 50vw; +// height: 50vw; +// border-width: 3vw; +// } + +// .circle-content { +// width: 95%; +// height: 95%; +// } + +// .circle-content .document-title { +// font-size: 4vw; +// } + +// .circle-content .document-total { +// font-size: 3.5vw; +// } + +// .circle-content .document-count { +// font-size: 6vw; +// } + +// .circle-content .document-type { +// font-size: 4vw; +// } +// } diff --git a/resources/scss/style.scss b/resources/scss/style.scss index 71849bb..9b3c671 100755 --- a/resources/scss/style.scss +++ b/resources/scss/style.scss @@ -45,6 +45,8 @@ @import "components/tooltip"; @import "components/widgets"; +// custom components +@import "components/circle"; // Plugin @import "plugins/simplebar"; diff --git a/resources/views/components/circle.blade.php b/resources/views/components/circle.blade.php new file mode 100644 index 0000000..7453871 --- /dev/null +++ b/resources/views/components/circle.blade.php @@ -0,0 +1,19 @@ +@section('css') +@vite(['resources/scss/components/_circle.scss']) +@endsection + +
{{$document_title}}
+Rp.0
+0
+{{$document_type}}
+0%
+