@php echo '
'; echo '
'.$template->form_name.'
'; $submitted_on = $formDetail[0]->created_at ?? null; $getConvertedtime = \App\Helpers\AppHelper::changeTimeZone($submitted_on, $studioId); /* label name */ echo '
Form Submitted: '.$getConvertedtime .'
'; echo '
'; if(isset($recentSubmittedForms) && !empty($recentSubmittedForms)){ foreach($recentSubmittedForms as $submittedFormKey => $submittedFormValue){ $signatureCount = 0; $i=0; foreach($submittedFormValue as $key=>$value){ $key = str_replace('####', '', $key); if($value['component_code'] == 'heading_small'){ echo '
' . $key . '
'; } if($value['component_code'] == 'heading_large'){ echo '
' . $key . '
'; } if($value['component_code'] == 'section_step'){ echo '
' . $key . '
'; } if($value['component_code'] == 'text_field_small'){ echo '
'; echo ''; echo ''; echo "
"; } if($value['component_code'] == 'text_field_large'){ echo '
'; echo ''; echo ''; echo "
"; } if($value['component_code'] == 'checkbox'){ echo '
'; echo '
' . $key . '
'; if (isset($value['sub_arrays']) && count($value['sub_arrays']) > 0 && is_array($value['sub_arrays'])) { $userFilledAnswer = json_decode($value['user_filled_answer'], true); if( $userFilledAnswer!=null ) { $subIds = explode(',', $userFilledAnswer['sub_ids']); $subIds = array_map('trim', $subIds); // Trim whitespace around each value foreach ($value['sub_arrays'] as $subId => $subLabel) { if(in_array((string) $subId, $subIds)){ $isChecked = 'checked'; }else{ // Fetch the current radio button's text $currentCheck = \App\Models\Forms\FormComponentQuestionsSub::where('id', (string)$subId)->first(); $checkText = $currentCheck ? trim($currentCheck->text) : ''; $submittedCheck = \App\Models\Forms\FormComponentQuestionsSub::withTrashed() ->whereIn('id', $subIds) ->pluck('text') ->map(function($text) { return trim($text); // Trim whitespace around each text }) ->toArray(); if (in_array($checkText, $submittedCheck)) { $isChecked = 'checked'; } else { $isChecked = ''; } } echo '
'; echo '
'; if($isChecked) { echo 'Fitforms'; } else { echo 'Fitforms'; } echo '
'; echo '
'; echo '
' . $subLabel . '
'; echo '
'; echo '
'; } } } echo "
"; } if($value['component_code'] == 'radio_button'){ echo '
'; echo '
' . $key . '
'; if (isset($value['sub_arrays']) && count($value['sub_arrays']) > 0 && is_array($value['sub_arrays'])) { $userFilledAnswer = json_decode($value['user_filled_answer'], true); if( $userFilledAnswer!=null ) { $subIds = explode(',', $userFilledAnswer['sub_ids']); $subIds = array_map('trim', $subIds); // Trim whitespace around each value foreach ($value['sub_arrays'] as $subId => $subLabel) { if(in_array((string) $subId, $subIds)){ $isChecked = 'checked'; }else{ // Fetch the current radio button's text $currentRadio = \App\Models\Forms\FormComponentQuestionsSub::where('id', (string)$subId)->first(); $radioText = $currentRadio ? trim($currentRadio->text) : ''; $submittedRadio = \App\Models\Forms\FormComponentQuestionsSub::withTrashed() ->whereIn('id', $subIds) ->pluck('text') ->map(function($text) { return trim($text); // Trim whitespace around each text }) ->toArray(); if (in_array($radioText, $submittedRadio)) { $isChecked = 'checked'; } else { $isChecked = ''; } } //$isChecked = in_array((string) $subId, $subIds) ? 'checked' : ''; echo '
'; echo '
'; if($isChecked) { echo 'Fitforms'; } else { echo 'Fitforms'; } echo '
'; echo '
'; echo '
' . $subLabel . '
'; echo '
'; echo '
'; } } } echo "
"; } if($value['component_code'] == 'dropdown'){ echo '
'; echo ''; if (isset($value['sub_arrays']) && count($value['sub_arrays']) > 0 && is_array($value['sub_arrays'])) { $userFilledAnswer = json_decode($value['user_filled_answer'], true); $subIds = []; if( $userFilledAnswer!=null ) { $subIds = explode(',', $userFilledAnswer['sub_ids']); $subIds = array_map('trim', $subIds); // Trim whitespace around each value } foreach ($value['sub_arrays'] as $subId => $subLabel) { if(in_array((string) $subId, $subIds)){ $isChecked = 'selected'; }else{ // Fetch the current radio button's text $currentDrop = \App\Models\Forms\FormComponentQuestionsSub::where('id', (string)$subId)->first(); $dropText = $currentDrop ? trim($currentDrop->text) : ''; $submittedDrop = \App\Models\Forms\FormComponentQuestionsSub::withTrashed() ->whereIn('id', $subIds) ->pluck('text') ->map(function($text) { return trim($text); // Trim whitespace around each text }) ->toArray(); if (in_array($dropText, $submittedDrop)) { $isChecked = 'selected'; } else { $isChecked = ''; } } //$isChecked = in_array((string) $subId, $subIds) ? 'selected' : ''; if($isChecked){ echo ''; } } } echo "
"; } if($value['component_code'] == 'terms_conditions'){ $terms_checked_val = ($value['user_filled_answer'] == '1') ? 'checked' : ''; $extra_records = !empty($value['extra_records']) ? json_decode($value['extra_records']) : ''; $agree_label = !empty($extra_records->termsconditions_checkbox) ? $extra_records->termsconditions_checkbox:'' ; echo '
'; echo '
' . $key . '
'; echo '
' . $value['component_question_desc'] . '
'; echo '
'; echo '
'; echo 'Fitforms'; echo '
'; echo '
'; echo '
' . $agree_label . '
'; echo '
'; echo '
'; } if($value['component_code'] == 'date') { $datefield = $value['user_filled_answer']; if (!empty($datefield)) { try { // Attempt to create a Carbon instance from the given format $formdateTime = \Carbon\Carbon::createFromFormat('d/m/Y', $datefield); // Check if the date is valid if ($formdateTime && $formdateTime->format('d/m/Y') === $datefield) { $datefieldvalue = $formdateTime->format('d M Y'); } else { //date range - 86cugq7cp $formdateTime2 = \Carbon\Carbon::createFromFormat('m/d/Y', $datefield); if (isset($formdateTime2) && $formdateTime2->format('m/d/Y') == $datefield) { $datefieldvalue = $formdateTime2->format('d M Y'); } else{ $datefieldvalue = ''; // Invalid date } } } catch (\Exception $e) { $datefieldvalue = ''; // Exception occurred } } else { $datefieldvalue = ''; } echo '
'; echo ''; echo ''; echo "
"; } if($value['component_code'] == 'date_range') { //date range - 86cugq7cp $dates = json_decode($value['user_filled_answer']); $formDateRange1 = (!empty($dates->date1)) ? \Carbon\Carbon::createFromFormat('d/m/Y', $dates->date1): ""; $formDateRange2 = (!empty($dates->date2)) ? \Carbon\Carbon::createFromFormat('d/m/Y', $dates->date2): ""; $date1 = (!empty($formDateRange1) && $formDateRange1->format('d/m/Y') === $dates->date1) ? $formDateRange1->format('d M Y'): ""; $date2 = (!empty($formDateRange2) && $formDateRange2->format('d/m/Y') === $dates->date2) ? $formDateRange2->format('d M Y'): ""; $extra_records = !empty($value['extra_records']) ? json_decode($value['extra_records']) : ''; $noticePeriod = !empty($extra_records->noticePeriod) ? $extra_records->noticePeriod:'' ; $minLen = !empty($extra_records->minLen) ? $extra_records->minLen:'' ; $maxLen = !empty($extra_records->maxLen) ? $extra_records->maxLen:'' ; $i++; echo '
'; //echo ""; echo ""; echo ''; echo "
"; } if($value['component_code'] == 'body_copy'){ echo '
'; echo '
' . $key . '
'; echo "
"; } if($value['component_code'] == 'text_field_mobile'){ echo '
'; echo ''; echo ''; echo "
"; } if($value['component_code'] == 'text_field_email'){ echo '
'; echo ''; echo ''; echo "
"; } if($value['component_code'] == 'two_input_field'){ $firstNameKey = $key; $subArray = $value['sub_arrays']; $secondNameKey = reset($subArray); $twoinpudata = json_decode($value['user_filled_answer'], true); $firstNameVal = $twoinpudata['firstName'] ?? ''; $secondNameVal = $twoinpudata['lastName'] ?? ''; echo '
'; echo ''; echo ''; echo ''; echo ''; echo "
"; } if($value['component_code'] == 'file_uploads'){ echo '
'; echo ''; $fileUpload = json_decode($value['user_filled_answer'], true); if(isset($fileUpload)){ foreach($fileUpload as $fileuploadDet){ $fileuploadLink = $fileuploadDet['file_uploaded_path']; $fileuploadName = $fileuploadDet['file_name']; echo '
'; echo ''; echo '
'; } } echo '
'; } if($value['component_code'] == 'signature_component'){ $signatureCount++; if($signatureCount == 1 && count(array_filter($submittedFormValue, function($v) { return $v['component_code'] == 'signature_component'; })) == 1) { $label = 'Signature'; } else { $label = 'Signature-' . $signatureCount; } echo '
'; echo ''; echo ''; echo "
"; } } } if($prizewon != ''){ echo '
'; echo ''; echo ''; echo "
"; } } // line here echo '
'; echo '
'; echo '
Admin Information
'; if($formUser->mark_as_actioned == 2) { $getActionedUserName = \App\Models\User::getCreatedBy($formUser->actioned_by); $getActionedTime = \App\Helpers\AppHelper::changeTimeZoneByStudio($formUser->updated_at, $studioId); echo '
Mark as actioned by '.$getActionedUserName .' on '.$getActionedTime.'
'; } echo '
'; echo '
Comments:
'; $getComment = \App\Helpers\AppHelper::getComments($studioId, $template->id, $formDetail[0]->user_id ); foreach($getComment as $data) { echo '
'.$data->first_name . ' ' . $data->last_name . ' on ' . $data->converted_created_at . ' - ' . $data->comment.'
'; } @endphp