'Wiaas Delivery Process Id', 'is_numeric' => true, 'update_entry_meta_callback' => array( __CLASS__, 'update_entry_delivery_process_id' ), 'is_default_column' => false, // this column will be displayed by default on the entry list 'filter' => array( 'operators' => array( 'is' ), ), ); $entry_meta[ 'wiaas_delivery_order_id' ] = array( 'label' => 'Wiaas Delivery Process Order Id', 'is_numeric' => true, 'update_entry_meta_callback' => null, 'is_default_column' => false, // this column will be displayed by default on the entry list 'filter' => array( 'operators' => array( 'is' ), ), ); $entry_meta[ 'wiaas_delivery_step_name' ] = array( 'label' => 'Wiaas Delivery Step name', 'is_numeric' => false, 'update_entry_meta_callback' => null, 'is_default_column' => false, // this column will be displayed by default on the entry list 'filter' => array( 'operators' => array( 'is' ), ), ); return $entry_meta; } public static function update_entry_delivery_process_id($key, $entry, $form) { if ( isset( $_REQUEST['wiaas_delivery_process_id'] ) ) { return absint( $_REQUEST['wiaas_delivery_process_id'] ); } if ( isset( $entry[ $key ] ) ) { return $entry[ $key ]; } return ''; } public function display_process_steps_details($form, $entry, $current_step) { $delivery_settings = rgar($form, 'wiaas_delivery_process'); if ($delivery_settings['delivery_form_type'] === 'action') { return; } $workflow_api = new Gravity_Flow_API($form['id']); $steps = $workflow_api->get_steps(); foreach ($steps as $index => $step) { if (! $step->is_active()) { continue; } $is_step_running = $step->get_status() === 'pending'; $is_current_step = $step->get_id() === $current_step->get_id(); $disabled_style = $is_step_running ? '' : 'opacity: 0.5'; ?>

get_name(), 'wiaas') ?>

target_form_id ); if (empty($action_form)) { echo '
'; continue; } $action_delivery_settings = rgar($action_form, 'wiaas_delivery_process'); ?>
' . ' ' . $action_form['title'] . '', $form_url ); echo $form_link; } echo '


'; $page_size = 20; $search_criteria = array( 'status' => 'active', 'field_filters' => array( array( 'key' => 'wiaas_delivery_process_id', 'value' => $entry['id'] ), ), ); $sorting = array( 'key' => 'date_created', 'direction' => 'DESC' ); $paging = array( 'offset' => 0, 'page_size' => $page_size ); $entries = GFAPI::get_entries( $action_form, $search_criteria, $sorting, $paging ); foreach ($entries as $action_entry) { $this->_display_step_action_entry($action_form, $action_entry); } ?>
get_current_step($action_entry); ?> type === 'wiaas_order') { continue; } if ($field->type === 'workflow_discussion') { echo ''; continue; } $value = $field->get_value_entry_detail($action_entry[$field->id]); $label = $field->get_field_label(false, $action_entry[$field->id]); echo '' . '' . '' . ''; } if (! empty($current_action_step)) { ?>
' . $field->get_value_entry_detail($action_entry[$field->id]) . '
' . $label . ' : ' . $value . '
View get_status_label($current_action_step->get_status()) ?>

'wiaas_form_editor_js', 'src' => $plugin_url . '/assets/js/wiaas-form-editor.js', 'enqueue' => array( array( 'admin_page' => array('form_editor'), ), ), ) ); return array_merge( parent::scripts(), $scripts ); } /** * Add settings menu for form delivery process * * @param $tabs * @param $form_id * * @return array */ public function add_form_settings_menu( $tabs, $form_id ) { $tabs[] = array( 'name' => $this->_slug, 'label' => esc_html__( 'Delivery Process', 'wiaas' ), 'query' => array( 'fid' => null ) ); return $tabs; } /** * Add settings field for delivery process settings menu * * @param $form * * @return array */ public function form_settings_fields($form) { return array( array( 'title' => esc_html__( 'Delivery Process', 'wiaas' ), 'fields' => array( array( 'name' => 'delivery_form_type', 'label' => esc_html__( 'Delivery Form Type', 'wiaas' ), 'type' => 'delivery_form_type', ), array( 'name' => 'delivery_action_code', 'label' => esc_html__( 'Action code', 'wiaas' ), 'type' => 'delivery_action_code', ), array( 'name' => 'delivery_action_form_type', 'label' => esc_html__( 'Automatic?', 'wiaas' ), 'type' => 'delivery_action_form_automatic', ) ) ) ); } public function settings_delivery_form_type() { $this->settings_select(array( 'name' => 'delivery_form_type', 'choices' => array( array( 'value' => 'action', 'label' => 'Action Form' ), array( 'value' => 'process', 'label' => 'Process Form' ) ), 'after_select' => '

Choose if this form will be used as process form or action form.

' . '

Process form defines order delivery process workflow.

' . '

Action form defines custom order data that is collected from delivery process participants.

' )); } public function settings_delivery_action_code() { $this->settings_select(array( 'name' => 'delivery_action_code', 'choices' => array( array( 'value' => '', 'label' => 'Select action code ...' ), array( 'value' => 'customer-acceptance', 'label' => 'Customer acceptance' ), array( 'value' => 'validate-questionnaire', 'label' => 'Validate Questionnaire' ), array( 'value' => 'schedule-meeting', 'label' => 'Schedule meeting' ) ), 'after_select' => '

Choose action code for action form.

' )); } public function settings_delivery_action_form_automatic() { $this->settings_checkbox_and_select(array( 'checkbox' => array( 'label' => esc_html__( 'Enable', 'wiaas' ), 'name' => 'automatic_action_entries_enabled', 'defeault_value' => '0', ), 'select' => array( 'name' => 'automatic_action_entries_type', 'choices' => array( array( 'value' => 'single', 'label' => esc_html__( 'Single entry', 'wiaas' ), ), array( 'value' => 'bundle', 'label' => esc_html__( 'Entry per bundle', 'wiaas' ), ) ), 'after_select' => '

Automatic entries can be created once per order or per every bundle in order.

' . '

Automatic entry will not be created if any required field cannot be populated.

', ) )); } }