Merge branch 'bug-fix/tourisms' into feat/dashboard-kekurangan-potensi
This commit is contained in:
@@ -21,7 +21,6 @@ class TourismController extends Controller
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
info($request);
|
||||
$perPage = $request->input('per_page', 15);
|
||||
$search = $request->input('search', '');
|
||||
|
||||
@@ -33,10 +32,7 @@ class TourismController extends Controller
|
||||
$tourisms->village_name = $village ? $village->village_name : null;
|
||||
|
||||
$district = DB::table('districts')->where('district_code', $tourisms->district_code)->first();
|
||||
$tourisms->district_name = $district ? $district->district_name : null;
|
||||
|
||||
$business_type = DB::table('business_type')->where('id', $tourisms->business_type_id)->first();
|
||||
$tourisms->business_type = $business_type ? $business_type->business_type : null;
|
||||
$tourisms->district_name = $village ? $village->village_name : null;
|
||||
return $tourisms;
|
||||
});
|
||||
|
||||
@@ -46,7 +42,7 @@ class TourismController extends Controller
|
||||
'total' => $tourisms->total(),
|
||||
'per_page' => $tourisms->perPage(),
|
||||
'current_page' => $tourisms->currentPage(),
|
||||
'last_page' => $tourisms->lastPage(),
|
||||
'last_page'=>$tourisms->lastPage(),
|
||||
]
|
||||
]);
|
||||
}
|
||||
@@ -62,11 +58,12 @@ class TourismController extends Controller
|
||||
|
||||
$data['district_code'] = $district_code;
|
||||
$data['village_code'] = $village_code;
|
||||
|
||||
return Tourism::create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Import advertisements from Excel or CSV
|
||||
* Import advertisements from Excel
|
||||
*/
|
||||
public function importFromFile(Request $request)
|
||||
{
|
||||
@@ -77,8 +74,8 @@ class TourismController extends Controller
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'message' => 'File validation failed.',
|
||||
'errors' => $validator->errors()
|
||||
'message'=>'File validation failed.',
|
||||
'errors'=>$validator->errors()
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -86,12 +83,12 @@ class TourismController extends Controller
|
||||
$file = $request->file('file');
|
||||
Excel::import(new TourismImport, $file);
|
||||
return response()->json([
|
||||
'message' => 'File uploaded and imported successfully!'
|
||||
'message'=>'File uploaded and imported successfully!'
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'message' => 'Error during file import.',
|
||||
'error' => $e->getMessage()
|
||||
'message'=>'Error during file import.',
|
||||
'error'=>$e->getMessage()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
@@ -109,7 +106,17 @@ class TourismController extends Controller
|
||||
*/
|
||||
public function update(TourismRequest $request, Tourism $tourism): Tourism
|
||||
{
|
||||
$tourism->update($request->validated());
|
||||
$data = $request->validated();
|
||||
|
||||
// Cari district_code berdasarkan district_name
|
||||
$district_code = DB::table('districts')->where('district_name', $data['district_name'])->value('district_code');
|
||||
// Cari village_code berdasarkan village_name
|
||||
$village_code = DB::table('villages')->where('village_name', $data['village_name'])->where('district_code', $district_code)->value('village_code');
|
||||
// Tambahkan village_code dan district_code ke data
|
||||
$data['village_code'] = $village_code;
|
||||
$data['district_code'] = $district_code;
|
||||
|
||||
$tourism->update($data);
|
||||
|
||||
return $tourism;
|
||||
}
|
||||
|
||||
@@ -69,9 +69,9 @@ class UmkmController extends Controller
|
||||
// Cari kode berdasarkan nama
|
||||
$district_code = DB::table('districts')->where('district_name', $data['district_name'])->value('district_code');
|
||||
$village_code = DB::table('villages')->where('village_name', $data['village_name'])->where('district_code', $district_code)->value('village_code');
|
||||
$business_scale_id = DB::table('business_scale')->where('id', $data['business_scale'])->value('id');
|
||||
$permit_status_id = DB::table('permit_status')->where('id', $data['permit_status'])->value('id');
|
||||
$business_form_id = DB::table('business_form')->where('id', $data['business_form'])->value('id');
|
||||
$business_scale_id = DB::table('business_scale')->where('id', $data['business_scale_id'])->value('id');
|
||||
$permit_status_id = DB::table('permit_status')->where('id', $data['permit_status_id'])->value('id');
|
||||
$business_form_id = DB::table('business_form')->where('id', $data['business_form_id'])->value('id');
|
||||
|
||||
info($business_scale_id);
|
||||
|
||||
|
||||
@@ -36,9 +36,7 @@ class TourismController extends Controller
|
||||
// Mengambil data untuk dropdown
|
||||
$dropdownOptions = [
|
||||
'village_name' => DB::table('villages')->orderBy('village_name')->pluck('village_name', 'village_code'),
|
||||
'district_name' => DB::table('districts')->orderBy('district_name')->pluck('district_name', 'district_code'),
|
||||
'business_type_id' => DB::table('business_type')->orderBy('business_type')->pluck('business_type', 'id'),
|
||||
'business_scale_id' => DB::table('business_scale')->orderBy('business_scale')->pluck('business_scale', 'id'),
|
||||
'district_name' => DB::table('districts')->orderBy('district_name')->pluck('district_name', 'district_code')
|
||||
];
|
||||
|
||||
$fields = $this->getFields();
|
||||
@@ -70,13 +68,9 @@ class TourismController extends Controller
|
||||
$district = DB::table('districts')->where('district_code', $modelInstance->district_code)->first();
|
||||
$modelInstance->district_name = $district ? $district->district_name : null;
|
||||
|
||||
$business_type = DB::table('business_type')->where('id', $modelInstance->business_type_id)->first();
|
||||
$modelInstance->business_scale_id = $business_type ? $business_type->id : null;
|
||||
|
||||
$dropdownOptions = [
|
||||
'village_name' => DB::table('villages')->orderBy('village_name')->pluck('village_name', 'village_code'),
|
||||
'district_name' => DB::table('districts')->orderBy('district_name')->pluck('district_name', 'district_code'),
|
||||
'business_type_id' => DB::table('business_type')->orderBy('business_type')->pluck('business_type', 'id'),
|
||||
'district_name' => DB::table('districts')->orderBy('district_name')->pluck('district_name', 'district_code')
|
||||
];
|
||||
|
||||
$fields = $this->getFields();
|
||||
@@ -90,46 +84,62 @@ class TourismController extends Controller
|
||||
private function getFields()
|
||||
{
|
||||
return [
|
||||
"business_name" => "Nama Usaha",
|
||||
"business_form" => "Bentuk Usaha",
|
||||
"project_name" => "Nama Project",
|
||||
"project_id" => "ID Proyek",
|
||||
"project_type_id" => "Jenis Proyek",
|
||||
"nib" => "NIB",
|
||||
"business_name" => "Nama Perusahaan",
|
||||
"oss_publication_date" => "Tanggal Terbit OSS",
|
||||
"investment_status_description" => "Uraian Status Penanaman Modal",
|
||||
"business_form" => "Uraian Jenis Perusahaan",
|
||||
"project_risk" => "Risiko Proyek",
|
||||
"project_name" => "Nama Proyek",
|
||||
"business_scale" => "Uraian Skala Usaha",
|
||||
"business_address" => "Alamat Usaha",
|
||||
"district_name" => "Kecamatan",
|
||||
"village_name" => "Desa",
|
||||
"land_area" => "Luas Tanah",
|
||||
"longitude" => "Longitude",
|
||||
"latitude" => "Latitude",
|
||||
"project_submission_date" => "Tanggal Pengajuan Project",
|
||||
"kbli" => "KBLI",
|
||||
"kbli_title" => "Judul KBLI",
|
||||
"supervisory_sector" => "Sektor Pembina",
|
||||
"user_name" => "Nama User",
|
||||
"email" => "Email",
|
||||
"contact" => "Kontak",
|
||||
"land_area_in_m2" => "Luas Tanah (m2)",
|
||||
"investment_amount" => "Jumlah Investasi",
|
||||
"number_of_employee" => "TKI",
|
||||
"business_type_id" => "Jenis Usaha",
|
||||
"project_id" => "Priject ID",
|
||||
"nib" => "NIB",
|
||||
"jenis_proyek" => "Jenis Proyek",
|
||||
"status_penanaman_modal" => "Status Penanaman Modal",
|
||||
"uraian_resiko_proyek" => "Uraian Resiko Proyek",
|
||||
"business_scale_id" => "Skala Bisnis/Usaha",
|
||||
"terbit_oss" => "Terbit OSS",
|
||||
"tki" => "TKI",
|
||||
];
|
||||
}
|
||||
|
||||
private function getFieldTypes()
|
||||
{
|
||||
return [
|
||||
"project_id" => "text",
|
||||
"project_type_id" => "text",
|
||||
"nib" => "text",
|
||||
"business_name" => "text",
|
||||
"oss_publication_date" => "date",
|
||||
"investment_status_description" => "text",
|
||||
"business_form" => "text",
|
||||
"project_risk" => "text",
|
||||
"project_name" => "text",
|
||||
"business_address" => "textarea",
|
||||
"business_scale" => "text",
|
||||
"business_address" => "text",
|
||||
"district_name" => "combobox",
|
||||
"village_name" => "combobox",
|
||||
"land_area" => "text",
|
||||
"longitude" => "text",
|
||||
"latitude" => "text",
|
||||
"project_submission_date" => "date",
|
||||
"kbli" => "text",
|
||||
"kbli_title" => "text",
|
||||
"supervisory_sector" => "text",
|
||||
"user_name" => "text",
|
||||
"email" => "text",
|
||||
"contact" => "text",
|
||||
"land_area_in_m2" => "text",
|
||||
"investment_amount" => "text",
|
||||
"number_of_employee" => "text",
|
||||
"business_type_id" => "select",
|
||||
"project_id" => "text",
|
||||
"nib" => "text",
|
||||
"jenis_proyek" => "text",
|
||||
"status_penanaman_modal" => "text",
|
||||
"uraian_resiko_proyek" => "text",
|
||||
"business_scale_id" => "select",
|
||||
"terbit_oss" => "date"
|
||||
"tki" => "text",
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Http\Controllers\Report;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\BusinessTypeCount;
|
||||
use App\Models\TourismBasedKBLI;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
@@ -14,8 +14,8 @@ class ReportTourismController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$businessTypeCounts = BusinessTypeCount::all();
|
||||
info($businessTypeCounts);
|
||||
return view('report.tourisms.index', compact('businessTypeCounts'));
|
||||
$tourismBasedKBLI = TourismBasedKBLI::all();
|
||||
info($tourismBasedKBLI);
|
||||
return view('report.tourisms.index', compact('tourismBasedKBLI'));
|
||||
}
|
||||
}
|
||||
@@ -22,23 +22,31 @@ class TourismRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'jenis_proyek' => 'required|string',
|
||||
'nib' => 'string',
|
||||
'business_name' => 'required|string',
|
||||
'status_penanaman_modal' => 'string',
|
||||
'business_form' => 'string',
|
||||
'uraian_resiko_proyek' => 'string',
|
||||
'project_name' => 'required|string',
|
||||
'project_id' => 'required|string',
|
||||
'project_type_id' => 'required|string',
|
||||
'nib' => 'required|string',
|
||||
'business_name' => 'required|string',
|
||||
'oss_publication_date' => 'required',
|
||||
'investment_status_description' => 'required|string',
|
||||
'business_form' => 'required|string',
|
||||
'project_risk' => 'required|string',
|
||||
'project_name' => 'required|string',
|
||||
'business_scale' => 'required|string',
|
||||
'business_address' => 'required|string',
|
||||
'district_name' => 'required|string',
|
||||
'village_name' => 'required|string',
|
||||
'land_area' => 'required|string',
|
||||
'district_name' => 'required',
|
||||
'village_name' => 'required',
|
||||
'longitude' => 'required|string',
|
||||
'latitude' => 'required|string',
|
||||
'project_submission_date' => 'required',
|
||||
'kbli' => 'required|string',
|
||||
'kbli_title' => 'required|string',
|
||||
'supervisory_sector' => 'required|string',
|
||||
'user_name' => 'required|string',
|
||||
'email' => 'required|string',
|
||||
'contact' => 'required|string',
|
||||
'land_area_in_m2' => 'required|string',
|
||||
'investment_amount' => 'required|string',
|
||||
'number_of_employee' => 'required|string',
|
||||
'business_type_id' => 'required|string',
|
||||
'terbit_oss' => 'required|date',
|
||||
'business_scale_id' => 'required',
|
||||
'tki' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class UmkmRequest extends FormRequest
|
||||
|
||||
'business_id_number.string' => 'Nomor ID usaha harus berupa teks.',
|
||||
|
||||
'business_scale.required' => 'Skala usaha wajib diisi.',
|
||||
'business_scale_id.required' => 'Skala usaha wajib diisi.',
|
||||
|
||||
'owner_id.required' => 'ID pemilik wajib diisi.',
|
||||
'owner_id.string' => 'ID pemilik harus berupa teks.',
|
||||
@@ -96,7 +96,7 @@ class UmkmRequest extends FormRequest
|
||||
|
||||
'number_of_employee.required' => 'Jumlah karyawan wajib diisi.',
|
||||
|
||||
'permit_status.required' => 'Status izin wajib diisi.',
|
||||
'permit_status_id.required' => 'Status izin wajib diisi.',
|
||||
|
||||
'land_area.required' => 'Luas lahan wajib diisi.',
|
||||
'land_area.integer' => 'Luas lahan harus berupa angka bulat.',
|
||||
|
||||
@@ -7,6 +7,7 @@ use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\ToCollection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use DateTime;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class TourismImport implements ToCollection
|
||||
{
|
||||
@@ -42,12 +43,10 @@ class TourismImport implements ToCollection
|
||||
return;
|
||||
}
|
||||
|
||||
info($rows);
|
||||
|
||||
foreach ($rows->skip(1) as $row) {
|
||||
// Normalisasi nama kecamatan dan desa
|
||||
$districtName = strtolower(trim(str_replace('Kecamatan', '', $row[13])));
|
||||
$villageName = strtolower(trim($row[14]));
|
||||
$districtName = strtolower(trim(str_replace('Kecamatan', '', $row[12])));
|
||||
$villageName = strtolower(trim($row[13]));
|
||||
|
||||
// Cari distric_code dari table districts
|
||||
$districtCode = $districts[$districtName] ?? null;
|
||||
@@ -66,24 +65,51 @@ class TourismImport implements ToCollection
|
||||
// ambill village code yang village_name sama dengan $villageName
|
||||
$villageCode = $listTrueVillage[$villageName]['village_code'] ?? '000000';
|
||||
|
||||
|
||||
// if (empty($row[16])) {
|
||||
// info("Data kosong");
|
||||
// } else {
|
||||
// info("Baris ke- | Nilai: " . $row[16]);
|
||||
// }
|
||||
|
||||
$excelSerialDate = $row[16];
|
||||
if (is_numeric($excelSerialDate)) {
|
||||
$projectSubmissionDate = Carbon::createFromFormat('Y-m-d', '1899-12-30')
|
||||
->addDays($excelSerialDate)
|
||||
->format('Y-m-d H:i:s');
|
||||
} else {
|
||||
$projectSubmissionDate = Carbon::createFromFormat('m/d/Y', $excelSerialDate)
|
||||
->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
info("Tanggal dikonversi: " . $projectSubmissionDate);
|
||||
|
||||
$dataToInsert[] = [
|
||||
'project_id' => $row[1],
|
||||
'jenis_proyek' => $row[2],
|
||||
'project_type_id' => $row[2],
|
||||
'nib' => $row[3],
|
||||
'business_name' => $row[4],
|
||||
'terbit_oss' => DateTime::createFromFormat('d/m/Y', $row[5])->format('Y-m-d'),
|
||||
'status_penanaman_modal' => $row[6],
|
||||
'oss_publication_date' => DateTime::createFromFormat('d/m/Y', $row[5]),
|
||||
'investment_status_description' => $row[6],
|
||||
'business_form' => $row[7],
|
||||
'uraian_resiko_proyek' => $row[8],
|
||||
'project_risk' => $row[8],
|
||||
'project_name' => $row[9],
|
||||
'business_type_id' => $row[10],
|
||||
'business_scale_id' => (int) $row[11],
|
||||
'business_scale' => $row[10],
|
||||
'business_address' => $row[12],
|
||||
'district_code' => $districtCode,
|
||||
'village_code' => $villageCode,
|
||||
'land_area' => $row[15],
|
||||
'investment_amount' => (string) $row[16],
|
||||
'number_of_employee' => (string) $row[17],
|
||||
'longitude' => $row[14],
|
||||
'latitude' => (string) $row[15],
|
||||
'project_submission_date' => $projectSubmissionDate,
|
||||
'kbli'=> $row[17],
|
||||
'kbli_title'=>$row[18],
|
||||
'supervisory_sector'=>$row[19],
|
||||
'user_name'=>$row[20],
|
||||
'email'=>$row[21],
|
||||
'contact'=>$row[22],
|
||||
'land_area_in_m2'=>$row[23],
|
||||
'investment_amount'=>$row[24],
|
||||
'tki'=>$row[25]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BusinessTypeCount extends Model
|
||||
{
|
||||
protected $table = 'business_type_counts';
|
||||
protected $primaryKey = null;
|
||||
|
||||
public $timestamps = false;
|
||||
protected $fillable = ['business_type', 'count'];
|
||||
}
|
||||
@@ -8,25 +8,33 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* Class Tourism
|
||||
*
|
||||
* @property $id
|
||||
* @property $project_id
|
||||
* @property $jenis_proyek
|
||||
* @property $nib
|
||||
* @property $created_at
|
||||
* @property $updated_at
|
||||
* @property $project_id
|
||||
* @property $project_type_id
|
||||
* @property $nib
|
||||
* @property $business_name
|
||||
* @property $terbit_oss
|
||||
* @property $status_penanaman_modal
|
||||
* @property $oss_publication_date
|
||||
* @property $investment_status_description
|
||||
* @property $business_form
|
||||
* @property $uraian_resiko_proyek
|
||||
* @property $project_risk
|
||||
* @property $project_name
|
||||
* @property $business_scale_id
|
||||
* @property $business_scale
|
||||
* @property $business_address
|
||||
* @property $district_code
|
||||
* @property $village_code
|
||||
* @property $land_area
|
||||
* @property $longitude
|
||||
* @property $latitude
|
||||
* @property $project_submission_date
|
||||
* @property $kbli
|
||||
* @property $kbli_title
|
||||
* @property $supervisory_sector
|
||||
* @property $user_name
|
||||
* @property $email
|
||||
* @property $contact
|
||||
* @property $land_area_in_m2
|
||||
* @property $investment_amount
|
||||
* @property $number_of_employee
|
||||
* @property $business_type_id
|
||||
* @property $tki
|
||||
*
|
||||
* @package App
|
||||
* @mixin \Illuminate\Database\Eloquent\Builder
|
||||
@@ -41,7 +49,7 @@ class Tourism extends Model
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = ['project_id', 'jenis_proyek', 'nib', 'business_name', 'terbit_oss', 'status_penanaman_modal', 'business_form', 'uraian_resiko_proyek', 'project_name', 'business_scale_id', 'business_address', 'district_code', 'village_code', 'land_area', 'investment_amount', 'number_of_employee', 'business_type_id'];
|
||||
protected $fillable = ['project_id', 'project_type_id', 'nib', 'business_name', 'oss_publication_date', 'investment_status_description', 'business_form', 'project_risk', 'project_name', 'business_scale', 'business_address', 'district_code', 'village_code', 'longitude', 'latitude', 'project_submission_date', 'kbli', 'kbli_title', 'supervisory_sector', 'user_name', 'email', 'contact', 'land_area_in_m2', 'investment_amount', 'tki'];
|
||||
|
||||
|
||||
}
|
||||
|
||||
14
app/Models/TourismBasedKBLI.php
Normal file
14
app/Models/TourismBasedKBLI.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TourismBasedKBLI extends Model
|
||||
{
|
||||
protected $table = 'v_tourisms_based_kbli';
|
||||
protected $primaryKey = null;
|
||||
|
||||
public $timestamps = false;
|
||||
protected $fillable = ['kbli_title', 'total_records'];
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::dropIfExists('tourisms');
|
||||
Schema::create('tourisms', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
|
||||
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
|
||||
$table->string('project_id');
|
||||
$table->string('project_type_id');
|
||||
$table->string('nib');
|
||||
$table->string('business_name');
|
||||
$table->datetime('oss_publication_date');
|
||||
$table->string('investment_status_description');
|
||||
$table->string('business_form');
|
||||
$table->string('project_risk');
|
||||
$table->string('project_name');
|
||||
$table->string('business_scale');
|
||||
$table->string('business_address');
|
||||
$table->integer('district_code');
|
||||
$table->integer('village_code');
|
||||
$table->string('longitude');
|
||||
$table->string('latitude');
|
||||
$table->datetime('project_submission_date');
|
||||
$table->string('kbli');
|
||||
$table->string('kbli_title');
|
||||
$table->string('supervisory_sector');
|
||||
$table->string('user_name');
|
||||
$table->string('email');
|
||||
$table->string('contact');
|
||||
$table->string('land_area_in_m2');
|
||||
$table->string('investment_amount');
|
||||
$table->string('tki');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tourisms');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('tourisms', function (Blueprint $table) {
|
||||
$table->string('village_code')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('tourisms', function (Blueprint $table) {
|
||||
$table->integer('village_code')->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -136,7 +136,7 @@
|
||||
"isEntry": true
|
||||
},
|
||||
"resources/js/dashboards/bigdata.js": {
|
||||
"file": "assets/bigdata-Cyb9tZIY.js",
|
||||
"file": "assets/bigdata-BGlke4DN.js",
|
||||
"name": "bigdata",
|
||||
"src": "resources/js/dashboards/bigdata.js",
|
||||
"isEntry": true,
|
||||
@@ -421,6 +421,16 @@
|
||||
"__commonjsHelpers-C4iS2aBk.js"
|
||||
]
|
||||
},
|
||||
"resources/js/report/tourisms/index.js": {
|
||||
"file": "assets/index-DlxOSPEG.js",
|
||||
"name": "index",
|
||||
"src": "resources/js/report/tourisms/index.js",
|
||||
"isEntry": true,
|
||||
"imports": [
|
||||
"_gridjs.umd-BiCNXlqL.js",
|
||||
"__commonjsHelpers-C4iS2aBk.js"
|
||||
]
|
||||
},
|
||||
"resources/js/roles/create.js": {
|
||||
"file": "assets/create-Dd-lHOwF.js",
|
||||
"name": "create",
|
||||
@@ -499,7 +509,7 @@
|
||||
"isEntry": true
|
||||
},
|
||||
"resources/scss/style.scss": {
|
||||
"file": "assets/style-C8C4w8xF.css",
|
||||
"file": "assets/style-CnBzxVPJ.css",
|
||||
"src": "resources/scss/style.scss",
|
||||
"isEntry": true
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
<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
|
||||
|
||||
@@ -64,7 +64,8 @@
|
||||
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} : '') }}">
|
||||
<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