#macro subjectsList items typeList depth>
<#if items?has_content>
<#if depth==0>
#if>
<@ul>
<#list items as item>
<#assign subjectId = 0 />
<#if subject?has_content><#assign subjectId = subject.id />#if>
<#if subjectId==item.id>
${item.text}
<#else>
${item.text}
#if>
<#assign child_subjects_list = item.getChilds(plugin) />
<#if child_subjects_list?has_content>
<@ul>
<@subjectsList items=child_subjects_list typeList=typeList depth=depth+1 />
@ul>
#if>
#list>
@ul>
<#if depth==0>
#if>
#if>
#macro>
<#macro subjectsListSelect items default_value exclude_value depth>
<#if items?has_content>
<#list items as subject>
<#if exclude_value="${subject.id}">
<#else>
<#assign child_subjects_list = subject.getChilds(plugin) />
<#if child_subjects_list?has_content>
<@subjectsListSelect items=child_subjects_list default_value=default_value exclude_value=exclude_value depth=depth+1 />
#if>
#if>
#list>
#if>
#macro>
<@row>
<@columns sm=3>
<@box color='primary' >
<@boxHeader title='#i18n{helpdesk.question_answer_list.adminTitleLeft}' />
<@boxBody>
<@subjectsList items=helpdesk_subject_list typeList="QuestionAnswer" depth=0 />
@boxBody>
@box>
<@box color='primary' >
<@boxHeader title='#i18n{helpdesk.search_results.labelSearch}' />
<@boxBody>
<@tform name='fullTextSearch' action='jsp/admin/plugins/helpdesk/HelpdeskSearch.jsp' >
<@input type='hidden' value=faq.id name='faq_id' />
<@input type='hidden' name='page' value='search' />
<@formGroup labelFor='query' labelKey='#i18n{helpdesk.search_results.labelSearch}' rows=2 >
<@input name='query' value='${query!}' />
@formGroup>
<@formGroup labelFor='date_start' labelKey='#i18n{helpdesk.search_results.date_start}' rows=2 >
<@inputGroup>
<@input type='daterange' dateRangeEndId='date_end' name='date_start' id='date_start' value='${date_start_query!}' />
<@inputGroupItem><@icon style='calendar' />@inputGroupItem>
@inputGroup>
@formGroup>
<@formGroup labelFor='date_end' labelKey='#i18n{helpdesk.search_results.date_end}' rows=2 >
<@inputGroup>
<@input name='date_end' id='date_end' value='${date_end_query!}' />
<@inputGroupItem><@icon style='calendar' />@inputGroupItem>
@inputGroup>
@formGroup>
<@formGroup labelFor='form_search_subject_id' labelKey='#i18n{helpdesk.subjects.title.questions}' rows=2 >
<@select id='form_search_subject_id' name='form_search_subject_id' >
<@option value='' label='' />
<@subjectsListSelect items=helpdesk_subject_list default_value="${subjectId!}" exclude_value="" depth=0 />
@select>
@formGroup>
<@formGroup labelFor='form_search_subject_id' labelKey='#i18n{helpdesk.subjects.title.questions}' rows=2 >
<@checkBox name='form_search_sub_subjects' id='form_search_sub_subjects' labelKey='#i18n{helpdesk.subject_list.labelSearchSubSubjects}' orientation='vertical' value='true' />
@formGroup>
<@formGroup labelFor='form_search_subject_id' labelKey='#i18n{helpdesk.search_results.labelNbDocsPerPage} ' rows=2 >
<#-- Number of documents per page selector -->
<@NbItemsPerPageSelectorCombo nb_items_per_page />
@formGroup>
<@formGroup rows=2 >
<@button buttonIcon='search' title='#i18n{helpdesk.search_results.buttonSearch}' type='submit' size='sm' />
@formGroup>
@tform>
@boxBody>
@box>
@columns>
<@columns sm=9>
<@box color='primary' >
<@boxHeader title='#i18n{helpdesk.question_answer_list.adminTitleRight}' boxTools=true >
<@tform action="jsp/admin/plugins/helpdesk/CreateQuestionAnswer.jsp">
<@input type='hidden' value=faq.id name='faq_id' />
<#if subject?has_content><@input type='hidden' value=subject.id name='subject_id' />#if>
<@button buttonIcon='plus' title='#i18n{helpdesk.question_answer_list.buttonLabelCreate}' type='submit' size='sm' />
@tform>
@boxHeader>
<@boxBody>
<#if subject?has_content>
<#if subject.questions?has_content>
<@tform id='question_form' name='question_form' action='jsp/admin/plugins/helpdesk/DoActionSelectionQuestionAnswer.jsp'>
<@input type='hidden' value=faq.id name='faq_id' />
<@table>
<@tr>
<@th>
<@checkBox id='select_all' name='select_all' labelKey='#i18n{helpdesk.question_answer_list.selectAll}' value='' params='onclick="toggle_checkboxes();"' />
<#if subject?has_content><@input type='hidden' value=subject.id name='subject_id' />#if>
@th>
<@th>
<@row>
<@columns sm=3>
#i18n{helpdesk.question_answer_list.titleSubject}
@columns>
<@columns sm=6>
<@div id='applySelection'>
<@div class='d-flex'>
<@div class='form-floating w-50' >
<@select id='selection' name='selection'>
<@option value='publish' label='#i18n{helpdesk.question_answer_list.publish}' />
<@option value='unpublish' label='#i18n{helpdesk.question_answer_list.unpublish}' />
<@option value='remove' label='#i18n{helpdesk.question_answer_list.remove}' />
@select>
<@formLabel class='' labelFor='selection' labelKey='#i18n{helpdesk.question_answer_list.applySelection}' mandatory=false />
@div>
<@div class='d-flex align-items-end'>
<@button buttonIcon='check' type='submit' size='' />
@div>
@div>
@div>
@columns>
@row>
@th>
<@th>#i18n{helpdesk.question_answer_list.titleState}@th>
<@th>#i18n{helpdesk.question_answer_list.titleActions}@th>
@tr>
<@tableHeadBodySeparator />
<#list subject.questions as question_answer>
<#assign truncated_value = 125 />
<@tr>
<@td><@checkBox id='question_selection' name='question_selection' labelKey='' value='${question_answer.idQuestionAnswer}' params='aria-label="${question_answer.idQuestionAnswer} "' />@td>
<@td class='w-75'>
${question_answer.question}
${question_answer.answer}@td>
<@td>
<#if question_answer.enabled>
<@icon style='check' title='#i18n{helpdesk.question_answer_list.published}' class='label label-success'/>
<#else>
<@icon style='close' title='#i18n{helpdesk.question_answer_list.unpublished}' class='label label-important'/>
#if>
@td>
<@td>
<@aButton href='jsp/admin/plugins/helpdesk/ModifyQuestionAnswer.jsp?faq_id=${faq.id}&question_id=${question_answer.idQuestionAnswer}' buttonIcon='edit'/>
<#if question_answer.idOrder gt 0>
<@aButton href='jsp/admin/plugins/helpdesk/DoGoUpQuestionAnswer.jsp?faq_id=${faq.id}&question_id=${question_answer.idQuestionAnswer}' buttonIcon='chevron-up' title='#i18n{helpdesk.commonList.buttonLabelGoUp}' hideTitle=['all']/>
<#else>
<@aButton href='javascript:void;' buttonIcon='chevron-up' class="btn-light disabled" title='#i18n{helpdesk.commonList.buttonLabelGoUp}' hideTitle=['all']/>
#if>
<#if subject.questions?seq_index_of(question_answer) != subject.questions?size-1>
<@aButton href='jsp/admin/plugins/helpdesk/DoGoDownQuestionAnswer.jsp?faq_id=${faq.id}&question_id=${question_answer.idQuestionAnswer}' buttonIcon='chevron-down' class="btn-light" title='#i18n{helpdesk.commonList.buttonLabelGoDown}' hideTitle=['all']/>
<#else>
<@aButton href='javascript:void;' buttonIcon='chevron-down' class="btn-light disabled" title='#i18n{helpdesk.commonList.buttonLabelGoDown}' hideTitle=['all']/>
#if>
<#if question_answer.enabled>
<@aButton href='jsp/admin/plugins/helpdesk/DoUnpublishQuestionAnswer.jsp?faq_id=${faq.id}&subject_id=${subject.id}&question_id=${question_answer.idQuestionAnswer}' buttonIcon='eye-slash' class="btn-light" title='#i18n{helpdesk.question_answer_list.unpublish}' hideTitle=['all']/>
<#else>
<@aButton href='jsp/admin/plugins/helpdesk/DoPublishQuestionAnswer.jsp?faq_id=${faq.id}&subject_id=${subject.id}&question_id=${question_answer.idQuestionAnswer}' buttonIcon='eye' class="btn-light" title='#i18n{helpdesk.question_answer_list.publish}' hideTitle=['all']/>
#if>
<@aButton href='jsp/admin/plugins/helpdesk/ConfirmRemoveQuestionAnswer.jsp?faq_id=${faq.id}&subject_id=${subject.id}&question_id=${question_answer.idQuestionAnswer}' title='#i18n{helpdesk.commonList.buttonLabelDelete}' hideTitle=['all'] buttonIcon='trash' class="btn-danger"/>
@td>
@tr>
#list>
@table>
@tform>
<#else>
<@empty title='#i18n{helpdesk.question_answer_list.noQuestion}' subtitle='' iconName='mood-empty' />
#if>
#if>
@boxBody>
@box>
@columns>
@row>
<#-- Number of items per page selector - Combo Box implementation -->
<#macro NbItemsPerPageSelectorCombo nb_items_per_page>
<@select id='items_per_page' name='items_per_page'>
<#list [ "10" , "20" , "50" , "100" ] as nb>
<#if nb_items_per_page = nb>
<@option selected=true value=nb label=nb />
<#else>
<@option value=nb label=nb />
#if>
#list>
@select>
#macro>