Address
@@ -873,6 +917,8 @@ $products = productList();
var fileInput = document.getElementById('fileInput' + vendorId);
var file = fileInput.files[0];
+
+
const updatedUser = document.getElementById('user_login-' + vendorId).value;
const firstName = document.getElementById('firstName-' + vendorId).value;
const lastName = document.getElementById('lastName-' + vendorId).value;
@@ -891,6 +937,8 @@ $products = productList();
formData.append('category', 'vendor');
formData.append('image', file); // Include the file data in the form data
+ if(file){
+
fetch('https:///api/v1/upload_image', {
method: 'POST',
body: formData
@@ -944,6 +992,46 @@ $products = productList();
.catch(error => {
console.error('Error during fetch:', error);
});
+
+ }else{
+ const payload = {
+ vendor_image: `https:///images/storage/vendor_uploads/${filename}`,
+ user_login: updatedUser,
+ first_name: firstName,
+ last_name: lastName,
+ user_email: updatedEmail,
+ phone: phone,
+ vendor_description: description,
+ status: status,
+ address: [{
+ address_1: updatedAddress1,
+ address_2: updatedAddress2,
+ barangay: barangay,
+ city: city,
+ province: province,
+ country: country,
+ }]
+ };
+ fetch('https:///api/v1/vendors/' + vendorId, {
+ method: 'PATCH',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(payload)
+ })
+ .then(response => {
+ if (response.ok) {
+ location.reload();
+
+ return response.json();
+ } else {
+ console.error('vendor Update failed');
+ throw new Error('vendor Update failed');
+ }
+ })
+ ;
+ }
+
}
});
}else {
@@ -971,6 +1059,8 @@ $products = productList();
formData.append('category', 'vendor');
formData.append('image', file);
+ if (file){
+
fetch('https:///api/v1/upload_image', {
method: 'POST',
body: formData
@@ -1025,6 +1115,44 @@ $products = productList();
.catch(error => {
console.error('Error during fetch:', error);
});
+ }else{
+
+ const payload = {
+ user_login: updatedUser,
+ first_name: firstName,
+ last_name: lastName,
+ user_email: updatedEmail,
+ phone: phone,
+ vendor_description: description,
+ status: status,
+ address: [{
+ address_1: updatedAddress1,
+ address_2: updatedAddress2,
+ barangay: barangay,
+ city: city,
+ province: province,
+ country: country,
+ }]
+ };
+
+ fetch('https:///api/v1/vendors/' + vendorId, {
+ method: 'PATCH',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(payload)
+ })
+ .then(response => {
+ if (response.ok) {
+ location.reload();
+ return response.json();
+ } else {
+ console.error('vendor Update failed');
+ throw new Error('vendor Update failed');
+ }
+ })
+ ;
+ }
}
}
diff --git a/cart.php b/cart.php
index d2e3506..b12214b 100644
--- a/cart.php
+++ b/cart.php
@@ -82,6 +82,9 @@ if ($_SESSION["userId"] <> "") {
+
+
+
diff --git a/category-slider.php b/category-slider.php
index 6905164..a47c0ac 100644
--- a/category-slider.php
+++ b/category-slider.php
@@ -35,6 +35,17 @@
+
+
@@ -48,11 +59,14 @@
-
-
+
+
-
+
-
+
-
diff --git a/index.php b/index.php
index 6a19e28..6c735f1 100644
--- a/index.php
+++ b/index.php
@@ -254,8 +254,23 @@ if ($_SESSION["userId"] <> "") {
-
-
+
+ 0) : ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+ 0) : ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+ 0) : ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+ 0) : ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+