/
addobservation.php
236 lines (168 loc) · 9.82 KB
/
addobservation.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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<?php include 'session.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php
include 'connection.php';
include 'header.php';
include 'functions.php';
// ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1);
// error_reporting(E_ALL);
?>
</head>
<body>
<div class="bg">
<?php
include 'navback.php';
$source = '?source=viewobservations';
include 'checksource.php';
?>
<div class="container">
<h1>Partner Observation</h1>
<div id="error">
<? echo $error.$successMessage; ?>
</div>
<form method="post" action="processobservation.php<?php echo $source ?>">
<div class="form-group">
<label for="partner"><h4>Partner Being Checked</h4></label>
<select class="form-control" id="partner" name="partner">
<!-- populate the drop down list with Partners allowed to do rotation spot checks -->
<?php
$query = "SELECT * FROM `partners` WHERE `active`='1' ORDER BY `firstname`";
$result = mysqli_query($link, $query);
if (!$result) {
printf("Error: %s\n", mysqli_error($link));
exit();
}
while($row = mysqli_fetch_array($result)){
include 'selectfromallpartners.php';
}
?>
</select>
</div>
<div class="form-group">
<label for="area"><h4>Area of Check</h4></label>
<select class="form-control" id="area" name="area">
<!--<option value="nill">Select...</option>-->
<option value="checkouts">Checkouts</option>
<option value="counters">Counters</option>
<option value="floor">Shop Floor</option>
</select>
</div>
<div id="criteria"></div>
<div class="form-group">
<label for="checks"><h4>Check The Following</h4></label><br>
<input type="checkbox" id="uniform" name="uniform" value="uniform" class="vertAlign"> Smartly dressed in correct uniform<br>
<input type="checkbox" id="ready" name="ready" value="ready" class="vertAlign"> Have their heads up and ready to help<br>
<input type="checkbox" id="greeting" name="greeting" value="greeting" class="vertAlign"> Give a warm greeting<br>
<input type="checkbox" id="smile" name="smile" value="smile" class="vertAlign"> Smile and make eye contact<br>
<input type="checkbox" id="listening" name="listening" value="listening" class="vertAlign"> Showing they actively listening<br>
<input type="checkbox" id="personal" name="personal" value="personal" class="vertAlign"> Making interactions personal<br>
<input type="checkbox" id="information" name="information" value="information" class="vertAlign"> Providing the right level of information<br>
<input type="checkbox" id="knowledge" name="knowledge" value="knowledge" class="vertAlign"> Sharing great product knowledge<br>
<input type="checkbox" id="display" name="display" value="display" class="vertAlign"> Having a vibrant and enticing display<br>
<input type="checkbox" id="thanks" name="thanks" value="thanks" class="vertAlign"> Giving a genuine thank you<br>
<input type="checkbox" id="goodbye" name="goodbye" value="goodbye" class="vertAlign"> Warmly saying goodbye<br>
</div>
<div id="resultText" class="form-group">
<label for="result"><h4>Overall Result</h4></label>
<select class="form-control" id="result" name="result">
<option value="pass">Pass</option>
<option value="fail">Fail</option>
</select>
</div>
<div id="discussionText" class="form-group">
<label for="discussion"><h4>Summary of discussion</h4></label>
<textarea class="form-control" id="discussion" name="discussion" rows="3"></textarea>
</div>
<div class="form-group">
<label for="manager"><h4>Partner Completing Check</h4></label>
<select class="form-control" id="manager" name="manager">
<!-- populate the drop down list with Partners allowed to do rotation spot checks -->
<?php
$query = "SELECT * FROM `partners` WHERE `canrotationcheck` = '1' ORDER BY `firstname`";
$result = mysqli_query($link, $query);
if (!$result) {
printf("Error: %s\n", mysqli_error($link));
exit();
}
while($row = mysqli_fetch_array($result)){
// if the option is the logged in user, preselect it
if($row['employee'] == $_SESSION['userData']['employee']){
echo '<option value="'.$row['employee'].'" selected="selected">'.$row['firstname'].' '.$row['surname'].'</option>';
} else {
echo '<option value="'.$row['employee'].'">'.$row['firstname'].' '.$row['surname'].'</option>';
}
}
?>
</select>
</div>
<button type="submit" class="btn btn-primary">Add Observation</button>
</form>
</div>
<?php
include 'footer.php';
?>
<!--<script>
// this script is to change to area labled 'criteria' to explanatory text based on the area chosen
/* event listener */
document.getElementsByName("area")[0].addEventListener('change', doThing);
/* function */
function doThing(){
var markup = 'Select an area for the check';
var markup2 = '';
var markup3 = '';
if(this.value == 'checkouts'){
markup = `
<h6>Partner is neat and well groomed<br>Area visibly clear of carrier bags<br>Genuine greeting, smile and eye contact<br>Acknowledge waiting customers<br>Offers bag for like (mainline only)<br>Offers to pack<br>Asks for myWaitrose Card<br>Clearly and politely states the cost<br>Positive closing comment with smile<br>Gives green token<br>Waits for customer to leave before serving next</h6>
`;
}
if(this.value == 'counters'){
markup = `
<h6>Partner is neat and well groomed<br>Genuine greeting, smile and eye contact<br>Acknowledge waiting customers<br>Offers product knowledge and relevant service information<br>Offers further help<br>Positive closing comment with smile</h6>
`;
}
if(this.value == 'floor'){
markup = `
<h6>Partner is neat and well groomed<br>Genuine greeting, smile and eye contact<br>Escot to product (Optional)<br>Hands product to customer (Optional)<br>Asks customer to continue shopping while product is found/checked (As appropriate)<br>Offers further help</h6>
`;
}
// place the explanation into the criteria area
document.getElementById("criteria").innerHTML = markup;
}
</script>-->
<!--<script>
// only show the discussion box if they have failed
document.getElementsByName("result")[0].addEventListener('change', addDiscussion);
/* function */
function addDiscussion(){
var markup = '';
if(this.value == 'pass'){
markup = ``;
} else {
markup = `
<label for="discussion"><h4>Summary of discussion</h4></label>
<textarea class="form-control" id="discussion" name="discussion" rows="3"></textarea>
`;
}
document.getElementById("discussionText").innerHTML = markup;
}
</script>-->
<script type="text/javascript">
$("form").submit(function(e) {
var error = "";
if ($("#area").val() == 'nill') {
error += "Please select and area for the observation.<br>"
}
if (error != "") {
$("#error").html('<div class="alert alert-danger" role="alert">' + error + '</div>');
return false;
} else {
return true;
}
})
</script>
</div>
</body>
</html>