fix(lead-forms): multiline options, editable title, color palette, builder validation and unique new form names
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -35,20 +35,26 @@ async function load() {
|
||||
}
|
||||
}
|
||||
|
||||
function nextFormName() {
|
||||
const taken = new Set(forms.value.map((f) => f.name.trim()));
|
||||
let n = forms.value.length + 1;
|
||||
while (taken.has(`فرم جدید ${toFaDigits(n)}`)) n += 1;
|
||||
return `فرم جدید ${toFaDigits(n)}`;
|
||||
}
|
||||
|
||||
async function createForm() {
|
||||
saving.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
const { data } = await api.post<LeadFormDto>('/lead-forms', {
|
||||
name: 'درخواست مشاوره',
|
||||
description: 'فرم دریافت درخواست مشاوره مشتریان',
|
||||
name: nextFormName(),
|
||||
source: 'وبسایت',
|
||||
createLead: true,
|
||||
createPerson: false,
|
||||
createDeal: false,
|
||||
duplicateMode: 'update',
|
||||
});
|
||||
await router.push({ name: 'lead-form-builder', params: { id: data.id } });
|
||||
await router.push({ name: 'lead-form-builder', params: { id: data.id }, query: { new: '1' } });
|
||||
} catch {
|
||||
error.value = 'ساخت فرم ناموفق بود.';
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user