From 06285fc533d6a3409a17e062e7281a9fc1175b7e Mon Sep 17 00:00:00 2001 From: Bayu Lukman Yusuf Date: Mon, 2 Mar 2026 10:32:10 +0700 Subject: [PATCH] map input --- lang/en/addresses.php | 6 + lang/id/addresses.php | 6 + resources/views/account/addresses.blade.php | 75 +-- .../components/address/address-map.blade.php | 438 ++++++++++++++++++ 4 files changed, 496 insertions(+), 29 deletions(-) create mode 100644 resources/views/components/address/address-map.blade.php diff --git a/lang/en/addresses.php b/lang/en/addresses.php index 7605f79..8a8cac1 100644 --- a/lang/en/addresses.php +++ b/lang/en/addresses.php @@ -51,6 +51,12 @@ return [ 'notification' => 'Notification', 'confirm_delete_address' => 'Are you sure you want to delete this address?', 'this_action_cannot_be_undone' => 'This action cannot be undone.', + 'select_location_on_map' => 'Select location on map', + 'search_for_location' => 'Search for location', + 'search' => 'Search', + 'type_to_search' => 'Start typing to search for locations...', + 'map_will_load_here' => 'Interactive map will load here when modal opens', + 'drag_marker_to_adjust' => 'Drag the marker to adjust the exact location', 'regions' => [ 'africa' => 'Africa', 'asia' => 'Asia', diff --git a/lang/id/addresses.php b/lang/id/addresses.php index 0f1f119..aa0e14b 100644 --- a/lang/id/addresses.php +++ b/lang/id/addresses.php @@ -51,6 +51,12 @@ return [ 'confirm_delete_address' => 'Apakah Anda yakin ingin menghapus alamat ini?', 'this_action_cannot_be_undone' => 'Tindakan ini tidak dapat dibatalkan.', 'notification' => 'Notifikasi', + 'select_location_on_map' => 'Pilih lokasi di peta', + 'search_for_location' => 'Cari lokasi', + 'search' => 'Cari', + 'type_to_search' => 'Mulai mengetik untuk mencari lokasi...', + 'map_will_load_here' => 'Peta interaktif akan dimuat di sini saat modal dibuka', + 'drag_marker_to_adjust' => 'Seret penanda untuk menyesuaikan lokasi yang tepat', 'regions' => [ 'africa' => 'Afrika', 'asia' => 'Asia', diff --git a/resources/views/account/addresses.blade.php b/resources/views/account/addresses.blade.php index 48cbbc6..0ca6b41 100644 --- a/resources/views/account/addresses.blade.php +++ b/resources/views/account/addresses.blade.php @@ -174,22 +174,19 @@ -
-
- - -
{{ __('addresses.please_enter_latitude') }}
-
+
+
- -
-
- - -
{{ __('addresses.please_enter_longitude') }}
-
-
-
+
@@ -447,26 +444,37 @@
-
-
- - -
{{ __('addresses.please_enter_latitude') }}
-
-
+
+
+ + + -
-
- - -
{{ __('addresses.please_enter_longitude') }}
+ +
+ +
+
+ + +
+ + +
+
+ {{ __('addresses.drag_marker_to_adjust') }} +
-
+
- +
{{ __('addresses.please_enter_address') }}
@@ -523,6 +531,15 @@ // Load provinces and set initial values loadProvinces(select, addressId, provinceId, cityId, districtId, villageId); }); + + // Initialize map components (for dynamically generated content) + document.querySelectorAll('.address-map-component').forEach(component => { + // Trigger initialization for this component + if (window.initializeAddressMap) { + const componentIndex = Date.now() + Math.random(); + window.initializeAddressMap(component, componentIndex); + } + }); } // Load addresses on page load diff --git a/resources/views/components/address/address-map.blade.php b/resources/views/components/address/address-map.blade.php new file mode 100644 index 0000000..b97534d --- /dev/null +++ b/resources/views/components/address/address-map.blade.php @@ -0,0 +1,438 @@ +@props([ + 'latitude' => null, + 'longitude' => null, + 'latitudeInputName' => 'latitude', + 'longitudeInputName' => 'longitude', + 'searchPlaceholder' => 'Search for location', + 'searchButtonText' => 'Search', + 'mapLabel' => 'Select location on map', + 'instructionText' => 'Drag the marker to adjust the exact location', + 'typeToSearchText' => 'Start typing to search for locations...', +]) + +
+ + + + + + +
+ +
+
+ + +
+ + +
+
+
+ {{ $instructionText }} +
+
+ + + + +