diff --git a/src/app/admin/contract-management/components/contractEditor.tsx b/src/app/admin/contract-management/components/contractEditor.tsx index fd29bc6..f8c739e 100644 --- a/src/app/admin/contract-management/components/contractEditor.tsx +++ b/src/app/admin/contract-management/components/contractEditor.tsx @@ -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 ABO )} - {type !== 'invoice' && ( - 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" - > - Personal - Company - Both - - )} + 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" + > + Personal + Company + Both + setLang(e.target.value as 'en' | 'de')} diff --git a/src/app/admin/contract-management/components/contractTemplateList.tsx b/src/app/admin/contract-management/components/contractTemplateList.tsx index b726f64..3237e40 100644 --- a/src/app/admin/contract-management/components/contractTemplateList.tsx +++ b/src/app/admin/contract-management/components/contractTemplateList.tsx @@ -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' && ( {formatUserType(track.templates[0]?.user_type)} )} + {track.family === 'invoice' && track.templates[0]?.user_type && ( + {formatUserType(track.templates[0].user_type)} + )} {track.family === 'other' && track.templates[0]?.user_type && ( {formatUserType(track.templates[0].user_type)} )} @@ -959,7 +962,7 @@ export default function ContractTemplateList({ refreshKey = 0, onEdit }: Props) {activeFamily.key === 'invoice' && ( - 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. )}