#include "macro_workflows.html" />
<@pageContainer>
<@pageColumn>
<@pageHeader title='#i18n{workflow.manage_workflow.page_title}'>
<#if workflow_list?has_content>
<@formGroup labelFor='search_workflow' labelKey='#i18n{portal.util.labelSearch}' hideLabel=['all'] formStyle=''>
<@inputGroup>
<@input type='text' name='search_workflow' id='search_workflow' placeHolder='#i18n{portal.util.labelSearch}' params='autocomplete="off"' />
<@inputGroupItem type='text'><@icon style='search' />@inputGroupItem>
@inputGroup>
@formGroup>
#if>
<#if permission_manage_advanced_parameters>
<@aButton href='jsp/admin/plugins/workflow/ManageAdvancedParameters.jsp' buttonIcon='cog' color='' class='me-1' title='#i18n{workflow.manage_workflow.button_manage_advanced_parameters}' hideTitle=['xs','sm','md'] />
#if>
<@button type='button' buttonIcon='filter' color='light' class='me-1' title='#i18n{workflow.manage_workflow.button_search}' hideTitle=['xs','sm','md'] params='data-bs-toggle="modal" data-bs-target="#workflow-filter"' />
<@button type='button' buttonIcon='upload' color='light' class='me-1' title='#i18n{workflow.manage_workflow.buttonImport}' hideTitle=['xs','sm','md'] params='data-bs-toggle="modal" data-bs-target="#workflow-import"' />
<@aButton href='jsp/admin/plugins/workflow/CreateWorkflow.jsp' buttonIcon='plus' color='primary' title='#i18n{workflow.manage_workflow.button_create}' hideTitle=['xs','sm'] />
@pageHeader>
<@modal id='workflow-filter'>
<@modalHeader modalTitle='#i18n{workflow.manage_workflow.button_search}' />
<@modalBody>
<@tform id='form-workflow-filter' method='get' action='jsp/admin/plugins/workflow/ManageWorkflow.jsp'>
<@formGroup labelFor='is_enabled' labelKey='#i18n{workflow.manage_workflow.label_active}' rows=2>
<@select name='is_enabled' id='is_enabled' items=active_list default_value=active_selected?string!'' />
@formGroup>
<@formGroup labelFor='workgroup' labelKey='#i18n{workflow.manage_workflow.label_workgroup}' rows=2>
<@select name='workgroup' id='workgroup' items=user_workgroup_list default_value=user_workgroup_selected />
@formGroup>
@tform>
@modalBody>
<@modalFooter>
<@button type='button' color='light' buttonIcon='x' title='#i18n{portal.util.labelCancel}' params='data-bs-dismiss="modal"' />
<@button type='submit' formId='form-workflow-filter' color='primary' buttonIcon='filter' title='#i18n{workflow.manage_workflow.button_search}' />
@modalFooter>
@modal>
<@modal id='workflow-import'>
<@modalHeader modalTitle='#i18n{workflow.manage_workflow.buttonImport}' />
<@modalBody>
<@tform id='form-workflow-import' method='post' name='upload_workflow' action='jsp/admin/plugins/workflow/ConfirmImportWorkflow.jsp' enctype='multipart/form-data'>
<@formGroup labelFor='json_file' labelKey='#i18n{workflow.manage_workflow.labelImportFile}' helpKey='#i18n{workflow.manage_workflow.labelImportFile.help}' mandatory=true rows=2>
<@input type='file' name='json_file' id='json_file' params='accept=".json,application/json"' />
@formGroup>
@tform>
@modalBody>
<@modalFooter>
<@button type='button' color='light' buttonIcon='x' title='#i18n{portal.util.labelCancel}' params='data-bs-dismiss="modal"' />
<@button type='submit' formId='form-workflow-import' name='action_doImportJson' color='primary' buttonIcon='upload' title='#i18n{workflow.manage_workflow.buttonImport}' />
@modalFooter>
@modal>
<#assign filterActive = ( active_selected?c != '-1' ) || ( ( user_workgroup_selected!'all' ) != 'all' ) />
<#assign resetFilterUrl = 'jsp/admin/plugins/workflow/ManageWorkflow.jsp?is_enabled=-1&workgroup=all' />
<#if filterActive>
<@alert color='info' iconTitle='filter' class='mt-3 d-flex align-items-center justify-content-between'>
<@span>#i18n{workflow.manage_workflow.filter_active}@span>
<@aButton href=resetFilterUrl color='light' size='sm' buttonIcon='filter-off' title='#i18n{portal.util.labelReset}' />
@alert>
#if>
<#if workflow_list?has_content>
<@manageFeature layout='list' id='workflow-list'>
<#list workflow_list as workflow>
<@manageFeatureItem>
<@manageFeatureItemColumn auto=true flex=false class='searchable'>
<@link href='jsp/admin/plugins/workflow/ModifyWorkflow.jsp?id_workflow=${workflow.id}' class='fw-bold' label=workflow.name />
<#if workflow.enabled>
<@tag color='success' class='ms-2'>#i18n{portal.util.labelEnabled}@tag>
<#else>
<@tag color='warning' class='ms-2'>#i18n{portal.util.labelDisabled}@tag>
#if>
<@p class='text-secondary small mb-0'>${workflow.description!}<#if workflow.workgroup?has_content && workflow.workgroup != 'all'> · <@icon style='users' class='me-1' />${workflow.workgroup}#if>@p>
@manageFeatureItemColumn>
<@manageFeatureItemColumn align='end'>
<@aButton href='jsp/admin/plugins/workflow/ModifyWorkflow.jsp?id_workflow=${workflow.id}' color='' buttonIcon='pencil' title='#i18n{workflow.manage_workflow.title_modify}' hideTitle=['all'] />
<#if workflow.enabled>
<@aButton href='jsp/admin/plugins/workflow/DoDisableWorkflow.jsp?id_workflow=${workflow.id}&token=${token}' color='warning' class='ms-1' buttonIcon='player-pause' title='#i18n{workflow.manage_workflow.title_disable}' hideTitle=['all'] />
<#else>
<@aButton href='jsp/admin/plugins/workflow/DoEnableWorkflow.jsp?id_workflow=${workflow.id}&token=${token}' color='success' class='ms-1' buttonIcon='player-play' title='#i18n{workflow.manage_workflow.title_enable}' hideTitle=['all'] />
#if>
<@actionsMenu id='workflow-actions-${workflow.id}'>
<@actionsMenuItem href='jsp/admin/plugins/workflow/DoExportWorkflow.jsp?id_workflow=${workflow.id}' iconName='download' label='#i18n{workflow.manage_workflow.title_export}' />
<@actionsMenuItem href='jsp/admin/plugins/workflow/ConfirmCopyWorkflow.jsp?id_workflow=${workflow.id}' iconName='copy' label='#i18n{workflow.manage_workflow.title_copy}' />
<@actionsMenuItem href='jsp/admin/plugins/workflow/ConfirmRemoveWorkflow.jsp?id_workflow=${workflow.id}' iconName='trash' label='#i18n{workflow.manage_workflow.title_delete}' danger=true />
@actionsMenu>
@manageFeatureItemColumn>
@manageFeatureItem>
#list>
@manageFeature>
<#if paginator.itemsCount gte 10>
<@paginationAdmin paginator=paginator combo=1 />
#if>
<#else>
<@card>
<#if filterActive>
<@empty title='#i18n{workflow.manage_workflow.no_result_filter}' subtitle=' ' iconName='filter-off' actionTitle='#i18n{portal.util.labelReset}' actionIcon='filter-off' actionUrl=resetFilterUrl />
<#else>
<@empty title='#i18n{workflow.manage_workflow.no_workflow}' subtitle='#i18n{workflow.manage_workflow.add_workflow}' iconName='git-merge' actionTitle='#i18n{workflow.manage_workflow.button_create}' actionUrl='jsp/admin/plugins/workflow/CreateWorkflow.jsp' />
#if>
@card>
#if>
@pageColumn>
@pageContainer>
<#if workflow_list?has_content>
#if>
<@scrollTopBtn />