feat: Update project selection logic in task edit form to set default project ID

This commit is contained in:
2025-05-08 21:52:43 +02:00
parent b8e12f5f3b
commit 74cd615233
2 changed files with 19 additions and 12 deletions

View File

@@ -71,15 +71,22 @@ if ( is_array( $this -> projects ) )
$projects[ $project['id'] ] .= ' (' . \factory\Crm::get_client_name( (int)$project[ 'client_id' ] ) . ')';
}
?>
<?=
\Html::select( [
'label' => 'Projekt',
'name' => 'project_id',
'id' => 'project_id',
'value' => $this -> task[ 'id' ] ? $this -> task[ 'project_id' ] : $this -> project_id,
'values' => $projects
] );
<?
if ( $this -> task['project_id'] )
$project_id = $this -> task[ 'project_id' ];
else
{
if ( !$this -> task['id'] )
$project_id = 72;
}
?>
<?= \Html::select([
'label' => 'Projekt',
'name' => 'project_id',
'id' => 'project_id',
'value' => $project_id,
'values' => $projects
]);?>
<?
$clients[ 0 ] = '--- wybierz klienta ---';
if ( is_array( $this -> clients ) )