Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 78 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| RolePlayOptionsController | |
0.00% |
0 / 78 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| index | |
0.00% |
0 / 77 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Controllers\v2\RolePlay; |
| 4 | |
| 5 | use Illuminate\Http\Request; |
| 6 | use App\Traits\SubscriptionTrait; |
| 7 | use Illuminate\Http\JsonResponse; |
| 8 | use App\Http\Controllers\Controller; |
| 9 | use App\Http\Models\Parameter; |
| 10 | use App\Http\Models\RolePlayObjections; |
| 11 | use App\Http\Models\RolePlayProjects; |
| 12 | use App\Http\Models\RolePlaySkillProgressions; |
| 13 | |
| 14 | class RolePlayOptionsController extends Controller |
| 15 | { |
| 16 | use SubscriptionTrait; |
| 17 | |
| 18 | public function __construct() {} |
| 19 | |
| 20 | public function index(Request $request): JsonResponse |
| 21 | { |
| 22 | $objections = RolePlayObjections::where('status', 'active')->orderBy('category', 'asc')->get(); |
| 23 | $skillProgression = RolePlaySkillProgressions::where('status', 'active')->get(); |
| 24 | $callTypes = [ |
| 25 | [ |
| 26 | 'value' => RolePlayProjects::$COLD_CALL, |
| 27 | 'label' => 'Cold Call' |
| 28 | ], |
| 29 | [ |
| 30 | 'value' => RolePlayProjects::$DISCOVERY_CALL, |
| 31 | 'label' => 'Discovery Call' |
| 32 | ] |
| 33 | ]; |
| 34 | $companySizes = [ |
| 35 | [ |
| 36 | 'value' => RolePlayProjects::$COMPANY_SIZE_SMALL, |
| 37 | 'label' => RolePlayProjects::$COMPANY_SIZE_SMALL |
| 38 | ], |
| 39 | [ |
| 40 | 'value' => RolePlayProjects::$COMPANY_SIZE_MEDIUM, |
| 41 | 'label' => RolePlayProjects::$COMPANY_SIZE_MEDIUM |
| 42 | ], |
| 43 | [ |
| 44 | 'value' => RolePlayProjects::$COMPANY_SIZE_LARGE, |
| 45 | 'label' => RolePlayProjects::$COMPANY_SIZE_LARGE |
| 46 | ] |
| 47 | ]; |
| 48 | $levels = [ |
| 49 | [ |
| 50 | 'value' => RolePlayProjects::$LEVEL_LOW, |
| 51 | 'label' => RolePlayProjects::$LEVEL_LOW |
| 52 | ], |
| 53 | [ |
| 54 | 'value' => RolePlayProjects::$LEVEL_MODERATE, |
| 55 | 'label' => RolePlayProjects::$LEVEL_MODERATE |
| 56 | ], |
| 57 | [ |
| 58 | 'value' => RolePlayProjects::$LEVEL_HIGH, |
| 59 | 'label' => RolePlayProjects::$LEVEL_HIGH |
| 60 | ], |
| 61 | [ |
| 62 | 'value' => RolePlayProjects::$LEVEL_CRITICAL, |
| 63 | 'label' => RolePlayProjects::$LEVEL_CRITICAL |
| 64 | ] |
| 65 | ]; |
| 66 | $timeFilters = [ |
| 67 | [ |
| 68 | 'value' => 'all_time', |
| 69 | 'label' => 'All Time' |
| 70 | ], |
| 71 | [ |
| 72 | 'value' => 'this_week', |
| 73 | 'label' => 'This Week' |
| 74 | ], |
| 75 | [ |
| 76 | 'value' => 'this_month', |
| 77 | 'label' => 'This Month' |
| 78 | ] |
| 79 | ]; |
| 80 | $personalitiesParams = Parameter::where('name', 'role_play_personalities')->first(); |
| 81 | $personalities = collect($personalitiesParams->value)->map(function ($param) { |
| 82 | return [ |
| 83 | 'value' => $param['type'], |
| 84 | 'label' => $param['name'], |
| 85 | 'description' => $param['description'] ?? '' |
| 86 | ]; |
| 87 | })->toArray(); |
| 88 | |
| 89 | return response()->json([ |
| 90 | 'data' => [ |
| 91 | 'objections' => $objections, |
| 92 | 'skill_progression' => $skillProgression, |
| 93 | 'call_types' => $callTypes, |
| 94 | 'company_sizes' => $companySizes, |
| 95 | 'levels' => $levels, |
| 96 | 'time_filters' => $timeFilters, |
| 97 | 'personalities' => $personalities, |
| 98 | ] |
| 99 | ]); |
| 100 | } |
| 101 | } |