54 lines
3.5 KiB
PHP
54 lines
3.5 KiB
PHP
<?php
|
|
|
|
namespace App\Widgets;
|
|
|
|
use Arrilot\Widgets\AbstractWidget;
|
|
use App\Http\Requests\LambdaRequest;
|
|
use Auth;
|
|
|
|
class CiplaTeamFormHeatMap extends AbstractWidget
|
|
{
|
|
/**
|
|
* The configuration array.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $config = [];
|
|
|
|
/**
|
|
* Treat this method as a controller action.
|
|
* Return view() or other content to display.
|
|
*/
|
|
public function run()
|
|
{
|
|
parse_str($this->config['parameters'], $params);
|
|
$params['user_id'] = Auth::user()->user_id;
|
|
$params['date_range'] = "12-01-2021_12-31-2021";
|
|
$groups = [];
|
|
$groups[] = ['name' => 'Customer Perspective', 'questions' => ['is_aware_of_the_customer_perspective_potential_prescription_position', 'has_customer_plan_based_on_customer_perspective', 'call_objective_planned_question_opening_statement_materials_and_objection_anticipated','greeted_customer_appropriately'] ];
|
|
$groups[] = ['name' => 'Pitch Quality', 'questions' => ['used_planned_opening_statement','gained_attention_of_the_customer','was_ready_with_tab_maintained_eye_contact_with_doctor_had_a_clear_voice','asked_planned_question_as_per_call_planning'] ];
|
|
$groups[] = ['name' => 'Customer Feedback', 'questions' => ['asked_question_related_to_customer_behaviourbelief_service','listened_attentively_and_asked_follow_up_question_if_required','generated_desired_response_from_customer','maintained_the_sequence_of_product_as_per_the_speciality_p1p2p3'] ];
|
|
$groups[] = ['name' => 'Shared Information', 'questions' => ['shared_benefit_of_productdevicesservices_as_per_marketing_strategy','shared_informationused_the_materialstools_as_per_plan_demonstrated_and_discussed_cipla_devices','utilized_the_tab_effectively_smooth_navigation_highlighted_studies_zoomed_graphs_etc','listened_attentively_acknowledged_concern'] ];
|
|
$groups[] = ['name' => 'Responded to Customer', 'questions' => ['asked_questions_to_seek_clarity_on_questionobjection','shared_the_relevant_information','confirmed_if_objectionquestion_was_addressed_assured_follow_through_actions_if_required_and_returned_to_call_flow','summarized_the_key_discussion_points'] ];
|
|
$groups[] = ['name' => 'Product Recall', 'questions' => ['gained_agreement_basis_call_objective_from_the_doctor','quantified_the_demand_with_rx','left_lblreminder_of_focused_product'] ];
|
|
|
|
$response = LambdaRequest::signedrequest('post', 'form', 'formentity/getformhistory', $params );
|
|
$submissions = [];
|
|
foreach($response->data->submissions as $sub) {
|
|
$submissions[$sub->user_info->id]['user_info'] = $sub->user_info;
|
|
$submissions[$sub->user_info->id]['date'] = date("M Y", strtotime($sub->record_date) );
|
|
foreach($groups as $group) {
|
|
$grpscore = 0;
|
|
foreach($group['questions'] as $ques) {
|
|
if(isset($sub->formdata->{$ques}) && $sub->formdata->{$ques} == 1)
|
|
$grpscore++;
|
|
}
|
|
$submissions[$sub->user_info->id]['scores'][] = ['grp_name' => $group['name'], 'score' => $grpscore];
|
|
}
|
|
//$submissions[$sub->user_info->id]['formdata'] = $sub->formdata;
|
|
}
|
|
//echo '<pre>'; print_r(['title' => $this->config['title'], 'submissions' => $submissions, 'questions' => $response->data->questions ]); exit;
|
|
return view('widgets.cipla_team_form_heat_map', ['title' => $this->config['title'], 'submissions' => $submissions, 'groups' => $groups ]);
|
|
}
|
|
}
|