Merge branch 'bug-fix/tourisms' into feat/dashboard-kekurangan-potensi
This commit is contained in:
@@ -5,37 +5,38 @@ import GlobalConfig from "../../global-config.js";
|
||||
import GeneralTable from "../../table-generator.js";
|
||||
|
||||
const dataTourismsColumns = [
|
||||
"Proyek ID",
|
||||
"Jenis Proyek",
|
||||
"NIB",
|
||||
"Nama Perusahaan",
|
||||
"Terbit OSS",
|
||||
"Status Penanaman Modal",
|
||||
"Bentuk Bisnis",
|
||||
"Uraian Resiko Proyek",
|
||||
"Nama Proyek",
|
||||
"Alamat Usaha",
|
||||
"Kecamatan",
|
||||
"Desa",
|
||||
"Luas Tanah",
|
||||
"Luas Tanah (m2)",
|
||||
"Jumlah Investasi",
|
||||
"TKI",
|
||||
"Tipe Usaha",
|
||||
"Longitude",
|
||||
"Latitude",
|
||||
{
|
||||
name: "Actions",
|
||||
widht: "120px",
|
||||
formatter: function (cell, row) {
|
||||
const id = row.cells[16].data;
|
||||
const id = row.cells[10].data;
|
||||
const long = row.cells[8].data;
|
||||
const lat = row.cells[9].data;
|
||||
const model = "data/tourisms";
|
||||
return gridjs.html(`
|
||||
<div class="d-flex justify-items-end gap-10">
|
||||
<button class="btn btn-warning me-2 btn-edit"
|
||||
data-id="${id}"
|
||||
data-model="${model}">
|
||||
<i class='bx bx-edit' ></i></button>
|
||||
<i class='bx bx-edit'></i></button>
|
||||
|
||||
<button class="btn btn-info me-2 btn-view"
|
||||
data-long="${long}" data-lat="${lat}">
|
||||
<i class='bx bx-map'></i></button>
|
||||
|
||||
<button class="btn btn-red btn-delete"
|
||||
data-id="${id}">
|
||||
<i class='bx bxs-trash' ></i></button>
|
||||
data-id="${id}">
|
||||
<i class='bx bxs-trash'></i></button>
|
||||
</div>
|
||||
`);
|
||||
},
|
||||
@@ -53,26 +54,42 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
table.processData = function (data) {
|
||||
return data.data.map((item) => {
|
||||
return [
|
||||
item.project_id,
|
||||
item.jenis_proyek,
|
||||
item.nib,
|
||||
item.business_name,
|
||||
item.terbit_oss,
|
||||
item.status_penanaman_modal,
|
||||
item.business_form,
|
||||
item.uraian_resiko_proyek,
|
||||
item.project_name,
|
||||
item.business_address,
|
||||
item.district_name,
|
||||
item.village_name,
|
||||
item.land_area,
|
||||
item.land_area_in_m2,
|
||||
item.investment_amount,
|
||||
item.number_of_employee,
|
||||
item.business_type,
|
||||
item.tki,
|
||||
item.longitude,
|
||||
item.latitude,
|
||||
item.id,
|
||||
];
|
||||
});
|
||||
};
|
||||
|
||||
table.init();
|
||||
|
||||
// Event listener untuk tombol "View" yang memunculkan modal
|
||||
document.addEventListener("click", function (e) {
|
||||
if (e.target && e.target.classList.contains("btn-view")) {
|
||||
const long = e.target.getAttribute("data-long");
|
||||
const lat = e.target.getAttribute("data-lat");
|
||||
|
||||
// Menyiapkan URL iframe dengan koordinat yang didapatkan
|
||||
const iframeSrc = `https://www.google.com/maps?q=${lat},${long}&hl=es;z=14&output=embed`;
|
||||
|
||||
// Menemukan modal dan iframe di dalam modal
|
||||
const modal = document.querySelector(".modalGMaps");
|
||||
const iframe = modal.querySelector("iframe");
|
||||
|
||||
// Set src iframe untuk menampilkan peta dengan koordinat yang relevan
|
||||
iframe.src = iframeSrc;
|
||||
|
||||
// Menampilkan modal
|
||||
var modalInstance = new bootstrap.Modal(modal);
|
||||
modalInstance.show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,14 +2,14 @@ import gridjs from "gridjs/dist/gridjs.umd.js";
|
||||
import "gridjs/dist/gridjs.umd.js";
|
||||
|
||||
// Mengambil data dari input dengan id="business_type_counts"
|
||||
const businessTypeCountsElement = document.getElementById("business_type_counts");
|
||||
const businessTypeCountsElement = document.getElementById("tourism_based_KBLI");
|
||||
console.log(businessTypeCountsElement);
|
||||
const businessTypeCounts = JSON.parse(businessTypeCountsElement.value); // Cek apakah data sudah terbawa dengan benar
|
||||
|
||||
// Membuat Grid.js instance
|
||||
new gridjs.Grid({
|
||||
columns: ["Jenis Bisnis Pariwisata", "Jumlah Total"], // Nama kolom
|
||||
data: businessTypeCounts.map(item => [item.business_type, item.count]), // Mengubah data untuk Grid.js
|
||||
data: businessTypeCounts.map(item => [item.kbli_title, item.total_records]), // Mengubah data untuk Grid.js
|
||||
search: true, // Menambahkan fitur pencarian
|
||||
pagination: true, // Menambahkan fitur pagination
|
||||
sort: true, // Menambahkan fitur sorting
|
||||
|
||||
@@ -63,8 +63,9 @@
|
||||
<input class="form-control" list="{{ $field }}Options" id="{{ $field }}" name="{{ $field }}"
|
||||
value="{{ old($field, isset($modelInstance) ? $modelInstance->{$field} : '') }}" placeholder="Type to search..." oninput="fetchOptions('{{ $field }}')">
|
||||
<datalist id="{{ $field }}Options"></datalist>
|
||||
@elseif($fieldType == 'date')
|
||||
<input type="date" id="{{ $field }}" name="{{ $field }}" class="form-control" value="{{ old($field, isset($modelInstance) ? $modelInstance->{$field} : '') }}">
|
||||
@elseif($fieldType == 'date')
|
||||
<input type="date" id="{{ $field }}" name="{{ $field }}" class="form-control"
|
||||
value="{{ old($field, isset($modelInstance) && $modelInstance->{$field} ? \Carbon\Carbon::parse($modelInstance->{$field})->format('Y-m-d') : '') }}">
|
||||
@else
|
||||
<input type="{{ $fieldType }}" id="{{ $field }}" name="{{ $field }}" class="form-control" value="{{ old($field, isset($modelInstance) ? $modelInstance->{$field} : '') }}">
|
||||
@endif
|
||||
|
||||
@@ -29,6 +29,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade modalGMaps" tabindex="-1"
|
||||
aria-labelledby="confirmationModalCenterTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-lg modal-sm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"
|
||||
aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<iframe
|
||||
src=""
|
||||
width="100%"
|
||||
height="450"
|
||||
style="border:0;"
|
||||
allowfullscreen=""
|
||||
loading="lazy">
|
||||
</iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- <div id="alert-container"></div> --}}
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
@section('content')
|
||||
@include('layouts.partials/page-title', ['title' => 'Report', 'subtitle' => 'Report Pariwisata'])
|
||||
|
||||
<input id="business_type_counts" type="hidden" value="{{ json_encode($businessTypeCounts) }}">
|
||||
<input id="tourism_based_KBLI" type="hidden" value="{{ json_encode($tourismBasedKBLI) }}">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">Laporan Pariwisata</h5>
|
||||
|
||||
Reference in New Issue
Block a user