Use compact unlabeled filter rows across Super Admin lists.
Also ship pending add-customer name flexibility, store-gated e-payment settings, and logo-only customer login branding. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
29a190f02a
commit
15aad9f9d8
@@ -70,14 +70,20 @@ export function AddCustomerModal({ open, onClose, onCreated }: AddCustomerModalP
|
||||
if (!mounted) return null
|
||||
|
||||
const canSubmit =
|
||||
firstName.trim().length >= 2 &&
|
||||
lastName.trim().length >= 2 &&
|
||||
(firstName.trim().length >= 1 || lastName.trim().length >= 1) &&
|
||||
toE164CellNumber(cellNumber.trim()).length > 0
|
||||
|
||||
async function handleSubmit() {
|
||||
const normalizedCell = toE164CellNumber(cellNumber.trim())
|
||||
if (!canSubmit || !normalizedCell) return
|
||||
|
||||
const trimmedFirst = firstName.trim()
|
||||
const trimmedLast = lastName.trim()
|
||||
if (!trimmedFirst && !trimmedLast) {
|
||||
setError(t('customers.addModal.errorNameRequired'))
|
||||
return
|
||||
}
|
||||
|
||||
const trimmedPassword = password.trim()
|
||||
if (trimmedPassword || passwordConfirm.trim()) {
|
||||
if (trimmedPassword.length < 8) {
|
||||
@@ -105,8 +111,8 @@ export function AddCustomerModal({ open, onClose, onCreated }: AddCustomerModalP
|
||||
try {
|
||||
const created = await createCustomer({
|
||||
cellNumber: normalizedCell,
|
||||
firstName: firstName.trim(),
|
||||
lastName: lastName.trim(),
|
||||
...(trimmedFirst ? { firstName: trimmedFirst } : {}),
|
||||
...(trimmedLast ? { lastName: trimmedLast } : {}),
|
||||
...(trimmedFirstEn ? { firstNameEn: trimmedFirstEn } : {}),
|
||||
...(trimmedLastEn ? { lastNameEn: trimmedLastEn } : {}),
|
||||
...(trimmedPassword ? { password: trimmedPassword } : {}),
|
||||
|
||||
@@ -1162,11 +1162,11 @@ const en = {
|
||||
'customers.addModal.subtitle':
|
||||
'Creates a verified customer account or links an existing user to your business.',
|
||||
'customers.addModal.hint':
|
||||
'Password is required only for new accounts. Existing users are added as verified customers.',
|
||||
'Password is optional. New accounts without a password can still sign in with SMS OTP.',
|
||||
'customers.addModal.pointCreate':
|
||||
'Creates a verified customer account or links an existing user to your business.',
|
||||
'customers.addModal.pointPassword':
|
||||
'Password is required only for new accounts. Existing users are added as verified customers.',
|
||||
'Password is optional. New accounts without a password can still sign in with SMS OTP.',
|
||||
'customers.addModal.firstName': 'First name',
|
||||
'customers.addModal.lastName': 'Last name',
|
||||
'customers.addModal.firstNameFa': 'First name (FA)',
|
||||
@@ -1182,6 +1182,7 @@ const en = {
|
||||
'customers.addModal.cancel': 'Cancel',
|
||||
'customers.addModal.submit': 'Add customer',
|
||||
'customers.addModal.error': 'Unable to add customer.',
|
||||
'customers.addModal.errorNameRequired': 'Enter a first name or last name.',
|
||||
'customers.addModal.errorPasswordMatch': 'Passwords do not match.',
|
||||
'customers.addModal.errorPasswordLength': 'Password must be at least 8 characters.',
|
||||
'customers.addModal.errorNameEnLength': 'English names must be at least 2 characters.',
|
||||
@@ -3631,11 +3632,11 @@ const fa: Record<MessageKey, string> = {
|
||||
'customers.addModal.subtitle':
|
||||
'یک حساب تأییدشده مشتری میسازد یا کاربر موجود را به کسبوکار شما وصل میکند.',
|
||||
'customers.addModal.hint':
|
||||
'رمز عبور فقط برای حسابهای جدید لازم است. کاربران موجود بهعنوان مشتری تأییدشده اضافه میشوند.',
|
||||
'رمز عبور اختیاری است. حسابهای جدید بدون رمز میتوانند با پیامک (OTP) وارد شوند.',
|
||||
'customers.addModal.pointCreate':
|
||||
'یک حساب تأییدشده مشتری میسازد یا کاربر موجود را به کسبوکار شما وصل میکند.',
|
||||
'customers.addModal.pointPassword':
|
||||
'رمز عبور فقط برای حسابهای جدید لازم است. کاربران موجود بهعنوان مشتری تأییدشده اضافه میشوند.',
|
||||
'رمز عبور اختیاری است. حسابهای جدید بدون رمز میتوانند با پیامک (OTP) وارد شوند.',
|
||||
'customers.addModal.firstName': 'نام',
|
||||
'customers.addModal.lastName': 'نام خانوادگی',
|
||||
'customers.addModal.firstNameFa': 'نام (فارسی)',
|
||||
@@ -3651,6 +3652,7 @@ const fa: Record<MessageKey, string> = {
|
||||
'customers.addModal.cancel': 'انصراف',
|
||||
'customers.addModal.submit': 'افزودن مشتری',
|
||||
'customers.addModal.error': 'افزودن مشتری ممکن نشد.',
|
||||
'customers.addModal.errorNameRequired': 'نام یا نام خانوادگی را وارد کنید.',
|
||||
'customers.addModal.errorPasswordMatch': 'رمزهای عبور یکسان نیستند.',
|
||||
'customers.addModal.errorPasswordLength': 'رمز عبور باید حداقل ۸ کاراکتر باشد.',
|
||||
'customers.addModal.errorNameEnLength': 'نام انگلیسی باید حداقل ۲ کاراکتر باشد.',
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'
|
||||
import { RefreshCw } from 'lucide-react'
|
||||
import { Breadcrumbs } from '../components/Breadcrumbs'
|
||||
import { PageTitle } from '../components/PageTitle'
|
||||
import { useTenantBranding } from '../context/TenantBrandingContext'
|
||||
import { useToast } from '../context/ToastContext'
|
||||
import { useT } from '../i18n/useT'
|
||||
import { ApiError } from '../lib/api'
|
||||
@@ -42,6 +43,8 @@ function resolveSitemapUrl(config: WebsiteSitemapConfig | null): string {
|
||||
export function WebsiteSettingsPage() {
|
||||
const t = useT()
|
||||
const { showToast } = useToast()
|
||||
const { enabledModules } = useTenantBranding()
|
||||
const storeModuleEnabled = hasBusinessModule(enabledModules, 'store')
|
||||
const [source, setSource] = useState<SpecialProductsSource>('product')
|
||||
const [sitemapConfig, setSitemapConfig] = useState<WebsiteSitemapConfig | null>(null)
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
@@ -219,9 +222,11 @@ export function WebsiteSettingsPage() {
|
||||
)}
|
||||
</section>
|
||||
|
||||
<div className={`${styles.ePaymentBlock} ${settingsStyles.stack}`}>
|
||||
<EPaymentSettingsSection />
|
||||
</div>
|
||||
{storeModuleEnabled ? (
|
||||
<div className={`${styles.ePaymentBlock} ${settingsStyles.stack}`}>
|
||||
<EPaymentSettingsSection />
|
||||
</div>
|
||||
) : null}
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ export interface UpdateCustomerPayload {
|
||||
|
||||
export interface CreateCustomerPayload {
|
||||
cellNumber: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
firstName?: string
|
||||
lastName?: string
|
||||
firstNameEn?: string
|
||||
lastNameEn?: string
|
||||
password?: string
|
||||
|
||||
Reference in New Issue
Block a user