_form.php
1 year ago
action_test_preview.php
4 months ago
index.php
1 year ago
new_form.php
1 year ago
test_preview.php
1 year ago
_form.php
91 lines
| 1 | <?php |
| 2 | /* @var $process OsProcessModel */ |
| 3 | |
| 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | exit; // Exit if accessed directly |
| 6 | } |
| 7 | |
| 8 | |
| 9 | ?> |
| 10 | <form action="" |
| 11 | data-os-action="<?php echo esc_attr(OsRouterHelper::build_route_name('processes', 'save')); ?>" |
| 12 | data-os-after-call="latepoint_process_updated" |
| 13 | class="os-process-form os-form-block os-form-block-type-<?php echo esc_attr($process->event_type); ?> <?php if($process->is_new_record()) echo 'os-is-editing'; ?> status-<?php echo esc_attr($process->status); ?>"> |
| 14 | |
| 15 | <div class="os-form-block-i"> |
| 16 | <div class="os-form-block-header"> |
| 17 | <div class="os-form-block-drag"></div> |
| 18 | <div class="os-form-block-name"><?php echo !empty($process->name) ? esc_html($process->name) : esc_html__('New Workflow', 'latepoint'); ?></div> |
| 19 | <div class="os-form-block-type"><?php echo esc_html($process->event_type); ?></div> |
| 20 | <div class="os-form-block-edit-btn"><i class="latepoint-icon latepoint-icon-edit-3"></i></div> |
| 21 | </div> |
| 22 | <div class="os-form-block-params os-form-w"> |
| 23 | <div class="sub-section-row"> |
| 24 | <div class="sub-section-label"> |
| 25 | <h3><?php esc_html_e('Status', 'latepoint') ?></h3> |
| 26 | </div> |
| 27 | <div class="sub-section-content"> |
| 28 | <?php echo OsFormHelper::select_field('process[status]', false, [LATEPOINT_STATUS_ACTIVE => __('Active', 'latepoint'), LATEPOINT_STATUS_DISABLED => __('Disabled', 'latepoint')], $process->status); ?> |
| 29 | </div> |
| 30 | </div> |
| 31 | <div class="sub-section-row"> |
| 32 | <div class="sub-section-label"> |
| 33 | <h3><?php esc_html_e('Name', 'latepoint') ?></h3> |
| 34 | </div> |
| 35 | <div class="sub-section-content"> |
| 36 | <?php echo OsFormHelper::text_field('process[name]', '', $process->name, ['theme' => 'bordered', 'placeholder' => __('Process Name', 'latepoint'), 'class' => 'os-form-block-name-input']); ?> |
| 37 | </div> |
| 38 | </div> |
| 39 | <div class="sub-section-row"> |
| 40 | <div class="sub-section-label"> |
| 41 | <h3><?php esc_html_e('Event Type', 'latepoint') ?></h3> |
| 42 | </div> |
| 43 | <div class="sub-section-content"> |
| 44 | <?php echo OsFormHelper::select_field('process[event][type]', false, \LatePoint\Misc\ProcessEvent::get_event_types_for_select(), $process->event->type, |
| 45 | ['class' => 'process-event-type-selector', 'data-route' => OsRouterHelper::build_route_name('processes', 'reload_event_trigger_conditions')]); ?> |
| 46 | </div> |
| 47 | </div> |
| 48 | <div class="process-event-condition-wrapper"> |
| 49 | <?php echo OsProcessesHelper::trigger_conditions_html_for_event($process->event); ?> |
| 50 | </div> |
| 51 | <?php echo OsProcessesHelper::time_offset_html_for_event($process->event); ?> |
| 52 | <div class="sub-section-row"> |
| 53 | <div class="sub-section-label"> |
| 54 | <h3><?php esc_html_e('Actions', 'latepoint') ?></h3> |
| 55 | </div> |
| 56 | <div class="sub-section-content"> |
| 57 | <?php |
| 58 | if(!empty($process->actions)) { |
| 59 | foreach ($process->actions as $action) { |
| 60 | echo \LatePoint\Misc\ProcessAction::generate_form($action, $process->id); |
| 61 | } |
| 62 | } |
| 63 | ?> |
| 64 | <a href="#" class="latepoint-btn latepoint-btn-block latepoint-btn-outline" data-os-after-call="latepoint_init_added_process_action_form" data-os-pass-this="yes" data-os-action="<?php echo OsRouterHelper::build_route_name('processes', 'new_action'); ?>" data-os-params="<?php echo OsUtilHelper::build_os_params(['process_id' => $process->id]); ?>" data-os-before-after="before"> |
| 65 | <i class="latepoint-icon latepoint-icon-plus"></i> |
| 66 | <span><?php esc_html_e('Add Action', 'latepoint'); ?></span> |
| 67 | </a> |
| 68 | </div> |
| 69 | </div> |
| 70 | <div class="os-form-block-buttons"> |
| 71 | <a href="#" class="latepoint-btn latepoint-btn-danger pull-left os-remove-process" |
| 72 | data-os-prompt="<?php esc_attr_e('Are you sure you want to delete this process?', 'latepoint'); ?>" |
| 73 | data-os-after-call="latepoint_process_action_removed" |
| 74 | data-os-pass-this="yes" |
| 75 | data-os-action="<?php echo esc_attr(OsRouterHelper::build_route_name('processes', 'destroy')); ?>" |
| 76 | data-os-params="<?php echo esc_attr(OsUtilHelper::build_os_params(['id' => $process->id], 'destroy_process_'.$process->id)); ?>"><?php esc_html_e('Delete', 'latepoint'); ?> |
| 77 | </a> |
| 78 | <a href="#" class="latepoint-btn latepoint-btn-secondary os-run-process" data-route="<?php echo esc_attr(OsRouterHelper::build_route_name('processes', 'test_preview')); ?>"><i class="latepoint-icon latepoint-icon-play-circle"></i><span><?php esc_html_e('Test this workflow', 'latepoint'); ?></span></a> |
| 79 | <button type="submit" class="os-form-block-save-btn latepoint-btn latepoint-btn-primary"><span><?php esc_html_e('Save Workflow', 'latepoint'); ?></span></button> |
| 80 | </div> |
| 81 | </div> |
| 82 | </div> |
| 83 | <a href="#" |
| 84 | data-os-prompt="<?php esc_attr_e('Are you sure you want to delete this process?', 'latepoint'); ?>" |
| 85 | data-os-after-call="latepoint_process_action_removed" |
| 86 | data-os-pass-this="yes" |
| 87 | data-os-action="<?php echo esc_attr(OsRouterHelper::build_route_name('processes', 'destroy')); ?>" |
| 88 | data-os-params="<?php echo esc_attr(OsUtilHelper::build_os_params(['id' => $process->id], 'destroy_process_'.$process->id)); ?>" class="os-remove-form-block"><i class="latepoint-icon latepoint-icon-cross"></i></a> |
| 89 | <?php echo OsFormHelper::hidden_field('process[id]', $process->id, ['class' => 'os-form-block-id']); ?> |
| 90 | <?php wp_nonce_field($process->is_new_record() ? 'new_process' : 'edit_process_'.$process->id); ?> |
| 91 | </form> |