Добавление системы приоритетов

This commit is contained in:
2024-06-15 15:34:07 +07:00
parent 9939364128
commit f4fc01c56d
5 changed files with 170 additions and 33 deletions
+3 -3
View File
@@ -4,7 +4,7 @@ import {ref} from "vue";
let name = "";
let description = "";
let priority = "0";
let priority = 0;
let error = ref(" ");
@@ -22,7 +22,7 @@ async function create_task(){
time: time,
name: name,
description: description,
priority: priority
priority: priority.toString()
});
location.reload();
@@ -52,7 +52,7 @@ async function create_task(){
<div>
<label for="name" class="block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200">Задача</label>
<div class="mt-2">
<input @input="error=' '" v-model="name" id="name" name="name" type="text" required class="px-2 block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-inset sm:text-sm sm:leading-6" />
<input @input="error=' '" maxlength="80" v-model="name" id="name" name="name" type="text" required class="px-2 block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-inset sm:text-sm sm:leading-6" />
</div>
</div>
+17 -6
View File
@@ -4,17 +4,20 @@ import {invoke} from "@tauri-apps/api";
const props = defineProps({
task_id: String,
task_name: String,
task_description: String
task_description: String,
task_priority: String
})
let name = props.task_name
let description = props.task_description
let name = props.task_name;
let description = props.task_description;
let priority = parseInt(props.task_priority);
async function send_edited_task(){
await invoke('edit_task', {
idTask: props.task_id,
name: name,
description: description
description: description,
priority: priority.toString()
}).then(() => location.reload());
}
</script>
@@ -27,7 +30,7 @@ async function send_edited_task(){
<!-- Modal header -->
<div class="flex items-center justify-between px-5 py-2 md:py-3 border-b rounded-t">
<h3 class="text-xl font-semibold text-gray-700 dark:text-gray-100">
Новая задача
Изменить задачу
</h3>
<button type="button" @click="$emit('close')" class="transition-colors text-gray-400 dark:text-gray-300 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center" data-modal-hide="default-modal">
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
@@ -53,11 +56,19 @@ async function send_edited_task(){
<textarea v-model="description" id="description" name="description" class="px-2 py-1.5 block w-full rounded-md border-0 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-inset sm:text-sm sm:leading-6" />
</div>
</div>
<div>
<div class="flex items-center justify-between">
<label for="priority" class="block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200">Приоритет</label>
</div>
<div class="mt-2">
<input v-model="priority" type="number" required min="0" max="10" step="1" id="priority" name="priority" class="px-2 py-1.5 block w-48 rounded-md border-0 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-inset sm:text-sm sm:leading-6" />
</div>
</div>
</div>
</div>
<!-- Modal footer -->
<div class="flex items-center py-3 px-5 md:p-3 border-t border-gray-200 rounded-b">
<input type="submit" class="text-white bg-green-500 hover:bg-green-600 transition-colors font-medium rounded-lg text-sm px-5 py-2.5 text-center" value="Создать">
<input type="submit" class="text-white bg-green-500 hover:bg-green-600 transition-colors font-medium rounded-lg text-sm px-5 py-2.5 text-center" value="Изменить">
</div>
</form>
</div>
+73
View File
@@ -0,0 +1,73 @@
<script setup>
import {invoke} from "@tauri-apps/api";
import {Icon} from "@iconify/vue";
import {ref} from "vue";
const props = defineProps({
task_id: String,
task_name: String,
task_priority: String
})
let priority = ref(parseInt(props.task_priority));
async function send_edited_task(){
await invoke('set_task_field', {
idTask: props.task_id,
field: 'priority',
value: priority.value.toString()
}).then(() => location.reload());
}
</script>
<template>
<div id="create-task-modal" tabindex="-1" aria-hidden="true" class="absolute left-[50%] translate-x-[-50%] overflow-y-auto overflow-x-hidden w-50 top-20 lg:top-32 z-50">
<div class="relative p-4 max-h-full">
<!-- Modal content -->
<form class="relative bg-white rounded-lg shadow dark:bg-[rgb(50,50,50)]" @submit.prevent="send_edited_task">
<!-- Modal header -->
<div class="flex items-center justify-between px-5 py-2 md:py-3 border-b rounded-t">
<h3 class="text-xl font-semibold text-gray-700 dark:text-gray-100 mr-2">
Изменение приоритета
</h3>
<button type="button" @click="$emit('close')" class="transition-colors text-gray-400 dark:text-gray-300 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center" data-modal-hide="default-modal">
<svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
</svg>
</button>
</div>
<!-- Modal body -->
<div class="p-4 md:p-5 space-y-4">
<div class="space-y-6">
<div>
<div class="flex items-center justify-between">
<label for="name" class="block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200">Название задачи</label>
</div>
<div class="m-1 text-ellipsis" id="name">
<p class="dark:text-white">{{props.task_name}}</p>
</div>
<div class="flex items-center justify-between">
<label for="priority" class="block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200">Приоритет</label>
</div>
<div class="mt-2 flex gap-3 ml-2" id="priority">
<Icon @click="priority = 0" :class="[priority === 0 ? 'opacity-100' : 'opacity-50']" class="dark:text-white text-gray-500 cursor-pointer" icon="streamline:signal-none-solid" width="26" height="26"/>
<Icon @click="priority = 1" :class="[priority > 0 && priority < 4 ? 'opacity-100' : 'opacity-50']" class="text-orange-300 cursor-pointer" icon="streamline:signal-low-solid" width="26" height="26"/>
<Icon @click="priority = 5" :class="[priority >= 4 && priority < 7 ? 'opacity-100' : 'opacity-50']" class="text-amber-500 cursor-pointer" icon="streamline:signal-medium-solid" width="26" height="26"/>
<Icon @click="priority = 8" :class="[priority >= 7 && priority < 9 ? 'opacity-100' : 'opacity-50']" class="text-orange-600 cursor-pointer" icon="streamline:signal-full-solid" width="26" height="26"/>
<Icon @click="priority = 10" :class="[priority >= 9 ? 'opacity-100' : 'opacity-50']" class="text-red-500 cursor-pointer" icon="heroicons-solid:exclamation" width="32" height="32"/>
</div>
</div>
</div>
</div>
<!-- Modal footer -->
<div class="flex items-center py-3 px-5 md:p-3 border-t border-gray-200 rounded-b">
<input type="submit" class="text-white bg-green-500 hover:bg-green-600 transition-colors font-medium rounded-lg text-sm px-5 py-2.5 text-center" value="Изменить">
</div>
</form>
</div>
</div>
</template>
<style scoped>
</style>