@@ -330,20 +330,27 @@ <h3 class="accordion-header" id="headingFive">
330330 </ tr >
331331 </ thead >
332332 < tbody >
333- {% if g.current_user.isCeltsAdmin %}
333+ {% set ns = namespace(backgroundChecksExist=false) %}
334334 {% for bgType in backgroundTypes %}
335+ {% if not g.current_user.isCeltsAdmin and not allBackgroundHistory[bgType.id] %}
336+ {% continue %}
337+ {% endif %}
338+ {% set ns.backgroundChecksExist = true %}
335339 < tr >
336340 < td >
337341 < h6 > {{bgType.description}}</ h6 >
338342 < ul class ="mb-0 " id ="bgHistory{{bgType.id}} ">
339343 {% for bgStatus in allBackgroundHistory[bgType.id] %}
340344 < li >
341345 {{bgStatus.backgroundCheckStatus}}: {{bgStatus.dateCompleted.strftime("%m/%d/%Y")}}
346+ {% if g.current_user.isCeltsAdmin %}
342347 < button class ="bg-transparent border-0 text-danger " id ="deleteBgHistory " data-id ="{{bgStatus.id}} "> X</ button >
348+ {% endif %}
343349 </ li >
344350 {% endfor %}
345351 </ ul >
346352 </ td >
353+ {% if g.current_user.isCeltsAdmin %}
347354 < td >
348355 < select class ="passedBackgroundCheck form-select " id ="{{bgType.id}} " data-id ="{{bgType.id}} ">
349356 < option value =''> </ option >
@@ -356,35 +363,14 @@ <h6>{{bgType.description}}</h6>
356363 < td >
357364 < button type ="button " class ="savebtn btn btn-primary " id ="{{bgType.id}} " data-id ="{{bgType.id}} " data-username ="{{volunteer.username}} "> Save</ button >
358365 </ td >
359- </ tr >
360- {% endfor %}
361- {% else %}
362- {% set noBackground = namespace(value=True) %}
363- {% for bgType in backgroundTypes %}
364- {% set checkedBackground = namespace(value='') %}
365- {% for bgStatus in allBackgroundHistory[bgType.id] %}
366- {% if bgStatus.backgroundCheckStatus in ['Submitted', 'Passed', 'Failed'] %}
367- {% set noBackground.value = False %}
368- {% set checkedBackground.value = checkedBackground.value ~ '< li > ' ~ bgStatus.backgroundCheckStatus ~ ': ' ~ bgStatus.dateCompleted.strftime("%m/%d/%Y") ~ '</ li > ' %}
369- {% endif %}
370- {% endfor %}
371- {% if checkedBackground.value %}
372- < tr >
373- < td >
374- < h6 > {{bgType.description}}</ h6 >
375- < ul class ="mb-0 " id ="bgHistory{{bgType.id}} ">
376- {{ checkedBackground.value | safe }}
377- </ ul >
378- </ td >
379- </ tr >
380366 {% endif %}
367+ </ tr >
381368 {% endfor %}
382- {% if noBackground.value %}
369+ {% if not ns.backgroundChecksExist %}
383370 < tr >
384- < td > There are no background checks</ td >
371+ < td > No background checks have been submitted. </ td >
385372 </ tr >
386373 {% endif %}
387- {% endif %}
388374 </ tbody >
389375 </ table >
390376 </ div >
0 commit comments