95 lines
4.3 KiB
PHP
95 lines
4.3 KiB
PHP
<?php
|
|||
|
|
/**
|
||
|
|
* 任务设置(v24 用户第 9、10 条)
|
||
|
|
*
|
||
|
|
* 用户原话:「和观影一样,新建任务旁边,也是设置,对任务的设置。
|
||
|
|
* 用户可以设置任务分类、看板。还可以在这里查看已完成的任务,
|
||
|
|
* 已完成的任务,按照分类来进行展示和搜索就可以了。」
|
||
|
|
*
|
||
|
|
* 所以这一页两块:看板 / 分类,各有增删改;旁边给一个进「已完成」的入口。
|
||
|
|
*
|
||
|
|
* @param array $boards 看板(带 open_count:里面还有几件没做完)
|
||
|
|
* @param array $categories 分类(带 used_count:被几条任务用过)
|
||
|
|
*/
|
||
|
|
$canWrite = \App\Auth::canWrite();
|
||
|
|
?>
|
||
|
|
<div class="page-head">
|
||
|
|
<h1>任务设置</h1>
|
||
|
|
<span class="sub">看板与分类都由你自己定</span>
|
||
|
|
<div class="actions">
|
||
|
|
<a class="btn btn-ghost" href="<?= e(url('tasks')) ?>">返回任务</a>
|
||
|
|
<a class="btn" href="<?= e(url('tasks/done')) ?>">已完成的任务</a>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<?php if (!$canWrite): ?>
|
||
|
|
<div class="card card-pad"><p class="empty-hint">只读账号不能改设置。</p></div>
|
||
|
|
<?php else: ?>
|
||
|
|
|
||
|
|
<div class="card card-pad">
|
||
|
|
<h2 class="cinema-h2">看板</h2>
|
||
|
|
<p class="small muted" style="margin-top:0">
|
||
|
|
看板是「分开看几摊事」用的(家务 / 装修 / 旅行准备 …)。任务看板顶上可以切换。
|
||
|
|
删掉一个看板时,里面的任务不会被删,会挪到默认看板。
|
||
|
|
</p>
|
||
|
|
<div class="set-list">
|
||
|
|
<?php foreach ($boards as $b): ?>
|
||
|
|
<form class="inline-form set-row" method="post" action="<?= e(url('tasks/board_update')) ?>">
|
||
|
|
<?= csrf_field() ?>
|
||
|
|
<input type="hidden" name="id" value="<?= (int)$b['id'] ?>">
|
||
|
|
<input class="input" name="name" value="<?= e((string)$b['name']) ?>" required>
|
||
|
|
<span class="small muted"><?= (int)($b['open_count'] ?? 0) ?> 件未完成</span>
|
||
|
|
<button class="btn btn-sm" type="submit">改名</button>
|
||
|
|
</form>
|
||
|
|
<?php if (count($boards) > 1): ?>
|
||
|
|
<form class="inline-form" method="post" action="<?= e(url('tasks/board_del')) ?>">
|
||
|
|
<?= csrf_field() ?>
|
||
|
|
<input type="hidden" name="id" value="<?= (int)$b['id'] ?>">
|
||
|
|
<button class="btn btn-ghost btn-sm" type="submit"
|
||
|
|
onclick="return confirm('删掉这个看板?里面的任务会挪到默认看板,不会丢。')">删除</button>
|
||
|
|
</form>
|
||
|
|
<?php else: ?>
|
||
|
|
<span class="small muted set-tail">最后一个看板不能删</span>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</div>
|
||
|
|
<form class="inline-form" method="post" action="<?= e(url('tasks/board_add')) ?>" style="margin-top:10px">
|
||
|
|
<?= csrf_field() ?>
|
||
|
|
<input class="input" name="name" placeholder="新看板名,如:装修" required>
|
||
|
|
<button class="btn btn-sm" type="submit">添加看板</button>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="card card-pad">
|
||
|
|
<h2 class="cinema-h2">分类</h2>
|
||
|
|
<p class="small muted" style="margin-top:0">
|
||
|
|
分类是给任务贴的标签(证件 / 报销 / 维修 …),用来在「已完成」里归类查看与搜索。
|
||
|
|
</p>
|
||
|
|
<div class="set-list">
|
||
|
|
<?php if (!$categories): ?>
|
||
|
|
<p class="empty-hint">还没有分类。</p>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php foreach ($categories as $c): ?>
|
||
|
|
<form class="inline-form set-row" method="post" action="<?= e(url('tasks/cat_update')) ?>">
|
||
|
|
<?= csrf_field() ?>
|
||
|
|
<input type="hidden" name="id" value="<?= (int)$c['id'] ?>">
|
||
|
|
<input class="input" name="name" value="<?= e((string)$c['name']) ?>" required>
|
||
|
|
<span class="small muted"><?= (int)($c['used_count'] ?? 0) ?> 条用过</span>
|
||
|
|
<button class="btn btn-sm" type="submit">改名</button>
|
||
|
|
</form>
|
||
|
|
<form class="inline-form" method="post" action="<?= e(url('tasks/cat_del')) ?>">
|
||
|
|
<?= csrf_field() ?>
|
||
|
|
<input type="hidden" name="id" value="<?= (int)$c['id'] ?>">
|
||
|
|
<button class="btn btn-ghost btn-sm" type="submit"
|
||
|
|
onclick="return confirm('删掉这个分类?用它标过的任务会变成「未分类」。')">删除</button>
|
||
|
|
</form>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</div>
|
||
|
|
<form class="inline-form" method="post" action="<?= e(url('tasks/cat_add')) ?>" style="margin-top:10px">
|
||
|
|
<?= csrf_field() ?>
|
||
|
|
<input class="input" name="name" placeholder="新分类名,如:证件" required>
|
||
|
|
<button class="btn btn-sm" type="submit">添加分类</button>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<?php endif; ?>
|