<#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 c.pending gt 0>· ${c.pending} #i18n{module.appointment.importer.countPending} <#macro statusBadge status> <#if status == 'COMPLETED'><@tag color='success'>#i18n{module.appointment.importer.status.COMPLETED} <#elseif status == 'COMPLETED_WITH_ERRORS'><@tag color='danger'>#i18n{module.appointment.importer.status.COMPLETED_WITH_ERRORS} <#elseif status == 'PROCESSING'><@tag color='warning'>#i18n{module.appointment.importer.status.PROCESSING} <#elseif status == 'VALIDATION_FAILED'><@tag color='danger'>#i18n{module.appointment.importer.status.VALIDATION_FAILED} <#elseif status == 'ARCHIVED'><@tag color='secondary'>#i18n{module.appointment.importer.status.ARCHIVED} <#else><@tag color='secondary'>#i18n{module.appointment.importer.status.PENDING} <@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}
<#list errors![] as msg>
<@alert color='danger'>${msg.message?html}
<#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 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"' /> <@button type='submit' name='action' value='doImportWorkbook' buttonIcon='upload' title='#i18n{module.appointment.importer.import}' color='primary' id='btn-import' /> <#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' />
<#elseif validation_errors?has_content>
<@alert color='danger'><#list validation_errors as error>${error.field?html} : ${error.message?html}<#if error_has_next>
<#else> <@row> <@columns lg=10 offsetLg=1> <@box class='border shadow-sm'>

#i18n{module.appointment.importer.sectionFilters}

<@aButton href='jsp/admin/plugins/appointment/modules/importer/ManageAppointmentImport.jsp?tab=results&reset=1' title='#i18n{module.appointment.importer.buttonResetFilters}' buttonIcon='refresh' color='light' size='sm' />
<@boxBody> <@tform action='jsp/admin/plugins/appointment/modules/importer/ManageAppointmentImport.jsp' method='get'> <@input type='hidden' name='tab' value='results' />
<@select name='filter_file' id='filter_file' items=filter_files default_value='${result_file!}' />
<@select name='filter_form' id='filter_form' items=result_forms default_value='${result_form_id!}' />
<@select name='status' id='status' items=status_options default_value='${filter_status!}' />
<#-- 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' />
<#if import_batches?has_content> <@box class='border shadow-sm'>

#i18n{module.appointment.importer.sectionBatches} (${paginator.itemsCount})

<@input type='search' name='batch_search' id='batch-search' class='form-control-sm w-auto' placeHolder='#i18n{portal.util.labelSearch}' params='aria-label="#i18n{module.appointment.importer.sectionBatches}"' />
<@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' />
<@paginationAdmin paginator=paginator combo=1 />
<#else> <@alert color='info'>#i18n{module.appointment.importer.alertNoResults} <#if import_files?has_content> <@box class='border shadow-sm'>

#i18n{module.appointment.importer.sectionFiles} <#if file_paginator??>(${file_paginator.itemsCount})

<@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 /> ${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 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 file_paginator??>
<@paginationAdmin paginator=file_paginator combo=1 />