fix: reload after updating settings
This commit is contained in:
parent
03ec2db6dd
commit
22dc47d1bf
@ -10,7 +10,7 @@
|
|||||||
/>
|
/>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div v-if="settings.doc" class="flex-1 flex flex-col gap-6 overflow-y-auto">
|
<div v-if="settings.doc" class="flex-1 flex flex-col gap-8 overflow-y-auto">
|
||||||
<div class="flex w-full">
|
<div class="flex w-full">
|
||||||
<FormControl
|
<FormControl
|
||||||
type="text"
|
type="text"
|
||||||
@ -21,10 +21,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- logo -->
|
<!-- logo -->
|
||||||
<hr class="w-full border-outline-gray-2" />
|
|
||||||
|
|
||||||
<div class="flex flex-col justify-between gap-5">
|
<div class="flex flex-col justify-between gap-4">
|
||||||
<span class="text-lg font-semibold text-ink-gray-9">
|
<span class="text-base font-semibold text-ink-gray-9">
|
||||||
{{ __('Logo') }}
|
{{ __('Logo') }}
|
||||||
</span>
|
</span>
|
||||||
<div class="flex flex-1 gap-5">
|
<div class="flex flex-1 gap-5">
|
||||||
@ -57,10 +56,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- favicon -->
|
<!-- favicon -->
|
||||||
<hr class="w-full border-outline-gray-2" />
|
|
||||||
|
|
||||||
<div class="flex flex-col justify-between gap-5">
|
<div class="flex flex-col justify-between gap-4">
|
||||||
<span class="text-lg font-semibold text-ink-gray-9">
|
<span class="text-base font-semibold text-ink-gray-9">
|
||||||
{{ __('Favicon') }}
|
{{ __('Favicon') }}
|
||||||
</span>
|
</span>
|
||||||
<div class="flex flex-1 gap-5">
|
<div class="flex flex-1 gap-5">
|
||||||
@ -93,10 +91,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- dropdown settings -->
|
<!-- dropdown settings -->
|
||||||
<hr class="w-full border-outline-gray-2" />
|
|
||||||
|
|
||||||
<div class="flex flex-col justify-between gap-5">
|
<div class="flex flex-col justify-between gap-4">
|
||||||
<span class="text-lg font-semibold text-ink-gray-9">
|
<span class="text-base font-semibold text-ink-gray-9">
|
||||||
{{ __('Dropdown settings') }}
|
{{ __('Dropdown settings') }}
|
||||||
</span>
|
</span>
|
||||||
<div class="flex flex-1">
|
<div class="flex flex-1">
|
||||||
@ -107,10 +104,15 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row-reverse">
|
<div class="flex flex-row-reverse">
|
||||||
<Button :label="__('Save')" variant="solid" @click="updateSettings" />
|
<Button
|
||||||
</div>
|
variant="solid"
|
||||||
|
:label="__('Update')"
|
||||||
|
:disabled="!settings.isDirty"
|
||||||
|
@click="updateSettings"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -121,10 +123,11 @@ import { FormControl, Badge } from 'frappe-ui'
|
|||||||
import { getSettings } from '@/stores/settings'
|
import { getSettings } from '@/stores/settings'
|
||||||
import { showSettings } from '@/composables/settings'
|
import { showSettings } from '@/composables/settings'
|
||||||
|
|
||||||
const { _settings: settings } = getSettings()
|
const { _settings: settings, setupBrand } = getSettings()
|
||||||
|
|
||||||
function updateSettings() {
|
function updateSettings() {
|
||||||
settings.save.submit()
|
settings.save.submit()
|
||||||
showSettings.value = false
|
showSettings.value = false
|
||||||
|
setupBrand()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -3,62 +3,68 @@
|
|||||||
<h2 class="flex gap-2 text-xl font-semibold leading-none h-5">
|
<h2 class="flex gap-2 text-xl font-semibold leading-none h-5">
|
||||||
{{ __('Send Invites To') }}
|
{{ __('Send Invites To') }}
|
||||||
</h2>
|
</h2>
|
||||||
<div class="flex-1 overflow-y-auto">
|
<div class="flex-1 flex flex-col gap-8 overflow-y-auto">
|
||||||
<label class="block text-xs text-ink-gray-5 mb-1.5">
|
<div>
|
||||||
{{ __('Invite by email') }}
|
<label class="block text-xs text-ink-gray-5 mb-1.5">
|
||||||
</label>
|
{{ __('Invite by email') }}
|
||||||
<MultiValueInput
|
</label>
|
||||||
v-model="invitees"
|
<MultiValueInput
|
||||||
:validate="validateEmail"
|
v-model="invitees"
|
||||||
:error-message="
|
:validate="validateEmail"
|
||||||
(value) => __('{0} is an invalid email address', [value])
|
:error-message="
|
||||||
"
|
(value) => __('{0} is an invalid email address', [value])
|
||||||
/>
|
"
|
||||||
<FormControl
|
/>
|
||||||
type="select"
|
<FormControl
|
||||||
class="mt-4"
|
type="select"
|
||||||
v-model="role"
|
class="mt-4"
|
||||||
:label="__('Invite as')"
|
v-model="role"
|
||||||
:options="[
|
:label="__('Invite as')"
|
||||||
{ label: __('Regular Access'), value: 'Sales User' },
|
:options="[
|
||||||
{ label: __('Manager Access'), value: 'Sales Manager' },
|
{ label: __('Regular Access'), value: 'Sales User' },
|
||||||
]"
|
{ label: __('Manager Access'), value: 'Sales Manager' },
|
||||||
:description="description"
|
]"
|
||||||
/>
|
:description="description"
|
||||||
<ErrorMessage class="mt-2" v-if="error" :message="error" />
|
/>
|
||||||
|
<ErrorMessage class="mt-2" v-if="error" :message="error" />
|
||||||
|
</div>
|
||||||
<template v-if="pendingInvitations.data?.length && !invitees.length">
|
<template v-if="pendingInvitations.data?.length && !invitees.length">
|
||||||
<div
|
<div class="flex flex-col gap-4">
|
||||||
class="mt-6 flex items-center justify-between py-4 text-base font-semibold"
|
<div
|
||||||
>
|
class="flex items-center justify-between text-base font-semibold"
|
||||||
<div>{{ __('Pending Invites') }}</div>
|
|
||||||
</div>
|
|
||||||
<ul class="flex flex-col gap-1">
|
|
||||||
<li
|
|
||||||
class="flex items-center justify-between px-2 py-1 rounded-lg bg-surface-gray-2"
|
|
||||||
v-for="user in pendingInvitations.data"
|
|
||||||
:key="user.name"
|
|
||||||
>
|
>
|
||||||
<div class="text-base">
|
<div>{{ __('Pending Invites') }}</div>
|
||||||
<span class="text-ink-gray-9">
|
</div>
|
||||||
{{ user.email }}
|
<ul class="flex flex-col gap-1">
|
||||||
</span>
|
<li
|
||||||
<span class="text-ink-gray-5"> ({{ roleMap[user.role] }}) </span>
|
class="flex items-center justify-between px-2 py-1 rounded-lg bg-surface-gray-2"
|
||||||
</div>
|
v-for="user in pendingInvitations.data"
|
||||||
<div>
|
:key="user.name"
|
||||||
<Tooltip text="Delete Invitation">
|
>
|
||||||
<Button
|
<div class="text-base">
|
||||||
icon="x"
|
<span class="text-ink-gray-9">
|
||||||
variant="ghost"
|
{{ user.email }}
|
||||||
:loading="
|
</span>
|
||||||
pendingInvitations.delete.loading &&
|
<span class="text-ink-gray-5">
|
||||||
pendingInvitations.delete.params.name === user.name
|
({{ roleMap[user.role] }})
|
||||||
"
|
</span>
|
||||||
@click="pendingInvitations.delete.submit(user.name)"
|
</div>
|
||||||
/>
|
<div>
|
||||||
</Tooltip>
|
<Tooltip text="Delete Invitation">
|
||||||
</div>
|
<Button
|
||||||
</li>
|
icon="x"
|
||||||
</ul>
|
variant="ghost"
|
||||||
|
:loading="
|
||||||
|
pendingInvitations.delete.loading &&
|
||||||
|
pendingInvitations.delete.params.name === user.name
|
||||||
|
"
|
||||||
|
@click="pendingInvitations.delete.submit(user.name)"
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row-reverse">
|
<div class="flex flex-row-reverse">
|
||||||
|
|||||||
@ -10,16 +10,21 @@ export function getSettings() {
|
|||||||
name: 'FCRM Settings',
|
name: 'FCRM Settings',
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
settings.value = data
|
settings.value = data
|
||||||
brand.name = settings.value?.brand_name
|
setupBrand()
|
||||||
brand.logo = settings.value?.brand_logo
|
|
||||||
brand.favicon = settings.value?.favicon
|
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function setupBrand() {
|
||||||
|
brand.name = settings.value?.brand_name
|
||||||
|
brand.logo = settings.value?.brand_logo
|
||||||
|
brand.favicon = settings.value?.favicon
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_settings,
|
_settings,
|
||||||
settings,
|
settings,
|
||||||
brand,
|
brand,
|
||||||
|
setupBrand,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user