merge: take origin/main for conflicting Vue files (main priority)
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 5.5
parent
5cf721f91e
commit
387c5c1676
@@ -1,17 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, watch } from 'vue';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Card as ACard,
|
||||
Checkbox as ACheckbox,
|
||||
Flex as AFlex,
|
||||
FormItem as AFormItem,
|
||||
Radio as ARadio,
|
||||
RadioGroup as ARadioGroup,
|
||||
Select as ASelect,
|
||||
Space as ASpace,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { Select as ASelect } from 'ant-design-vue';
|
||||
import type {
|
||||
DataAccessOwnerKind,
|
||||
DataAccessRule,
|
||||
@@ -26,12 +15,9 @@ import {
|
||||
PERSON_MOODS,
|
||||
sectionHasDataAccessLimits,
|
||||
} from '@mento/shared';
|
||||
|
||||
export type IdOption = { id: string; name: string };
|
||||
type Choice = { value: string; label: string };
|
||||
|
||||
const { Text: ATypographyText } = Typography;
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: SectionDataAccess;
|
||||
@@ -449,13 +435,17 @@ const filterSummary = computed(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-flex vertical :gap="compact ? 8 : 12">
|
||||
<a-radio-group v-model:value="mode" :disabled="disabled">
|
||||
<a-flex vertical :gap="4">
|
||||
<a-radio value="all">همهٔ {{ sectionLabel }}</a-radio>
|
||||
<a-radio value="rules">محدود با فیلتر</a-radio>
|
||||
</a-flex>
|
||||
</a-radio-group>
|
||||
<div class="dae" :class="{ compact }">
|
||||
<div class="dae-mode">
|
||||
<label>
|
||||
<input v-model="mode" type="radio" value="all" :disabled="disabled" />
|
||||
همهٔ {{ sectionLabel }}
|
||||
</label>
|
||||
<label>
|
||||
<input v-model="mode" type="radio" value="rules" :disabled="disabled" />
|
||||
محدود با فیلتر
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<template v-if="mode === 'rules'">
|
||||
<p class="hint">
|
||||
@@ -471,37 +461,30 @@ const filterSummary = computed(() => {
|
||||
</p>
|
||||
<p class="summary">{{ filterSummary }}</p>
|
||||
|
||||
<a-card size="small" title="مالک / مسئول" :bordered="true">
|
||||
<a-flex vertical :gap="8">
|
||||
<a-typography-text type="secondary">خالی = بدون محدودیت مالک</a-typography-text>
|
||||
<a-space wrap :size="8">
|
||||
<a-checkbox
|
||||
:checked="filter.owners?.includes('self')"
|
||||
:disabled="disabled"
|
||||
@change="toggleOwner('self')"
|
||||
>
|
||||
{{ ownerSelfLabel }}
|
||||
</a-checkbox>
|
||||
<a-checkbox
|
||||
:checked="filter.owners?.includes('team')"
|
||||
:disabled="disabled"
|
||||
@change="toggleOwner('team')"
|
||||
>
|
||||
تیمهای عضو
|
||||
</a-checkbox>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
<fieldset :disabled="disabled">
|
||||
<legend>مالک / مسئول</legend>
|
||||
<p class="muted">خالی = بدون محدودیت مالک</p>
|
||||
<label class="chip">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="filter.owners?.includes('self')"
|
||||
@change="toggleOwner('self')"
|
||||
/>
|
||||
{{ ownerSelfLabel }}
|
||||
</label>
|
||||
<label class="chip">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="filter.owners?.includes('team')"
|
||||
@change="toggleOwner('team')"
|
||||
/>
|
||||
تیمهای عضو
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<a-form-item
|
||||
v-for="picker in pickers"
|
||||
:key="picker.legend"
|
||||
:label="picker.legend"
|
||||
:style="{ marginBottom: 0 }"
|
||||
>
|
||||
<a-typography-text v-if="picker.loading" type="secondary">
|
||||
در حال بارگذاری منبعها…
|
||||
</a-typography-text>
|
||||
<label v-for="picker in pickers" :key="picker.legend" class="pick">
|
||||
<span>{{ picker.legend }}</span>
|
||||
<p v-if="picker.loading" class="muted">در حال بارگذاری منبعها…</p>
|
||||
<a-select
|
||||
v-else
|
||||
:value="pickerValue(picker)"
|
||||
@@ -516,14 +499,70 @@ const filterSummary = computed(() => {
|
||||
style="width: 100%"
|
||||
@update:value="setList(picker.key, $event)"
|
||||
/>
|
||||
<a-typography-text v-if="picker.hint" type="secondary">
|
||||
{{ picker.hint }}
|
||||
</a-typography-text>
|
||||
</a-form-item>
|
||||
<p v-if="picker.hint" class="muted">{{ picker.hint }}</p>
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<a-typography-text v-else-if="!hasLimits" type="secondary">
|
||||
<p v-else-if="!hasLimits" class="hint">
|
||||
بدون محدودیت — همهٔ {{ sectionLabel }} قابل مشاهدهاند.
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.dae {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
.dae-mode {
|
||||
display: grid;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
.dae-mode label,
|
||||
.chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
font-size: 0.88rem;
|
||||
margin-inline-end: 0.55rem;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
.hint,
|
||||
.muted,
|
||||
.summary {
|
||||
color: #64748b;
|
||||
font-size: 0.82rem;
|
||||
margin: 0;
|
||||
}
|
||||
.hint.warn {
|
||||
color: #b45309;
|
||||
}
|
||||
.summary {
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
}
|
||||
fieldset {
|
||||
border: 1px dashed #e2e8f0;
|
||||
border-radius: 8px;
|
||||
padding: 0.5rem 0.65rem;
|
||||
margin: 0;
|
||||
}
|
||||
legend {
|
||||
padding-inline: 0.25rem;
|
||||
font-size: 0.8rem;
|
||||
color: #475569;
|
||||
font-weight: 600;
|
||||
}
|
||||
.pick {
|
||||
display: grid;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
.pick > span {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
color: #475569;
|
||||
}
|
||||
.compact fieldset {
|
||||
padding: 0.45rem 0.55rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import {
|
||||
Tabs as ATabs,
|
||||
TabPane as ATabPane,
|
||||
Typography,
|
||||
Radio as ARadio,
|
||||
RadioGroup as ARadioGroup,
|
||||
Checkbox as ACheckbox,
|
||||
Space as ASpace,
|
||||
Input as AInput,
|
||||
} from 'ant-design-vue';
|
||||
import type {
|
||||
DataAccessPolicy,
|
||||
DataAccessSection,
|
||||
@@ -28,8 +18,6 @@ import {
|
||||
import { api } from '@/lib/api';
|
||||
import DataAccessEditor, { type IdOption } from '@/components/DataAccessEditor.vue';
|
||||
|
||||
const { Text: ATypographyText } = Typography;
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: DataAccessPolicy;
|
||||
/** فقط بخشهایی که این مجوزها را دارند نشان بده؛ خالی = همه */
|
||||
@@ -125,10 +113,6 @@ function patchTreasury(next: UserTreasuryAccess | null) {
|
||||
emit('update:treasuryAccess', next);
|
||||
}
|
||||
|
||||
function onTreasuryModeChange(e: { target: { value?: unknown } }) {
|
||||
patchTreasury(e.target.value === 'role' ? null : (props.treasuryAccess ?? emptyTreasuryAccess()));
|
||||
}
|
||||
|
||||
function toggleTreasurySection(key: RolePermissionKey) {
|
||||
const current = props.treasuryAccess ?? emptyTreasuryAccess();
|
||||
const sections = current.sections.includes(key)
|
||||
@@ -242,102 +226,131 @@ onMounted(() => {
|
||||
void loadOptions();
|
||||
void loadTreasuryAccounts();
|
||||
});
|
||||
|
||||
const editorSection = computed<DataAccessSection>(() =>
|
||||
active.value === 'treasury' ? 'customers' : active.value,
|
||||
);
|
||||
|
||||
const stagesForActive = computed(() => {
|
||||
if (active.value === 'leads') return leadStages.value;
|
||||
if (active.value === 'sales') return dealStages.value;
|
||||
if (active.value === 'activities') return activityStages.value;
|
||||
if (active.value === 'projects') return projectStages.value;
|
||||
return [];
|
||||
});
|
||||
|
||||
const boardsForActive = computed(() => {
|
||||
if (active.value === 'activities') return activityBoards.value;
|
||||
if (active.value === 'projects') return projectBoards.value;
|
||||
return [];
|
||||
});
|
||||
|
||||
const typesForActive = computed(() => {
|
||||
if (active.value === 'activities') return activityTypes.value;
|
||||
if (active.value === 'routines') return routineCategories.value;
|
||||
return [];
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<a-typography-text v-if="!visibleSections.length" type="secondary">
|
||||
<div class="dap">
|
||||
<p v-if="!visibleSections.length" class="muted">
|
||||
برای تنظیم محدوده، ابتدا مجوز بخش مربوط را روشن کنید.
|
||||
</a-typography-text>
|
||||
<a-tabs v-else v-model:activeKey="active">
|
||||
<a-tab-pane
|
||||
v-for="s in visibleSections"
|
||||
:key="s"
|
||||
:tab="DATA_ACCESS_SECTION_LABELS[s]"
|
||||
>
|
||||
<DataAccessEditor
|
||||
:section="s"
|
||||
:model-value="sectionValue(s)"
|
||||
:groups="customerGroups"
|
||||
:stages="s === 'leads' ? leadStages : s === 'sales' ? dealStages : s === 'activities' ? activityStages : s === 'projects' ? projectStages : []"
|
||||
:pipelines="pipelines"
|
||||
:boards="s === 'activities' ? activityBoards : s === 'projects' ? projectBoards : []"
|
||||
:activity-types="s === 'activities' ? activityTypes : s === 'routines' ? routineCategories : []"
|
||||
:import-sources="importSources"
|
||||
:import-sources-ready="importSourcesReady"
|
||||
:import-sources-failed="importSourcesFailed"
|
||||
:disabled="disabled || dataLocked"
|
||||
:compact="compact"
|
||||
@update:model-value="setSection(s, $event)"
|
||||
/>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane v-if="showTreasury" key="treasury" tab="مدیریت مالی">
|
||||
<a-space direction="vertical">
|
||||
<a-typography-text type="secondary">
|
||||
این برگه فقط برای همین کاربر است. «مثل نقش» یعنی همان دسترسی مالی نقش بماند.
|
||||
در حالت سفارشی، اگر هیچ بخش ریزی تیک نخورد همه بخشها بهجز حقوق باز میمانند و حقوق جداست.
|
||||
اگر هیچ حسابی انتخاب نشود همه حسابها باز است.
|
||||
</a-typography-text>
|
||||
<a-radio-group
|
||||
:value="treasuryAccess == null ? 'role' : 'custom'"
|
||||
</p>
|
||||
<template v-else>
|
||||
<div class="tabs" role="tablist">
|
||||
<button
|
||||
v-for="s in visibleSections"
|
||||
:key="s"
|
||||
type="button"
|
||||
class="tab"
|
||||
:class="{ on: active === s }"
|
||||
role="tab"
|
||||
:aria-selected="active === s"
|
||||
@click="active = s"
|
||||
>
|
||||
{{ DATA_ACCESS_SECTION_LABELS[s] }}
|
||||
</button>
|
||||
<button
|
||||
v-if="showTreasury"
|
||||
type="button"
|
||||
class="tab"
|
||||
:class="{ on: active === 'treasury' }"
|
||||
role="tab"
|
||||
:aria-selected="active === 'treasury'"
|
||||
@click="active = 'treasury'"
|
||||
>
|
||||
مدیریت مالی
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="active === 'treasury'" class="treasury">
|
||||
<p class="muted">
|
||||
این برگه فقط برای همین کاربر است. «مثل نقش» یعنی همان دسترسی مالی نقش بماند.
|
||||
در حالت سفارشی، اگر هیچ بخش ریزی تیک نخورد همه بخشها بهجز حقوق باز میمانند و حقوق جداست.
|
||||
اگر هیچ حسابی انتخاب نشود همه حسابها باز است.
|
||||
</p>
|
||||
<label class="choice">
|
||||
<input
|
||||
type="radio"
|
||||
name="user-treasury"
|
||||
:checked="treasuryAccess == null"
|
||||
:disabled="disabled"
|
||||
@change="onTreasuryModeChange"
|
||||
>
|
||||
<a-space direction="vertical">
|
||||
<a-radio value="role">مثل نقش</a-radio>
|
||||
<a-radio value="custom">سفارشی برای این کاربر</a-radio>
|
||||
</a-space>
|
||||
</a-radio-group>
|
||||
<template v-if="treasuryAccess">
|
||||
<a-checkbox
|
||||
@change="patchTreasury(null)"
|
||||
/>
|
||||
مثل نقش
|
||||
</label>
|
||||
<label class="choice">
|
||||
<input
|
||||
type="radio"
|
||||
name="user-treasury"
|
||||
:checked="treasuryAccess != null"
|
||||
:disabled="disabled"
|
||||
@change="patchTreasury(treasuryAccess ?? emptyTreasuryAccess())"
|
||||
/>
|
||||
سفارشی برای این کاربر
|
||||
</label>
|
||||
<template v-if="treasuryAccess">
|
||||
<label class="choice">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="treasuryAccess.enabled"
|
||||
:disabled="disabled"
|
||||
@change="patchTreasury({ ...treasuryAccess, enabled: !treasuryAccess.enabled })"
|
||||
>
|
||||
دسترسی به مدیریت مالی
|
||||
</a-checkbox>
|
||||
<template v-if="treasuryAccess.enabled">
|
||||
<a-space direction="vertical">
|
||||
<a-checkbox
|
||||
v-for="perm in treasurySections"
|
||||
:key="perm.key"
|
||||
:checked="treasuryAccess.sections.includes(perm.key)"
|
||||
:disabled="disabled"
|
||||
@change="toggleTreasurySection(perm.key)"
|
||||
>
|
||||
{{ perm.label }}
|
||||
</a-checkbox>
|
||||
</a-space>
|
||||
<a-checkbox
|
||||
/>
|
||||
دسترسی به مدیریت مالی
|
||||
</label>
|
||||
<template v-if="treasuryAccess.enabled">
|
||||
<label v-for="perm in treasurySections" :key="perm.key" class="choice sub">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="treasuryAccess.sections.includes(perm.key)"
|
||||
:disabled="disabled"
|
||||
@change="toggleTreasurySection(perm.key)"
|
||||
/>
|
||||
{{ perm.label }}
|
||||
</label>
|
||||
<label class="choice">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="treasuryAccess.ownAccounts"
|
||||
:disabled="disabled"
|
||||
@change="patchTreasury({ ...treasuryAccess, ownAccounts: !treasuryAccess.ownAccounts })"
|
||||
>
|
||||
حسابهایی که خودش مسئول آنهاست
|
||||
</a-checkbox>
|
||||
<a-typography-text type="secondary">حسابهای دیگر</a-typography-text>
|
||||
<a-input
|
||||
v-model:value="treasuryAccountQuery"
|
||||
placeholder="جستجوی حساب"
|
||||
:disabled="disabled"
|
||||
allow-clear
|
||||
/>
|
||||
<a-space direction="vertical">
|
||||
<a-checkbox
|
||||
v-for="account in filteredTreasuryAccounts"
|
||||
:key="account.id"
|
||||
:checked="treasuryAccess.accountIds.includes(account.id)"
|
||||
:disabled="disabled"
|
||||
@change="toggleTreasuryAccount(account.id)"
|
||||
>
|
||||
{{ account.name }}
|
||||
<template v-if="account.responsibleName"> — مسئول: {{ account.responsibleName }}</template>
|
||||
</a-checkbox>
|
||||
</a-space>
|
||||
<a-typography-text v-if="!treasuryAccounts.length" type="secondary">
|
||||
حسابی برای انتخاب نیست.
|
||||
</a-typography-text>
|
||||
</template>
|
||||
حسابهایی که خودش مسئول آنهاست
|
||||
</label>
|
||||
<p class="muted">حسابهای دیگر</p>
|
||||
<input v-model="treasuryAccountQuery" placeholder="جستجوی حساب" :disabled="disabled" />
|
||||
<label v-for="account in filteredTreasuryAccounts" :key="account.id" class="choice">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="treasuryAccess.accountIds.includes(account.id)"
|
||||
:disabled="disabled"
|
||||
@change="toggleTreasuryAccount(account.id)"
|
||||
/>
|
||||
{{ account.name }}
|
||||
<template v-if="account.responsibleName"> — مسئول: {{ account.responsibleName }}</template>
|
||||
</label>
|
||||
<p v-if="!treasuryAccounts.length" class="muted">حسابی برای انتخاب نیست.</p>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
@@ -359,4 +372,48 @@ onMounted(() => {
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.dap {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
.tabs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
.tab {
|
||||
font: inherit;
|
||||
border: 1px solid #e2e8f0;
|
||||
background: #fff;
|
||||
border-radius: 999px;
|
||||
padding: 0.3rem 0.7rem;
|
||||
cursor: pointer;
|
||||
color: #475569;
|
||||
}
|
||||
.tab.on {
|
||||
border-color: #0f766e;
|
||||
background: #f0fdfa;
|
||||
color: #0f766e;
|
||||
font-weight: 600;
|
||||
}
|
||||
.muted {
|
||||
color: #64748b;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.treasury {
|
||||
display: grid;
|
||||
gap: 0.45rem;
|
||||
}
|
||||
.choice {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 0.4rem;
|
||||
align-items: center;
|
||||
}
|
||||
.choice.sub {
|
||||
padding-inline-start: 1.2rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
ClockCircleOutlined,
|
||||
LeftOutlined,
|
||||
RightOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
} from '@ant-design/icons-vue';
|
||||
import {
|
||||
addJalaliMonths,
|
||||
dateToJalali,
|
||||
@@ -58,6 +58,8 @@ const hourColRef = ref<HTMLElement | null>(null);
|
||||
const minuteColRef = ref<HTMLElement | null>(null);
|
||||
const top = ref(0);
|
||||
const left = ref(0);
|
||||
/** بالای مودال Ant (حدود ۱۰۰۰) تا تقویم پشت پنجره نماند */
|
||||
const popupZ = ref(120);
|
||||
const todayJ = dateToJalali(new Date());
|
||||
const cursor = ref<{ jy: number; jm: number }>({ jy: todayJ.jy, jm: todayJ.jm });
|
||||
const draftHour = ref(9);
|
||||
@@ -325,16 +327,32 @@ function place() {
|
||||
const panel = panelRef.value;
|
||||
if (!trigger) return;
|
||||
const rect = trigger.getBoundingClientRect();
|
||||
const width = panel?.offsetWidth || (props.mode === 'time' ? (isMobile.value ? 340 : 280) : 320);
|
||||
const height = panel?.offsetHeight || (props.mode === 'time' ? (isMobile.value ? 460 : 320) : 360);
|
||||
const width =
|
||||
panel?.offsetWidth ||
|
||||
(props.mode === 'time' ? (isMobile.value ? 340 : 280) : 328);
|
||||
const height =
|
||||
panel?.offsetHeight ||
|
||||
(props.mode === 'time' ? (isMobile.value ? 460 : 320) : 340);
|
||||
const margin = 8;
|
||||
let nextLeft = rect.left;
|
||||
if (getComputedStyle(document.documentElement).direction === 'rtl') {
|
||||
nextLeft = rect.right - width;
|
||||
}
|
||||
nextLeft = Math.min(Math.max(8, nextLeft), window.innerWidth - width - 8);
|
||||
let nextTop = rect.bottom + 8;
|
||||
if (nextTop + height > window.innerHeight - 8) {
|
||||
nextTop = Math.max(8, rect.top - height - 8);
|
||||
nextLeft = Math.min(
|
||||
Math.max(margin, nextLeft),
|
||||
Math.max(margin, window.innerWidth - width - margin),
|
||||
);
|
||||
const spaceBelow = window.innerHeight - rect.bottom - margin * 2;
|
||||
const spaceAbove = rect.top - margin * 2;
|
||||
let nextTop: number;
|
||||
if (height <= spaceBelow) {
|
||||
nextTop = rect.bottom + margin;
|
||||
} else if (height <= spaceAbove) {
|
||||
nextTop = rect.top - height - margin;
|
||||
} else if (spaceBelow >= spaceAbove) {
|
||||
nextTop = Math.max(margin, window.innerHeight - height - margin);
|
||||
} else {
|
||||
nextTop = margin;
|
||||
}
|
||||
left.value = nextLeft;
|
||||
top.value = nextTop;
|
||||
@@ -360,6 +378,7 @@ async function show() {
|
||||
calView.value = props.startView;
|
||||
clockFace.value = 'hour';
|
||||
syncViewport();
|
||||
liftAboveOverlays();
|
||||
open.value = true;
|
||||
await nextTick();
|
||||
place();
|
||||
@@ -554,7 +573,7 @@ onBeforeUnmount(() => {
|
||||
'is-desktop': !isMobile,
|
||||
}"
|
||||
role="dialog"
|
||||
:style="{ top: `${top}px`, left: `${left}px` }"
|
||||
:style="{ top: `${top}px`, left: `${left}px`, zIndex: popupZ }"
|
||||
>
|
||||
<header v-if="mode !== 'time'" class="nav">
|
||||
<a-button type="text" class="nav-btn" :aria-label="navLabels.forward" @click="navStep(1)">
|
||||
@@ -742,7 +761,7 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
پاک کردن
|
||||
</a-button>
|
||||
<a-button type="primary" class="done" @click="hide">تأیید</a-button>
|
||||
<a-button type="primary" @click="hide">تأیید</a-button>
|
||||
</footer>
|
||||
</div>
|
||||
</Teleport>
|
||||
@@ -867,10 +886,11 @@ onBeforeUnmount(() => {
|
||||
.panel {
|
||||
position: fixed;
|
||||
z-index: 120;
|
||||
box-sizing: border-box;
|
||||
width: min(20.5rem, calc(100vw - 16px));
|
||||
max-height: calc(100vh - 16px);
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
/* تقویم باید یکجا دیده شود؛ اسکرول داخل پنل گیجکننده است */
|
||||
max-height: none;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
border-radius: var(--radius);
|
||||
box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
|
||||
@@ -878,6 +898,13 @@ onBeforeUnmount(() => {
|
||||
font-family: IRANSans, Tahoma, sans-serif;
|
||||
}
|
||||
|
||||
@media (max-height: 420px) {
|
||||
.panel {
|
||||
max-height: calc(100vh - 16px);
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.panel-time {
|
||||
width: min(22.5rem, calc(100vw - 16px));
|
||||
}
|
||||
@@ -909,45 +936,40 @@ onBeforeUnmount(() => {
|
||||
|
||||
.pick-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 0.35rem;
|
||||
padding: 0.25rem 0;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.pick-cell) {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
height: 44px;
|
||||
margin: 0;
|
||||
padding: 0 4px;
|
||||
.panel :deep(.pick-cell.ant-btn) {
|
||||
width: 100% !important;
|
||||
min-width: 0 !important;
|
||||
height: 44px !important;
|
||||
padding-inline: 0 !important;
|
||||
border-radius: var(--radius);
|
||||
color: #0f172a;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.pick-cell.today) {
|
||||
.panel :deep(.pick-cell.today) {
|
||||
box-shadow: inset 0 0 0 1px #99f6e4;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.pick-cell.on),
|
||||
.panel :deep(.ant-btn.pick-cell:hover) {
|
||||
.panel :deep(.pick-cell.on),
|
||||
.panel :deep(.pick-cell.ant-btn:hover) {
|
||||
background: #0d9488;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.nav-btn) {
|
||||
.nav-btn {
|
||||
width: 32px;
|
||||
min-width: 32px;
|
||||
height: 32px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: var(--radius);
|
||||
background: #f1f5f9;
|
||||
color: #0f766e;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -960,6 +982,7 @@ onBeforeUnmount(() => {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, minmax(0, 1fr));
|
||||
gap: 0.15rem;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@@ -970,40 +993,43 @@ onBeforeUnmount(() => {
|
||||
padding-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.day) {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
height: 34px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 1;
|
||||
.panel :deep(.day.ant-btn) {
|
||||
width: 100% !important;
|
||||
min-width: 0 !important;
|
||||
height: 34px !important;
|
||||
padding: 0 !important;
|
||||
border: 0;
|
||||
border-radius: var(--radius);
|
||||
background: none;
|
||||
color: #0f172a;
|
||||
font: inherit;
|
||||
font-size: 0.82rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.day.mute) {
|
||||
.panel :deep(.day.ant-btn > span) {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.panel :deep(.day.mute) {
|
||||
color: #cbd5e1;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.day.today) {
|
||||
.panel :deep(.day.today) {
|
||||
box-shadow: inset 0 0 0 1px #99f6e4;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.day.on),
|
||||
.panel :deep(.ant-btn.day:hover) {
|
||||
.panel :deep(.day.on),
|
||||
.panel :deep(.day.ant-btn:hover) {
|
||||
background: #0d9488;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.day.mute:hover) {
|
||||
.panel :deep(.day.mute:hover) {
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
}
|
||||
@@ -1033,11 +1059,9 @@ onBeforeUnmount(() => {
|
||||
margin-bottom: 0.85rem;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.md-chip) {
|
||||
.md-chip {
|
||||
min-width: 5.1rem;
|
||||
height: 4.1rem;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: var(--radius);
|
||||
background: #f1f5f9;
|
||||
@@ -1050,7 +1074,7 @@ onBeforeUnmount(() => {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.md-chip.on) {
|
||||
.md-chip.on {
|
||||
background: #ccfbf1;
|
||||
color: #0f766e;
|
||||
box-shadow: inset 0 0 0 2px #99f6e4;
|
||||
@@ -1124,11 +1148,10 @@ onBeforeUnmount(() => {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.md-tick) {
|
||||
.md-tick {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
width: 36px;
|
||||
min-width: 36px;
|
||||
height: 36px;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
@@ -1145,12 +1168,12 @@ onBeforeUnmount(() => {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.md-tick.inner) {
|
||||
.md-tick.inner {
|
||||
font-size: 0.74rem;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.md-tick.on) {
|
||||
.md-tick.on {
|
||||
background: transparent;
|
||||
color: #fff;
|
||||
}
|
||||
@@ -1199,12 +1222,9 @@ onBeforeUnmount(() => {
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.col-item) {
|
||||
.col-item {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
height: 36px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: var(--radius);
|
||||
background: transparent;
|
||||
@@ -1215,11 +1235,11 @@ onBeforeUnmount(() => {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.col-item:hover) {
|
||||
.col-item:hover {
|
||||
background: #e2e8f0;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.col-item.on) {
|
||||
.col-item.on {
|
||||
background: #0d9488;
|
||||
color: #fff;
|
||||
}
|
||||
@@ -1231,8 +1251,28 @@ onBeforeUnmount(() => {
|
||||
margin-top: 0.7rem;
|
||||
}
|
||||
|
||||
.panel :deep(.ant-btn.done) {
|
||||
.link,
|
||||
.done {
|
||||
border: 0;
|
||||
background: none;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.link {
|
||||
color: #0f766e;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.done {
|
||||
margin-inline-start: auto;
|
||||
background: #14b8a6;
|
||||
color: #fff;
|
||||
border-radius: var(--radius);
|
||||
padding: 0.4rem 0.8rem;
|
||||
font-weight: 600;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.panel.is-mobile .time-box {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
Popover as APopover,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { SettingOutlined } from '@/icons/ant-bridge';
|
||||
import { SettingOutlined } from '@ant-design/icons-vue';
|
||||
import { useTableColumns } from '@/lib/tableColumns';
|
||||
import { toFaDigits } from '@/lib/jalali';
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
emptySectionDataAccess,
|
||||
sectionHasDataAccessLimits,
|
||||
} from '@mento/shared';
|
||||
import { UiButton, UiEmptyState, UiField, UiInput } from '@/components/ui';
|
||||
import DataAccessPolicyPanel from '@/components/DataAccessPolicyPanel.vue';
|
||||
import { formatLocalDateInput, parseLocalInput, toFaDigits } from '@/lib/jalali';
|
||||
import { matchesSearch } from '@/lib/search';
|
||||
@@ -37,7 +38,7 @@ const showPriorArchive = computed(
|
||||
const priorUsers = computed(() => props.users.filter((u) => u.isActive !== false));
|
||||
const selectedPriorUsers = computed(() => priorUsers.value.filter((u) => u.priorArchiveEnabled));
|
||||
const priorSearch = ref('');
|
||||
const priorPick = ref<string | undefined>(undefined);
|
||||
const priorPick = ref('');
|
||||
const priorSavingId = ref('');
|
||||
const cutoffLocal = ref('');
|
||||
const cutoffSaving = ref(false);
|
||||
@@ -48,16 +49,10 @@ const availablePriorUsers = computed(() => {
|
||||
return priorUsers.value.filter((u) => {
|
||||
if (u.priorArchiveEnabled) return false;
|
||||
if (!q) return true;
|
||||
return [u.fullName, u.email, u.mobile]
|
||||
.filter(Boolean)
|
||||
.some((v) => String(v).toLowerCase().includes(q));
|
||||
return [u.fullName, u.email, u.mobile].filter(Boolean).some((v) => String(v).toLowerCase().includes(q));
|
||||
});
|
||||
});
|
||||
|
||||
const availablePriorOptions = computed(() =>
|
||||
availablePriorUsers.value.map((u) => ({ value: u.id, label: u.fullName })),
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
refreshUsers: [];
|
||||
}>();
|
||||
@@ -105,7 +100,7 @@ const filteredAccessUsers = computed(() => {
|
||||
|
||||
async function setPriorArchive(userId: string, enabled: boolean) {
|
||||
priorSavingId.value = userId;
|
||||
priorPick.value = undefined;
|
||||
priorPick.value = '';
|
||||
error.value = '';
|
||||
ok.value = '';
|
||||
try {
|
||||
@@ -143,10 +138,7 @@ async function loadPriorArchiveCutoff() {
|
||||
applyCutoffFromOrg(data);
|
||||
} catch (e) {
|
||||
error.value = axios.isAxiosError(e)
|
||||
? String(
|
||||
(e.response?.data as { message?: string })?.message ??
|
||||
'بارگذاری تاریخ بایگانی ناموفق بود.',
|
||||
)
|
||||
? String((e.response?.data as { message?: string })?.message ?? 'بارگذاری تاریخ بایگانی ناموفق بود.')
|
||||
: 'بارگذاری تاریخ بایگانی ناموفق بود.';
|
||||
} finally {
|
||||
cutoffLoading.value = false;
|
||||
@@ -168,10 +160,7 @@ async function onCutoffChange(value: string) {
|
||||
await auth.hydrate();
|
||||
} catch (e) {
|
||||
error.value = axios.isAxiosError(e)
|
||||
? String(
|
||||
(e.response?.data as { message?: string })?.message ??
|
||||
'ذخیره تاریخ بایگانی ناموفق بود.',
|
||||
)
|
||||
? String((e.response?.data as { message?: string })?.message ?? 'ذخیره تاریخ بایگانی ناموفق بود.')
|
||||
: 'ذخیره تاریخ بایگانی ناموفق بود.';
|
||||
await loadPriorArchiveCutoff();
|
||||
} finally {
|
||||
@@ -179,10 +168,9 @@ async function onCutoffChange(value: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function pickPriorUser(userId: unknown) {
|
||||
const id = userId == null ? '' : String(userId);
|
||||
if (!id) return;
|
||||
void setPriorArchive(id, true);
|
||||
function pickPriorUser(userId: string) {
|
||||
if (!userId) return;
|
||||
void setPriorArchive(userId, true);
|
||||
}
|
||||
|
||||
async function load() {
|
||||
@@ -279,19 +267,9 @@ function toggleMember(userId: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function setRole(userId: string, role: unknown) {
|
||||
function setRole(userId: string, role: TeamMemberRole) {
|
||||
if (!memberDraft.value[userId]) return;
|
||||
memberDraft.value = {
|
||||
...memberDraft.value,
|
||||
[userId]: String(role) as TeamMemberRole,
|
||||
};
|
||||
}
|
||||
|
||||
function teamMembersLabel(team: TeamDto) {
|
||||
if (!team.members.length) return 'بدون عضو';
|
||||
return team.members
|
||||
.map((m) => `${m.fullName}${m.role === 'manager' ? ' (سرپرست)' : ''}`)
|
||||
.join('، ');
|
||||
memberDraft.value = { ...memberDraft.value, [userId]: role };
|
||||
}
|
||||
|
||||
async function saveMembers() {
|
||||
@@ -411,31 +389,22 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a-flex vertical :gap="12">
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" closable @close="error = ''" />
|
||||
<a-alert v-if="ok" type="success" show-icon :message="ok" closable @close="ok = ''" />
|
||||
<div class="teams-panel">
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
<p v-if="ok" class="ok">{{ ok }}</p>
|
||||
|
||||
<a-card :bordered="false">
|
||||
<a-form v-if="canEdit" layout="vertical" @finish="createTeam">
|
||||
<a-divider orientation="right">تیم جدید</a-divider>
|
||||
<a-row :gutter="[16, 0]" align="bottom">
|
||||
<a-col :xs="24" :md="8">
|
||||
<a-form-item label="نام تیم">
|
||||
<a-input v-model:value="newName" placeholder="مثلاً فروش تهران" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="10">
|
||||
<a-form-item label="توضیح">
|
||||
<a-input v-model:value="newDesc" placeholder="اختیاری" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xs="24" :md="6">
|
||||
<a-form-item label=" ">
|
||||
<a-button type="primary" html-type="submit" :loading="saving" block>افزودن</a-button>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
<section v-if="canEdit" class="card">
|
||||
<h3>تیم جدید</h3>
|
||||
<div class="row">
|
||||
<UiField label="نام تیم">
|
||||
<UiInput v-model="newName" placeholder="مثلاً فروش تهران" />
|
||||
</UiField>
|
||||
<UiField label="توضیح">
|
||||
<UiInput v-model="newDesc" placeholder="اختیاری" />
|
||||
</UiField>
|
||||
<UiButton :loading="saving" @click="createTeam">افزودن</UiButton>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<header class="card-head">
|
||||
@@ -530,27 +499,41 @@ onMounted(() => {
|
||||
:disabled="cutoffSaving || cutoffLoading"
|
||||
@update:model-value="onCutoffChange"
|
||||
/>
|
||||
<a-list v-else item-layout="vertical" :data-source="teams">
|
||||
<template #renderItem="{ item: t }">
|
||||
<a-list-item>
|
||||
<template v-if="canEdit" #actions>
|
||||
<a-button type="link" @click="startMetaEdit(t)">ویرایش</a-button>
|
||||
<a-button type="link" @click="startEdit(t)">اعضا</a-button>
|
||||
<a-button type="link" danger @click="removeTeam(t.id)">حذف</a-button>
|
||||
</template>
|
||||
<a-list-item-meta>
|
||||
<template #title>
|
||||
<a-space wrap>
|
||||
<a-typography-text strong>{{ t.name }}</a-typography-text>
|
||||
<a-tag :bordered="false">{{ toFaDigits(t.memberCount) }} عضو</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #description>
|
||||
<a-typography-text type="secondary">
|
||||
{{ t.description || 'بدون توضیح' }} · {{ teamMembersLabel(t) }}
|
||||
</a-typography-text>
|
||||
</template>
|
||||
</a-list-item-meta>
|
||||
</header>
|
||||
<p class="hint">
|
||||
فقط کاربرانی که تیک میخورند سوئیچ کار جاری و بایگانی را میبینند. بقیهٔ محیط مثل قبل همهٔ
|
||||
رکوردها را مطابق سطح دسترسی خودشان میبینند.
|
||||
</p>
|
||||
<div class="prior-picker">
|
||||
<UiInput v-model="priorSearch" placeholder="جستجوی کاربر…" />
|
||||
<select
|
||||
v-model="priorPick"
|
||||
:disabled="!availablePriorUsers.length || Boolean(priorSavingId)"
|
||||
@change="pickPriorUser(($event.target as HTMLSelectElement).value)"
|
||||
>
|
||||
<option value="">
|
||||
{{ availablePriorUsers.length ? 'انتخاب کاربر برای فعالسازی' : 'کاربر دیگری پیدا نشد' }}
|
||||
</option>
|
||||
<option v-for="u in availablePriorUsers" :key="u.id" :value="u.id">
|
||||
{{ u.fullName }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div v-if="selectedPriorUsers.length" class="prior-chips">
|
||||
<span v-for="u in selectedPriorUsers" :key="u.id" class="prior-chip">
|
||||
{{ u.fullName }}
|
||||
<button
|
||||
type="button"
|
||||
:disabled="priorSavingId === u.id"
|
||||
:aria-label="`حذف ${u.fullName}`"
|
||||
@click="setPriorArchive(u.id, false)"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
<p v-else class="hint">هنوز کاربری برای دیدن سوئیچ بایگانی انتخاب نشده است.</p>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<header class="card-head">
|
||||
@@ -598,48 +581,15 @@ onMounted(() => {
|
||||
:data-locked="accessMode === 'inherit'"
|
||||
compact
|
||||
/>
|
||||
<a-list v-else item-layout="vertical" :data-source="editableUsers">
|
||||
<template #renderItem="{ item: u }">
|
||||
<a-list-item>
|
||||
<template v-if="canEdit" #actions>
|
||||
<a-button type="link" @click="openAccessEditor(u)">
|
||||
{{ expandedAccess === u.id ? 'بستن' : 'تنظیم' }}
|
||||
</a-button>
|
||||
</template>
|
||||
<a-list-item-meta :description="accessSummary(u)">
|
||||
<template #title>
|
||||
<a-typography-text strong>{{ u.fullName }}</a-typography-text>
|
||||
</template>
|
||||
</a-list-item-meta>
|
||||
<a-flex v-if="expandedAccess === u.id" vertical :gap="8" style="width: 100%">
|
||||
<a-radio-group v-model:value="accessMode">
|
||||
<a-space wrap>
|
||||
<a-radio value="inherit">مثل نقش</a-radio>
|
||||
<a-radio value="custom">سفارشی</a-radio>
|
||||
</a-space>
|
||||
</a-radio-group>
|
||||
<DataAccessPolicyPanel
|
||||
v-model="draftAccess"
|
||||
v-model:treasury-access="draftTreasury"
|
||||
:show-treasury="showTreasury"
|
||||
:data-locked="accessMode === 'inherit'"
|
||||
compact
|
||||
/>
|
||||
<a-space>
|
||||
<a-button type="primary" :loading="accessSaving" @click="saveUserAccess(u.id)">
|
||||
ذخیره
|
||||
</a-button>
|
||||
<a-button @click="expandedAccess = null">انصراف</a-button>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</a-flex>
|
||||
</a-collapse-panel>
|
||||
</a-collapse>
|
||||
</a-card>
|
||||
</a-flex>
|
||||
<div class="actions">
|
||||
<UiButton :loading="accessSaving" @click="saveUserAccess(u.id)">ذخیره</UiButton>
|
||||
<UiButton variant="secondary" @click="expandedAccess = null">انصراف</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -607,4 +607,9 @@ function openFullActivity(id: string) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.muted {
|
||||
margin: 0;
|
||||
color: #64748b;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch, type Component } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import axios from 'axios';
|
||||
import type {
|
||||
ActivityFieldDef,
|
||||
@@ -20,45 +20,6 @@ import {
|
||||
ACTIVITY_TYPE_LABELS,
|
||||
DEFAULT_ACTIVITY_PRIORITY_SETTINGS,
|
||||
} from '@mento/shared';
|
||||
import {
|
||||
AimOutlined,
|
||||
ArrowDownOutlined,
|
||||
ArrowUpOutlined,
|
||||
BankOutlined,
|
||||
BellOutlined,
|
||||
CalendarOutlined,
|
||||
CarOutlined,
|
||||
CheckOutlined,
|
||||
DeleteOutlined,
|
||||
EnvironmentOutlined,
|
||||
FileTextOutlined,
|
||||
FlagOutlined,
|
||||
MessageOutlined,
|
||||
MailOutlined,
|
||||
PhoneOutlined,
|
||||
PlusOutlined,
|
||||
SendOutlined,
|
||||
SoundOutlined,
|
||||
StarOutlined,
|
||||
TeamOutlined,
|
||||
ThunderboltOutlined,
|
||||
ContainerOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Checkbox as ACheckbox,
|
||||
Col as ACol,
|
||||
Flex as AFlex,
|
||||
FormItem as AFormItem,
|
||||
Input as AInput,
|
||||
Modal as AModal,
|
||||
Row as ARow,
|
||||
Select as ASelect,
|
||||
Textarea as ATextarea,
|
||||
} from 'ant-design-vue';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { api } from '@/lib/api';
|
||||
import { toFaDigits } from '@/lib/jalali';
|
||||
import { useActivityPriorities } from '@/lib/activity-priorities';
|
||||
@@ -68,27 +29,8 @@ import {
|
||||
typeColorStyle,
|
||||
useActivityTypes,
|
||||
} from '@/lib/activity-types';
|
||||
|
||||
const ACTIVITY_ICON_COMPONENTS: Record<ActivityTypeIcon, Component> = {
|
||||
phone: PhoneOutlined,
|
||||
users: TeamOutlined,
|
||||
check: CheckOutlined,
|
||||
chat: MessageOutlined,
|
||||
mail: MailOutlined,
|
||||
building: BankOutlined,
|
||||
calendar: CalendarOutlined,
|
||||
star: StarOutlined,
|
||||
flag: FlagOutlined,
|
||||
briefcase: ContainerOutlined,
|
||||
document: FileTextOutlined,
|
||||
target: AimOutlined,
|
||||
truck: CarOutlined,
|
||||
send: SendOutlined,
|
||||
megaphone: SoundOutlined,
|
||||
pin: EnvironmentOutlined,
|
||||
bell: BellOutlined,
|
||||
sparkle: ThunderboltOutlined,
|
||||
};
|
||||
import { UiButton, UiModal } from '@/components/ui';
|
||||
import UiIcon from '@/components/UiIcon.vue';
|
||||
|
||||
const props = defineProps<{ open: boolean }>();
|
||||
const emit = defineEmits<{ close: []; changed: [] }>();
|
||||
@@ -157,7 +99,10 @@ function snapshot(d: Draft | null) {
|
||||
|
||||
const dirty = computed(() => snapshot(draft.value) !== savedSnapshot.value);
|
||||
|
||||
function applySelect(id: string | 'new') {
|
||||
function select(id: string | 'new') {
|
||||
if (dirty.value && draft.value && !window.confirm('تغییرات ذخیره نشده از بین میرود. ادامه میدهید؟')) {
|
||||
return;
|
||||
}
|
||||
selectedId.value = id;
|
||||
draft.value = toDraft(id === 'new' ? null : (types.value.find((t) => t.id === id) ?? null));
|
||||
savedSnapshot.value = snapshot(draft.value);
|
||||
@@ -236,7 +181,7 @@ watch(
|
||||
const first = types.value[0];
|
||||
selectedId.value = null;
|
||||
draft.value = null;
|
||||
if (first) applySelect(first.id);
|
||||
if (first) select(first.id);
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
@@ -274,15 +219,12 @@ function moveField(index: number, dir: -1 | 1) {
|
||||
function removeField(index: number) {
|
||||
const f = draft.value?.fields[index];
|
||||
if (!f) return;
|
||||
if (f.label.trim()) {
|
||||
Modal.confirm({
|
||||
title: 'حذف فیلد',
|
||||
content: `فیلد «${f.label}» حذف شود؟ مقادیر ثبتشدهٔ آن در فعالیتهای قبلی دیگر نمایش داده نمیشود.`,
|
||||
okText: 'حذف',
|
||||
cancelText: 'انصراف',
|
||||
okButtonProps: { danger: true },
|
||||
onOk: () => draft.value!.fields.splice(index, 1),
|
||||
});
|
||||
if (
|
||||
f.label.trim() &&
|
||||
!window.confirm(
|
||||
`فیلد «${f.label}» حذف شود؟ مقادیر ثبتشدهٔ آن در فعالیتهای قبلی دیگر نمایش داده نمیشود.`,
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
draft.value!.fields.splice(index, 1);
|
||||
@@ -318,7 +260,14 @@ function validate(d: Draft): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
async function performSave(d: Draft) {
|
||||
async function save() {
|
||||
const d = draft.value;
|
||||
if (!d) return;
|
||||
const msg = validate(d);
|
||||
if (msg) {
|
||||
error.value = msg;
|
||||
return;
|
||||
}
|
||||
busy.value = 'save';
|
||||
error.value = '';
|
||||
notice.value = '';
|
||||
@@ -331,6 +280,18 @@ async function performSave(d: Draft) {
|
||||
};
|
||||
try {
|
||||
if (d.id) {
|
||||
const prev = types.value.find((t) => t.id === d.id);
|
||||
if (
|
||||
prev &&
|
||||
!d.isSystem &&
|
||||
prev.baseType !== d.baseType &&
|
||||
!window.confirm(
|
||||
'با تغییر نوع پایه، فعالیتهای قبلی این نوع هم در گزارشها با نوع پایهٔ جدید شمرده میشوند. ادامه میدهید؟',
|
||||
)
|
||||
) {
|
||||
busy.value = '';
|
||||
return;
|
||||
}
|
||||
await api.patch(`/activities/types/${d.id}`, body);
|
||||
} else {
|
||||
const { data } = await api.post<ActivityTypeDefDto>('/activities/types', body);
|
||||
@@ -350,56 +311,31 @@ async function performSave(d: Draft) {
|
||||
}
|
||||
}
|
||||
|
||||
async function save() {
|
||||
const d = draft.value;
|
||||
if (!d) return;
|
||||
const msg = validate(d);
|
||||
if (msg) {
|
||||
error.value = msg;
|
||||
return;
|
||||
}
|
||||
const prev = d.id ? types.value.find((t) => t.id === d.id) : undefined;
|
||||
if (prev && !d.isSystem && prev.baseType !== d.baseType) {
|
||||
Modal.confirm({
|
||||
title: 'تغییر نوع پایه',
|
||||
content:
|
||||
'با تغییر نوع پایه، فعالیتهای قبلی این نوع هم در گزارشها با نوع پایهٔ جدید شمرده میشوند. ادامه میدهید؟',
|
||||
okText: 'ادامه',
|
||||
cancelText: 'انصراف',
|
||||
onOk: () => performSave(d),
|
||||
});
|
||||
return;
|
||||
}
|
||||
await performSave(d);
|
||||
}
|
||||
|
||||
async function remove() {
|
||||
const d = draft.value;
|
||||
if (!d?.id || d.isSystem) return;
|
||||
Modal.confirm({
|
||||
title: 'حذف نوع فعالیت',
|
||||
content: `نوع «${d.name}» حذف شود؟ فعالیتهای این نوع به نوع اصلی «${ACTIVITY_TYPE_LABELS[d.baseType]}» برمیگردند. برای نگه داشتن سوابق، میتوانید بهجای حذف آن را غیرفعال کنید.`,
|
||||
okText: 'حذف',
|
||||
cancelText: 'انصراف',
|
||||
okButtonProps: { danger: true },
|
||||
async onOk() {
|
||||
busy.value = 'remove';
|
||||
error.value = '';
|
||||
try {
|
||||
await api.delete(`/activities/types/${d.id!}`);
|
||||
await load(true);
|
||||
savedSnapshot.value = snapshot(null);
|
||||
draft.value = null;
|
||||
const first = types.value[0];
|
||||
if (first) applySelect(first.id);
|
||||
emit('changed');
|
||||
} catch (e) {
|
||||
error.value = apiMessage(e, 'حذف نوع فعالیت ناموفق بود.');
|
||||
} finally {
|
||||
busy.value = '';
|
||||
}
|
||||
},
|
||||
});
|
||||
if (
|
||||
!window.confirm(
|
||||
`نوع «${d.name}» حذف شود؟ فعالیتهای این نوع به نوع اصلی «${ACTIVITY_TYPE_LABELS[d.baseType]}» برمیگردند. برای نگه داشتن سوابق، میتوانید بهجای حذف آن را غیرفعال کنید.`,
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
busy.value = 'remove';
|
||||
error.value = '';
|
||||
try {
|
||||
await api.delete(`/activities/types/${d.id}`);
|
||||
await load(true);
|
||||
savedSnapshot.value = snapshot(null);
|
||||
draft.value = null;
|
||||
const first = types.value[0];
|
||||
if (first) select(first.id);
|
||||
emit('changed');
|
||||
} catch (e) {
|
||||
error.value = apiMessage(e, 'حذف نوع فعالیت ناموفق بود.');
|
||||
} finally {
|
||||
busy.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
async function moveType(index: number, dir: -1 | 1) {
|
||||
@@ -430,10 +366,6 @@ function close() {
|
||||
}
|
||||
emit('close');
|
||||
}
|
||||
|
||||
function showPlaceholder(type: ActivityFieldType) {
|
||||
return !['checkbox', 'participants', 'select', 'multiselect', 'date'].includes(type);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -465,71 +397,172 @@ function showPlaceholder(type: ActivityFieldType) {
|
||||
برای هر نوع فعالیت فیلدهای مخصوص خودش را تعریف کنید؛ مثلاً «موضوع جلسه» و «شرکتکنندگان» برای جلسه
|
||||
یا «لیست کارها» برای وظیفه. «نوع پایه» مشخص میکند فعالیت در گزارشها جزو تماس، جلسه، وظیفه یا پیام
|
||||
شمرده شود.
|
||||
</a-typography-text>
|
||||
</p>
|
||||
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col :xs="24" :md="7">
|
||||
<a-flex vertical gap="small">
|
||||
<a-flex
|
||||
v-for="(t, index) in types"
|
||||
:key="t.id"
|
||||
align="center"
|
||||
gap="small"
|
||||
>
|
||||
<a-button
|
||||
block
|
||||
:type="selectedId === t.id ? 'primary' : 'default'"
|
||||
:ghost="selectedId === t.id"
|
||||
:style="{ opacity: t.isActive ? 1 : 0.65, textAlign: 'start', height: 'auto', padding: '8px 12px' }"
|
||||
@click="select(t.id)"
|
||||
<div class="layout">
|
||||
<aside class="list">
|
||||
<div
|
||||
v-for="(t, index) in types"
|
||||
:key="t.id"
|
||||
class="type-row"
|
||||
:class="{ on: selectedId === t.id, off: !t.isActive }"
|
||||
>
|
||||
<button type="button" class="pick" @click="select(t.id)">
|
||||
<span class="ico" :style="typeColorStyle(t.color)">
|
||||
<UiIcon :name="t.icon" :size="14" />
|
||||
</span>
|
||||
<span class="txt">
|
||||
<b>{{ t.name }}</b>
|
||||
<small>
|
||||
{{ ACTIVITY_TYPE_LABELS[t.baseType] }} · {{ toFaDigits(t.fields.length) }} فیلد
|
||||
<template v-if="!t.isActive"> · غیرفعال</template>
|
||||
</small>
|
||||
</span>
|
||||
</button>
|
||||
<div class="order">
|
||||
<button
|
||||
type="button"
|
||||
:disabled="index === 0 || Boolean(busy)"
|
||||
aria-label="انتقال به بالا"
|
||||
@click="moveType(index, -1)"
|
||||
>
|
||||
<a-flex align="center" gap="small">
|
||||
<span
|
||||
:style="{
|
||||
...typeColorStyle(t.color),
|
||||
width: '30px',
|
||||
height: '30px',
|
||||
borderRadius: '999px',
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
flexShrink: 0,
|
||||
}"
|
||||
>
|
||||
<component :is="ACTIVITY_ICON_COMPONENTS[t.icon]" />
|
||||
</span>
|
||||
<a-flex vertical :style="{ minWidth: 0, flex: 1 }">
|
||||
<a-typography-text strong :ellipsis="true">{{ t.name }}</a-typography-text>
|
||||
<a-typography-text type="secondary" :style="{ fontSize: '12px' }">
|
||||
{{ ACTIVITY_TYPE_LABELS[t.baseType] }} · {{ toFaDigits(t.fields.length) }} فیلد
|
||||
<template v-if="!t.isActive"> · غیرفعال</template>
|
||||
</a-typography-text>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
</a-button>
|
||||
<a-flex vertical>
|
||||
<a-button
|
||||
type="text"
|
||||
:disabled="index === 0 || Boolean(busy)"
|
||||
aria-label="انتقال به بالا"
|
||||
@click="moveType(index, -1)"
|
||||
▲
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="index === types.length - 1 || Boolean(busy)"
|
||||
aria-label="انتقال به پایین"
|
||||
@click="moveType(index, 1)"
|
||||
>
|
||||
▼
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="add-type" :class="{ on: selectedId === 'new' }" @click="select('new')">
|
||||
<UiIcon name="plus" :size="15" />
|
||||
نوع فعالیت جدید
|
||||
</button>
|
||||
</aside>
|
||||
|
||||
<section v-if="draft" class="editor">
|
||||
<div class="grid">
|
||||
<label class="f">
|
||||
<span>نام نوع</span>
|
||||
<input v-model="draft.name" maxlength="60" placeholder="مثلاً: بازدید حضوری" />
|
||||
</label>
|
||||
<label class="f">
|
||||
<span>نوع پایه (برای گزارشها)</span>
|
||||
<select v-model="draft.baseType" :disabled="draft.isSystem">
|
||||
<option v-for="b in BASE_TYPES" :key="b" :value="b">{{ ACTIVITY_TYPE_LABELS[b] }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="f">
|
||||
<span>رنگ</span>
|
||||
<select v-model="draft.color">
|
||||
<option v-for="c in ACTIVITY_STAGE_COLORS" :key="c" :value="c">
|
||||
{{ ACTIVITY_STAGE_COLOR_LABELS[c] }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<label v-if="!draft.isSystem && draft.id" class="f toggle">
|
||||
<input v-model="draft.isActive" type="checkbox" />
|
||||
<span>فعال (در فرم فعالیت قابل انتخاب باشد)</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="f">
|
||||
<span>آیکون</span>
|
||||
<div class="icons">
|
||||
<button
|
||||
v-for="ic in ACTIVITY_TYPE_ICONS"
|
||||
:key="ic"
|
||||
type="button"
|
||||
:class="{ on: draft.icon === ic }"
|
||||
:style="draft.icon === ic ? typeColorStyle(draft.color) : undefined"
|
||||
:title="ACTIVITY_TYPE_ICON_LABELS[ic]"
|
||||
:aria-label="ACTIVITY_TYPE_ICON_LABELS[ic]"
|
||||
@click="draft.icon = ic"
|
||||
>
|
||||
<UiIcon :name="ic" :size="16" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p v-if="draft.isSystem" class="sys-note">
|
||||
این نوع اصلی است: حذف و غیرفعال نمیشود، ولی نام، ظاهر و فیلدهایش قابل تغییر است.
|
||||
</p>
|
||||
|
||||
<div class="fields-head">
|
||||
<strong>فیلدهای اختصاصی</strong>
|
||||
<small>{{ toFaDigits(draft.fields.length) }} فیلد</small>
|
||||
</div>
|
||||
<p v-if="!draft.fields.length" class="empty">
|
||||
هنوز فیلدی تعریف نشده؛ فعالیتهای این نوع فقط فیلدهای عمومی (عنوان، زمان، مسئول، مشتری…) را دارند.
|
||||
</p>
|
||||
|
||||
<div v-for="(f, index) in draft.fields" :key="f.key" class="field-card">
|
||||
<div class="field-top">
|
||||
<span class="num">{{ toFaDigits(index + 1) }}</span>
|
||||
<input v-model="f.label" class="label-input" maxlength="80" placeholder="عنوان فیلد (مثلاً: موضوع جلسه)" />
|
||||
<select v-model="f.type" aria-label="نوع فیلد">
|
||||
<option v-for="ft in ACTIVITY_FIELD_TYPES" :key="ft" :value="ft">
|
||||
{{ ACTIVITY_FIELD_TYPE_LABELS[ft] }}
|
||||
</option>
|
||||
</select>
|
||||
<div class="field-actions">
|
||||
<button type="button" :disabled="index === 0" aria-label="بالا" @click="moveField(index, -1)">▲</button>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="index === draft.fields.length - 1"
|
||||
aria-label="پایین"
|
||||
@click="moveField(index, 1)"
|
||||
>
|
||||
<template #icon><ArrowUpOutlined /></template>
|
||||
</a-button>
|
||||
<a-button
|
||||
type="text"
|
||||
:disabled="index === types.length - 1 || Boolean(busy)"
|
||||
aria-label="انتقال به پایین"
|
||||
@click="moveType(index, 1)"
|
||||
>
|
||||
<template #icon><ArrowDownOutlined /></template>
|
||||
</a-button>
|
||||
</a-flex>
|
||||
</a-flex>
|
||||
<a-button
|
||||
block
|
||||
:type="selectedId === 'new' ? 'primary' : 'dashed'"
|
||||
@click="select('new')"
|
||||
▼
|
||||
</button>
|
||||
<button type="button" class="danger" aria-label="حذف فیلد" @click="removeField(index)">
|
||||
<UiIcon name="trash" :size="14" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-extra">
|
||||
<textarea
|
||||
v-if="needsOptions(f.type)"
|
||||
v-model="f.optionsText"
|
||||
rows="3"
|
||||
placeholder="گزینهها — هر گزینه در یک خط"
|
||||
/>
|
||||
<input
|
||||
v-if="!['checkbox', 'participants', 'select', 'multiselect', 'date'].includes(f.type)"
|
||||
v-model="f.placeholder"
|
||||
maxlength="200"
|
||||
placeholder="متن راهنما داخل فیلد (اختیاری)"
|
||||
/>
|
||||
<label v-if="f.type !== 'checkbox'" class="req">
|
||||
<input v-model="f.required" type="checkbox" />
|
||||
اجباری
|
||||
</label>
|
||||
<small v-if="f.type === 'participants'" class="tip">
|
||||
همکارانی که بهعنوان شرکتکننده انتخاب شوند، این فعالیت را در لیست خودشان هم میبینند و اعلان
|
||||
دریافت میکنند.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="add-field" @click="addField">
|
||||
<UiIcon name="plus" :size="15" />
|
||||
افزودن فیلد
|
||||
</button>
|
||||
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
<p v-else-if="notice" class="notice">{{ notice }}</p>
|
||||
|
||||
<div class="actions">
|
||||
<UiButton
|
||||
variant="primary"
|
||||
type="button"
|
||||
:disabled="!dirty || Boolean(busy)"
|
||||
:loading="busy === 'save'"
|
||||
@click="save"
|
||||
>
|
||||
{{ draft.id ? 'ذخیرهٔ تغییرات' : 'ساخت نوع فعالیت' }}
|
||||
</UiButton>
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { RouterLink } from 'vue-router';
|
||||
import { GiftOutlined } from '@/icons/ant-bridge';
|
||||
import {
|
||||
Button as AButton,
|
||||
Flex as AFlex,
|
||||
List as AList,
|
||||
Modal as AModal,
|
||||
Space as ASpace,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import { api } from '@/lib/api';
|
||||
import { toFaDigits } from '@/lib/jalali';
|
||||
import { hasSectionPermission } from '@/lib/section-permissions';
|
||||
@@ -74,78 +64,63 @@ onMounted(async () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section v-if="data" class="bg-white rounded-2xl border border-slate-200/80 p-4 shadow-sm">
|
||||
<a-flex align="center" wrap="wrap" gap="middle" justify="space-between">
|
||||
<a-flex align="center" gap="middle">
|
||||
<a-typography-text type="secondary"><GiftOutlined /></a-typography-text>
|
||||
<div>
|
||||
<a-typography-text strong>تولدهای {{ data.monthName }}</a-typography-text>
|
||||
<br />
|
||||
<a-typography-text type="secondary">
|
||||
{{ toFaDigits(data.total) }} مشتری این ماه تولد دارند
|
||||
</a-typography-text>
|
||||
</div>
|
||||
</a-flex>
|
||||
<section v-if="data" class="birthdays">
|
||||
<div class="head">
|
||||
<span class="ico"><UiIcon name="gift" :size="18" /></span>
|
||||
<div>
|
||||
<strong>تولدهای {{ data.monthName }}</strong>
|
||||
<p>{{ toFaDigits(data.total) }} مشتری این ماه تولد دارند</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a-space wrap>
|
||||
<RouterLink
|
||||
v-for="person in data.preview"
|
||||
:key="person.id"
|
||||
:to="{ name: 'person-detail', params: { id: person.id } }"
|
||||
<div class="chips">
|
||||
<RouterLink
|
||||
v-for="person in data.preview"
|
||||
:key="person.id"
|
||||
class="chip"
|
||||
:title="person.fullName"
|
||||
:to="{ name: 'person-detail', params: { id: person.id } }"
|
||||
>
|
||||
<b>{{ toFaDigits(person.day) }}</b>
|
||||
<span>{{ person.fullName }}</span>
|
||||
</RouterLink>
|
||||
</div>
|
||||
<button type="button" class="more" @click="listOpen = true">
|
||||
{{ data.total > data.preview.length ? 'همه' : 'فهرست' }}
|
||||
</button>
|
||||
|
||||
<UiModal :open="listOpen" :title="`تولدهای ${data.monthName}`" @close="listOpen = false">
|
||||
<div class="days">
|
||||
<section
|
||||
v-for="[day, people] in groups"
|
||||
:key="day"
|
||||
class="day"
|
||||
:class="{ past: day < data.today, today: day === data.today }"
|
||||
>
|
||||
<a-tag>
|
||||
{{ toFaDigits(person.day) }} — {{ person.fullName }}
|
||||
</a-tag>
|
||||
</RouterLink>
|
||||
<a-button type="link" @click="listOpen = true">
|
||||
{{ data.total > data.preview.length ? 'همه' : 'فهرست' }}
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-flex>
|
||||
|
||||
<a-modal
|
||||
v-model:open="listOpen"
|
||||
:title="`تولدهای ${data.monthName}`"
|
||||
:footer="null"
|
||||
destroy-on-close
|
||||
>
|
||||
<a-list item-layout="vertical" :data-source="groups">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
<a-tag v-if="item[0] < data!.today">گذشته</a-tag>
|
||||
<a-tag v-else-if="item[0] === data!.today" color="processing">امروز</a-tag>
|
||||
</template>
|
||||
<a-list-item-meta>
|
||||
<template #title>
|
||||
{{ toFaDigits(item[0]) }} {{ data!.monthName }}
|
||||
</template>
|
||||
</a-list-item-meta>
|
||||
<a-list :data-source="item[1]">
|
||||
<template #renderItem="{ item: person }">
|
||||
<a-list-item>
|
||||
<RouterLink
|
||||
:to="{ name: 'person-detail', params: { id: person.id } }"
|
||||
@click="listOpen = false"
|
||||
>
|
||||
{{ person.fullName }}
|
||||
</RouterLink>
|
||||
<template #actions>
|
||||
<a-button
|
||||
type="link"
|
||||
:disabled="!person.mobile"
|
||||
@click="openSms(person)"
|
||||
>
|
||||
{{ person.mobile ? 'پیامک تبریک' : 'بدون شماره' }}
|
||||
</a-button>
|
||||
</template>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
</a-modal>
|
||||
<h3>
|
||||
<b>{{ toFaDigits(day) }}</b>
|
||||
<span>{{ data.monthName }}</span>
|
||||
<em v-if="day < data.today">گذشته</em>
|
||||
<em v-else-if="day === data.today">امروز</em>
|
||||
</h3>
|
||||
<ul>
|
||||
<li v-for="person in people" :key="person.id">
|
||||
<RouterLink :to="{ name: 'person-detail', params: { id: person.id } }" @click="listOpen = false">
|
||||
{{ person.fullName }}
|
||||
</RouterLink>
|
||||
<button
|
||||
type="button"
|
||||
class="sms"
|
||||
:disabled="!person.mobile"
|
||||
@click="openSms(person)"
|
||||
>
|
||||
{{ person.mobile ? 'پیامک تبریک' : 'بدون شماره' }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
</UiModal>
|
||||
|
||||
<SmsComposeModal
|
||||
nest
|
||||
@@ -161,3 +136,289 @@ onMounted(async () => {
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.birthdays {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
background:
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.35), transparent 42%),
|
||||
linear-gradient(100deg, var(--accent-subtle) 0%, #fff 58%, #fff7f4 100%);
|
||||
border: 1px solid color-mix(in srgb, var(--accent) 22%, #fff);
|
||||
border-radius: var(--radius);
|
||||
box-shadow: 0 6px 18px rgba(15, 118, 110, 0.05);
|
||||
padding: 0.55rem 0.75rem;
|
||||
}
|
||||
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.55rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ico {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 10px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: #fff;
|
||||
color: #e11d48;
|
||||
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, #fff);
|
||||
}
|
||||
|
||||
.head strong {
|
||||
display: block;
|
||||
color: var(--accent-deep);
|
||||
font-size: 0.88rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.head p {
|
||||
margin: 0.05rem 0 0;
|
||||
color: #64748b;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.chips {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-wrap: nowrap;
|
||||
gap: 0.35rem;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.chip {
|
||||
display: inline-flex;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
max-width: 11.5rem;
|
||||
min-width: 0;
|
||||
border-radius: 999px;
|
||||
border: 1px solid color-mix(in srgb, var(--accent) 24%, #fff);
|
||||
background: rgba(255, 255, 255, 0.86);
|
||||
color: #134e4a;
|
||||
padding: 0.22rem 0.55rem 0.22rem 0.28rem;
|
||||
text-decoration: none;
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
|
||||
.chip b {
|
||||
flex-shrink: 0;
|
||||
font-weight: 700;
|
||||
font-size: 0.72rem;
|
||||
color: var(--accent-deep);
|
||||
background: var(--accent-soft);
|
||||
border-radius: 999px;
|
||||
padding: 0.12rem 0.38rem;
|
||||
}
|
||||
|
||||
.chip span {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.more {
|
||||
flex-shrink: 0;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
padding: 0.32rem 0.7rem;
|
||||
font: inherit;
|
||||
font-size: 0.78rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.more:hover {
|
||||
background: var(--accent-hover);
|
||||
}
|
||||
|
||||
.days {
|
||||
display: grid;
|
||||
gap: 0.85rem;
|
||||
max-height: 62vh;
|
||||
overflow: auto;
|
||||
padding-inline-end: 0.15rem;
|
||||
}
|
||||
|
||||
.day {
|
||||
background: #fff;
|
||||
border: 1px solid #e7eef2;
|
||||
border-radius: 14px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.day h3 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
margin: 0;
|
||||
padding: 0.55rem 0.8rem;
|
||||
background: var(--accent-subtle);
|
||||
border-bottom: 1px solid color-mix(in srgb, var(--accent) 16%, #fff);
|
||||
font-size: 0.86rem;
|
||||
font-weight: 600;
|
||||
color: var(--accent-deep);
|
||||
}
|
||||
|
||||
.day h3 b {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
min-width: 1.7rem;
|
||||
height: 1.7rem;
|
||||
padding: 0 0.3rem;
|
||||
border-radius: 999px;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
|
||||
.day em {
|
||||
margin-inline-start: auto;
|
||||
font-style: normal;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 600;
|
||||
color: #94a3b8;
|
||||
background: #fff;
|
||||
border-radius: 999px;
|
||||
padding: 0.1rem 0.45rem;
|
||||
}
|
||||
|
||||
.day.today h3 {
|
||||
background: color-mix(in srgb, var(--accent-soft) 70%, #fff);
|
||||
}
|
||||
|
||||
.day.today em {
|
||||
color: var(--accent-deep);
|
||||
}
|
||||
|
||||
.day.past {
|
||||
opacity: 0.82;
|
||||
}
|
||||
|
||||
.day ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.day li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
padding: 0.62rem 0.85rem;
|
||||
border-top: 1px solid #eef2f6;
|
||||
}
|
||||
|
||||
.day li:first-child {
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.day a {
|
||||
flex: 1 1 auto;
|
||||
color: #0f172a;
|
||||
text-decoration: none;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.day a:hover {
|
||||
color: var(--accent-deep);
|
||||
}
|
||||
|
||||
.sms {
|
||||
flex-shrink: 0;
|
||||
border: 1px solid color-mix(in srgb, var(--accent) 35%, #fff);
|
||||
background: #fff;
|
||||
color: var(--accent-deep);
|
||||
border-radius: 999px;
|
||||
padding: 0.28rem 0.65rem;
|
||||
font: inherit;
|
||||
font-size: 0.75rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sms:hover:not(:disabled) {
|
||||
background: var(--accent-subtle);
|
||||
}
|
||||
|
||||
.sms:disabled {
|
||||
border-color: #e2e8f0;
|
||||
color: #94a3b8;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.lead {
|
||||
margin: 0 0 0.6rem;
|
||||
}
|
||||
|
||||
.hint,
|
||||
.err,
|
||||
.ok {
|
||||
margin: 0.55rem 0 0;
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.hint {
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.err {
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.ok {
|
||||
color: #16a34a;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.birthdays {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 0.45rem 0.6rem;
|
||||
}
|
||||
|
||||
.head {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.head p {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.more {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
}
|
||||
|
||||
.chips {
|
||||
grid-column: 1 / -1;
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.chips::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.day li {
|
||||
gap: 0.45rem;
|
||||
padding-inline: 0.7rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
FlagFilled,
|
||||
LeftOutlined,
|
||||
MoreOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
} from '@ant-design/icons-vue';
|
||||
import {
|
||||
Avatar as AAvatar,
|
||||
Button as AButton,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { nextTick, ref } from 'vue';
|
||||
import { PlusOutlined } from '@/icons/ant-bridge';
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import {
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref } from 'vue';
|
||||
import { HolderOutlined, MoreOutlined } from '@/icons/ant-bridge';
|
||||
import { HolderOutlined, MoreOutlined } from '@ant-design/icons-vue';
|
||||
import {
|
||||
Button as AButton,
|
||||
Dropdown as ADropdown,
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
CheckOutlined,
|
||||
DeleteOutlined,
|
||||
MoreOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
} from '@ant-design/icons-vue';
|
||||
import {
|
||||
Avatar as AAvatar,
|
||||
Button as AButton,
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
FlagOutlined,
|
||||
MoreOutlined,
|
||||
WarningOutlined,
|
||||
} from '@/icons/ant-bridge';
|
||||
} from '@ant-design/icons-vue';
|
||||
|
||||
const AMenuItem = AMenu.Item;
|
||||
import UserAvatar from '@/components/UserAvatar.vue';
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { Menu as AMenu } from 'ant-design-vue';
|
||||
import type { MenuProps } from 'ant-design-vue';
|
||||
import { Segmented as ASegmented } from 'ant-design-vue';
|
||||
import { treasurySectionAllowed, type TreasurySectionKey } from '@mento/shared';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
|
||||
@@ -14,29 +13,33 @@ const scroller = ref<HTMLElement | null>(null);
|
||||
const links = computed(() => {
|
||||
const role = auth.user?.role;
|
||||
const permissions = auth.user?.permissions;
|
||||
const all: Array<{ to: string; label: string; exact?: boolean; section: TreasurySectionKey }> = [
|
||||
{ to: '/finance', label: 'داشبورد', exact: true, section: 'treasury_dashboard' },
|
||||
{ to: '/finance/incomes', label: 'دریافتها و درآمدها', section: 'treasury_incomes' },
|
||||
{ to: '/finance/expenses', label: 'پرداختها و هزینهها', section: 'treasury_expenses' },
|
||||
{ to: '/finance/receivables', label: 'اقساط و مطالبات', section: 'treasury_receivables' },
|
||||
{ to: '/finance/accounts', label: 'صندوق و حسابها', section: 'treasury_accounts' },
|
||||
{ to: '/finance/payroll', label: 'حقوق', section: 'treasury_payroll' },
|
||||
{ to: '/finance/recurring', label: 'تکرارشونده', section: 'treasury_recurring' },
|
||||
{ to: '/finance/reports', label: 'گزارش', section: 'treasury_reports' },
|
||||
{ to: '/finance/audit', label: 'سوابق', section: 'treasury_audit' },
|
||||
{ to: '/finance/categories', label: 'دستهبندی', section: 'treasury_categories' },
|
||||
const all: Array<{ value: string; label: string; exact?: boolean; section: TreasurySectionKey }> = [
|
||||
{ value: '/finance', label: 'داشبورد', exact: true, section: 'treasury_dashboard' },
|
||||
{ value: '/finance/incomes', label: 'دریافتها و درآمدها', section: 'treasury_incomes' },
|
||||
{ value: '/finance/expenses', label: 'پرداختها و هزینهها', section: 'treasury_expenses' },
|
||||
{ value: '/finance/receivables', label: 'اقساط و مطالبات', section: 'treasury_receivables' },
|
||||
{ value: '/finance/accounts', label: 'صندوق و حسابها', section: 'treasury_accounts' },
|
||||
{ value: '/finance/payroll', label: 'حقوق', section: 'treasury_payroll' },
|
||||
{ value: '/finance/recurring', label: 'تکرارشونده', section: 'treasury_recurring' },
|
||||
{ value: '/finance/reports', label: 'گزارش', section: 'treasury_reports' },
|
||||
{ value: '/finance/audit', label: 'سوابق', section: 'treasury_audit' },
|
||||
{ value: '/finance/categories', label: 'دستهبندی', section: 'treasury_categories' },
|
||||
];
|
||||
return all.filter((link) => treasurySectionAllowed(role, permissions, link.section));
|
||||
});
|
||||
|
||||
function on(path: string, exact?: boolean) {
|
||||
if (exact) return route.path === path;
|
||||
return route.path === path || route.path.startsWith(`${path}/`);
|
||||
}
|
||||
const options = computed(() => links.value.map((l) => ({ value: l.value, label: l.label })));
|
||||
|
||||
const selectedKeys = computed(() => {
|
||||
const match = links.value.find((link) => on(link.to, link.exact));
|
||||
return match ? [match.to] : [];
|
||||
const active = computed(() => {
|
||||
const path = route.path;
|
||||
for (const link of links.value) {
|
||||
if (link.exact) {
|
||||
if (path === link.value) return link.value;
|
||||
} else if (path === link.value || path.startsWith(`${link.value}/`)) {
|
||||
return link.value;
|
||||
}
|
||||
}
|
||||
return '/finance';
|
||||
});
|
||||
|
||||
watch(
|
||||
|
||||
Reference in New Issue
Block a user