-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustomerHome.php
221 lines (192 loc) · 9.86 KB
/
customerHome.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<?php
// TRADESMAN PAGE
// $trademsna id = 1; // tradesman ID JB
// $customer_id = 2; // customer ID mathi
include 'header.php';
include 'calendar.php';
$customer_id = $user->getCustomer_id();
//$customerObj = new Customer();
//$customerObj->read($customer_id);
// echo $tradesmanObj->checkHiringTimeCome($tradesman_id);
?>
<html>
<style>
<?php include 'Tradesman/Assets/Css/tradesman_home.css' ?><?php include 'Assets/Css/header.css' ?><?php include './Tradesman/Assets/Css/workerSignup.css' ?>
</style>
<body>
<?php
$month = date("Y-m-d");
$calendar = new Calendar($month);
$current_month = $calendar->getActive_month();
$current_year = $calendar->getActive_year();
?>
<!-- ---------------------------------COVER PHOTO ON TOP WITH GRADIENT------------------------------------------- -->
<div class="cover">
<div class="coverimg">
<div class="coveroverlay">
<div class="container">
<div class="covertxt">
<span class="weAreHere">
WE ARE HERE
</span><br>
<span class="toHelp">
TO HELP
</span><br>
<span class="you">
YOU
</span>
</div>
</div>
</div>
</div>
</div>
<div id="scheduledMessage" class="bg-warning"></div>
<!-- ---------------------------------TOP SERVIES------------------------------------------- -->
<div id="exceptCoverPhoto">
<p id="top-services " class="h1 fw-bold p-3"><span id="topServices" class="pe-5">TOP SERVICES</span> </p>
<div class="row d-flex justify-content-evenly">
<!-- ---------------------------------PLUMBER BOX------------------------------------------- -->
<?php
require_once('classes.php');
$sql = "SELECT * FROM service Order by average_rating limit 4;";
$result = QueryHandler::query($sql);
while ($row = mysqli_fetch_array($result)) {
?>
<div id="box_service" class="col-md-5 mb-5">
<div id="box" class="row ">
<div class="col text-center">
<img id="job_images" class="" src="Assets/Images/<?php echo $row['cover_photo']; ?>" alt="" />
</div>
<div id="service_detail " class=" col pt-3 d-flex flex-column align-items-xs-center align-items-md-center align-items-lg-start">
<div id="job" class=" d-flex text-center fw-bold h5 mt-1">
<div id="box" class=" pb-2"><?php echo $row['service_name']; ?></div>
</div>
<div class="fw-bolder"><?php echo $row['total_hirings']; ?> Total Order</div>
<div class="fw-bolder">
<p class="">
Avg Review <?php echo $row['average_rating']; ?>
<span id="star" class="material-icons"> grade</span>
</p>
</div>
</div>
</div>
</div>
<?php } ?>
<!-- CUSTOMER scheduleS -> show scheduled details in 2 way. CALENDAR & LIST -->
<div class="h1 text-uppercase mt-2">
<p>your schedules</p>
</div>
<div class="horizontal_line_customer"></div>
<!-- LIST VIEW OF scheduleS :: example :: "Sep 1, 02.10 p.m - Jeyabawan" -->
<div class="row m-3" id="CalendarContent">
<div class="col-md-12 col-lg-6 mb-5" id="schedule_list">
<div class="fw-bold me-5" id="schedule_list_box">
<p id="scheuledList" class="h3 fw-bold">
Your scheduled hirings for this month
</p>
<div id="alertBox" class="alert alert-dark" role="alert">
You Have No Schedule For This Month!!!!
</div>
<ul>
<?php
$sql = "SELECT * from calendar where customer_id='$customer_id' ORDER BY date;";
$result = QueryHandler::query($sql);
if (!$result) {
die('QUERY FAIL!');
}
$count = 0;
while ($row = mysqli_fetch_assoc($result)) {
$tradesmanObj = Tradesman::getInstance($row['tradesman_id']);
// echo $row['customer_id'];
if (date('m', strtotime($row['date'])) == $current_month && date('Y', strtotime($row['date'])) == $current_year) {
$count = $count + 1;
$calendar->add_event($tradesmanObj->getUsername(), $row['date'], 1, 'green', $row['time']);
echo '<li class="fw bold h5">' . date('M j ,', strtotime($row['date'])) . ' ' . date('g:i a', strtotime($row['time'])) . ' - ' . $tradesmanObj->getUsername() . ' - ' . $row['service_name'] . '</li>';
$events = $calendar->getEvents();
// echo '<script> console.log('.$events[0].'); </script>';
// echo $events[0];
for ($i = 1; $i <= 31; $i++) {
?><div class="modal fade" id="modal_schedule_date_<?php echo $i; ?>" role="dialog">
<div class="modal-dialog modal-dialog-centered">
<!-- Modal content-->
<div class="modal-content p-3 text-center">
<div><?php echo $tradesmanObj->getUsername() . "<br>Date:" . $row['date'] . " Time:" . $row['time']; ?></div>
<div class="row">
<div class="col">
<button class="btn text-white fw-bold" style="background-color: #142f61">
CHANGE
</button>
</div>
<div class="col">
<button type="close" data-dismiss="modal" class="close btn text-white fw-bold" style="background-color: #142f61">
CLOSE
</button>
</div>
</div>
</div>
</div>
</div><?php
}
}
}
if ($count == 0) {
echo '<script>document.getElementById("scheuledList").style.display="none"; </script>';
echo '<script>document.getElementById("alertBox").style.display="block"; </script>';
} else {
echo '<script>document.getElementById("scheuledList").style.display="block";</script>';
echo '<script>document.getElementById("alertBox").style.display="none";</script>';
}
?>
<!-- <li class="fw bold h5">Sep 1, 02.10 p.m - Jeyabawan</li> -->
</ul>
</div>
</div>
<div class="col-md-12 col-lg-6" id="calendar_box">
<?php echo $calendar ?>
</div>
</div>
</div>
<div id="getCount" class="bg-warning">
</div>
</body>
</html>
<?php include 'footer.php' ?>
<script>
$(document).ready(function() {
$(document).on("click", ".del", function() {
console.log("previous button cicked.");
let del = $(this);
let current_month = $(this).attr("data-id");
var name = <?php echo $customer_id ?>;
$.ajax({
type: "get",
data: {
name: name,
current_month: current_month
},
url: "previousC.php",
success: function(data) {
console.log(data);
$("#CalendarContent").html(data);
}
});
});
$(document).on("click", ".del1", function() {
// let del1 = $(this);
let current_month = $(this).attr("data-id");
var name = <?php echo $customer_id ?>;
$.ajax({
type: "get",
data: {
name: name,
current_month: current_month
},
url: "nextC.php",
success: function(data) {
console.log(data);
$("#CalendarContent").html(data);
}
});
});
});
</script>