From 4a8603ee4835834f6a9c9762d687becb5892db43 Mon Sep 17 00:00:00 2001 From: jouls Date: Tue, 28 May 2024 18:23:48 +0800 Subject: [PATCH] fixed address section of vendor-settings and user-profile --- user-profile.php | 92 +++++++++++++++++++++++++++++++++++++++++---- vendor-settings.php | 32 ++++++++++++++-- 2 files changed, 112 insertions(+), 12 deletions(-) diff --git a/user-profile.php b/user-profile.php index c525917..2564fc0 100644 --- a/user-profile.php +++ b/user-profile.php @@ -205,7 +205,7 @@ if ($_SESSION["isVendor"] == true) {
Contact number
@@ -216,6 +216,9 @@ if ($_SESSION["isVendor"] == true) {
+
+ Shipping Address: +
Name: @@ -236,8 +239,60 @@ if ($_SESSION["isVendor"] == true) {
+ +
+ Billing Address: +
+
+ Name: + + + +
+
+ Contact #: +
+
+ Address: + + + + + + + +
+
+ @@ -264,16 +319,16 @@ if ($_SESSION["isVendor"] == true) {
- - > + > +
- - > + > + @@ -313,7 +368,7 @@ if ($_SESSION["isVendor"] == true) {
- +
@@ -1085,6 +1140,27 @@ if ($_SESSION["isVendor"] == true) { if (!updateResponse.ok) { throw new Error(`Failed to update address: ${updateResponse.status}`); } + + const selectedBillingElement = document.getElementById('selectedBillingFName'); + const selectedBillingLNameElement = document.getElementById('selectedBillingLName'); + const selectedBillingContactElement = document.getElementById('selectedBillingContact'); + const sBillingBuildingElement = document.getElementById('sBillingBuilding'); + const sBillingStreetElement = document.getElementById('sBillingStreet'); + const sBillingBarangayElement = document.getElementById('sBillingBarangay'); + const sBillingCityElement = document.getElementById('sBillingCity'); + const sBillingProvinceElement = document.getElementById('sBillingProvince'); + const sBillingCountryElement = document.getElementById('sBillingCountry'); + if (selectedBillingElement) { + selectedBillingElement.textContent = customerData.address[addressIndex].first_name; + selectedBillingLNameElement.textContent = customerData.address[addressIndex].last_name; + selectedBillingContactElement.textContent = 'Contact #: ' + customerData.address[addressIndex].phone; + sBillingBuildingElement.textContent = customerData.address[addressIndex].address_1; + sBillingStreetElement.textContent = customerData.address[addressIndex].address_2; + sBillingBarangayElement.textContent = customerData.address[addressIndex].barangay; + sBillingCityElement.textContent = customerData.address[addressIndex].city; + sBillingProvinceElement.textContent = customerData.address[addressIndex].province; + sBillingCountryElement.textContent = customerData.address[addressIndex].country; + } console.log(`Address updated successfully for customer ${customerId}`); } catch (error) { console.error('Error updating address:', error.message); @@ -1162,8 +1238,8 @@ if ($_SESSION["isVendor"] == true) { sCountryElement.textContent = customerData.address[addressIndex].country; } console.log(`Address updated successfully for customer ${customerId}`); - location.reload(); - header("location: user-profile.php"); + // location.reload(); + // header("location: user-profile.php"); } catch (error) { console.error('Error updating address:', error.message); } diff --git a/vendor-settings.php b/vendor-settings.php index 912331c..308b6d0 100644 --- a/vendor-settings.php +++ b/vendor-settings.php @@ -265,10 +265,6 @@ if ($_SESSION["isCustomer"] == true) { - - -
-
Billing Address: @@ -295,6 +291,34 @@ if ($_SESSION["isCustomer"] == true) {
+