fix: added forecasting & currency setting in general settings
(cherry picked from commit 5dcd416007e5f9e0515f2525deaa88323cedc11b)
This commit is contained in:
parent
59030f8d44
commit
d75cde4bb0
@ -10,16 +10,70 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-1 flex flex-col overflow-y-auto">
|
<div class="flex-1 flex flex-col overflow-y-auto">
|
||||||
<template v-for="(setting, i) in settings" :key="setting.name">
|
<div
|
||||||
|
class="flex items-center justify-between p-3 cursor-pointer hover:bg-surface-menu-bar rounded"
|
||||||
|
@click="toggleForecasting()"
|
||||||
|
>
|
||||||
|
<div class="flex flex-col gap-0.5">
|
||||||
|
<div class="text-base font-medium text-ink-gray-7 truncate">
|
||||||
|
{{ __('Enable forecasting') }}
|
||||||
|
</div>
|
||||||
|
<div class="text-base text-ink-gray-5 truncate">
|
||||||
|
{{
|
||||||
|
__(
|
||||||
|
"It will make deal's `Close Date` & `Deal Value` mandatory to get accurate forecasting insights",
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Switch
|
||||||
|
size="sm"
|
||||||
|
v-model="settings.doc.enable_forecasting"
|
||||||
|
@click.stop="toggleForecasting(settings.doc.enable_forecasting)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="h-px border-t mx-2 border-outline-gray-modals" />
|
||||||
|
<div
|
||||||
|
class="flex items-center justify-between gap-8 p-3 cursor-pointer hover:bg-surface-menu-bar rounded"
|
||||||
|
>
|
||||||
|
<div class="flex flex-col gap-0.5">
|
||||||
|
<div class="text-base font-medium text-ink-gray-7 truncate">
|
||||||
|
{{ __('Currency') }}
|
||||||
|
</div>
|
||||||
|
<div class="text-base text-ink-gray-5">
|
||||||
|
{{
|
||||||
|
__(
|
||||||
|
'Set your CRM’s main currency. All monetary values will use this. This can’t be changed later.',
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Link
|
||||||
|
class="form-control flex-1 truncate"
|
||||||
|
:class="settings.doc.currency ? '' : 'w-40'"
|
||||||
|
:value="settings.doc.currency || ''"
|
||||||
|
doctype="Currency"
|
||||||
|
@change="(v) => setCurrency(v)"
|
||||||
|
:placeholder="__('Select currency')"
|
||||||
|
:disabled="settings.doc.currency ? true : false"
|
||||||
|
placement="bottom-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="h-px border-t mx-2 border-outline-gray-modals" />
|
||||||
|
<template v-for="(setting, i) in settingsList" :key="setting.name">
|
||||||
<li
|
<li
|
||||||
class="flex items-center justify-between p-3 cursor-pointer hover:bg-surface-menu-bar rounded"
|
class="flex items-center justify-between p-3 cursor-pointer hover:bg-surface-menu-bar rounded"
|
||||||
@click="() => emit('updateStep', setting.name)"
|
@click="() => emit('updateStep', setting.name)"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col gap-0.5">
|
||||||
<div class="text-base font-medium text-ink-gray-7 truncate">
|
<div class="text-base font-medium text-ink-gray-7 truncate">
|
||||||
{{ __(setting.label) }}
|
{{ __(setting.label) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-p-base text-ink-gray-5 truncate">
|
<div class="text-base text-ink-gray-5 truncate">
|
||||||
{{ __(setting.description) }}
|
{{ __(setting.description) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -28,7 +82,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<div
|
<div
|
||||||
v-if="settings !== i + 1"
|
v-if="settingsList !== i + 1"
|
||||||
class="h-px border-t mx-2 border-outline-gray-modals"
|
class="h-px border-t mx-2 border-outline-gray-modals"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@ -37,9 +91,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import Link from '@/components/Controls/Link.vue'
|
||||||
|
import { getSettings } from '@/stores/settings'
|
||||||
|
import { globalStore } from '@/stores/global'
|
||||||
|
import { Switch, toast } from 'frappe-ui'
|
||||||
|
|
||||||
const emit = defineEmits(['updateStep'])
|
const emit = defineEmits(['updateStep'])
|
||||||
|
|
||||||
const settings = [
|
const { _settings: settings } = getSettings()
|
||||||
|
const { $dialog } = globalStore()
|
||||||
|
|
||||||
|
const settingsList = [
|
||||||
{
|
{
|
||||||
name: 'brand-settings',
|
name: 'brand-settings',
|
||||||
label: 'Brand settings',
|
label: 'Brand settings',
|
||||||
@ -51,4 +113,46 @@ const settings = [
|
|||||||
description: 'Configure actions that appear on the home dropdown',
|
description: 'Configure actions that appear on the home dropdown',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
function toggleForecasting(value) {
|
||||||
|
settings.doc.enable_forecasting =
|
||||||
|
value !== undefined ? value : !settings.doc.enable_forecasting
|
||||||
|
|
||||||
|
settings.save.submit(null, {
|
||||||
|
onSuccess: () => {
|
||||||
|
toast.success(
|
||||||
|
settings.doc.enable_forecasting
|
||||||
|
? __('Forecasting enabled successfully')
|
||||||
|
: __('Forecasting disabled successfully'),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function setCurrency(value) {
|
||||||
|
$dialog({
|
||||||
|
title: __('Set currency'),
|
||||||
|
message: __(
|
||||||
|
'Are you sure you want to set the currency as {0}? This cannot be changed later.',
|
||||||
|
[value],
|
||||||
|
),
|
||||||
|
variant: 'solid',
|
||||||
|
theme: 'blue',
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
label: __('Save'),
|
||||||
|
variant: 'solid',
|
||||||
|
onClick: (close) => {
|
||||||
|
settings.doc.currency = value
|
||||||
|
settings.save.submit(null, {
|
||||||
|
onSuccess: () => {
|
||||||
|
toast.success(__('Currency set as {0} successfully', [value]))
|
||||||
|
close()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user