A number of task improvements. Not optimal tag selection
Some checks failed
Build BAB Application Deployment Artifact / build (push) Failing after 2m20s
Some checks failed
Build BAB Application Deployment Artifact / build (push) Failing after 2m20s
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
"appwrite": "^13.0.0",
|
"appwrite": "^13.0.0",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
"vue": "3",
|
"vue": "3",
|
||||||
|
"vue-multiselect": "^2.1.9",
|
||||||
"vue-router": "4"
|
"vue-router": "4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>My component</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
</script>
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
color="primary"
|
color="primary"
|
||||||
:disable="loading"
|
:disable="loading"
|
||||||
label="New Task"
|
label="New Task"
|
||||||
@click="newTask"
|
to="/task/new"
|
||||||
/>
|
/>
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="tasks.length !== 0"
|
v-if="tasks.length !== 0"
|
||||||
|
|||||||
181
src/pages/task/NewTaskPage.vue
Normal file
181
src/pages/task/NewTaskPage.vue
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
<template>
|
||||||
|
<toolbar-component pageTitle="Tasks" />
|
||||||
|
<q-page padding>
|
||||||
|
<div class="q-pa-md" style="max-width: 400px">
|
||||||
|
<q-form @submit="onSubmit" @reset="onReset" class="q-gutter-md">
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
v-model="newTask.title"
|
||||||
|
label="Task Title"
|
||||||
|
hint="A short description of the task"
|
||||||
|
lazy-rules
|
||||||
|
:rules="[
|
||||||
|
(val) =>
|
||||||
|
(val && val.length > 0) || 'Please enter a title for the task',
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
<q-editor
|
||||||
|
filled
|
||||||
|
v-model="newTask.description"
|
||||||
|
label="Detailed Description"
|
||||||
|
hint="A detailed description of the task"
|
||||||
|
lazy-rules
|
||||||
|
placeholder="Enter a detailed description..."
|
||||||
|
/>
|
||||||
|
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
v-model="newTask.dueDate"
|
||||||
|
mask="date"
|
||||||
|
:rules="[dateRule]"
|
||||||
|
hint="Enter the due date"
|
||||||
|
lazy-rules
|
||||||
|
>
|
||||||
|
<template v-slot:append>
|
||||||
|
<q-icon name="event" class="cursor-pointer">
|
||||||
|
<q-popup-proxy
|
||||||
|
cover
|
||||||
|
transition-show="scale"
|
||||||
|
transition-hide="scale"
|
||||||
|
>
|
||||||
|
<q-date
|
||||||
|
v-model="newTask.dueDate"
|
||||||
|
@input="updateDateISO"
|
||||||
|
today-btn
|
||||||
|
>
|
||||||
|
<div class="row items-center justify-end">
|
||||||
|
<q-btn v-close-popup label="Close" color="primary" flat />
|
||||||
|
</div>
|
||||||
|
</q-date>
|
||||||
|
</q-popup-proxy>
|
||||||
|
</q-icon>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
<q-input
|
||||||
|
outlined
|
||||||
|
filled
|
||||||
|
v-model="tagInput"
|
||||||
|
label="Add required skills"
|
||||||
|
@input="filterMatches"
|
||||||
|
/>
|
||||||
|
<q-btn
|
||||||
|
label="Add Tags"
|
||||||
|
@click="addTags"
|
||||||
|
color="primary"
|
||||||
|
class="q-ml-md"
|
||||||
|
/>
|
||||||
|
<div class="q-mt-md">
|
||||||
|
<q-badge
|
||||||
|
v-for="(tag, index) in newTask.required_skills"
|
||||||
|
:key="index"
|
||||||
|
class="q-mr-sm"
|
||||||
|
>{{ tag }}</q-badge
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<q-list v-if="matches.length > 0 && tagInput"
|
||||||
|
><q-item
|
||||||
|
v-for="(match, index) in matches"
|
||||||
|
:key="index"
|
||||||
|
clickable
|
||||||
|
@click="selectMatch(match)"
|
||||||
|
>{{ match }}</q-item
|
||||||
|
></q-list
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<q-btn
|
||||||
|
label="Submit"
|
||||||
|
type="submit"
|
||||||
|
color="primary"
|
||||||
|
flat
|
||||||
|
class="q-ml-sm"
|
||||||
|
/>
|
||||||
|
<q-btn
|
||||||
|
label="Reset"
|
||||||
|
type="reset"
|
||||||
|
color="primary"
|
||||||
|
flat
|
||||||
|
class="q-ml-sm"
|
||||||
|
/>
|
||||||
|
<q-btn
|
||||||
|
label="Cancel"
|
||||||
|
color="secondary"
|
||||||
|
flat
|
||||||
|
class="q-ml-sm"
|
||||||
|
@click="$router.go(-1)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</q-form>
|
||||||
|
</div>
|
||||||
|
</q-page>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { reactive, ref, computed } from 'vue';
|
||||||
|
import { useTaskStore } from 'src/stores/task';
|
||||||
|
import type { Task } from 'src/stores/task';
|
||||||
|
import ToolbarComponent from 'src/components/ToolbarComponent.vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { date } from 'quasar';
|
||||||
|
|
||||||
|
const taskStore = useTaskStore();
|
||||||
|
|
||||||
|
const tagInput = ref('');
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const newTask = reactive({
|
||||||
|
description: '',
|
||||||
|
dueDate: date.formatDate(Date.now(), 'YYYY-MM-DD'),
|
||||||
|
required_skills: [],
|
||||||
|
} as unknown as Task);
|
||||||
|
async function onSubmit() {
|
||||||
|
try {
|
||||||
|
await taskStore.addTask(newTask);
|
||||||
|
console.log('Created Task');
|
||||||
|
router.go(-1);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to create new Task: ', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
taskStore.fetchSkillTags();
|
||||||
|
console.log(taskStore.skillTags.map((t) => t.name));
|
||||||
|
const matches = computed(() => {
|
||||||
|
if (!tagInput.value) return [];
|
||||||
|
return taskStore.skillTags
|
||||||
|
.map((t) => t.name)
|
||||||
|
.filter((t) => t.toLowerCase().includes(tagInput.value.toLowerCase()));
|
||||||
|
});
|
||||||
|
|
||||||
|
const addTags = () => {
|
||||||
|
if (tagInput.value.trim() !== '') {
|
||||||
|
const newTags: string[] = tagInput.value
|
||||||
|
.split(',')
|
||||||
|
.map((t) => t.trim())
|
||||||
|
.filter((t) => t !== '' && !newTask.required_skills.includes(t));
|
||||||
|
newTask.required_skills.push(...newTags);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const filterMatches = () => {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Method to update the model in ISO 8601 format
|
||||||
|
const updateDateISO = (value: string) => {
|
||||||
|
newTask.dueDate = date.formatDate(value, 'YYYY-MM-DD');
|
||||||
|
};
|
||||||
|
const dateRule = (val: string) => {
|
||||||
|
// Check if the date is valid using Quasar's date utils if needed
|
||||||
|
// For simplicity, we are directly checking the date string validity
|
||||||
|
return (val && !isNaN(Date.parse(val))) || 'Please enter a valid date';
|
||||||
|
};
|
||||||
|
|
||||||
|
const selectMatch = (match: string) => {
|
||||||
|
if (!newTask.required_skills.includes(match)) {
|
||||||
|
newTask.required_skills.push(match);
|
||||||
|
tagInput.value = ''; // Clear input field and close match list
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function onReset() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref } from 'vue';
|
|
||||||
import { useTaskStore } from 'stores/task';
|
import { useTaskStore } from 'stores/task';
|
||||||
import ToolbarComponent from 'src/components/ToolbarComponent.vue';
|
import ToolbarComponent from 'src/components/ToolbarComponent.vue';
|
||||||
import TaskListComponent from 'src/components/task/TaskListComponent.vue';
|
import TaskListComponent from 'src/components/task/TaskListComponent.vue';
|
||||||
@@ -1,24 +1,9 @@
|
|||||||
import ScheduleIndexPage from 'pages/schedule/ScheduleIndexPage.vue';
|
|
||||||
import ChecklistPageVue from 'pages/ChecklistPage.vue';
|
|
||||||
import LoginPageVue from 'pages/LoginPage.vue';
|
|
||||||
import ReferencePageVue from 'src/pages/reference/ReferencePage.vue';
|
|
||||||
import ReferenceIndexPageVue from 'src/pages/reference/ReferenceIndexPage.vue';
|
|
||||||
import ReferenceItemPageVue from 'src/pages/reference/ReferenceItemPage.vue';
|
|
||||||
import MainLayoutVue from 'src/layouts/MainLayout.vue';
|
|
||||||
import BoatPageVue from 'src/pages/BoatPage.vue';
|
|
||||||
import CertificationPageVue from 'src/pages/CertificationPage.vue';
|
|
||||||
import IndexPageVue from 'src/pages/IndexPage.vue';
|
|
||||||
import ProfilePageVue from 'src/pages/ProfilePage.vue';
|
|
||||||
import TaskPageVue from 'src/pages/TaskPage.vue';
|
|
||||||
import { RouteRecordRaw } from 'vue-router';
|
import { RouteRecordRaw } from 'vue-router';
|
||||||
import SchedulePageView from 'pages/schedule/SchedulePageView.vue';
|
|
||||||
import BoatReservationPageVue from 'src/pages/schedule/BoatReservationPage.vue';
|
|
||||||
import BoatScheduleViewVue from 'src/pages/schedule/BoatScheduleView.vue';
|
|
||||||
|
|
||||||
const routes: RouteRecordRaw[] = [
|
const routes: RouteRecordRaw[] = [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
component: MainLayoutVue,
|
component: () => import('src/layouts/MainLayout.vue'),
|
||||||
// If we get so big we need lazy loading, we can use imports again
|
// If we get so big we need lazy loading, we can use imports again
|
||||||
// component: () => import('layouts/MainLayout.vue'),
|
// component: () => import('layouts/MainLayout.vue'),
|
||||||
children: [
|
children: [
|
||||||
@@ -26,69 +11,83 @@ const routes: RouteRecordRaw[] = [
|
|||||||
path: '',
|
path: '',
|
||||||
// If we get so big we need lazy loading, we can use imports again
|
// If we get so big we need lazy loading, we can use imports again
|
||||||
// component: () => import('pages/IndexPage.vue'),
|
// component: () => import('pages/IndexPage.vue'),
|
||||||
component: IndexPageVue,
|
component: () => import('src/pages/IndexPage.vue'),
|
||||||
name: 'index',
|
name: 'index',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/boat',
|
path: '/boat',
|
||||||
component: BoatPageVue,
|
component: () => import('src/pages/BoatPage.vue'),
|
||||||
name: 'boat',
|
name: 'boat',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/schedule',
|
path: '/schedule',
|
||||||
component: SchedulePageView,
|
component: () => import('pages/schedule/SchedulePageView.vue'),
|
||||||
name: 'schedule',
|
name: 'schedule',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: ScheduleIndexPage,
|
component: () => import('pages/schedule/ScheduleIndexPage.vue'),
|
||||||
name: 'schedule-index',
|
name: 'schedule-index',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'book',
|
path: 'book',
|
||||||
component: BoatReservationPageVue,
|
component: () =>
|
||||||
|
import('src/pages/schedule/BoatReservationPage.vue'),
|
||||||
name: 'reserve-boat',
|
name: 'reserve-boat',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'view',
|
path: 'view',
|
||||||
component: BoatScheduleViewVue,
|
component: () => import('src/pages/schedule/BoatScheduleView.vue'),
|
||||||
name: 'boat-schedule',
|
name: 'boat-schedule',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/certification',
|
path: '/certification',
|
||||||
component: CertificationPageVue,
|
component: () => import('src/pages/CertificationPage.vue'),
|
||||||
name: 'certification',
|
name: 'certification',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/task',
|
path: '/task',
|
||||||
component: TaskPageVue,
|
|
||||||
name: 'task',
|
name: 'task',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: () => import('src/pages/task/TaskPage.vue'),
|
||||||
|
name: 'task-index',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'new',
|
||||||
|
component: () => import('pages/task/NewTaskPage.vue'),
|
||||||
|
name: 'new-task',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/checklist',
|
path: '/checklist',
|
||||||
component: ChecklistPageVue,
|
component: () => import('pages/ChecklistPage.vue'),
|
||||||
name: 'checklist',
|
name: 'checklist',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/profile',
|
path: '/profile',
|
||||||
component: ProfilePageVue,
|
component: () => import('src/pages/ProfilePage.vue'),
|
||||||
name: 'profile',
|
name: 'profile',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/reference',
|
path: '/reference',
|
||||||
component: ReferencePageVue,
|
component: () => import('src/pages/reference/ReferencePage.vue'),
|
||||||
name: 'reference',
|
name: 'reference',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: ReferenceIndexPageVue,
|
component: () =>
|
||||||
|
import('src/pages/reference/ReferenceIndexPage.vue'),
|
||||||
name: 'reference-index',
|
name: 'reference-index',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/reference/:id/view',
|
path: '/reference/:id/view',
|
||||||
component: ReferenceItemPageVue,
|
component: () =>
|
||||||
|
import('src/pages/reference/ReferenceItemPage.vue'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -112,7 +111,7 @@ const routes: RouteRecordRaw[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
component: LoginPageVue,
|
component: () => import('pages/LoginPageVue.vue'),
|
||||||
name: 'login',
|
name: 'login',
|
||||||
meta: {
|
meta: {
|
||||||
publicRoute: true,
|
publicRoute: true,
|
||||||
|
|||||||
@@ -2,14 +2,25 @@ import { defineStore } from 'pinia';
|
|||||||
import { AppwriteIds, databases, ID } from 'src/boot/appwrite';
|
import { AppwriteIds, databases, ID } from 'src/boot/appwrite';
|
||||||
import type { Models } from 'appwrite';
|
import type { Models } from 'appwrite';
|
||||||
|
|
||||||
|
export enum TASKSTATUS {
|
||||||
|
READY = 'ready',
|
||||||
|
COMPLETE = 'complete',
|
||||||
|
WAITING = 'waiting',
|
||||||
|
}
|
||||||
export interface Task extends Models.Document {
|
export interface Task extends Models.Document {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
taskLabels: string[];
|
required_skills: string[];
|
||||||
dueDate: Date;
|
tags: string[];
|
||||||
parentId: string;
|
due_date: string;
|
||||||
|
duration: number;
|
||||||
|
volunteers: string[];
|
||||||
|
volunteers_required: number;
|
||||||
|
status: TASKSTATUS;
|
||||||
|
depends_on: string;
|
||||||
completed: boolean;
|
completed: boolean;
|
||||||
}
|
boat: string;
|
||||||
|
} // TODO: convert some of these strings into objects.
|
||||||
|
|
||||||
export interface TaskTag extends Models.Document {
|
export interface TaskTag extends Models.Document {
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -5031,6 +5031,11 @@ vue-eslint-parser@^9.4.2:
|
|||||||
lodash "^4.17.21"
|
lodash "^4.17.21"
|
||||||
semver "^7.3.6"
|
semver "^7.3.6"
|
||||||
|
|
||||||
|
vue-multiselect@^2.1.9:
|
||||||
|
version "2.1.9"
|
||||||
|
resolved "https://registry.yarnpkg.com/vue-multiselect/-/vue-multiselect-2.1.9.tgz#803628d5ff6c5925320930c965bdaae8934b92b1"
|
||||||
|
integrity sha512-nGEppmzhQQT2iDz4cl+ZCX3BpeNhygK50zWFTIRS+r7K7i61uWXJWSioMuf+V/161EPQjexI8NaEBdUlF3dp+g==
|
||||||
|
|
||||||
vue-router@4:
|
vue-router@4:
|
||||||
version "4.3.0"
|
version "4.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.3.0.tgz#d5913f27bf68a0a178ee798c3c88be471811a235"
|
resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-4.3.0.tgz#d5913f27bf68a0a178ee798c3c88be471811a235"
|
||||||
|
|||||||
Reference in New Issue
Block a user