Add thousand separators to all CRM price and amount inputs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-05 02:13:39 +03:30
co-authored by Cursor
parent 36e47e8af3
commit 20a9ac0d34
9 changed files with 239 additions and 25 deletions
+3 -4
View File
@@ -3,6 +3,7 @@ import { computed, onMounted, ref } from 'vue';
import axios from 'axios';
import { api } from '@/lib/api';
import { CURRENCY_OPTIONS, formatMoney } from '@/lib/money';
import MoneyInput from '@/components/MoneyInput.vue';
import type { OrganizationDto, UpdateOrgCurrenciesRequest } from '@mento/shared';
const loading = ref(false);
@@ -152,11 +153,9 @@ onMounted(load);
<h2>نرخ به {{ baseCurrency }}</h2>
<div v-for="code in rateCurrencies" :key="code" class="rate-row">
<span>۱ {{ code }} =</span>
<input
<MoneyInput
v-model="rates[code]"
type="number"
min="0.000001"
step="any"
:decimals="6"
:placeholder="`نرخ به ${baseCurrency}`"
/>
<span>{{ baseCurrency }}</span>
+4 -5
View File
@@ -9,6 +9,7 @@ import { currencySuffix, formatMoney } from '@/lib/money';
import CustomFieldsSection from '@/components/CustomFieldsSection.vue';
import EntityTimeline from '@/components/EntityTimeline.vue';
import JalaliDateInput from '@/components/JalaliDateInput.vue';
import MoneyInput from '@/components/MoneyInput.vue';
import UiIcon from '@/components/UiIcon.vue';
import UserAvatar from '@/components/UserAvatar.vue';
import type {
@@ -531,12 +532,10 @@ onMounted(load);
<div class="field">
<label for="amount">پیش‌بینی مبلغ فروش به مشتری</label>
<div class="amount">
<input
<MoneyInput
id="amount"
v-model="amount"
type="number"
min="0"
step="1"
:decimals="0"
:readonly="lines.length > 0"
:placeholder="lines.length ? 'جمع ردیف‌ها' : 'مبلغ را وارد کنید'"
/>
@@ -708,7 +707,7 @@ onMounted(load);
</select>
<input v-model="line.name" placeholder="نام ردیف" />
<input v-model="line.quantity" type="number" min="0.01" step="0.01" placeholder="تعداد" />
<input v-model="line.unitPrice" type="number" min="0" step="1" placeholder="قیمت واحد" />
<MoneyInput v-model="line.unitPrice" :decimals="0" placeholder="قیمت واحد" />
<button class="linkish danger" type="button" @click="removeLine(line.key)">حذف</button>
</div>
<p v-if="!lines.length" class="muted">
+7 -9
View File
@@ -6,6 +6,7 @@ import { api } from '@/lib/api';
import { formatMoney as formatMoneyLib } from '@/lib/money';
import { formatLocalDateInput } from '@/lib/jalali';
import JalaliDateInput from '@/components/JalaliDateInput.vue';
import MoneyInput from '@/components/MoneyInput.vue';
import type {
CompanyDto,
CreateInvoiceRequest,
@@ -476,11 +477,9 @@ onMounted(load);
step="0.01"
placeholder="تعداد"
/>
<input
<MoneyInput
v-model="line.unitPrice"
type="number"
min="0"
step="1"
:decimals="0"
placeholder="قیمت واحد"
/>
<button
@@ -515,12 +514,11 @@ onMounted(load);
class="installment-row"
>
<JalaliDateInput v-model="item.dueDate" />
<input
<MoneyInput
v-model="item.amount"
type="number"
min="0.01"
step="1"
:decimals="0"
placeholder="مبلغ قسط"
required
/>
<button
class="btn btn-ghost no-print"
@@ -553,7 +551,7 @@ onMounted(load);
<section v-if="!isNew && invoice && !loading" class="pay-block no-print">
<h3>ثبت پرداخت</h3>
<div class="pay-form">
<input v-model="payAmount" type="number" min="0.01" placeholder="مبلغ" />
<MoneyInput v-model="payAmount" :decimals="0" placeholder="مبلغ" />
<select v-model="payMethod">
<option
v-for="(label, key) in methodLabel"
+2 -1
View File
@@ -3,6 +3,7 @@ import { onMounted, ref } from 'vue';
import axios from 'axios';
import { api } from '@/lib/api';
import { formatMoney } from '@/lib/money';
import MoneyInput from '@/components/MoneyInput.vue';
import type {
CreateProductRequest,
OrganizationDto,
@@ -122,7 +123,7 @@ onMounted(load);
</div>
<div class="field">
<label for="p-price">قیمت واحد</label>
<input id="p-price" v-model="unitPrice" type="number" min="0" step="1" />
<MoneyInput id="p-price" v-model="unitPrice" :decimals="0" />
</div>
<div class="field">
<label for="p-currency">ارز</label>
+2 -1
View File
@@ -5,6 +5,7 @@ import axios from 'axios';
import { api } from '@/lib/api';
import { formatMoney as formatMoneyLib } from '@/lib/money';
import JalaliDateInput from '@/components/JalaliDateInput.vue';
import MoneyInput from '@/components/MoneyInput.vue';
import type {
CompanyDto,
CreateQuoteRequest,
@@ -307,7 +308,7 @@ onMounted(load);
</select>
<input v-model="line.name" placeholder="نام ردیف" required />
<input v-model="line.quantity" type="number" min="0.01" step="0.01" placeholder="تعداد" />
<input v-model="line.unitPrice" type="number" min="0" step="1" placeholder="قیمت واحد" />
<MoneyInput v-model="line.unitPrice" :decimals="0" placeholder="قیمت واحد" />
<button class="btn btn-ghost no-print" type="button" @click="removeLine(line.key)">حذف</button>
</div>
<p class="total"><strong>جمع:</strong> {{ formatMoney(totalAmount) }}</p>
+2 -1
View File
@@ -8,6 +8,7 @@ import { canReassignRecords, canViewAllRecords } from '@/lib/roles';
import { formatMoney as formatMoneyLib } from '@/lib/money';
import { formatLocalDateInput } from '@/lib/jalali';
import JalaliDateInput from '@/components/JalaliDateInput.vue';
import MoneyInput from '@/components/MoneyInput.vue';
import type {
CreateSalesGoalRequest,
OrgUserDto,
@@ -209,7 +210,7 @@ onMounted(() => {
</div>
<div class="field">
<label>مبلغ هدف (ریال)</label>
<input v-model="targetAmount" type="number" min="0" step="1" required />
<MoneyInput v-model="targetAmount" :decimals="0" required />
</div>
<div v-if="canManageTeamGoals" class="field">
<label>برای</label>