Changes
This commit is contained in:
parent
79dcf2bb3b
commit
d969c09e2e
|
|
@ -166,7 +166,7 @@ class CampaignController extends Controller
|
|||
|
||||
public function export(Request $request) {
|
||||
$post = $request->except('_token');
|
||||
//$post['export'] = 1;
|
||||
$post['export'] = 1;
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/view', $post, 60);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
//echo '<pre>'; print_r($response); print_r($post); exit;
|
||||
|
|
@ -189,7 +189,7 @@ class CampaignController extends Controller
|
|||
break;
|
||||
|
||||
case 'details':
|
||||
$headers = ['User', 'Employee Code', 'Email', 'Designation', 'Zone', 'Region', "Area", "Territory", "Rank", "Total Units", "Total Points"];
|
||||
$headers = ['User', 'Employee Code', 'Email', 'Designation', 'Manager 1 Name', 'Manager 1 Emp Code', 'Manager 1 Email', 'Manager 2 Name', 'Manager 2 Emp Code', 'Manager 2 Email', 'Zone', 'Region', "Area", "Territory", "Rank", "Total Units", "Total Points"];
|
||||
foreach($response->data->metrics as $metric) {
|
||||
$headers[] = $metric->name . ' Units';
|
||||
$headers[] = $metric->name . ' Points';
|
||||
|
|
@ -202,6 +202,13 @@ class CampaignController extends Controller
|
|||
$row[] = $user->user_info->email;
|
||||
$row[] = $user->user_info->designation;
|
||||
|
||||
$row[] = isset($user->user_info->manager1->name) ? $user->user_info->manager1->name : '-';
|
||||
$row[] = isset($user->user_info->manager1->employee_code) ? $user->user_info->manager1->employee_code : '-';
|
||||
$row[] = isset($user->user_info->manager1->email) ? $user->user_info->manager1->email : '-';
|
||||
$row[] = isset($user->user_info->manager2->name) ? $user->user_info->manager2->name : '-';
|
||||
$row[] = isset($user->user_info->manager2->employee_code) ? $user->user_info->manager2->employee_code : '-';
|
||||
$row[] = isset($user->user_info->manager2->email) ? $user->user_info->manager2->email : '-';
|
||||
|
||||
$row[] = isset($user->user_info->positions->Zone) ? $user->user_info->positions->Zone : '-';
|
||||
$row[] = isset($user->user_info->positions->Region) ? $user->user_info->positions->Region : '-';
|
||||
$row[] = isset($user->user_info->positions->Area) ? $user->user_info->positions->Area : '-';
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ class CampaignreportController extends Controller
|
|||
} else {
|
||||
$token = $request->session()->get('metric_access_key');
|
||||
}
|
||||
|
||||
$post['export'] = 1;
|
||||
$response = LambdaRequest::postrequest($this->_service, $this->_module.'/view', $post, $token);
|
||||
$exceldata = [];
|
||||
if(!isset($post['type'])) {
|
||||
|
|
@ -245,7 +245,7 @@ class CampaignreportController extends Controller
|
|||
break;
|
||||
|
||||
case 'details':
|
||||
$headers = ['User', 'Employee Code', 'Email', 'Designation', 'Zone', 'Region', "Area", "Territory", "Rank", "Total Units", "Total Points"];
|
||||
$headers = ['User', 'Employee Code', 'Email', 'Designation', 'Manager 1 Name', 'Manager 1 Emp Code', 'Manager 1 Email', 'Manager 2 Name', 'Manager 2 Emp Code', 'Manager 2 Email', 'Zone', 'Region', "Area", "Territory", "Rank", "Total Units", "Total Points"];
|
||||
foreach($response->data->metrics as $metric) {
|
||||
$headers[] = $metric->name . ' Units';
|
||||
$headers[] = $metric->name . ' Points';
|
||||
|
|
@ -258,6 +258,13 @@ class CampaignreportController extends Controller
|
|||
$row[] = $user->user_info->email;
|
||||
$row[] = $user->user_info->designation;
|
||||
|
||||
$row[] = isset($user->user_info->manager1->name) ? $user->user_info->manager1->name : '-';
|
||||
$row[] = isset($user->user_info->manager1->employee_code) ? $user->user_info->manager1->employee_code : '-';
|
||||
$row[] = isset($user->user_info->manager1->email) ? $user->user_info->manager1->email : '-';
|
||||
$row[] = isset($user->user_info->manager2->name) ? $user->user_info->manager2->name : '-';
|
||||
$row[] = isset($user->user_info->manager2->employee_code) ? $user->user_info->manager2->employee_code : '-';
|
||||
$row[] = isset($user->user_info->manager2->email) ? $user->user_info->manager2->email : '-';
|
||||
|
||||
$row[] = isset($user->user_info->positions->Zone) ? $user->user_info->positions->Zone : '-';
|
||||
$row[] = isset($user->user_info->positions->Region) ? $user->user_info->positions->Region : '-';
|
||||
$row[] = isset($user->user_info->positions->Area) ? $user->user_info->positions->Area : '-';
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@ class DomainController extends Controller
|
|||
'territory_types' => ['title' => 'Territory Types', 'type' => 'multiselect', 'required' => true, 'values' => $territories ],
|
||||
'logo' => ['title' => 'Group Image or Icon', 'type' => 'image', 'required' => true],
|
||||
'description' => ['title' => 'Description', 'type' => 'textarea', 'required' => true],
|
||||
'use_default_otp' => ['title' => 'Use Default OTP', 'type' => 'select', 'required' => true, 'values' => ['Yes' => 'Yes', 'No' => 'No'] ],
|
||||
'default_otp' => ['title' => 'Default OTP to be used', 'type' => 'number', 'required' => true],
|
||||
|
||||
'terms_text' => ['title' => 'Login Terms & Conditions Text', 'type' => 'textarea', 'required' => true, 'fullwidth' => true],
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@ class FormController extends Controller
|
|||
|
||||
protected function deliverform($formdata, $questions, $id = false) {
|
||||
$additional_info = $this->get_additional_info($formdata);
|
||||
|
||||
// if($formdata->form_id == '1672808391-a35fbd00-fbc8-40a6-ad40-6172011c546e') {
|
||||
// echo '<pre>'; print_r($formdata); print_r($questions); exit;
|
||||
// }
|
||||
//echo '<pre>'; print_r($formdata); print_r($questions); exit;
|
||||
$data = ['questions' => $questions, 'form' => $formdata, 'form_id' => $formdata->form_id, 'id' => false, 'id' => $id ];
|
||||
if(sizeof($additional_info) > 0) {
|
||||
|
|
@ -359,7 +361,21 @@ class FormController extends Controller
|
|||
$post['powerof5_triohale_rx'] = $post['triohale_rx'];
|
||||
}
|
||||
break;
|
||||
|
||||
case '1675171879-850cf63f-864d-42e1-82e7-2a60e92712b6':
|
||||
$post['launched_count'] = [];
|
||||
foreach($post['contact_id'] as $i => $c) {
|
||||
$post['launched_count'][] = $post['launched'][$i] == 'Yes' ? 1 : 0;
|
||||
}
|
||||
break;
|
||||
case '1672051617-b274ae94-8706-4f0f-8e65-6e4380f7c005':
|
||||
case '1673857541-fe4fef4b-6b1c-4326-96ec-f71634ee91db':
|
||||
if($post['is_hridayam_doctor'] == 'Yes') {
|
||||
$rxformdata = $post;
|
||||
$rxformdata['form_id'] = '1672051617-b274ae94-8704-4f0f-8e85-6e4380f7c4543';
|
||||
LambdaRequest::postrequest('form', 'formentity/submitform', ['formdata' => $rxformdata, 'entity_id' => $rxformdata['form_id'], 'user_id' => $user_id, 'partition' => $partition ]);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return $post;
|
||||
|
|
@ -770,7 +786,7 @@ class FormController extends Controller
|
|||
foreach($history->data->submissions as $submission) {
|
||||
$row = [];
|
||||
$row[] = $submission->createdAt;
|
||||
$row[] = $submission->user_info->name;
|
||||
$row[] = isset($submission->user_info->name) ? $submission->user_info->name : '';
|
||||
foreach($history->data->questions as $q => $v) {
|
||||
$row[] = isset($submission->formdata->{$q}) ? $submission->formdata->{$q} : '-';
|
||||
}
|
||||
|
|
@ -886,6 +902,19 @@ class FormController extends Controller
|
|||
if(isset($formdata) && !empty($formdata) && $formdata->user_id != '') {
|
||||
$post = $this->processformdata($formdata->form_id, $post, $formdata->user_id, $formdata->partition);
|
||||
$finfo = LambdaRequest::postrequest('form', 'survey/submitform', ['formdata' => $post, 'entity_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]);
|
||||
|
||||
if($formdata->form_id == '1674212914-9f377f34-4762-4b40-team3-8b282d183332') {
|
||||
unset($post['form_id']);
|
||||
Log::debug(print_r($post, true));
|
||||
echo '<pre>'; print_r($post); exit;
|
||||
$handler = curl_init();
|
||||
curl_setopt($handler, CURLOPT_URL, "https://gnpdoctor.buildrapport.co/neblogisticsave/ciplatodoctor");
|
||||
curl_setopt($handler, CURLOPT_POSTFIELDS, http_build_query($post));
|
||||
curl_setopt($handler, CURLOPT_POST, 1);
|
||||
curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($handler);
|
||||
|
||||
}
|
||||
if($finfo->status == 'success') {
|
||||
return response()->json(['status' => 'success']);
|
||||
} else {
|
||||
|
|
@ -895,4 +924,59 @@ class FormController extends Controller
|
|||
return response()->json(['status' => 'failure']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function quizhandle($finfo, Request $request) {
|
||||
$request->session()->put('finfo', $finfo);
|
||||
$finfo = LambdaRequest::postrequest('form', 'quiz/getforminfo', ['finfo' => $finfo]);
|
||||
//echo '<pre>'; print_r($finfo); exit;
|
||||
$request->session()->put('formdata', $finfo->data->formdata);
|
||||
if($finfo->status == 'success' && $finfo->data->formdata->link_type == 'form') {
|
||||
//return $this->deliverform($finfo->data->formdata, $finfo->data->questions);
|
||||
$formdata = $finfo->data->formdata;
|
||||
$questions = $finfo->data->questions;
|
||||
$data = ['questions' => $questions, 'form' => $formdata, 'form_id' => $formdata->form_id, 'id' => false];
|
||||
if (\View::exists('quiz.'.$formdata->partition.'.'.$formdata->form_id)) {
|
||||
return view('quiz.'.$formdata->partition.'.'.$formdata->form_id)->with($data);
|
||||
} elseif (\View::exists('quiz.'.$formdata->form_id)) {
|
||||
return view('quiz.'.$formdata->form_id)->with($data);
|
||||
} else {
|
||||
// return $data;
|
||||
return view('quiz.common')->with($data);
|
||||
}
|
||||
|
||||
} elseif($finfo->status == 'success' && $finfo->data->formdata->link_type == 'list') {
|
||||
//echo '<pre>'; print_r($finfo->data); exit;
|
||||
if (\View::exists('quiz.list-'.$finfo->data->formdata->form_id)) {
|
||||
return view('quiz.list-'.$finfo->data->formdata->form_id)->with(['questions' => $finfo->data->questions, 'submissions' => $finfo->data->submissions, 'formname' => $finfo->data->formdata->title, 'form_id' => $finfo->data->formdata->form_id, 'lastkey' => $finfo->data->lastkey ]);
|
||||
} else {
|
||||
return view('quiz.list')->with(['questions' => $finfo->data->questions, 'submissions' => $finfo->data->submissions, 'formname' => $finfo->data->formdata->title, 'form_id' => $finfo->data->formdata->form_id, 'lastkey' => $finfo->data->lastkey ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxquizsubmit(Request $request) {
|
||||
$post = $request->except('_token');
|
||||
$formdata = $request->session()->get('formdata');
|
||||
//print_r($formdata); exit;
|
||||
|
||||
|
||||
if(isset($post['user_id']) && $post['user_id'] != '') {
|
||||
$formdata->user_id = $post['user_id'];
|
||||
}
|
||||
if(isset($formdata) && !empty($formdata) && $formdata->user_id != '') {
|
||||
// echo '<pre>'; print_r(['formdata' => $post, 'entity_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]); exit;
|
||||
|
||||
|
||||
$finfo = LambdaRequest::postrequest('form', 'quiz/submitform', ['formdata' => $post, 'entity_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]);
|
||||
//echo '<pre>'; print_r($finfo); exit;
|
||||
if($finfo->status == 'success') {
|
||||
return response()->json(['status' => 'success', 'submission' => $finfo->data->submission]);
|
||||
} else {
|
||||
return response()->json(['status' => 'failure']);
|
||||
}
|
||||
} else {
|
||||
return response()->json(['status' => 'failure']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -51,13 +51,18 @@ class FormactionController extends Controller
|
|||
$forms_dd[$form->id] = $form->title . ' (Survey)';
|
||||
}
|
||||
|
||||
$quizs = $this->getlambda('get', 'form', 'quiz', 'dropdown');
|
||||
foreach($quizs->data->items as $form){
|
||||
$forms_dd[$form->id] = $form->name . ' (Quiz)';
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => ['title' => 'Title', 'type' => 'text', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
'groups' => ['title' => 'Groups', 'type' => 'multiselect', 'required' => true, 'values' => $groups_dd ],
|
||||
'roles' => ['title' => 'Roles', 'type' => 'multiselect', 'required' => true, 'values' => $roles_dd ],
|
||||
|
||||
'target_type' => ['title' => 'Target Type', 'type' => 'select', 'required' => true, 'values' => ['form' => 'Web Form', 'survey' => 'Surveys', 'external' => 'External Webpage', 'nativeform' => 'Native Form (coming soon)'] ],
|
||||
'target_type' => ['title' => 'Target Type', 'type' => 'select', 'required' => true, 'values' => ['form' => 'Web Form', 'survey' => 'Surveys', 'quiz' => 'Quizs', 'external' => 'External Webpage', 'nativeform' => 'Native Form (coming soon)'] ],
|
||||
'form_id' => ['title' => 'Form', 'type' => 'select', 'values' => $forms_dd ],
|
||||
'link_type' => ['title' => 'Menu Type (valid of forms only)', 'type' => 'select', 'required' => true, 'values' => ['form' => 'Web Form', 'list' => 'Submitted Data'] ],
|
||||
'external_url' => ['title' => 'External Url', 'type' => 'text'],
|
||||
|
|
|
|||
|
|
@ -41,6 +41,12 @@ class FormentityController extends Controller
|
|||
foreach($roles->data->items as $role){
|
||||
$roles_dd[$role->id] = $role->name;
|
||||
}
|
||||
|
||||
$coattr = $this->getlambda('get', 'ums', 'contactattribute', 'get_all');
|
||||
$coattr_dd = [];
|
||||
foreach($coattr->data->items as $coatt){
|
||||
$coattr_dd[$coatt->code] = $coatt->attribute;
|
||||
}
|
||||
|
||||
return [
|
||||
'title' => ['title' => 'Title', 'type' => 'text', 'required' => true],
|
||||
|
|
@ -49,7 +55,8 @@ class FormentityController extends Controller
|
|||
'metric_authkey' => ['title' => 'Auth Key', 'type' => 'text', 'required' => true],
|
||||
|
||||
'manager_de_roles' => ['title' => 'Manager Data Entry Roles', 'type' => 'multiselect', 'values' => $roles_dd ],
|
||||
|
||||
'contact_attributes' => ['title' => 'Include Doctor Attributes in Export', 'type' => 'multiselect', 'values' => $coattr_dd],
|
||||
|
||||
'self_notification' => ['title' => 'Self Email Notification', 'type' => 'yesno', 'required' => true, 'fullwidth' => true],
|
||||
'manager1_email_notification' => ['title' => '1st Level Manager Email Notification', 'type' => 'yesno', 'required' => true],
|
||||
'manager1_push_notification' => ['title' => '1st Level Manager Mobile Notification', 'type' => 'yesno', 'required' => true],
|
||||
|
|
@ -62,6 +69,8 @@ class FormentityController extends Controller
|
|||
'approver_can_edit' => ['title' => 'Approver can edit entry', 'type' => 'yesno', 'required' => true],
|
||||
'is_personalized' => ['title' => 'Is Personalization Needed', 'type' => 'yesno', 'required' => true],
|
||||
'workflow_approvers' => ['title' => 'Metric', 'type' => 'mapping', 'required' => true, 'approvers' => $users_dd, 'fullwidth' => true ],
|
||||
|
||||
|
||||
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class FormquestionController extends Controller
|
|||
return [
|
||||
'question' => ['title' => 'Question', 'type' => 'text', 'required' => true, 'fullwidth' => true],
|
||||
'code' => ['title' => 'Code (small caps without spaces and special chars except "_")', 'type' => 'text', 'required' => true],
|
||||
'type' => ['title' => 'Question Type', 'type' => 'select', 'required' => true, 'values' => ['text' => 'Text', 'number' => 'Number', 'date' => 'Date', 'email' => 'Email', 'url' => 'Url', 'dropdown' => 'Dropdown', 'checkbox' => 'Checkbox', 'radio' => 'Radio', 'multitextbox' => 'Multi Text Boxes', 'contacts' => 'Contacts', 'file' => 'File Upload'] ],
|
||||
'type' => ['title' => 'Question Type', 'type' => 'select', 'required' => true, 'values' => ['text' => 'Text', 'number' => 'Number', 'date' => 'Date', 'time' => 'Time', 'email' => 'Email', 'url' => 'Url', 'dropdown' => 'Dropdown', 'checkbox' => 'Checkbox', 'radio' => 'Radio', 'multitextbox' => 'Multi Text Boxes', 'contacts' => 'Contacts', 'file' => 'File Upload'] ],
|
||||
'required' => ['title' => 'Is Required', 'type' => 'yesno', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
'options' => ['title' => 'Options', 'type' => 'mapping', 'fullwidth' => true ],
|
||||
|
|
|
|||
|
|
@ -88,9 +88,41 @@ class MetricreportController extends Controller
|
|||
$exceldata[] = [''];
|
||||
switch($response->data->post->type) {
|
||||
case 'leaderboard':
|
||||
$exceldata[] = ["Rank", "User", "Designation", "Units", "Percent"];
|
||||
$headings = ["Rank", "User", "User Id", "Designation", 'Manager 1 Name', 'Manager 1 Emp Code', 'Manager 1 Email', 'Manager 2 Name', 'Manager 2 Emp Code', 'Manager 2 Email', 'Zone', 'Region', "Area", "Territory", "Units", "Percent", "Active User"];
|
||||
if(count($response->data->graph->values) > 0 && isset($response->data->graph->values[0]->stats->prescribers) ){
|
||||
$headings[] = "Prescribers";
|
||||
}
|
||||
foreach($response->data->graph->metrics as $val) {
|
||||
$headings[] = $val->display;
|
||||
}
|
||||
|
||||
$exceldata[] = $headings;
|
||||
foreach($response->data->graph->values as $val) {
|
||||
$exceldata[] = [(string)$val->rank, (string)$val->user->name, $val->user->designation, (string)round($val->score, 2), (string)$response->data->graph->values[0]->rank != 0 ? ($response->data->graph->values[0]->rank == 1 ? ($response->data->graph->values[0]->score ? ceil(($val->score/$response->data->graph->values[0]->score)*100) : 0) : ($response->data->graph->values[1]->score ? ceil(($val->score/$response->data->graph->values[1]->score)*100) : 0 ) ) : 0 ];
|
||||
$rowdata = [(string)$val->rank, (string)$val->user->name, (string)$val->user->id, $val->user->designation];
|
||||
$user = $val->user;
|
||||
$rowdata[] = isset($user->manager1->name) ? $user->manager1->name : '-';
|
||||
$rowdata[] = isset($user->manager1->employee_code) ? $user->manager1->employee_code : '-';
|
||||
$rowdata[] = isset($user->manager1->email) ? $user->manager1->email : '-';
|
||||
$rowdata[] = isset($user->manager2->name) ? $user->manager2->name : '-';
|
||||
$rowdata[] = isset($user->manager2->employee_code) ? $user->manager2->employee_code : '-';
|
||||
$rowdata[] = isset($user->manager2->email) ? $user->manager2->email : '-';
|
||||
|
||||
$rowdata[] = isset($user->positions->Zone) ? $user->positions->Zone : '-';
|
||||
$rowdata[] = isset($user->positions->Region) ? $user->positions->Region : '-';
|
||||
$rowdata[] = isset($user->positions->Area) ? $user->positions->Area : '-';
|
||||
$rowdata[] = isset($user->positions->Territory) ? $user->positions->Territory : '-';
|
||||
|
||||
$rowdata[] = (string)round($val->score, 2);
|
||||
$rowdata[] = (string)$response->data->graph->values[0]->rank != 0 ? ($response->data->graph->values[0]->rank == 1 ? ($response->data->graph->values[0]->score ? ceil(($val->score/$response->data->graph->values[0]->score)*100) : 0) : ($response->data->graph->values[1]->score ? ceil(($val->score/$response->data->graph->values[1]->score)*100) : 0 ) ) : 0;
|
||||
$rowdata[] = (String)isset($val->stats->ucount) ? $val->stats->ucount:0;
|
||||
|
||||
if(isset($val->stats->prescribers) ) {
|
||||
$rowdata[] = $val->stats->prescribers;
|
||||
}
|
||||
foreach($response->data->graph->metrics as $m) {
|
||||
$rowdata[] = isset($val->stats->{$m->metric}) ? $val->stats->{$m->metric} : 0;
|
||||
}
|
||||
$exceldata[] = $rowdata;
|
||||
}
|
||||
break;
|
||||
case 'trend':
|
||||
|
|
@ -164,7 +196,11 @@ class MetricreportController extends Controller
|
|||
if($response->data->graph->chart == 'contacts') {
|
||||
//echo '<pre>'; print_r($response->data->graph->values); exit;
|
||||
|
||||
$headers = ['Doctor', 'MSL Code', 'User', 'Employee Code', 'Email', 'Designation', 'Manager 1 Name', 'Manager 1 Emp Code', 'Manager 1 Email', 'Manager 2 Name', 'Manager 2 Emp Code', 'Manager 2 Email', 'Zone', 'Region', "Area", "Territory"];
|
||||
$headers = ['Doctor', 'MSL Code'];
|
||||
foreach($response->data->graph->contact_attributes as $attr) {
|
||||
$headers[] = ucwords($attr);
|
||||
}
|
||||
$headers = array_merge($headers, ['User', 'Employee Code', 'Email', 'Designation', 'Manager 1 Name', 'Manager 1 Emp Code', 'Manager 1 Email', 'Manager 2 Name', 'Manager 2 Emp Code', 'Manager 2 Email', 'Zone', 'Region', "Area", "Territory"]);
|
||||
foreach($response->data->graph->values->metrics as $metric) {
|
||||
$headers[] = $metric->metric;
|
||||
}
|
||||
|
|
@ -173,8 +209,12 @@ class MetricreportController extends Controller
|
|||
$row = [];
|
||||
$row[] = $contact->name;
|
||||
$row[] = $contact->msl_code;
|
||||
$user = $response->data->graph->values->users->{$contact->id};
|
||||
|
||||
foreach($response->data->graph->contact_attributes as $attr) {
|
||||
$row[] = isset($contact->{$attr}) ? $contact->{$attr} : '';
|
||||
}
|
||||
|
||||
$user = $response->data->graph->values->users->{$contact->id};
|
||||
$row[] = $user->name;
|
||||
$row[] = $user->employee_code;
|
||||
$row[] = $user->email;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,13 @@ class MetricviewController extends Controller
|
|||
foreach($roles->data->items as $role){
|
||||
$roles_dd[$role->id] = $role->name;
|
||||
}
|
||||
|
||||
|
||||
$coattr = $this->getlambda('get', 'ums', 'contactattribute', 'get_all');
|
||||
$coattr_dd = [];
|
||||
foreach($coattr->data->items as $coatt){
|
||||
$coattr_dd[$coatt->code] = $coatt->attribute;
|
||||
}
|
||||
//echo '<pre>'; print_r($coattr_dd); exit;
|
||||
$fields = [
|
||||
'name' => ['title' => 'Name', 'type' => 'text', 'required' => true],
|
||||
//'type' => ['title' => 'Type', 'type' => 'select', 'required' => true, 'values' => ['simple' => 'Simple', 'grouped' => 'Grouped', 'verses' => 'A vs B'] ],
|
||||
|
|
@ -125,7 +131,9 @@ class MetricviewController extends Controller
|
|||
'report_roles' => ['title' => 'Data Report from Roles', 'type' => 'multiselect', 'values' => $roles_dd, 'required' => true],
|
||||
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
'show_positions' => ['title' => 'Show Position in Reports', 'type' => 'select', 'required' => true, 'values' => ['Yes' => 'Yes', 'No' => 'No'] ],
|
||||
|
||||
'contact_attributes' => ['title' => 'Include Doctor Attributes', 'type' => 'multiselect', 'values' => $coattr_dd],
|
||||
]);
|
||||
|
||||
return $fields;
|
||||
|
|
@ -140,11 +148,12 @@ class MetricviewController extends Controller
|
|||
|
||||
} else {
|
||||
foreach($data['metric'] as $k => $metric) {
|
||||
$data['metrics'][] = ['metric' => $metric, 'display' => $data['display_unit'][$k] ];
|
||||
$data['metrics'][] = ['metric' => $metric, 'display' => $data['display_unit'][$k], 'sort_order' => $data['sort_order'][$k] ];
|
||||
}
|
||||
}
|
||||
unset($data['metric']);
|
||||
unset($data['display_unit']);
|
||||
unset($data['sort_order']);
|
||||
//echo '<pre>'; print_r($data); exit;
|
||||
return $data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,142 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Kreait\Firebase\Factory;
|
||||
use Response;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
|
||||
class QuizController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
protected $_options;
|
||||
protected $_corrects;
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'form';
|
||||
$this->_module = 'quiz';
|
||||
$this->_viewname = 'quiz';
|
||||
$this->_title = 'Quiz';
|
||||
$this->_base_url = '/quiz';
|
||||
}
|
||||
|
||||
protected function get_list_fields(){
|
||||
return [
|
||||
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete', 'submission' => ['icon' => 'form-select', 'querystring' => 'id={ID}'] ] ],
|
||||
'name' => ['title' => 'Name', 'type' => 'text'],
|
||||
'show_score' => ['title' => 'Show Score', 'type' => 'text'],
|
||||
'show_answers' => ['title' => 'Show Answers', 'type' => 'text'],
|
||||
'number_attempts' => ['title' => 'No. of Attempts', 'type' => 'text'],
|
||||
'start_time' => ['title' => 'Start Time', 'type' => 'text'],
|
||||
'end_time' => ['title' => 'End Time', 'type' => 'text'],
|
||||
'status' => ['title' => 'Status', 'type' => 'select'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
protected function get_form_fields($type, $values){
|
||||
return [
|
||||
'name' => ['title' => 'Name', 'type' => 'text', 'required' => true, 'fullwidth' => true],
|
||||
'show_score' => ['title' => 'Show Score', 'type' => 'select', 'required' => true, 'values' => ['Yes' => 'Yes', 'No' => 'No' ]],
|
||||
'show_answers' => ['title' => 'Show Answers', 'type' => 'select', 'required' => true, 'values' => ['Yes' => 'Yes', 'No' => 'No' ]],
|
||||
'limit_attempts' => ['title' => 'Limit Attempts', 'type' => 'select', 'required' => true, 'values' => ['Yes' => 'Yes', 'No' => 'No' ]],
|
||||
'number_attempts' => ['title' => 'No. of attempts', 'type' => 'number', 'required' => true],
|
||||
'start_time' => ['title' => 'Start Time', 'type' => 'datetime', 'required' => true],
|
||||
'end_time' => ['title' => 'End Time', 'type' => 'datetime', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
];
|
||||
}
|
||||
|
||||
public function form($type, $id = null) {
|
||||
$values = [];
|
||||
$questions = [];
|
||||
if($type == 'edit') {
|
||||
$this->_request->session()->put('current_quiz', $id);
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_one', ['id' => $id]);
|
||||
$values = $response->data->item;
|
||||
|
||||
$questions = LambdaRequest::signedrequest('get', $this->_service, 'quizquestion/get_all', ['entity_id' => $id]);
|
||||
$questions = $questions->data->items;
|
||||
}
|
||||
$data = $this->_beforeform($type, $values);
|
||||
$fields = $this->get_form_fields($type, $values);
|
||||
|
||||
return $this->view('form')->with([
|
||||
'title' => $this->_title,
|
||||
'mode' => $type,
|
||||
'fields' => $fields,
|
||||
'base_url' => $this->_base_url,
|
||||
'item' => $values,
|
||||
'questions' => $questions
|
||||
]);
|
||||
}
|
||||
|
||||
public function addquestion($request) {
|
||||
$post = $request->input();
|
||||
$quiz_id = $request->session()->get('current_quiz');
|
||||
return $this->view('question-form')->with('quiz_id', $quiz_id)->with('edit', false);
|
||||
}
|
||||
public function editquestion($request) {
|
||||
$post = $request->input();
|
||||
$quiz_id = $request->session()->get('current_quiz');
|
||||
$question = LambdaRequest::signedrequest('get', $this->_service, 'quizquestion/get_one', ['id' => $post['id']]);
|
||||
$question = $question->data->item;
|
||||
return $this->view('question-form')->with('quiz_id', $quiz_id)->with('edit', true)->with('question', $question);
|
||||
}
|
||||
|
||||
public function postaddquestion($request) {
|
||||
$post = $request->input();
|
||||
$quiz_id = $request->session()->get('current_quiz');
|
||||
$options = [];
|
||||
foreach ($post['options'] as $index => $value) {
|
||||
$options[] = ['option' => $value, 'is_correct' => ($index == $post['correct_ans']) ];
|
||||
}
|
||||
LambdaRequest::signedrequest('post', $this->_service, 'quizquestion/create', ['entity_id' => $quiz_id, 'question' => $post['question'], 'options' => $options]);
|
||||
$message = 'Question added successfully!';
|
||||
return redirect('/quiz/edit?id='.$quiz_id)->with('message', $message);
|
||||
}
|
||||
|
||||
public function posteditquestion($request) {
|
||||
$post = $request->input();
|
||||
//echo '<pre>'; print_r($post); exit;
|
||||
$quiz_id = $request->session()->get('current_quiz');
|
||||
$options = [];
|
||||
foreach ($post['options'] as $index => $value) {
|
||||
$options[] = ['option' => $value, 'is_correct' => ($index == $post['correct_ans']) ];
|
||||
}
|
||||
LambdaRequest::signedrequest('post', $this->_service, 'quizquestion/update', ['id' => $post['id'], 'entity_id' => $quiz_id, 'question' => $post['question'], 'options' => $options]);
|
||||
$message = 'Question added successfully!';
|
||||
return redirect('/quiz/edit?id='.$quiz_id)->with('message', $message);
|
||||
}
|
||||
|
||||
|
||||
public function questions(Request $request) {
|
||||
$entity_id = $request->input('id', 0);
|
||||
if($entity_id === 0) {
|
||||
return redirect('/quizs')->withError('Quiz not found!');
|
||||
} else {
|
||||
$request->session()->put('entity_id', $entity_id);
|
||||
return redirect('/quizquestions');
|
||||
}
|
||||
}
|
||||
|
||||
public function submission(Request $request) {
|
||||
$entity_id = $request->input('id', 0);
|
||||
if($entity_id === 0) {
|
||||
return redirect('/quizs')->withError('Quiz not found!');
|
||||
} else {
|
||||
$request->session()->put('entity_id', $entity_id);
|
||||
return redirect('/quizsubmissions');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use DB;
|
||||
|
||||
class QuizquestionController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'form';
|
||||
$this->_module = 'quizquestion';
|
||||
$this->_viewname = 'quizquestion';
|
||||
$this->_title = 'Quiz Questions';
|
||||
$this->_base_url = '/quizquestion';
|
||||
}
|
||||
|
||||
public function list(Request $request) {
|
||||
$entity_id = $request->session()->get('entity_id');
|
||||
if($entity_id === 0) {
|
||||
return redirect('/quizquestions')->withError('Question not found!');
|
||||
}
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all', ['entity_id' => $entity_id]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
$fields = $this->get_list_fields();
|
||||
return $this->view('list')->with([
|
||||
'title' => $this->_title,
|
||||
'fields' => $fields,
|
||||
'base_url' => $this->_base_url,
|
||||
'items' => $response->data->items,
|
||||
'buttons' => $this->get_list_buttons()
|
||||
]);
|
||||
}
|
||||
|
||||
protected function get_list_buttons() {
|
||||
return [ ['title' => 'Add New', 'link' => $this->_base_url.'/addnew' ], ['title' => 'Back to Quizs', 'link' => '/quizs'] ];
|
||||
}
|
||||
|
||||
protected function get_list_fields(){
|
||||
return [
|
||||
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
|
||||
//'media_thumb' => ['title' => 'Media Thumb', 'type' => 'image'],
|
||||
'question' => ['title' => 'Question', 'type' => 'text'],
|
||||
'status' => ['title' => 'Status', 'type' => 'select'],
|
||||
];
|
||||
}
|
||||
|
||||
protected function get_form_fields($type, $values){
|
||||
$groups = $this->getlambda('get', 'ums', 'group', 'dropdown');
|
||||
$groups_dd = [];
|
||||
foreach($groups->data->items as $group){
|
||||
$groups_dd[$group->id] = $group->name;
|
||||
}
|
||||
return [
|
||||
'question' => ['title' => 'Question', 'type' => 'text', 'required' => true, 'fullwidth' => true],
|
||||
'code' => ['title' => 'Code (small caps without spaces and special chars except "_")', 'type' => 'text', 'required' => true],
|
||||
'type' => ['title' => 'Question Type', 'type' => 'select', 'required' => true, 'values' => ['text' => 'Text', 'number' => 'Number', 'date' => 'Date', 'email' => 'Email', 'url' => 'Url', 'dropdown' => 'Dropdown', 'checkbox' => 'Checkbox', 'radio' => 'Radio', 'radiometrix' => 'RadioMetrix', 'multitextbox' => 'Multi Text Boxes', 'contacts' => 'Contacts', 'file' => 'File Upload'] ],
|
||||
'required' => ['title' => 'Is Required', 'type' => 'yesno', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
'options' => ['title' => 'Options', 'type' => 'mapping', 'fullwidth' => true ],
|
||||
];
|
||||
}
|
||||
|
||||
protected function _beforesave($type, $request) {
|
||||
$data = $request->except('_token');
|
||||
$data['entity_id'] = $request->session()->get('entity_id');
|
||||
$options = [];
|
||||
if(isset($data['option_value'])) {
|
||||
foreach($data['option_value'] as $k => $ov) {
|
||||
$options[] = ['value' => $ov, 'display' => $data['option_name'][$k], 'cost' => $data['option_cost'][$k] ];
|
||||
}
|
||||
$data['options'] = $options;
|
||||
unset($data['option_value']);
|
||||
unset($data['option_name']);
|
||||
unset($data['option_cost']);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function _beforeform($type, $values) {
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use DB;
|
||||
|
||||
use League\Csv\Reader;
|
||||
use Auth;
|
||||
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Exports\InvoicesExport;
|
||||
|
||||
class QuizsubmissionController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'form';
|
||||
$this->_module = 'quiz';
|
||||
$this->_viewname = 'quizsubmission';
|
||||
$this->_title = ' : Submitted Data';
|
||||
$this->_base_url = '/quizsubmission';
|
||||
}
|
||||
|
||||
protected function get_list_buttons()
|
||||
{
|
||||
return [['title' => 'Date Filter', 'link' => '#.'], ['title' => 'Export Excel', 'link' => $this->_base_url . '/export']];
|
||||
}
|
||||
|
||||
public function list(Request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$form_id = $request->session()->get('entity_id');
|
||||
$post = $request->input();
|
||||
if (isset($post['startdate']))
|
||||
$startdate = $post['startdate'];
|
||||
else
|
||||
$startdate = date("Y/m/d", strtotime("-365 day"));
|
||||
|
||||
if (isset($post['enddate']))
|
||||
$enddate = $post['enddate'];
|
||||
else
|
||||
$enddate = date("Y/m/d", strtotime("now") + 86400);
|
||||
|
||||
$reqdata = ["partition" => 'rapport-' . $user->domain, "form_id" => $form_id, "alldata" => true, "date_range" => $startdate . '_' . $enddate];
|
||||
$request->session()->put('formdata_request', $reqdata);
|
||||
//echo '<pre>'; print_r($reqdata); exit;
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module . '/getformhistory', $reqdata);
|
||||
if ($response->statusCode == 401) {
|
||||
return redirect('/unauthorised');
|
||||
}
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
$fields = [
|
||||
'user' => ['title' => 'Submitted By', 'type' => 'text'],
|
||||
'date' => ['title' => 'Record Date', 'type' => 'text'],
|
||||
'sdate' => ['title' => 'Submitted On', 'type' => 'text'],
|
||||
'total_questions' => ['title' => 'Total Questions', 'type' => 'text'],
|
||||
'correct_answers' => ['title' => 'Correct Answers', 'type' => 'text'],
|
||||
'time_taken' => ['title' => 'Time Taken (in Sec)', 'type' => 'text'],
|
||||
];
|
||||
foreach ($response->data->questions as $qid => $question) {
|
||||
$fields['field_' . $qid] = ['title' => $question->label, 'type' => 'text'];
|
||||
}
|
||||
//echo '<pre>';
|
||||
// print_r($fields);
|
||||
// exit;
|
||||
$items = [];
|
||||
// print_r($response->data->questions);
|
||||
|
||||
//echo '<pre>'; print_r($response->data->submissions); exit;
|
||||
|
||||
foreach ($response->data->submissions as $submission) {
|
||||
$item = ['user' => $submission->user_info->name,
|
||||
'date' => date("d M Y", strtotime($submission->record_date)),
|
||||
'sdate' => date("d M Y", strtotime($submission->createdAt)),
|
||||
'total_questions' => $submission->total_questions,
|
||||
'correct_answers' => $submission->correct_answers,
|
||||
'time_taken' => $submission->time_taken,
|
||||
];
|
||||
foreach ($response->data->questions as $qid => $question) {
|
||||
$item['field_' . $qid] = $submission->formdata->{$qid} ? 'Correct' : 'Incorrect';
|
||||
}
|
||||
$items[] = (object)$item;
|
||||
}
|
||||
//echo '<pre>'; print_r($items); exit;
|
||||
|
||||
return $this->view('list')->with([
|
||||
'title' => $response->data->formname . $this->_title,
|
||||
'fields' => $fields,
|
||||
'base_url' => $this->_base_url,
|
||||
'items' => $items,
|
||||
'buttons' => $this->get_list_buttons(),
|
||||
'startdate' => $startdate,
|
||||
'enddate' => $enddate
|
||||
]);
|
||||
}
|
||||
|
||||
public function export(Request $request)
|
||||
{
|
||||
$reqdata = $request->session()->get('formdata_request');
|
||||
//$reqdata = ["partition" => 'rapport-vitalis1', "form_id" => '1650365457-c86bd7f2-a33c-49a5-9671-3c2511b57f3b', "alldata" => true, "date_range" => '2022/_'.$enddate ];
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module . '/getformhistory', $reqdata);
|
||||
//echo '<pre>'; print_r($reqdata); print_r($response); exit;
|
||||
$fields = ['Submitted By', 'User identification', 'Email', 'Employee Code', 'Record Date', 'Submitted On', 'Total Questions', 'Correct Answers', 'Time Taken (in Sec)'];
|
||||
foreach ($response->data->questions as $qid => $question) {
|
||||
$fields[] = $question->label;
|
||||
}
|
||||
list($startdate, $enddate) = explode('_', $reqdata['date_range']);
|
||||
$exceldata = [];
|
||||
$exceldata[] = [ucwords($response->data->formname . $this->_title) . ' Report'];
|
||||
$exceldata[] = ['Start Date: ' . date("d M Y", strtotime($startdate))];
|
||||
$exceldata[] = ['End Date: ' . date("d M Y", strtotime($enddate))];
|
||||
$exceldata[] = [''];
|
||||
$exceldata[] = $fields;
|
||||
|
||||
foreach ($response->data->submissions as $submission) {
|
||||
$item = [$submission->user_info->name,
|
||||
$submission->user_info->id,
|
||||
$submission->email,
|
||||
$submission->employee_code,
|
||||
date("d M Y", strtotime($submission->record_date)),
|
||||
date("d M Y", strtotime($submission->createdAt)),
|
||||
$submission->total_questions,
|
||||
$submission->correct_answers,
|
||||
$submission->time_taken,
|
||||
];
|
||||
foreach ($response->data->questions as $qid => $question) {
|
||||
$item[] = $submission->formdata->{$qid} ? 'Correct' : 'Incorrect';
|
||||
}
|
||||
$exceldata[] = $item;
|
||||
}
|
||||
return Excel::download(new InvoicesExport($exceldata), 'report.xlsx');
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ class SurveysubmissionController extends Controller
|
|||
if (isset($post['startdate']))
|
||||
$startdate = $post['startdate'];
|
||||
else
|
||||
$startdate = date("Y/m/d", strtotime("-1 day"));
|
||||
$startdate = date("Y/m/d", strtotime("-365 day"));
|
||||
|
||||
if (isset($post['enddate']))
|
||||
$enddate = $post['enddate'];
|
||||
|
|
@ -69,15 +69,59 @@ class SurveysubmissionController extends Controller
|
|||
foreach ($response->data->submissions as $submission) {
|
||||
$item = ['user' => $submission->user_info->name, 'date' => date("d M Y", strtotime($submission->record_date)), 'sdate' => date("d M Y", strtotime($submission->createdAt))];
|
||||
foreach ($response->data->questions as $qid => $question) {
|
||||
if ($question->type == 'radiometrix') {
|
||||
$rm = [];
|
||||
foreach ($submission->formdata->$qid as $key => $val) {
|
||||
$rm[] = $key . ':' . $val;
|
||||
}
|
||||
$item['field_' . $qid] = implode(', ', $rm);
|
||||
} else {
|
||||
$item['field_' . $qid] = count((array)$question->options) > 0 && isset($question->options->{$submission->formdata->{$qid}}) ? $question->options->{$submission->formdata->{$qid}} : $submission->formdata->{$qid};
|
||||
//print_r($submission->formdata->{$qid});
|
||||
|
||||
switch($question->type) {
|
||||
case 'text':
|
||||
case 'date':
|
||||
$item['field_' . $qid] = isset($submission->formdata->{$qid}) ? $submission->formdata->{$qid} : '';
|
||||
break;
|
||||
case 'dropdown':
|
||||
case 'radio':
|
||||
$item['field_' . $qid] = isset($submission->formdata->{$qid}) ? (isset($question->options->{$submission->formdata->{$qid}}) ? $question->options->{$submission->formdata->{$qid}} : '') : '';
|
||||
break;
|
||||
case 'checkbox':
|
||||
$item['field_' . $qid] = isset($submission->formdata->{$qid}) ? ( is_array($submission->formdata->{$qid}) ? implode(',', $submission->formdata->{$qid}) : $submission->formdata->{$qid} ) : '';
|
||||
$item['field_' . $qid] = explode(',', $item['field_' . $qid]);
|
||||
foreach($item['field_' . $qid] as &$v) {
|
||||
$v = (isset($question->options->{$v}) ? $question->options->{$v} : '');
|
||||
}
|
||||
$item['field_' . $qid] = implode(', ', $item['field_' . $qid]);
|
||||
|
||||
//$item['field_' . $qid] = array_map(function($v) { return (isset($question->options->{$v}) ? $question->options->{$v} : ''); } , $item['field_' . $qid] );
|
||||
|
||||
break;
|
||||
case 'radiometrix':
|
||||
if(isset($submission->formdata->{$qid}) && is_object($submission->formdata->{$qid})) {
|
||||
$rm = [];
|
||||
foreach ($submission->formdata->$qid as $key => $val) {
|
||||
$rm[] = $key . ':' . $val;
|
||||
}
|
||||
$item['field_' . $qid] = implode(' , ', $rm);
|
||||
} else {
|
||||
$item['field_' . $qid] = '';
|
||||
}
|
||||
|
||||
|
||||
//echo '<pre>'; print_r($submission->formdata->{$qid}); echo '</pre>';
|
||||
break;
|
||||
default:
|
||||
if ($question->type == 'radiometrix') {
|
||||
$rm = [];
|
||||
// foreach ($submission->formdata->$qid as $key => $val) {
|
||||
// $rm[] = $key . ':' . $val;
|
||||
// }
|
||||
// $item['field_' . $qid] = implode(', ', $rm);
|
||||
$item['field_' . $qid] = $question->type;
|
||||
} else {
|
||||
//$item['field_' . $qid] = count((array)$question->options) > 0 && isset($question->options->{$submission->formdata->{$qid}}) ? $question->options->{$submission->formdata->{$qid}} : $submission->formdata->{$qid};
|
||||
$item['field_' . $qid] = $question->type;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
$items[] = (object)$item;
|
||||
}
|
||||
|
|
@ -101,10 +145,29 @@ class SurveysubmissionController extends Controller
|
|||
$reqdata = $request->session()->get('formdata_request');
|
||||
//$reqdata = ["partition" => 'rapport-vitalis1', "form_id" => '1650365457-c86bd7f2-a33c-49a5-9671-3c2511b57f3b', "alldata" => true, "date_range" => '2022/_'.$enddate ];
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module . '/getformhistory', $reqdata);
|
||||
$fields = ['Submitted By', 'User identification', 'Record Date', 'Submitted On'];
|
||||
$fields = ['Submitted By', 'User identification', 'Email', 'Employee Code', 'Record Date', 'Submitted On'];
|
||||
$fieldoptions = ['', '', '', '', '', ''];
|
||||
foreach ($response->data->questions as $qid => $question) {
|
||||
$fields[] = $question->label;
|
||||
if($question->type == 'radiometrix') {
|
||||
$count = 0;
|
||||
foreach($question->orig_options as $opv) {
|
||||
$fieldoptions[] = $opv->display;
|
||||
if($count > 0) $fields[] = '';
|
||||
$count++;
|
||||
}
|
||||
} else if($question->type == 'checkbox') {
|
||||
$count = 0;
|
||||
foreach($question->options as $opk => $opv) {
|
||||
$fieldoptions[] = $opv;
|
||||
if($count > 0) $fields[] = '';
|
||||
$count++;
|
||||
}
|
||||
} else {
|
||||
$fieldoptions[] = '';
|
||||
}
|
||||
}
|
||||
//echo '<pre>'; print_r($fields); print_r($fieldoptions); exit;
|
||||
list($startdate, $enddate) = explode('_', $reqdata['date_range']);
|
||||
$exceldata = [];
|
||||
$exceldata[] = [ucwords($response->data->formname . $this->_title) . ' Report'];
|
||||
|
|
@ -112,11 +175,73 @@ class SurveysubmissionController extends Controller
|
|||
$exceldata[] = ['End Date: ' . date("d M Y", strtotime($enddate))];
|
||||
$exceldata[] = [''];
|
||||
$exceldata[] = $fields;
|
||||
$exceldata[] = $fieldoptions;
|
||||
|
||||
foreach ($response->data->submissions as $submission) {
|
||||
$item = [$submission->user_info->name, $submission->user_info->id, date("d M Y", strtotime($submission->record_date)), date("d M Y", strtotime($submission->createdAt))];
|
||||
$item = [$submission->user_info->name,
|
||||
$submission->user_info->id,
|
||||
$submission->email,
|
||||
$submission->employee_code,
|
||||
date("d M Y", strtotime($submission->record_date)),
|
||||
date("d M Y", strtotime($submission->createdAt))];
|
||||
foreach ($response->data->questions as $qid => $question) {
|
||||
$item[] = $submission->formdata->{$qid};
|
||||
//$item[] = $submission->formdata->{$qid};
|
||||
switch($question->type) {
|
||||
case 'text':
|
||||
case 'date':
|
||||
$item[] = isset($submission->formdata->{$qid}) ? $submission->formdata->{$qid} : '';
|
||||
break;
|
||||
case 'dropdown':
|
||||
case 'radio':
|
||||
$opts = array_values((array)$question->options);
|
||||
$item[] = isset($submission->formdata->{$qid}) ? (isset($question->options->{$submission->formdata->{$qid}}) ? $question->options->{$submission->formdata->{$qid}} : ( $submission->formdata->{$qid} == 'on' ? $opts[0] : '') ) : '';
|
||||
break;
|
||||
case 'checkbox':
|
||||
foreach($question->options as $opk => $opv) {
|
||||
$item[] = isset($submission->formdata->{$qid}) ? ( is_array($submission->formdata->{$qid}) ? (in_array($opk,$submission->formdata->{$qid}) ? 'Yes' : '' ) : $submission->formdata->{$qid} ) : '';
|
||||
}
|
||||
|
||||
// $it = isset($submission->formdata->{$qid}) ? ( is_array($submission->formdata->{$qid}) ? implode(',', $submission->formdata->{$qid}) : $submission->formdata->{$qid} ) : '';
|
||||
// $it = explode(',', $it);
|
||||
// foreach($it as &$v) {
|
||||
// $v = (isset($question->options->{$v}) ? $question->options->{$v} : '');
|
||||
// }
|
||||
// $item[] = implode(', ', $it);
|
||||
|
||||
//$item['field_' . $qid] = array_map(function($v) { return (isset($question->options->{$v}) ? $question->options->{$v} : ''); } , $item['field_' . $qid] );
|
||||
|
||||
break;
|
||||
case 'radiometrix':
|
||||
foreach($question->orig_options as $opv) {
|
||||
if(isset($submission->formdata->{$qid}) && is_object($submission->formdata->{$qid})) {
|
||||
// $rm = [];
|
||||
// foreach ($submission->formdata->$qid as $key => $val) {
|
||||
// $rm[] = $key . ':' . $val;
|
||||
// }
|
||||
// $item[] = implode(' , ', $rm);
|
||||
$item[] = isset($submission->formdata->{$qid}->{$opv->display}) ? $submission->formdata->{$qid}->{$opv->display} : '';
|
||||
} else {
|
||||
$item[] = '';
|
||||
}
|
||||
}
|
||||
|
||||
//echo '<pre>'; print_r($submission->formdata->{$qid}); echo '</pre>';
|
||||
break;
|
||||
default:
|
||||
if ($question->type == 'radiometrix') {
|
||||
$rm = [];
|
||||
// foreach ($submission->formdata->$qid as $key => $val) {
|
||||
// $rm[] = $key . ':' . $val;
|
||||
// }
|
||||
// $item['field_' . $qid] = implode(', ', $rm);
|
||||
$item['field_' . $qid] = $question->type;
|
||||
} else {
|
||||
//$item['field_' . $qid] = count((array)$question->options) > 0 && isset($question->options->{$submission->formdata->{$qid}}) ? $question->options->{$submission->formdata->{$qid}} : $submission->formdata->{$qid};
|
||||
$item['field_' . $qid] = $question->type;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
$exceldata[] = $item;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ class LambdaRequest
|
|||
public static function postrequest($service, $url, $params, $token = '') {
|
||||
$params['application'] = 'rapport';
|
||||
$fullurl = self::genurl($service, $url);
|
||||
if(self::REMOTE_ENV != 'local' && $service == 'form' && $url == 'formentity/getformhistory') {
|
||||
$fullurl = 'https://sgrmuxa46z7xfouezyvg3tnhnq0yptjn.lambda-url.ap-south-1.on.aws/';
|
||||
}
|
||||
if($token == '') {
|
||||
$response = Http::post($fullurl, $params);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,415 @@
|
|||
/*Copyright (c) 2019 Jason Zissman
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
(function (root, factory) {
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
// CommonJS
|
||||
return module.exports = factory();
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
// AMD
|
||||
define([], function () {
|
||||
return (root.TimeMe = factory());
|
||||
});
|
||||
} else {
|
||||
// Global Variables
|
||||
return root.TimeMe = factory();
|
||||
}
|
||||
})(this, function () {
|
||||
|
||||
var TimeMe = {
|
||||
|
||||
startStopTimes: {},
|
||||
idleTimeoutMs: 30 * 1000,
|
||||
currentIdleTimeMs: 0,
|
||||
checkStateRateMs: 250,
|
||||
active: false, // state if we are actively recording time
|
||||
idle: false, // state if user on page but not interacting
|
||||
currentPageName: "default-page-name",
|
||||
timeElapsedCallbacks: [],
|
||||
userLeftCallbacks: [],
|
||||
userReturnCallbacks: [],
|
||||
|
||||
trackTimeOnElement: function (elementId) {
|
||||
var element = document.getElementById(elementId);
|
||||
if (element) {
|
||||
element.addEventListener("mouseover", function () {
|
||||
TimeMe.startTimer(elementId);
|
||||
});
|
||||
element.addEventListener("mousemove", function () {
|
||||
TimeMe.startTimer(elementId);
|
||||
});
|
||||
element.addEventListener("mouseleave", function () {
|
||||
TimeMe.stopTimer(elementId);
|
||||
});
|
||||
element.addEventListener("keypress", function () {
|
||||
TimeMe.startTimer(elementId);
|
||||
});
|
||||
element.addEventListener("focus", function () {
|
||||
TimeMe.startTimer(elementId);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
getTimeOnElementInSeconds: function (elementId) {
|
||||
var time = TimeMe.getTimeOnPageInSeconds(elementId);
|
||||
if (time) {
|
||||
return time;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
|
||||
// startTime is optional. If provided, must be of type Date(). By providing
|
||||
// startTime, you are overriding the internal timing mechanism and manually
|
||||
// indicating the start time.
|
||||
startTimer: function (pageName, startTime) {
|
||||
if (!pageName) {
|
||||
pageName = TimeMe.currentPageName;
|
||||
}
|
||||
|
||||
if (TimeMe.startStopTimes[pageName] === undefined) {
|
||||
TimeMe.startStopTimes[pageName] = [];
|
||||
} else {
|
||||
var arrayOfTimes = TimeMe.startStopTimes[pageName];
|
||||
var latestStartStopEntry = arrayOfTimes[arrayOfTimes.length - 1];
|
||||
if (latestStartStopEntry !== undefined && latestStartStopEntry.stopTime === undefined) {
|
||||
// Can't start new timer until previous finishes.
|
||||
return;
|
||||
}
|
||||
}
|
||||
TimeMe.startStopTimes[pageName].push({
|
||||
"startTime": startTime || new Date(),
|
||||
"stopTime": undefined
|
||||
});
|
||||
TimeMe.active = true;
|
||||
TimeMe.idle = false;
|
||||
},
|
||||
|
||||
stopAllTimers: function () {
|
||||
var pageNames = Object.keys(TimeMe.startStopTimes);
|
||||
for (var i = 0; i < pageNames.length; i++) {
|
||||
TimeMe.stopTimer(pageNames[i]);
|
||||
}
|
||||
},
|
||||
|
||||
// stopTime is optional. If provided, must be of type Date(). By providing
|
||||
// stopTime, you are overriding the internal timing mechanism and manually
|
||||
// indicating the stop time.
|
||||
stopTimer: function (pageName, stopTime) {
|
||||
if (!pageName) {
|
||||
pageName = TimeMe.currentPageName;
|
||||
}
|
||||
var arrayOfTimes = TimeMe.startStopTimes[pageName];
|
||||
if (arrayOfTimes === undefined || arrayOfTimes.length === 0) {
|
||||
// Can't stop timer before you've started it.
|
||||
return;
|
||||
}
|
||||
if (arrayOfTimes[arrayOfTimes.length - 1].stopTime === undefined) {
|
||||
arrayOfTimes[arrayOfTimes.length - 1].stopTime = stopTime || new Date();
|
||||
}
|
||||
TimeMe.active = false;
|
||||
},
|
||||
|
||||
getTimeOnCurrentPageInSeconds: function () {
|
||||
return TimeMe.getTimeOnPageInSeconds(TimeMe.currentPageName);
|
||||
},
|
||||
|
||||
getTimeOnPageInSeconds: function (pageName) {
|
||||
var timeInMs = TimeMe.getTimeOnPageInMilliseconds(pageName);
|
||||
if (timeInMs === undefined) {
|
||||
return undefined;
|
||||
} else {
|
||||
return timeInMs / 1000;
|
||||
}
|
||||
},
|
||||
|
||||
getTimeOnCurrentPageInMilliseconds: function () {
|
||||
return TimeMe.getTimeOnPageInMilliseconds(TimeMe.currentPageName);
|
||||
},
|
||||
|
||||
getTimeOnPageInMilliseconds: function (pageName) {
|
||||
|
||||
var totalTimeOnPage = 0;
|
||||
|
||||
var arrayOfTimes = TimeMe.startStopTimes[pageName];
|
||||
if (arrayOfTimes === undefined) {
|
||||
// Can't get time on page before you've started the timer.
|
||||
return;
|
||||
}
|
||||
|
||||
var timeSpentOnPageInSeconds = 0;
|
||||
for (var i = 0; i < arrayOfTimes.length; i++) {
|
||||
var startTime = arrayOfTimes[i].startTime;
|
||||
var stopTime = arrayOfTimes[i].stopTime;
|
||||
if (stopTime === undefined) {
|
||||
stopTime = new Date();
|
||||
}
|
||||
var difference = stopTime - startTime;
|
||||
timeSpentOnPageInSeconds += (difference);
|
||||
}
|
||||
|
||||
totalTimeOnPage = Number(timeSpentOnPageInSeconds);
|
||||
return totalTimeOnPage;
|
||||
},
|
||||
|
||||
getTimeOnAllPagesInSeconds: function () {
|
||||
var allTimes = [];
|
||||
var pageNames = Object.keys(TimeMe.startStopTimes);
|
||||
for (var i = 0; i < pageNames.length; i++) {
|
||||
var pageName = pageNames[i];
|
||||
var timeOnPage = TimeMe.getTimeOnPageInSeconds(pageName);
|
||||
allTimes.push({
|
||||
"pageName": pageName,
|
||||
"timeOnPage": timeOnPage
|
||||
});
|
||||
}
|
||||
return allTimes;
|
||||
},
|
||||
|
||||
setIdleDurationInSeconds: function (duration) {
|
||||
var durationFloat = parseFloat(duration);
|
||||
if (isNaN(durationFloat) === false) {
|
||||
TimeMe.idleTimeoutMs = duration * 1000;
|
||||
} else {
|
||||
throw {
|
||||
name: "InvalidDurationException",
|
||||
message: "An invalid duration time (" + duration + ") was provided."
|
||||
};
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
setCurrentPageName: function (pageName) {
|
||||
TimeMe.currentPageName = pageName;
|
||||
return this;
|
||||
},
|
||||
|
||||
resetRecordedPageTime: function (pageName) {
|
||||
delete TimeMe.startStopTimes[pageName];
|
||||
},
|
||||
|
||||
resetAllRecordedPageTimes: function () {
|
||||
var pageNames = Object.keys(TimeMe.startStopTimes);
|
||||
for (var i = 0; i < pageNames.length; i++) {
|
||||
TimeMe.resetRecordedPageTime(pageNames[i]);
|
||||
}
|
||||
},
|
||||
|
||||
resetIdleCountdown: function () {
|
||||
if (TimeMe.idle) {
|
||||
TimeMe.triggerUserHasReturned();
|
||||
}
|
||||
TimeMe.idle = false;
|
||||
TimeMe.currentIdleTimeMs = 0;
|
||||
},
|
||||
|
||||
callWhenUserLeaves: function (callback, numberOfTimesToInvoke) {
|
||||
this.userLeftCallbacks.push({
|
||||
callback: callback,
|
||||
numberOfTimesToInvoke: numberOfTimesToInvoke
|
||||
})
|
||||
},
|
||||
|
||||
callWhenUserReturns: function (callback, numberOfTimesToInvoke) {
|
||||
this.userReturnCallbacks.push({
|
||||
callback: callback,
|
||||
numberOfTimesToInvoke: numberOfTimesToInvoke
|
||||
})
|
||||
},
|
||||
|
||||
triggerUserHasReturned: function () {
|
||||
if (!TimeMe.active) {
|
||||
for (var i = 0; i < this.userReturnCallbacks.length; i++) {
|
||||
var userReturnedCallback = this.userReturnCallbacks[i];
|
||||
var numberTimes = userReturnedCallback.numberOfTimesToInvoke;
|
||||
if (isNaN(numberTimes) || (numberTimes === undefined) || numberTimes > 0) {
|
||||
userReturnedCallback.numberOfTimesToInvoke -= 1;
|
||||
userReturnedCallback.callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
TimeMe.startTimer();
|
||||
},
|
||||
|
||||
triggerUserHasLeftPage: function () {
|
||||
if (TimeMe.active) {
|
||||
for (var i = 0; i < this.userLeftCallbacks.length; i++) {
|
||||
var userHasLeftCallback = this.userLeftCallbacks[i];
|
||||
var numberTimes = userHasLeftCallback.numberOfTimesToInvoke;
|
||||
if (isNaN(numberTimes) || (numberTimes === undefined) || numberTimes > 0) {
|
||||
userHasLeftCallback.numberOfTimesToInvoke -= 1;
|
||||
userHasLeftCallback.callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
TimeMe.stopAllTimers();
|
||||
},
|
||||
|
||||
callAfterTimeElapsedInSeconds: function (timeInSeconds, callback) {
|
||||
TimeMe.timeElapsedCallbacks.push({
|
||||
timeInSeconds: timeInSeconds,
|
||||
callback: callback,
|
||||
pending: true
|
||||
});
|
||||
},
|
||||
|
||||
checkState: function () {
|
||||
for (var i = 0; i < TimeMe.timeElapsedCallbacks.length; i++) {
|
||||
if (TimeMe.timeElapsedCallbacks[i].pending && TimeMe.getTimeOnCurrentPageInSeconds() > TimeMe.timeElapsedCallbacks[i].timeInSeconds) {
|
||||
TimeMe.timeElapsedCallbacks[i].callback();
|
||||
TimeMe.timeElapsedCallbacks[i].pending = false;
|
||||
}
|
||||
}
|
||||
if (TimeMe.idle === false && TimeMe.currentIdleTimeMs > TimeMe.idleTimeoutMs) {
|
||||
TimeMe.idle = true;
|
||||
TimeMe.triggerUserHasLeftPage();
|
||||
} else {
|
||||
TimeMe.currentIdleTimeMs += TimeMe.checkStateRateMs;
|
||||
}
|
||||
},
|
||||
|
||||
visibilityChangeEventName: undefined,
|
||||
hiddenPropName: undefined,
|
||||
|
||||
listenForVisibilityEvents: function () {
|
||||
|
||||
if (typeof document.hidden !== "undefined") {
|
||||
TimeMe.hiddenPropName = "hidden";
|
||||
TimeMe.visibilityChangeEventName = "visibilitychange";
|
||||
} else if (typeof document.mozHidden !== "undefined") {
|
||||
TimeMe.hiddenPropName = "mozHidden";
|
||||
TimeMe.visibilityChangeEventName = "mozvisibilitychange";
|
||||
} else if (typeof document.msHidden !== "undefined") {
|
||||
TimeMe.hiddenPropName = "msHidden";
|
||||
TimeMe.visibilityChangeEventName = "msvisibilitychange";
|
||||
} else if (typeof document.webkitHidden !== "undefined") {
|
||||
TimeMe.hiddenPropName = "webkitHidden";
|
||||
TimeMe.visibilityChangeEventName = "webkitvisibilitychange";
|
||||
}
|
||||
|
||||
document.addEventListener(TimeMe.visibilityChangeEventName, function () {
|
||||
if (document[TimeMe.hiddenPropName]) {
|
||||
TimeMe.triggerUserHasLeftPage();
|
||||
} else {
|
||||
TimeMe.triggerUserHasReturned();
|
||||
}
|
||||
}, false);
|
||||
|
||||
window.addEventListener('blur', function () {
|
||||
TimeMe.triggerUserHasLeftPage();
|
||||
});
|
||||
|
||||
window.addEventListener('focus', function () {
|
||||
TimeMe.triggerUserHasReturned();
|
||||
});
|
||||
|
||||
document.addEventListener("mousemove", function () { TimeMe.resetIdleCountdown(); });
|
||||
document.addEventListener("keyup", function () { TimeMe.resetIdleCountdown(); });
|
||||
document.addEventListener("touchstart", function () { TimeMe.resetIdleCountdown(); });
|
||||
window.addEventListener("scroll", function () { TimeMe.resetIdleCountdown(); });
|
||||
|
||||
setInterval(function () {
|
||||
TimeMe.checkState();
|
||||
}, TimeMe.checkStateRateMs);
|
||||
},
|
||||
|
||||
websocket: undefined,
|
||||
|
||||
websocketHost: undefined,
|
||||
|
||||
setUpWebsocket: function (websocketOptions) {
|
||||
if (window.WebSocket && websocketOptions) {
|
||||
var websocketHost = websocketOptions.websocketHost; // "ws://hostname:port"
|
||||
try {
|
||||
TimeMe.websocket = new WebSocket(websocketHost);
|
||||
window.onbeforeunload = function (event) {
|
||||
TimeMe.sendCurrentTime(websocketOptions.appId);
|
||||
};
|
||||
TimeMe.websocket.onopen = function () {
|
||||
TimeMe.sendInitWsRequest(websocketOptions.appId);
|
||||
}
|
||||
TimeMe.websocket.onerror = function (error) {
|
||||
if (console) {
|
||||
console.log("Error occurred in websocket connection: " + error);
|
||||
}
|
||||
}
|
||||
TimeMe.websocket.onmessage = function (event) {
|
||||
if (console) {
|
||||
console.log(event.data);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (console) {
|
||||
console.error("Failed to connect to websocket host. Error:" + error);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
websocketSend: function (data) {
|
||||
TimeMe.websocket.send(JSON.stringify(data));
|
||||
},
|
||||
|
||||
sendCurrentTime: function (appId) {
|
||||
var timeSpentOnPage = TimeMe.getTimeOnCurrentPageInMilliseconds();
|
||||
var data = {
|
||||
type: "INSERT_TIME",
|
||||
appId: appId,
|
||||
timeOnPageMs: timeSpentOnPage,
|
||||
pageName: TimeMe.currentPageName
|
||||
};
|
||||
TimeMe.websocketSend(data);
|
||||
},
|
||||
sendInitWsRequest: function (appId) {
|
||||
var data = {
|
||||
type: "INIT",
|
||||
appId: appId
|
||||
};
|
||||
TimeMe.websocketSend(data);
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
|
||||
var idleTimeoutInSeconds = TimeMe.idleTimeoutMs || 30;
|
||||
var currentPageName = TimeMe.currentPageName || "default-page-name";
|
||||
var websocketOptions = undefined;
|
||||
var initialStartTime = undefined;
|
||||
|
||||
if (options) {
|
||||
idleTimeoutInSeconds = options.idleTimeoutInSeconds || idleTimeoutInSeconds;
|
||||
currentPageName = options.currentPageName || currentPageName;
|
||||
websocketOptions = options.websocketOptions;
|
||||
initialStartTime = options.initialStartTime;
|
||||
}
|
||||
|
||||
TimeMe.setIdleDurationInSeconds(idleTimeoutInSeconds)
|
||||
.setCurrentPageName(currentPageName)
|
||||
.setUpWebsocket(websocketOptions)
|
||||
.listenForVisibilityEvents();
|
||||
|
||||
// TODO - only do this if page currently visible.
|
||||
|
||||
TimeMe.startTimer(undefined, initialStartTime);
|
||||
}
|
||||
};
|
||||
return TimeMe;
|
||||
});
|
||||
}).call(this);
|
||||
|
|
@ -153,12 +153,13 @@
|
|||
</div> <!-- end collapse-->
|
||||
@break
|
||||
@case($post->type == 'myteam')
|
||||
@if(isset($users) && isset($users[0]->level))
|
||||
<div class="btn-group mb-2">
|
||||
<button type="button" class="btn btn-info leaderboard-prev" {{isset($post->level) && $base_level==$post->level?'disabled':''}}><i class="mdi mdi-play mdi-rotate-180 mdi-18px"></i></button>
|
||||
<button type="button" class="btn btn-info">Level {{$users[0]->level}}</button>
|
||||
<button type="button" class="btn btn-info leaderboard-next" {{$users[0]->level==1?'disabled':''}}><i class="mdi mdi-play mdi-18px"></i></button>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
<div id="cardCollpase4" class="collapse pt-3 show">
|
||||
<div class="table-responsive">
|
||||
@if(isset($users))
|
||||
|
|
@ -288,7 +289,7 @@
|
|||
window.location.href = href.toString()
|
||||
});
|
||||
|
||||
@if($post->type == 'leaderboard' || $post->type == 'myteam')
|
||||
@if(isset($users) && isset($users[0]->level) && $post->type == 'leaderboard' || $post->type == 'myteam')
|
||||
$('.leaderboard-next').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let href = new URL(window.location.href);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,99 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Dashboard", "mode" => $mode ?? "", "demo" => $demo ?? ""])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{asset('assets/libs/flatpickr/flatpickr.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/selectize/selectize.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<!-- third party css end -->
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<h4 class="page-title">Team Members</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row" id="graph-wrapper">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"></h4>
|
||||
<ul class="nav nav-pills navtab-bg nav-justified" role="tablist">
|
||||
@php
|
||||
$firstdone = true;
|
||||
@endphp
|
||||
@foreach($teams as $team)
|
||||
<li class="nav-item" role="presentation">
|
||||
<a href="#tab-{{$team->team_details->id}}" data-bs-toggle="tab" aria-expanded="false" class="nav-link {{$firstdone ? 'active':''}}" aria-selected="true" role="tab">
|
||||
{{$team->team_details->name}}
|
||||
</a>
|
||||
</li>
|
||||
@php
|
||||
$firstdone = false;
|
||||
@endphp
|
||||
@endforeach
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
@php
|
||||
$firstdone = true;
|
||||
@endphp
|
||||
@foreach($teams as $team)
|
||||
<div class="tab-pane {{$firstdone ? 'active':''}}" id="tab-{{$team->team_details->id}}" role="tabpanel">
|
||||
<h4>{{$team->team_details->name}}</h4>
|
||||
<p>{{$team->team_details->description}}</p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
||||
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Employee Code</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($team->players as $player)
|
||||
<tr>
|
||||
<td><h5 class="m-0 fw-normal">{{$player->name}}</h5></td>
|
||||
<td>{{$player->employee_code}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@php
|
||||
$firstdone = false;
|
||||
@endphp
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- container -->
|
||||
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<!-- third party js -->
|
||||
|
||||
<!-- third party js ends -->
|
||||
|
||||
|
||||
|
||||
|
||||
@endsection
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
<link href="{{asset('assets/libs/multiselect/multiselect.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ URL::asset('assets/libs/dropify/dropify.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/flatpickr/flatpickr.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<!-- third party css end -->
|
||||
@endsection
|
||||
|
||||
|
|
@ -53,7 +54,7 @@
|
|||
<input type="text" id="field-{{$field}}" name="{{$field}}" class="form-control" placeholder="Enter {{$props['title']}}" value="{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}" data-provide="datepicker" data-date-format="mm-dd-yyyy" data-date-autoclose="true" {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
@break
|
||||
@case('datetime')
|
||||
<input type="text" id="field-{{$field}}" name="{{$field}}" class="form-control" placeholder="Enter {{$props['title']}}" value="{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}" data-provide="datepicker" data-date-format="mm-dd-yyyy" data-date-autoclose="true" {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
<input type="text" id="field-{{$field}}" name="{{$field}}" class="form-control datetime" placeholder="Enter {{$props['title']}}" value="{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}" {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$field}}" name="{{$field}}" class="form-control" placeholder="Enter {{$props['title']}}" {{isset($props['required'])&&$props['required']?'required':'' }}>{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}</textarea>
|
||||
|
|
@ -150,6 +151,8 @@
|
|||
<script src="{{asset('assets/libs/multiselect/jquery.quicksearch.js')}}"></script>
|
||||
<script src="{{ URL::asset('assets/libs/dropify/dropify.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/flatpickr/flatpickr.min.js')}}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('[data-toggle="select2"]').select2();
|
||||
|
|
@ -165,6 +168,11 @@
|
|||
}
|
||||
});
|
||||
|
||||
$('.datetime').flatpickr({
|
||||
enableTime: true,
|
||||
dateFormat: "Y-m-d H:i"
|
||||
});
|
||||
|
||||
$('.bigmultiselect').multiSelect({
|
||||
selectableHeader: "<div class='custom-header'><strong>Selectable</strong></div><input type='text' class='form-control' autocomplete='off' placeholder='Search Selectable'>",
|
||||
selectionHeader: "<div class='custom-header'><strong>Selected</strong></div><input type='text' class='form-control' autocomplete='off' placeholder='Search Selected'>",
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@
|
|||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?hierarchy='+hierarchy,
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
|
|
@ -162,6 +162,7 @@
|
|||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="'+ $('#field-select_doctor_activity').val() +'" value="1">')
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
@endif
|
||||
|
||||
@php
|
||||
$start = strtotime("1 May 2021");
|
||||
$start = strtotime("1 Jan 2023");
|
||||
$till = strtotime("now");
|
||||
if( request()->get('record_date') ) {
|
||||
$target = strtotime(request()->get('record_date'));
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
$contacts = [];
|
||||
if(sizeof($history->data->submissions) > 0) {
|
||||
foreach($history->data->submissions as $sub){
|
||||
$contacts[$sub->formdata->contact_id] = ['id' => $sub->id, 'units' => $sub->formdata->units ];
|
||||
$contacts[$sub->formdata->contact_id] = ['id' => $sub->id, 'units' => isset($sub->formdata->units) ? $sub->formdata->units : 0 ];
|
||||
}
|
||||
}
|
||||
//echo '<pre>';print_r($history);print_r($contacts);echo '</pre>';
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-date" class="form-label">Date<span class="text-danger">*</span></label>
|
||||
<input type="date" id="field-date" name="date" class="form-control" required value="{{ (sizeof($contacts) > 0 ) ? $history->data->submissions[0]->formdata->date : '' }}">
|
||||
<input type="date" id="field-date" name="date" class="form-control" required value="{{ (sizeof($contacts) > 0 ) ? $history->data->submissions[1]->formdata->date : '' }}">
|
||||
</div>
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-record_date" class="form-label">Month<span class="text-danger">*</span></label>
|
||||
|
|
@ -91,16 +91,16 @@
|
|||
<input type="hidden" name="id[]" value="{{$contacts[$doctor->display]['id']}}">
|
||||
@endif
|
||||
<input type="hidden" name="contact_id[]" value="{{$doctor->value}}">
|
||||
<input type="hidden" name="brand[]" value="{{$doctor->contact->brand}}">
|
||||
<input type="hidden" name="brand[]" value="{{isset($doctor->contact->brand) ? $doctor->contact->brand : ''}}">
|
||||
<tr>
|
||||
<td>{{$doctor->display}}</td>
|
||||
<td style="min-width: 100px;">
|
||||
<input type="number" id="" name="units[]" class="form-control" required value="{{ (sizeof($contacts)>0 && isset($contacts[$doctor->display]) ) ? $contacts[$doctor->display]['units'] : '' }}">
|
||||
<input type="number" id="" name="units[]" class="form-control" required value="{{ (sizeof($contacts)>0 && isset($contacts[$doctor->display]) ) ? $contacts[$doctor->display]['units'] : '0' }}">
|
||||
</td>
|
||||
<td>{{$doctor->contact->brand}}</td>
|
||||
<td>{{$doctor->contact->speciality}}</td>
|
||||
<td>{{$doctor->contact->hospital}}</td>
|
||||
<td>{{$doctor->contact->city}}</td>
|
||||
<td>{{isset($doctor->contact->brand) ? $doctor->contact->brand : ''}}</td>
|
||||
<td>{{isset($doctor->contact->speciality) ? $doctor->contact->speciality : ''}}</td>
|
||||
<td>{{isset($doctor->contact->hospital) ? $doctor->contact->hospital : ''}}</td>
|
||||
<td>{{isset($doctor->contact->city) ? $doctor->contact->city : ''}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
|
@ -146,6 +147,7 @@
|
|||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/flatpickr/flatpickr.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="/images/loader-large.gif" alt="processing..." />
|
||||
|
|
@ -98,8 +99,10 @@
|
|||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} {{ $question->code == 'camp_date' ? 'min="'.date("Y-m-d", strtotime("now")+604800).'"':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control datepicker" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
|
|
@ -224,6 +227,7 @@
|
|||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/flatpickr/flatpickr.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#form-wrapper').hide()
|
||||
|
|
@ -273,6 +277,22 @@
|
|||
parseInt( $('#execution-hba1c_telma_ln_range_rx').val() ) )
|
||||
})
|
||||
|
||||
document.getElementById("field-camp_date").min = "{{date("Y-m-d", strtotime("now")+604800)}}";
|
||||
|
||||
// $('#field-camp_date').change(function(event){
|
||||
// let seldate = new Date($('#field-camp_date').val())
|
||||
// let mindate = new Date();
|
||||
// mindate.setDate(mindate.getDate() + 7);
|
||||
// if(seldate < mindate) {
|
||||
// alert( "Please select Camp date greater than " + mindate.toDateString() )
|
||||
// $('#field-camp_date').val( mindate.toISOString().split('T')[0] )
|
||||
// }
|
||||
// })
|
||||
|
||||
// $('.datepicker').flatpickr({
|
||||
// dateFormat: "m-d-Y"
|
||||
// });
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,202 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="'+ $('#field-brand_name').val() +'" value="'+ $('#field-current_business_value_pm').val() +'">')
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,207 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}} {!!$question->code=='contact_id'?'campaign="'.(isset($option->contact->campaign)?$option->contact->campaign:'').'"':''!!} >{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#field-campaign').prop('readonly', true)
|
||||
$('#field-contact_id').change(function(){
|
||||
$('#field-campaign').val( $('option:selected', this).attr('campaign') )
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,212 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$start = strtotime("1 May 2021");
|
||||
$till = strtotime("now");
|
||||
if( request()->get('record_date') ) {
|
||||
$target = strtotime(request()->get('record_date'));
|
||||
} else {
|
||||
$target = strtotime("now");
|
||||
}
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id, date("m-01-Y", $start) , date("m-t-Y", $target) );
|
||||
$contacts = [];
|
||||
if(sizeof($history->data->submissions) > 0) {
|
||||
foreach($history->data->submissions as $sub){
|
||||
$contacts[$sub->formdata->contact_id] = ['id' => $sub->id, 'launched' => $sub->formdata->launched, 'record_date' => $sub->formdata->record_date ];
|
||||
}
|
||||
}
|
||||
//echo '<pre>';print_r($contacts);echo '</pre>';
|
||||
@endphp
|
||||
|
||||
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
|
||||
<div class="col-md-12 mb-2">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-hover table-nowrap table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Doctor Name</th>
|
||||
<th>Launched</th>
|
||||
<th>Launche Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($questions[0]->options as $doctor)
|
||||
@if(sizeof($contacts) > 0 && isset($contacts[$doctor->display]) )
|
||||
<input type="hidden" name="id[]" value="{{$contacts[$doctor->display]['id']}}">
|
||||
@endif
|
||||
<input type="hidden" name="contact_id[]" value="{{$doctor->value}}">
|
||||
<tr>
|
||||
<td>{{$doctor->display}}</td>
|
||||
<td>
|
||||
@if(sizeof($contacts) > 0 && isset($contacts[$doctor->display]) )
|
||||
<select class="form-control launched-field" name="launched[]">
|
||||
<option value=""> -- Select -- </option>
|
||||
<option value="Yes" {{$contacts[$doctor->display]['launched']=='Yes'?'selected':''}}> Yes </option>
|
||||
<option value="No" {{$contacts[$doctor->display]['launched']=='No'?'selected':''}}> No </option>
|
||||
</select>
|
||||
@else
|
||||
<select class="form-control launched-field" name="launched[]">
|
||||
<option value=""> -- Select -- </option>
|
||||
<option value="Yes"> Yes </option>
|
||||
<option value="No"> No </option>
|
||||
</select>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if(sizeof($contacts) > 0 && isset($contacts[$doctor->display]) )
|
||||
<input type="date" name="record_date[]" class="form-control data-field" value="{{$contacts[$doctor->display]['record_date']}}">
|
||||
@else
|
||||
<input type="date" name="record_date[]" class="form-control data-field">
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('.launched-field').change(function(){
|
||||
if($(this).val() == 'Yes') {
|
||||
$(this).parent().parent().find('.data-field').prop('required', true)
|
||||
} else {
|
||||
$(this).parent().parent().find('.data-field').removeAttr('required')
|
||||
}
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmitmultiple',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -48,6 +48,7 @@
|
|||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
|
@ -56,7 +57,7 @@
|
|||
@php
|
||||
$options = [];
|
||||
foreach($question->options as $ops) {
|
||||
if(!isset($ops->contact->type)) {
|
||||
if(!isset($ops->contact->type) || $ops->contact->type == 'doctor') {
|
||||
$options[] = $ops;
|
||||
}
|
||||
}
|
||||
|
|
@ -169,6 +170,7 @@
|
|||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
|
@ -56,7 +57,7 @@
|
|||
@php
|
||||
$options = [];
|
||||
foreach($question->options as $ops) {
|
||||
if(!isset($ops->contact->type)) {
|
||||
if(!isset($ops->contact->type) || $ops->contact->type == 'doctor') {
|
||||
$options[] = $ops;
|
||||
}
|
||||
}
|
||||
|
|
@ -157,6 +158,7 @@
|
|||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
|
@ -157,6 +158,7 @@
|
|||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
|
@ -56,7 +57,7 @@
|
|||
@php
|
||||
$options = [];
|
||||
foreach($question->options as $ops) {
|
||||
if(!isset($ops->contact->type)) {
|
||||
if(!isset($ops->contact->type) || $ops->contact->type == 'doctor') {
|
||||
$options[] = $ops;
|
||||
}
|
||||
}
|
||||
|
|
@ -157,6 +158,7 @@
|
|||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,213 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#field-total_qty').prop('readonly', true)
|
||||
$('#field-emsita_trio_chemist_avail,#field-emsita_trio_forte_chemist_avail,#field-emsita_chemist_avail,#field-eml_chemist_avail,#field-emlm_chemist_avail').change(function(){
|
||||
$('#field-total_qty').val( parseInt($('#field-emsita_trio_chemist_avail').val()) +
|
||||
parseInt($('#field-emsita_trio_forte_chemist_avail').val()) +
|
||||
parseInt($('#field-emsita_chemist_avail').val()) +
|
||||
parseInt($('#field-eml_chemist_avail').val()) +
|
||||
parseInt($('#field-emlm_chemist_avail').val())
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="'+ $('#field-brand_name').val() +'" value="'+ $('#field-current_business_value_pm').val() +'">')
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#field-total_qty').prop('readonly', true)
|
||||
$('#field-emsita_trio_stockiest_order,#field-emsita_trio_forte_stockiest_order,#field-eml_stockiest_order,#field-emlm_stockiest_order').change(function(){
|
||||
$('#field-total_qty').val( parseInt($('#field-emsita_trio_stockiest_order').val()) + parseInt($('#field-emsita_trio_forte_stockiest_order').val()) + parseInt($('#field-eml_stockiest_order').val()) + parseInt($('#field-emlm_stockiest_order').val()) )
|
||||
})
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
@case('time')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}} {{ $question->code == 'contact_id' ? ' msl_code='.$option->contact->msl_code :'' }}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#field-doctor_uid_no').prop('readonly', true);
|
||||
$('#field-contact_id').change(function(){
|
||||
$('#field-doctor_uid_no').val( $('option:selected', this).attr('msl_code') )
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,204 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$('#report-form').append('<input type="hidden" name="activity_CME" value="'+ ($('#field-activity_type').val()=='CME'?'1':'0') +'">')
|
||||
$('#report-form').append('<input type="hidden" name="activity_RTM" value="'+ ($('#field-activity_type').val()=='RTM'?'1':'0') +'">')
|
||||
$('#report-form').append('<input type="hidden" name="activity_Nutritional_Club_Meet" value="'+ ($('#field-activity_type').val()=='Nutritional_Club_Meet'?'1':'0') +'">')
|
||||
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,202 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$('#report-form').append('<input type="hidden" name="hinex_total_1kg" value="'+ ( parseInt($('#field-hinex_hp_1kg').val()) + parseInt($('#field-hinex_dm_1kg').val()) ) +'">')
|
||||
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$start = strtotime("1 May 2021");
|
||||
$till = strtotime("now");
|
||||
if( request()->get('record_date') ) {
|
||||
$target = strtotime(request()->get('record_date'));
|
||||
} else {
|
||||
$target = strtotime("now");
|
||||
}
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id, date("m-01-Y", $target) , date("m-t-Y", $target) );
|
||||
$contacts = [];
|
||||
if(sizeof($history->data->submissions) > 0) {
|
||||
foreach($history->data->submissions as $sub){
|
||||
$contacts[$sub->formdata->contact_id] = ['id' => $sub->id, 'indamet_80_rx' => isset($sub->formdata->indamet_80_rx) ? $sub->formdata->indamet_80_rx : 0, 'indamet_160_rx' => isset($sub->formdata->indamet_160_rx) ? $sub->formdata->indamet_160_rx : 0, 'indamet_320_rx' => isset($sub->formdata->indamet_320_rx) ? $sub->formdata->indamet_320_rx : 0 ];
|
||||
}
|
||||
}
|
||||
//echo '<pre>';print_r($contacts);echo '</pre>'; exit;
|
||||
@endphp
|
||||
|
||||
<form method="POST" action="/form/submitmultiple" id="report-form">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-date" class="form-label">Date<span class="text-danger">*</span></label>
|
||||
<input type="date" id="field-date" name="date" class="form-control" required value="{{ (sizeof($contacts) > 0 ) ? $history->data->submissions[1]->formdata->date : '' }}">
|
||||
</div>
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-record_date" class="form-label">Month<span class="text-danger">*</span></label>
|
||||
<select id="field-record_date" name="record_date" class="form-control" required>
|
||||
@while ($start < $till)
|
||||
<option value="{{ date("M Y", $start) }}" {{ date("M Y", $target)==date("M Y", $start)?'selected':'' }} >{{ date("M Y", $start) }}</option>
|
||||
{{ $start = $start = $start + 60*60*24*(date("t", $start)) }}
|
||||
@endwhile
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mb-2">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-hover table-nowrap table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Doctor Name</th>
|
||||
<th>Indamet 80</th>
|
||||
<th>Indamet 160</th>
|
||||
<th>Indamet 320</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($questions[2]->options as $doctor)
|
||||
@if(sizeof($contacts) > 0 && isset($contacts[$doctor->display]) )
|
||||
<input type="hidden" name="id[]" value="{{$contacts[$doctor->display]['id']}}">
|
||||
@endif
|
||||
<input type="hidden" name="contact_id[]" value="{{$doctor->value}}">
|
||||
<input type="hidden" name="brand[]" value="{{isset($doctor->contact->brand) ? $doctor->contact->brand : ''}}">
|
||||
<tr>
|
||||
<td>{{$doctor->display}}</td>
|
||||
<td style="min-width: 100px;">
|
||||
<input type="number" id="" name="indamet_80_rx[]" class="form-control" required value="{{ (sizeof($contacts)>0 && isset($contacts[$doctor->display]) ) ? $contacts[$doctor->display]['indamet_80_rx'] : '0' }}">
|
||||
</td>
|
||||
<td style="min-width: 100px;">
|
||||
<input type="number" id="" name="indamet_160_rx[]" class="form-control" required value="{{ (sizeof($contacts)>0 && isset($contacts[$doctor->display]) ) ? $contacts[$doctor->display]['indamet_160_rx'] : '0' }}">
|
||||
</td>
|
||||
<td style="min-width: 100px;">
|
||||
<input type="number" id="" name="indamet_320_rx[]" class="form-control" required value="{{ (sizeof($contacts)>0 && isset($contacts[$doctor->display]) ) ? $contacts[$doctor->display]['indamet_320_rx'] : '0' }}">
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmitmultiple',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('#field-record_date').change(function(){
|
||||
window.location.href = window.location.href.split('?')[0] + '?record_date=' + $(this).val()
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -43,7 +43,6 @@
|
|||
}
|
||||
@endphp
|
||||
|
||||
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-6">
|
||||
@if($form->link_type == 'form')
|
||||
|
|
|
|||
|
|
@ -0,0 +1,204 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="'+ $('#field-select_brand').val() +'" value="'+ $('#field-no_of_rxn_existing').val() +'">')
|
||||
$('#report-form').append('<input type="hidden" name="new_'+ $('#field-select_brand').val() +'" value="'+ $('#field-no_of_rxn_new').val() +'">')
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,204 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="'+ $('#field-select_brand').val() +'" value="'+ $('#field-no_of_rxn_existing').val() +'">')
|
||||
$('#report-form').append('<input type="hidden" name="new_'+ $('#field-select_brand').val() +'" value="'+ $('#field-no_of_rxn_new').val() +'">')
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -138,6 +138,7 @@
|
|||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#report-form').append('<input type="hidden" name="'+ $('#field-select_doctor_activity').val() +'" value="1">')
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
|
|
|
|||
|
|
@ -294,6 +294,7 @@
|
|||
in_array('all_data_access', $permissions) ||
|
||||
in_array('formproduct_get_all', $permissions) ||
|
||||
in_array('formexports_get_all', $permissions) ||
|
||||
in_array('quiz_get_all', $permissions) ||
|
||||
in_array('all_data_access', $permissions) )
|
||||
|
||||
<li>
|
||||
|
|
@ -314,18 +315,23 @@
|
|||
<a href="/surveys">Survey</a>
|
||||
</li>
|
||||
@endif
|
||||
@if(in_array('quiz_get_all', $permissions))
|
||||
<li>
|
||||
<a href="/quizs">Quiz</a>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if(in_array('formaction_get_all', $permissions))
|
||||
<li>
|
||||
<a href="/formactions">Quick Action</a>
|
||||
</li>
|
||||
@endif
|
||||
@if(in_array('all_data_access', $permissions))
|
||||
@if(in_array('formexports_get_all', $permissions))
|
||||
<li>
|
||||
<a href="/formdatas">Form Data</a>
|
||||
</li>
|
||||
@endif
|
||||
@if(in_array('formexports_get_all', $permissions) || in_array('all_data_access', $permissions) )
|
||||
@if(in_array('formexports_get_all', $permissions) )
|
||||
<li>
|
||||
<a href="/formexports">Form Data Export</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -127,9 +127,6 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</div> <!-- .table-responsive -->
|
||||
|
||||
|
||||
|
||||
</div> <!-- end collapse-->
|
||||
@break
|
||||
@case($graph->type == 'simple' && $post['type'] == 'trend' && $graph->chart == 'tabular')
|
||||
|
|
|
|||
|
|
@ -61,16 +61,20 @@
|
|||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="row mb-3">
|
||||
<label for="period" class="col-6 col-xl-5 col-form-label">Select Period</label>
|
||||
<div class="col-6 col-xl-7">
|
||||
<label for="period" class="col-3 col-form-label">Period</label>
|
||||
<div class="col-9">
|
||||
<select class="form-control" id="period" name="period">
|
||||
@foreach($periods as $v)
|
||||
<option value="{{$v->value}}" {{$post['period'] == $v->value ? "selected":""}}>{{$v->label}}</option>
|
||||
@endforeach
|
||||
<option value="custom-date" {{$post['period'] == $v->value ? "selected":""}}>Custom Date</option>
|
||||
<option value="custom-date" {{$post['period'] == 'custom-date' ? "selected":""}}>Custom Date</option>
|
||||
</select>
|
||||
@php
|
||||
$dates = isset($post['dates'])?explode('--', $post['dates']):["",""];
|
||||
@endphp
|
||||
<div class="input-group input-group-sm" id="period-daterange-wrapper">
|
||||
<input type="text" class="form-control border" id="period-daterange">
|
||||
<input type="text" class="form-control border datetime" id="period-startdate" value="{{ $dates[0] }}">
|
||||
<input type="text" class="form-control border datetime" id="period-enddate" value="{{ $dates[1] }}">
|
||||
<span class="input-group-text bg-blue border-blue text-white" id="custom-date-submit">
|
||||
<i class="mdi mdi-arrow-right-bold"></i>
|
||||
</span>
|
||||
|
|
@ -120,6 +124,9 @@
|
|||
<th>Total</th>
|
||||
<!-- <th>Percent</th> -->
|
||||
<th>Active User</th>
|
||||
@if(count($graph->values) > 0 && isset($graph->values[0]->stats->prescribers) )
|
||||
<th>Prescribers</th>
|
||||
@endif
|
||||
@foreach($graph->metrics as $val)
|
||||
<th>{{$val->display}}</th>
|
||||
@endforeach
|
||||
|
|
@ -143,6 +150,9 @@
|
|||
<td>{{round($val->score, 2)}}</td>
|
||||
<!-- <td>{{$graph->values[0]->rank != 0 ? ($graph->values[0]->rank == 1 ? ($graph->values[0]->score ? ceil(($val->score/$graph->values[0]->score)*100) : 0) : ($graph->values[1]->score ? ceil(($val->score/$graph->values[1]->score)*100) : 0 ) ) : 0 }}%</td> -->
|
||||
<td>{{ isset($val->stats->ucount) ? $val->stats->ucount : '0' }}</td>
|
||||
@if(isset($val->stats->prescribers) )
|
||||
<td>{{ $val->stats->prescribers }}</td>
|
||||
@endif
|
||||
@foreach($graph->metrics as $m)
|
||||
<td>{{ isset($val->stats->{$m->metric}) ? $val->stats->{$m->metric} : '-' }}</td>
|
||||
@endforeach
|
||||
|
|
@ -215,10 +225,12 @@
|
|||
<tr>
|
||||
<th colspan="2">User</th>
|
||||
<th>Employee Code</th>
|
||||
@if(!isset($graph->show_positions) || (isset($graph->show_positions) && $graph->show_positions))
|
||||
<th>Zone</th>
|
||||
<th>Region</th>
|
||||
<th>Area</th>
|
||||
<th>Territory</th>
|
||||
@endif
|
||||
<th>Role</th>
|
||||
@foreach($graph->values->metrics as $metric)
|
||||
<th>{{$metric->metric}}</th>
|
||||
|
|
@ -231,10 +243,12 @@
|
|||
<td><img src="{{isset($user->avatar) ? $user->avatar : ''}}" class="avatar-sm rounded-circle"></td>
|
||||
<td>{{ $user->name }} <br/>{{$user->designation}}</td>
|
||||
<td>{{ isset($user->employee_code) ? $user->employee_code:''}}</td>
|
||||
@if(!isset($graph->show_positions) || (isset($graph->show_positions) && $graph->show_positions))
|
||||
<td>{{ isset($user->positions->Zone) ? $user->positions->Zone : '-' }}</td>
|
||||
<td>{{ isset($user->positions->Region) ? $user->positions->Region : '-' }}</td>
|
||||
<td>{{ isset($user->positions->Area) ? $user->positions->Area : '-' }}</td>
|
||||
<td>{{ isset($user->positions->Territory) ? $user->positions->Territory : '-' }}</td>
|
||||
@endif
|
||||
<td>{{ isset($user->roles) ? (is_array($user->roles) ? implode(',', $user->roles) : $user->roles) : '-' }}</td>
|
||||
@foreach($graph->values->metrics as $metric)
|
||||
<td>{{ isset($metric->stats->{$user->id}) ? $metric->stats->{$user->id} : '-' }}</th>
|
||||
|
|
@ -256,6 +270,9 @@
|
|||
<tr>
|
||||
<th>Doctor</th>
|
||||
<th>MSL Code</th>
|
||||
@foreach($graph->contact_attributes as $attr)
|
||||
<th>{{ucwords($attr)}}</th>
|
||||
@endforeach
|
||||
<th>User</th>
|
||||
<th>Employee Code</th>
|
||||
<th>Zone</th>
|
||||
|
|
@ -272,6 +289,9 @@
|
|||
<tr>
|
||||
<td>{{ $contact->name }}</td>
|
||||
<td>{{ $contact->msl_code }}</td>
|
||||
@foreach($graph->contact_attributes as $attr)
|
||||
<td>{{ isset($contact->{$attr}) ? $contact->{$attr} : '' }}</td>
|
||||
@endforeach
|
||||
@php
|
||||
$user = $graph->values->users->{$contact->id};
|
||||
@endphp
|
||||
|
|
@ -391,7 +411,9 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
@if($post['period'] != 'custom-date')
|
||||
$('#period-daterange-wrapper').hide()
|
||||
@endif
|
||||
$('#period').change(function(){
|
||||
if($(this).val() == 'custom-date') {
|
||||
$('#period-daterange-wrapper').show()
|
||||
|
|
@ -405,6 +427,10 @@
|
|||
}
|
||||
});
|
||||
|
||||
$('.datetime').flatpickr({
|
||||
dateFormat: "Y-m-d"
|
||||
});
|
||||
|
||||
$('#period-daterange').flatpickr({
|
||||
altInput: true,
|
||||
mode: "range",
|
||||
|
|
@ -417,7 +443,7 @@
|
|||
let href = new URL(window.location.href);
|
||||
href.searchParams.delete('refresh')
|
||||
href.searchParams.set('period', $('#period').val() );
|
||||
href.searchParams.set('dates', $('#period-daterange').val().replace(" to ", "--"))
|
||||
href.searchParams.set('dates', $('#period-startdate').val() + "--" + $('#period-enddate').val() )
|
||||
window.location.href = href.toString()
|
||||
})
|
||||
|
||||
|
|
@ -428,6 +454,9 @@
|
|||
let href = new URL(document.location.origin + $(this).attr('href'));
|
||||
href.searchParams.delete('refresh')
|
||||
href.searchParams.set('period', $('#period').val() );
|
||||
if($('#period').val() == 'custom-date'){
|
||||
href.searchParams.set('dates', $('#period-startdate').val() + "--" + $('#period-enddate').val() )
|
||||
}
|
||||
window.location.href = href.toString()
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
<select class="form-control" id="field-{{$field}}" name="{{$field}}" {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
<option value=""> -- Select {{$props['title']}} -- </option>
|
||||
@foreach($props['values'] as $k => $v)
|
||||
<option value="{{$k}}" {{$mode=='edit' && $item->{$field} == $k ? 'selected="selected"':''}}>{{$v}}</option>
|
||||
<option value="{{$k}}" {{$mode=='edit' && isset($item->{$field}) && $item->{$field} == $k ? 'selected="selected"':''}}>{{$v}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
|
|
@ -111,6 +111,7 @@
|
|||
<tr>
|
||||
<th>Metric</th>
|
||||
<th>Display Unit</th>
|
||||
<th>Sort Order</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -126,6 +127,7 @@
|
|||
</select>
|
||||
</td>
|
||||
<td><input type="text" name="display_unit[]" class="form-control" value="{{$map->display}}"></td>
|
||||
<td><input type="number" name="sort_order[]" class="form-control" value="{{isset($map->sort_order)?$map->sort_order:0}}"></td>
|
||||
<th><button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button></th>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
|
@ -140,6 +142,7 @@
|
|||
</select>
|
||||
</td>
|
||||
<td><input type="text" name="display_unit[]" class="form-control" value=""></td>
|
||||
<td><input type="number" name="sort_order[]" class="form-control" value=""></td>
|
||||
<th><button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button></th>
|
||||
</tr>
|
||||
@endif
|
||||
|
|
@ -198,6 +201,7 @@
|
|||
</select>
|
||||
</td>
|
||||
<td><input type="text" name="display_unit[]" class="form-control" value=""></td>
|
||||
<td><input type="number" name="sort_order[]" class="form-control" value=""></td>
|
||||
<th><button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button></th>
|
||||
</tr>`);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,193 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => 'Form'])
|
||||
@include('layouts.shared/head-css', ['mode' => $mode ?? '', 'demo' => $demo ?? ''])
|
||||
<link href="{{ asset('assets/libs/sweetalert2/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row form-body">
|
||||
|
||||
@if (Session::has('error'))
|
||||
<div class="alert alert-danger">{{ Session::get('error') }}</div>
|
||||
<br>
|
||||
@endif
|
||||
@if (session('success'))
|
||||
<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>
|
||||
@endif
|
||||
<div class="col-12">
|
||||
<h4 class="page-title">{{ $form->name }}</h4>
|
||||
</div>
|
||||
@if($form->limit_attempts == 'Yes' && $form->number_attempts <= $form->existing_attempts)
|
||||
<h4 class="header-title mt-3"> You have already submitted the Quiz for the maximum number of times allowed. </h4>
|
||||
<h5 class="header-title mt-3"> Allowed attempts: {{$form->number_attempts}} </h5>
|
||||
<h5 class="header-title mt-3"> Attempts done: {{$form->existing_attempts}} </h5>
|
||||
@elseif(strtotime($form->start_time) <= strtotime("now")+(19800) && strtotime($form->end_time) >= strtotime("now")+(19800) )
|
||||
<form method="POST" action="/form/submit" id="quiz-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form->id}}">
|
||||
<input type="hidden" name="time_taken" id="time_taken" value="">
|
||||
@csrf
|
||||
|
||||
@php
|
||||
$qc = 1;
|
||||
$ols = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
|
||||
@endphp
|
||||
@foreach ($questions as $question)
|
||||
<h4 class="header-title mt-3">{{$qc}}) {{ $question->question }}</h4>
|
||||
@php
|
||||
$ac = 0;
|
||||
@endphp
|
||||
@foreach($question->options as $ans)
|
||||
<div class="radio radio-success mb-2">
|
||||
<input type="radio" name="answer[{{$question->id}}]" id="answer_{{$question->id}}_{{$ac}}" value="{{$ac}}" {{$ac==0?'required':''}}>
|
||||
<label for="answer_{{$question->id}}_{{$ac}}">
|
||||
{{$ols[$ac]}}) {{$ans->option}}
|
||||
</label>
|
||||
</div>
|
||||
@php
|
||||
$ac++;
|
||||
@endphp
|
||||
@endforeach
|
||||
@php
|
||||
$qc++;
|
||||
@endphp
|
||||
@endforeach
|
||||
|
||||
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
@else
|
||||
<h4 class="header-title mt-3">Quiz will be active from {{date("d M, h:iA", strtotime($form->start_time)) }} to {{date("d M, h:iA", strtotime($form->end_time)) }} </h4>
|
||||
|
||||
|
||||
|
||||
@endif
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
<div class="card-body p-3 row message-body">
|
||||
<div class="col-12">
|
||||
<h4 class="page-title">{{ $form->name }}</h4>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<h2>Your response are successfully submitted.</h2>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
@if($form->show_score)
|
||||
<div class="alert alert-success bg-success text-white border-0 show_score_wrapper" role="alert">
|
||||
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-12">
|
||||
@if($form->show_answers)
|
||||
@php
|
||||
$qc = 1;
|
||||
$ols = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'];
|
||||
@endphp
|
||||
@foreach ($questions as $question)
|
||||
<h4 class="header-title mt-3">{{$qc}}) {{ $question->question }}</h4>
|
||||
@php
|
||||
$ac = 0;
|
||||
@endphp
|
||||
@foreach($question->options as $ans)
|
||||
<p style="margin-bottom:5px" class="{{$ans->is_correct?'text-success fw-bold ':''}}">{{$ols[$ac]}}) {{$ans->option}}</p>
|
||||
@php
|
||||
$ac++;
|
||||
@endphp
|
||||
@endforeach
|
||||
@php
|
||||
$qc++;
|
||||
@endphp
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{ URL::asset('assets/js/jquery-sparkline/jquery-sparkline.min.js')}}"></script>
|
||||
<script src="{{ URL::asset('assets/js/pages/timeme.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('.message-body').hide()
|
||||
|
||||
$('#quiz-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$('#time_taken').val(TimeMe.getTimeOnCurrentPageInSeconds());
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/quizly/ajaxsubmit',
|
||||
data: $('#quiz-form').serialize(),
|
||||
success: function( data ) {
|
||||
console.log(data)
|
||||
$("#pageloader").fadeOut();
|
||||
if(data.status == 'success') {
|
||||
$('.message-body').show()
|
||||
$('.form-body').hide()
|
||||
console.log(data)
|
||||
$('.show_score_wrapper').html('You answered <strong> '+data.submission.correct_answers+' correct out of '+data.submission.total_questions+' </strong>questions<br />You took <strong>'+data.submission.time_taken+' sec</strong> to submit the Quiz')
|
||||
console.log('You answered <strong> '+data.submission.correct_answers+' correct out of '+data.submission.total_questions+' </strong>questions<br />You took <strong>'+data.submission.time_taken+' sec</strong> to submit the Quiz')
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
TimeMe.initialize({
|
||||
currentPageName: "my-home-page", // current page
|
||||
idleTimeoutInSeconds: 10, // seconds
|
||||
|
||||
});
|
||||
|
||||
// $('#post-media-btn').click(function(){
|
||||
//
|
||||
// });
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,228 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Add & Edit Products"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{asset('assets/libs/select2/select2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/multiselect/multiselect.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ URL::asset('assets/libs/dropify/dropify.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/flatpickr/flatpickr.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<!-- third party css end -->
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success mt-3">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row mt-3">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<form method="post" action="" id="form-availiblity" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<h4 class="page-title">Add / Edit {{$title}}</h4>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="float-end">
|
||||
<a href="{{$base_url}}s" class="btn btn-dark waves-effect waves-light">Back</a>
|
||||
<button type="submit" class="btn btn-success waves-effect waves-light">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
@foreach($fields as $field => $props)
|
||||
@if($props['type'] != 'hidden')
|
||||
<div class="col-md-{{isset($props['fullwidth'])?'12':'6'}} mb-3">
|
||||
<label for="field-{{$field}}" class="form-label">{{$props['title']}} {!!isset($props['required'])&&$props['required'] ? '<span class="text-danger">*</span>':''!!} </label>
|
||||
@endif
|
||||
@switch($props['type'])
|
||||
@case('hidden')
|
||||
<input type="{{$props['type']}}" id="field-{{$field}}" name="{{$field}}" value="{{$mode=='edit'?$item->{$field}:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('number')
|
||||
@case('tel')
|
||||
<input type="{{$props['type']}}" id="field-{{$field}}" name="{{$field}}" class="form-control" placeholder="Enter {{$props['title']}}" value="{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}" {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
@break
|
||||
@case('date')
|
||||
<input type="text" id="field-{{$field}}" name="{{$field}}" class="form-control" placeholder="Enter {{$props['title']}}" value="{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}" data-provide="datepicker" data-date-format="mm-dd-yyyy" data-date-autoclose="true" {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
@break
|
||||
@case('datetime')
|
||||
<input type="text" id="field-{{$field}}" name="{{$field}}" class="form-control datetime" placeholder="Enter {{$props['title']}}" value="{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}" {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$field}}" name="{{$field}}" class="form-control" placeholder="Enter {{$props['title']}}" {{isset($props['required'])&&$props['required']?'required':'' }}>{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}</textarea>
|
||||
@break
|
||||
@case('select')
|
||||
<select class="form-control" id="field-{{$field}}" name="{{$field}}" {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
<option value=""> -- Select {{$props['title']}} -- </option>
|
||||
@foreach($props['values'] as $k => $v)
|
||||
<option value="{{$k}}" {{$mode=='edit' && isset($item->{$field}) && $item->{$field} == $k ? 'selected="selected"':''}}>{{$v}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($props['values'] as $k => $v)
|
||||
<div class="form-check mb-2 form-check-blue">
|
||||
<input class="form-check-input" type="checkbox" name="{{$field}}[]" value="{{$k}}" id="field-{{$field}}-{{$k}}" {{$mode=='edit' && isset($item->{$field}) && in_array($k, $item->{$field}) ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$field}}-{{$k}}">{{$v}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('multiselect')
|
||||
<select class="form-control select2-multiple" data-toggle="select2" data-width="100%" multiple="multiple" data-placeholder="Choose {{$props['title']}}" id="field-{{$field}}" name="{{$field}}[]" {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
<option value=""> -- Select {{$props['title']}} -- </option>
|
||||
@foreach($props['values'] as $k => $v)
|
||||
<option value="{{$k}}" {{$mode=='edit' && isset($item->{$field}) && in_array($k, $item->{$field}) ? 'selected="selected"':''}}>{{$v}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('bigmultiselect')
|
||||
<select multiple="multiple" class="bigmultiselect multi-select" id="field-{{$field}}" name="{{$field}}[]" {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
@foreach($props['values'] as $k => $v)
|
||||
<option value="{{$k}}" {{$mode=='edit' && in_array($k, $item->{$field}) ? 'selected="selected"':''}}>{{$v}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('yesno')
|
||||
<div>
|
||||
<div class="form-check mb-2 form-check-success form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="{{$field}}" id="field-{{$field}}-yes" value="yes" {{$mode=='edit' && $item->{$field} == 'yes' ? 'checked':''}} {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
<label class="form-check-label" for="field-{{$field}}-yes">Yes</label>
|
||||
</div>
|
||||
<div class="form-check mb-2 form-check-danger form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="{{$field}}" id="field-{{$field}}-no" value="no" {{$mode=='edit' && $item->{$field} == 'no' ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$field}}-no">No</label>
|
||||
</div>
|
||||
</div>
|
||||
@break
|
||||
@case('image')
|
||||
<div class="mt-3" id="file_wrapper">
|
||||
<input type="file" name="{{$field}}" class="dropify" data-default-file="{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}" data-allowed-file-extensions="png jpg jpeg gif" />
|
||||
<p class="text-muted text-center mt-2 mb-0">500MB Max File size</p>
|
||||
</div>
|
||||
@break
|
||||
@case('multiimage')
|
||||
<div class="mt-3" id="file_wrapper">
|
||||
<input type="file" name="{{$field}}[]" multiple class="dropify" data-allowed-file-extensions="png jpg jpeg gif" />
|
||||
<p class="text-muted text-center mt-2 mb-0">500MB Max File size</p>
|
||||
</div>
|
||||
@break
|
||||
@case('file')
|
||||
<div class="mt-3" id="file_wrapper">
|
||||
<input type="file" name="{{$field}}" class="dropify" data-default-file="{{$mode=='edit'?$item->{$field}:''}}" data-allowed-file-extensions="png jpg jpeg gif mp4 pdf mp3 zip" />
|
||||
<p class="text-muted text-center mt-2 mb-0">1GB Max File size</p>
|
||||
</div>
|
||||
@break
|
||||
|
||||
@endswitch
|
||||
@if($props['type'] != 'hidden')
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="float-end">
|
||||
<a href="{{$base_url}}s" class="btn btn-dark waves-effect waves-light">Back</a>
|
||||
<button type="submit" class="btn btn-success waves-effect waves-light">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end card-body -->
|
||||
</form>
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
|
||||
@if($mode=='edit')
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="page-title-box" style="margin-top: -35px;">
|
||||
<div class="page-title-right">
|
||||
<a class="btn btn-info waves-effect waves-light" href="/quiz/addquestion">Add New Question</a>
|
||||
</div>
|
||||
<h4 class="page-title">Manage Question</h4>
|
||||
</div>
|
||||
<div class="responsive-table-plugin">
|
||||
<div class="table-rep-plugin">
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-hover table-centered m-0">
|
||||
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th style="width: 5%">Sr.</th>
|
||||
<th style="width: 50%">Question</th>
|
||||
<th style="width: 15%">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $count = 1?>
|
||||
@foreach($questions as $item)
|
||||
<tr>
|
||||
<td>{{$count}}</td>
|
||||
<td>{{$item->question}}</td>
|
||||
<td>
|
||||
<a href="/quiz/editquestion?id={{$item->id}}" class="btn btn-xs btn-secondary" data-toggle="tooltip" data-placement="top" title="" data-original-title="Edit"><i class="mdi mdi-pencil"></i></a>
|
||||
|
||||
<a href="/question/delete?id={{$item->id}}" class="btn btn-xs btn-danger" onclick="return confirm('Are you sure?')" data-toggle="tooltip" data-placement="top" title="" data-original-title="Delete"><i class="mdi mdi-delete"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $count++ ?>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end .table-responsive-->
|
||||
|
||||
</div> <!-- end .table-rep-plugin-->
|
||||
</div> <!-- end .responsive-table-plugin-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
</div>
|
||||
<style type="text/css">
|
||||
.ms-container {max-width: 100%}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<script src="{{asset('assets/libs/select2/select2.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/multiselect/multiselect.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/multiselect/jquery.quicksearch.js')}}"></script>
|
||||
<script src="{{ URL::asset('assets/libs/dropify/dropify.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/flatpickr/flatpickr.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('[data-toggle="select2"]').select2();
|
||||
$('.dropify').dropify({
|
||||
messages: {
|
||||
'default': 'Drag and drop a file here or click',
|
||||
'replace': 'Drag and drop or click to replace',
|
||||
'remove': 'Remove',
|
||||
'error': 'Ooops, something wrong appended.'
|
||||
},
|
||||
error: {
|
||||
'fileSize': 'The file size is too big (500MB max).'
|
||||
}
|
||||
});
|
||||
|
||||
$('.datetime').flatpickr({
|
||||
enableTime: true,
|
||||
dateFormat: "Y-m-d H:i"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Add & Edit Products"])
|
||||
@section('css')
|
||||
<link href="{{ URL::asset('assets/libs/flatpickr/flatpickr.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ URL::asset('assets/libs/dropify/dropify.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
@endsection
|
||||
@section('content')
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
<form method="post" id="form-availiblity" enctype="multipart/form-data">
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<button type="submit" class="btn btn-secondary float-right">Submit</button>
|
||||
</div>
|
||||
<h4 class="page-title">{{!$edit ? 'Add New Question':'Edit Question' }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@csrf
|
||||
<input type="hidden" name="correct_ans" value="" id="correct_ans">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group mb-3">
|
||||
<label for="name">Question</label>
|
||||
<textarea id="question" name="question" class="form-control" placeholder="Question" rows="6" required >{{$edit?$question->question:''}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="alert" role="alert" id="login-alert"></div>
|
||||
<h4>Options <button type="button" class="btn btn-info waves-effect waves-light float-end" id="btn-add-option">Add Option</button></h4>
|
||||
|
||||
<table class="table mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Option</th>
|
||||
<th style="width:5%">Is Correct</th>
|
||||
<th style="width:10%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if($edit)
|
||||
@foreach($question->options as $option)
|
||||
<tr>
|
||||
<td><input type="text" name="options[]" class="form-control" value="{{$option->option}}" required></td>
|
||||
<td><input type="radio" name="correct" id="" value="option8" {{$option->is_correct?'checked':''}}></td>
|
||||
<th><button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button></th>
|
||||
</tr>
|
||||
@endforeach
|
||||
@else
|
||||
<tr>
|
||||
<td><input type="text" name="options[]" class="form-control" value="" required></td>
|
||||
<td><input type="radio" name="correct" id="" value="option8"></td>
|
||||
<th><button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button></th>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div> <!-- end col -->
|
||||
|
||||
</div> <!-- end row -->
|
||||
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col -->
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<script src="{{ URL::asset('assets/libs/flatpickr/flatpickr.min.js')}}"></script>
|
||||
<script src="{{ URL::asset('assets/libs/dropify/dropify.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('.date-picker').flatpickr();
|
||||
$('.datetime-picker').flatpickr({
|
||||
enableTime: true,
|
||||
dateFormat: "Y-m-d H:i"
|
||||
});
|
||||
|
||||
$('#btn-add-option').click(function(){
|
||||
$('table tbody').append('<tr><td><input type="text" name="options[]" class="form-control" value="" required></td><td><input type="radio" name="correct" id="" value="option8"></td><th><button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button></th></tr>');
|
||||
|
||||
$('.btn-remove').unbind();
|
||||
$('.btn-remove').click(function(){
|
||||
$(this).parent().parent().remove();
|
||||
});
|
||||
});
|
||||
$('#form-availiblity').submit(function(event) {
|
||||
event.preventDefault(); //this will prevent the default submit
|
||||
console.log($('#form-availiblity').serialize())
|
||||
var index = $("input[type=radio]").index($("input[type=radio]:checked"));
|
||||
if(index > -1) {
|
||||
$('#correct_ans').val(index);
|
||||
$('#form-availiblity').unbind('submit').submit();
|
||||
} else {
|
||||
$('#login-alert').html('Please select correct Answer');
|
||||
$('#login-alert').removeClass('alert-success');
|
||||
$('#login-alert').addClass('alert-danger');
|
||||
$('#login-alert').show();
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
@if($question->type == 'file')
|
||||
<td><a target="_blank" href="{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}" download="{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}" class="btn btn-dark btn-xs"><i class="mdi mdi-cloud-download me-1"></i> Download</a></td>
|
||||
@else
|
||||
<td>{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}</td>
|
||||
<td>{!! isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' !!}</td>
|
||||
@endif
|
||||
@endforeach
|
||||
<th>
|
||||
|
|
|
|||
|
|
@ -81,24 +81,50 @@
|
|||
@case('radio')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check" id="field-{{$question->code}}">
|
||||
<input type="radio" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}" class="form-check-input" {{isset($question->value) && $question->value != $question->value ? 'checked':''}}>
|
||||
<input type="radio" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}" value="{{$option->value}}" class="form-check-input" {{isset($question->value) && $question->value != $question->value ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" required>
|
||||
@break
|
||||
<input type="file" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control" value=""
|
||||
accept="image/jpg, image/jpeg, image/png" required>
|
||||
@break
|
||||
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@foreach ($question->options as $option)
|
||||
<div class="col-6">{{ $option->display }}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{ $option->value }}"
|
||||
name="{{ $option->value }}" class="form-control" required
|
||||
value="{{ isset($option->val) ? $option->val : 0 }}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@break
|
||||
|
||||
@case('radiometrix')
|
||||
@foreach ($question->options as $option)
|
||||
<div class="row">
|
||||
<div class="col-5">{{ $option->display }}</div>
|
||||
<div class="col-7 mb-1">
|
||||
@php
|
||||
$nn = json_decode($option->value);
|
||||
@endphp
|
||||
@foreach ($nn as $value)
|
||||
<input type="radio"
|
||||
id="field-{{ $option->display }}-{{ $value }}"
|
||||
name="{{ $question->code }}[{{$option->display}}]" value="{{$value}}" class="form-check-input"
|
||||
{{ isset($question->display) && $option->display != $option->display ? 'checked' : '' }}>
|
||||
{{ $value }}
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
|
|
@ -154,7 +180,7 @@
|
|||
$('#report-form input').removeAttr('required')
|
||||
$('#field-record_region').parent().show()
|
||||
$('#field-record_subject_type').parent().show()
|
||||
$("[id^='field-" + $(this).val() + "_" + "']").parent().show()
|
||||
$("[for^='field-" + $(this).val() + "_" + "']").parent().show()
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,259 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => 'Form'])
|
||||
@include('layouts.shared/head-css', ['mode' => $mode ?? '', 'demo' => $demo ?? ''])
|
||||
<link href="{{ asset('assets/libs/sweetalert2/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
||||
<div class="card bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if (Session::has('error'))
|
||||
<div class="alert alert-danger">{{ Session::get('error') }}</div>
|
||||
<br>
|
||||
@endif
|
||||
@if (session('success'))
|
||||
<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>
|
||||
@endif
|
||||
<div class="col-12">
|
||||
<h4 class="page-title">{{ $form->title }}</h4>
|
||||
</div>
|
||||
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{ $form_id }}">
|
||||
@csrf
|
||||
@if ($id)
|
||||
<input type="hidden" name="id" value="{{ $id }}">
|
||||
@endif
|
||||
@if (isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span
|
||||
class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach ($form->users as $option)
|
||||
<option value="{{ $option->value }}"
|
||||
hierarchy="{{ $option->hierarchy_id }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach ($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-{{ $question->code }}"
|
||||
class="form-label">{{ $question->question }} {!! $question->required == 'yes' ? '<span class="text-danger">*</span>' : '' !!}
|
||||
</label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{ $question->type }}" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}"
|
||||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
|
||||
@case('text')
|
||||
@case('email')
|
||||
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{ $question->type }}" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
|
||||
@case('number')
|
||||
<input type="{{ $question->type }}" min="0" max="9999999999"
|
||||
step="1" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||||
value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
|
||||
@case('textarea')
|
||||
<textarea id="field-{{ $question->code }}" name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}>{{ isset($question->value) ? $question->value : '' }}</textarea>
|
||||
@break
|
||||
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach ($question->options as $option)
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
|
||||
@case('checkbox')
|
||||
@foreach ($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox"
|
||||
id="field-{{ $question->code }}-{{ $option->value }}"
|
||||
name="{{ $question->code }}[]" value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked' : '' }}>
|
||||
<label class="form-check-label"
|
||||
for="field-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
|
||||
@case('radio')
|
||||
@foreach ($question->options as $option)
|
||||
<div class="form-check">
|
||||
<input type="radio"
|
||||
id="field-{{ $question->code }}-{{ $option->value }}"
|
||||
name="{{ $question->code }}" class="form-check-input" value="{{$option->value}}"
|
||||
{{ isset($question->value) && $question->value != $question->value ? 'checked' : '' }}>
|
||||
<label class="form-check-label"
|
||||
for="field-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
|
||||
@case('file')
|
||||
<input type="file" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control" value=""
|
||||
accept="image/jpg, image/jpeg, image/png" required>
|
||||
@break
|
||||
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach ($question->options as $option)
|
||||
<div class="col-6">{{ $option->display }}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{ $option->value }}"
|
||||
name="{{ $option->value }}" class="form-control" required
|
||||
value="{{ isset($option->val) ? $option->val : 0 }}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
|
||||
@case('radiometrix')
|
||||
@foreach ($question->options as $option)
|
||||
<div class="row">
|
||||
<div class="col-5">{{ $option->display }}</div>
|
||||
<div class="col-7 mb-1">
|
||||
@php
|
||||
$nn = json_decode($option->value);
|
||||
@endphp
|
||||
@foreach ($nn as $value)
|
||||
<input type="radio"
|
||||
id="field-{{ $option->display }}-{{ $value }}"
|
||||
name="{{ $question->code }}[{{$option->display}}]" value="{{$value}}" class="form-check-input"
|
||||
{{ isset($question->display) && $option->display != $option->display ? 'checked' : '' }}>
|
||||
{{ $value }}
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{ asset('assets/libs/sweetalert2/sweetalert2.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($) {
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: 'https://gnpdoctor.buildrapport.co/neblogisticsave/ciplatodoctor',
|
||||
// data: new FormData($('#report-form')[0]),
|
||||
// processData: false,
|
||||
// contentType: false,
|
||||
// success: function(data) {
|
||||
// console.log(data);
|
||||
// },
|
||||
// });
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/srvey/ajaxsubmit',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
$("#pageloader").fadeOut();
|
||||
if (data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Loading…
Reference in New Issue