Create a project workflow by typing to generate approval cards.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref, watch } from 'vue';
|
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||||
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
import { RouterLink, useRoute, useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { api } from '@/lib/api';
|
import { api } from '@/lib/api';
|
||||||
@@ -135,6 +135,14 @@ function isOverdue(item: ActivityDto) {
|
|||||||
return startOfLocalDay(new Date(item.dueAt)).getTime() < startOfLocalDay().getTime();
|
return startOfLocalDay(new Date(item.dueAt)).getTime() < startOfLocalDay().getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isMobile = ref(false);
|
||||||
|
|
||||||
|
function cardStatusText(item: ActivityDto) {
|
||||||
|
if (item.status === 'done') return 'انجام شد';
|
||||||
|
if (item.status === 'canceled') return 'لغو شده';
|
||||||
|
return 'انجام نشده';
|
||||||
|
}
|
||||||
|
|
||||||
function uiStatus(item: ActivityDto): UiStatus {
|
function uiStatus(item: ActivityDto): UiStatus {
|
||||||
if (item.status === 'done') return 'done';
|
if (item.status === 'done') return 'done';
|
||||||
if (item.status === 'canceled') return 'canceled';
|
if (item.status === 'canceled') return 'canceled';
|
||||||
@@ -317,10 +325,22 @@ watch(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let mobileQuery: MediaQueryList | null = null;
|
||||||
|
function syncMobile() {
|
||||||
|
isMobile.value = mobileQuery?.matches ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
mobileQuery = window.matchMedia('(max-width: 899px)');
|
||||||
|
syncMobile();
|
||||||
|
mobileQuery.addEventListener('change', syncMobile);
|
||||||
void load();
|
void load();
|
||||||
void loadCounts();
|
void loadCounts();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
mobileQuery?.removeEventListener('change', syncMobile);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -510,7 +530,7 @@ onMounted(() => {
|
|||||||
{{ statusLabel[uiStatus(item)] }}
|
{{ statusLabel[uiStatus(item)] }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="row-more" @click.stop>
|
<div v-if="!isMobile" class="row-more" @click.stop>
|
||||||
<UiDropdownMenu
|
<UiDropdownMenu
|
||||||
:open="menuId === item.id"
|
:open="menuId === item.id"
|
||||||
align="end"
|
align="end"
|
||||||
@@ -563,6 +583,7 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-side">
|
<div class="card-side">
|
||||||
<UiDropdownMenu
|
<UiDropdownMenu
|
||||||
|
v-if="isMobile"
|
||||||
:open="menuId === item.id"
|
:open="menuId === item.id"
|
||||||
align="end"
|
align="end"
|
||||||
@update:open="(v) => (menuId = v ? item.id : null)"
|
@update:open="(v) => (menuId = v ? item.id : null)"
|
||||||
@@ -595,17 +616,8 @@ onMounted(() => {
|
|||||||
<UiIcon name="calendar" :size="14" />
|
<UiIcon name="calendar" :size="14" />
|
||||||
{{ dateText(item) }}
|
{{ dateText(item) }}
|
||||||
</span>
|
</span>
|
||||||
<button
|
<span class="status" :class="item.status === 'done' ? 'done' : item.status === 'canceled' ? 'canceled' : 'planned'">
|
||||||
v-if="item.status === 'open'"
|
{{ cardStatusText(item) }}
|
||||||
class="done-btn"
|
|
||||||
type="button"
|
|
||||||
@click="complete(item.id)"
|
|
||||||
>
|
|
||||||
<UiIcon name="check" :size="14" />
|
|
||||||
انجام شد
|
|
||||||
</button>
|
|
||||||
<span v-else class="status" :class="uiStatus(item)">
|
|
||||||
{{ statusLabel[uiStatus(item)] }}
|
|
||||||
</span>
|
</span>
|
||||||
</footer>
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
|
|||||||
Reference in New Issue
Block a user