Skip to content

Commit

Permalink
Link resources to the resource tab of their corresponding entity view
Browse files Browse the repository at this point in the history
  • Loading branch information
jensschuppe committed Jan 21, 2022
1 parent 5babb5f commit ba9b89c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CRM/Resource/Form/DemandAssignments.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function buildQuickForm()
$display_candidate['id'] = $resource->id;
$display_candidate['field_name'] = "unassign_{$resource->id}";
$display_candidate['meets_demand'] = $this->resource_demand->isFulfilledWithResource($resource);
$display_candidate['paths']['view'] = $candidate->getEntityUrl('view');
$display_resources[] = $display_candidate;
}

Expand Down
1 change: 1 addition & 0 deletions CRM/Resource/Form/ResourceDemandAssign.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function buildQuickForm()
$display_candidate = $candidate->toArray();
$display_candidate['id'] = $candidate->id;
$display_candidate['field_name'] = "assign_{$candidate->id}";
$display_candidate['paths']['view'] = $candidate->getEntityUrl('view');
$display_candidates[] = $display_candidate;
}
$this->assign('candidates', $display_candidates);
Expand Down
6 changes: 5 additions & 1 deletion templates/CRM/Resource/Form/DemandAssignments.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
{foreach from=$resources item=resource}
<tr id="demand-{$resource.id}" class="demand resource-view {if $resource.meets_demand}resource-demand-met{else}resource-demand-not-met{/if}">
{assign var="field_name" value=$resource.field_name}
<td>{$resource.label} [{$resource.id}]</td>
<td>
<a href="{$candidate.paths.view}">
{$resource.label} [{$resource.id}]
</a>
</td>
<td>{$resource.entity_id}</td>
<td>{if $resource.meets_demand}{ts}yes{/ts}{else}{ts}no{/ts}{/if}</td>
<td>{$form.$field_name.html}</td>
Expand Down
6 changes: 5 additions & 1 deletion templates/CRM/Resource/Form/ResourceDemandAssign.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@
{foreach from=$candidates item=candidate}
<tr id="resource-{$candidate.id}" class="resource resource-view">
{assign var="field_name" value=$candidate.field_name}
<td>{$candidate.label} [{$candidate.id}]</td>
<td>
<a href="{$candidate.paths.view}">
{$candidate.label} [{$candidate.id}]
</a>
</td>
<td>{$candidate.entity_id}</td>
<td>{$form.$field_name.html}</td>
</tr>
Expand Down

0 comments on commit ba9b89c

Please sign in to comment.