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