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/en/checkout.php b/lang/en/checkout.php index c943daf..9fe04cb 100644 --- a/lang/en/checkout.php +++ b/lang/en/checkout.php @@ -68,4 +68,6 @@ return [ 'shipping' => 'Shipping:', 'estimated_total' => 'Estimated total:', 'proceed_to_checkout' => 'Proceed to checkout', + 'order_summary' => 'Order summary', + 'calculated_at_checkout' => 'Calculated at checkout', ]; diff --git a/lang/en/navbar.php b/lang/en/navbar.php index ffd7c6e..0a2389e 100644 --- a/lang/en/navbar.php +++ b/lang/en/navbar.php @@ -14,5 +14,8 @@ return [ 'sign_up' => 'Sign Up', 'contact' => 'Contact', 'terms_conditions' => 'Terms & Conditions', - 'categories' => 'Categories' + 'categories' => 'Categories', + 'delivery' => 'Delivery', + 'set_your_address' => 'Set your address', + 'gender' => 'Gender', ]; 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/lang/id/checkout.php b/lang/id/checkout.php index 04e4c3c..96c4b45 100644 --- a/lang/id/checkout.php +++ b/lang/id/checkout.php @@ -68,4 +68,6 @@ return [ 'shipping' => 'Pengiriman:', 'estimated_total' => 'Total estimasi:', 'proceed_to_checkout' => 'Lanjut ke checkout', + 'order_summary' => 'Ringkasan pesanan', + 'calculated_at_checkout' => 'Dihitung di checkout', ]; diff --git a/lang/id/navbar.php b/lang/id/navbar.php index 9054bce..69defed 100644 --- a/lang/id/navbar.php +++ b/lang/id/navbar.php @@ -15,4 +15,7 @@ return [ 'contact' => 'Kontak', 'terms_conditions' => 'Syarat & Ketentuan', 'categories' => 'Kategori', + 'delivery' => 'Pengiriman', + 'set_your_address' => 'Atur alamat Anda', + 'gender' => 'Gender', ]; 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/checkout/v1-cart.blade.php b/resources/views/checkout/v1-cart.blade.php index 8a2a074..ec076bb 100644 --- a/resources/views/checkout/v1-cart.blade.php +++ b/resources/views/checkout/v1-cart.blade.php @@ -42,12 +42,12 @@
--}} - +
- + + - +
ProductQuantity @else @foreach ($carts as $key => $cart) +
--}} - - + @if ($product->variants->first()->reference) + + @endif {{--
  • @@ -1061,14 +1061,14 @@ discountSpan.style.display = 'none'; } document.querySelector('.product-main-image').src = image; - document.querySelector('.variantOption').textContent = labelText; + // document.querySelector('.variantOption').textContent = labelText; // Update AddToCart component with new variant ID - const addToCartBtn = document.querySelector('[data-item-id]'); + const addToCartBtn = document.querySelector('[data-item-reference-id]'); if (addToCartBtn) { console.log(this.value); var item_id = this.value; - addToCartBtn.setAttribute('data-item-id', item_id); + addToCartBtn.setAttribute('data-item-reference-id', item_id); } }); }); @@ -1088,95 +1088,100 @@ const isWishlist = this.getAttribute('data-is-wishlist') === 'true'; const icon = this.querySelector('i'); const text = this.querySelector('span'); - + // Get CSRF token - const token = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content'); - + const token = document.querySelector('meta[name="csrf-token"]')?.getAttribute( + 'content'); + if (isWishlist) { // Remove from wishlist fetch('/account/wishlist/' + itemId, { - method: 'DELETE', - headers: { - 'Content-Type': 'application/json', - 'X-CSRF-TOKEN': token, - 'X-Requested-With': 'XMLHttpRequest' - } - }) - .then(response => response.json()) - .then(data => { - if (data.success) { - // Update button state - this.setAttribute('data-is-wishlist', 'false'); - icon.className = 'ci-heart'; - text.textContent = 'Add to Wishlist'; - - // Show success message - const successAlert = document.createElement('div'); - successAlert.className = 'alert alert-success alert-dismissible fade show position-fixed'; - successAlert.style.css = 'top: 20px; right: 20px; z-index: 9999; max-width: 300px;'; - successAlert.innerHTML = ` + method: 'DELETE', + headers: { + 'Content-Type': 'application/json', + 'X-CSRF-TOKEN': token, + 'X-Requested-With': 'XMLHttpRequest' + } + }) + .then(response => response.json()) + .then(data => { + if (data.success) { + // Update button state + this.setAttribute('data-is-wishlist', 'false'); + icon.className = 'ci-heart'; + text.textContent = 'Add to Wishlist'; + + // Show success message + const successAlert = document.createElement('div'); + successAlert.className = + 'alert alert-success alert-dismissible fade show position-fixed'; + successAlert.style.css = + 'top: 20px; right: 20px; z-index: 9999; max-width: 300px;'; + successAlert.innerHTML = ` Item removed from wishlist! `; - document.body.appendChild(successAlert); - - // Auto-hide after 3 seconds - setTimeout(() => { - if (successAlert.parentNode) { - successAlert.parentNode.removeChild(successAlert); - } - }, 3000); - } else { - console.error('Failed to remove from wishlist:', data.message); - } - }) - .catch(error => { - console.error('Error removing from wishlist:', error); - }); + document.body.appendChild(successAlert); + + // Auto-hide after 3 seconds + setTimeout(() => { + if (successAlert.parentNode) { + successAlert.parentNode.removeChild(successAlert); + } + }, 3000); + } else { + console.error('Failed to remove from wishlist:', data.message); + } + }) + .catch(error => { + console.error('Error removing from wishlist:', error); + }); } else { // Add to wishlist fetch('/account/wishlist', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'X-CSRF-TOKEN': token, - 'X-Requested-With': 'XMLHttpRequest' - }, - body: JSON.stringify({ - item_id: itemId + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'X-CSRF-TOKEN': token, + 'X-Requested-With': 'XMLHttpRequest' + }, + body: JSON.stringify({ + item_id: itemId + }) }) - }) - .then(response => response.json()) - .then(data => { - if (data.success) { - // Update button state - this.setAttribute('data-is-wishlist', 'true'); - icon.className = 'ci-heart-filled'; - text.textContent = 'In Wishlist'; - - // Show success message - const successAlert = document.createElement('div'); - successAlert.className = 'alert alert-success alert-dismissible fade show position-fixed'; - successAlert.style.css = 'top: 20px; right: 20px; z-index: 9999; max-width: 300px;'; - successAlert.innerHTML = ` + .then(response => response.json()) + .then(data => { + if (data.success) { + // Update button state + this.setAttribute('data-is-wishlist', 'true'); + icon.className = 'ci-heart-filled'; + text.textContent = 'In Wishlist'; + + // Show success message + const successAlert = document.createElement('div'); + successAlert.className = + 'alert alert-success alert-dismissible fade show position-fixed'; + successAlert.style.css = + 'top: 20px; right: 20px; z-index: 9999; max-width: 300px;'; + successAlert.innerHTML = ` Item added to wishlist! `; - document.body.appendChild(successAlert); - - // Auto-hide after 3 seconds - setTimeout(() => { - if (successAlert.parentNode) { - successAlert.parentNode.removeChild(successAlert); - } - }, 3000); - } else { - console.error('Failed to add to wishlist:', data.message); - } - }) - .catch(error => { - console.error('Error adding to wishlist:', error); - }); + document.body.appendChild(successAlert); + + // Auto-hide after 3 seconds + setTimeout(() => { + if (successAlert.parentNode) { + successAlert.parentNode.removeChild(successAlert); + } + }, 3000); + } else { + console.error('Failed to add to wishlist:', data.message); + } + }) + .catch(error => { + console.error('Error adding to wishlist:', error); + }); } }); }