Initial commit

This commit is contained in:
2024-06-15 12:55:41 +07:00
commit 9939364128
35 changed files with 7941 additions and 0 deletions
+89
View File
@@ -0,0 +1,89 @@
<script setup>
import {invoke} from "@tauri-apps/api";
import {ref} from "vue";
let name = "";
let description = "";
let priority = "0";
let error = ref(" ");
async function create_task(){
if (name.replace(/ /g,'') === ""){
error.value = "Название задачи не может быть пустым!";
} else{
let nowDateTime = new Date();
let date = nowDateTime.getFullYear() + "." + ('0' + (nowDateTime.getMonth()+1)).slice(-2) + '.'
+ ('0' + nowDateTime.getDate()).slice(-2);
let time = ('0' + nowDateTime.getHours()).slice(-2) + ":" + ('0' + nowDateTime.getMinutes()).slice(-2);
await invoke('add_task', {
date: date,
time: time,
name: name,
description: description,
priority: priority
});
location.reload();
}
}
</script>
<template>
<div id="create-task-modal" tabindex="-1" aria-hidden="true" class="px-[5vw] md:px-[10vw] lg:px-[15vw] absolute overflow-y-auto overflow-x-hidden w-full top-20 lg:top-24 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="create_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">
<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>
<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" />
</div>
</div>
<div>
<div class="flex items-center justify-between">
<label for="description" class="block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200">Описание</label>
</div>
<div class="mt-2">
<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="Создать">
<p class="ml-3 text-red-500">{{error}}</p>
</div>
</form>
</div>
</div>
</template>
<style scoped>
</style>
+69
View File
@@ -0,0 +1,69 @@
<script setup>
import {invoke} from "@tauri-apps/api";
const props = defineProps({
task_id: String,
task_name: String,
task_description: String
})
let name = props.task_name
let description = props.task_description
async function send_edited_task(){
await invoke('edit_task', {
idTask: props.task_id,
name: name,
description: description
}).then(() => location.reload());
}
</script>
<template>
<div id="create-task-modal" tabindex="-1" aria-hidden="true" class="px-[5vw] md:px-[10vw] lg:px-[15vw] absolute overflow-y-auto overflow-x-hidden w-full top-20 lg:top-24 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">
Новая задача
</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>
<label for="name" class="block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200">Задача</label>
<div class="mt-2">
<input 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>
<div>
<div class="flex items-center justify-between">
<label for="description" class="block text-sm font-medium leading-6 text-gray-900 dark:text-gray-200">Описание</label>
</div>
<div class="mt-2">
<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>
<!-- 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>