|
@@ -10,10 +10,13 @@ use App\Models\AppSession;
|
|
|
use App\Models\Client;
|
|
|
use App\Models\Pro;
|
|
|
use App\Models\Bill;
|
|
|
+use App\Models\Survey;
|
|
|
//require_once './class.Diff.php';
|
|
|
use Illuminate\Support\Facades\Http;
|
|
|
use Soundasleep\Html2Text as Html2Text;
|
|
|
+use Illuminate\Support\Facades\File;
|
|
|
|
|
|
+use Illuminate\Support\Facades\View;
|
|
|
|
|
|
if(!function_exists('chargeForCPT')) {
|
|
|
function chargeForCPT($cpt) {
|
|
@@ -1176,4 +1179,19 @@ if(!function_exists('formatAsTitle')) {
|
|
|
$titleCaseString = ucwords(strtolower($cleanString));
|
|
|
return $titleCaseString;
|
|
|
}
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+if(!function_exists('getSurveyData')) {
|
|
|
+ function getSurveyData($survey) {
|
|
|
+ $surveyFormPath = resource_path(Survey::FORM_PATH . '/' . $survey->internal_name . '.blade.php');
|
|
|
+ if(!file_exists($surveyFormPath)) return null;
|
|
|
+
|
|
|
+ $entity = null;
|
|
|
+ if($survey->entity_type === 'Client'){
|
|
|
+ $entity = Client::where('uid', $survey->entity_uid)->first();
|
|
|
+ }
|
|
|
+ $preview = true;
|
|
|
+ $html = (string) view('app.admin.surveys.forms.'.$survey->internal_name, compact('entity', 'survey', 'preview'))->render();
|
|
|
+ return $html;
|
|
|
+ }
|
|
|
+}
|