-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
tomergewithholiday.php
executable file
·226 lines (210 loc) · 8.9 KB
/
tomergewithholiday.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
<?php
/* Copyright (C) 2012-2103 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Page module configuration paid holiday.
*
* \file holiday.php
* \ingroup holiday
* \brief Page module configuration paid holiday.
*/
require '../../main.inc.php';
require DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
require_once DOL_DOCUMENT_ROOT. '/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT. '/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT. '/user/class/usergroup.class.php';
// Si pas administrateur
if (! $user->admin) accessforbidden();
/*
* View
*/
// Vérification si module activé
if (empty($conf->holiday->enabled)) print $langs->trans('NotActiveModCP');
llxheader('',$langs->trans('TitleAdminCP'));
print_fiche_titre($langs->trans('MenuCPTypes'));
echo '<div id="types">';
echo '<table class="noborder" style="width: 100%;">';
echo '<tr class="liste_titre">';
echo '<td style="width: 150px">' . $langs->trans('TypeLabel') . '</td>';
echo '<td>' . $langs->trans('TypeDescription') . '</td>';
echo '<td style="text-align: center; width: 100px">' . $langs->trans('TypeAffect') . '</td>';
echo '<td style="text-align: center; width: 50px">' . $langs->trans('TypeDelay') . '</td>';
echo '<td style="text-align: center;">' . $langs->trans('nbCongesDeductedCPMini') . '</td>';
echo '<td style="text-align: center;">' . $langs->trans('nbCongesEveryMonthCPMini') . '</td>';
echo '<td style="width: 40px"></td>';
echo '</tr>';
$types = $db->query(
"SELECT *
FROM llx_congespayes_types
WHERE deleteAt IS NULL
ORDER BY label"
);
while($type = $db->fetch_array($types))
{
echo'
<tr id="row_'.$type['rowid'].'" '.$bc[$var=!$var].'>
<td>'.$type['label'].'</td>
<td>'.($type['description']?$type['description']:'N/A').'</td>
<td style="font-weight: bold; text-align: center">
'.($type['affect']?$langs->trans('TypeAffectYes'):$langs->trans('TypeAffectNo')).'
</td>
<td style="text-align: center">'.$type['delay'].'</td>
<td style="text-align: center">'.$type['nbCongesDeducted'].'</td>
<td style="text-align: center">'.$type['nbCongesEveryMonth'].'</td>
<td>
<img class="btn edit" data-rowid="'.$type['rowid'].'" src="../img/edit.png" title="'.$langs->trans('TypeBtnEdit').'">
<img class="btn delete" data-rowid="'.$type['rowid'].'" src="../img/delete.png" title="'.$langs->trans('TypeBtnDelete').'">
</td>
</tr>
<tr id="form_'.$type['rowid'].'" '.$bc[$var].' style="display: none">
<td colspan="7">
<form>
<input type="hidden" name="rowid" value="'.$type['rowid'].'">
<div>
<label>' . $langs->trans('TypeLabel') . '</label>
<input class="text" maxlength="45" name="label" type="text" value="'.$type['label'].'">
</div>
<div>
<label>' . $langs->trans('TypeDescription') . '</label>
<textarea name="description">'.$type['description'].'</textarea>
</div>
<div>
<label>' . $langs->trans('TypeDelay') . '</label>
<input class="text" maxlength="2" name="delay" type="text" value="'.$type['delay'].'" style="width: 50px">
</div>
<div>
<label>' . $langs->trans('TypeAffect') . '</label>
<select name="affect">
<option value="1"'.($type['affect']?' selected="selected"':'').'>
'.$langs->trans('TypeAffectYes').'
</option>
<option value="0"'.($type['affect']?'':' selected="selected"').'>
'.$langs->trans('TypeAffectNo').'
</option>
</select>
</div>
<div>
<label>' . $langs->trans('nbCongesDeductedCPMini') . '</label>
<input class="text" maxlength="5" name="nbCongesDeducted" type="text"
value="'.$type['nbCongesDeducted'].'" style="width: 50px">
</div>
<div>
<label>' . $langs->trans('nbCongesEveryMonthCPMini') . '</label>
<input class="text" maxlength="5" name="nbCongesEveryMonth" type="text"
value="'.$type['nbCongesEveryMonth'].'" style="width: 50px">
</div>
<div style="text-align: right">
<input class="btn btn-primary button " type="submit" value="'.$langs->trans('TypeBtnApply').'">
<input data-rowid="'.$type['rowid'].'" class="btn cancel button" type="button" value="'.$langs->trans('TypeBtnCancel').'">
</div>
</form>
</td>
</tr>
';
}
echo '
<tr id="row_new" '.$bc[!$var].'>
<td colspan="7" style="text-align: right;">
<img class="btn" id="new" src="../img/add.png" title="'.$langs->trans('TypeBtnAdd').'">
</td>
</tr>
<tr id="form_new" '.$bc[!$var].' style="display:none">
<td colspan="7">
<form>
<div>
<label>' . $langs->trans('TypeLabel') . '</label>
<input class="text" maxlength="45" name="label" type="text">
</div>
<div>
<label>' . $langs->trans('TypeDescription') . '</label>
<textarea name="description"></textarea>
</div>
<div>
<label>' . $langs->trans('TypeDelay') . '</label>
<input class="text" maxlength="2" name="delay" type="text" value="0" style="width: 50px">
</div>
<div>
<label>' . $langs->trans('TypeAffect') . '</label>
<select name="affect">
<option value="1">'.$langs->trans('TypeAffectYes').'</option>
<option value="0">'.$langs->trans('TypeAffectNo').'</option>
</select>
</div>
<div>
<label>' . $langs->trans('nbCongesDeductedCPMini') . '</label>
<input class="text" maxlength="5" name="nbCongesDeducted" type="text"
value="0" style="width: 50px">
</div>
<div>
<label>' . $langs->trans('nbCongesEveryMonthCPMini') . '</label>
<input class="text" maxlength="5" name="nbCongesEveryMonth" type="text"
value="0" style="width: 50px">
</div>
<div style="text-align: right">
<input class="btn btn-primary" type="submit" value="'.$langs->trans('TypeBtnAdd').'">
<input class="btn cancel" type="button" value="'.$langs->trans('TypeBtnCancel').'">
</div>
</form>
</td>
</tr>
</table>
<script>
$(function(){
$(".cancel", "#types").click(function(){
var rowid = false;
if(rowid = $(this).data("rowid")) {
$("#row_"+rowid, "#types").show();
$("#form_"+rowid, "#types").hide();
} else {
$("#row_new", "#types").show();
$("#form_new", "#types").hide();
}
});
$(".edit", "#types").click(function(){
var rowid = $(this).data("rowid");
$("#row_"+rowid, "#types").hide();
$("#form_"+rowid, "#types").show();
});
$("#new", "#types").click(function(){
$("#row_new", "#types").hide();
$("#form_new", "#types").show();
});
$("form", "#types").submit(function(){
$.post("ajax/types_editor.php", $(this).serialize(), function(response) {
if(response.status) window.location.reload();
else alert(response.content);
}, "json");
return false;
});
$(".delete", "#types").click(function(){
if(confirm("'.$langs->trans('TypeBtnDeleteConfirmation').'")) {
$.post("ajax/types_delete.php", {
rowid: $(this).data("rowid")
}, function(response) {
if(response.status) window.location.reload();
else alert(response.content);
}, "json");
}
});
});
</script>
';
echo '</div>';
llxFooter();
$db->close();
?>