add a confirm modal before resetting task record

This commit is contained in:
Julien Calixte
2023-12-03 22:31:13 +01:00
parent 1167a73557
commit 5e5015d14e

View File

@@ -91,6 +91,12 @@ const addSteps = (steps: Stepable[]) => {
taskStore.addStepsToTask(props.taskId, steps, record.value.currentStepId) taskStore.addStepsToTask(props.taskId, steps, record.value.currentStepId)
} }
const reset = () => {
if (window.confirm('Are you sure you want to reset the record?')) {
recordStore.reset(props.taskId)
}
}
const activeElement = useActiveElement() const activeElement = useActiveElement()
const INPUT_MATTERS = ['INPUT', 'TEXTAREA'] const INPUT_MATTERS = ['INPUT', 'TEXTAREA']
const notUsingInput = computed( const notUsingInput = computed(
@@ -169,11 +175,7 @@ onUnmounted(() => {
<img src="/icons/plus.svg" alt="plus" /> <img src="/icons/plus.svg" alt="plus" />
</button> </button>
<button <button v-if="hasStarted" class="button is-warning" @click="reset">
v-if="hasStarted"
class="button is-warning"
@click="recordStore.reset(taskId)"
>
<img src="/icons/recycle.svg" alt="reset" /> <img src="/icons/recycle.svg" alt="reset" />
</button> </button>
</div> </div>