' . esc_html__( 'The survey subsystem is not loaded.', 'ai-eshop-optimizer' ) . '

'; return; } $aieo_qn_blueprints = isset( $blueprints ) ? (array) $blueprints : array(); $aieo_qn_health = isset( $health ) ? (array) $health : array(); $aieo_qn_surfaces = isset( $surfaces ) ? (array) $surfaces : array(); $aieo_qn_worklist = isset( $worklist ) ? (array) $worklist : array(); $aieo_qn_hooks = isset( $hooks ) ? (array) $hooks : array(); $aieo_qn_statuses = isset( $statuses ) ? (array) $statuses : array(); $aieo_qn_pages = isset( $pages ) ? (array) $pages : array(); $aieo_qn_problem_tone = static function ( array $rows ) { foreach ( $rows as $aieo_qn_i => $aieo_qn_row ) { if ( is_array( $aieo_qn_row ) ) { $rows[ $aieo_qn_i ]['problem_tone'] = '' !== trim( (string) ( $aieo_qn_row['problem'] ?? '' ) ) ? 'danger' : ''; } } return $rows; }; $aieo_qn_health = $aieo_qn_problem_tone( $aieo_qn_health ); $aieo_qn_surfaces = $aieo_qn_problem_tone( $aieo_qn_surfaces ); ?> 'aieo-card-questionnaires-placement', 'title' => __( 'Where each survey appears', 'ai-eshop-optimizer' ), 'description' => __( 'Everything is off until you switch it on here. A survey needs two things: somewhere on the site to be shown, and a page of its own to land on when it is sent by email. The second one is what a link in a message points at, and without it nothing can be sent at all.', 'ai-eshop-optimizer' ) . ' ' . __( 'Once per order is on by default and should stay on. A confirmation page gets reloaded, returned to from an email and opened on a second device, and each of those is another chance to answer the same survey twice.', 'ai-eshop-optimizer' ), 'cols' => 3, ) ); foreach ( $aieo_qn_blueprints as $aieo_qn_bp ) : $aieo_qn_slug = str_replace( '_', '-', sanitize_key( (string) $aieo_qn_bp['id'] ) ); $aieo_qn_form = 'aieo-card-questionnaires-placement-' . $aieo_qn_slug . '-form'; $aieo_qn_id = (string) $aieo_qn_bp['id']; list( $aieo_qn_open, $aieo_qn_close ) = AIEO_DMM_UI::card( array( 'anchor' => 'questionnaires-placement-' . $aieo_qn_slug, 'title' => (string) $aieo_qn_bp['label'], 'description' => '' !== (string) ( $aieo_qn_bp['description'] ?? '' ) ? (string) $aieo_qn_bp['description'] : __( 'Where this survey is shown, how it looks there, and the page its email link opens.', 'ai-eshop-optimizer' ), 'tools' => '' . esc_html( $aieo_qn_bp['id'] ) . '', 'footer' => class_exists( '\Rooster\Admin\States' ) ? \Rooster\Admin\States::save_button( $aieo_qn_form ) : '', ) ); echo $aieo_qn_open; ob_start(); ?> __( 'Nowhere on the site', 'ai-eshop-optimizer' ) ) + $aieo_qn_hooks; $aieo_qn_page_opts = array( '0' => __( 'None, so nothing can be sent', 'ai-eshop-optimizer' ) ); foreach ( $aieo_qn_pages as $aieo_qn_pid => $aieo_qn_pt ) { $aieo_qn_page_opts[ (string) (int) $aieo_qn_pid ] = $aieo_qn_pt; } $aieo_qn_blank = 'aieo-qn-blank-' . $aieo_qn_id; $aieo_qn_sizes = array(); foreach ( array( array( 'secsize', 'section_size', __( 'Section heading size (px)', 'ai-eshop-optimizer' ), 19 ), array( 'qsize', 'question_size', __( 'Question size (px)', 'ai-eshop-optimizer' ), 16 ), array( 'optsize', 'option_size', __( 'Answer options size (px)', 'ai-eshop-optimizer' ), 15 ), array( 'helpsize', 'help_size', __( 'Explanations size (px)', 'ai-eshop-optimizer' ), 14 ), ) as $aieo_qn_sz ) { $aieo_qn_sid = 'aieo-qn-' . $aieo_qn_sz[0] . '-' . $aieo_qn_id; $aieo_qn_sizes[] = array( 'label' => $aieo_qn_sz[2], 'id' => $aieo_qn_sid, 'control' => \Rooster\Admin\Ui::input( $aieo_qn_sz[1], $aieo_qn_bp[ $aieo_qn_sz[1] ] > 0 ? (string) (int) $aieo_qn_bp[ $aieo_qn_sz[1] ] : '', array( 'id' => $aieo_qn_sid, 'type' => 'number', 'xs' => true, 'class' => 'aieo-qn-' . $aieo_qn_sz[0], 'min' => 10, 'max' => 48, 'step' => 1, 'placeholder' => (string) (int) $aieo_qn_sz[3] ) ), ); } $aieo_qn_status_boxes = ''; foreach ( $aieo_qn_statuses as $aieo_qn_sk => $aieo_qn_sl ) { $aieo_qn_status_boxes .= ''; } echo '
' . '' . '
' . $aieo_qn_row( array( 'label' => '', 'control' => AIEO_Kit::check( 'enabled', __( 'Show this survey on the site', 'ai-eshop-optimizer' ), ! empty( $aieo_qn_bp['enabled'] ), array( 'id' => 'aieo-qn-enabled-' . $aieo_qn_id, 'attrs' => array( 'class' => 'aieo-qn-enabled' ) ) ), ) ) . $aieo_qn_row( array( 'id' => 'aieo-qn-hook-' . $aieo_qn_id, 'label' => __( 'Show it', 'ai-eshop-optimizer' ), 'control' => \Rooster\Admin\Ui::select( 'hook', $aieo_qn_hook_opts, (string) $aieo_qn_bp['hook_key'], array( 'id' => 'aieo-qn-hook-' . $aieo_qn_id ) ), ) ) . $aieo_qn_row( array( 'id' => 'aieo-qn-priority-' . $aieo_qn_id, 'label' => __( 'Priority', 'ai-eshop-optimizer' ), 'control' => \Rooster\Admin\Ui::input( 'priority', (string) $aieo_qn_bp['priority'], array( 'id' => 'aieo-qn-priority-' . $aieo_qn_id, 'type' => 'number', 'xs' => true, 'class' => 'aieo-qn-priority', 'step' => 1 ) ), ) ) . $aieo_qn_row( array( 'id' => 'aieo-qn-page-' . $aieo_qn_id, 'label' => __( 'Landing page for emailed links', 'ai-eshop-optimizer' ), 'control' => \Rooster\Admin\Ui::select( 'page_id', $aieo_qn_page_opts, (string) (int) $aieo_qn_bp['page_id'], array( 'id' => 'aieo-qn-page-' . $aieo_qn_id ) ) . ' ' . \Rooster\Admin\Ui::button( __( 'Create it for me', 'ai-eshop-optimizer' ), array( 'class' => 'aieo-qn-makepage' ) ) . ' ', ) ) . $aieo_qn_row( array( 'id' => 'aieo-qn-expires-' . $aieo_qn_id, 'label' => __( 'Link valid for (days)', 'ai-eshop-optimizer' ), 'control' => \Rooster\Admin\Ui::input( 'expires_days', (string) $aieo_qn_bp['expires'], array( 'id' => 'aieo-qn-expires-' . $aieo_qn_id, 'type' => 'number', 'xs' => true, 'class' => 'aieo-qn-expires', 'min' => 0, 'step' => 1 ) ), ) ) . $aieo_qn_row( array( 'id' => 'aieo-qn-title-' . $aieo_qn_id, 'label' => __( 'Heading shown to the customer', 'ai-eshop-optimizer' ), 'control' => \Rooster\Admin\Ui::input( 'title', (string) $aieo_qn_bp['title'], array( 'id' => 'aieo-qn-title-' . $aieo_qn_id, 'class' => 'aieo-qn-title', 'placeholder' => (string) $aieo_qn_bp['title_ph'], 'attrs' => array( 'aria-describedby' => $aieo_qn_blank ) ) ), ) ) . $aieo_qn_row( array( 'id' => 'aieo-qn-intro-' . $aieo_qn_id, 'label' => __( 'Opening line, under the heading', 'ai-eshop-optimizer' ), 'control' => \Rooster\Admin\Ui::textarea( 'intro', (string) $aieo_qn_bp['intro'], array( 'id' => 'aieo-qn-intro-' . $aieo_qn_id, 'rows' => 2, 'placeholder' => (string) $aieo_qn_bp['intro_ph'] ) ), 'help' => __( 'Leave either blank to use the wording shown in grey.', 'ai-eshop-optimizer' ), 'help_id' => $aieo_qn_blank, ) ) . $aieo_qn_row( array( 'id' => 'aieo-qn-thanks-' . $aieo_qn_id, 'label' => __( 'Thank-you shown after answering', 'ai-eshop-optimizer' ), 'control' => \Rooster\Admin\Ui::textarea( 'thanks', (string) $aieo_qn_bp['thanks'], array( 'id' => 'aieo-qn-thanks-' . $aieo_qn_id, 'rows' => 2, 'placeholder' => (string) $aieo_qn_bp['thanks_ph'] ) ), ) ) . $aieo_qn_row( array( 'id' => 'aieo-qn-sizes-' . $aieo_qn_id, 'label' => __( 'Text sizes', 'ai-eshop-optimizer' ), 'parts' => $aieo_qn_sizes, 'help' => __( 'Leave blank for the theme default shown in grey.', 'ai-eshop-optimizer' ), ) ) . ( $aieo_qn_statuses ? $aieo_qn_row( array( 'id' => 'aieo-qn-statuses-' . $aieo_qn_id, 'group' => true, 'label' => __( 'Only for orders in these states', 'ai-eshop-optimizer' ), 'control' => '
' . $aieo_qn_status_boxes . '
', 'help' => __( 'Tick none for any state.', 'ai-eshop-optimizer' ), ) ) : '' ) . $aieo_qn_row( array( 'label' => '', 'control' => AIEO_Kit::check( 'once_per_order', __( 'Only once per order', 'ai-eshop-optimizer' ), ! empty( $aieo_qn_bp['once'] ), array( 'id' => 'aieo-qn-once-' . $aieo_qn_id, 'attrs' => array( 'class' => 'aieo-qn-once' ) ) ), ) ) . '
'; echo AIEO_DMM_UI::card_form( 'aieo_survey_save_placement', 'questionnaires_' . $aieo_qn_bp['id'], $aieo_qn_form, (string) ob_get_clean() ); echo $aieo_qn_close; endforeach; rooster_admin_band_close(); ?> 'questionnaires-overview', 'title' => __( 'Your surveys', 'ai-eshop-optimizer' ), 'description' => __( 'A survey asks what the shop cannot work out for itself. Each one declares what its questions mean (a choice, a number, a scale, an order), and the surface it is shown on decides how to draw them. So the same question can be a row of buttons on a phone and a slider on a desktop, without the stored answer changing.', 'ai-eshop-optimizer' ), 'flush' => true, ) ); echo $aieo_qn_open; ?> __( 'How answers are stored', 'ai-eshop-optimizer' ) ) ) ); ?> __( 'Your surveys', 'ai-eshop-optimizer' ), 'id' => 'aieo-qn-blueprints', 'per_page' => 0, 'chooser' => true, 'row_key' => 'id', 'rows' => $aieo_qn_blueprints, 'columns' => array( array( 'key' => 'label', 'label' => __( 'User Survey', 'ai-eshop-optimizer' ), 'sub_key' => 'id' ), array( 'key' => 'questions', 'label' => __( 'Questions', 'ai-eshop-optimizer' ), 'type' => 'integer' ), array( 'key' => 'enabled', 'label' => __( 'On a page', 'ai-eshop-optimizer' ), 'type' => 'badge', 'format' => array( 'map' => array( '1' => 'success', '' => 'muted' ), 'labels' => array( '1' => __( 'Live', 'ai-eshop-optimizer' ), '' => __( 'Off', 'ai-eshop-optimizer' ) ), ), ), array( 'key' => 'hook', 'label' => __( 'Shown', 'ai-eshop-optimizer' ) ), array( 'key' => 'page_title', 'label' => __( 'Landing page', 'ai-eshop-optimizer' ) ), array( 'key' => 'responses', 'label' => __( 'Responses (30d)', 'ai-eshop-optimizer' ), 'type' => 'integer' ), array( 'key' => 'resolved', 'label' => __( 'Attached to a customer', 'ai-eshop-optimizer' ), 'type' => 'integer' ), array( 'key' => 'rate', 'label' => __( 'Of qualifying orders', 'ai-eshop-optimizer' ), 'type' => 'percent' ), array( 'key' => 'asked', 'label' => __( 'Asked by a workflow', 'ai-eshop-optimizer' ), 'type' => 'integer' ), array( 'key' => 'answered', 'label' => __( 'Answered', 'ai-eshop-optimizer' ), 'type' => 'integer' ), array( 'key' => 'silent', 'label' => __( 'Questions collecting nothing', 'ai-eshop-optimizer' ), 'type' => 'integer', 'bands' => array( array( 'min' => 1, 'tone' => 'warning' ) ), ), array( 'key' => 'problem', 'label' => __( 'Problem', 'ai-eshop-optimizer' ), 'tone_key' => 'problem_tone' ), ), 'empty' => __( 'No surveys are defined. Three ship with the plugin, so if none is listed the blueprint file could not be read.', 'ai-eshop-optimizer' ), ) ); ?> 'questionnaires-questions', 'title' => __( 'Is every question collecting anything?', 'ai-eshop-optimizer' ), 'description' => __( 'A question that has been asked and never once answered is either broken or worthless, and both are worth knowing. This is the check that would have found four questions on the old form collecting 3,748 answers into nothing for three years.', 'ai-eshop-optimizer' ), 'flush' => true, ) ); echo $aieo_qn_open; ?> __( 'Skipped or not shown?', 'ai-eshop-optimizer' ) ) ) ); ?> __( 'Is every question collecting anything?', 'ai-eshop-optimizer' ), 'id' => 'aieo-qn-questions', 'caps' => array( 'search' => true ), 'filters' => array( array( 'key' => 'blueprint', 'label' => __( 'User Survey', 'ai-eshop-optimizer' ), 'any' => __( 'Any survey', 'ai-eshop-optimizer' ) ), array( 'key' => 'state', 'label' => __( 'State', 'ai-eshop-optimizer' ), 'control' => 'segmented', 'options' => array( 'silent' => __( 'Collecting nothing', 'ai-eshop-optimizer' ), 'collecting' => __( 'Collecting', 'ai-eshop-optimizer' ), ), ), ), 'row_key' => 'code', 'density' => 'compact', 'rows' => $aieo_qn_health, 'columns' => array( array( 'key' => 'blueprint', 'label' => __( 'User Survey', 'ai-eshop-optimizer' ), 'type' => 'code' ), array( 'key' => 'label', 'label' => __( 'Question', 'ai-eshop-optimizer' ), 'sub_key' => 'code' ), array( 'key' => 'state', 'label' => __( 'State', 'ai-eshop-optimizer' ), 'type' => 'badge', 'format' => array( 'map' => array( 'silent' => 'warning', 'collecting' => 'success' ), 'labels' => array( 'silent' => __( 'Collecting nothing', 'ai-eshop-optimizer' ), 'collecting' => __( 'Collecting', 'ai-eshop-optimizer' ), ), ), ), array( 'key' => 'answered', 'label' => __( 'Answered', 'ai-eshop-optimizer' ), 'type' => 'integer' ), array( 'key' => 'skipped', 'label' => __( 'Skipped', 'ai-eshop-optimizer' ), 'type' => 'integer' ), array( 'key' => 'not_shown', 'label' => __( 'Not shown', 'ai-eshop-optimizer' ), 'type' => 'integer' ), ), 'empty' => __( 'No answers have been stored yet.', 'ai-eshop-optimizer' ), ) ); ?> 'questionnaires-mapping', 'title' => __( 'Forms this reads', 'ai-eshop-optimizer' ), 'description' => __( 'A form built in another plugin numbers its fields; a survey names its questions. This is the reconciliation between them, and it reports both directions: a question no field answers, and a field no question claims. Only one of those is visible from a report, and it is not the dangerous one.', 'ai-eshop-optimizer' ), 'flush' => true, ) ); echo $aieo_qn_open; ?> __( 'Forms this reads', 'ai-eshop-optimizer' ), 'id' => 'aieo-qn-surfaces', 'per_page' => 0, 'row_key' => 'surface', 'rows' => $aieo_qn_surfaces, 'columns' => array( array( 'key' => 'surface', 'label' => __( 'Form', 'ai-eshop-optimizer' ), 'type' => 'code' ), array( 'key' => 'blueprint', 'label' => __( 'Read as', 'ai-eshop-optimizer' ), 'type' => 'code' ), array( 'key' => 'mapped', 'label' => __( 'Fields mapped', 'ai-eshop-optimizer' ), 'type' => 'integer' ), array( 'key' => 'unmapped_fields', 'label' => __( 'Fields answering nothing', 'ai-eshop-optimizer' ), 'type' => 'integer', 'bands' => array( array( 'min' => 1, 'tone' => 'warning' ) ), ), array( 'key' => 'unmapped_questions', 'label' => __( 'Questions nothing feeds', 'ai-eshop-optimizer' ), 'type' => 'integer', 'bands' => array( array( 'min' => 1, 'tone' => 'warning' ) ), ), array( 'key' => 'context', 'label' => __( 'Identifies the answerer by', 'ai-eshop-optimizer' ), 'type' => 'code' ), array( 'key' => 'problem', 'label' => __( 'Problem', 'ai-eshop-optimizer' ), 'tone_key' => 'problem_tone' ), ), 'empty' => __( 'No third-party form is being read. A survey shown on this site needs no mapping, because its fields are its questions.', 'ai-eshop-optimizer' ), ) ); ?> 'questionnaires-worklist', 'title' => __( 'Answers nothing has been told the meaning of', 'ai-eshop-optimizer' ), 'description' => __( 'These answers were collected and cannot be counted, because nothing on this site knows which coded answer they are. Teaching one is permanent and applies to every form here: the old ones, the new ones and any import. The same word never has to be explained twice.', 'ai-eshop-optimizer' ), 'flush' => true, ) ); echo $aieo_qn_open; ?> __( 'Is anything lost?', 'ai-eshop-optimizer' ) ) ) ); ?> __( 'Answers nothing has been told the meaning of', 'ai-eshop-optimizer' ), 'id' => 'aieo-qn-worklist', 'caps' => array( 'search' => true ), 'filters' => array( array( 'key' => 'surface', 'label' => __( 'Form', 'ai-eshop-optimizer' ), 'control' => 'combo', 'any' => __( 'Any form', 'ai-eshop-optimizer' ) ) ), 'row_key' => 'value', 'density' => 'compact', 'rows' => $aieo_qn_worklist, 'columns' => array( array( 'key' => 'surface', 'label' => __( 'Form', 'ai-eshop-optimizer' ), 'type' => 'code' ), array( 'key' => 'question', 'label' => __( 'Question', 'ai-eshop-optimizer' ), 'type' => 'code' ), array( 'key' => 'value', 'label' => __( 'Answer as written', 'ai-eshop-optimizer' ) ), array( 'key' => 'hits', 'label' => __( 'Times given', 'ai-eshop-optimizer' ), 'type' => 'integer' ), ), 'empty' => __( 'Every answer that has been collected is understood.', 'ai-eshop-optimizer' ), ) ); ?>