fix: let only the owner set logout time and move the attendance tab

This commit is contained in:
2026-10-19 13:54:09 +03:30
parent 8590579605
commit f15ebb72ea
4 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -129,6 +129,7 @@ const avatarUrls = ref<Record<string, string>>({});
const loadedAvatars = new Set<string>();
const canInvite = computed(() => canManageUsers(auth.user?.role));
const canSetLogoutTime = computed(() => auth.user?.role === 'owner');
const canEditOrg = computed(() => canManageSettings(auth.user?.role));
const canEditRoles = computed(() => canManageUsers(auth.user?.role));
/** مالک واقعی می‌تواند از جدول کاربران وارد مشاهده شود / برگردد */
@@ -493,7 +494,7 @@ async function toggleStatus(user: OrgUserDto) {
}
async function changeLogoutTime(user: OrgUserDto, raw: string) {
if (!canInvite.value || user.role === 'owner') return;
if (!canSetLogoutTime.value || user.role === 'owner') return;
const next = raw.trim();
if (next === (user.logoutTime ?? '')) return;
error.value = '';
@@ -997,7 +998,7 @@ onUnmounted(() => {
<span :class="{ flip: !sortLoginDesc }">▴</span>
</button>
</th>
<th>ساعت خروج</th>
<th v-if="canSetLogoutTime">ساعت خروج</th>
<th class="ops" />
</tr>
</thead>
@@ -1037,7 +1038,7 @@ onUnmounted(() => {
</span>
</td>
<td class="muted">{{ formatLastLogin(user.lastLoginAt) }}</td>
<td @click.stop>
<td v-if="canSetLogoutTime" @click.stop>
<span v-if="user.role === 'owner'" class="muted">—</span>
<input
v-else
@@ -1045,7 +1046,6 @@ onUnmounted(() => {
type="time"
dir="ltr"
:value="user.logoutTime || ''"
:disabled="!canInvite"
:aria-label="`ساعت خروج ${user.fullName}`"
@change="changeLogoutTime(user, ($event.target as HTMLInputElement).value)"
/>