mirror of
https://github.com/frappe/lms.git
synced 2026-05-02 13:39:31 +03:00
Merge pull request #1823 from pateljannat/issues-144
fix: misc improvements
This commit is contained in:
+1
-1
Submodule frappe-ui updated: 310089f4a4...f1bde9bcb2
@@ -20,10 +20,10 @@
|
||||
</template>
|
||||
</Dialog>
|
||||
|
||||
<Popover :show="iosInstallMessage" placement="top">
|
||||
<Popover :show="iosInstallMessage" placement="top-start">
|
||||
<template #body>
|
||||
<div
|
||||
class="fixed bottom-[4rem] left-1/2 -translate-x-1/2 z-20 w-[90%] flex flex-col gap-3 rounded bg-blue-100 py-5 drop-shadow-xl"
|
||||
class="fixed top-[20rem] translate-x-1/3 z-20 flex flex-col gap-3 rounded bg-surface-white py-5 drop-shadow-xl"
|
||||
>
|
||||
<div
|
||||
class="mb-1 flex flex-row items-center justify-between px-3 text-center"
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
<div class="px-3 text-xs text-gray-800">
|
||||
<span class="flex flex-col gap-2">
|
||||
<span>
|
||||
<span class="leading-5">
|
||||
{{
|
||||
__(
|
||||
'Get the app on your iPhone for easy access & a better experience'
|
||||
|
||||
@@ -194,17 +194,26 @@ const isSessionUser = () => {
|
||||
return $user.data?.email === profile.data?.email
|
||||
}
|
||||
|
||||
const hasHigherAccess = () => {
|
||||
return $user.data?.is_evaluator || $user.data?.is_moderator
|
||||
}
|
||||
|
||||
const isEvaluatorOrModerator = () => {
|
||||
return (
|
||||
profile.data?.roles.filter(
|
||||
(row) => row.role === 'Moderator' || row.role === 'Evaluator'
|
||||
).length > 0
|
||||
)
|
||||
}
|
||||
|
||||
const getTabButtons = () => {
|
||||
let buttons = [{ label: 'About' }, { label: 'Certificates' }]
|
||||
if ($user.data?.is_moderator) buttons.push({ label: 'Roles' })
|
||||
if (
|
||||
isSessionUser() &&
|
||||
($user.data?.is_evaluator || $user.data?.is_moderator)
|
||||
) {
|
||||
|
||||
if (hasHigherAccess() && isEvaluatorOrModerator()) {
|
||||
buttons.push({ label: 'Slots' })
|
||||
buttons.push({ label: 'Schedule' })
|
||||
}
|
||||
|
||||
return buttons
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ const props = defineProps({
|
||||
const evaluations = createListResource({
|
||||
doctype: 'LMS Certificate Request',
|
||||
filters: {
|
||||
evaluator: user.data?.name,
|
||||
evaluator: props.profile.data?.name,
|
||||
status: ['!=', 'Cancelled'],
|
||||
},
|
||||
fields: [
|
||||
|
||||
@@ -43,18 +43,22 @@
|
||||
:options="days"
|
||||
v-model="slot.day"
|
||||
@focusout.stop="update(slot.name, 'day', slot.day)"
|
||||
:disabled="!isSessionUser()"
|
||||
/>
|
||||
<FormControl
|
||||
type="time"
|
||||
v-model="slot.start_time"
|
||||
@focusout.stop="update(slot.name, 'start_time', slot.start_time)"
|
||||
:disabled="!isSessionUser()"
|
||||
/>
|
||||
<FormControl
|
||||
type="time"
|
||||
v-model="slot.end_time"
|
||||
@focusout.stop="update(slot.name, 'end_time', slot.end_time)"
|
||||
:disabled="!isSessionUser()"
|
||||
/>
|
||||
<X
|
||||
v-if="isSessionUser()"
|
||||
@click="deleteRow(slot.name)"
|
||||
class="w-6 h-auto stroke-1.5 text-red-900 rounded-md cursor-pointer p-1 bg-surface-red-2 hidden group-hover:block"
|
||||
/>
|
||||
@@ -69,20 +73,23 @@
|
||||
:options="days"
|
||||
v-model="newSlot.day"
|
||||
@focusout.stop="add()"
|
||||
:disabled="!isSessionUser()"
|
||||
/>
|
||||
<FormControl
|
||||
type="time"
|
||||
v-model="newSlot.start_time"
|
||||
@focusout.stop="add()"
|
||||
:disabled="!isSessionUser()"
|
||||
/>
|
||||
<FormControl
|
||||
type="time"
|
||||
v-model="newSlot.end_time"
|
||||
@focusout.stop="add()"
|
||||
:disabled="!isSessionUser()"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Button @click="showSlotsTemplate = 1">
|
||||
<Button v-if="isSessionUser()" @click="showSlotsTemplate = 1">
|
||||
<template #prefix>
|
||||
<Plus class="w-4 h-4 stroke-1.5 text-ink-gray-7" />
|
||||
</template>
|
||||
@@ -98,6 +105,7 @@
|
||||
type="date"
|
||||
:label="__('From')"
|
||||
v-model="from"
|
||||
:disabled="!isSessionUser()"
|
||||
@blur="
|
||||
() => {
|
||||
updateUnavailability.submit({
|
||||
@@ -111,6 +119,7 @@
|
||||
type="date"
|
||||
:label="__('To')"
|
||||
v-model="to"
|
||||
:disabled="!isSessionUser()"
|
||||
@blur="
|
||||
() => {
|
||||
updateUnavailability.submit({
|
||||
@@ -122,7 +131,7 @@
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div v-if="isSessionUser()">
|
||||
<h2 class="mb-4 text-lg font-semibold text-ink-gray-9">
|
||||
{{ __('My calendar') }}
|
||||
</h2>
|
||||
@@ -157,11 +166,19 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (user.data?.name !== props.profile.data?.name) {
|
||||
if (user.data?.name !== props.profile.data?.name && !hasHigherAccess()) {
|
||||
window.location.href = `/user/${props.profile.data?.username}`
|
||||
}
|
||||
})
|
||||
|
||||
const hasHigherAccess = () => {
|
||||
return user.data?.is_evaluator || user.data?.is_moderator
|
||||
}
|
||||
|
||||
const isSessionUser = () => {
|
||||
return user.data?.email === props.profile.data?.email
|
||||
}
|
||||
|
||||
const showSlotsTemplate = ref(0)
|
||||
const from = ref(null)
|
||||
const to = ref(null)
|
||||
|
||||
Reference in New Issue
Block a user