Display and accept SuperAdmin money amounts in tomans.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-08 13:27:31 +03:30
co-authored by Cursor
parent 68de9a2337
commit 8e696bb591
7 changed files with 55 additions and 27 deletions
+13 -3
View File
@@ -1,7 +1,16 @@
<script setup lang="ts">
import { computed } from 'vue'
import { fromGroupedInput, toGroupedDisplay } from '@/utils/money'
import {
fromGroupedInput,
rialToToman,
toGroupedDisplay,
tomanToRial,
} from '@/utils/money'
/**
* Money field bound to **rial** storage values (API/DB).
* User types and sees **toman** (÷10 / ×10 at the edges).
*/
const props = withDefaults(
defineProps<{
value: number | null | undefined
@@ -22,10 +31,11 @@ const emit = defineEmits<{
(e: 'update:value', value: number): void
}>()
const display = computed(() => toGroupedDisplay(props.value ?? 0))
const display = computed(() => toGroupedDisplay(rialToToman(props.value ?? 0)))
function onInput(raw: string | number) {
emit('update:value', fromGroupedInput(String(raw ?? ''), props.allowNegative))
const toman = fromGroupedInput(String(raw ?? ''), props.allowNegative)
emit('update:value', tomanToRial(toman))
}
</script>