Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% javascript %}
- $(function(){
- $('#registrations-table tr[data-href]').each(function(){
- $(this).css('cursor','pointer').hover(
- function(){
- $(this).addClass('active');
- },
- function(){
- $(this).removeClass('active');
- }).click( function(){
- document.location = $(this).attr('data-href');
- }
- );
- });
- });
- {% endjavascript %}
- {% assign allRegistrationsItems = '' %}
- {% for alias in Context.Person.Aliases %}
- {% registration where:'PersonAliasId == "{{alias.Id}}"' %}
- {% for registration in registrationItems %}
- {% assign allRegistrationsItems = allRegistrationsItems | AddToArray:registration %}
- {% endfor %}
- {% endregistration %}
- {% registrationregistrant where:'PersonAliasId == "{{alias.Id}}"' %}
- {% for registrationregistrant in registrationregistrantItems %}
- {% assign allRegistrationsItems = allRegistrationsItems | AddToArray:registrationregistrant.Registration %}
- {% endfor %}
- {% endregistrationregistrant %}
- {% endfor %}
- {% assign allRegistrationsItems = allRegistrationsItems | OrderBy:'CreatedDateTime desc' %}
- {% assign rows = allRegistrationsItems | Distinct:'RegistrationInstance.Id' %}
- //- Get All RegistrationInstance the current person has access to. A user may have access to view a registration object or a registrationregistrant even when they do not have access to view the registration instance they are tied to
- //- All registrationinstance will have an id greater than -1, this is a little hack to grab all registrations instances the current user has access to
- {% registrationinstance where:'Id > -1' %}
- {%- assign pageSize = 25 -%}
- {%- assign pageNum = 'Global' | PageParameter:'p' | Default:'' -%}
- {%- assign query = 'Global' | Page:'QueryString' -%}
- {%- assign url = 'Global' | Page:'Url' -%}
- {%- assign rootURL = url | Url:'localpath' -%}
- {%- assign firstLoop = true -%}
- {%- for queryParam in query -%}
- {%- assign kvParam = queryParam | PropertyToKeyValue -%}
- {%- if kvParam.Key != 'p' and kvParam.Key != 'PageId' -%}
- {%- if firstLoop == true -%}
- {%- capture rootURL %}{{ rootURL }}?{{ kvParam.Key }}={{ kvParam.Value }}{% endcapture -%}
- {%- assign firstLoop = false -%}
- {%- else -%}
- {%- capture rootURL %}{{ rootURL }}&{{ kvParam.Key }}={{ kvParam.Value }}{% endcapture -%}
- {%- endif -%}
- {%- endif -%}
- {%- endfor -%}
- {%- if pageNum == '1' -%}
- {%- comment %} redirect if the page query value is 1 {% endcomment -%}
- {{ rootURL | PageRedirect }}
- {%- endif -%}
- {%- if pageNum == '' %}{% assign pageNum = '1' %}{% endif -%}
- {%- assign pageNum = pageNum | AsInteger -%}
- {%- assign itemCount = rows | Size -%}
- {%- assign pageCount = itemCount | DividedBy:pageSize | Ceiling -%}
- {%- assign skipCount = pageNum | Minus:1 | Times:pageSize -%}
- {%- assign roleID = 'Global' | PageParameter:'GroupId' | Default:'0' -%}
- <div class="panel panel-block">
- <div class="panel-body">
- <div class="grid grid-panel">
- <div class="table-responsive">
- <table id="registrations-table" class="grid-table table js-sticky-headers sticky-headers table-bordered table-striped table-hover">
- <thead>
- <tr align="left">
- {%- assign columnCount = 6 -%}
- <th data-priority="1" scope="col">Template</th>
- <th data-priority="1" scope="col">Instance</th>
- <th data-priority="1" scope="col">Date</th>
- <th data-priority="1" scope="col">Registrants</th>
- <th data-priority="1" scope="col">Registrar</th>
- <th data-priority="1" scope="col">Registrant</th>
- <th data-priority="1" scope="col">Registration Payment Link</th>
- </tr>
- </thead>
- <tbody>
- {%- assign firstRow = rows | First -%}
- //- Due to the way I constructed this array there is always at least one row but it might be empty
- {%- if firstRow != '' -%}
- {%- for row in rows limit:pageSize offset:skipCount -%}
- {% assign viewregistrationinstance = registrationinstanceItems | Where:'Id', row.RegistrationInstance.Id | Select:'Id' %}
- {% assign showRegistration = false %}
- {% if viewregistrationinstance > 0 %} {% assign showRegistration = true %}{% endif %}
- <tr align="left" title="" class="" data-key="" data-href="{% if showRegistration %}~/page/405?RegistrationId={{row.Id}}&RegistrationInstanceId={{row.RegistrationInstance.Id}}{% endif %}">
- <td data-priority="1">{% if showRegistration %}{{ row.RegistrationInstance.RegistrationTemplate }}{% else %}Restricted View Access{% endif %}</td>
- <td data-priority="1">{% if showRegistration %}{{ row.RegistrationInstance }}{% else %}{% endif %}</td>
- <td data-priority="1">{{ row.CreatedDateTime | Date:'M/d/yyyy' }}</td>
- <td data-priority="1">{{ row.Registrants | Size }}</td>
- <td data-priority="1">{{ row.PersonAlias.Person }}</td>
- <td data-priority="1">{{ row.Registrants | Join:', ' }}</td>
- <td data-priority="1"><a href="{{ 'Global' | Attribute:'PublicApplicationRoot' }}Registration?RegistrationId={{row.Id}}">Payment Link</a></td>
- </tr>
- {%- endfor -%}
- {%- endif -%}
- </tbody>
- <tfoot>
- {%- if pageCount > 1 -%}
- <tr>
- <td class="grid-paging" colspan="{{ columnCount }}">
- <span class="grid-itemcount">{{ itemCount | Format:'#,##0' }} {{ 'Item' | PluralizeForQuantity:itemCount }}</span>
- {[ pager current:'{{ pageNum }}' total:'{{ pageCount }}' rooturl:'{{ rootURL }}' buttoncount:'10' size:'small' class:'grid-pager' usequery:'true' ]}
- </td>
- </tr>
- {%- endif -%}
- </tfoot>
- </table>
- </div>
- </div>
- </div>
- </div>
- {% endregistrationinstance %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement