<?php
require_once(__DIR__."/../includes/sysinit.php");
include("client.php");
$_client = new Client; //new class instance
$_client->hddnClientId				= $_POST['hddnClientId'] ??  0;
$_client->edtClientName				= $_POST['edtClientName']?? '';
$_client->edtClientSurname			= $_POST['edtClientSurname'] ?? '';
$_client->txtAddressId				= $_POST['txtAddressId'] ?? '';
$_client->edtClientCell				= $_POST['edtClientCell'] ?? '';
$_client->edtClientPhone			= $_POST['edtClientPhone'] ?? '';
$_client->edtClientEmail			= $_POST['edtClientEmail'] ?? '';
$_client->addressLat				= $_POST['latitude'] ?? '';
$_client->addressLng				= $_POST['longitude'] ?? '';
$_client->buildingList					= json_decode($_POST['buildingList'] ?? '', true);
$_client->txtAddressNote			= $_POST['txtAddressNote'] ?? '';
$_client->txtClientNotes			= $_POST['txtClientNotes'] ?? '';
$_client->txtClientBookingNote		= $_POST['txtClientBookingNote'] ?? '';
if ($_POST['action']=='0') $_client->addClient();
if ($_POST['action']=='1') $_client->addClient();
if ($_POST['action']=='2') $_client->viewClient();
if ($_POST['action']=='3') $_client->editClient();
if ($_POST['action']=='4') $_client->deleteClient();
if ($_POST['action']=='5') $_client->viewBuildings();
if ($_POST['action']=='6') $_client->viewTxns();
if ($_POST['action']=='7') $_client->addBooking();
if ($_POST['action']=='8') $_client->viewHistory();
unset($_client);