Polish admin pricing UI, currency inputs, and active switch confirm.

EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-08 12:44:05 +02:00
co-authored by Cursor
parent 47c7d1dc27
commit 7fc9f98f86
14 changed files with 181 additions and 93 deletions
+58
View File
@@ -0,0 +1,58 @@
<script setup lang="ts">
import { computed } from 'vue'
import { extractNumericString, formatNumber } from '@/utils/format'
const props = withDefaults(
defineProps<{
modelValue?: number | null
placeholder?: string
disabled?: boolean
id?: string
inputClass?: string
allowEmpty?: boolean
}>(),
{
modelValue: null,
placeholder: '',
disabled: false,
inputClass: 'admin-input',
allowEmpty: true,
},
)
const emit = defineEmits<{
'update:modelValue': [value: number | null]
}>()
const displayValue = computed(() => {
if (props.modelValue == null || !Number.isFinite(props.modelValue)) return ''
return formatNumber(props.modelValue)
})
function onInput(event: Event) {
const input = event.target as HTMLInputElement
const numeric = extractNumericString(input.value)
if (!numeric) {
emit('update:modelValue', props.allowEmpty ? null : 0)
input.value = ''
return
}
const next = Number(numeric)
emit('update:modelValue', next)
input.value = formatNumber(next)
}
</script>
<template>
<input
:id="id"
type="text"
inputmode="numeric"
dir="ltr"
:class="inputClass"
:value="displayValue"
:placeholder="placeholder"
:disabled="disabled"
@input="onInput"
/>
</template>