-
Notifications
You must be signed in to change notification settings - Fork 39
/
edit_jobs.html
223 lines (210 loc) · 8.52 KB
/
edit_jobs.html
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
{if isset($error)}
<script type="text/javascript">
jQuery(document).ready(function() {
if("{$error}" != "") {
alert("{$error}");
}
});
</script>
{/if}
<div id="content">
<script type="text/javascript" src="js_min/datatable.min.js"></script>
{if isset($jobType)}
<div style="margin-top: 2em;padding: 0 1em 1em;"class="ui-widget-content">
<h2>{t}Jobs{/t}</h2>
<!-- <div class="center"> -->
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#addJob').click(function() {
// check fields
var foundError = 0;
var msgString = "{t}Some fields are missing:{/t}\n";
var form = jQuery("#addJobForm");
if ("" == form.find("input[name=job_name]").val()) {
msgString += "{t}Job Name{/t}";
++foundError;
}
if ("" == form.find("input[name=job_color]").val()) {
msgString += "{t}Job Color{/t}";
++foundError;
}
if (0 == foundError) {
form.submit();
} else {
alert(msgString);
}
});
});
</script>
<form id="addJobForm" name="addJobForm" method="post" action="{$page}">
<fieldset>
<label for="job_name">{t}Job Name{/t}:</label>
<input name="job_name" size="30" type="text" id="job_name" />
<label for="job_type">{t}Type{/t}:</label>
<select name="job_type" id="job_type">
{foreach from=$jobType key=id item=i}
<option value="{$id}">{$i}</option>
{/foreach}
</select>
<label for="colorpicker">{t}Color{/t}:</label>
<input style="background-color: #FFFFFF" name="job_color" type="text" id="job_color" value="{$rndJobColor}" title="format: FFFFFF" size="6" />
<input type="button" id="addJob" name="btAddJob" value="{t}Add{/t}" />
<a href='http://www.colorschemer.com/online.html' target='_blank' title="{t}open a colorPicker in a new Tab{/t}">ColorPicker</a>
<input type="hidden" name="action" value="addJob" />
</fieldset>
</form>
<!-- Display previous entries -->
<div style="margin-top: 1em;">
<script type="text/javascript">
function deleteJob(id, description){
var confirmString = "{t}Delete job{/t} '" + description + "' ?";
if (confirm(confirmString)) {
var form = jQuery("#deleteJobForm");
form.find("input[name=job_id]").val(id);
form.submit();
}
}
</script>
<table>
<!-- <caption>Jobs</caption> -->
<thead>
<tr>
<th></th>
<th>{t}Job Name{/t}</th>
<th>{t}Type{/t}</th>
<th>{t}Color{/t}</th>
</tr>
</thead>
<tbody>
{foreach from=$jobs key=id item=i}
<tr>
<td class="ui-state-error-text" style="width:1em;">{if isset($i.deletedJob) && $i.deletedJob}
<a class="ui-icon" title="{t}delete Job{/t}" href="{$page}"
onclick="deleteJob('{$id}', '{$i.name}');return false"></a>
{/if}</td>
<td title="{$id}">{$i.name}</td>
<td title="{$i.type}">{$i.typeName}</td>
<td style="background-color: #{$i.color};">{$i.color}</td>
</tr>
{/foreach}
</tbody>
</table>
<form id="deleteJobForm" name="deleteJobForm" method="post" action="{$page}" class="ui-helper-hidden">
<fieldset>
<input type="hidden" name="job_id" value="0" />
<input type="hidden" name="action" value="deleteJob" />
</fieldset>
</form>
</div>
</div>
<div style="margin-top: 2em;padding: 0 1em 1em;"class="ui-widget-content ui-corner">
<h2 title="{t}Job Assignations{/t}">{t}Job Assignations{/t}</h2>
<!-- <div class="center"> -->
<div>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#addAssociationProject").click(function() {
// check fields
var foundError = 0;
var msgString = "{t}Missing fields :{/t}\n";
var form = jQuery("#addJobProjectAssociationForm");
var select = form.find("select[name=projects]").val();
if (select == null) {
msgString += "{t}Projects{/t}";
++foundError;
} else {
form.find("input[name=formattedProjects]").val(select.join(","));
}
if (0 == form.find("select[name=job_id]").val()) {
msgString += "{t}Job{/t}";
++foundError;
}
if (0 == foundError) {
form.submit();
} else {
alert(msgString);
}
});
});
</script>
<form id="addJobProjectAssociationForm" name="addJobProjectAssociationForm" method="post" action="{$page}">
<table class="invisible">
<tr>
<td title="{t}single selection{/t}">{t}Job{/t}:</td>
<td title="{t}multiple selection{/t}">{t}Projects{/t}:</td>
</tr>
<tr>
<td>
<select name="job_id" size="5">
{foreach from=$assignedJobs key=id item=i}
<option value="{$id}">{$i.name}</option>
{/foreach}
</select>
</td>
<td>
<select name="projects" multiple="multiple" size="5">
{foreach from=$projects key=id item=i}
<option value="{$id}">{$i}</option>
{/foreach}
</select>
</td>
<td>
<input type="button" id="addAssociationProject" name="btAddAssociation" value="{t}Add{/t}" />
</td>
</tr>
</table>
<input type="hidden" name="formattedProjects" value="" />
<input type="hidden" name="action" value="addAssociationProject" />
</form>
</div>
<!-- Display previous entries -->
<div style="margin-top: 2em;">
<script type="text/javascript">
function deleteJobProjectAssociation(id, description){
var confirmString = "{t}Remove this link :{/t} '" + description + "' ?";
if (confirm(confirmString)) {
var form = jQuery("#deleteJobProjectAssociationForm");
form.find("input[name=asso_id]").val(id);
form.submit();
}
}
</script>
<table class="datatable_csv">
<!-- <caption>Assigned Jobs</caption> -->
<thead>
<tr>
<th></th>
<th>{t}Job Name{/t}</th>
<th>{t}Project{/t}</th>
</tr>
</thead>
<tbody>
{foreach from=$tuples key=id item=i}
<tr>
<td class="ui-state-error-text" style="width:1em;">
<a class="ui-icon" title="{t}delete Project Association{/t}" href="{$page}" onclick="deleteJobProjectAssociation('{$id}','{$i.desc}');return false;" ></a>
</td>
<td>{$i.jobname}</td>
<td>{$i.project}</td>
</tr>
{/foreach}
</tbody>
</table>
<form id="deleteJobProjectAssociationForm" name="deleteJobProjectAssociationForm" method="post" action="{$page}" class="ui-helper-hidden">
<fieldset>
<input type="hidden" name="asso_id" value="0" />
<input type="hidden" name="action" value="deleteJobProjectAssociation" />
</fieldset>
</form>
</div>
<script type="text/javascript">
jQuery.ajax({
url: "js_min/colorpicker.min.js",
dataType: "script",
cache: true
});
</script>
{else}
<p class="center ui-state-error-text">{t}Sorry, you need to be in the admin-team to access this page.{/t}</p>
{/if}
</div>