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