Browse Source

fix wrapping in task status numbers, check mark as active by default if a log would bring it at or past the target.

main
Gisle Aune 4 years ago
parent
commit
c43b180106
  1. 2
      svelte-ui/src/components/TaskEntry.svelte
  2. 27
      svelte-ui/src/forms/LogAddForm.svelte
  3. 2
      svelte-ui/src/forms/TaskDeleteForm.svelte

2
svelte-ui/src/components/TaskEntry.svelte

@ -36,7 +36,7 @@
</div> </div>
{:else} {:else}
<div class="icon"> <div class="icon">
{task.completedAmount} / {task.itemAmount}
{task.completedAmount}&nbsp;/&nbsp;{task.itemAmount}
</div> </div>
{/if} {/if}
<div class="name">{task.name}</div> <div class="name">{task.name}</div>

27
svelte-ui/src/forms/LogAddForm.svelte

@ -7,25 +7,25 @@ import logStore from "../stores/logs";
import projectStore, { fpProjectStore } from "../stores/project"; import projectStore, { fpProjectStore } from "../stores/project";
import { formatFormTime } from "../utils/time"; import { formatFormTime } from "../utils/time";
let loggedTime = formatFormTime(new Date);
let taskName = "";
let description = "";
let markInactive = false;
let error = null;
function onSubmit() {
const md = $modalStore; const md = $modalStore;
if (md.name !== "log.add") { if (md.name !== "log.add") {
throw new Error("Wrong form"); throw new Error("Wrong form");
} }
const task = md.task;
let loggedTime = formatFormTime(new Date);
let description = "";
let markInactive = task.completedAmount >= (task.itemAmount - 1);
let error = null;
function onSubmit() {
stuffLogClient.createLog({ stuffLogClient.createLog({
taskId: md.task.id,
taskId: task.id,
loggedTime: new Date(loggedTime).toISOString(), loggedTime: new Date(loggedTime).toISOString(),
description, description,
}).then(() => { }).then(() => {
if (markInactive) { if (markInactive) {
return stuffLogClient.updateTask(md.task.id, {active: false})
return stuffLogClient.updateTask(task.id, {active: false})
} }
}).then(() => { }).then(() => {
modalStore.close(); modalStore.close();
@ -43,19 +43,12 @@ import logStore from "../stores/logs";
function onClose() { function onClose() {
modalStore.close(); modalStore.close();
} }
$: {
const md = $modalStore;
if (md.name === "log.add") {
taskName = md.task.name;
}
}
</script> </script>
<Modal show title="Add Log" error={error} closable on:close={onClose}> <Modal show title="Add Log" error={error} closable on:close={onClose}>
<form on:submit|preventDefault={onSubmit}> <form on:submit|preventDefault={onSubmit}>
<label for="taskName">Task</label> <label for="taskName">Task</label>
<input disabled name="taskName" type="text" bind:value={taskName} />
<input disabled name="taskName" type="text" bind:value={task.name} />
<label for="loggedTime">Logged Time</label> <label for="loggedTime">Logged Time</label>
<input name="loggedTime" type="datetime-local" bind:value={loggedTime} /> <input name="loggedTime" type="datetime-local" bind:value={loggedTime} />

2
svelte-ui/src/forms/TaskDeleteForm.svelte

@ -55,6 +55,6 @@
<hr /> <hr />
<button type="submit">Delete1 Task</button>
<button type="submit">Delete Task</button>
</form> </form>
</Modal> </Modal>
Loading…
Cancel
Save