refactor: simplify role checks for wartosc_zlecenia display in ProjectViewPage and ProjectForm

This commit is contained in:
2025-11-14 09:41:06 +01:00
parent be1bab103f
commit 6b205f36bb
2 changed files with 29 additions and 35 deletions

View File

@@ -421,9 +421,7 @@ export default function ProjectViewPage() {
{project.investment_number || "N/A"}
</p>
</div>
{(() => {
console.log('Session user role in project view:', session?.user?.role, 'wartosc_zlecenia:', project.wartosc_zlecenia);
return session?.user?.role === 'team_lead' && project.wartosc_zlecenia && (
{session?.user?.role === 'team_lead' && project.wartosc_zlecenia && (
<FieldWithHistory
tableName="projects"
recordId={project.project_id}
@@ -435,8 +433,7 @@ export default function ProjectViewPage() {
})}
label="Wartość zlecenia"
/>
);
})()}
)}
</div>
{project.contact && (

View File

@@ -330,9 +330,7 @@ const ProjectForm = forwardRef(function ProjectForm({ initialData = null }, ref)
/>
</div>
{(() => {
console.log('Session user role in ProjectForm:', session?.user?.role);
return session?.user?.role === 'team_lead' && (
{session?.user?.role === 'team_lead' && (
<div>
<label className="block text-sm font-medium text-gray-700 mb-2">
Wartość zlecenia
@@ -347,8 +345,7 @@ const ProjectForm = forwardRef(function ProjectForm({ initialData = null }, ref)
min="0"
/>
</div>
);
})()}
)}
<div className="md:col-span-2">
<label className="block text-sm font-medium text-gray-700 mb-2">