xref: /plugin/bez/tpl/task_form.php (revision a99642a4e080c577ca6bae05ecac75de931fb219)
1<?php
2if (isset($template['issue'])) {
3	$id = $this->id('issue', 'id', $template['issue']->id, 'action', $template['task_action'], 'tid', $template['task_id']);
4} else {
5
6}
7?>
8<a name="z_"></a>
9<form 	class="bez_form bez_task_form"
10		action="?id=<?php echo $id ?>" method="POST">
11		<input type="hidden" name="id" value="<?php echo $id ?>">
12		<fieldset class="bds_form">
13			<?php if ($template['action'] === 'task_correction_update'): ?>
14				<div class="row">
15				<label for="id"><?php echo $bezlang['id'] ?>:</label>
16				<span><strong>#z<?php echo $nparams['tid'] ?></strong></span>
17				</div>
18
19				<?php if ($template['auth_level'] >= 15 && isset($template['issue'])): ?>
20				<div class="row">
21					<label for="cause"><?php echo ucfirst($bezlang['cause']) ?>:</label>
22					<span>
23						<select name="cause" id="cause">
24							<option <?php if ($value['cause'] == '') echo 'selected' ?>
25								value="">--- <?php echo $bezlang['correction'] ?> ---</option>
26
27							<?php foreach ($template['causes'] as $cause): ?>
28								<option <?php if ($value['cause'] == $cause->id) echo 'selected' ?>
29								 value="<?php echo $cause->id ?>">#p<?php echo $cause->id ?></option>
30							<?php endforeach ?>
31						</select>
32					</span>
33				</div>
34				<?php endif ?>
35			<?php endif ?>
36			<div class="row">
37			<label for="executor"><?php echo $bezlang['executor'] ?>:</label>
38			<span>
39			<?php if ($template['auth_level'] >= 15): ?>
40				<select name="executor" id="executor" data-validation="required">
41					<option value="">--- <?php echo $bezlang['select'] ?>---</option>
42				<?php foreach ($template['users'] as $nick => $name): ?>
43					<option <?php if ($value['executor'] == $nick) echo 'selected' ?>
44					 value="<?php echo $nick ?>"><?php echo $name ?></option>
45				<?php endforeach ?>
46				</select>
47			<?php else: ?>
48				<input type="hidden" name="executor" value="<?php echo $template['user'] ?>">
49				<strong>
50				<?php echo $template['user_name'] ?>
51				</strong>
52			<?php endif ?>
53
54
55			</span>
56			</div>
57
58			<div class="row">
59			<label for="tasktype"><?php echo $bezlang['task_type'] ?>:</label>
60			<span>
61				<?php if ($template['auth_level'] < 15): ?>
62					<input type="hidden" name="tasktype" value="<?php echo $nparams['tasktype'] ?>">
63					<strong>
64					<?php echo $template['tasktype_name'] ?>
65					</strong>
66				<?php else: ?>
67					<select id="tasktype" name="tasktype">
68						<option <?php if ($value['tasktype'] == '') echo 'selected' ?> value=""><?php echo $bezlang['tasks_no_type'] ?></option>
69						<?php foreach ($template['tasktypes'] as $tasktype): ?>
70							<option <?php if ($value['tasktype'] == $tasktype->id) echo 'selected' ?> value="<?php echo $tasktype->id ?>"><?php echo $tasktype->type ?></option>
71						<?php endforeach ?>
72					</select>
73				<?php endif ?>
74			</span>
75			</div>
76
77			<div class="row">
78			<label for="action"><?php echo $bezlang['class'] ?>:</label>
79			<span>
80				<strong>
81					<?php if (!isset($template['issue'])): ?>
82						<?php echo $bezlang['programme'] ?>
83					<?php elseif (!isset($template['cause'])): ?>
84						<?php echo $bezlang['correction'] ?>
85						<input type="hidden" name="action" value="0" />
86					<?php elseif ($template['cause']['potential'] == 0): ?>
87						<?php echo $bezlang['corrective_action'] ?>
88						<input type="hidden" name="action" value="1" />
89					<?php else: ?>
90						<?php echo $bezlang['preventive_action'] ?>
91						<input type="hidden" name="action" value="2" />
92					<?php endif ?>
93				</strong>
94			</span>
95			</div>
96
97			<div class="row">
98				<label for="task"><?php echo $bezlang['description'] ?>:</label>
99				<span>
100					<div class="bez_toolbar"></div>
101					<textarea name="task" id="task" data-validation="required"><?php echo $value['task'] ?></textarea>
102				</span>
103			</div>
104
105			<div class="row task_plan_field">
106				<label for="plan_date"><?php echo $bezlang['plan_date'] ?>:</label>
107				<span>
108					<input name="plan_date" style="width:90px;" data-validation="required,date" value="<?php echo $value['plan_date'] ?>"/>
109				<div style="display:inline" id="task_datapair">
110					<?php echo $bezlang['from_hour'] ?>
111					<input name="start_time" style="width:60px;" class="time start" value="<?php echo $value['start_time'] ?>"
112					data-validation="required,custom"
113					data-validation-regexp="^(\d{1,2}):(\d{1,2})$"
114					data-validation-depends-on="all_day_event"
115					/>
116					<?php echo $bezlang['to_hour'] ?>
117					<input name="finish_time" style="width:60px;" class="time end" value="<?php echo $value['finish_time'] ?>"
118					data-validation="required,custom"
119					data-validation-regexp="^(\d{1,2}):(\d{1,2})$"
120					data-validation-depends-on="all_day_event"
121					/>
122				</div>
123				</span>
124			</div>
125
126			<div class="row">
127				<label></label>
128				<span style="dispaly: block; position:relative; top: -10px;">
129					<label><input type="checkbox" name="all_day_event" value="1"
130				<?php if (!isset($value['all_day_event']) || $value['all_day_event'] === '1'): ?>
131					checked
132				<?php endif ?> /> <?php echo $bezlang['all_day_event'] ?></label></span>
133			</div>
134
135
136			<div class="row">
137				<label for="cost"><?php echo $bezlang['cost'] ?>:</label>
138				<span><input 	type="number" name="cost" id="cost"
139								min="0" max="100000" step="50"
140								value="<?php echo $value['cost'] ?>"></span>
141			</div>
142			<?php if (isset($nparams['tid']) && $nparams['tid'] !== '-1'): ?>
143				<div class="row">
144				<label for="task_state"><?php echo $bezlang['task_state'] ?>:</label>
145				<span>
146					<strong><?php echo $bezlang[$template['state_string']] ?></strong>
147				</span>
148				</div>
149
150				<?php if ($template['state_string'] != 'task_opened'): ?>
151				<div class="row">
152					<label for="reason">
153						<?php if ($template['state_string'] == 'task_done'): ?>
154							<?php echo $bezlang['evaluation'] ?>:
155						<?php else: ?>
156							<?php echo $bezlang['reason'] ?>:
157						<?php endif ?>
158					</label>
159					<span><textarea name="reason" id="reason"><?php echo $value['reason'] ?></textarea></span>
160				</div>
161				<?php endif ?>
162			<?php endif ?>
163			<div class="row">
164				<label></label>
165				<span style="padding-top:10px;">
166					<input type="submit" value="<?php echo isset($template['button']) ? $template['button'] : $bezlang['add'] ?>">
167					<a href="?id=<?php
168				if (isset($template['issue'])) {
169					echo $this->id('issue', 'id', $template['issue']->id);
170				} else {
171					echo $this->id('show_task', 'tid', $nparams['tid']);
172				}
173				?>"
174				class="bez_delete_button bez_link_button">
175					<?php echo $bezlang['cancel'] ?>
176				</a>
177			</span>
178		</fieldset>
179
180
181	</form>
182
183
184