Skip to content

Commit

Permalink
BK2024 Only show nominations if set
Browse files Browse the repository at this point in the history
  • Loading branch information
agileware-justin committed Sep 14, 2024
1 parent 4b4f7ee commit ec55a13
Showing 1 changed file with 56 additions and 46 deletions.
102 changes: 56 additions & 46 deletions templates/CRM/Elections/Page/ViewElectionBlocks/nominations.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,61 +23,71 @@
<p>There are no existing nominations</p>
{/if}
{assign var="candidatesCount" value=0}
<div class="election_row_style">
{foreach from = $nomination.nominations key = sk item = seconder}
{if !empty($nomination.nominations)}
<div class="election_row_style">
{foreach from = $nomination.nominations key = sk item = seconder}

{if (!$election->advertiseCandidatesStarted and $election->isNominationsInProgress and $seconder.has_rejected_nomination == 0) or (!$election->advertiseCandidatesStarted and !$election->isNominationsInProgress and $seconder.seconders|@count >= 2) or ($election->advertiseCandidatesStarted and !$election->isVotingStarted and $seconder.is_eligible_candidate == 1 and $seconder.has_rejected_nomination == 0) or ($election->isVotingStarted and $seconder.has_accepted_nomination == 1)}
{assign var='scKey' value='member_nominee.display_name'}
{assign var='scImgKey' value='member_nominee.image_URL'}

<div class="crm-election-nominated-block">
{if $election->isNominationsStarted}
{if (!$election->advertiseCandidatesStarted and $election->isNominationsInProgress and $seconder.has_rejected_nomination == 0) or (!$election->advertiseCandidatesStarted and !$election->isNominationsInProgress and $seconder.seconders|@count >= 2) or ($election->advertiseCandidatesStarted and !$election->isVotingStarted and $seconder.is_eligible_candidate == 1 and $seconder.has_rejected_nomination == 0) or ($election->isVotingStarted and $seconder.has_accepted_nomination == 1)}
{assign var='scKey' value='member_nominee.display_name'}
{assign var='scImgKey' value='member_nominee.image_URL'}
<div class="crm-election-nominated-block">
{if $election->isNominationsStarted}
<a href="{crmURL p="civicrm/elections/candidate" q="enid=`$seconder.id`"}">
{/if}
{/if}

{assign var="candidatesCount" value=$candidatesCount+1}
<div class="crm-election-nominated-block inside">
{assign var='profilePicUrl' value=$seconder.$scImgKey}
<img src="{$profilePicUrl}" /><br><br>
{$seconder.$scKey}<br>
{assign var="candidatesCount" value=$candidatesCount+1}
<div class="crm-election-nominated-block inside">
{assign var='profilePicUrl' value=$seconder.$scImgKey}
<img src="{$profilePicUrl}"/><br><br>
{$seconder.$scKey}<br>

{if !$election->isVotingStarted and ($seconder.is_eligible_candidate == 1)}
Candidate Status:
{if $seconder.has_accepted_nomination == 1}
Accepted<br><br>
{$seconder.comments|nl2br}
{elseif $seconder.has_rejected_nomination == 1}
Withdrawn<br><br>
{$seconder.rejection_comments|nl2br}
{else}
Pending
{if !$election->isVotingStarted and ($seconder.is_eligible_candidate == 1)}
Candidate Status:
{if $seconder.has_accepted_nomination == 1}
Accepted
<br>
<br>
{$seconder.comments|nl2br}
{elseif $seconder.has_rejected_nomination == 1}
Withdrawn
<br>
<br>
{$seconder.rejection_comments|nl2br}
{else}
Pending
{/if}
{/if}
{/if}

</div>
{if $election->isNominationsStarted}
</div>
{if $election->isNominationsStarted}
</a>
{/if}
{if $election->isNominationsInProgress and $election->required_nominations >= 2 and $seconder.seconders|@count < 2 and $seconder.is_eligible_candidate != 1}
<div class="clearfix"></div>
<input type="button" value="{ts}Need Second{/ts}" onclick="window.location.href='{crmURL p="civicrm/elections/nominations/create" q="eid=`$election->id`&enid=`$seconder.id`"}'" class="election-action-button" />
{/if}
{if $election->isNominationsInProgress and $seconder.has_rejected_nomination == 0 and $seconder.has_accepted_nomination == 0 and ($seconder.seconders|@count >= 2 or $seconder.is_eligible_candidate == 1) }
<div class="clearfix"></div>
<input type="button" value="{ts}Nominate{/ts}" onclick="window.location.href='{crmURL p="civicrm/elections/nominations/create" q="eid=`$election->id`&enid=`$seconder.id`"}'" class="election-action-button" />
{/if}
{/if}
{if $election->isNominationsInProgress and $election->required_nominations >= 2 and $seconder.seconders|@count < 2 and $seconder.is_eligible_candidate != 1}
<div class="clearfix"></div>
<input type="button" value="{ts}Need Second{/ts}"
onclick="window.location.href='{crmURL p="civicrm/elections/nominations/create" q="eid=`$election->id`&enid=`$seconder.id`"}'"
class="election-action-button"/>
{/if}
{if $election->isNominationsInProgress and $seconder.has_rejected_nomination == 0 and $seconder.has_accepted_nomination == 0 and ($seconder.seconders|@count >= 2 or $seconder.is_eligible_candidate == 1) }
<div class="clearfix"></div>
<input type="button" value="{ts}Nominate{/ts}"
onclick="window.location.href='{crmURL p="civicrm/elections/nominations/create" q="eid=`$election->id`&enid=`$seconder.id`"}'"
class="election-action-button"/>
{/if}

</div>
{/if}
</div>
{/if}

{/foreach}
</div>
{if empty($candidatesCount) or (empty($nomination.nominations) and !$election->advertiseCandidatesStarted) or ($election->advertiseCandidatesStarted and empty($candidatesCount))}
{if $election->advertiseCandidatesStarted}
<p>There are no eligible candidates.</p>
{else}
<p>There are no eligible nominations.</p>
{/foreach}
</div>
{if empty($candidatesCount) or (empty($nomination.nominations) and !$election->advertiseCandidatesStarted) or ($election->advertiseCandidatesStarted and empty($candidatesCount))}
{if $election->advertiseCandidatesStarted}
<p>There are no eligible candidates.</p>
{else}
<p>There are no eligible nominations.</p>
{/if}
{/if}
{/if}
</div><div class="clearfix"></div>
</div>
<div class="clearfix"></div>
{/foreach}

0 comments on commit ec55a13

Please sign in to comment.