/
adminDemandInfo.php
245 lines (216 loc) · 10.5 KB
/
adminDemandInfo.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
237
238
239
240
241
242
243
244
<?php
require_once('class.authentification.php');
require_once('class.util.php');
require_once('class.demande.php');
define('licenseTabName', 'licenseTab');
define('residentialProofTabName', 'residentialProofTab');
define('car1TabName', 'car1Tab');
define('car2TabName', 'car2Tab');
$auth = authentification::instance();
$matricules = util::getParam($_POST, 'matricules');
$section = util::getParam($_GET, 'section');
if($auth->estIdentifie() && isset($matricules) && isset($section))
{
$matricules = json_decode($matricules);
$demandCount = count($matricules);
$demande = null;
if($demandCount == 1)
{
$demande = new demande($matricules[0]);
$demande->updateDataFromDB();
$options = $demande->getStatus()->getStatusSelectorOptions();
}
else if($demandCount == 0) {
exit(0);
}
if($section == 'status')
{
if($demandCount > 1)
generateStatusSectionContentMultiDemands($demandCount);
else
generateStatusSectionContent($demande);
}
else if($section == 'proof')
generateProofSectionContent($demande);
}
else
{
header('Location index.php');
exit(0);
}
function generateStatusSectionContentMultiDemands($demandCount)
{
print(' <div>
<div>
<label style="font-size:17px; display:block;" >'.util::cleanUTF8( "L'état des $demandCount demandes sélectionnées sera modifié").'</label>
<label id="demandStateLabel" style="font-size:17px; width:150px; display:inline-block;display:none" >États demandes</label>
<span id="currentStatusNameContainer">
<label id="currentStatusName" style="font-size:26px; font-weight:bold"></label>
<img id="statusChangeIndicatorIcon" width="16" height="16" style="margin-left:10px; display:none" ></img>
<img id="loadingWheel" src="images/loading_wheel.gif" style="width:16px; height:16px;"></img>
<label id="statusChangeMessage" ></label>
</span>
</div>
<input type="hidden" id="selectedStatus" name="selectedStatus" value="" ></input>
<div style="margin-top:5px">
<label style="font-size:17px; width:120px; display:inline-block;" > Changer pour </label>
<select id="statusSelector" style="font-size:16">
<option value="'.demandStatus::WAITING_STATUS.'" selected>En attente </option>
<option value="'.demandStatus::PROOF_OK_STATUS.'">Preuves vérfiées</option>
<option value="'.demandStatus::REFUSED_STATUS.'">Refusé</option>
<option value="'.demandStatus::ACCEPTED_STATUS.'">Accepté</option>
<option value="'.demandStatus::PAID_STATUS.'">Payé</option>
<option value="'.demandStatus::PRINTED_STATUS.'">Imprimé</option>
<option value="'.demandStatus::INVALID_PROOF_STATUS.'">Preuves invalides</option>
</select>
<div style="float:right">
<span id="confirmStatusChangeButton" style="vertical-align:bottom; float:right" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text" style="padding:4px 6px 4px 6px">Confirmer</span></div>
</span>
</div>
<hr>
<div id="sendMailCheckContainer" style="margin-top:5px">
<input type="checkbox" id="sendMailCheck" checked> </input>
<label> Envoyer courriel indiquant le changement d\'état</label>
</div>
<div id="includeDetailsCheckContainer"">
<input type="checkbox" id="includeDetailsCheck" > </input>
<label> Inclure les détails dans le contenu du message </label>
</div>
<div id="detailsTextAreaContainer">
<label style=" margin-top:5px;"> Détails optionnels sur le changement d\'état</label>
<textarea id="detailsTextArea" style="float:left; max-width:100%; max-height:75%; width:100%; height:50%; paddin:0px"></textarea>
</div>
</div>'); // End of status section
}
function generateStatusSectionContent($demande)
{
print(' <div>
<div>
<label style="font-size:17px; width:120px; display:inline-block;" >État demande</label>
<span id="currentStatusNameContainer">
<label id="currentStatusName" style="font-size:26px; font-weight:bold">'.util::cleanUTF8($demande->getStatus()->getName()).'</label>
<img id="statusChangeIndicatorIcon" width="16" height="16" style="margin-left:10px; display:none" ></img>
<img id="loadingWheel" src="images/loading_wheel.gif" style="width:16px; height:16px;"></img>
<label id="statusChangeMessage" ></label>
</span>
</div>
<input type="hidden" id="selectedStatus" name="selectedStatus" value="'.$demande->getStatus()->getId().'" ></input>
<input type="hidden" id="matricule" name="matricule" value="'.$demande->getUserData()->getMatricule().'" ></input>
<div style="margin-top:5px">
<label style="font-size:17px; width:120px; display:inline-block;" > Changer pour </label>
<select id="statusSelector" style="font-size:16">
<option value="'.demandStatus::WAITING_STATUS.'" selected>En attente </option>
<option value="'.demandStatus::PROOF_OK_STATUS.'">Preuves vérfiées</option>
<option value="'.demandStatus::REFUSED_STATUS.'">Refusé</option>
<option value="'.demandStatus::ACCEPTED_STATUS.'">Accepté</option>
<option value="'.demandStatus::PAID_STATUS.'">Payé</option>
<option value="'.demandStatus::PRINTED_STATUS.'">Imprimé</option>
<option value="'.demandStatus::INVALID_PROOF_STATUS.'">Preuves invalides</option>
</select>
<div style="float:right">
<span id="printStatusButton" style="vertical-align:bottom; float:right" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text" style="padding:4px 6px 4px 6px">Imprimer</span></div>
</span>
<span id="confirmStatusChangeButton" style="vertical-align:bottom; float:right" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text" style="padding:4px 6px 4px 6px">Confirmer</span></div>
</span>
</div>
<hr>
<div id="carpoolingDetailsContainer">
'.util::cleanUTF8($demande->getDetails()).'
</div>
<div id="sendMailCheckContainer" style="margin-top:5px">
<input type="checkbox" id="sendMailCheck" checked> </input>
<label> Envoyer courriel indiquant le changement d\'état</label>
</div>
<div id="includeDetailsCheckContainer"">
<input type="checkbox" id="includeDetailsCheck" checked > </input>
<label> Inclure les détails dans le contenu du message </label>
</div>
<div id="detailsTextAreaContainer">
<label style=" margin-top:5px;"> Détails optionnels sur le changement d\'état</label>
<textarea id="detailsTextArea" style="float:left; max-width:100%; max-height:75%; width:100%; height:50%; paddin:0px">'.util::cleanUTF8($demande->getStatus()->getDescription()).'</textarea>
</div>
</div>'); // End of status section
}
function generateProofSectionContent($demande)
{
$hasOptionnalCar = $demande->getSecondCar()->existsInDatabase();
//print("<label>Status: ".$demande->getStatus()->getName()."</label>");
print("<div id='proofTabs'>
<ul>
<li><a href='#".licenseTabName."'><span>Permis</span></a></li>
<li><a href='#".residentialProofTabName."'><span>Résidence</span></a></li>
<li><a href='#".car1TabName."'><span>Véhicule 1</span></a></li>
".($hasOptionnalCar ? "<li><a href='#".car2TabName."'><span>Deuxième véhicule</span></a></li>" : "")."
</ul>
<div id='".licenseTabName."'>"
.getLicenseProofImageHtml($demande).
"</div>
<div id='".residentialProofTabName."'>
<div>"
.getResidenceProofImageHtml($demande).
"</div>
</div>
<div id='".car1TabName."'>"
.getCar1ProofImageHtml($demande)
.getCarHtmlContent($demande->getFirstCar())."
</div>");
if($hasOptionnalCar)
{
print( "<div id='".car2TabName."''>"
.getCar2ProofImageHtml($demande)
.getCarHtmlContent($demande->getSecondCar()).
"</div>");
}
print(" </div>" ); // End of proof tabs
}
function getLicenseProofImageHtml(demande $demande)
{
return getProofImageHtml($demande->getLicense()->getOutputLocation(), licenseTabName);
}
function getResidenceProofImageHtml(demande $demande)
{
return getProofImageHtml($demande->getResidenceProof()->getOutputLocation(), residentialProofTabName);
}
function getCar1ProofImageHtml(demande $demande)
{
return getProofImageHtml($demande->getFirstCar()->getInsurance()->getOutputLocation(), car1TabName);
}
function getCar2ProofImageHtml(demande $demande)
{
return getProofImageHtml($demande->getSecondCar()->getInsurance()->getOutputLocation(), car2TabName);
}
function getProofImageHtml($imgSrc, $tabName)
{
return " <div id='demandVerificationImageContainer' style='height:100%' >
<div class='demandVerificationImageFrame'>
<img class='demandVerificationImage' id='".$tabName."VerificationImage' src='$imgSrc' data-zoom-image='$imgSrc' original-image-path='$imgSrc' >
</img>
</div>
<div>
<button class='popUpImageOverlayButton' style='padding:4x'></button>
<a id='openImageInTabButtonLink' href='$imgSrc' target='_blank'>
<button class='openImageInTabButton' style='padding:4x'></button>
</a>
<button class='rotateImageCounterClockwiseButton' style='padding:4x' ></button>
<button class='rotateImageClockwiseButton' style='padding:4x'></button>
</div>
</div>";
}
function getCarHtmlContent(car $car)
{
$carIndex = $car->getIndex();
return "<span id='demandVerificationInfoContainer'>
<label class='infoFieldTitleWithBar' >".util::cleanUTF8('Modèle')."</label>
<label id='car".$carIndex."Model' class='infoFieldValue' style='font-size:18px'>".$car->getModel()."</label>
<label class='infoFieldTitleWithBar' >Couleur</label>
<label id='car".$carIndex."Color' class='infoFieldValue' style='font-size:18px'>".$car->getColor()."</label>
<label class='infoFieldTitleWithBar' >".util::cleanUTF8('Année')."</label>
<label id='car".$carIndex."Year' class='infoFieldValue' style='font-size:18px'>".$car->getYear()."</label>
<label class='infoFieldTitleWithBar' >".util::cleanUTF8('Année')."</label>
<label id='car".$carIndex."License' class='infoFieldValue' style='font-size:18px'>".$car->getLicense()."</label>
</span>";
}
?>