dei voda
This commit is contained in:
parent
a1049623c8
commit
f91493ac82
@ -174,7 +174,7 @@ export default function ContractEditor({ onSaved, editingTemplateId, onCancelEdi
|
||||
type,
|
||||
contract_type: type === 'contract' ? contractType : null,
|
||||
lang,
|
||||
user_type: type === 'invoice' ? 'both' : userType,
|
||||
user_type: userType,
|
||||
descriptionLength: description ? description.length : 0,
|
||||
htmlLength: html.length,
|
||||
});
|
||||
@ -303,7 +303,6 @@ export default function ContractEditor({ onSaved, editingTemplateId, onCancelEdi
|
||||
onChange={(e) => {
|
||||
const newType = e.target.value as 'contract' | 'invoice' | 'other';
|
||||
setType(newType);
|
||||
if (newType === 'invoice') setUserType('both');
|
||||
}}
|
||||
required
|
||||
className="w-full sm:w-1/3 rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 outline-none focus:ring-2 focus:ring-indigo-500/50 shadow"
|
||||
@ -324,18 +323,16 @@ export default function ContractEditor({ onSaved, editingTemplateId, onCancelEdi
|
||||
<option value="abo">ABO</option>
|
||||
</select>
|
||||
)}
|
||||
{type !== 'invoice' && (
|
||||
<select
|
||||
value={userType}
|
||||
onChange={(e) => setUserType(e.target.value as 'personal' | 'company' | 'both')}
|
||||
required
|
||||
className="w-full sm:w-40 rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 outline-none focus:ring-2 focus:ring-indigo-500/50 shadow"
|
||||
>
|
||||
<option value="personal">Personal</option>
|
||||
<option value="company">Company</option>
|
||||
<option value="both">Both</option>
|
||||
</select>
|
||||
)}
|
||||
<select
|
||||
value={userType}
|
||||
onChange={(e) => setUserType(e.target.value as 'personal' | 'company' | 'both')}
|
||||
required
|
||||
className="w-full sm:w-40 rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm text-gray-900 outline-none focus:ring-2 focus:ring-indigo-500/50 shadow"
|
||||
>
|
||||
<option value="personal">Personal</option>
|
||||
<option value="company">Company</option>
|
||||
<option value="both">Both</option>
|
||||
</select>
|
||||
<select
|
||||
value={lang}
|
||||
onChange={(e) => setLang(e.target.value as 'en' | 'de')}
|
||||
|
||||
@ -310,7 +310,7 @@ function buildTrack(templates: ContractTemplate[]): TemplateTrack {
|
||||
|
||||
if (family === 'invoice') {
|
||||
title = names.length === 1 ? names[0] : 'Invoice Templates';
|
||||
subtitle = 'All customers';
|
||||
subtitle = `${formatUserType(lead?.user_type)} • ${sortedTemplates.length} version${sortedTemplates.length === 1 ? '' : 's'}`;
|
||||
}
|
||||
|
||||
return {
|
||||
@ -731,6 +731,9 @@ export default function ContractTemplateList({ refreshKey = 0, onEdit }: Props)
|
||||
{track.family === 'contract' && (
|
||||
<Pill className="border-slate-200 bg-white/90 text-slate-700">{formatUserType(track.templates[0]?.user_type)}</Pill>
|
||||
)}
|
||||
{track.family === 'invoice' && track.templates[0]?.user_type && (
|
||||
<Pill className="border-sky-200 bg-white/90 text-sky-800">{formatUserType(track.templates[0].user_type)}</Pill>
|
||||
)}
|
||||
{track.family === 'other' && track.templates[0]?.user_type && (
|
||||
<Pill className="border-slate-200 bg-slate-100 text-slate-700">{formatUserType(track.templates[0].user_type)}</Pill>
|
||||
)}
|
||||
@ -959,7 +962,7 @@ export default function ContractTemplateList({ refreshKey = 0, onEdit }: Props)
|
||||
|
||||
{activeFamily.key === 'invoice' && (
|
||||
<div className="mt-4 rounded-2xl border border-sky-200 bg-sky-50 px-4 py-3 text-sm text-sky-900">
|
||||
Invoice templates always use user type "Both". Keep one active version per language so the invoice flow stays predictable.
|
||||
Invoice templates can target Personal, Company, or Both. Keep one active version per language and user type so the invoice flow stays predictable.
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user