mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-22 22:13:59 +00:00
567 lines
33 KiB
PHP
567 lines
33 KiB
PHP
<?php
|
|
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use App\Models\QAQuestionnaireSet;
|
|
use App\Models\QAQuestions;
|
|
use App\Models\QAAnswerOptions;
|
|
use App\Classes\ValueObjects\Constants\QAType;
|
|
|
|
class QAWorkFlowSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$questionnaireSets = [
|
|
[
|
|
'name' => 'Admin Work Flow',
|
|
'description' => 'Admin Work Flow',
|
|
'group' => '1688,approve_po,fill_po',
|
|
'version' => 1,
|
|
'questions' => [
|
|
[
|
|
'question_number' => 'node_0',
|
|
'question_title' => 'Are you ready to work today?',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => true,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Yes', 'value' => 'start_work', 'next_question_number' => 'start_work'],
|
|
['display_text' => 'No', 'value' => 'no_work', 'next_question_number' => 'no_work'],
|
|
],
|
|
'group' => '',
|
|
],
|
|
[
|
|
'question_number' => 'start_work',
|
|
'question_title' => 'What will you work on?',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => '1688', 'value' => '1688', 'next_question_number' => '1688'],
|
|
['display_text' => 'Approve PO', 'value' => 'approve_po', 'next_question_number' => 'approve_po'],
|
|
['display_text' => 'Fill PO', 'value' => 'fill_po', 'next_question_number' => 'fill_po'],
|
|
],
|
|
'group' => '',
|
|
],
|
|
[
|
|
'question_number' => 'no_work',
|
|
'question_title' => 'Come back when you are ready to work',
|
|
'question_type' => QAType::DEFAULT,
|
|
'is_start' => false,
|
|
'is_end' => true,
|
|
'group' => '',
|
|
],
|
|
[
|
|
'question_number' => '1688',
|
|
'question_title' => '1688',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'url' => 'api.admin_work_flow.fetch_oldest_order', //'http://localhost:8082/api/v1/admin-work-flow/fetch-oldest-order', //this.route("api.admin_work_flow.fetch_oldest_order"),
|
|
'is_start' => true,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Login Issue', 'value' => '1688_login_issue', 'btn_color' => 'warning', 'next_question_number' => '1688_login_issue'],
|
|
['display_text' => 'Login Successful', 'value' => '1688_login_successful', 'next_question_number' => '1688_login_successful'],
|
|
],
|
|
'group' => '1688',
|
|
],
|
|
[
|
|
'question_number' => '1688_login_issue',
|
|
'question_title' => '1688_login_issue',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Need TAC', 'value' => '1688_login_issue_need_tac', 'next_question_number' => '1688_issue_submit'],
|
|
['display_text' => 'Wrong login details', 'value' => '1688_login_issue_wrong_login_details', 'next_question_number' => '1688_issue_submit'],
|
|
['display_text' => 'Others', 'value' => '1688_login_issue_others', 'next_question_number' => '1688_login_issue_others'],
|
|
['display_text' => 'Order Cancelled', 'value' => '1688_login_issue_refund_request', 'next_question_number' => '1688_login_issue_refund_request'],
|
|
],
|
|
'group' => '1688',
|
|
'is_admin_filter' => true
|
|
],
|
|
[
|
|
'question_number' => '1688_login_successful',
|
|
'question_title' => '1688_login_successful',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
//'url' => 'api.admin_work_flow.fetch_model_attributes', //'http://localhost:8082/api/v1/admin-work-flow/{booking_id}/fetch-model-attributes',
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => "Can't verify order?", 'value' => '1688_login_successful_cannot_verify', 'next_question_number' => '1688_login_successful_cannot_verify'],
|
|
['display_text' => 'Order Verified', 'value' => '1688_order_verify', 'next_question_number' => '1688_order_verify'],
|
|
],
|
|
'group' => '1688',
|
|
],
|
|
[
|
|
'question_number' => '1688_login_successful_cannot_verify',
|
|
'question_title' => '1688_login_successful_cannot_verify',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Amount not found', 'value' => '1688_login_successful_cannot_verify_amount_not_found', 'next_question_number' => '1688_issue_submit'],
|
|
['display_text' => 'Plus Member', 'value' => '1688_login_successful_cannot_verify_plus_member', 'next_question_number' => '1688_issue_submit'],
|
|
['display_text' => 'Others', 'value' => '1688_login_successful_cannot_verify_others', 'next_question_number' => '1688_login_successful_cannot_verify_others'],
|
|
['display_text' => 'Customer did not verify 1688 account', 'value' => '1688_login_successful_cannot_verify_customer_did_not_verify_account', 'next_question_number' => '1688_issue_submit'],
|
|
['display_text' => 'WorldFirst account linked another account', 'value' => '1688_login_successful_cannot_verify_worldfirst_account_linked_another_account', 'next_question_number' => '1688_issue_submit'],
|
|
],
|
|
'group' => '1688',
|
|
'is_admin_filter' => true
|
|
],
|
|
[
|
|
'question_number' => '1688_login_successful_cannot_verify_others',
|
|
'question_title' => 'What other issues did you encounter? Upload documents if needed',
|
|
'question_type' => QAType::REMARKS_WITH_DOCUMENT_UPLOAD,
|
|
'next_nested_question' => '1688_issue_submit',
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'group' => '1688',
|
|
'is_admin_filter' => true
|
|
],
|
|
[
|
|
'question_number' => '1688_order_verify',
|
|
'question_title' => 'Order Amount',
|
|
'question_description' => 'Please key in the order amount',
|
|
'question_' => 'Order Amount',
|
|
'question_type' => QAType::FLOAT_MONEY,
|
|
'next_nested_question' => '1688_order_verification',
|
|
//'url' => 'api.admin_work_flow.fetch_model_attributes',
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
// 'answer_options' => [
|
|
// ['display_text' => 'Yes', 'value' => '1688_order_verification', 'next_question_number' => '1688_order_verification'],
|
|
// ],
|
|
'group' => '1688',
|
|
],
|
|
[
|
|
'question_number' => '1688_order_verification',
|
|
'question_title' => 'Are You Sure this is the correct amount?',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Yes', 'value' => '1688_proceed_order', 'next_question_number' => '1688_proceed_order'],
|
|
['display_text' => 'No', 'value' => '1688_underpaid_overpaid', 'next_question_number' => '1688_underpaid_overpaid'],
|
|
],
|
|
'group' => '1688',
|
|
],
|
|
[
|
|
'question_number' => '1688_proceed_order',
|
|
'question_title' => 'Proceed the order on 1688?',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Yes', 'value' => '1688_submit', 'next_question_number' => '1688_submit'],
|
|
['display_text' => 'Got Issue', 'value' => '1688_proceed_order_issue', 'next_question_number' => '1688_proceed_order_issue'],
|
|
],
|
|
'group' => '1688',
|
|
],
|
|
[
|
|
'question_number' => '1688_proceed_order_issue',
|
|
'question_title' => '1688_proceed_order_issue',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Wrong Pin Number', 'value' => '1688_proceed_order_issue_wrong_pin_number', 'next_question_number' => '1688_issue_submit'],
|
|
['display_text' => 'Not Enough Stock', 'value' => '1688_proceed_order_issue_not_enough_stock', 'next_question_number' => '1688_issue_submit'],
|
|
['display_text' => 'Others', 'value' => '1688_proceed_order_issue_others', 'next_question_number' => '1688_proceed_order_issue_others'],
|
|
['display_text' => 'No CrossBoarder', 'value' => '1688_proceed_order_issue_no_crossborder', 'next_question_number' => '1688_issue_submit'],
|
|
['display_text' => 'AngPau', 'value' => '1688_proceed_order_issue_angpau', 'next_question_number' => '1688_issue_submit'],
|
|
],
|
|
'group' => '1688',
|
|
'is_admin_filter' => true
|
|
],
|
|
[
|
|
'question_number' => '1688_proceed_order_issue_others',
|
|
'question_title' => 'What other issues did you encounter? Upload documents if needed',
|
|
'question_type' => QAType::REMARKS_WITH_DOCUMENT_UPLOAD,
|
|
'next_nested_question' => '1688_issue_submit',
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'group' => '1688',
|
|
'is_admin_filter' => true
|
|
],
|
|
[
|
|
'question_number' => '1688_login_issue_others',
|
|
'question_title' => 'What other issues did you encounter? Upload documents if needed',
|
|
'question_type' => QAType::REMARKS_WITH_DOCUMENT_UPLOAD,
|
|
'next_nested_question' => '1688_issue_submit',
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'group' => '1688',
|
|
'is_admin_filter' => true
|
|
],
|
|
[
|
|
'question_number' => '1688_submit',
|
|
'question_title' => '1688_submit',
|
|
'question_type' => QAType::SUBMIT_1688_3_TYPES_DOCUMENTS,
|
|
'next_nested_question' => '1688_issue_submit',
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'group' => '1688',
|
|
],
|
|
[
|
|
'question_number' => '1688_issue_submit',
|
|
'question_title' => 'Issue has been submitted',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => true,
|
|
'answer_options' => [
|
|
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
|
['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'],
|
|
],
|
|
'group' => '1688',
|
|
],
|
|
[
|
|
'question_number' => '1688_login_issue_refund_request',
|
|
'question_title' => 'Refund Request sent',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => true,
|
|
'answer_options' => [
|
|
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
|
['display_text' => 'Next Order', 'value' => '1688', 'next_question_number' => '1688'],
|
|
],
|
|
'group' => '1688',
|
|
],
|
|
[
|
|
'question_number' => '1688_insufficient_order',
|
|
'question_title' => 'Are You Sure this is the correct amount?',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Underpaid Order', 'value' => 'underpaid_order_1', 'next_question_number' => '1688_issue_submit'],
|
|
['display_text' => 'Underpaid Order', 'value' => 'underpaid_order_2', 'next_question_number' => '1688_issue_submit'],
|
|
['display_text' => 'Overpaid Order', 'value' => 'underpaid_order_2', 'next_question_number' => '1688_issue_submit'],
|
|
],
|
|
'group' => '1688',
|
|
],
|
|
[
|
|
'question_number' => '1688_underpaid_order_1',
|
|
'question_title' => 'This order is underpaid 1',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Done', 'value' => '1688_issue_submit', 'next_question_number' => '1688_issue_submit'],
|
|
],
|
|
'group' => '1688',
|
|
],
|
|
[
|
|
'question_number' => '1688_underpaid_order_2',
|
|
'question_title' => 'This order is underpaid 2',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Done', 'value' => '1688_issue_submit', 'next_question_number' => '1688_issue_submit'],
|
|
],
|
|
'group' => '1688',
|
|
],
|
|
[
|
|
'question_number' => '1688_overpaid_order',
|
|
'question_title' => 'This order is overpaid',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Done', 'value' => '1688_issue_submit', 'next_question_number' => '1688_issue_submit'],
|
|
],
|
|
'group' => '1688',
|
|
],
|
|
[
|
|
'question_number' => 'approve_po',
|
|
'question_title' => 'approve_po',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'url' => "api.admin_work_flow.fetch_pending_approve_po",
|
|
'is_start' => true,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Approve', 'value' => 'approve_po_approved', 'next_question_number' => 'approve_po_approved'],
|
|
['display_text' => 'Edit PO', 'value' => 'approve_po_edit', 'next_question_number' => 'approve_po_edit'],
|
|
['display_text' => 'Reject', 'value' => 'approve_po_reject', 'next_question_number' => 'approve_po_reject'],
|
|
],
|
|
'group' => 'approve_po',
|
|
],
|
|
[
|
|
'question_number' => 'fill_po',
|
|
'question_title' => 'fill_po',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'url' => "api.admin_work_flow.fetch_pending_fill_po",
|
|
'is_start' => true,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Edit PO', 'value' => 'fill_po_edit', 'next_question_number' => 'fill_po_edit'],
|
|
],
|
|
'group' => 'fill_po',
|
|
],
|
|
[
|
|
'question_number' => 'approve_po_filled',
|
|
'question_title' => 'PO Filled',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => true,
|
|
'answer_options' => [
|
|
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
|
['display_text' => 'Next PO (Fill)', 'value' => 'fill_po', 'next_question_number' => 'fill_po'],
|
|
['display_text' => 'Next PO (Approve)', 'value' => 'approve_po', 'next_question_number' => 'approve_po'],
|
|
],
|
|
'group' => 'approve_po',
|
|
],
|
|
[
|
|
'question_number' => 'approve_po_approved',
|
|
'question_title' => 'PO Approved',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => true,
|
|
'answer_options' => [
|
|
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
|
['display_text' => 'Next PO (Fill)', 'value' => 'fill_po', 'next_question_number' => 'fill_po'],
|
|
['display_text' => 'Next PO (Approve)', 'value' => 'approve_po', 'next_question_number' => 'approve_po'],
|
|
],
|
|
'group' => 'approve_po',
|
|
],
|
|
[
|
|
'question_number' => 'approve_po_edit',
|
|
'question_title' => 'approve_po_edit',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'url' => "api.booking.show",
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Issue?', 'value' => 'approve_po_edit_po_issue', 'next_question_number' => 'approve_po_edit_po_issue'],
|
|
['display_text' => 'Done', 'value' => 'approve_po_filled', 'next_question_number' => 'approve_po_filled'],
|
|
],
|
|
'group' => 'approve_po',
|
|
],
|
|
[
|
|
'question_number' => 'approve_po_reject',
|
|
'question_title' => 'PO Rejected',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Sensitive Goods', 'value' => 'Sensitive Goods', 'next_question_number' => 'approve_po_reject_others_complete'],
|
|
['display_text' => 'Others', 'value' => 'approve_po_reject_others', 'next_question_number' => 'approve_po_reject_others'],
|
|
// ['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
|
// ['display_text' => 'Next Order', 'value' => 'approve_po', 'next_question_number' => 'approve_po'],
|
|
],
|
|
'group' => 'approve_po',
|
|
'is_admin_filter' => true
|
|
],
|
|
[
|
|
'question_number' => 'approve_po_reject_others',
|
|
'question_title' => 'What other issues did you encounter? Upload documents if needed',
|
|
'question_type' => QAType::REMARKS_WITH_DOCUMENT_UPLOAD,
|
|
'next_nested_question' => 'approve_po_reject_others_complete',
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'group' => 'approve_po',
|
|
'is_admin_filter' => true
|
|
],
|
|
[
|
|
'question_number' => 'approve_po_reject_others_complete',
|
|
'question_title' => 'Issue has been submitted',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => true,
|
|
'answer_options' => [
|
|
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
|
['display_text' => 'Next PO (Fill)', 'value' => 'fill_po', 'next_question_number' => 'fill_po'],
|
|
['display_text' => 'Next PO (Approve)', 'value' => 'approve_po', 'next_question_number' => 'approve_po'],
|
|
],
|
|
'group' => 'approve_po',
|
|
],
|
|
[
|
|
'question_number' => 'approve_po_edit_po_issue',
|
|
'question_title' => 'approve_po_edit_po_issue',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Sensitive Goods', 'value' => 'Sensitive Goods', 'next_question_number' => 'approve_po_edit_po_issue_submit'],
|
|
['display_text' => 'Others', 'value' => 'approve_po_edit_po_issue_others', 'next_question_number' => 'approve_po_edit_po_issue_others'],
|
|
],
|
|
'group' => 'approve_po',
|
|
'is_admin_filter' => true
|
|
],
|
|
[
|
|
'question_number' => 'approve_po_edit_po_issue_submit',
|
|
'question_title' => 'Issue has been submitted',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => true,
|
|
'answer_options' => [
|
|
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
|
['display_text' => 'Next PO (Fill)', 'value' => 'fill_po', 'next_question_number' => 'fill_po'],
|
|
['display_text' => 'Next PO (Approve)', 'value' => 'approve_po', 'next_question_number' => 'approve_po'],
|
|
],
|
|
'group' => 'approve_po',
|
|
],
|
|
[
|
|
'question_number' => 'approve_po_edit_po_issue_others',
|
|
'question_title' => 'What other issues did you encounter? Upload documents if needed',
|
|
'question_type' => QAType::REMARKS_WITH_DOCUMENT_UPLOAD,
|
|
'next_nested_question' => 'approve_po_edit_po_issue_submit',
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'group' => 'approve_po',
|
|
'is_admin_filter' => true
|
|
],
|
|
[
|
|
'question_number' => 'approve_po_edit_po_issue_submit',
|
|
'question_title' => 'Issue has been submitted',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => true,
|
|
'answer_options' => [
|
|
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
|
['display_text' => 'Next PO (Fill)', 'value' => 'fill_po', 'next_question_number' => 'fill_po'],
|
|
['display_text' => 'Next PO (Approve)', 'value' => 'approve_po', 'next_question_number' => 'approve_po'],
|
|
],
|
|
'group' => 'approve_po',
|
|
],
|
|
[
|
|
'question_number' => 'fill_po_issue_others',
|
|
'question_title' => 'What other issues did you encounter? Upload documents if needed',
|
|
'question_type' => QAType::REMARKS_WITH_DOCUMENT_UPLOAD,
|
|
'next_nested_question' => 'fill_po_issue_submit',
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'group' => 'fill_po',
|
|
'is_admin_filter' => true
|
|
],
|
|
[
|
|
'question_number' => 'fill_po_issue_submit',
|
|
'question_title' => 'Issue has been submitted',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => true,
|
|
'answer_options' => [
|
|
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
|
['display_text' => 'Next PO (Fill)', 'value' => 'fill_po', 'next_question_number' => 'fill_po'],
|
|
['display_text' => 'Next PO (Approve)', 'value' => 'approve_po', 'next_question_number' => 'approve_po'],
|
|
],
|
|
'group' => 'fill_po',
|
|
],
|
|
[
|
|
'question_number' => 'fill_po_edit',
|
|
'question_title' => 'fill_po_edit',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'url' => "api.booking.show",
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Issue?', 'value' => 'fill_po_edit_issue', 'next_question_number' => 'fill_po_edit_issue'],
|
|
['display_text' => 'Done', 'value' => 'fill_po_edit_filled', 'next_question_number' => 'fill_po_edit_filled'],
|
|
],
|
|
'group' => 'fill_po',
|
|
],
|
|
[
|
|
'question_number' => 'fill_po_edit_issue',
|
|
'question_title' => 'fill_po_edit_issue',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => false,
|
|
'answer_options' => [
|
|
['display_text' => 'Sensitive Goods', 'value' => 'Sensitive Goods', 'next_question_number' => 'fill_po_issue_submit'],
|
|
['display_text' => 'Others', 'value' => 'fill_po_issue_others', 'next_question_number' => 'fill_po_issue_others'],
|
|
],
|
|
'group' => 'fill_po',
|
|
'is_admin_filter' => true
|
|
],
|
|
[
|
|
'question_number' => 'fill_po_edit_filled',
|
|
'question_title' => 'PO Filled',
|
|
'question_type' => QAType::MULTIPLE_CHOICES,
|
|
'is_start' => false,
|
|
'is_end' => true,
|
|
'answer_options' => [
|
|
['display_text' => 'Stop Working', 'value' => 'stop_working', 'next_question_number' => 'stop_working'],
|
|
['display_text' => 'Next PO (Fill)', 'value' => 'fill_po', 'next_question_number' => 'fill_po'],
|
|
['display_text' => 'Next PO (Approve)', 'value' => 'approve_po', 'next_question_number' => 'approve_po'],
|
|
],
|
|
'group' => 'fill_po',
|
|
],
|
|
[
|
|
'question_number' => 'stop_working',
|
|
'question_title' => 'Thank you. Reload page to restart.',
|
|
'question_type' => QAType::DEFAULT,
|
|
'is_start' => false,
|
|
'is_end' => true,
|
|
'group' => '',
|
|
],
|
|
]
|
|
],
|
|
];
|
|
|
|
foreach ($questionnaireSets as $set) {
|
|
$questionnaireSet = QAQuestionnaireSet::create([
|
|
'name' => $set['name'],
|
|
'description' => $set['description'],
|
|
'group' => $set['group'],
|
|
]);
|
|
|
|
foreach ($set['questions'] as $key => $questionData) {
|
|
$question = new QAQuestions;
|
|
$question->question_number = $questionData['question_number'];
|
|
$question->question_title = $questionData['question_title'];
|
|
if (isset($questionData['question_description'])) {
|
|
$question->question_description = $questionData['question_description'];
|
|
}
|
|
$question->question_type = $questionData['question_type'];
|
|
$question->questionnaire_set_id = $questionnaireSet->id;
|
|
if (isset($questionData['group']) && $questionData['group'] != '') {
|
|
$question->group = $questionData['group'];
|
|
}
|
|
|
|
if (isset($questionData['next_nested_question'])) {
|
|
$question->next_nested_question = $questionData['next_nested_question'];
|
|
}
|
|
if (isset($questionData['next_main_question'])) {
|
|
$question->next_main_question = $questionData['next_main_question'];
|
|
}
|
|
|
|
$question->is_start = $questionData['is_start'];
|
|
$question->is_end = $questionData['is_end'];
|
|
if (isset($questionData['end_text'])) {
|
|
$question->end_text = $questionData['end_text'];
|
|
}
|
|
|
|
if (isset($questionData['url'])) {
|
|
$question->url = $questionData['url'];
|
|
}
|
|
|
|
if (isset($questionData['is_admin_filter'])) {
|
|
$question->is_admin_filter = $questionData['is_admin_filter'];
|
|
}
|
|
|
|
$question->order = $key + 1;
|
|
$question->save();
|
|
|
|
if (isset($questionData['answer_options'])) {
|
|
foreach ($questionData['answer_options'] as $optionData) {
|
|
$answerOption = new QAAnswerOptions;
|
|
$answerOption->display_text = $optionData['display_text'];
|
|
$answerOption->value = $optionData['value'];
|
|
$answerOption->question_number = $questionData['question_number'];
|
|
$answerOption->next_question_number = $optionData['next_question_number'] ?? null;
|
|
$answerOption->questionnaire_set_id = $questionnaireSet->id;
|
|
$answerOption->save();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|