<?php
include 'confing.php';

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $vendor_name = $_POST['vendor_name'];
    $vendor_id = $_POST['vendor_id'];
    $service_name = $_POST['service_name'];
    $vendor_address = $_POST['vendor_address'];
    $service_charge = $_POST['service_charge'];
    $vendor_image = $_POST['vendor_image'];
    $vendor_lat = $_POST['vendor_lat'];
    $vendor_long = $_POST['vendor_long'];
    $status = $_POST['status'];
    $booking_id = $_POST['id'];

    $query = "UPDATE booking SET 
              vendor_name='$vendor_name',
              vendor_id='$vendor_id',
              service_name='$service_name',
              vendor_address='$vendor_address', 
              service_charge='$service_charge',
              vendor_image='$vendor_image',
              vendor_lat='$vendor_lat',
              vendor_long='$vendor_long',
              status='$status'
              WHERE id='$booking_id'";
              

    if (mysqli_query($conn, $query)) {
        echo json_encode(["status" => "success", "message" => "Profile updated successfully"]);
    } else {
        echo json_encode(["status" => "error", "message" => "Failed to update profile"]);
    }
}
?>
