-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschedule.php
58 lines (44 loc) · 1.9 KB
/
schedule.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
// include 'classes.php';
require_once 'classes.php';
require_once 'calendar.php';
// $conn = (new Connection())->createConnection();
// $calendar_date = date("Y-m-d");
// $calendar = new Calendar($calendar_date);
$notification = new Notification();
$sheduleID = $_GET['sheduleID'];
$sql = "SELECT * from notification where notification_id=$sheduleID;";
$result = QueryHandler::query( $sql);
if (!$result) {
die('QUERY FAILLLL!');
}
while ($row = mysqli_fetch_assoc($result)) {
$date = $row['date'];
$time = $row['time'];
echo "hire now time is ". $time ;
$tradesman_id = $row['receiver_id'];
$customer_id = $row['sender_id'];
// $service_id = $row[''];
$service_id = $row['service_id'];
$lng = $row['longitude'];
$lat = $row['latitude'];
// $notification->createHiring($sheduleID);
$hiring_id = $notification->createHiring($date,$time, $tradesman_id,$customer_id,$service_id, "On going" , $lng , $lat , "On the way");
// // echo $sheduleID . ' ' . $date . ' ' . $time . '<br>';
// $canSchedule = $calendar->checkShedule(1, $time, $date , $conn);
// $tradesman_id = 1;
// if ($canSchedule) {
// echo "Hiring was successfully scheduled <br>This Hiring request is scheduled in your calendar<br>Check it!!! ";
// $query = "INSERT INTO calendar(tradesman_id,date, time,customer_id,service_name)VALUES ('$tradesman_id','$date', '$time',2, 'plumber')";
// $result = mysqli_query($conn, $query);
// if (!$result) {
// die('QUERY FAILLLL!');
// }
// } else {
// echo "You have been scheduled for hiring at the same time already <br> The notification has been sent to the customer.";
// // echo '<script> alert("You have another work at this time. You can not schedule this hiring request!!");<script>';
// }
}
$notification->remove($sheduleID);
$data = $hiring_id;
echo json_encode($data);