diff --git a/src/components/AppDatePicker.vue b/src/components/AppDatePicker.vue index b37abe6..53dad42 100644 --- a/src/components/AppDatePicker.vue +++ b/src/components/AppDatePicker.vue @@ -6,14 +6,22 @@ import { getLocaleCode } from '../utils/locale' interface Props { modelValue: string placeholder?: string + showTime?: boolean + hour?: number + minute?: number } const props = withDefaults(defineProps(), { placeholder: 'Select date', + showTime: false, + hour: 0, + minute: 0, }) const emit = defineEmits<{ 'update:modelValue': [value: string] + 'update:hour': [value: number] + 'update:minute': [value: number] }>() const isOpen = ref(false) @@ -30,13 +38,44 @@ const displayText = computed(() => { if (!props.modelValue) return null const [y, m, d] = props.modelValue.split('-').map(Number) const date = new Date(y, m - 1, d) - return date.toLocaleDateString(getLocaleCode(), { + const datePart = date.toLocaleDateString(getLocaleCode(), { month: 'short', day: 'numeric', year: 'numeric', }) + if (props.showTime) { + const hh = String(props.hour).padStart(2, '0') + const mm = String(props.minute).padStart(2, '0') + return `${datePart} ${hh}:${mm}` + } + return datePart }) +// ── Time helpers ────────────────────────────────────────────────────── +const internalHour = ref(props.hour) +const internalMinute = ref(props.minute) + +watch(() => props.hour, (v) => { internalHour.value = v }) +watch(() => props.minute, (v) => { internalMinute.value = v }) + +function onHourInput(e: Event) { + const val = parseInt((e.target as HTMLInputElement).value) + if (!isNaN(val)) { + const clamped = Math.min(23, Math.max(0, val)) + internalHour.value = clamped + emit('update:hour', clamped) + } +} + +function onMinuteInput(e: Event) { + const val = parseInt((e.target as HTMLInputElement).value) + if (!isNaN(val)) { + const clamped = Math.min(59, Math.max(0, val)) + internalMinute.value = clamped + emit('update:minute', clamped) + } +} + const viewMonthLabel = computed(() => { const date = new Date(viewYear.value, viewMonth.value, 1) return date.toLocaleDateString(getLocaleCode(), { month: 'long', year: 'numeric' }) @@ -354,6 +393,28 @@ onBeforeUnmount(() => { + +
+ Time + + : + +
+
- +
@@ -339,7 +339,7 @@ import { useInvoicesStore, type Invoice } from '../stores/invoices' import { useClientsStore } from '../stores/clients' import { useToastStore } from '../stores/toast' import { generateInvoicePdf } from '../utils/invoicePdf' -import { formatDate, formatCurrency } from '../utils/locale' +import { formatDate, formatCurrency, getCurrencySymbol } from '../utils/locale' const invoicesStore = useInvoicesStore() const clientsStore = useClientsStore() diff --git a/src/views/Projects.vue b/src/views/Projects.vue index 1aff996..80d7108 100644 --- a/src/views/Projects.vue +++ b/src/views/Projects.vue @@ -104,13 +104,13 @@
- +
@@ -200,7 +200,7 @@ import AppSelect from '../components/AppSelect.vue' import { useProjectsStore, type Project } from '../stores/projects' import { useClientsStore } from '../stores/clients' import { useSettingsStore } from '../stores/settings' -import { formatCurrency } from '../utils/locale' +import { formatCurrency, getCurrencySymbol } from '../utils/locale' const colorPresets = ['#D97706', '#3B82F6', '#8B5CF6', '#EC4899', '#10B981', '#EF4444', '#06B6D4', '#6B7280'] diff --git a/src/views/Settings.vue b/src/views/Settings.vue index bc9b3ab..d4fa3ba 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -155,7 +155,7 @@ :min="0" :step="1" :precision="2" - prefix="$" + :prefix="getCurrencySymbol()" @update:model-value="saveSettings" /> @@ -241,7 +241,7 @@ import { useSettingsStore } from '../stores/settings' import { useToastStore } from '../stores/toast' import AppNumberInput from '../components/AppNumberInput.vue' import AppSelect from '../components/AppSelect.vue' -import { LOCALES, getCurrencies } from '../utils/locale' +import { LOCALES, getCurrencies, getCurrencySymbol } from '../utils/locale' const settingsStore = useSettingsStore() const toastStore = useToastStore()