Compare commits

..

No commits in common. "025eaf42338ce1cc53d8ed22c05535a86bfe74e7" and "4d81f6875aa80238e652384a568b71dddca9e519" have entirely different histories.

2 changed files with 16 additions and 16 deletions

View File

@ -174,7 +174,7 @@ export default function ContractEditor({ onSaved, editingTemplateId, onCancelEdi
type,
contract_type: type === 'contract' ? contractType : null,
lang,
user_type: userType,
user_type: type === 'invoice' ? 'both' : userType,
descriptionLength: description ? description.length : 0,
htmlLength: html.length,
});
@ -303,6 +303,7 @@ 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"
@ -323,16 +324,18 @@ export default function ContractEditor({ onSaved, editingTemplateId, onCancelEdi
<option value="abo">ABO</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>
{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={lang}
onChange={(e) => setLang(e.target.value as 'en' | 'de')}

View File

@ -310,7 +310,7 @@ function buildTrack(templates: ContractTemplate[]): TemplateTrack {
if (family === 'invoice') {
title = names.length === 1 ? names[0] : 'Invoice Templates';
subtitle = `${formatUserType(lead?.user_type)}${sortedTemplates.length} version${sortedTemplates.length === 1 ? '' : 's'}`;
subtitle = 'All customers';
}
return {
@ -731,9 +731,6 @@ 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>
)}
@ -962,7 +959,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 can target Personal, Company, or Both. Keep one active version per language and user type so the invoice flow stays predictable.
Invoice templates always use user type &quot;Both&quot;. Keep one active version per language so the invoice flow stays predictable.
</div>
)}