#include "macro_workflows.html" />
<#macro manageWorkflowFilters type='' class=''>
<@tform align='left' class='${class}'>
<@formGroup formStyle="inline" labelFor='is_enabled' labelKey='#i18n{workflow.manage_workflow.label_active}' hideLabel=['all']>
<@select name='is_enabled' items=active_list default_value=active_selected?string!'' size='' />
@formGroup>
<@formGroup formStyle="inline" labelFor='workgroup' labelKey='#i18n{workflow.manage_workflow.label_workgroup}' hideLabel=['all']>
<@inputGroup>
<@select name="workgroup" items=user_workgroup_list default_value=user_workgroup_selected size='' />
<@button type='submit' name='filter' buttonIcon='filter' title='#i18n{workflow.manage_workflow.button_search}' hideTitle=['all'] color='default' size='' />
@inputGroup>
@formGroup>
@tform>
#macro>
<@pageContainer>
<@pageColumn>
<@pageHeader title='#i18n{workflow.manage_workflow.title}'>
<@manageWorkflowFilters class='d-none d-md-flex' />
<#if permission_manage_advanced_parameters>
<@aButton href='jsp/admin/plugins/workflow/ManageAdvancedParameters.jsp' buttonIcon='cog' title='#i18n{workflow.manage_workflow.button_manage_advanced_parameters}' size='' hideTitle=['all'] />
#if>
<#-- btnTitle='#i18n{workflow.manage_workflow.button_create}' -->
<#-- <@offcanvas targetUrl='jsp/admin/plugins/workflow/CreateWorkflow.jsp' targetElement='#create_workflow_page' redirectForm=false id='workflow-create' title='#i18n{workflow.create_workflow.title}' btnTitle='' btnIcon='plus' btnSize='' position='end' /> -->
<@aButton href='jsp/admin/plugins/workflow/CreateWorkflow.jsp' buttonIcon='plus' title='#i18n{workflow.manage_workflow.button_create}' hideTitle=['all'] size='' />
<@aButton title='#i18n{workflow.manage_workflow.buttonImport}' buttonIcon='upload' size='' params='data-toggle="modal" data-target="#importJsonModal"' hideTitle=['all'] />
@pageHeader>
<@manageWorkflowFilters class='d-md-none mb-3' />
<@table responsive=false class='mb-3'>
<@tr>
<@th hide=['xs']>#i18n{workflow.manage_workflow.row_name}
<@sort jsp_url="jsp/admin/plugins/workflow/ManageWorkflow.jsp" attribute="name" />
@th>
<@th>#i18n{workflow.manage_workflow.row_actions}@th>
@tr>
<#list workflow_list as workflow>
<@tr>
<@td>
${workflow.name} <#if !workflow.enabled><@icon style='times' class='fa-fw text-danger' title='#i18n{portal.util.labelDisabled}' />#if>
@td>
<@td>
<@aButton href='jsp/admin/plugins/workflow/ModifyWorkflow.jsp?id_workflow=${workflow.id}' hideTitle=['all'] buttonIcon='pencil' title='#i18n{workflow.manage_workflow.title_modify}' size='sm' />
<@aButton href='jsp/admin/plugins/workflow/DoExportWorkflow.jsp?id_workflow=${workflow.id}' hideTitle=['all'] buttonIcon='download' title='#i18n{workflow.manage_workflow.title_export}' size='sm' />
<@aButton href='jsp/admin/plugins/workflow/ConfirmCopyWorkflow.jsp?id_workflow=${workflow.id}' hideTitle=['all'] buttonIcon='copy' color='warning' title='#i18n{workflow.manage_workflow.title_copy}' size='sm' />
<@aButton href='jsp/admin/plugins/workflow/ConfirmRemoveWorkflow.jsp?id_workflow=${workflow.id}' hideTitle=['all'] buttonIcon='trash' color='danger' title='#i18n{workflow.manage_workflow.title_delete}' size='sm' />
<#if workflow.enabled>
<@aButton href='jsp/admin/plugins/workflow/DoDisableWorkflow.jsp?id_workflow=${workflow.id}&token=${token}' hideTitle=['all'] buttonIcon='stop' color='danger' title='#i18n{workflow.manage_workflow.title_disable}' size='sm' />
<#else>
<@aButton href='jsp/admin/plugins/workflow/DoEnableWorkflow.jsp?id_workflow=${workflow.id}&token=${token}' hideTitle=['all'] buttonIcon='play' color='success' title='#i18n{workflow.manage_workflow.title_enable}' size='sm' />
#if>
@td>
@tr>
#list>
@table>
<@paginationAdmin paginator=paginator combo=1 />
@pageColumn>
@pageContainer>
<@modal id='importJsonModal'>
<@modalHeader modalTitle='#i18n{workflow.manage_workflow.buttonImport}' />
<@modalBody>
<@tform class='form' method='post' name='upload_workflow' action='jsp/admin/plugins/workflow/ConfirmImportWorkflow.jsp' params='enctype="multipart/form-data"'>
<@formGroup labelKey='#i18n{workflow.manage_workflow.labelImportFile}' helpKey='#i18n{workflow.manage_workflow.labelImportFile.help}' rows=2>
<@input type='file' name='json_file'/>
@formGroup>
<@formGroup>
<@button type='submit' name='action_doImportJson' buttonIcon='check' title='#i18n{portal.admin.message.buttonValidate}' />
<#-- <@button type='cancel' name='action_doCancelImport' buttonIcon='times' title='#i18n{portal.admin.message.buttonCancel}' cancel=true /> -->
@formGroup>
@tform>
@modalBody>
@modal>