feat(activities): let every assignee finish their own share
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -201,6 +201,7 @@ const page = computed(() => {
|
||||
|
||||
const loading = ref(false);
|
||||
const error = ref('');
|
||||
const notice = ref('');
|
||||
const data = ref<PaginatedResponse<ActivityDto> | null>(null);
|
||||
const q = ref(typeof route.query.q === 'string' ? route.query.q : '');
|
||||
const users = ref<OrgUserDto[]>([]);
|
||||
@@ -837,6 +838,30 @@ function onFacetDone() {
|
||||
openCol.value = null;
|
||||
}
|
||||
|
||||
function assigneePeopleOf(item: ActivityDto) {
|
||||
if (item.assignees?.length) return item.assignees;
|
||||
return item.assignee ? [item.assignee] : [];
|
||||
}
|
||||
|
||||
function needsEveryone(item: ActivityDto) {
|
||||
return item.completionMode === 'all' && assigneePeopleOf(item).length > 1;
|
||||
}
|
||||
|
||||
function canMarkShare(item: ActivityDto) {
|
||||
if (item.status !== 'open') return false;
|
||||
if (!needsEveryone(item)) return true;
|
||||
const mine = auth.user?.id;
|
||||
if (!mine) return false;
|
||||
return (
|
||||
assigneePeopleOf(item).some((person) => person.id === mine) &&
|
||||
!item.completedByIds?.includes(mine)
|
||||
);
|
||||
}
|
||||
|
||||
function completeLabel(item: ActivityDto) {
|
||||
return needsEveryone(item) ? 'انجام سهم من' : 'انجام شد';
|
||||
}
|
||||
|
||||
async function complete(id: string) {
|
||||
menuId.value = null;
|
||||
boardMenuId.value = null;
|
||||
@@ -1503,6 +1528,7 @@ onUnmounted(() => {
|
||||
</div>
|
||||
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
<p v-if="notice" class="ok">{{ notice }}</p>
|
||||
<p v-if="importMsg" class="ok">{{ importMsg }}</p>
|
||||
|
||||
<div v-if="selectMode" class="select-bar">
|
||||
@@ -1532,6 +1558,7 @@ onUnmounted(() => {
|
||||
@stages-changed="onStagesChanged"
|
||||
@add="openAddInStage"
|
||||
@error="(msg: string) => (error = msg)"
|
||||
@notice="(msg: string) => (notice = msg)"
|
||||
@menu-deal="onBoardMenu"
|
||||
@toggle-select="toggleSelect"
|
||||
@bulk-delete="askBulkDelete"
|
||||
@@ -1755,8 +1782,8 @@ onUnmounted(() => {
|
||||
<button v-if="canPromotePrior(item)" type="button" @click="promotePriorActivity(item.id)">
|
||||
انتقال به کار جاری
|
||||
</button>
|
||||
<button v-if="item.status === 'open'" type="button" @click="complete(item.id)">
|
||||
انجام شد
|
||||
<button v-if="canMarkShare(item)" type="button" @click="complete(item.id)">
|
||||
{{ completeLabel(item) }}
|
||||
</button>
|
||||
<button type="button" class="danger" @click="askDeleteActivity(item.id, item.title)">
|
||||
حذف
|
||||
@@ -1845,8 +1872,8 @@ onUnmounted(() => {
|
||||
<button v-if="canPromotePrior(item)" type="button" @click="promotePriorActivity(item.id)">
|
||||
انتقال به کار جاری
|
||||
</button>
|
||||
<button v-if="item.status === 'open'" type="button" @click="complete(item.id)">
|
||||
انجام شد
|
||||
<button v-if="canMarkShare(item)" type="button" @click="complete(item.id)">
|
||||
{{ completeLabel(item) }}
|
||||
</button>
|
||||
<button type="button" class="danger" @click="askDeleteActivity(item.id, item.title)">
|
||||
حذف
|
||||
|
||||
Reference in New Issue
Block a user