#macro counts c>
${c.created} #i18n{module.appointment.importer.countCreated}
· ${c.errors} #i18n{module.appointment.importer.countErrors}
<#if c.replaced gt 0>· ${c.replaced} #i18n{module.appointment.importer.countReplaced} #if>
<#if c.pending gt 0>· ${c.pending} #i18n{module.appointment.importer.countPending} #if>
#macro>
<#macro statusBadge status>
<#if status == 'COMPLETED'><@tag color='success'>#i18n{module.appointment.importer.status.COMPLETED}@tag>
<#elseif status == 'COMPLETED_WITH_ERRORS'><@tag color='danger'>#i18n{module.appointment.importer.status.COMPLETED_WITH_ERRORS}@tag>
<#elseif status == 'PROCESSING'><@tag color='warning'>#i18n{module.appointment.importer.status.PROCESSING}@tag>
<#elseif status == 'VALIDATION_FAILED'><@tag color='danger'>#i18n{module.appointment.importer.status.VALIDATION_FAILED}@tag>
<#elseif status == 'ARCHIVED'><@tag color='secondary'>#i18n{module.appointment.importer.status.ARCHIVED}@tag>
<#else><@tag color='secondary'>#i18n{module.appointment.importer.status.PENDING}@tag>#if>
#macro>
<@row><@columns><@box><@boxBody>
<#-- The messages of the actions are shown on both tabs: an action of the results tab redirects to it -->
<#list infos![] as msg><@alert color='success'>${msg?html}@alert>
#list>
<#list errors![] as msg><@alert color='danger'>${msg.message?html}@alert>
#list>
<#if active_tab == 'import'>
#i18n{module.appointment.importer.overlay.title}
<@tform name='appointment_import' action='jsp/admin/plugins/appointment/modules/importer/ManageAppointmentImport.jsp' params='enctype="multipart/form-data"'>
<@formGroup labelFor='id_form' labelKey='#i18n{module.appointment.importer.form}' mandatory=true><@select name='id_form' id='id_form' items=forms default_value='${selected_form_id!}' />@formGroup>
<@formGroup labelFor='import_file' labelKey='#i18n{module.appointment.importer.file}' mandatory=true><@input type='file' name='import_file' id='import_file' params='accept=".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"' />@formGroup>
<@button type='submit' name='action' value='doImportWorkbook' buttonIcon='upload' title='#i18n{module.appointment.importer.import}' color='primary' id='btn-import' />
@tform>
<#if validation_report_available>
<@alert color='danger'>
#i18n{module.appointment.importer.alertValidationFailed}
<@aButton href='jsp/admin/plugins/appointment/modules/importer/DownloadAppointmentImport.jsp?view=downloadValidationReport&id_import_file=${validation_report_file_id}' title='#i18n{module.appointment.importer.buttonViewReport}' buttonIcon='download' size='sm' />
@alert>
<#elseif validation_errors?has_content>
<@alert color='danger'><#list validation_errors as error>${error.field?html} : ${error.message?html}<#if error_has_next> #if>#list>@alert>
#if>
<#else>
<@row>
<@columns lg=10 offsetLg=1>
<@box class='border shadow-sm'>
<@boxBody>
<@tform action='jsp/admin/plugins/appointment/modules/importer/ManageAppointmentImport.jsp' method='get'>
<@input type='hidden' name='tab' value='results' />
#i18n{module.appointment.importer.labelFilterFile}
<@select name='filter_file' id='filter_file' items=filter_files default_value='${result_file!}' />
#i18n{module.appointment.importer.form}
<@select name='filter_form' id='filter_form' items=result_forms default_value='${result_form_id!}' />
#i18n{module.appointment.importer.filterStatus}
<@select name='status' id='status' items=status_options default_value='${filter_status!}' />
#i18n{module.appointment.importer.filterDate}
<#-- result_date is an ISO date (yyyy-MM-dd): the macro needs a date, not a string parsed with the format of the locale -->
<@input type='date' name='filter_date' id='filter_date' value=result_date?has_content?then( result_date?date.xs, '' ) format='Y-m-d' showFormat='d/m/Y' />
<@button type='submit' title='#i18n{module.appointment.importer.buttonFilter}' buttonIcon='filter' color='primary' />
@tform>
@boxBody>
@box>
<#if import_batches?has_content>
<@box class='border shadow-sm'>
<@boxBody class='p-0'>
<@table class='table-striped table-hover table-vcenter mb-0' id='import-results'>
#
#i18n{module.appointment.importer.columnFile}
#i18n{module.appointment.importer.columnForm}
#i18n{module.appointment.importer.columnSlot}
#i18n{module.appointment.importer.filterStatus}
#i18n{module.appointment.importer.columnRows}
#i18n{module.appointment.importer.columnCreatedOn}
#i18n{module.appointment.importer.columnActions}
<#list import_batches as batch>
${batch?counter}
${batch.importFileName?html}
${batch.formTitle?html}
${batch.startingDateTimeLabel?html} – ${batch.endingTimeLabel?html}
<@statusBadge status=batch.status />
<@counts c=batch.counts />
${batch.creationDateLabel?html}
<@aButton href='jsp/admin/plugins/appointment/modules/importer/ManageAppointmentImport.jsp?view=viewImportBatch&id_import_batch=${batch.idImportBatch}&return_filter_file=${result_file?url("UTF-8")}&return_filter_form=${result_form_id?url("UTF-8")}&return_filter_status=${filter_status?url("UTF-8")}&return_filter_date=${result_date?url("UTF-8")}&return_page_index=${current_page_index}&return_items_per_page=${nb_items_per_page}' buttonIcon='eye' title='#i18n{module.appointment.importer.buttonViewBatch}' size='sm' />
#list>
@table>
<@paginationAdmin paginator=paginator combo=1 />
@boxBody>
@box>
<#else>
<@alert color='info'>#i18n{module.appointment.importer.alertNoResults}@alert>
#if>
<#if import_files?has_content>
<@box class='border shadow-sm'>
<@boxBody class='p-0'>
<@table class='table-striped table-hover table-vcenter mb-0'>
#i18n{module.appointment.importer.columnFile}
#i18n{module.appointment.importer.columnForm}
#i18n{module.appointment.importer.filterStatus}
#i18n{module.appointment.importer.columnRows}
#i18n{module.appointment.importer.columnImportedOn}
#i18n{module.appointment.importer.columnReports}
<#list import_files as file>
${file.importFileName?html}
${file.formTitle?html}
<@statusBadge status=file.status />
<#if file.status != 'VALIDATION_FAILED'><@counts c=file.counts />#if>
${file.creationDateLabel?html}
<#if file.status == 'VALIDATION_FAILED'>
<@aButton href='jsp/admin/plugins/appointment/modules/importer/DownloadAppointmentImport.jsp?view=downloadValidationReport&id_import_file=${file.idImportFile}' title='#i18n{module.appointment.importer.buttonDownloadValidationReport}' color='danger' size='sm' buttonIcon='download' />
<#else>
<@aButton href='jsp/admin/plugins/appointment/modules/importer/DownloadAppointmentImport.jsp?view=downloadReport&id_import_file=${file.idImportFile}' title='#i18n{module.appointment.importer.buttonDownloadReport}' size='sm' buttonIcon='download' />
#if>
<#if file.status == 'COMPLETED_WITH_ERRORS'>
<@aButton href='jsp/admin/plugins/appointment/modules/importer/DownloadAppointmentImport.jsp?view=downloadFailedRows&id_import_file=${file.idImportFile}' title='#i18n{module.appointment.importer.buttonDownloadFailedRows}' color='danger' size='sm' buttonIcon='download' />
<#if retry_form_ids?seq_contains( file.idForm?c )>
<@aButton href='jsp/admin/plugins/appointment/modules/importer/ManageAppointmentImport.jsp?view=confirmRetryImportFile&id_import_file=${file.idImportFile}' title='#i18n{module.appointment.importer.buttonRetryErrors}' color='warning' size='sm' buttonIcon='refresh' />
#if>
#if>
#list>
@table>
<#if file_paginator??>
<@paginationAdmin paginator=file_paginator combo=1 />
#if>
@boxBody>
@box>
#if>
@columns>
@row>
#if>
@boxBody>@box>@columns>@row>