Added start of hints for form controls.
Build and Deploy Web App / build-and-deploy (push) Successful in 19s Details

This commit is contained in:
andrewlalis 2025-09-24 21:09:51 -04:00
parent 44ead22c4f
commit 9763fd7abe
2 changed files with 24 additions and 70 deletions

View File

@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
defineProps<{ defineProps<{
label: string label: string
hint?: string
}>() }>()
</script> </script>
<template> <template>
@ -9,6 +10,9 @@ defineProps<{
{{ label }} {{ label }}
<slot></slot> <slot></slot>
</label> </label>
<p v-if="hint" style="margin-top: 0.1rem; margin-bottom: 0;" class="font-size-small text-muted">
{{ hint }}
</p>
</div> </div>
</template> </template>
<style lang="css"> <style lang="css">
@ -17,7 +21,7 @@ defineProps<{
margin: 0.5rem; margin: 0.5rem;
} }
.app-form-control > label { .app-form-control>label {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
font-size: 0.9rem; font-size: 0.9rem;
@ -26,19 +30,19 @@ defineProps<{
/* Styles for different form controls under here: */ /* Styles for different form controls under here: */
.app-form-control > label input { .app-form-control>label input {
font-size: 16px; font-size: 16px;
font-family: 'OpenSans', sans-serif; font-family: 'OpenSans', sans-serif;
padding: 0.25rem 0.5rem; padding: 0.25rem 0.5rem;
} }
.app-form-control > label textarea { .app-form-control>label textarea {
font-size: 16px; font-size: 16px;
font-family: 'OpenSans', sans-serif; font-family: 'OpenSans', sans-serif;
padding: 0.25rem 0.5rem; padding: 0.25rem 0.5rem;
} }
.app-form-control > label select { .app-form-control>label select {
font-size: 16px; font-size: 16px;
font-family: 'OpenSans', sans-serif; font-family: 'OpenSans', sans-serif;
padding: 0.25rem 0.5rem; padding: 0.25rem 0.5rem;

View File

@ -281,46 +281,20 @@ function getLocalDateTimeStringFromUTCTimestamp(timestamp: string) {
<FormGroup> <FormGroup>
<!-- Basic properties --> <!-- Basic properties -->
<FormControl label="Timestamp"> <FormControl label="Timestamp">
<input <input type="datetime-local" v-model="timestamp" step="1" :disabled="loading" style="min-width: 250px" />
type="datetime-local"
v-model="timestamp"
step="1"
:disabled="loading"
style="min-width: 250px"
/>
</FormControl> </FormControl>
<FormControl label="Amount"> <FormControl label="Amount">
<input <input type="number" v-model="amount" step="0.01" min="0.01" :disabled="loading" style="max-width: 100px" />
type="number"
v-model="amount"
step="0.01"
min="0.01"
:disabled="loading"
style="max-width: 100px"
/>
</FormControl> </FormControl>
<FormControl label="Currency"> <FormControl label="Currency">
<select <select v-model="currency" :disabled="loading || availableCurrencies.length === 1">
v-model="currency" <option v-for="currency in availableCurrencies" :key="currency.code" :value="currency">
:disabled="loading || availableCurrencies.length === 1"
>
<option
v-for="currency in availableCurrencies"
:key="currency.code"
:value="currency"
>
{{ currency.code }} {{ currency.code }}
</option> </option>
</select> </select>
</FormControl> </FormControl>
<FormControl <FormControl label="Description" style="min-width: 200px">
label="Description" <textarea v-model="description" :disabled="loading"></textarea>
style="min-width: 200px"
>
<textarea
v-model="description"
:disabled="loading"
></textarea>
</FormControl> </FormControl>
</FormGroup> </FormGroup>
@ -337,30 +311,16 @@ function getLocalDateTimeStringFromUTCTimestamp(timestamp: string) {
<FormGroup> <FormGroup>
<!-- Accounts --> <!-- Accounts -->
<FormControl label="Credited Account"> <FormControl label="Credited Account">
<select <select v-model="creditedAccountId" :disabled="loading">
v-model="creditedAccountId" <option v-for="account in availableAccounts" :key="account.id" :value="account.id">
:disabled="loading"
>
<option
v-for="account in availableAccounts"
:key="account.id"
:value="account.id"
>
{{ account.name }} ({{ account.numberSuffix }}) {{ account.name }} ({{ account.numberSuffix }})
</option> </option>
<option :value="null">None</option> <option :value="null">None</option>
</select> </select>
</FormControl> </FormControl>
<FormControl label="Debited Account"> <FormControl label="Debited Account">
<select <select v-model="debitedAccountId" :disabled="loading">
v-model="debitedAccountId" <option v-for="account in availableAccounts" :key="account.id" :value="account.id">
:disabled="loading"
>
<option
v-for="account in availableAccounts"
:key="account.id"
:value="account.id"
>
{{ account.name }} ({{ account.numberSuffix }}) {{ account.name }} ({{ account.numberSuffix }})
</option> </option>
<option :value="null">None</option> <option :value="null">None</option>
@ -368,12 +328,8 @@ function getLocalDateTimeStringFromUTCTimestamp(timestamp: string) {
</FormControl> </FormControl>
</FormGroup> </FormGroup>
<LineItemsEditor <LineItemsEditor v-if="currency" v-model="lineItems" :currency="currency"
v-if="currency" :transaction-amount="floatMoneyToInteger(amount, currency)" />
v-model="lineItems"
:currency="currency"
:transaction-amount="floatMoneyToInteger(amount, currency)"
/>
<FormGroup> <FormGroup>
<!-- Tags --> <!-- Tags -->
@ -384,18 +340,12 @@ function getLocalDateTimeStringFromUTCTimestamp(timestamp: string) {
<FormGroup> <FormGroup>
<h5>Attachments</h5> <h5>Attachments</h5>
<FileSelector <FileSelector :initial-files="existingTransaction?.attachments ?? []"
:initial-files="existingTransaction?.attachments ?? []" v-model:uploaded-files="attachmentsToUpload" v-model:removed-files="removedAttachmentIds" />
v-model:uploaded-files="attachmentsToUpload"
v-model:removed-files="removedAttachmentIds"
/>
</FormGroup> </FormGroup>
<FormActions <FormActions @cancel="doCancel()" :disabled="loading || !formValid || !unsavedEdits"
@cancel="doCancel()" :submit-text="editing ? 'Save' : 'Add'" />
:disabled="loading || !formValid || !unsavedEdits"
:submit-text="editing ? 'Save' : 'Add'"
/>
</AppForm> </AppForm>
</AppPage> </AppPage>
</template> </template>