Changes till date
This commit is contained in:
parent
bbe46e9c0c
commit
4254cd9937
|
|
@ -0,0 +1,143 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Log;
|
||||
|
||||
class GenerateAssets extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'assets:generate';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$job = DB::table("export_jobs")->where('status', 'created')->where('type', 'tentcard')->first();
|
||||
if(!is_null($job)) {
|
||||
//$user = DB::table("users")->where('user_id', $job->user_id)->first();
|
||||
//$response = LambdaRequest::getrequest('ums', 'contact/get_all', ['search' => json_encode([]), 'keyword' => "", 'start' => 0, 'length' => 9999, 'fields' => '["msl_code","doctor_image","user_info"]', 'belowme' => true, 'source' => 'dynamodb' ], $user->access_token );
|
||||
$conts = DB::table("contacts")->select('id', 'name', 'contact_id', 'user_id', 'employee_code', 'rep_name', 'position_name', 'msl_code')->whereBetween('created_date', [date("Y-m-d H:i:s", strtotime($job->start_date) + 19800 ), date("Y-m-d H:i:s", strtotime($job->end_date) + 19800 ) ])->get();
|
||||
|
||||
$files = [];
|
||||
$contacts = [];
|
||||
foreach($conts as $cont) {
|
||||
$contacts[$cont->msl_code] = $cont;
|
||||
}
|
||||
foreach($contacts as $contact) {
|
||||
//$contact->name = str_replace(" ", "_", $contact->name);
|
||||
print_r($contact);
|
||||
$file = $this->generate($contact, $job);
|
||||
$files[] = $file;
|
||||
}
|
||||
|
||||
print_r(count($contacts));
|
||||
|
||||
// $folder = storage_path('app/public/'.$job->type);
|
||||
// $fileName = $contact->user_info->employee_code.'-'.$user->name.'-'.date("Y-m-d", strtotime($job->start_date)).'-'.date("Y-m-d", strtotime($job->start_date)).'.zip';
|
||||
// exec('cd '.$folder.'; zip "'.$fileName.'" ' . implode(' ', $files));
|
||||
|
||||
|
||||
// $zip = new \ZipArchive();
|
||||
// $folder = storage_path('app/public/'.$job->type);
|
||||
// $fileName = $contact->user_info->employee_code.'('.$user->name.')-'.$job->start_date.'-'.$job->start_date.'.zip';
|
||||
// if ($zip->open($folder, \ZipArchive::CREATE)== TRUE)
|
||||
// {
|
||||
// foreach ($files as $value){
|
||||
// $zip->addFile($folder.'/'.$value, $value);
|
||||
// }
|
||||
// $zip->close();
|
||||
// }
|
||||
//print_r($fileName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//print_r($job);
|
||||
}
|
||||
|
||||
protected function generate($contact, $job) {
|
||||
$folder = storage_path('app/public/'.$job->type);
|
||||
$templatename = 'template.png';
|
||||
switch($job->type) {
|
||||
case 'tentcard':
|
||||
$pdfname = str_replace(' ', '_', $contact->employee_code).'-'.str_replace(' ', '_', $contact->name).'-Tent-Standee.pdf';
|
||||
if(!file_exists($folder.'/'.$pdfname)) {
|
||||
$outputImage = $this->retimage($folder.'/'.$templatename);
|
||||
$font = storage_path('app').'/fonts/Poppins-Medium.ttf';
|
||||
$white = imagecolorallocatealpha($outputImage, 255, 255, 255, 0);
|
||||
imagettftext($outputImage, 28, 0, 120, 1290, $white, $font, 'Dr. ' . str_replace('Dr', '', str_replace('.', '', $contact->name) ));
|
||||
exec('qrencode -o '.$folder.'/qrcode-'.$contact->id.'.png -s 5 -m 2 https://breathefree.cttr.in/tracking/'.$contact->contact_id.'/'.$contact->user_id);
|
||||
|
||||
//file_put_contents($folder.'/'.'qrcode-'.$contact->id.'.png', file_get_contents( 'https://api.qrserver.com/v1/create-qr-code/?size=200&data=https://breathefree.cttr.in/tracking/'.$contact->id.'/'.$contact->user_id ));
|
||||
|
||||
$qrimg = $this->retimage($folder.'/'.'qrcode-'.$contact->id.'.png');
|
||||
imagecopyresized($outputImage,$qrimg,645,905,0,0,220,220,225,225);
|
||||
|
||||
$filename = 'tentcard-'.$contact->id.'.png';
|
||||
imagepng($outputImage, $folder.'/'.$filename);
|
||||
imagedestroy($outputImage);
|
||||
//imagedestroy($templatePDF);
|
||||
exec('convert ' .$folder.'/'.$filename. ' '.$folder.'/'.str_replace(' ', '_', $contact->employee_code).'-'.str_replace(' ', '_', $contact->name).'-Tent-Standee.pdf');
|
||||
exec('rm '.$folder.'/'.$filename);
|
||||
exec('rm '.$folder.'/'.'qrcode-'.$contact->id.'.png');
|
||||
|
||||
}
|
||||
return $pdfname;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function retimage($image) {
|
||||
$size = getimagesize($image);
|
||||
switch ($size['mime']) {
|
||||
case 'image/jpeg':
|
||||
$photoimg = imagecreatefromjpeg($image);
|
||||
break;
|
||||
case 'image/png':
|
||||
$photoimg = imagecreatefrompng($image);
|
||||
break;
|
||||
case 'image/jpeg':
|
||||
$photoimg = imagecreatefrompng($image);
|
||||
break;
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
}
|
||||
return $photoimg;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Log;
|
||||
|
||||
class GenerateAssetsCsv extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'assets:generatecsv';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$job = DB::table("export_jobs")->where('status', 'created')->where('type', 'tentcard')->first();
|
||||
if(!is_null($job)) {
|
||||
//$user = DB::table("users")->where('user_id', $job->user_id)->first();
|
||||
//$response = LambdaRequest::getrequest('ums', 'contact/get_all', ['search' => json_encode([]), 'keyword' => "", 'start' => 0, 'length' => 9999, 'fields' => '["msl_code","doctor_image","user_info"]', 'belowme' => true, 'source' => 'dynamodb' ], $user->access_token );
|
||||
$conts = DB::table("contacts")->select('id', 'name', 'contact_id', 'user_id', 'employee_code', 'rep_name', 'position_name', 'msl_code', 'created_date')->whereBetween('created_date', [date("Y-m-d H:i:s", strtotime($job->start_date) + 19800 ), date("Y-m-d H:i:s", strtotime($job->end_date) + 19800 ) ])->get();
|
||||
$contacts = [];
|
||||
foreach($conts as $cont) {
|
||||
$contacts[$cont->msl_code] = $cont;
|
||||
}
|
||||
|
||||
$headers = ['TM', 'Emp ID', 'HQ', 'Dr Name', 'MSL Code', 'Created Date'];
|
||||
$csv = implode(',', $headers) . "\n";//Column headers
|
||||
foreach($contacts as $contact) {
|
||||
$csv.= $contact->rep_name.','.$contact->employee_code.','.$contact->position_name.','.$contact->name.','.$contact->msl_code.','.$contact->created_date."\n";
|
||||
}
|
||||
|
||||
$folder = storage_path('app/public');
|
||||
$fileName = date("Y-m-d", strtotime($job->start_date)).'-'.date("Y-m-d", strtotime($job->end_date)).'.csv';
|
||||
print_r($folder);
|
||||
print_r($fileName);
|
||||
$csv_handler = fopen ($folder .'/'. $fileName,'w');
|
||||
fwrite ($csv_handler,$csv);
|
||||
fclose ($csv_handler);
|
||||
|
||||
|
||||
|
||||
// $folder = storage_path('app/public/'.$job->type);
|
||||
// $fileName = $contact->user_info->employee_code.'-'.$user->name.'-'.date("Y-m-d", strtotime($job->start_date)).'-'.date("Y-m-d", strtotime($job->start_date)).'.zip';
|
||||
// exec('cd '.$folder.'; zip "'.$fileName.'" ' . implode(' ', $files));
|
||||
|
||||
|
||||
// $zip = new \ZipArchive();
|
||||
// $folder = storage_path('app/public/'.$job->type);
|
||||
// $fileName = $contact->user_info->employee_code.'('.$user->name.')-'.$job->start_date.'-'.$job->start_date.'.zip';
|
||||
// if ($zip->open($folder, \ZipArchive::CREATE)== TRUE)
|
||||
// {
|
||||
// foreach ($files as $value){
|
||||
// $zip->addFile($folder.'/'.$value, $value);
|
||||
// }
|
||||
// $zip->close();
|
||||
// }
|
||||
//print_r($fileName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//print_r($job);
|
||||
}
|
||||
|
||||
protected function generate($contact, $job) {
|
||||
$folder = storage_path('app/public/'.$job->type);
|
||||
$templatename = 'template.png';
|
||||
switch($job->type) {
|
||||
case 'stickeraw':
|
||||
$pdfname = str_replace(' ', '_', $contact->employee_code).'-'.str_replace(' ', '_', $contact->name).'-Sticker.pdf';
|
||||
print_r($pdfname);
|
||||
if(!file_exists($folder.'/'.$pdfname)) {
|
||||
$outputImage = $this->retimage($folder.'/'.$templatename);
|
||||
file_put_contents($folder.'/'.'qrcode-'.$contact->id.'.png', file_get_contents( 'https://api.qrserver.com/v1/create-qr-code/?size=200&data=https://breathefree.cttr.in/tracking/'.$contact->id.'/'.$contact->user_id ));
|
||||
|
||||
$qrimg = $this->retimage($folder.'/'.'qrcode-'.$contact->id.'.png');
|
||||
imagecopyresized($outputImage,$qrimg,70,312,0,0,190,190,250,250);
|
||||
|
||||
$font = storage_path('app').'/fonts/Poppins-Bold.ttf';
|
||||
$white = imagecolorallocatealpha($outputImage, 255, 255, 255, 0);
|
||||
imagettftext($outputImage, 27, 0, 309, 340, $white, $font, 'Dr. ' . str_replace('Dr', '', str_replace('.', '', $contact->name) ) );
|
||||
|
||||
$filename = 'sticker-'.$contact->id.'.png';
|
||||
imagepng($outputImage, $folder.'/'.$filename);
|
||||
imagedestroy($outputImage);
|
||||
exec('convert ' .$folder.'/'.$filename. ' '.$folder.'/'.str_replace(' ', '_', $contact->employee_code).'-'.str_replace(' ', '_', $contact->name).'-Sticker.pdf');
|
||||
exec('rm '.$folder.'/'.$filename);
|
||||
exec('rm '.$folder.'/'.'qrcode-'.$contact->id.'.png');
|
||||
|
||||
}
|
||||
return $pdfname;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function retimage($image) {
|
||||
$size = getimagesize($image);
|
||||
switch ($size['mime']) {
|
||||
case 'image/jpeg':
|
||||
$photoimg = imagecreatefromjpeg($image);
|
||||
break;
|
||||
case 'image/png':
|
||||
$photoimg = imagecreatefrompng($image);
|
||||
break;
|
||||
case 'image/jpeg':
|
||||
$photoimg = imagecreatefrompng($image);
|
||||
break;
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
}
|
||||
return $photoimg;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Log;
|
||||
|
||||
class GenerateStickerAssets extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'assets:generatesticker';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$job = DB::table("export_jobs")->where('status', 'created')->where('type', 'stickeraw')->first();
|
||||
if(!is_null($job)) {
|
||||
//$user = DB::table("users")->where('user_id', $job->user_id)->first();
|
||||
//$response = LambdaRequest::getrequest('ums', 'contact/get_all', ['search' => json_encode([]), 'keyword' => "", 'start' => 0, 'length' => 9999, 'fields' => '["msl_code","doctor_image","user_info"]', 'belowme' => true, 'source' => 'dynamodb' ], $user->access_token );
|
||||
$conts = DB::table("contacts")->select('id', 'name', 'contact_id', 'user_id', 'employee_code', 'rep_name', 'position_name', 'msl_code')->where('status', 0)->whereBetween('created_date', [date("Y-m-d H:i:s", strtotime($job->start_date) + 19800 ), date("Y-m-d H:i:s", strtotime($job->end_date) + 19800 ) ])->get();
|
||||
|
||||
$files = [];
|
||||
$contacts = [];
|
||||
foreach($conts as $cont) {
|
||||
$contacts[$cont->msl_code] = $cont;
|
||||
}
|
||||
foreach($contacts as $contact) {
|
||||
//$contact->name = str_replace(" ", "_", $contact->name);
|
||||
print_r($contact);
|
||||
$file = $this->generate($contact, $job);
|
||||
$files[] = $file;
|
||||
}
|
||||
|
||||
print_r(count($contacts));
|
||||
|
||||
// $folder = storage_path('app/public/'.$job->type);
|
||||
// $fileName = $contact->user_info->employee_code.'-'.$user->name.'-'.date("Y-m-d", strtotime($job->start_date)).'-'.date("Y-m-d", strtotime($job->start_date)).'.zip';
|
||||
// exec('cd '.$folder.'; zip "'.$fileName.'" ' . implode(' ', $files));
|
||||
|
||||
|
||||
// $zip = new \ZipArchive();
|
||||
// $folder = storage_path('app/public/'.$job->type);
|
||||
// $fileName = $contact->user_info->employee_code.'('.$user->name.')-'.$job->start_date.'-'.$job->start_date.'.zip';
|
||||
// if ($zip->open($folder, \ZipArchive::CREATE)== TRUE)
|
||||
// {
|
||||
// foreach ($files as $value){
|
||||
// $zip->addFile($folder.'/'.$value, $value);
|
||||
// }
|
||||
// $zip->close();
|
||||
// }
|
||||
//print_r($fileName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//print_r($job);
|
||||
}
|
||||
|
||||
protected function generate($contact, $job) {
|
||||
$folder = storage_path('app/public/'.$job->type);
|
||||
$templatename = 'template.png';
|
||||
switch($job->type) {
|
||||
case 'stickeraw':
|
||||
$pdfname = str_replace(' ', '_', $contact->employee_code).'-'.str_replace(' ', '_', $contact->name).'-Sticker.pdf';
|
||||
print_r($pdfname);
|
||||
if(!file_exists($folder.'/'.$pdfname)) {
|
||||
$outputImage = $this->retimage($folder.'/'.$templatename);
|
||||
//file_put_contents($folder.'/'.'qrcode-'.$contact->id.'.png', file_get_contents( 'https://api.qrserver.com/v1/create-qr-code/?size=200&data=https://breathefree.cttr.in/tracking/'.$contact->id.'/'.$contact->user_id ));
|
||||
|
||||
exec('qrencode -o '.$folder.'/qrcode-'.$contact->id.'.png -s 5 -m 2 https://breathefree.cttr.in/tracking/'.$contact->contact_id.'/'.$contact->user_id);
|
||||
|
||||
$qrimg = $this->retimage($folder.'/'.'qrcode-'.$contact->id.'.png');
|
||||
imagecopyresized($outputImage,$qrimg,70,312,0,0,190,190,225,225);
|
||||
|
||||
$font = storage_path('app').'/fonts/Poppins-Bold.ttf';
|
||||
$white = imagecolorallocatealpha($outputImage, 255, 255, 255, 0);
|
||||
imagettftext($outputImage, 27, 0, 309, 340, $white, $font, 'Dr. ' . str_replace('Dr', '', str_replace('.', '', $contact->name) ) );
|
||||
|
||||
$filename = 'sticker-'.$contact->id.'.png';
|
||||
imagepng($outputImage, $folder.'/'.$filename);
|
||||
imagedestroy($outputImage);
|
||||
exec('convert ' .$folder.'/'.$filename. ' '.$folder.'/'.str_replace(' ', '_', $contact->employee_code).'-'.str_replace(' ', '_', $contact->name).'-Sticker.pdf');
|
||||
exec('rm '.$folder.'/'.$filename);
|
||||
exec('rm '.$folder.'/'.'qrcode-'.$contact->id.'.png');
|
||||
|
||||
}
|
||||
return $pdfname;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function retimage($image) {
|
||||
$size = getimagesize($image);
|
||||
switch ($size['mime']) {
|
||||
case 'image/jpeg':
|
||||
$photoimg = imagecreatefromjpeg($image);
|
||||
break;
|
||||
case 'image/png':
|
||||
$photoimg = imagecreatefrompng($image);
|
||||
break;
|
||||
case 'image/jpeg':
|
||||
$photoimg = imagecreatefrompng($image);
|
||||
break;
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
}
|
||||
return $photoimg;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Log;
|
||||
|
||||
class GenerateZips extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'assets:generatezip';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$job = DB::table("export_jobs")->where('status', 'created')->where('type', 'tentcard')->first();
|
||||
if(!is_null($job)) {
|
||||
$contacts = DB::table("contacts")->select('id', 'name', 'contact_id', 'user_id', 'employee_code', 'rep_name', 'position_name', 'depot_name')->where('status', 0)->whereBetween('created_date', [date("Y-m-d H:i:s", strtotime($job->start_date) + 19800 ), date("Y-m-d H:i:s", strtotime($job->end_date) + 19800 ) ])->get();
|
||||
|
||||
$users = [];
|
||||
$depots = [];
|
||||
foreach($contacts as $contact) {
|
||||
if(!isset($users[$contact->user_id])) {
|
||||
$users[$contact->user_id]['userinfo'] = ['name' => $contact->rep_name, 'employee_code' => $contact->employee_code, 'position_name' => $contact->position_name];
|
||||
$users[$contact->user_id]['contacts'] = [];
|
||||
}
|
||||
if( !in_array($contact->name, $users[$contact->user_id]['contacts']) ) {
|
||||
$users[$contact->user_id]['contacts'][] = $contact->name;
|
||||
}
|
||||
//if(!array_key_exists($contact->user_id, $depots) ){
|
||||
$depots[$contact->employee_code] = $contact->depot_name;
|
||||
//}
|
||||
}
|
||||
|
||||
print_r($depots);
|
||||
$zips = [];
|
||||
$folder = storage_path('app/public/'.$job->type);
|
||||
foreach($users as $user_id => $user) {
|
||||
$files = [];
|
||||
if( isset($user['contacts']) && sizeof($user['contacts']) > 0 ) {
|
||||
foreach($user['contacts'] as $cont) {
|
||||
$fileName = str_replace(' ', '_', $user['userinfo']['employee_code']).'-'.str_replace(' ', '_', $cont).($job->type=='tentcard'?'-Tent-Standee.pdf':'-Sticker.pdf') ;
|
||||
if(file_exists($folder .'/'. $fileName)) {
|
||||
$files[] = $fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
$zipName = $user['userinfo']['position_name'].'-'.$user['userinfo']['employee_code'].'-'.$user['userinfo']['name'].'.zip';
|
||||
$zips[ $depots[ $user['userinfo']['employee_code'] ] ][] = $zipName;
|
||||
//print_r('cd '.$folder.'; zip "zips/'.$zipName.'" ' . implode(' ', $files));
|
||||
exec('cd '.$folder.'; zip "zips/'.$zipName.'" ' . implode(' ', $files));
|
||||
}
|
||||
$zipNames = [];
|
||||
// $zipss = array_chunk($zips, 100);
|
||||
foreach($zips as $depot => $zip) {
|
||||
$zipName = $depot . '-' .date("Y-m-d", strtotime($job->start_date)).'-'.date("Y-m-d", strtotime($job->end_date)).'.zip';
|
||||
//print_r('cd '.$folder.'/zips; zip "'.$zipName.'" "' . implode('" "', $zip) . '"');
|
||||
exec('cd '.$folder.'/zips; zip "'.$zipName.'" "' . implode('" "', $zip) . '"');
|
||||
exec('aws s3 cp ' . $folder .'/zips/'. $zipName. ' s3://rapportapp/breathefree/'.$job->type.'/');
|
||||
$zipNames[] = 'https://did94hhhcgq1d.cloudfront.net/breathefree/'.$job->type.'/'.$zipName;
|
||||
//exec('cd '.$folder.'/zips; rf -rf "' . implode('" "', $zip) . '"');
|
||||
|
||||
}
|
||||
|
||||
print_r($zipNames);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//print_r($job);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use DB;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
|
||||
class IndexActivities extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'activity:indexdata';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$activityIndex = DB::connection("primary")->table("activity_index")->where("is_active", 0)->first();
|
||||
if($activityIndex) {
|
||||
$total = $activityIndex->total_activities;
|
||||
for($completed = 0; $completed <= $total; $completed+=10) {
|
||||
LambdaRequest::getrequest('catalog', 'activity/step', ['id'=>$activityIndex->import_id, 'step'=>'index_data_chunk', 'start_from' => $completed, 'limit' => 10], env('LAMBDA_ACCESS_TOKEN'));
|
||||
DB::connection("primary")->table("activity_index")->where("id", $activityIndex->id)->update(['is_active' => 1, 'indexed_activities' => $completed ]);
|
||||
}
|
||||
LambdaRequest::getrequest('catalog', 'activity/step', ['id'=>$activityIndex->import_id, 'step'=>'complete'], env('LAMBDA_ACCESS_TOKEN'));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
namespace App\Helpers;
|
||||
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
|
||||
use DB;
|
||||
class Formhelper
|
||||
{
|
||||
public static function getMultiformData($partition, $form_id, $user_id, $startdate = false, $enddate = false) {
|
||||
|
|
@ -13,5 +13,17 @@ class Formhelper
|
|||
}
|
||||
return $history;
|
||||
}
|
||||
|
||||
public static function getformdefination($partition, $form_id, $user_id) {
|
||||
$history = LambdaRequest::postrequest('form', 'formentity/getformdefination', ['form_id' => $form_id, 'user_id' => $user_id, 'partition' => $partition ]);
|
||||
return $history;
|
||||
}
|
||||
|
||||
public static function getuserdropdown($partition, $filter) {
|
||||
list($app, $domain) = explode('-', $partition);
|
||||
$token = DB::table('users')->select("access_token")->where("domain", $domain)->orderBy('updated_at', 'desc')->skip(0)->take(1)->get();
|
||||
$history = LambdaRequest::getrequest('ums', 'users/dropdown', ['filter' => $filter ], $token[0]->access_token);
|
||||
return $history;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,129 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Http\Client\ConnectionException;
|
||||
use DB;
|
||||
|
||||
class ActivityimportController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'catalog';
|
||||
$this->_module = 'activity';
|
||||
$this->_viewname = 'activity';
|
||||
$this->_title = 'Activity Import';
|
||||
$this->_base_url = '/activityimport';
|
||||
}
|
||||
|
||||
protected function get_list_fields(){
|
||||
return [
|
||||
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
|
||||
'title' => ['title' => 'Title', 'type' => 'text'],
|
||||
'status' => ['title' => 'Status', 'type' => 'text'],
|
||||
'createdAt' => ['title' => 'Created At', 'type' => 'text'],
|
||||
];
|
||||
}
|
||||
|
||||
public function list(Request $request) {
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/import_list');
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
if($response->statusCode == 401) {
|
||||
return redirect('/unauthorised');
|
||||
}
|
||||
$fields = $this->get_list_fields();
|
||||
//echo '<pre>'; print_r($fields); exit;
|
||||
return $this->view($this->_listtype)->with([
|
||||
'title' => $this->_title,
|
||||
'fields' => $fields,
|
||||
'base_url' => $this->_base_url,
|
||||
'items' => $response->data->items,
|
||||
'buttons' => $this->get_list_buttons()
|
||||
]);
|
||||
}
|
||||
|
||||
protected function get_form_fields($type, $values){
|
||||
$mappings = $this->getlambda('get', 'metric', 'injestion_mapping', 'get_all');
|
||||
$mappings_dd = [];
|
||||
foreach($mappings->data->items as $mapping){
|
||||
$mappings_dd[$mapping->id] = $mapping->name;
|
||||
}
|
||||
//echo '<pre>'; print_r($mappings_dd); exit;
|
||||
return [
|
||||
'title' => ['title' => 'Title', 'type' => 'text', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
'file' => ['title' => 'File Upload', 'type' => 'file', 'required' => true],
|
||||
'mapping_id' => ['title' => 'Select Mapping', 'type' => 'select', 'values' => $mappings_dd ],
|
||||
];
|
||||
}
|
||||
|
||||
public function form($type, $id = null) {
|
||||
$values = [];
|
||||
if($type == 'edit') {
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/import_detail', ['id' => $id]);
|
||||
$values = $response->data->item;
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
}
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
$data = $this->_beforeform($type, $values);
|
||||
$fields = $this->get_form_fields($type, $values);
|
||||
//echo '<pre>'; print_r($fields); exit;
|
||||
return $this->view('form')->with([
|
||||
'title' => $this->_title,
|
||||
'mode' => $type,
|
||||
'fields' => $fields,
|
||||
'base_url' => $this->_base_url,
|
||||
'item' => $values,
|
||||
]);
|
||||
}
|
||||
|
||||
protected function _beforesave($type, $request) {
|
||||
$data = $request->except('_token');
|
||||
if( $request->file('file') ) {
|
||||
$data['file'] = $this->_uploadMedia($request, 'file', 'activity_import');
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function _beforeform($type, $values) {
|
||||
// if($type == 'edit') {
|
||||
// $values->channels = explode('#', $values->channels);
|
||||
// }
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
return $values;
|
||||
}
|
||||
|
||||
public function processimport(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/step', ['id'=>$id, 'step'=>'status']);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return $this->view('processimport')->with(['id'=>$id, 'title'=>$response->data->status->title, 'status'=>$response->data->status->status, 'context'=>$response->data->status->context ]);
|
||||
}
|
||||
|
||||
public function step(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$step = $request->input('step', 0);
|
||||
try {
|
||||
LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/step', ['id'=>$id, 'step'=>$step]);
|
||||
} catch (ConnectionException $e) {
|
||||
return redirect('/activityimport/stepresponse?id='.$id.'&step='.$step);
|
||||
}
|
||||
}
|
||||
|
||||
public function stepresponse(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$step = $request->input('step', 0);
|
||||
return $this->view('stepresponse')->with(['id'=>$id, 'step'=>$step]);
|
||||
}
|
||||
|
||||
public function checkstatus(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$step = $request->input('step', 0);
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/step', ['id'=>$id, 'step'=>'status']);
|
||||
return response()->json($response->data->status);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use DB;
|
||||
|
||||
class AppController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'detailing';
|
||||
$this->_module = 'app';
|
||||
$this->_viewname = 'app';
|
||||
$this->_title = 'App';
|
||||
$this->_base_url = '/app';
|
||||
}
|
||||
|
||||
protected function get_list_fields(){
|
||||
return [
|
||||
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
|
||||
'name' => ['title' => 'Name', 'type' => 'text'],
|
||||
'android_min_version' => ['title' => 'Android Min Version', 'type' => 'text'],
|
||||
'ios_min_version' => ['title' => 'IOS Min Version', 'type' => 'text'],
|
||||
'status' => ['title' => 'Status', 'type' => 'select'],
|
||||
];
|
||||
}
|
||||
|
||||
protected function get_form_fields($type, $values){
|
||||
$channels = $this->getlambda('get', 'ums', 'channel', 'dropdown');
|
||||
$channels_dd = [];
|
||||
foreach($channels->data->items as $channel){
|
||||
$channels_dd[$channel->id] = $channel->name;
|
||||
}
|
||||
return [
|
||||
'name' => ['title' => 'Name', 'type' => 'text', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled']],
|
||||
'android_package' => ['title' => 'Android Package', 'type' => 'text', 'required' => true],
|
||||
'ios_package' => ['title' => 'IOS Package', 'type' => 'text', 'required' => true],
|
||||
'android_min_version' => ['title' => 'Android Min Version', 'type' => 'text', 'required' => true],
|
||||
'ios_min_version' => ['title' => 'IOS Min Version','type' => 'text', 'required' => true],
|
||||
'android_store_link' => ['title' => 'Android Store Link', 'type' => 'text', 'required' => true],
|
||||
'ios_store_link' => ['title' => 'IOS Store Link', 'type' => 'text', 'required' => true],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -66,10 +66,10 @@ class AppreciationcategoryController extends Controller
|
|||
'points' => ['title' => 'Points', 'type' => 'text', 'required' => true],
|
||||
'groups' => ['title' => 'Groups', 'type' => 'multiselect', 'required' => true, 'values' => $groups_dd ],
|
||||
'roles' => ['title' => 'Roles', 'type' => 'multiselect', 'required' => true, 'values' => $roles_dd ],
|
||||
'mapped_metric' => ['title' => 'Metric', 'type' => 'select', 'values' => $metric_dd ],
|
||||
|
||||
'icon' => ['title' => 'Icon', 'type' => 'image', 'required' => true ],
|
||||
|
||||
'mapped_metric' => ['title' => 'Point Metric', 'type' => 'select', 'values' => $metric_dd ],
|
||||
'count_metric' => ['title' => 'Count Metric', 'type' => 'select', 'values' => $metric_dd ],
|
||||
];
|
||||
|
||||
return $fields;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,11 @@ class BadgelistController extends Controller
|
|||
foreach($groups->data->items as $group){
|
||||
$groups_dd[$group->id] = $group->name;
|
||||
}
|
||||
|
||||
$metrics = $this->getlambda('get', 'metric', 'metric', 'get_all');
|
||||
$metric_dd = [];
|
||||
foreach($metrics->data->items as $metric){
|
||||
$metric_dd[$metric->id] = $metric->name;
|
||||
}
|
||||
$fields = [
|
||||
'title' => ['title' => 'Title', 'type' => 'text', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
|
|
@ -60,6 +64,8 @@ class BadgelistController extends Controller
|
|||
'image' => ['title' => 'Image', 'type' => 'image', 'required' => true ],
|
||||
'conditions' => ['title' => 'Conditions', 'type' => 'text', 'required' => true],
|
||||
|
||||
'mapped_metric' => ['title' => 'Point Metric', 'type' => 'select', 'values' => $metric_dd ],
|
||||
'count_metric' => ['title' => 'Count Metric', 'type' => 'select', 'values' => $metric_dd ],
|
||||
];
|
||||
|
||||
return $fields;
|
||||
|
|
@ -77,7 +83,9 @@ class BadgelistController extends Controller
|
|||
if ($type == 'edit') {
|
||||
$values->groups = explode('#', $values->groups);
|
||||
$values->roles = explode('#', $values->roles);
|
||||
$values->conditions = implode('#', $values->conditions);
|
||||
}
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,13 +33,51 @@ class BannerController extends Controller
|
|||
foreach($channels->data->items as $channel){
|
||||
$channels_dd[$channel->id] = $channel->name;
|
||||
}
|
||||
$groups = $this->getlambda('get', 'ums', 'group', 'dropdown');
|
||||
$groups_dd = [];
|
||||
foreach($groups->data->items as $group){
|
||||
$groups_dd[$group->id] = $group->name;
|
||||
}
|
||||
$roles = $this->getlambda('get', 'ums', 'roles', 'dropdown');
|
||||
$roles_dd = [];
|
||||
foreach($roles->data->items as $role){
|
||||
$roles_dd[$role->id] = $role->name;
|
||||
}
|
||||
$forms = $this->getlambda('get', 'form', 'formentity', 'dropdown');
|
||||
$forms_dd = [];
|
||||
foreach($forms->data->items as $form){
|
||||
$forms_dd[$form->id] = $form->title;
|
||||
}
|
||||
|
||||
$forms = $this->getlambda('get', 'form', 'survey', 'dropdown');
|
||||
foreach($forms->data->items as $form){
|
||||
$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 [
|
||||
'title' => ['title' => 'Title', 'type' => 'text', 'required' => true],
|
||||
'channels' => ['title' => 'Channels', 'type' => 'multiselect', 'required' => true, 'values' => $channels_dd ],
|
||||
'scheduled' => ['title' => 'Scheduled', 'type' => 'yesno', 'required' => true, 'fullwidth' => true],
|
||||
'groups' => ['title' => 'Groups', 'type' => 'multiselect', 'required' => true, 'values' => $groups_dd ],
|
||||
'roles' => ['title' => 'Roles', 'type' => 'multiselect', 'required' => true, 'values' => $roles_dd ],
|
||||
|
||||
'scheduled' => ['title' => 'Scheduled', 'type' => 'yesno', 'required' => true],
|
||||
'position' => ['title' => 'Position', 'type' => 'select', 'required' => true, 'values' => ['default' => 'Default', 'below_stats' => 'Below Stats', 'popup' => 'Pop Up']],
|
||||
|
||||
'schedule_start_date' => ['title' => 'Schedule start date', 'type' => 'date'],
|
||||
'schedule_end_date' => ['title' => 'Schedule end date', 'type' => 'date'],
|
||||
'media_url' => ['title' => 'Banner Image', 'type' => 'image', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled']],
|
||||
|
||||
'has_cta' => ['title' => 'Has CTA', 'type' => 'yesno', 'required' => true, 'fullwidth' => true],
|
||||
'target_type' => ['title' => 'Target Type', 'type' => 'select', 'values' => ['internal_action' => 'Internal Action', 'form' => 'Web Form', 'survey' => 'Surveys', 'quiz' => 'Quizs', 'doctorlist' => 'Doctor List', 'external' => 'External Webpage'] ],
|
||||
'form_id' => ['title' => 'Form', 'type' => 'select', 'values' => $forms_dd ],
|
||||
'external_url' => ['title' => 'External Url / Internal Action', 'type' => 'text'],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -51,12 +89,21 @@ class BannerController extends Controller
|
|||
if( $request->file('media_url') ) {
|
||||
$data['media_url'] = $this->_uploadMedia($request, 'media_url', 'banners');
|
||||
}
|
||||
$data['groups'] = implode('#', $data['groups']);
|
||||
$data['roles'] = implode('#', $data['roles']);
|
||||
$data['form_id'] = isset($data['form_id']) ? $data['form_id'] : 'none';
|
||||
|
||||
//echo '<pre>'; print_r($data); exit;
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function _beforeform($type, $values) {
|
||||
if($type == 'edit') {
|
||||
$values->channels = explode('#', $values->channels);
|
||||
$values->groups = !isset($values->groups) ? '' : $values->groups;
|
||||
$values->roles = !isset($values->roles) ? '' : $values->roles;
|
||||
$values->groups = explode('#', $values->groups);
|
||||
$values->roles = explode('#', $values->roles);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,129 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Http\Client\ConnectionException;
|
||||
use DB;
|
||||
|
||||
class BdeimportController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'catalog';
|
||||
$this->_module = 'activity';
|
||||
$this->_viewname = 'bdeimport';
|
||||
$this->_title = 'BDE Import';
|
||||
$this->_base_url = '/bdeimport';
|
||||
}
|
||||
|
||||
protected function get_list_fields(){
|
||||
return [
|
||||
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
|
||||
'title' => ['title' => 'Title', 'type' => 'text'],
|
||||
'status' => ['title' => 'Status', 'type' => 'text'],
|
||||
'createdAt' => ['title' => 'Created At', 'type' => 'text'],
|
||||
];
|
||||
}
|
||||
|
||||
public function list(Request $request) {
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/import_list');
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
if($response->statusCode == 401) {
|
||||
return redirect('/unauthorised');
|
||||
}
|
||||
$fields = $this->get_list_fields();
|
||||
//echo '<pre>'; print_r($fields); exit;
|
||||
return $this->view($this->_listtype)->with([
|
||||
'title' => $this->_title,
|
||||
'fields' => $fields,
|
||||
'base_url' => $this->_base_url,
|
||||
'items' => $response->data->items,
|
||||
'buttons' => $this->get_list_buttons()
|
||||
]);
|
||||
}
|
||||
|
||||
protected function get_form_fields($type, $values){
|
||||
$mappings = $this->getlambda('get', 'metric', 'injestion_mapping', 'get_all');
|
||||
$mappings_dd = [];
|
||||
foreach($mappings->data->items as $mapping){
|
||||
$mappings_dd[$mapping->id] = $mapping->name;
|
||||
}
|
||||
//echo '<pre>'; print_r($mappings_dd); exit;
|
||||
return [
|
||||
'title' => ['title' => 'Title', 'type' => 'text', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
'file' => ['title' => 'File Upload', 'type' => 'file', 'required' => true],
|
||||
'mapping_id' => ['title' => 'Select Mapping', 'type' => 'select', 'values' => $mappings_dd ],
|
||||
];
|
||||
}
|
||||
|
||||
public function form($type, $id = null) {
|
||||
$values = [];
|
||||
if($type == 'edit') {
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/import_detail', ['id' => $id]);
|
||||
$values = $response->data->item;
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
}
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
$data = $this->_beforeform($type, $values);
|
||||
$fields = $this->get_form_fields($type, $values);
|
||||
//echo '<pre>'; print_r($fields); exit;
|
||||
return $this->view('form')->with([
|
||||
'title' => $this->_title,
|
||||
'mode' => $type,
|
||||
'fields' => $fields,
|
||||
'base_url' => $this->_base_url,
|
||||
'item' => $values,
|
||||
]);
|
||||
}
|
||||
|
||||
protected function _beforesave($type, $request) {
|
||||
$data = $request->except('_token');
|
||||
if( $request->file('file') ) {
|
||||
$data['file'] = $this->_uploadMedia($request, 'file', 'activity_import');
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function _beforeform($type, $values) {
|
||||
// if($type == 'edit') {
|
||||
// $values->channels = explode('#', $values->channels);
|
||||
// }
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
return $values;
|
||||
}
|
||||
|
||||
public function processimport(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/bdestep', ['id'=>$id, 'step'=>'status']);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return $this->view('processimport')->with(['id'=>$id, 'title'=>$response->data->status->title, 'status'=>$response->data->status->status, 'context'=>isset($response->data->status->context)?$response->data->status->context:[] ]);
|
||||
}
|
||||
|
||||
public function step(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$step = $request->input('step', 0);
|
||||
try {
|
||||
LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/bdestep', ['id'=>$id, 'step'=>$step]);
|
||||
} catch (ConnectionException $e) {
|
||||
return redirect('/activityimport/stepresponse?id='.$id.'&step='.$step);
|
||||
}
|
||||
}
|
||||
|
||||
public function stepresponse(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$step = $request->input('step', 0);
|
||||
return $this->view('stepresponse')->with(['id'=>$id, 'step'=>$step]);
|
||||
}
|
||||
|
||||
public function checkstatus(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$step = $request->input('step', 0);
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/bdestep', ['id'=>$id, 'step'=>'status']);
|
||||
return response()->json($response->data->status);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use DB;
|
||||
|
||||
class BrandController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'catalog';
|
||||
$this->_module = 'brand';
|
||||
$this->_viewname = 'brand';
|
||||
$this->_title = 'Brand';
|
||||
$this->_base_url = '/brand';
|
||||
}
|
||||
|
||||
protected function get_list_fields(){
|
||||
return [
|
||||
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
|
||||
'name' => ['title' => 'Brand Name', 'type' => 'text'],
|
||||
'type' => ['title' => 'Brand Type', 'type' => 'text'],
|
||||
'division' => ['title' => 'Division', 'type' => 'text'],
|
||||
'company' => ['title' => 'Company', 'type' => 'text'],
|
||||
'status' => ['title' => 'Status', 'type' => 'select'],
|
||||
];
|
||||
}
|
||||
|
||||
protected function get_form_fields($type, $values){
|
||||
// $channels = $this->getlambda('get', 'ums', 'channel', 'dropdown');
|
||||
// $channels_dd = [];
|
||||
// foreach($channels->data->items as $channel){
|
||||
// $channels_dd[$channel->id] = $channel->name;
|
||||
// }
|
||||
return [
|
||||
'name' => ['title' => 'Brand Name', 'type' => 'text', 'required' => true],
|
||||
'type' => ['title' => 'Brand Type', 'type' => 'select', 'values' => ['MDI'=>'MDI', 'DPI'=>'DPI', 'Oral'=>'Oral'] ],
|
||||
'division' => ['title' => 'Division', 'type' => 'text'],
|
||||
'company' => ['title' => 'Company', 'type' => 'text'],
|
||||
'focus_brand' => ['title' => 'Focus Brand', 'type' => 'text'],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
];
|
||||
}
|
||||
|
||||
protected function _beforesave($type, $request) {
|
||||
$data = $request->except('_token');
|
||||
// if($type == 'edit') {
|
||||
// $values->channels = explode('#', $values->channels);
|
||||
// }
|
||||
if( $request->file('media_url') ) {
|
||||
$data['media_url'] = $this->_uploadMedia($request, 'media_url', 'banners');
|
||||
}
|
||||
$data['type'] = isset($data['type']) ? $data['type'] : '';
|
||||
$data['division'] = isset($data['division']) ? $data['division'] : '';
|
||||
$data['company'] = isset($data['company']) ? $data['company'] : '';
|
||||
$data['focus_brand'] = isset($data['focus_brand']) ? $data['focus_brand'] : '';
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function _beforeform($type, $values) {
|
||||
// if($type == 'edit') {
|
||||
// $values->channels = explode('#', $values->channels);
|
||||
// }
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ class ComcampaignController extends Controller
|
|||
$channels[$chan->id] = $chan->name;
|
||||
}
|
||||
|
||||
$conlists = $this->getlambda('get', 'ums', 'contact_list', 'dropdown');
|
||||
$conlists = $this->getlambda('get', 'contact', 'contact_list', 'dropdown');
|
||||
$contactlists = [];
|
||||
foreach ($conlists->data->items as $conlist) {
|
||||
$contactlists[$conlist->id] = $conlist->name;
|
||||
|
|
|
|||
|
|
@ -77,6 +77,12 @@ class CompetitionController extends Controller
|
|||
$teams_dd[$team->id] = $team->name;
|
||||
}
|
||||
|
||||
$roles = $this->getlambda('get', 'ums', 'roles', 'dropdown');
|
||||
$roles_dd = [];
|
||||
foreach($roles->data->items as $role){
|
||||
$roles_dd[$role->id] = $role->name;
|
||||
}
|
||||
|
||||
$fields = [
|
||||
'title' => ['title' => 'Title', 'type' => 'text', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
|
|
@ -85,6 +91,10 @@ class CompetitionController extends Controller
|
|||
'description' => ['title' => 'Description', 'type' => 'textarea', 'required' => true, 'fullwidth' => true ],
|
||||
'validity_start' => ['title' => 'Validity start', 'type' => 'date', 'required' => true],
|
||||
'validity_end' => ['title' => 'Validity end', 'type' => 'date', 'required' => true],
|
||||
'ranking_method' => ['title' => 'Ranking Method', 'type' => 'select', 'required' => true, 'values' => ['Total' => 'Total', 'Average' => 'Average'] ],
|
||||
'points_unit' => ['title' => 'Points Units', 'type' => 'text', 'required' => true, ],
|
||||
'response_roles' => ['title' => 'Accept Response from Roles', 'type' => 'multiselect', 'values' => $roles_dd, 'required' => true],
|
||||
|
||||
'cover_image' => ['title' => 'Cover Image', 'type' => 'image', 'required' => true],
|
||||
'target_metrics' => ['title' => 'Choose Metric', 'type' => 'multiselect', 'required' => true, 'values' => $metrics_dd, 'fullwidth' => true ],
|
||||
'observers' => ['title' => 'Observers', 'type' => 'multiselect', 'values' => $users_dd, 'required' => true, 'fullwidth' => true],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use Log;
|
||||
use Auth;
|
||||
use DB;
|
||||
class CompetitionreportController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->_service = 'competition';
|
||||
$this->_module = 'contest';
|
||||
$this->_viewname = 'competition_contest';
|
||||
$this->_title = 'Competition Contests';
|
||||
$this->_base_url = '/competitionreport';
|
||||
}
|
||||
|
||||
public function dashboard(Request $request) {
|
||||
$id = $request->input('id', false);
|
||||
$domain = $request->input('domain', false);
|
||||
$user = DB::table('users')->where("domain", $domain)->select("access_token")->orderBy('updated_at', 'desc')->first();
|
||||
$competition = LambdaRequest::getrequest($this->_service, $this->_module.'/contest_dashboard', ['id' => $id ], $user->access_token );
|
||||
$competition = $competition->data->item;
|
||||
if (\View::exists('competition_contest.'.$competition->partition.'.dashboard-'.$competition->id)) {
|
||||
return view('competition_contest.'.$competition->partition.'.dashboard-'.$competition->id)->with(['competition' => $competition]);
|
||||
} elseif (\View::exists('competition_contest.dashboard-'.$competition->id)) {
|
||||
return view('competition_contest.dashboard-'.$competition->id)->with(['competition' => $competition]);
|
||||
} else {
|
||||
return view('competition_contest.dashboard')->with(['competition' => $competition]);
|
||||
}
|
||||
//return $this->deliverform($competition->data->item);
|
||||
}
|
||||
|
||||
public function teamdashboard(Request $request) {
|
||||
$id = $request->input('id', false);
|
||||
$team = $request->input('team', false);
|
||||
$domain = $request->input('domain', false);
|
||||
|
||||
$user = DB::table('users')->where("domain", $domain)->select("access_token")->orderBy('updated_at', 'desc')->first();
|
||||
$competition = LambdaRequest::getrequest($this->_service, $this->_module.'/team_dashboard', ['id' => $id, 'team' => $team ], $user->access_token );
|
||||
$competition = $competition->data->item;
|
||||
//echo '<pre>'; print_r($competition); exit;
|
||||
if (\View::exists('competition_contest.'.$competition->partition.'.team_dashboard-'.$competition->id)) {
|
||||
return view('competition_contest.'.$competition->partition.'.team_dashboard-'.$competition->id)->with(['competition' => $competition]);
|
||||
} elseif (\View::exists('competition_contest.team_dashboard-'.$competition->id)) {
|
||||
return view('competition_contest.team_dashboard-'.$competition->id)->with(['competition' => $competition]);
|
||||
} else {
|
||||
return view('competition_contest.team_dashboard')->with(['competition' => $competition]);
|
||||
}
|
||||
//return $this->deliverform($competition->data->item);
|
||||
}
|
||||
|
||||
public function contestmailer(Request $request) {
|
||||
$id = $request->input('id', false);
|
||||
$domain = $request->input('domain', false);
|
||||
$user = DB::table('users')->where("domain", $domain)->select("access_token")->orderBy('updated_at', 'desc')->first();
|
||||
$competition = LambdaRequest::getrequest($this->_service, $this->_module.'/contest_dashboard', ['id' => $id ], $user->access_token );
|
||||
$competition = $competition->data->item;
|
||||
if (\View::exists('competition_contest.'.$competition->partition.'.mailer-'.$competition->id)) {
|
||||
return view('competition_contest.'.$competition->partition.'.mailer-'.$competition->id)->with(['competition' => $competition]);
|
||||
} elseif (\View::exists('competition_contest.mailer-'.$competition->id)) {
|
||||
return view('competition_contest.mailer-'.$competition->id)->with(['competition' => $competition]);
|
||||
} else {
|
||||
return view('competition_contest.mailer')->with(['competition' => $competition]);
|
||||
}
|
||||
//return $this->deliverform($competition->data->item);
|
||||
}
|
||||
|
||||
public function contestteammailer(Request $request) {
|
||||
$id = $request->input('id', false);
|
||||
$team = $request->input('team', false);
|
||||
$domain = $request->input('domain', false);
|
||||
|
||||
$user = DB::table('users')->where("domain", $domain)->select("access_token")->orderBy('updated_at', 'desc')->first();
|
||||
$competition = LambdaRequest::getrequest($this->_service, $this->_module.'/team_dashboard', ['id' => $id, 'team' => $team ], $user->access_token );
|
||||
$competition = $competition->data->item;
|
||||
//echo '<pre>'; print_r($competition); exit;
|
||||
if (\View::exists('competition_contest.'.$competition->partition.'.team_mailer-'.$competition->id)) {
|
||||
return view('competition_contest.'.$competition->partition.'.team_mailer-'.$competition->id)->with(['competition' => $competition]);
|
||||
} elseif (\View::exists('competition_contest.team_mailer-'.$competition->id)) {
|
||||
return view('competition_contest.team_mailer-'.$competition->id)->with(['competition' => $competition]);
|
||||
} else {
|
||||
return view('competition_contest.team_mailer')->with(['competition' => $competition]);
|
||||
}
|
||||
//return $this->deliverform($competition->data->item);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,13 +6,15 @@ use App\Http\Requests\LambdaRequest;
|
|||
use DB;
|
||||
use League\Csv\Reader;
|
||||
use Log;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Exports\InvoicesExport;
|
||||
|
||||
class ContactController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'ums';
|
||||
$this->_service = 'contact';
|
||||
$this->_module = 'contact';
|
||||
$this->_viewname = 'contact';
|
||||
$this->_title = 'Contact';
|
||||
|
|
@ -32,12 +34,91 @@ class ContactController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
public function aggrid(Request $request) {
|
||||
$fields = [
|
||||
//'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
|
||||
'name' => ['title' => 'Name', 'type' => 'text', 'editable' => false],
|
||||
'msl_code' => ['title' => 'MSL Code', 'type' => 'text', 'editable' => false],
|
||||
'position_name' => ['title' => 'Position', 'type' => 'text', 'editable' => false],
|
||||
'user_name' => ['title' => 'Rep Name', 'type' => 'text', 'editable' => false],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'editable' => false],
|
||||
];
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, 'contactattribute/get_all');
|
||||
foreach($response->data->items as $item) {
|
||||
$fields[$item->code] = ['title' => $item->attribute, 'type' => $item->type, 'editable' => $item->editable == 'yes' ? true : false, 'options' => $item->options ];
|
||||
}
|
||||
//echo '<pre>'; print_r($fields); exit;
|
||||
|
||||
//echo $this->_listtype; exit;
|
||||
return $this->view('aggrid')->with([
|
||||
'title' => $this->_title,
|
||||
'fields' => $fields,
|
||||
'base_url' => $this->_base_url,
|
||||
//'items' => $response->data->items,
|
||||
'buttons' => $this->get_list_buttons()
|
||||
]);
|
||||
}
|
||||
|
||||
public function aggridajaxlist(Request $request) {
|
||||
$params = $request->input();
|
||||
$search = [];
|
||||
$fields = $this->get_list_fields();
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all', ['start' => 0, 'length' => 100, 'search' => json_encode($search), 'keyword' => '' ]);
|
||||
|
||||
$users = [];
|
||||
foreach($response->data->items as $item) {
|
||||
$user = [];
|
||||
if(isset($item->id)) {
|
||||
$user['id'] = $item->id;
|
||||
}
|
||||
foreach($fields as $field => $props){
|
||||
if($field != 'actions') {
|
||||
switch($props['type']){
|
||||
case('image'):
|
||||
$user[$field] = '<img src="'.$item->{$field}.'" class="img-thumbnail"> ';
|
||||
break;
|
||||
case('text'):
|
||||
case('select'):
|
||||
$user[$field] = isset($item->{$field}) ? $item->{$field} : '';
|
||||
break;
|
||||
case('date'):
|
||||
$user[$field] = date("d M Y", strtotime($item->{$field}));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// $user['actions'] = [];
|
||||
// foreach($props['buttons'] as $key => $button){
|
||||
// switch($button) {
|
||||
// case 'edit':
|
||||
// $user['actions'][] = ['link' => '/edit?id='.$item->id, 'icon' => 'square-edit-outline text-warning'];
|
||||
// break;
|
||||
// case 'delete':
|
||||
// $user['actions'][] = ['link' => '/delete?id='.$item->id, 'icon' => 'delete text-danger'];
|
||||
// break;
|
||||
// default:
|
||||
// $querystring = $button['querystring'];
|
||||
// foreach((array)$item as $k => $v) {
|
||||
// if(strpos($querystring,'{'.strtoupper($k).'}') !== false)
|
||||
// $querystring = str_replace('{'.strtoupper($k).'}', $v, $querystring);
|
||||
// }
|
||||
// $user['actions'][] = ['link' => '/'.$key.'?'.$querystring, 'icon' => $button['icon']];
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
$users[] = $user;
|
||||
}
|
||||
|
||||
return response()->json($users);
|
||||
}
|
||||
|
||||
protected function get_list_buttons() {
|
||||
return [ ['title' => 'Add New', 'link' => $this->_base_url.'/addnew' ], ['title' => 'Import Users', 'link' => $this->_base_url.'/import'] ];
|
||||
return [ ['title' => 'Add New', 'link' => $this->_base_url.'/addnew' ], ['title' => 'Import Users', 'link' => $this->_base_url.'/import'], ['title' => 'Export Users', 'link' => $this->_base_url.'/export'] ];
|
||||
}
|
||||
|
||||
protected function get_import_fields($records){
|
||||
$response = LambdaRequest::signedrequest('get', 'ums', 'contactattribute/get_all');
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, 'contactattribute/get_all');
|
||||
$hierar = $this->getlambda('get', 'ums', 'hierarchy', 'dropdown');
|
||||
$hierar_dd = [];
|
||||
foreach($hierar->data->items as $hier){
|
||||
|
|
@ -63,7 +144,6 @@ class ContactController extends Controller
|
|||
}
|
||||
$fields[$item->code] = ['title' => $item->attribute, 'type' => $item->type, 'required' => $item->required=='yes'?true:false, 'values' => $values];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +179,7 @@ class ContactController extends Controller
|
|||
}
|
||||
|
||||
protected function get_form_fields($type, $values){
|
||||
$response = LambdaRequest::signedrequest('get', 'ums', 'contactattribute/get_all');
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, 'contactattribute/get_all');
|
||||
$hierar = $this->getlambda('get', 'ums', 'hierarchy', 'dropdown');
|
||||
$hierar_dd = [];
|
||||
foreach($hierar->data->items as $hier){
|
||||
|
|
@ -170,6 +250,49 @@ class ContactController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function export(Request $request) {
|
||||
$attributes = LambdaRequest::signedrequest('get', $this->_service, 'contactattribute/get_all', []);
|
||||
$fields = [];
|
||||
foreach($attributes->data->items as $attri) {
|
||||
$fields[] = $attri->code;
|
||||
}
|
||||
$fields[] = 'user_info';
|
||||
$fields[] = 'msl_code';
|
||||
$fields[] = 'position';
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all', ['source' => 'dynamodb', 'belowme' => 'yes', 'search' => json_encode([]), 'keyword' => "", 'fields' => json_encode($fields) ]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
|
||||
$headers = ['Name', 'Email', 'Phone', 'MSL Code', 'Position', 'Rep Name', 'Rep Employee Code', 'Position Name', 'Position Code', 'Status'];
|
||||
foreach($attributes->data->items as $attri) {
|
||||
$headers[] = $attri->attribute;
|
||||
}
|
||||
|
||||
$exceldata[] = $headers;
|
||||
foreach($response->data->items as $user) {
|
||||
$row = [];
|
||||
$row[] = isset($user->name) ? $user->name : '-';
|
||||
$row[] = isset($user->email) ? $user->email : '-';
|
||||
$row[] = isset($user->phone) ? $user->phone : '-';
|
||||
$row[] = isset($user->msl_code) ? $user->msl_code : '-';
|
||||
$row[] = isset($user->position) ? $user->position : '-';
|
||||
|
||||
$row[] = isset($user->user_info->name) ? $user->user_info->name : '-';
|
||||
$row[] = isset($user->user_info->employee_code) ? $user->user_info->employee_code : '-';
|
||||
|
||||
$row[] = isset($user->hierarchy_info->name) ? $user->hierarchy_info->name : '-';
|
||||
$row[] = isset($user->hierarchy_info->code) ? $user->hierarchy_info->code : '-';
|
||||
$row[] = isset($user->status) ? $user->status : '-';
|
||||
|
||||
foreach($attributes->data->items as $attri) {
|
||||
$row[] = isset($user->{$attri->code}) ? $user->{$attri->code} : '-';
|
||||
}
|
||||
$exceldata[] = $row;
|
||||
}
|
||||
return Excel::download(new InvoicesExport($exceldata), 'contacts.xlsx');
|
||||
}
|
||||
|
||||
|
||||
// public function postimport(Request $request) {
|
||||
// if( $request->file('importfile') ) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class ContactattributeController extends Controller
|
|||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'ums';
|
||||
$this->_service = 'contact';
|
||||
$this->_module = 'contactattribute';
|
||||
$this->_viewname = 'contactattribute';
|
||||
$this->_title = 'Contact Attributes';
|
||||
|
|
@ -43,17 +43,29 @@ class ContactattributeController extends Controller
|
|||
return [
|
||||
'attribute' => ['title' => 'Attribute', 'type' => 'text', 'required' => true],
|
||||
'code' => ['title' => 'Code (small caps without spaces and special chars except "_")', 'type' => 'text', 'required' => true],
|
||||
'type' => ['title' => 'Attribute Type', 'type' => 'select', 'required' => true, 'values' => ['text' => 'Text', 'number' => 'Number', 'date' => 'Date', 'email' => 'Email', 'url' => 'Url', 'select' => 'Dropdown', 'checkbox' => 'Checkbox', 'radio' => 'Radio'] ],
|
||||
'required' => ['title' => 'Is Required', 'type' => 'yesno', 'required' => true],
|
||||
'editable' => ['title' => 'Is Editable', 'type' => 'yesno', 'required' => true],
|
||||
'type' => ['title' => 'Attribute Type', 'type' => 'select', 'required' => true, 'values' => ['text' => 'Text', 'number' => 'Number', 'date' => 'Date', 'email' => 'Email', 'url' => 'Url', 'select' => 'Dropdown', 'checkbox' => 'Checkbox', 'radio' => 'Radio'] ],
|
||||
|
||||
'sort_order' => ['title' => 'Sort Order', 'type' => 'number', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
'options' => ['title' => 'Options', 'type' => 'mapping', 'fullwidth' => true ],
|
||||
];
|
||||
}
|
||||
|
||||
protected function _beforeform($type, $values) {
|
||||
if($type == 'edit') {
|
||||
$this->_request->session()->put('entity_id', $values->id);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
protected function _beforesave($type, $request) {
|
||||
$data = $request->except('_token');
|
||||
$data['entity_id'] = $request->session()->get('entity_id');
|
||||
$data['id'] = $request->session()->get('entity_id');
|
||||
if(!$data['id']) {
|
||||
unset($data['id']);
|
||||
}
|
||||
$options = [];
|
||||
if(isset($data['option_value'])) {
|
||||
foreach($data['option_value'] as $k => $ov) {
|
||||
|
|
@ -63,6 +75,7 @@ class ContactattributeController extends Controller
|
|||
unset($data['option_value']);
|
||||
unset($data['option_name']);
|
||||
}
|
||||
//echo '<pre>'; print_r($data); exit;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ class ContactlistController extends Controller
|
|||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'ums';
|
||||
$this->_service = 'contact';
|
||||
$this->_module = 'contact_list';
|
||||
$this->_viewname = 'contactlist';
|
||||
$this->_title = 'Contact List';
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ use Illuminate\Http\Request;
|
|||
use App\Http\Requests\LambdaRequest;
|
||||
use League\Csv\Reader;
|
||||
use Log;
|
||||
use Auth;
|
||||
use DB;
|
||||
use App\Jobs\Importdata;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
|
|
@ -168,14 +171,42 @@ class Controller extends BaseController
|
|||
|
||||
public function postimport(Request $request) {
|
||||
if( $request->file('importfile') ) {
|
||||
|
||||
$path = $request->file('importfile')->store('user_import');
|
||||
$request->session()->put('user_import_path', $path);
|
||||
return redirect($this->_base_url.'/importmap')->withMessage('Successfully Uploaded !!!');
|
||||
$csv = Reader::createFromPath(storage_path('app') .'/' . $path, 'r');
|
||||
$csv->setHeaderOffset(0);
|
||||
|
||||
$header = $csv->getHeader(); //returns the CSV header record
|
||||
$records = $csv->getRecords(); //returns all the CSV records as an Iterator object
|
||||
$fields = $this->get_import_fields($records);
|
||||
if($this->validateImport($header, $records)) {
|
||||
$path = $request->file('importfile')->store('user_import', 's3');
|
||||
$user = Auth::user();
|
||||
$id = DB::table('import_jobs')->insertGetId(['user_id' => $user->id, 'domain' => $user->domain, 'service' => $this->_service, 'module' => $this->_module, 'filepath' => $path, 'status' => 1 ]);
|
||||
Importdata::dispatch($id);
|
||||
return redirect($this->_base_url.'/importprocess?id='.$id)->withMessage('Successfully Uploaded !!!');
|
||||
} else {
|
||||
return \Redirect::back()->withMessage('CSV File incorrect. Either not all required fields have values or data type is incorrect. Please check and try again!');
|
||||
}
|
||||
} else {
|
||||
return \Redirect::back()->withMessage('Some Error occured!');
|
||||
}
|
||||
}
|
||||
|
||||
public function importprocess(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$import = DB::table('import_jobs')->where('id', $id)->first();
|
||||
return $this->view('importprocess')->with(['baseurl' => $this->_base_url, 'id' => $id]);
|
||||
}
|
||||
|
||||
public function importstatus(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$import = DB::table('import_jobs')->where('id', $id)->first();
|
||||
return response()->json($import);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function importmap(Request $request) {
|
||||
$path = $request->session()->get('user_import_path');
|
||||
$csv = Reader::createFromPath(storage_path('app') .'/' . $path, 'r');
|
||||
|
|
@ -301,7 +332,15 @@ class Controller extends BaseController
|
|||
protected function _uploadMedia($request, $name = 'image', $folder = 'image') {
|
||||
$path = '';
|
||||
try {
|
||||
if( $request->file($name) ) {
|
||||
if(is_array($request->file($name))) {
|
||||
$paths = [];
|
||||
foreach($request->file($name) as $file) {
|
||||
$path = $file->store($folder, 's3');
|
||||
$path = env('AWS_URL').'/'.$path;
|
||||
$paths[] = $path;
|
||||
}
|
||||
$path = implode(',', $paths);
|
||||
} else if( $request->file($name) ) {
|
||||
$path = $request->file($name)->store($folder, 's3');
|
||||
$path = env('AWS_URL').'/'.$path;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,15 @@ class DashboardController extends Controller
|
|||
} else {
|
||||
$campaigns = [];
|
||||
}
|
||||
//echo '<pre>'; print_r($campaigns); exit;
|
||||
$widgets = [];
|
||||
// if(isset($widgets) && $widgets->statusCode == 200) {
|
||||
// $widgets = $widgets->data->campaigns;
|
||||
// } else {
|
||||
// $widgets = [];
|
||||
// }
|
||||
//echo '<pre>'; print_r($widgets); exit;
|
||||
|
||||
return view('index')->with(['metrics' => isset($reports->data->metrics) ? $reports->data->metrics : [], 'widgets' => $widgets->data->widgets, 'campaigns' => $campaigns]);
|
||||
return view('index')->with(['metrics' => isset($reports->data->metrics) ? $reports->data->metrics : [], 'widgets' => $widgets, 'campaigns' => $campaigns]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,19 @@ class DetailingcontestController extends Controller
|
|||
//
|
||||
protected function get_list_fields(){
|
||||
return [
|
||||
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete', 'responses' => ['icon' => 'image-multiple', 'querystring' => 'id={ID}'], 'report' => ['icon' => 'text-box-outline', 'querystring' => 'id={ID}'] ] ],
|
||||
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete', 'metrics' => ['icon' => 'book-arrow-right', 'querystring' => 'id={ID}'], 'responses' => ['icon' => 'image-multiple', 'querystring' => 'id={ID}'], 'report' => ['icon' => 'chart-pie', 'querystring' => 'id={ID}'], ] ], // 'report' => ['icon' => 'text-box-outline', 'querystring' => 'id={ID}']
|
||||
'name' => ['title' => 'Title', 'type' => 'text'],
|
||||
'marks' => ['title' => 'Marks', 'type' => 'text'],
|
||||
|
||||
'no_of_participants' => ['title' => 'No of participants', 'type' => 'text'],
|
||||
'no_of_uploads' => ['title' => 'No of uploads', 'type' => 'text'],
|
||||
'no_of_evaluations' => ['title' => 'No of evaluations', 'type' => 'text'],
|
||||
'pass_count' => ['title' => 'Pass Count', 'type' => 'text'],
|
||||
'fail_count' => ['title' => 'Fail Count', 'type' => 'text'],
|
||||
'published_on' => ['title' => 'Published On', 'type' => 'date'],
|
||||
|
||||
'is_published' => ['title' => 'Published', 'type' => 'select'],
|
||||
'is_result_published' => ['title' => 'Result Published', 'type' => 'select'],
|
||||
'status' => ['title' => 'Status', 'type' => 'select'],
|
||||
];
|
||||
}
|
||||
|
|
@ -59,24 +69,46 @@ class DetailingcontestController extends Controller
|
|||
'groups' => ['title' => 'Groups', 'type' => 'multiselect', 'required' => true, 'values' => $groups_dd ],
|
||||
'evaluators' => ['title' => 'Evaluators', 'type' => 'multiselect', 'required' => true, 'values' => $users_dd ],
|
||||
'observers' => ['title' => 'Observers', 'type' => 'multiselect', 'required' => true, 'values' => $users_dd ],
|
||||
|
||||
'evaluation_parameters' => ['title' => 'Evaluation Parameters', 'type' => 'multiselect', 'required' => true, 'values' => $params_dd ],
|
||||
'evaluation_workflow' => ['title' => 'Evaluator Type', 'type' => 'select', 'required' => true, 'values' => ['ANY' => 'ANY', 'ALL' => 'ALL'] ],
|
||||
'media_type' => ['title' => 'Media Type', 'type' => 'select', 'required' => true, 'values' => ['audio' => 'Audio', 'video' => 'Video', 'pdf' => 'PDF', 'image' => 'Image',] ],
|
||||
'media' => ['title' => 'Media', 'type' => 'file', 'required' => true],
|
||||
|
||||
'dashboard_image' => ['title' => 'Dashboard Image', 'type' => 'image', 'required' => true],
|
||||
'cover_image' => ['title' => 'Cover Image', 'type' => 'image', 'required' => true],
|
||||
|
||||
'media_type' => ['title' => 'Media Type', 'type' => 'select', 'required' => true, 'values' => ['audio' => 'Audio', 'video' => 'Video', 'pdf' => 'PDF', 'image' => 'Image',] ],
|
||||
'response_sources' => ['title' => 'Response Sources', 'type' => 'multiselect', 'required' => true, 'values' => ['CAMERA' => 'CAMERA', 'GALLERY' => 'GALLERY'] ],
|
||||
'media' => ['title' => 'Media', 'type' => 'file', 'required' => true],
|
||||
|
||||
'response_types' => ['title' => 'Response Types', 'type' => 'checkbox', 'required' => true, 'values' => ['audio' => 'Audio', 'video' => 'Video', 'pdf' => 'PDF', 'image' => 'Image',] ],
|
||||
'response_sources' => ['title' => 'Response Sources', 'type' => 'multiselect', 'required' => true, 'values' => ['CAMERA' => 'CAMERA', 'GALLERY' => 'GALLERY'] ],
|
||||
'response_self_delete' => ['title' => 'Response Deletion Access', 'type' => 'yesno', 'required' => true],
|
||||
'limits_audio' => ['title' => 'Audio Duration Limit (in sec)', 'type' => 'number', 'required' => true],
|
||||
'limits_video' => ['title' => 'Video Duration Limit (in sec)', 'type' => 'number', 'required' => true],
|
||||
'limits_size' => ['title' => 'Max file Size (in MB)', 'type' => 'number', 'required' => true],
|
||||
|
||||
'response_self_delete' => ['title' => 'Can delete self Response before Evaluation', 'type' => 'yesno', 'required' => true],
|
||||
'allow_self_evaluation' => ['title' => 'Is Self Evaluation Enabled', 'type' => 'yesno', 'required' => true],
|
||||
'evaluation_workflow' => ['title' => 'Evaluator Type', 'type' => 'select', 'required' => true, 'values' => ['ANY' => 'ANY', 'ALL' => 'ALL'] ],
|
||||
|
||||
'result_publish_count' => ['title' => 'Result Publish Count', 'type' => 'number', 'required' => true],
|
||||
'marks' => ['title' => 'Marks', 'type' => 'number', 'required' => true],
|
||||
|
||||
'is_published' => ['title' => 'Is Published', 'type' => 'yesno', 'required' => true],
|
||||
'is_reattempt_allowed' => ['title' => 'Is Reattempt allowed', 'type' => 'yesno', 'required' => true],
|
||||
'no_of_reattempts' => ['title' => 'No of Reattempts', 'type' => 'number', 'required' => true],
|
||||
|
||||
'validate_evaluations' => ['title' => 'Validate Evaluations', 'type' => 'yesno', 'required' => true],
|
||||
'validation_type' => ['title' => 'Validation Type', 'type' => 'select', 'required' => true, 'values' => ['none' => 'None', 'warning' => 'Warning', 'warning_for_top' => 'Warning for top', 'stop' => 'Stop', 'stop_for_top' => 'Stop for top',]],
|
||||
|
||||
// 'is_result_published' => ['title' => 'Is Result Published', 'type' => 'yesno', 'required' => true],
|
||||
|
||||
'additional_evaluators' => ['title' => 'Additional Evaluators', 'type' => 'checkbox', 'required' => true, 'values' => ['level_1_manager' => '1st line manager', 'level_2_manager' => '2nd line manager', 'random_manager' => 'Random Manager',]],
|
||||
'response_roles' => ['title' => 'Accept Response from Roles', 'type' => 'multiselect', 'values' => $roles_dd, 'required' => true]
|
||||
'response_roles' => ['title' => 'Accept Response from Roles', 'type' => 'multiselect', 'values' => $roles_dd, 'required' => true],
|
||||
|
||||
'show_pass_fail_icon' => ['title' => 'Show Pass/Fail icons on Responses', 'type' => 'yesno', 'required' => true, 'fullwidth' => true],
|
||||
'pass_icon' => ['title' => 'Pass Icon', 'type' => 'image', 'required' => true],
|
||||
'fail_icon' => ['title' => 'Fail Icon', 'type' => 'image', 'required' => true],
|
||||
|
||||
//'metrics' => ['title' => 'Choose Metric', 'type' => 'mapping', 'required' => true, 'metrics' => $metrics_dd, 'types' => ['unit' => 'Units', 'count' => 'Count'] , 'fullwidth' => true ]
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
protected function _beforesave($type, $request) {
|
||||
|
|
@ -87,11 +119,31 @@ class DetailingcontestController extends Controller
|
|||
if( $request->file('media') ) {
|
||||
$data['media'] = $this->_uploadMedia($request, 'media', 'detailing');
|
||||
}
|
||||
if( $request->file('dashboard_image') ) {
|
||||
$data['dashboard_image'] = $this->_uploadMedia($request, 'dashboard_image', 'detailing');
|
||||
}
|
||||
if( $request->file('pass_icon') ) {
|
||||
$data['pass_icon'] = $this->_uploadMedia($request, 'pass_icon', 'detailing');
|
||||
}
|
||||
if( $request->file('fail_icon') ) {
|
||||
$data['fail_icon'] = $this->_uploadMedia($request, 'fail_icon', 'detailing');
|
||||
}
|
||||
$data['limits'] = ['video' => $data['limits_video'], 'audio' => $data['limits_audio'], 'size' => $data['limits_size'] ];
|
||||
unset($data['limits_video']);
|
||||
unset($data['limits_audio']);
|
||||
unset($data['limits_size']);
|
||||
//echo '<pre>'; print_r($data); exit;
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function _beforeform($type, $values) {
|
||||
if($type == 'edit') {
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
if(isset($values->limits)) {
|
||||
$values->limits_video = $values->limits->video ?? 0;
|
||||
$values->limits_audio = $values->limits->audio ?? 0;
|
||||
$values->limits_size = $values->limits->size ?? 0;
|
||||
}
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
if(isset($values->groups))
|
||||
$values->groups = explode('#', $values->groups);
|
||||
|
|
@ -136,11 +188,79 @@ class DetailingcontestController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
public function report(Request $request) {
|
||||
$con_id = $request->input('id', 0);
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, 'contest_response/get_all', ['con_id' => $con_id]);
|
||||
echo '<pre>'; print_r($response); exit;
|
||||
public function metrics(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_one', ['id' => $id]);
|
||||
$parameters = $this->getlambda('get', 'detailing', 'parameter', 'get_all');
|
||||
$params_dd = [];
|
||||
$params_dd['no_of_uploads'] = 'No. of uploads';
|
||||
$params_dd['total_score'] = 'Total score';
|
||||
$params_dd['average_score'] = 'Average score';
|
||||
foreach($parameters->data->items as $param){
|
||||
$params_dd[$param->id] = $param->title . ' (Scale: ' . $param->scale . ')';
|
||||
}
|
||||
$metrics = $this->getlambda('get', 'metric', 'metric', 'get_all');
|
||||
$metrics_dd = [];
|
||||
foreach($metrics->data->items as $metric){
|
||||
$metrics_dd[$metric->id] = $metric->name;
|
||||
}
|
||||
//echo '<pre>'; print_r($response->data->item); exit;
|
||||
return $this->view('metrics')->with([
|
||||
'parameters' => $params_dd,
|
||||
'metrics' => $metrics_dd,
|
||||
'item' => $response->data->item,
|
||||
]);
|
||||
}
|
||||
|
||||
echo $con_id; exit;
|
||||
public function postmetrics(Request $request) {
|
||||
$post = $request->except('_token');
|
||||
//echo '<pre>'; print_r($post); exit;
|
||||
$mapping = [];
|
||||
foreach($post['metric'] as $i => $metric) {
|
||||
$mapping[] = ['metric' => $metric, 'parameter' => $post['parameter'][$i] ];
|
||||
}
|
||||
$data = ['id' => $post['id'], 'metrics' => json_encode($mapping), 'metric_mapping_auth_key' => $post['metric_mapping_auth_key'] ];
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/update', $data);
|
||||
return redirect('/detailingcontests')->withMessage('Contest Metrics Saved!');
|
||||
}
|
||||
|
||||
public function report(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/detailreport', ['id' => $id]);
|
||||
return $this->view('report')->with([
|
||||
'parameters' => $response->data->parameters,
|
||||
'users' => $response->data->users,
|
||||
]);
|
||||
}
|
||||
|
||||
protected function get_list_buttons() {
|
||||
return [ ['title' => 'Add New', 'link' => $this->_base_url.'/addnew' ],
|
||||
['title' => 'Export Contests', 'link' => $this->_base_url.'s' ],
|
||||
['title' => 'Send Reminders', 'link' => $this->_base_url.'s' ] ];
|
||||
}
|
||||
|
||||
public function status(Request $request) {
|
||||
$id = $request->input('id', 0);
|
||||
$action = $request->input('action', 0);
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_one', ['id' => $id]);
|
||||
$toupdate = [];
|
||||
switch($action) {
|
||||
case 'publish':
|
||||
$toupdate = ['is_published' => 'yes', 'is_result_published' => 'no'];
|
||||
break;
|
||||
case 'unpublish':
|
||||
$toupdate = ['is_published' => 'no', 'is_result_published' => 'no'];
|
||||
break;
|
||||
case 'publish_result':
|
||||
$toupdate = ['is_published' => 'yes', 'is_result_published' => 'yes'];
|
||||
break;
|
||||
case 'unpublish_result':
|
||||
$toupdate = ['is_published' => 'yes', 'is_result_published' => 'no'];
|
||||
break;
|
||||
}
|
||||
$toupdate['id'] = $id;
|
||||
//echo '<pre>'; print_r($toupdate); exit;
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/update', $toupdate);
|
||||
return redirect('/detailingcontest/edit?id='.$id)->withMessage('Detailing Contest Updated!');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class DetailingcontestresponseController extends Controller
|
|||
return redirect('/magazines')->withError('Magazine not found!');
|
||||
}
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all', ['con_id' => $con_id]);
|
||||
//echo '<pre>'; print_r($response->data->evaluations); exit;
|
||||
echo '<pre>'; print_r($response->data); exit;
|
||||
$items = [];
|
||||
foreach ($response->data->items as $item) {
|
||||
$item->user_name = $item->user_info->name;
|
||||
|
|
@ -33,7 +33,7 @@ class DetailingcontestresponseController extends Controller
|
|||
|
||||
$fields = $this->get_list_fields();
|
||||
return $this->view('list')->with([
|
||||
'title' => $this->_title,
|
||||
'title' => $this->_title . ' : ' . $response->data->contest->name,
|
||||
'fields' => $fields,
|
||||
'base_url' => $this->_base_url,
|
||||
'items' => $items,
|
||||
|
|
@ -54,6 +54,10 @@ class DetailingcontestresponseController extends Controller
|
|||
'user_name' => ['title' => 'User Name', 'type' => 'text'],
|
||||
'title' => ['title' => 'Media Name', 'type' => 'text'],
|
||||
'media_type' => ['title' => 'Media Type', 'type' => 'text'],
|
||||
'createdAt' => ['title' => 'Submitted On', 'type' => 'date'],
|
||||
'marks' => ['title' => 'Avg. Marks', 'type' => 'text'],
|
||||
'total' => ['title' => 'Avg. Total', 'type' => 'text'],
|
||||
'result' => ['title' => 'Result', 'type' => 'text'],
|
||||
'no_of_evaluations' => ['title' => 'No of Evaluations', 'type' => 'text'],
|
||||
'likes_count' => ['title' => 'Likes', 'type' => 'text'],
|
||||
'comments_count' => ['title' => 'Comments', 'type' => 'text'],
|
||||
|
|
|
|||
|
|
@ -21,17 +21,42 @@ class DoctorController extends Controller
|
|||
public function list(Request $request)
|
||||
{
|
||||
$post = $request->input();
|
||||
echo '<pre>'; print_r($post); exit;
|
||||
|
||||
if ($token != '') {
|
||||
$request->session()->put('metric_access_key', $token);
|
||||
if (isset($post['code'])) {
|
||||
$request->session()->put('metric_access_key', $post['code']);
|
||||
} else {
|
||||
$token = $request->session()->get('metric_access_key');
|
||||
$post['code'] = $request->session()->get('metric_access_key');
|
||||
}
|
||||
$response = LambdaRequest::getrequest($this->_service, $this->_module . '/get_my_contacts', [], $token);
|
||||
$fields = $this->get_list_fields();
|
||||
|
||||
$response = LambdaRequest::getrequest($this->_service, $this->_module . '/mydoctors', ['code' => $post['code']]);
|
||||
$request->session()->put('hierarchy', $response->data->hierarchy);
|
||||
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
|
||||
$fields = [
|
||||
//'actions' => ['title' => 'Actions', 'type' => 'button', 'buttons' => ['edit', 'delete']],
|
||||
'name' => ['title' => 'Name', 'type' => 'text', 'required' => true],
|
||||
'email' => ['title' => 'Email', 'type' => 'email', 'required' => true],
|
||||
'phone' => ['title' => 'Phone', 'type' => 'text', 'required' => true],
|
||||
'msl_code' => ['title' => 'MSL Code', 'type' => 'text'],
|
||||
// 'position' => ['title' => 'Position', 'type' => 'select', 'required' => true, 'values' => $hierar_dd ],
|
||||
// 'practice_type' => ['title' => 'Practice', 'type' => 'select', 'required' => true, 'values' => $values ],
|
||||
//'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active', 'disabled']],
|
||||
];
|
||||
|
||||
foreach($response->data->attributes as $attribute) {
|
||||
$options = [];
|
||||
foreach($attribute->options as $opts) {
|
||||
$options[$opts->value] = $opts->display;
|
||||
}
|
||||
|
||||
$fields[$attribute->code] = ['title' => $attribute->attribute, 'type' => $attribute->type, 'values' => $options, 'required' => $attribute->required == 'yes' ];
|
||||
}
|
||||
$fields['status'] = ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active'=>'Active', 'disabled'=>'Disabled']];
|
||||
//echo '<pre>'; print_r($fields); exit;
|
||||
|
||||
return $this->view('list')->with([
|
||||
'title' => $this->_title,
|
||||
'user_id' => $response->data->user,
|
||||
'fields' => $fields,
|
||||
'base_url' => $this->_base_url,
|
||||
'items' => $response->data->items,
|
||||
|
|
@ -39,106 +64,16 @@ class DoctorController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
public function form($type, $id = null)
|
||||
{
|
||||
$token = $this->_request->session()->get('metric_access_key');
|
||||
$values = [];
|
||||
if ($type == 'edit') {
|
||||
$response = LambdaRequest::getrequest($this->_service, $this->_module . '/get_one', ['id' => $id], $token);
|
||||
$values = $response->data->item;
|
||||
}
|
||||
$data = $this->_beforeform($type, $values);
|
||||
$fields = $this->get_form_fields($type, $values, $token);
|
||||
return $this->view('form')->with([
|
||||
'title' => $this->_title,
|
||||
'mode' => $type,
|
||||
'fields' => $fields,
|
||||
'base_url' => $this->_base_url,
|
||||
'item' => $values,
|
||||
]);
|
||||
}
|
||||
|
||||
public function save($type, $request)
|
||||
public function postsubmit( $request)
|
||||
{
|
||||
$token = $request->session()->get('metric_access_key');
|
||||
if ($type == 'edit') {
|
||||
$url = '/update';
|
||||
} else {
|
||||
$url = '/create';
|
||||
}
|
||||
$data = $this->_beforesave($type, $request);
|
||||
$response = LambdaRequest::postrequest($this->_service, $this->_module . $url, $data, $token);
|
||||
$token = $request->session()->get('metric_access_key');
|
||||
$post = $request->except('_token');
|
||||
$response = LambdaRequest::postrequest($this->_service, $this->_module . '/updatemydoctor', ['post' => $post, 'code' => $token]);
|
||||
if ($response->statusCode == 200 && $response->status == "success") {
|
||||
return redirect($this->_base_url . 's')->withMessage('Successfully Saved !!!');
|
||||
} else {
|
||||
return redirect($this->_base_url . 's')->withError('Some Error occured! ' . $response->body->message);
|
||||
}
|
||||
}
|
||||
|
||||
public function createdoctor(Request $request)
|
||||
{
|
||||
return Doctor::create($request->only(['msl_code', 'email', 'contact_id', 'name', 'phone']))->id;
|
||||
}
|
||||
|
||||
protected function get_list_fields()
|
||||
{
|
||||
return [
|
||||
'actions' => ['title' => 'Actions', 'buttons' => ['edit', 'delete']],
|
||||
'name' => ['title' => 'Name', 'type' => 'text'],
|
||||
'msl_code' => ['title' => 'MSL Code', 'type' => 'text']
|
||||
];
|
||||
}
|
||||
|
||||
public function action($action, Request $request)
|
||||
{
|
||||
$this->_request = $request;
|
||||
switch ($action) {
|
||||
case 'edit':
|
||||
return $this->form('edit', $request->input('id'));
|
||||
break;
|
||||
case 'addnew':
|
||||
return $this->form('new');
|
||||
break;
|
||||
case 'delete':
|
||||
return $this->delete($request->input('id'));
|
||||
break;
|
||||
default:
|
||||
return $this->{$action}($request);
|
||||
break;
|
||||
}
|
||||
}
|
||||
protected function get_form_fields($type, $values, $token)
|
||||
{
|
||||
$response = LambdaRequest::getrequest('ums', 'contactattribute/get_all', [], $token);
|
||||
$fields = [
|
||||
'name' => ['title' => 'Name', 'type' => 'text', 'required' => true],
|
||||
'email' => ['title' => 'Email', 'type' => 'email', 'required' => true],
|
||||
'phone' => ['title' => 'Phone', 'type' => 'text', 'required' => true],
|
||||
'msl_code' => ['title' => 'MSL Code', 'type' => 'text'],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled']],
|
||||
];
|
||||
|
||||
foreach ($response->data->items as $item) {
|
||||
$values = [];
|
||||
if (in_array($item->type, ['select', 'radio', 'checkbox'])) {
|
||||
foreach ($item->options as $op) {
|
||||
$values[$op->value] = $op->display;
|
||||
}
|
||||
}
|
||||
$fields[$item->code] = ['title' => $item->attribute, 'type' => $item->type, 'required' => $item->required == 'yes' ? true : false, 'values' => $values];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
public function delete($id)
|
||||
{
|
||||
$token = $this->_request->session()->get('metric_access_key');
|
||||
|
||||
$response = LambdaRequest::getrequest($this->_service, $this->_module . '/delete', ['id' => $id], $token);
|
||||
if ($response->statusCode == 200 && $response->status == "success") {
|
||||
return redirect($this->_base_url . 's')->withMessage('Successfully Marked Deleted !!!');
|
||||
} else {
|
||||
return redirect($this->_base_url . 's')->withError('Some Error occured! ' . $response->body->message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class DomainController extends Controller
|
|||
'10' => 'November',
|
||||
'11' => 'December',
|
||||
];
|
||||
|
||||
|
||||
return [
|
||||
'id' => ['title' => '', 'type' => 'hidden'],
|
||||
'name' => ['title' => 'Domain Name', 'type' => 'text', 'required' => true],
|
||||
|
|
@ -90,17 +90,38 @@ class DomainController extends Controller
|
|||
'logo' => ['title' => 'Group Image or Icon', 'type' => 'image', 'required' => true],
|
||||
'description' => ['title' => 'Description', 'type' => 'textarea', 'required' => true],
|
||||
'year_start_month' => ['title' => 'Year start month', 'type' => 'select', 'required' => true, 'values' => $months],
|
||||
|
||||
'login_scheme' => ['title' => 'login Scheme', 'type' => 'select', 'required' => true, 'values' => ['OTP' => 'OTP', 'Password' => 'Password'] ],
|
||||
'otp_scheme' => ['title' => 'OTP Scheme', 'type' => 'select', 'required' => true, 'values' => ['email' => 'Email Only', 'email_wa_pull' => 'Email + Whatsapp Request', 'email_wa_push' => 'Email + Whatsapp Push', 'wa_pull' => 'Whatsapp Request Only', 'wa_push' => 'Whatsapp Push Only'] ],
|
||||
'force_change_password' => ['title' => 'Force Change Password', 'type' => 'select', 'required' => true, 'values' => ['Yes' => 'Yes', 'No' => 'No'] ],
|
||||
'enable_registration' => ['title' => 'Enable Registration', 'type' => 'select', 'required' => true, 'values' => ['Yes' => 'Yes', 'No' => 'No'] ],
|
||||
'registration_default_role' => ['title' => 'Registration default Role', 'type' => 'select', 'values' => $roles_dd],
|
||||
'registration_default_designation' => ['title' => 'Registration default Designation', 'type' => 'text'],
|
||||
|
||||
'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],
|
||||
'static_otp_for_roles' => ['title' => 'Use Statis OTP for Roles', 'type' => 'multitextbox', 'values' => $roles_dd, 'fullwidth' => true],
|
||||
'dynamic_otp_for_roles' => ['title' => 'Use Dynamic OTP for Roles', 'type' => 'multiselect', 'values' => $roles_dd],
|
||||
'message_recipient_list' => ['title' => 'Messages Recipient List', 'type' => 'select', 'required' => true, 'values' => ['show_all_users' => 'Show all users', 'show_users_under_hierarchy' => 'Show users under hierarchy', 'show_users_under_hierarchy_and_peers' => 'Show users under hierarchy & peers', 'show_users_under_hierarchy_same_level' => 'Show users under hierarchy & at same level'] ],
|
||||
'appreciation_recipient_list' => ['title' => 'Appreciation Recipient List', 'type' => 'select', 'required' => true, 'values' => ['show_all_users' => 'Show all users', 'show_users_under_hierarchy' => 'Show users under hierarchy', 'show_users_under_hierarchy_and_peers' => 'Show users under hierarchy & peers', 'show_users_under_hierarchy_same_level' => 'Show users under hierarchy & at same level'] ],
|
||||
'badges_recipient_list' => ['title' => 'Badges Recipient List', 'type' => 'select', 'required' => true, 'values' => ['show_all_users' => 'Show all users', 'show_users_under_hierarchy' => 'Show users under hierarchy', 'show_users_under_hierarchy_and_peers' => 'Show users under hierarchy & peers', 'show_users_under_hierarchy_same_level' => 'Show users under hierarchy & at same level'] ],
|
||||
|
||||
'terms_text' => ['title' => 'Login Terms & Conditions Text', 'type' => 'textarea', 'required' => true, 'fullwidth' => true],
|
||||
'android_server_key' => ['title' => 'Android Server Key', 'type' => 'textarea', 'fullwidth' => true],
|
||||
'ios_server_key' => ['title' => 'IOS Server Key', 'type' => 'textarea', 'fullwidth' => true],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
protected function _beforesave($type, $request) {
|
||||
$data = $request->except('_token');
|
||||
$static_otp_for_roles = [];
|
||||
foreach($data['static_otp_for_roles'] as $k => $v) {
|
||||
if(!empty($v)) {
|
||||
$static_otp_for_roles[] = ['role' => $k, 'otp' => $v];
|
||||
}
|
||||
}
|
||||
$data['static_otp_for_roles'] = json_encode($static_otp_for_roles);
|
||||
if( $request->file('logo') ) {
|
||||
$data['logo'] = $this->_uploadMedia($request, 'logo', 'domain');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use Illuminate\Support\Facades\Cache;
|
|||
use Aws\Ses\SesClient;
|
||||
use Aws\Credentials\CredentialProvider;
|
||||
use Illuminate\Support\Str;
|
||||
use Response;
|
||||
|
||||
class FormController extends Controller
|
||||
{
|
||||
|
|
@ -31,11 +32,13 @@ 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') {
|
||||
// if($formdata->form_id == '1711609582-e93dba24-9c98-43e7-b97a-b22d64d9b9fc') {
|
||||
// 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 ];
|
||||
Log::debug(print_r($data, true));
|
||||
//echo '<pre>'; print_r($data); exit;
|
||||
if(sizeof($additional_info) > 0) {
|
||||
$data['additional'] = $additional_info;
|
||||
}
|
||||
|
|
@ -94,6 +97,8 @@ class FormController extends Controller
|
|||
return view('form.'.$finfo->data->formdata->partition.'.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, 'formdata' => $finfo->data->formdata ]);
|
||||
} elseif (\View::exists('form.list-'.$finfo->data->formdata->form_id)) {
|
||||
return view('form.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, 'formdata' => $finfo->data->formdata ]);
|
||||
} elseif (\View::exists('form.'.$finfo->data->formdata->partition.'.list')) {
|
||||
return view('form.'.$finfo->data->formdata->partition.'.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, 'formdata' => $finfo->data->formdata ]);
|
||||
} else {
|
||||
return view('form.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, 'formdata' => $finfo->data->formdata ]);
|
||||
}
|
||||
|
|
@ -130,9 +135,9 @@ class FormController extends Controller
|
|||
}
|
||||
}
|
||||
$html .= '<th>';
|
||||
if( in_array('edit', $submission->actions) ){
|
||||
//if( in_array('edit', $submission->actions) && (strtotime("now") - strtotime($submission->createdAt)) < 432000 ){
|
||||
$html .= '<a href="/form/edit?id='.$submission->id.'" class="btn btn-primary btn-xs">Edit</button>';
|
||||
}
|
||||
//}
|
||||
$html .= '</th>
|
||||
</tr>';
|
||||
}
|
||||
|
|
@ -144,12 +149,39 @@ class FormController extends Controller
|
|||
$formdata = $request->session()->get('formdata');
|
||||
//Log::debug(print_r($formdata, true));
|
||||
$id = $request->input('id', false);
|
||||
$action = $request->input('action', false);
|
||||
Log::debug(print_r(['form_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition, 'id' => $id ], true));
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/getformdefination', ['form_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition, 'id' => $id ]);
|
||||
//Log::debug(print_r($finfo, true));
|
||||
$formdata->formdata = $finfo->data->formdata;
|
||||
//echo '<pre>'; print_r($formdata); print_r($finfo); exit;
|
||||
if($formdata->form_id == '1711947857-4fbd5d43-d176-4ec7-aff2-e4dec4b6e02a' && isset($action) && $action == 'delete') {
|
||||
$contact_id = false;
|
||||
foreach($finfo->data->questions as $que) {
|
||||
if($que->code == 'contact_id') {
|
||||
$contact_id = $que->value;
|
||||
}
|
||||
}
|
||||
list($application, $domain) = explode("-", $formdata->partition);
|
||||
$token = DB::table('users')->select("access_token")->where("domain", $domain)->where("permissions", 'like', '%contact_delete%')->orderBy('updated_at', 'desc')->skip(0)->take(1)->get();
|
||||
LambdaRequest::getrequest('contact', 'contact/delete', ['id' => $contact_id], $token[0]->access_token);
|
||||
LambdaRequest::getrequest('form', 'formentity/deletesubmission', ['id' => $id, 'form_id' => $formdata->form_id], $token[0]->access_token);
|
||||
return redirect('/form/history')->withMessage('Successfully Deleted !!!');
|
||||
}
|
||||
$formdata->title = $finfo->data->formdata->title;
|
||||
return $this->deliverform($formdata, $finfo->data->questions, $id);
|
||||
}
|
||||
|
||||
public function deletesubmission(Request $request) {
|
||||
$formdata = $request->session()->get('formdata');
|
||||
//Log::debug(print_r($formdata, true));
|
||||
$id = $request->input('id', false);
|
||||
$form_id = $request->input('form_id', false);
|
||||
list($application, $domain) = explode("-", $formdata->partition);
|
||||
$token = DB::table('users')->select("access_token")->where("domain", $domain)->where("permissions", 'like', '%contact_create%')->orderBy('updated_at', 'desc')->skip(0)->take(1)->get();
|
||||
LambdaRequest::getrequest('form', 'formentity/deletesubmission', ['form_id' => $form_id, 'id' => $id ], $token[0]->access_token);
|
||||
return redirect('/form/history')->withMessage('Successfully Deleted !!!');
|
||||
}
|
||||
|
||||
public function submit(Request $request) {
|
||||
$post = $request->except('_token');
|
||||
|
|
@ -195,7 +227,10 @@ class FormController extends Controller
|
|||
if(isset($post['id']) && $post['id']=='') unset($post['id']);
|
||||
|
||||
$formdata = $request->session()->get('formdata');
|
||||
|
||||
if(!$formdata) {
|
||||
$formdata = (object)[];
|
||||
}
|
||||
$formdata->form_id = $post['form_id'];
|
||||
// if($formdata->partition == 'rapport-copd') {
|
||||
// return response()->json(['status' => 'failure']);
|
||||
// }
|
||||
|
|
@ -206,14 +241,20 @@ class FormController extends Controller
|
|||
if(isset($post['user_id']) && $post['user_id'] != '') {
|
||||
$formdata->user_id = $post['user_id'];
|
||||
}
|
||||
if(isset($post['partition']) && $post['partition'] != '') {
|
||||
$formdata->partition = $post['partition'];
|
||||
}
|
||||
$request->session()->put('formdata', $formdata);
|
||||
if(isset($formdata) && !empty($formdata) && $formdata->user_id != '') {
|
||||
$post = $this->processformdata($formdata->form_id, $post, $formdata->user_id, $formdata->partition);
|
||||
|
||||
Log::debug(print_r($post, true));
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/submitform', ['formdata' => $post, 'entity_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]);
|
||||
Log::debug(print_r($finfo, true));
|
||||
if($finfo->status == 'success') {
|
||||
return response()->json(['status' => 'success']);
|
||||
} else {
|
||||
if($finfo->statusCode == 401) {
|
||||
return response()->json(['status' => 'failure', 'message' => $finfo->data ]);
|
||||
}
|
||||
return response()->json(['status' => 'failure']);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -224,12 +265,129 @@ class FormController extends Controller
|
|||
public function ajaxsubmitmultiple(Request $request) {
|
||||
$post = $request->except('_token');
|
||||
$formdata = $request->session()->get('formdata');
|
||||
|
||||
$formdata->form_id = $post['form_id'];
|
||||
// if($formdata->partition == 'rapport-copd') {
|
||||
// return response()->json(['status' => 'failure']);
|
||||
// }
|
||||
if(isset($post['user_id']) && $post['user_id'] != '') {
|
||||
$formdata->user_id = $post['user_id'];
|
||||
}
|
||||
$request->session()->put('formdata', $formdata);
|
||||
Log::debug(print_r($formdata, true));
|
||||
|
||||
if($formdata->form_id == '1716267411-74ef7199-6298-4bae-8c8b-c069a405c864') {
|
||||
$contacts = [];
|
||||
foreach($post['contact_id'] as $i => $contact_id) {
|
||||
$contacts[] = ['contact_id' => $contact_id, 'proxym_tuesday' => isset($post['proxym_tuesday'][$i])?'Yes':'No', 'ferium_xt_thursday' => isset($post['ferium_xt_thursday'][$i])?'Yes':'No', 'galact_saturday' => isset($post['galact_saturday'][$i])?'Yes':'No' ];
|
||||
}
|
||||
list($application, $domain) = explode("-", $formdata->partition);
|
||||
$token = DB::table('users')->select("access_token")->where("domain", $domain)->where("permissions", 'like', '%contact_create%')->orderBy('updated_at', 'desc')->skip(0)->take(1)->get();
|
||||
|
||||
foreach($contacts as $contact) {
|
||||
$contactdata = [
|
||||
'domain' => $domain,
|
||||
'application' => $application,
|
||||
'user_id' => $post['user_id'],
|
||||
'hierarchy' => $post['hierarchy_id'],
|
||||
'proxym_tuesday' => $contact['proxym_tuesday'],
|
||||
'ferium_xt_thursday' => $contact['ferium_xt_thursday'],
|
||||
'galact_saturday' => $contact['galact_saturday'],
|
||||
'id' => $contact['contact_id'],
|
||||
];
|
||||
$cont = LambdaRequest::postrequest('contact', 'contact/update', $contactdata, $token[0]->access_token);
|
||||
}
|
||||
return response()->json(['status' => 'success']);
|
||||
}
|
||||
|
||||
//["rtm","telma_ln_ecme","zita_ecme"]
|
||||
if($formdata->form_id == '1721281521-a4a857d7-84d7-4e4c-9df3-4e9c9f999d64') {
|
||||
$contacts = [];
|
||||
foreach($post['contact_id'] as $i => $contact_id) {
|
||||
$contacts[] = ['contact_id' => $contact_id, 'zita_ecme' => isset($post['zita_ecme'][$i])?'Yes':'No', 'telma_ln_ecme' => isset($post['telma_ln_ecme'][$i])?'Yes':'No', 'rtm' => isset($post['rtm'][$i])?'Yes':'No' ];
|
||||
}
|
||||
list($application, $domain) = explode("-", $formdata->partition);
|
||||
$token = DB::table('users')->select("access_token")->where("domain", $domain)->where("permissions", 'like', '%contact_create%')->orderBy('updated_at', 'desc')->skip(0)->take(1)->get();
|
||||
$post['contact_id'] = [];
|
||||
$post['zita_ecme'] = [];
|
||||
$post['telma_ln_ecme'] = [];
|
||||
$post['rtm'] = [];
|
||||
foreach($contacts as $i => $contact) {
|
||||
$contactdata = [
|
||||
'domain' => $domain,
|
||||
'application' => $application,
|
||||
'user_id' => $post['user_id'],
|
||||
//'hierarchy' => $post['hierarchy_id'],
|
||||
'zita_ecme' => $contact['zita_ecme'],
|
||||
'telma_ln_ecme' => $contact['telma_ln_ecme'],
|
||||
'rtm' => $contact['rtm'],
|
||||
'id' => $contact['contact_id'],
|
||||
];
|
||||
$cont = LambdaRequest::postrequest('contact', 'contact/update', $contactdata, $token[0]->access_token);
|
||||
$post['contact_id'][$i] = $contact['contact_id'];
|
||||
$post['zita_ecme'][$i] = $contact['zita_ecme'];
|
||||
$post['telma_ln_ecme'][$i] = $contact['telma_ln_ecme'];
|
||||
$post['rtm'][$i] = $contact['rtm'];
|
||||
}
|
||||
return response()->json(['status' => 'success']);
|
||||
}
|
||||
|
||||
if($formdata->form_id == '1716267411-74ef7199-6298-4bae-c2c-c069a405c864') {
|
||||
$contacts = [];
|
||||
foreach($post['contact_id'] as $i => $contact_id) {
|
||||
$contacts[] = ['contact_id' => $contact_id, 'c2c' => isset($post['c2c'][$i])?'Yes':'No' ];
|
||||
}
|
||||
|
||||
list($application, $domain) = explode("-", $formdata->partition);
|
||||
$token = DB::table('users')->select("access_token")->where("domain", $domain)->where("permissions", 'like', '%contact_create%')->orderBy('updated_at', 'desc')->skip(0)->take(1)->get();
|
||||
|
||||
foreach($contacts as $contact) {
|
||||
$contactdata = [
|
||||
'domain' => $domain,
|
||||
'application' => $application,
|
||||
'user_id' => $post['user_id'],
|
||||
'hierarchy' => $post['hierarchy_id'],
|
||||
'c2c' => $contact['c2c'],
|
||||
'id' => $contact['contact_id'],
|
||||
];
|
||||
$cont = LambdaRequest::postrequest('contact', 'contact/update', $contactdata, $token[0]->access_token);
|
||||
}
|
||||
return response()->json(['status' => 'success']);
|
||||
}
|
||||
|
||||
if($formdata->form_id == '1723015306-c8d90868-1c50-4820-ab96-474cdff8e543') {
|
||||
$contacts = [];
|
||||
foreach($post['contact_id'] as $i => $contact_id) {
|
||||
$contacts[] = ['contact_id' => $contact_id, 'glycoquic_f' => isset($post['glycoquic_f'][$i])?'Yes':'No' ];
|
||||
}
|
||||
|
||||
list($application, $domain) = explode("-", $formdata->partition);
|
||||
$token = DB::table('users')->select("access_token")->where("domain", $domain)->where("permissions", 'like', '%contact_create%')->orderBy('updated_at', 'desc')->skip(0)->take(1)->get();
|
||||
|
||||
foreach($contacts as $contact) {
|
||||
$contactdata = [
|
||||
'domain' => $domain,
|
||||
'application' => $application,
|
||||
'user_id' => $post['user_id'],
|
||||
'glycoquic_f' => $contact['glycoquic_f'],
|
||||
'id' => $contact['contact_id'],
|
||||
];
|
||||
$cont = LambdaRequest::postrequest('contact', 'contact/update', $contactdata, $token[0]->access_token);
|
||||
}
|
||||
return response()->json(['status' => 'success']);
|
||||
}
|
||||
|
||||
if($formdata->form_id == '1713426268-c89f38eb-ec32-43ba-a81b-b690a8f90d6a') {
|
||||
if(DB::table('team3_nebyatra_doctors')->where('user_id', $formdata->user_id)->wherein('mobile_number', $post['mobile_number'])->exists() ){
|
||||
$phones = DB::table('team3_nebyatra_doctors')->select("mobile_number")->where('user_id', $formdata->user_id)->wherein('mobile_number', $post['mobile_number'])->get();
|
||||
$matched = [];
|
||||
foreach($phones as $phone) {
|
||||
$matched[] = $phone->mobile_number;
|
||||
}
|
||||
return response()->json(['status' => 'failure', 'message' => 'Some Mobile numbers you entered already exists. Numbers are ' . implode(', ', $matched) ]);
|
||||
}
|
||||
}
|
||||
if(isset($formdata) && !empty($formdata) && $formdata->user_id != '') {
|
||||
$post = $this->processformdata($formdata->form_id, $post);
|
||||
$post = $this->processformdata($formdata->form_id, $post, $formdata->user_id, $formdata->partition);
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/submitmultipleform', ['formdata' => $post, 'entity_id' => $post['form_id'], 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]);
|
||||
//Log::debug(print_r($finfo, true));
|
||||
if($finfo->status == 'success') {
|
||||
|
|
@ -245,21 +403,83 @@ class FormController extends Controller
|
|||
public function approvereject(Request $request) {
|
||||
$formdata = $request->session()->get('formdata');
|
||||
$post = $request->all();
|
||||
$user = DB::table('users')->where('domain', str_replace('rapport-', '',$formdata->partition ) )->first();
|
||||
//$user = DB::table('users')->where('domain', str_replace('rapport-', '',$formdata->partition ) )->first();
|
||||
|
||||
list($app, $domain) = explode('-', $formdata->partition);
|
||||
$user = DB::table('users')->select("access_token")->where('domain', $domain )->orderBy('updated_at', 'desc')->skip(0)->take(1)->get();
|
||||
Log::debug(print_r($formdata, true));
|
||||
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/approvereject', ['submission_id' => $post['id'], 'action' => $post['action'] ], $user->access_token);
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/approvereject', ['submission_id' => $post['id'], 'action' => $post['action'] ], $user[0]->access_token);
|
||||
Log::debug(print_r($user, true));
|
||||
Log::debug(print_r($finfo, true));
|
||||
|
||||
Log::debug(print_r($formdata, true));
|
||||
Log::debug(print_r($post, true));
|
||||
|
||||
|
||||
return response()->json($post);
|
||||
}
|
||||
|
||||
public function approverejectmultiple(Request $request) {
|
||||
$post = $request->all();
|
||||
foreach($post['ids'] as $id) {
|
||||
LambdaRequest::postrequest('form', 'formentity/approvereject', ['submission_id' => $id, 'action' => $post['action'] ], Auth::user()->access_token);
|
||||
}
|
||||
return response()->json($post);
|
||||
}
|
||||
|
||||
public function allaprovers(Request $request) {
|
||||
$post = $request->all();
|
||||
$allapprovers = LambdaRequest::postrequest('form', 'formentity/allapprovers', ['submission_id' => $post['submission_id'], 'form_id' => $post['form_id'] ], Auth::user()->access_token);
|
||||
return response()->json($allapprovers->data->approvals);
|
||||
}
|
||||
|
||||
protected function processformdata($form, $post, $user_id = 0, $partition = '' ) {
|
||||
switch($form) {
|
||||
case '1711609582-e93dba24-9c98-43e7-b97a-b22d64d9b9fc':
|
||||
case '1711609582-e93dba24-9c98-43e7-neb2-b22d64d9b9fc':
|
||||
list($application, $domain) = explode("-", $partition);
|
||||
$token = DB::table('users')->select("access_token")->where("domain", $domain)->where("permissions", 'like', '%contact_create%')->orderBy('updated_at', 'desc')->skip(0)->take(1)->get();
|
||||
$contactdata = [
|
||||
'domain' => $domain,
|
||||
'application' => $application,
|
||||
'user_id' => $user_id,
|
||||
'name' => $post['chemist_name'],
|
||||
'current_business' => $post['current_business'],
|
||||
'type' => 'chemist',
|
||||
'category' => isset($post['category']) ? $post['category'] : '',
|
||||
'msl_code' => strtotime("now").'-'.rand(1000,9999)
|
||||
];
|
||||
if(isset($post['id'])) {
|
||||
$contactdata['id'] = $post['contact_id'];
|
||||
unset($post['contact_id']);
|
||||
$contact = LambdaRequest::postrequest('contact', 'contact/update', $contactdata, $token[0]->access_token);
|
||||
} else {
|
||||
$contact = LambdaRequest::postrequest('contact', 'contact/create', $contactdata, $token[0]->access_token);
|
||||
}
|
||||
$post['contact_id'] = $contact->data->item->id;
|
||||
break;
|
||||
case '1711947857-4fbd5d43-d176-4ec7-aff2-e4dec4b6e02a':
|
||||
list($application, $domain) = explode("-", $partition);
|
||||
$token = DB::table('users')->select("access_token")->where("domain", $domain)->where("permissions", 'like', '%contact_create%')->orderBy('updated_at', 'desc')->skip(0)->take(1)->get();
|
||||
$contactdata = [
|
||||
'domain' => $domain,
|
||||
'application' => $application,
|
||||
'user_id' => $user_id,
|
||||
'name' => $post['chemist_name'],
|
||||
'current_business' => $post['current_business'],
|
||||
'type' => 'chemist',
|
||||
'doctor_name' => $post['doctor_name'],
|
||||
'category' => $post['category'],
|
||||
'doctor_msl_code' => $post['msl_code'],
|
||||
'doctor_speciality' => $post['speciality'],
|
||||
'msl_code' => strtotime("now").'-'.rand(1000,9999)
|
||||
];
|
||||
if(isset($post['id'])) {
|
||||
$contactdata['id'] = $post['contact_id'];
|
||||
unset($post['contact_id']);
|
||||
$contact = LambdaRequest::postrequest('contact', 'contact/update', $contactdata, $token[0]->access_token);
|
||||
} else {
|
||||
$contact = LambdaRequest::postrequest('contact', 'contact/create', $contactdata, $token[0]->access_token);
|
||||
}
|
||||
$post['contact_id'] = $contact->data->item->id;
|
||||
break;
|
||||
case '1654748343-81b065ee-e05c-431c-a44d-706afc1c16f4':
|
||||
if($post['contact_id'] == 'other') {
|
||||
$post['contact_id'] = '';
|
||||
|
|
@ -390,7 +610,7 @@ class FormController extends Controller
|
|||
break;
|
||||
case '1669979081-e991fc27-e8c1-4120-9883-b42af09244d3':
|
||||
case '1689236085-9aaa37ba-601b-4414-b1fc-a26e9cc722df':
|
||||
if(isset($post['execution_done']) && $post['execution_done'] == 'yes') {
|
||||
if(isset($post['execution_done']) && $post['execution_done'] == 'yes' && isset($post['activity_type'])) {
|
||||
$post[$post['activity_type']] = 1;
|
||||
}
|
||||
break;
|
||||
|
|
@ -486,6 +706,29 @@ class FormController extends Controller
|
|||
$post = $first_post;
|
||||
}
|
||||
break;
|
||||
case '1713426268-c89f38eb-ec32-43ba-a81b-b690a8f90d6a':
|
||||
if(is_array($post['doctor_name']) ) {
|
||||
$execCount = sizeof($post['doctor_name']);
|
||||
$planed = LambdaRequest::postrequest('form', 'formentity/getformdefination', ['form_id' => '1713425460-8bdf7394-01b5-48f3-8985-343b465dd685', 'user_id' => $user_id, 'partition' => $partition, 'id' => $post['plan_id'] ]);
|
||||
$plandata = $planed->data->formdata;
|
||||
if(isset($plandata->execution_count)) {
|
||||
$plandata->execution_count += $execCount;
|
||||
} else {
|
||||
$plandata->execution_count = $execCount;
|
||||
}
|
||||
$plandata->id = $post['plan_id'];
|
||||
LambdaRequest::postrequest('form', 'formentity/submitform', ['formdata' => (array)$plandata, 'entity_id' => '1713425460-8bdf7394-01b5-48f3-8985-343b465dd685', 'user_id' => $user_id, 'partition' => $partition ]);
|
||||
$post['plan_id'] = [];
|
||||
foreach($post['doctor_name'] as $i => $dn) {
|
||||
$post['plan_id'][] = $plandata->id;
|
||||
DB::table('team3_nebyatra_doctors')->updateOrInsert(
|
||||
['user_id' => $user_id, 'mobile_number' => $post['mobile_number'][$i] ],
|
||||
['doctor_name' => $dn, 'email_id' => $post['email_id'][$i], 'speciality' => $post['speciality'][$i], 'location' => $post['location'][$i], 'district' => $post['district'][$i], 'state' => $post['state'][$i], 'date_added' => $post['record_date'][$i] ]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $post;
|
||||
|
|
@ -493,12 +736,49 @@ class FormController extends Controller
|
|||
|
||||
public function history(Request $request) {
|
||||
$formdata = $request->session()->get('formdata');
|
||||
//Log::debug(print_r($formdata, true));
|
||||
$form_id = $request->input('form_id', $formdata->form_id);
|
||||
$formdata->form_id = $form_id;
|
||||
$request->session()->put('formdata', $formdata);
|
||||
//echo '<pre>'; print_r($formdata); exit;
|
||||
$history = LambdaRequest::postrequest('form', 'formentity/getformhistory', ['form_id' => $form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]);
|
||||
//echo '<pre>'; print_r($history); print_r($formdata); exit;
|
||||
//Log::debug(print_r($history, true));
|
||||
if($form_id == '1713426268-c89f38eb-ec32-43ba-a81b-b690a8f90d6a') {
|
||||
$plan_id = $request->input('plan_id', '');
|
||||
$submissions = [];
|
||||
foreach($history->data->submissions as $sub) {
|
||||
if(isset($sub->formdata->plan_id) && $sub->formdata->plan_id == $plan_id) {
|
||||
$submissions[] = $sub;
|
||||
}
|
||||
}
|
||||
$data = ['form' => $history->data->form, 'questions' => $history->data->questions, 'submissions' => $submissions, 'formname' => $history->data->formname, 'form_id' => $form_id ];
|
||||
} else {
|
||||
$data = ['form' => $history->data->form, 'questions' => $history->data->questions, 'submissions' => $history->data->submissions, 'formname' => $history->data->formname, 'form_id' => $form_id ];
|
||||
}
|
||||
|
||||
if($request->input('export', false)) {
|
||||
$exceldata = [];
|
||||
$exceldata[] = [$formdata->title];
|
||||
$exceldata[] = [''];
|
||||
$headers = ['Submission Date', 'Submitted By', 'Approval Status'];
|
||||
foreach($history->data->questions as $question) {
|
||||
$headers[] = $question->label;
|
||||
}
|
||||
$exceldata[] = $headers;
|
||||
foreach($history->data->submissions as $submission) {
|
||||
$row = [];
|
||||
$row[] = $submission->createdAt;
|
||||
$row[] = isset($submission->user_info->name) ? $submission->user_info->name : '';
|
||||
$row[] = isset($submission->workflow_status) ? $submission->workflow_status : '';
|
||||
foreach($history->data->questions as $q => $v) {
|
||||
$row[] = isset($submission->formdata->{$q}) ? $submission->formdata->{$q} : '-';
|
||||
}
|
||||
$exceldata[] = $row;
|
||||
}
|
||||
return Excel::download(new InvoicesExport($exceldata), $formdata->title.'.xlsx');
|
||||
}
|
||||
|
||||
$data = ['questions' => $history->data->questions, 'submissions' => $history->data->submissions, 'formname' => $history->data->formname, 'form_id' => $form_id ];
|
||||
if (\View::exists('form.'.$formdata->partition.'.'.$formdata->form_id.'-history')) {
|
||||
return view('form.'.$formdata->partition.'.'.$formdata->form_id.'-history')->with($data);
|
||||
} elseif (\View::exists('form.'.$formdata->form_id.'-history')) {
|
||||
|
|
@ -517,13 +797,13 @@ class FormController extends Controller
|
|||
//'user_id' => $formdata->user_id,
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/getformdefination', ['form_id' => $formdata->form_id, 'partition' => $formdata->partition, 'id' => $id ]);
|
||||
$formdata->title = $finfo->data->formdata->title;
|
||||
Log::debug(print_r(['form_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition, 'id' => $id ], true));
|
||||
//Log::debug(print_r($finfo->data->formdata, true));
|
||||
if (\View::exists('form.'.$formdata->partition.'.'.$formdata->form_id)) {
|
||||
return view('form.'.$formdata->partition.'.'.$formdata->form_id)->with(['questions' => $finfo->data->questions,'form_id' => $formdata->form_id, 'form' => $formdata, 'id' => $id ]);
|
||||
return view('form.'.$formdata->partition.'.'.$formdata->form_id)->with(['questions' => $finfo->data->questions,'form_id' => $formdata->form_id, 'form' => $formdata, 'id' => $id, 'formdata' => $finfo->data->formdata ]);
|
||||
} elseif (\View::exists('form.'.$formdata->form_id)) {
|
||||
return view('form.'.$formdata->form_id)->with(['questions' => $finfo->data->questions,'form_id' => $formdata->form_id, 'form' => $formdata, 'id' => $id ]);
|
||||
return view('form.'.$formdata->form_id)->with(['questions' => $finfo->data->questions,'form_id' => $formdata->form_id, 'form' => $formdata, 'id' => $id, 'formdata' => $finfo->data->formdata ]);
|
||||
} else {
|
||||
return view('form.common')->with(['questions' => $finfo->data->questions, 'form_id' => $formdata->form_id, 'form' => $formdata, 'id' => $id ]);
|
||||
return view('form.common')->with(['questions' => $finfo->data->questions, 'form_id' => $formdata->form_id, 'form' => $formdata, 'id' => $id, 'formdata' => $finfo->data->formdata ]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -567,12 +847,17 @@ class FormController extends Controller
|
|||
|
||||
public function metricreport(Request $request) {
|
||||
$post = $request->input();
|
||||
Log::debug(print_r($post, true));
|
||||
$token = $request->header('Authorization');
|
||||
if($token != '') {
|
||||
$request->session()->put('metric_access_key', $token);
|
||||
} elseif(array_key_exists('authorization', $post)) {
|
||||
$token = $post['authorization'];
|
||||
$request->session()->put('metric_access_key', $token);
|
||||
} else {
|
||||
$token = $request->session()->get('metric_access_key');
|
||||
}
|
||||
//Log::debug('Token is:' . $token);
|
||||
$download = (isset($post['download']) && $post['download'] == 1) ? 1 : 0;
|
||||
$email = (isset($post['email']) && $post['email'] == 1) ? 1 : 0;
|
||||
$s3 = (isset($post['s3']) && $post['s3'] == 1) ? 1 : 0;
|
||||
|
|
@ -581,7 +866,7 @@ class FormController extends Controller
|
|||
unset($post['s3']);
|
||||
|
||||
$response = LambdaRequest::postrequest('metric', 'metric_report/view', $post, $token);
|
||||
//Log::debug(print_r($response, true));
|
||||
Log::debug(print_r($response, true));
|
||||
//echo '<pre>'; print_r($response); print_r($post); exit;
|
||||
|
||||
$breadcrumbs = [];
|
||||
|
|
@ -684,6 +969,11 @@ class FormController extends Controller
|
|||
$row = [];
|
||||
$row[] = $contact->name;
|
||||
$row[] = $contact->msl_code;
|
||||
|
||||
if(!isset($response->data->graph->values->users->{$contact->id})) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$user = $response->data->graph->values->users->{$contact->id};
|
||||
|
||||
$row[] = $user->name;
|
||||
|
|
@ -776,7 +1066,7 @@ class FormController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
protected function deliverpersonalization($formdata, $questions, $personalizations) {
|
||||
protected function deliverpersonalization($formdata, $questions, $personalizations) {
|
||||
$additional_info = $this->get_additional_info($formdata);
|
||||
//echo '<pre>'; print_r($formdata); print_r($questions); print_r($personalizations); exit;
|
||||
$data = ['questions' => $questions, 'form' => $formdata, 'form_id' => $formdata->form_id, 'personalizations' => $personalizations ];
|
||||
|
|
@ -938,6 +1228,22 @@ class FormController extends Controller
|
|||
imagettftext($outputImage, $pos->size, 0, $pos->x, $pos->y, $white, $font, $text);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'multiline':
|
||||
if(isset($form_info[$pos->field_name])) {
|
||||
$font = storage_path('app').'/fonts/'.$pos->font;
|
||||
$pos->color = explode('-',$pos->color);
|
||||
$white = imagecolorallocate($outputImage, $pos->color[0], $pos->color[1], $pos->color[2]);
|
||||
$text = $form_info[$pos->field_name];
|
||||
$lines = wordwrap($text, $pos->linechars, "\n", true);
|
||||
$xPosition = $pos->x;
|
||||
$yPosition = $pos->y;
|
||||
foreach (explode("\n", $lines) as $line) {
|
||||
imagettftext($outputImage, $pos->size, 0, $xPosition, $yPosition, $white, $font, $line);
|
||||
$yPosition += $pos->linehieght;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1188,6 +1494,7 @@ class FormController extends Controller
|
|||
} else {
|
||||
//echo '<prE>';print_r($form_info); exit;
|
||||
$res = ['folder' => 'personalized/'.$form_info['form_id'].'/', 'images' => $form_info['genareted_image'] ];
|
||||
$res['form_info'] = $form_info;
|
||||
if(isset($form_info['pdf_file'])) {
|
||||
$res['pdf_file'] = $form_info['pdf_file'];
|
||||
}
|
||||
|
|
@ -1204,6 +1511,136 @@ class FormController extends Controller
|
|||
//return view('form.download')->with($res);
|
||||
}
|
||||
|
||||
public function downloadtempletepdf(Request $request) {
|
||||
$post = $request->all();
|
||||
$id = $post['id'];
|
||||
$formdata = $request->session()->get('formdata');
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/getformdefination', ['form_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition, 'id' => $id ]);
|
||||
//echo '<pre>'; print_r($finfo); exit;
|
||||
foreach($finfo->data->personalizations as $pers) {
|
||||
if($pers->id == $finfo->data->formdata->personalization_id) {
|
||||
$personalisation = $pers;
|
||||
}
|
||||
}
|
||||
|
||||
$genareted_image = [];
|
||||
$pdf_images = [];
|
||||
foreach($personalisation->templates as $i => $template) {
|
||||
$temp = pathinfo($template);
|
||||
if(!file_exists(storage_path('app/public/personalized/'.$formdata->form_id.'/template-'.$personalisation->id.'_'.$i.'.'.$temp['extension'] ))) {
|
||||
//Log::debug(print_r($form_info['form_info'], true));
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $template);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // good edit, thanks!
|
||||
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); // also, this seems wise considering output is image.
|
||||
$data = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
Storage::disk('public')->put('personalized/'.$formdata->form_id.'/template-'.$personalisation->id.'_'.$i.'.'.$temp['extension'], $data);
|
||||
}
|
||||
|
||||
$folder = storage_path('app/public/personalized/'.$formdata->form_id);
|
||||
$templatename = 'template-'.$personalisation->id.'_'.$i.'.'.$temp['extension'];
|
||||
$outputImage = $this->retimage($folder.'/'.$templatename);
|
||||
$templatesize = getimagesize( $folder.'/'.$templatename );
|
||||
$pdfparams = ["width"=>$templatesize[0],"height"=>$templatesize[1]];
|
||||
|
||||
//echo '<pre>'; print_r($templatesize); echo '</pre>'; exit;
|
||||
$positions = json_decode($personalisation->positions[$i]);
|
||||
$maskimages = [];
|
||||
foreach($positions as $pos) {
|
||||
if($pos->type == 'image' && isset($pos->fill) && $pos->fill == 'mask') {
|
||||
$maskimages[] = $pos;
|
||||
}
|
||||
}
|
||||
if(sizeof($maskimages) > 0) {
|
||||
$w = imagesx($outputImage);
|
||||
$h = imagesy($outputImage);
|
||||
$tempimage = imagecreatetruecolor($w, $h);
|
||||
}
|
||||
foreach($maskimages as $pos) {
|
||||
$image = storage_path( str_replace('/storage', 'app/public', $finfo->data->formdata->{$pos->field_name} ) );
|
||||
$photoimg = $this->retimage( $image );
|
||||
$photosize = getimagesize( $image );
|
||||
imagecopyresized($tempimage,$photoimg,$pos->x,$pos->y,0,0,$pos->width,$pos->height, $photosize[0], $photosize[1]);
|
||||
}
|
||||
if(sizeof($maskimages) > 0) {
|
||||
imagecopyresized($tempimage,$outputImage,0,0,0,0,$w,$h,$w,$h);
|
||||
$outputImage = $tempimage;
|
||||
}
|
||||
foreach(json_decode($personalisation->positions[$i]) as $pos) {
|
||||
// if($pos->field_name == 'link') {
|
||||
// $pdfparams['link_params_x'] = $pos->x;
|
||||
// $pdfparams['link_params_y'] = $pos->y;
|
||||
// $pdfparams['link_params_url'] = $finfo->data->formdata->{$pos->field_name};
|
||||
// continue;
|
||||
// }
|
||||
switch($pos->type) {
|
||||
case 'image':
|
||||
if(!(isset($pos->fill) && $pos->fill == 'mask')) {
|
||||
$image = storage_path( str_replace('/storage', 'app/public', $finfo->data->formdata->{$pos->field_name} ) );
|
||||
$photoimg = $this->retimage( $image );
|
||||
$photosize = getimagesize( $image );
|
||||
imagecopyresized($outputImage,$photoimg,$pos->x,$pos->y,0,0,$pos->width,$pos->height, $photosize[0], $photosize[1]);
|
||||
}
|
||||
break;
|
||||
case 'text':
|
||||
case 'date':
|
||||
if(isset($finfo->data->formdata->{$pos->field_name})) {
|
||||
$font = storage_path('app').'/fonts/'.$pos->font;
|
||||
$pos->color = explode('-',$pos->color);
|
||||
$white = imagecolorallocate($outputImage, $pos->color[0], $pos->color[1], $pos->color[2]);
|
||||
$text = $finfo->data->formdata->{$pos->field_name};
|
||||
if(isset($pos->prefix) && !empty($pos->prefix)) {
|
||||
$text = $pos->prefix . $text;
|
||||
}
|
||||
if($pos->type == 'date') {
|
||||
$text = date($pos->format, strtotime($text));
|
||||
}
|
||||
if(isset($pos->suffix) && !empty($pos->suffix)) {
|
||||
$text = $text . $pos->suffix;
|
||||
}
|
||||
if(isset($pos->align) && $pos->align == 'center') {
|
||||
$box = imagettfbbox($pos->size, 0, $font, $text);
|
||||
$pos->x = explode('-', $pos->x);
|
||||
$pos->x = $pos->x[0] + (($pos->x[1] - $pos->x[0]) - $box[2])/2;
|
||||
}
|
||||
imagettftext($outputImage, $pos->size, 0, $pos->x, $pos->y, $white, $font, $text);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'multiline':
|
||||
if(isset($finfo->data->formdata->{$pos->field_name})) {
|
||||
$font = storage_path('app').'/fonts/'.$pos->font;
|
||||
$pos->color = explode('-',$pos->color);
|
||||
$white = imagecolorallocate($outputImage, $pos->color[0], $pos->color[1], $pos->color[2]);
|
||||
$text = $form_info[$pos->field_name];
|
||||
$lines = wordwrap($text, $pos->linechars, "\n", true);
|
||||
$xPosition = $pos->x;
|
||||
$yPosition = $pos->y;
|
||||
foreach (explode("\n", $lines) as $line) {
|
||||
imagettftext($outputImage, $pos->size, 0, $xPosition, $yPosition, $white, $font, $line);
|
||||
$yPosition += $pos->linehieght;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$filename = 'generated-'.strtotime("now").'_'.$i.'.png';
|
||||
$genareted_image[] = $filename;
|
||||
|
||||
imagepng($outputImage, $folder.'/'.$filename);
|
||||
imagedestroy($outputImage);
|
||||
|
||||
$res = ['folder' => 'personalized/'.$formdata->form_id.'/', 'images' => $genareted_image, 'form_info' => (array)$finfo->data->formdata ];
|
||||
if (\View::exists('form.'.$formdata->partition.'.download-'.$formdata->form_id)) {
|
||||
return view('form.'.$formdata->partition.'.download-'.$formdata->form_id)->with($res);
|
||||
} else {
|
||||
return view('form.download')->with($res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function downloadpersonalizationzip($files, Request $request) {
|
||||
$post = $request->input();
|
||||
$files = json_decode(base64_decode($files));
|
||||
|
|
@ -1227,17 +1664,24 @@ class FormController extends Controller
|
|||
|
||||
public function downloaddata(Request $request) {
|
||||
$formdata = $request->session()->get('formdata');
|
||||
//$request->session()->put('finfo', $finfo);
|
||||
$post = $request->all();
|
||||
$form_id = $request->input('form_id', $formdata->form_id);
|
||||
//echo '<pre>'; print_r($formdata); exit;
|
||||
$history = LambdaRequest::postrequest('form', 'formentity/getformhistory', ['form_id' => $form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition, 'team_report' => 1 ]);
|
||||
|
||||
if(($form_id == '1718178830-d871301e-312b-4a60-9c68-15afa4ce6163' && (in_array('1655449173-a39a5017-8232-4d58-a253-90d06bc733d0', $formdata->roles) || in_array('1655449172-a39a5017-8232-4d58-a253-90d06bc733d0', $formdata->roles) || in_array('1655449171-a39a5017-8232-4d58-a253-90d06bc733d0', $formdata->roles) ) ) ||
|
||||
(($form_id == '1713425460-8bdf7394-01b5-48f3-8985-343b465dd685' || $form_id == '1713426268-c89f38eb-ec32-43ba-a81b-b690a8f90d6a') && (in_array('1655449175-a39a5017-8232-4d58-edm-90d06bc733d0', $formdata->roles) || in_array('1655445669-148e5dc2-3983-4ec6-bfho-a52c494a92132', $formdata->roles) || in_array('1655449179-a39a5017-8232-4d58-rbm-90d06bc733d0', $formdata->roles) ) ) ) {
|
||||
$finfo = $request->session()->get('finfo');
|
||||
$history = LambdaRequest::postrequest('form', 'formentity/getforminfo', ['finfo' => $finfo]);
|
||||
//echo '<pre>'; print_r($finfo); exit;
|
||||
} else {
|
||||
$history = LambdaRequest::postrequest('form', 'formentity/getformhistory', ['form_id' => $form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition, 'team_report' => 1 ]);
|
||||
}
|
||||
Log::debug(print_r($formdata, true));
|
||||
//echo '<pre>'; print_r($history); exit;
|
||||
$exceldata = [];
|
||||
$exceldata[] = [$formdata->title];
|
||||
|
||||
$exceldata[] = [''];
|
||||
$headers = ['Submission Date', 'Submitted By'];
|
||||
$headers = ['Submission Date', 'Submitted By', 'Approval Status'];
|
||||
foreach($history->data->questions as $question) {
|
||||
$headers[] = $question->label;
|
||||
}
|
||||
|
|
@ -1246,6 +1690,7 @@ class FormController extends Controller
|
|||
$row = [];
|
||||
$row[] = $submission->createdAt;
|
||||
$row[] = isset($submission->user_info->name) ? $submission->user_info->name : '';
|
||||
$row[] = isset($submission->workflow_status) ? $submission->workflow_status : '';
|
||||
foreach($history->data->questions as $q => $v) {
|
||||
$row[] = isset($submission->formdata->{$q}) ? $submission->formdata->{$q} : '-';
|
||||
}
|
||||
|
|
@ -1326,7 +1771,7 @@ class FormController extends Controller
|
|||
}
|
||||
|
||||
public function getdoctorlist(Request $request) {
|
||||
$response = LambdaRequest::getrequest('ums', 'contact/get_my_contacts', ['hierarchy' => $request->input('hierarchy', ''), 'partition' => $request->input('partition', '') ]);
|
||||
$response = LambdaRequest::getrequest('contact', 'contact/get_my_contacts', ['hierarchy' => $request->input('hierarchy', ''), 'partition' => $request->input('partition', '') ]);
|
||||
$docs = [];
|
||||
foreach($response->data->items as $item) {
|
||||
$docs[] = ['value' => $item->id, 'display' => $item->name, 'contact' => $item];
|
||||
|
|
@ -1391,6 +1836,18 @@ class FormController extends Controller
|
|||
$response = curl_exec($handler);
|
||||
Log::debug(print_r($response, true));
|
||||
}
|
||||
if($formdata->form_id == '1711710347-b4f08442-60dc-4a4c-a9c7-a759d95c5cad') {
|
||||
unset($post['form_id']);
|
||||
Log::debug(print_r($post, true));
|
||||
$handler = curl_init();
|
||||
curl_setopt($handler, CURLOPT_URL, "https://gnpdoctor.buildrapport.co/neblogisticsave/faultynebulizer");
|
||||
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);
|
||||
Log::debug(print_r($response, true));
|
||||
}
|
||||
|
||||
if($finfo->status == 'success') {
|
||||
return response()->json(['status' => 'success']);
|
||||
} else {
|
||||
|
|
@ -1488,4 +1945,100 @@ class FormController extends Controller
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function iframeupload(Request $request) {
|
||||
return view('form.iframeupload');
|
||||
}
|
||||
|
||||
public function allsubmissions(Request $request) {
|
||||
$post = $request->all();
|
||||
$user = Auth::user();
|
||||
$history = LambdaRequest::signedrequest('post', 'form', 'formentity/getallsubmissions', ['form_id' => $post['form_id'], 'partition' => $post['partition']], 120);
|
||||
|
||||
if(isset($post['download'])) {
|
||||
$exceldata = [];
|
||||
$headers = ['User Name','User Email','User Phone', 'Submitted On'];
|
||||
foreach($history->data->questions as $que) {
|
||||
$headers[] = $que->question;
|
||||
}
|
||||
$exceldata[] = $headers;
|
||||
$submissions = json_decode(file_get_contents( $history->data->submission_json ), false);
|
||||
foreach($submissions as $sub) {
|
||||
$subs = [$sub->submitted_by, $sub->user_email, $sub->user_phone, $sub->submitted_on];
|
||||
foreach($history->data->questions as $que) {
|
||||
$subs[] = $sub->{$que->code};
|
||||
}
|
||||
$exceldata[] = $subs;
|
||||
}
|
||||
$report = Excel::raw(new InvoicesExport($exceldata), 'Xlsx');
|
||||
$filename = 'reports/'.$post['form_id'].'-report.xlsx';
|
||||
$res = Excel::store(new InvoicesExport($exceldata), 'public/'.$filename);
|
||||
$headers = array( 'Content-Type: application/excel', );
|
||||
return Response::download(storage_path('app/public')."/".$filename, $post['form_id'].'-report.xlsx', $headers);
|
||||
} else {
|
||||
//echo '<pre>'; print_r((array)$history->data); exit;
|
||||
if (\View::exists('form.'.$post['partition'].'.'.$post['form_id'].'-allsubmissions')) {
|
||||
return view('form.'.$post['partition'].'.'.$post['form_id'].'-allsubmissions')->with((array)$history->data);
|
||||
} elseif (\View::exists('form.'.$post['form_id'].'-allsubmissions')) {
|
||||
return view('form.'.$post['form_id'].'-allsubmissions')->with((array)$history->data);
|
||||
} else {
|
||||
return view('form.allsubmissions')->with((array)$history->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function fullworkflow(Request $request) {
|
||||
$post = $request->all();
|
||||
$user = Auth::user();
|
||||
$history = LambdaRequest::signedrequest('post', 'form', 'formentity/getallsubmissions', ['form_id' => $post['form_id'], 'approver' => Auth::user()->user_id, 'partition' => $post['partition']], 120);
|
||||
//echo '<pre>'; print_r($history); exit;
|
||||
if(isset($post['download'])) {
|
||||
$exceldata = [];
|
||||
$headers = ['User Name','User Email','User Phone', 'Submitted On'];
|
||||
foreach($history->data->questions as $que) {
|
||||
$headers[] = $que->question;
|
||||
}
|
||||
$exceldata[] = $headers;
|
||||
$submissions = json_decode(file_get_contents( $history->data->submission_json ), false);
|
||||
foreach($submissions as $sub) {
|
||||
$subs = [$sub->submitted_by, $sub->user_email, $sub->user_phone, $sub->submitted_on];
|
||||
foreach($history->data->questions as $que) {
|
||||
$subs[] = $sub->{$que->code};
|
||||
}
|
||||
$exceldata[] = $subs;
|
||||
}
|
||||
$report = Excel::raw(new InvoicesExport($exceldata), 'Xlsx');
|
||||
$filename = 'reports/'.$post['form_id'].'-report.xlsx';
|
||||
$res = Excel::store(new InvoicesExport($exceldata), 'public/'.$filename);
|
||||
$headers = array( 'Content-Type: application/excel', );
|
||||
return Response::download(storage_path('app/public')."/".$filename, $post['form_id'].'-report.xlsx', $headers);
|
||||
} else {
|
||||
//echo '<pre>'; print_r((array)$history->data); exit;
|
||||
if (\View::exists('form.'.$post['partition'].'.'.$post['form_id'].'-fullworkflow')) {
|
||||
return view('form.'.$post['partition'].'.'.$post['form_id'].'-fullworkflow')->with((array)$history->data);
|
||||
} elseif (\View::exists('form.'.$post['form_id'].'-fullworkflow')) {
|
||||
return view('form.'.$post['form_id'].'-fullworkflow')->with((array)$history->data);
|
||||
} else {
|
||||
return view('form.fullworkflow')->with((array)$history->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function uploadchunk(Request $request) {
|
||||
$path = '';
|
||||
$name = 'chunk_video';
|
||||
$folder = 'chunk_video';
|
||||
try {
|
||||
if( $request->file($name) ) {
|
||||
$path = $request->file($name)->store($folder);
|
||||
$path = '/'.str_replace('public', 'storage', $path);
|
||||
}
|
||||
} catch (AwsException $e) {
|
||||
Log::debug($e->getMessage());
|
||||
}
|
||||
return response()->json(['status' => 'success', 'filepath' => $path ]);
|
||||
return $path;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -62,10 +62,10 @@ class FormactionController extends Controller
|
|||
'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', 'quiz' => 'Quizs', 'doctorlist' => 'Doctor List', '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', 'doctorlist' => 'Doctor List', 'external' => 'External Webpage', 'internal_action' => 'Internal Action'] ],
|
||||
'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'],
|
||||
'external_url' => ['title' => 'External Url / Internal Action', 'type' => 'text'],
|
||||
'visiblity_check' => ['title' => 'Enable Schedule', 'type' => 'yesno', 'required' => true],
|
||||
'validity_start' => ['title' => 'Schedule Start Date', 'type' => 'datetime', 'required' => true],
|
||||
'validity_end' => ['title' => 'Schedule End Date', 'type' => 'datetime', 'required' => true],
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class FormentityController extends Controller
|
|||
$roles_dd[$role->id] = $role->name;
|
||||
}
|
||||
|
||||
$coattr = $this->getlambda('get', 'ums', 'contactattribute', 'get_all');
|
||||
$coattr = $this->getlambda('get', 'contact', 'contactattribute', 'get_all');
|
||||
$coattr_dd = [];
|
||||
foreach($coattr->data->items as $coatt){
|
||||
$coattr_dd[$coatt->code] = $coatt->attribute;
|
||||
|
|
@ -66,15 +66,15 @@ class FormentityController extends Controller
|
|||
|
||||
'roles_email_notification' => ['title' => 'Email Notification to Roles', 'type' => 'multiselect', 'values' => $roles_dd ],
|
||||
'roles_push_notification' => ['title' => 'Push Notification to Roles', 'type' => 'multiselect', 'values' => $roles_dd ],
|
||||
'allow_non_hierarchy_submission' => ['title' => 'Allow Non Hierarchy Submission', 'type' => 'yesno', 'required' => true],
|
||||
|
||||
'workflow' => ['title' => 'Enable Workflow', 'type' => 'yesno', 'required' => true],
|
||||
'workflow_type' => ['title' => 'Workflow type', 'type' => 'select', 'required' => true, 'values' => ['single' => 'Single Persoon', 'multiple' => 'Multiple person', 'sequencial' => 'Sequencial'] ],
|
||||
'approver_can_edit' => ['title' => 'Approver can edit entry', 'type' => 'yesno', 'required' => true],
|
||||
'is_personalized' => ['title' => 'Is Personalization Needed', 'type' => 'yesno', 'required' => true],
|
||||
'allow_delete_by_user' => ['title' => 'Allow Submission Delete by User', 'type' => 'yesno', 'required' => true],
|
||||
'export_fields' => ['title' => 'Export Fields', 'type' => 'textarea', 'required' => false, 'fullwidth' => true ],
|
||||
'workflow_approvers' => ['title' => 'Metric', 'type' => 'mapping', 'required' => true, 'approvers' => $users_dd, 'fullwidth' => true ],
|
||||
|
||||
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -85,6 +85,7 @@ class FormentityController extends Controller
|
|||
$values->manager1_push_notification = isset($values->manager1_push_notification) ? $values->manager1_push_notification : 'no';
|
||||
$values->manager2_email_notification = isset($values->manager2_email_notification) ? $values->manager2_email_notification : 'no';
|
||||
$values->manager2_push_notification = isset($values->manager2_push_notification) ? $values->manager2_push_notification : 'no';
|
||||
$values->export_fields = isset($values->export_fields) ? $values->export_fields : '';
|
||||
}
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
return $values;
|
||||
|
|
@ -121,11 +122,13 @@ class FormentityController extends Controller
|
|||
// $forfields = ['is-aware-of-the-customer-perspective-potential-prescription-position','has-customer-plan-based-on-customer-perspective','rcpawardicu-quantified-rcpa-comp-taken-pob-dr-perspective-on-molecule-or-price-etc','call-objective-planned-question-opening-statement-materials-and-objection-anticipated','greeted-customer-appropriately','used-planned-opening-statement','gained-attention-of-the-customer','was-ready-with-tab-maintained-eye-contact-with-doctor-had-a-clear-voice','asked-planned-question-as-per-call-planning','asked-question-related-to-customer-behaviourbelief-service','listened-attentively-and-asked-follow-up-question-if-required','generated-desired-response-from-customer','maintained-the-sequence-of-product-as-per-the-speciality-p1p2p3','shared-benefit-of-productdevicesservices-as-per-marketing-strategy','shared-informationused-the-materialstools-as-per-plan-demonstrated-and-discussed-cipla-devices','utilized-the-tab-effectively-smooth-navigation-highlighted-studies-zoomed-graphs-etc','listened-attentively-acknowledged-concern','asked-questions-to-seek-clarity-on-questionobjection','shared-the-relevant-information','confirmed-if-objectionquestion-was-addressed-assured-follow-through-actions-if-required-and-returned-to-call-flow','summarized-the-key-discussion-points','gained-agreement-basis-call-objective-from-the-doctor','quantified-the-demand-with-rx','left-lblreminder-of-focused-product','total_score','area-of-strength','area-of-development','coaching-objective','development-time-frame','next-coaching-visit','development-action-plan'];
|
||||
|
||||
foreach ($records as $record) {
|
||||
$record['record_date'] = '2022-12-20';
|
||||
$record['created_date'] = '1671758762';
|
||||
$record['record_date'] = '2024-04-02';
|
||||
$record['created_date'] = strtotime("now");
|
||||
$formdata = [];
|
||||
foreach($forfields as $field) {
|
||||
$formdata[$field] = $record[$field] == 'Yes' ? 1 : ( $record[$field] == 'No' ? 0 : $record[$field] ) ;
|
||||
if(isset($record[$field])) {
|
||||
$formdata[$field] = $record[$field] == 'Yes' ? 1 : ( $record[$field] == 'No' ? 0 : $record[$field] ) ;
|
||||
}
|
||||
}
|
||||
$recs[] = [
|
||||
'entity_id' => $entity_id,
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ class FormexportController extends Controller
|
|||
|
||||
protected function get_form_fields($type, $values){
|
||||
$forms = $this->getlambda('get', 'form', 'formentity', 'dropdown');
|
||||
//echo '<pre>'; print_r($forms); exit;
|
||||
|
||||
$forms_dd = [];
|
||||
|
||||
$uforms = Auth::user()->forms;
|
||||
|
|
@ -90,10 +92,12 @@ class FormexportController extends Controller
|
|||
|
||||
|
||||
$this->_request->session()->put('form_list_dropdown', $forms_dd);
|
||||
$this->_request->session()->put('form_questions_dropdown', $forms->data->questions);
|
||||
|
||||
//echo '<pre>'; print_r($forms_dd); exit;
|
||||
return [
|
||||
'form_id' => ['title' => 'Select Form', 'type' => 'select', 'required' => true, 'values' => $forms_dd],
|
||||
'date_field' => ['title' => 'Select Date Field', 'type' => 'select', 'required' => true, 'values' => []],
|
||||
'start_date' => ['title' => 'Start Date', 'type' => 'date', 'required' => true],
|
||||
'end_date' => ['title' => 'End Date', 'type' => 'date', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
|
|
@ -111,4 +115,24 @@ class FormexportController extends Controller
|
|||
return $values;
|
||||
}
|
||||
|
||||
public function form($type, $id = null) {
|
||||
$values = [];
|
||||
if($type == 'edit') {
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_one', ['id' => $id]);
|
||||
$values = $response->data->item;
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
}
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
$data = $this->_beforeform($type, $values);
|
||||
$fields = $this->get_form_fields($type, $values);
|
||||
$questions = $this->_request->session()->get('form_questions_dropdown');
|
||||
return $this->view('form')->with([
|
||||
'title' => $this->_title,
|
||||
'mode' => $type,
|
||||
'fields' => $fields,
|
||||
'base_url' => $this->_base_url,
|
||||
'item' => $values,
|
||||
'questions' => $questions
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,21 +43,23 @@ class FormquestionController extends Controller
|
|||
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
|
||||
//'media_thumb' => ['title' => 'Media Thumb', 'type' => 'image'],
|
||||
'question' => ['title' => 'Question', 'type' => 'text'],
|
||||
'sort_order' => ['title' => 'Sort Order', '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;
|
||||
}
|
||||
// $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', '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],
|
||||
'sort_order' => ['title' => 'Sort Order', 'type' => 'number', 'required' => false],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
'options' => ['title' => 'Options', 'type' => 'mapping', 'fullwidth' => true ],
|
||||
];
|
||||
|
|
@ -80,7 +82,9 @@ class FormquestionController extends Controller
|
|||
}
|
||||
|
||||
protected function _beforeform($type, $values) {
|
||||
|
||||
if($type == 'edit') {
|
||||
$values->sort_order = isset($values->sort_order) ? $values->sort_order : 0;
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class GroupController extends Controller
|
|||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'ums';
|
||||
$this->_service = 'detailing';
|
||||
$this->_module = 'group';
|
||||
$this->_viewname = 'group';
|
||||
$this->_title = 'Groups';
|
||||
|
|
|
|||
|
|
@ -50,12 +50,21 @@ class HierarchyController extends Controller
|
|||
foreach($users->data->items as $user){
|
||||
$users_dd[$user->id] = $user->firstname . ' ' . $user->lastname . ' (' . $user->employee_code . ')';
|
||||
}
|
||||
$positions = $this->getlambda('get', 'ums', 'hierarchy', 'dropdown');
|
||||
//echo '<pre>'; print_r($positions); exit;
|
||||
|
||||
$positions_dd = [];
|
||||
foreach($positions->data->items as $position){
|
||||
$positions_dd[$position->code] = $position->name . ' ('.$position->code.')';
|
||||
// foreach($response->data->items as $item) {
|
||||
// $positions_dd[$item->code] = $item->name . ' ('.$item->code.')';
|
||||
// }
|
||||
// asort($positions_dd);
|
||||
|
||||
$positions = $this->getlambda('get', 'ums', 'hierarchy', 'dropdown');
|
||||
foreach($positions->data->items as $item) {
|
||||
$positions_dd[$item->code] = $item->name . ' ('.$item->code.')';
|
||||
}
|
||||
asort($positions_dd);
|
||||
// foreach($positions->data->items as $position){
|
||||
// $positions_dd[$position->code] = $position->name . ' ('.$position->code.')';
|
||||
// }
|
||||
//echo '<pre>'; print_r($items); exit;
|
||||
return $this->view('list')->with([
|
||||
'title' => $this->_title,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use App\Http\Requests\LambdaRequest;
|
|||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use DB;
|
||||
use Log;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
|
|
@ -53,6 +54,7 @@ class LoginController extends Controller
|
|||
$post['device'] = 'portal';
|
||||
$response = LambdaRequest::postrequest('ums', 'auth/verify', $post);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
//Log::debug(print_r($response, true));
|
||||
if($response->statusCode == 200 && $response->status == "success") {
|
||||
User::updateOrCreate(
|
||||
['email' => $response->data->user->domain . '-' . $response->data->user->email],
|
||||
|
|
|
|||
|
|
@ -60,17 +60,41 @@ class MagmediaController extends Controller
|
|||
foreach($groups->data->items as $group){
|
||||
$groups_dd[$group->id] = $group->name;
|
||||
}
|
||||
|
||||
$forms = $this->getlambda('get', 'form', 'formentity', 'dropdown');
|
||||
$forms_dd = [];
|
||||
foreach($forms->data->items as $form){
|
||||
$forms_dd[$form->id] = $form->title;
|
||||
}
|
||||
|
||||
$forms = $this->getlambda('get', 'form', 'survey', 'dropdown');
|
||||
foreach($forms->data->items as $form){
|
||||
$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)';
|
||||
}
|
||||
$metrics = $this->getlambda('get', 'metric', 'metric', 'get_all');
|
||||
$metric_dd = ['NA' => 'Tracking Not Needed'];
|
||||
foreach($metrics->data->items as $metric){
|
||||
$metric_dd[$metric->id] = $metric->name;
|
||||
}
|
||||
$fields = [
|
||||
'name' => ['title' => 'Media Name', 'type' => 'text', 'required' => true],
|
||||
'points' => ['title' => 'Points', 'type' => 'text', 'required' => true],
|
||||
'description' => ['title' => 'Media Description', 'type' => 'textarea', 'required' => true, 'fullwidth' => true],
|
||||
'media_type' => ['title' => 'Media Types', 'type' => 'select', 'required' => true, 'values' => ['image' => 'Image', 'video' => 'Video', 'pdf' => 'PDF', 'audio' => 'Audio', 'gallery' => 'Gallery', 'form' => 'Form', 'external' => 'External Url', 'scorm' => 'Scorm'] ],
|
||||
'media_type' => ['title' => 'Media Types', 'type' => 'select', 'required' => true, 'values' => ['image' => 'Image', 'video' => 'Video', 'pdf' => 'PDF', 'audio' => 'Audio', 'gallery' => 'Gallery', 'form' => 'Form', 'quiz' => 'Quiz', 'survey' => 'Survey', 'external' => 'External Url', 'scorm' => 'Scorm'] ],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
|
||||
'form_id' => ['title' => 'Form', 'type' => 'select', 'values' => $forms_dd ],
|
||||
//'media_thumb' => ['title' => 'Media Thumb', 'type' => 'image', 'required' => true],
|
||||
'media_url' => ['title' => 'Media File (image, video, pdf, audio, scorm) (for gallery, upload zip file with all images)', 'type' => 'file'],
|
||||
'gallery' => ['title' => 'Multiple Media File (only for gallery)', 'type' => 'multiimage'],
|
||||
'ext_url' => ['title' => 'Media Url (form, external)', 'type' => 'text'],
|
||||
|
||||
'mapped_metric' => ['title' => 'Point Metric', 'type' => 'select', 'values' => $metric_dd, 'required' => true ],
|
||||
'count_metric' => ['title' => 'Count Metric', 'type' => 'select', 'values' => $metric_dd, 'required' => true ],
|
||||
];
|
||||
return $fields;
|
||||
}
|
||||
|
|
@ -126,6 +150,12 @@ class MagmediaController extends Controller
|
|||
unset($values->comments_users);
|
||||
unset($values->likes_count);
|
||||
unset($values->comments_count);
|
||||
if(!isset($values->mapped_metric)) {
|
||||
$values->mapped_metric = '';
|
||||
}
|
||||
if(!isset($values->count_metric)) {
|
||||
$values->count_metric = '';
|
||||
}
|
||||
|
||||
//echo '<pre>'; print_r($values); exit;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,24 +95,35 @@ class MetricreportController extends Controller
|
|||
switch($response->data->post->type) {
|
||||
case 'leaderboard':
|
||||
case 'scoreboard':
|
||||
$headings = ["Rank", "User", "User Id", "Employee Code", "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"];
|
||||
$headings = ["Rank", "User Id", "User Name", "Employee Code", "Designation"];
|
||||
//'Manager 1 Name', 'Manager 1 Emp Code', 'Manager 1 Email', 'Manager 2 Name', 'Manager 2 Emp Code', 'Manager 2 Email'
|
||||
//echo '<pre>'; print_r((array)$response->data->graph->values[0]->user->parents); exit;
|
||||
foreach((array)$response->data->graph->values[0]->user->parents as $par) {
|
||||
$headings = array_merge($headings, ['Manager '.$par->level.' Name', 'Manager '.$par->level.' Emp Code']);
|
||||
}
|
||||
$headings = array_merge($headings, ['Zone', 'Region', "Area", "Territory", "Units (for Ranking)", "Percent of Highest", "Active User"]);
|
||||
//echo '<pre>'; print_r($headings); exit;
|
||||
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) {
|
||||
$rowdata = [(string)$val->rank, (string)$val->user->name, (string)$val->user->id,(isset($val->user->owner_info) && isset($val->user->owner_info->employee_code) ? $val->user->owner_info->employee_code : '-'), $val->user->designation];
|
||||
$rowdata = [(string)$val->rank, (string)$val->user->id,(string)$val->user->name, (string)$val->user->employee_code, $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 : '-';
|
||||
foreach((array)$user->parents as $par) {
|
||||
$rowdata[] = isset($par->name) ? $par->name : '-';
|
||||
$rowdata[] = isset($par->employee_code) ? $par->employee_code : '-';
|
||||
//$rowdata[] = isset($par->email) ? $par->email : '-';
|
||||
}
|
||||
// $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 : (isset($user->positions->Country) ? $user->positions->Country : '-' );
|
||||
$rowdata[] = isset($user->positions->Region) ? $user->positions->Region : '-';
|
||||
|
|
@ -193,7 +204,7 @@ class MetricreportController extends Controller
|
|||
$row[] = isset($user->positions->Territory) ? $user->positions->Territory : '-';
|
||||
$row[] = isset($user->roles) ? (is_array($user->roles) ? implode(',', $user->roles) : $user->roles) : '-';
|
||||
foreach($response->data->graph->values->metrics as $metric) {
|
||||
$row[] = isset($metric->stats->{$user->id}) ? $metric->stats->{$user->id} : '-';
|
||||
$row[] = isset($metric->stats->{$user->id}) ? $metric->stats->{$user->id} : 0;
|
||||
}
|
||||
$exceldata[] = $row;
|
||||
}
|
||||
|
|
@ -220,6 +231,9 @@ class MetricreportController extends Controller
|
|||
foreach($response->data->graph->contact_attributes as $attr) {
|
||||
$row[] = isset($contact->{$attr}) ? $contact->{$attr} : '';
|
||||
}
|
||||
if(!isset($response->data->graph->values->users->{$contact->id})) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$user = $response->data->graph->values->users->{$contact->id};
|
||||
$row[] = $user->name;
|
||||
|
|
@ -240,12 +254,85 @@ class MetricreportController extends Controller
|
|||
$row[] = isset($user->positions->Territory) ? $user->positions->Territory : '-';
|
||||
|
||||
foreach($response->data->graph->values->metrics as $metric) {
|
||||
$row[] = isset($metric->stats->{$contact->id}) ? $metric->stats->{$contact->id} : '-';
|
||||
$row[] = isset($metric->stats->{$contact->id}) ? $metric->stats->{$contact->id} : 0;
|
||||
}
|
||||
$exceldata[] = $row;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'incremental':
|
||||
if($response->data->graph->chart == 'incremental') {
|
||||
$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", "Role"];
|
||||
// foreach($response->data->graph->values->metrics as $metric) {
|
||||
// //$headers[] = $metric->metric;
|
||||
// }
|
||||
$graph = $response->data->graph;
|
||||
$period = explode('-', $post['period'])[0];
|
||||
$interval = 'P1D';
|
||||
if($period == 'week') {
|
||||
$interval = 'P1W';
|
||||
} elseif($period == 'month') {
|
||||
$interval = 'P1M';
|
||||
}
|
||||
|
||||
$first_day = strtotime($graph->first_day);
|
||||
$last_day = strtotime($graph->last_day);
|
||||
|
||||
$start = new \DateTime($graph->first_day);
|
||||
$end = new \DateTime($graph->last_day);
|
||||
$interval = new \DateInterval($interval);
|
||||
$periods = new \DatePeriod($start, $interval, $end);
|
||||
$colspan = 0;
|
||||
foreach($periods as $date) {
|
||||
$colspan++;
|
||||
}
|
||||
$subheaders = ["","","","","","","","","","","","","","",""];
|
||||
foreach($graph->values->metrics as $metric){
|
||||
$headers[] = $metric->metric;
|
||||
//$headers = array_merge($headers, Array($colspan-1).fill(""));
|
||||
foreach($periods as $date) {
|
||||
$subheaders[] = $date->format('d M Y');
|
||||
$headers[] = "";
|
||||
}
|
||||
$subheaders[] = "";
|
||||
//unset($headers[sizeof($headers)-1]);
|
||||
}
|
||||
|
||||
$exceldata[] = $headers;
|
||||
$exceldata[] = $subheaders;
|
||||
foreach($response->data->graph->values->users as $user) {
|
||||
$row = [];
|
||||
$row[] = $user->name;
|
||||
$row[] = $user->employee_code;
|
||||
$row[] = $user->email;
|
||||
$row[] = $user->designation;
|
||||
|
||||
$row[] = isset($user->manager1->name) ? $user->manager1->name : '-';
|
||||
$row[] = isset($user->manager1->employee_code) ? $user->manager1->employee_code : '-';
|
||||
$row[] = isset($user->manager1->email) ? $user->manager1->email : '-';
|
||||
$row[] = isset($user->manager2->name) ? $user->manager2->name : '-';
|
||||
$row[] = isset($user->manager2->employee_code) ? $user->manager2->employee_code : '-';
|
||||
$row[] = isset($user->manager2->email) ? $user->manager2->email : '-';
|
||||
|
||||
$row[] = isset($user->positions->Zone) ? $user->positions->Zone : '-';
|
||||
$row[] = isset($user->positions->Region) ? $user->positions->Region : '-';
|
||||
$row[] = isset($user->positions->Area) ? $user->positions->Area : '-';
|
||||
$row[] = isset($user->positions->Territory) ? $user->positions->Territory : '-';
|
||||
$row[] = isset($user->roles) ? (is_array($user->roles) ? implode(',', $user->roles) : $user->roles) : '-';
|
||||
|
||||
foreach($graph->values->metrics as $metric) {
|
||||
foreach($periods as $date) {
|
||||
$row[] = isset($metric->stats->{$user->id}->{$date->getTimestamp().'000'}) ? $metric->stats->{$user->id}->{$date->getTimestamp().'000'} : '-';
|
||||
}
|
||||
$row[] = "";
|
||||
}
|
||||
// foreach($response->data->graph->values->metrics as $metric) {
|
||||
// //$row[] = isset($metric->stats->{$user->id}) ? $metric->stats->{$user->id} : '-';
|
||||
// }
|
||||
$exceldata[] = $row;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
//echo '<pre>'; print_r($exceldata); exit;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ class MetricviewController extends Controller
|
|||
'validity_end' => ['title' => 'Validity end', 'type' => 'text'],
|
||||
'agg_type' => ['title' => 'Aggregation type', 'type' => 'text'],
|
||||
'status' => ['title' => 'Status', 'type' => 'select'],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +73,7 @@ class MetricviewController extends Controller
|
|||
$roles_dd[$role->id] = $role->name;
|
||||
}
|
||||
|
||||
$coattr = $this->getlambda('get', 'ums', 'contactattribute', 'get_all');
|
||||
$coattr = $this->getlambda('get', 'contact', 'contactattribute', 'get_all');
|
||||
$coattr_dd = [];
|
||||
foreach($coattr->data->items as $coatt){
|
||||
$coattr_dd[$coatt->code] = $coatt->attribute;
|
||||
|
|
@ -119,10 +118,10 @@ class MetricviewController extends Controller
|
|||
'operation' => ['title' => 'Operation', 'type' => 'select', 'required' => true, 'values' => ['sum' => 'Sum', 'avg' => 'Avg', 'value_count' => 'Count'] ],
|
||||
'agg_type' => ['title' => 'Aggregation Type', 'type' => 'select', 'required' => true, 'values' => ['individual' => 'Individual', 'team' => 'Team'] ],
|
||||
|
||||
'graphical_views' => ['title' => 'Graphical views', 'type' => 'multiselect', 'required' => true, 'values' => ['progress' => 'Progress', 'percentile' => 'Percentile', 'pie' => 'Pie chart', 'bar' => 'Bar chart', 'line' => 'Line chart'] ],
|
||||
'graphical_views' => ['title' => 'Graphical views', 'type' => 'multiselect', 'values' => ['progress' => 'Progress', 'percentile' => 'Percentile', 'pie' => 'Pie chart', 'bar' => 'Bar chart', 'line' => 'Line chart'] ],
|
||||
'details_views' => ['title' => 'Details views', 'type' => 'multiselect', 'required' => true, 'values' => ['tabular' => 'Tabular', 'contacts' => 'Doctor View', 'incremental' => 'Incremental View'] ],
|
||||
'trend_views' => ['title' => 'Trend views', 'type' => 'multiselect', 'required' => true, 'values' => ['bar' => 'Bar chart', 'line' => 'Line chart', 'tabular' => 'Tabular'] ],
|
||||
'leaderboard_views' => ['title' => 'Leaderboard views', 'type' => 'multiselect', 'required' => true, 'values' => ['leaderboard' => 'Leaderboard View'] ],
|
||||
'trend_views' => ['title' => 'Trend views', 'type' => 'multiselect', 'values' => ['bar' => 'Bar chart', 'line' => 'Line chart', 'tabular' => 'Tabular'] ],
|
||||
'leaderboard_views' => ['title' => 'Leaderboard views', 'type' => 'multiselect', 'values' => ['leaderboard' => 'Leaderboard View'] ],
|
||||
'contacts_views' => ['title' => 'Doctor views', 'type' => 'multiselect', 'values' => ['contacts' => 'Doctor View'] ],
|
||||
|
||||
'intervals' => ['title' => 'Intervals', 'type' => 'multiselect', 'required' => true, 'values' => ['yearlycy' => 'Calender Year', 'yearlyfy' => 'Financial Year', 'monthly' => 'Monthly', 'weekly' => 'Weekly', 'daily' => 'Daily'] ],
|
||||
|
|
@ -151,7 +150,7 @@ class MetricviewController extends Controller
|
|||
|
||||
} else {
|
||||
foreach($data['metric'] as $k => $metric) {
|
||||
$data['metrics'][] = ['metric' => $metric, 'display' => $data['display_unit'][$k], 'sort_order' => isset($data['sort_order'][$k]) ? $data['sort_order'][$k] : 0, 'list_view' => isset($data['list_view'][$k]) ? $data['list_view'][$k] : 'no' ];
|
||||
$data['metrics'][] = ['metric' => $metric, 'display' => $data['display_unit'][$k], 'sort_order' => isset($data['sort_order'][$k]) ? $data['sort_order'][$k] : 0, 'list_view' => isset($data['list_view'][$k]) ? $data['list_view'][$k] : 'yes' ];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -181,8 +180,12 @@ class MetricviewController extends Controller
|
|||
if(!isset($values->combined_metrics)) {
|
||||
$values->combined_metrics = '[]';
|
||||
}
|
||||
if(!isset($values->sort_order)) {
|
||||
$values->sort_order = 0;
|
||||
}
|
||||
|
||||
$metrics = $values->metrics;
|
||||
usort($metrics, fn($a, $b) => ($a->sort_order > $b->sort_order) );
|
||||
usort($metrics, fn($a, $b) => ((isset($a->sort_order) && isset($b->sort_order)) && $a->sort_order > $b->sort_order) );
|
||||
$values->metrics = $metrics;
|
||||
|
||||
//echo '<pre>'; print_r($metrics); exit;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,266 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use DB;
|
||||
use League\Csv\Reader;
|
||||
use Log;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Exports\InvoicesExport;
|
||||
|
||||
class ProductController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'catalog';
|
||||
$this->_module = 'product';
|
||||
$this->_viewname = 'product';
|
||||
$this->_title = 'Product';
|
||||
$this->_base_url = '/product';
|
||||
$this->_listtype = 'list';
|
||||
}
|
||||
|
||||
public function list(Request $request) {
|
||||
$fields = $this->get_list_fields();
|
||||
//echo $this->_listtype; exit;
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all');
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return $this->view($this->_listtype)->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' => 'Import', 'link' => $this->_base_url.'/import'], ['title' => 'Export', 'link' => $this->_base_url.'/export'] ];
|
||||
}
|
||||
|
||||
protected function get_import_fields($records){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'productattribute/get_all');
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
$hierar = $this->getlambda('get', 'ums', 'hierarchy', 'dropdown');
|
||||
$hierar_dd = [];
|
||||
foreach($hierar->data->items as $hier){
|
||||
$hierar_dd[$hier->code] = $hier->name . ' (' . $hier->code . ')';
|
||||
}
|
||||
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
$fields = [
|
||||
'name' => ['title' => 'Name', 'type' => 'text', 'required' => true],
|
||||
'sku' => ['title' => 'SKU', 'type' => 'text', 'required' => true],
|
||||
'division' => ['title' => 'Division', 'type' => 'text', 'required' => true],
|
||||
'company' => ['title' => 'Company', 'type' => 'text'],
|
||||
'brand' => ['title' => 'Brand', 'type' => 'select', 'required' => true, 'values' => $hierar_dd ],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
];
|
||||
|
||||
foreach ($response->data->items as $item) {
|
||||
$values = [];
|
||||
if(in_array($item->type, ['select', 'radio', 'checkbox']) ) {
|
||||
foreach($item->options as $op) {
|
||||
$values[$op->value] = $op->display;
|
||||
}
|
||||
}
|
||||
$fields[$item->code] = ['title' => $item->attribute, 'type' => $item->type, 'required' => $item->required=='yes'?true:false, 'values' => $values];
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
// public function list(Request $request) {
|
||||
// $response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all');
|
||||
// //echo '<pre>'; print_r($items); exit;
|
||||
// $items = [];
|
||||
// foreach ($response->data->items as $item) {
|
||||
// $item->position = $item->hierarchy_info->code;
|
||||
// unset($item->hierarchy_info);
|
||||
// $items[] = $item;
|
||||
// }
|
||||
|
||||
// $fields = $this->get_list_fields();
|
||||
// return $this->view('list')->with([
|
||||
// 'title' => $this->_title,
|
||||
// 'fields' => $fields,
|
||||
// 'base_url' => $this->_base_url,
|
||||
// 'items' => $items,
|
||||
// 'buttons' => $this->get_list_buttons()
|
||||
// ]);
|
||||
// }
|
||||
|
||||
protected function get_list_fields(){
|
||||
return [
|
||||
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
|
||||
'name' => ['title' => 'Name', 'type' => 'text'],
|
||||
'sku' => ['title' => 'SKU', 'type' => 'text'],
|
||||
'division' => ['title' => 'Division', 'type' => 'text'],
|
||||
'company' => ['title' => 'Company', 'type' => 'text'],
|
||||
'status' => ['title' => 'Status', 'type' => 'select'],
|
||||
];
|
||||
}
|
||||
|
||||
protected function get_form_fields($type, $values){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'productattribute/get_all');
|
||||
$brandr = $this->getlambda('get', 'catalog', 'brand', 'dropdown');
|
||||
$brandr_dd = [];
|
||||
foreach($brandr->data->items as $bran){
|
||||
$brandr_dd[$bran->id] = $bran->name;
|
||||
}
|
||||
|
||||
$fields = [
|
||||
'name' => ['title' => 'Name', 'type' => 'text', 'required' => true],
|
||||
'sku' => ['title' => 'SKU', 'type' => 'text', 'required' => true],
|
||||
'division' => ['title' => 'Division', 'type' => 'text', 'required' => true],
|
||||
'company' => ['title' => 'Company', 'type' => 'text'],
|
||||
'brand' => ['title' => 'Brand', 'type' => 'select', 'required' => true, 'values' => $brandr_dd ],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
];
|
||||
|
||||
foreach ($response->data->items as $item) {
|
||||
$values = [];
|
||||
if(in_array($item->type, ['select', 'radio', 'checkbox']) ) {
|
||||
foreach($item->options as $op) {
|
||||
$values[$op->value] = $op->display;
|
||||
}
|
||||
}
|
||||
$fields[$item->code] = ['title' => $item->attribute, 'type' => $item->type, 'required' => $item->required=='yes'?true:false, 'values' => $values];
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
protected function _beforesave($type, $request) {
|
||||
$data = $request->except('_token');
|
||||
$options = [];
|
||||
if(isset($data['option_value'])) {
|
||||
foreach($data['option_value'] as $k => $ov) {
|
||||
$options[] = ['value' => $ov, 'display' => $data['option_name'][$k] ];
|
||||
}
|
||||
$data['options'] = $options;
|
||||
unset($data['option_value']);
|
||||
unset($data['option_name']);
|
||||
}
|
||||
//echo '<pre>'; print_r($data); exit;
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function editall(Request $request) {
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_my_contacts');
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
$fields = $this->get_list_fields();
|
||||
return $this->view('editall')->with([
|
||||
'title' => $this->_title,
|
||||
'fields' => $response->data->attributes,
|
||||
'base_url' => $this->_base_url,
|
||||
'items' => $response->data->items
|
||||
]);
|
||||
}
|
||||
|
||||
public function postsavelist(Request $request) {
|
||||
Log::debug(print_r($request->except('_token'), true));
|
||||
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/savelist', $request->except('_token'));
|
||||
// //echo '<pre>'; print_r($response); exit;
|
||||
// $fields = $this->get_list_fields();
|
||||
// return $this->view('editall')->with([
|
||||
// 'title' => $this->_title,
|
||||
// 'fields' => $response->data->attributes,
|
||||
// 'base_url' => $this->_base_url,
|
||||
// 'items' => $response->data->items
|
||||
// ]);
|
||||
}
|
||||
|
||||
|
||||
public function export(Request $request) {
|
||||
$attributes = LambdaRequest::signedrequest('get', $this->_service, 'contactattribute/get_all', []);
|
||||
$fields = [];
|
||||
foreach($attributes->data->items as $attri) {
|
||||
$fields[] = $attri->code;
|
||||
}
|
||||
$fields[] = 'user_info';
|
||||
$fields[] = 'msl_code';
|
||||
$fields[] = 'position';
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all', ['source' => 'dynamodb', 'belowme' => 'yes', 'search' => json_encode([]), 'keyword' => "", 'fields' => json_encode($fields) ]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
|
||||
$headers = ['Name', 'Email', 'Phone', 'MSL Code', 'Position', 'Rep Name', 'Rep Employee Code', 'Position Name', 'Position Code', 'Status'];
|
||||
foreach($attributes->data->items as $attri) {
|
||||
$headers[] = $attri->attribute;
|
||||
}
|
||||
|
||||
$exceldata[] = $headers;
|
||||
foreach($response->data->items as $user) {
|
||||
$row = [];
|
||||
$row[] = isset($user->name) ? $user->name : '-';
|
||||
$row[] = isset($user->email) ? $user->email : '-';
|
||||
$row[] = isset($user->phone) ? $user->phone : '-';
|
||||
$row[] = isset($user->msl_code) ? $user->msl_code : '-';
|
||||
$row[] = isset($user->position) ? $user->position : '-';
|
||||
|
||||
$row[] = isset($user->user_info->name) ? $user->user_info->name : '-';
|
||||
$row[] = isset($user->user_info->employee_code) ? $user->user_info->employee_code : '-';
|
||||
|
||||
$row[] = isset($user->hierarchy_info->name) ? $user->hierarchy_info->name : '-';
|
||||
$row[] = isset($user->hierarchy_info->code) ? $user->hierarchy_info->code : '-';
|
||||
$row[] = isset($user->status) ? $user->status : '-';
|
||||
|
||||
foreach($attributes->data->items as $attri) {
|
||||
$row[] = isset($user->{$attri->code}) ? $user->{$attri->code} : '-';
|
||||
}
|
||||
$exceldata[] = $row;
|
||||
}
|
||||
return Excel::download(new InvoicesExport($exceldata), 'contacts.xlsx');
|
||||
}
|
||||
|
||||
|
||||
// public function postimport(Request $request) {
|
||||
// if( $request->file('importfile') ) {
|
||||
// $path = $request->file('importfile')->store('user_import');
|
||||
// $request->session()->put('user_import_path', $path);
|
||||
|
||||
// $csv = Reader::createFromPath(storage_path('app') .'/' . $path, 'r');
|
||||
// $csv->setHeaderOffset(0);
|
||||
|
||||
// $header = $csv->getHeader(); //returns the CSV header record
|
||||
// $records = $csv->getRecords(); //returns all the CSV records as an Iterator
|
||||
// $contacts = [];
|
||||
// echo '<pre>';
|
||||
// foreach($records as $record) {
|
||||
// $contacts[] = (array)$record;
|
||||
// }
|
||||
|
||||
// $created = 0;
|
||||
// $updated = 0;
|
||||
// $count = 0;
|
||||
// $total = sizeof($contacts);
|
||||
|
||||
// while($count < $total) {
|
||||
// $tempdata = array_slice($contacts, $count, 20);
|
||||
// Log::debug(print_r($tempdata, true));
|
||||
// $response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/import', $tempdata);
|
||||
// Log::debug(print_r($response, true));
|
||||
// $count = $count + 20;
|
||||
// $created = $created + $response->data->created_count;
|
||||
// $updated = $updated + (isset($response->data->updated_count) ? $response->data->updated_count : 0);
|
||||
// Log::debug(print_r(['$count' => $count, '$created' => $created, '$updated' => $updated], true));
|
||||
// }
|
||||
|
||||
// //echo '<pre>'; print_r($response); exit;
|
||||
// if($response->statusCode == 200 && $response->status == "success") {
|
||||
// return redirect($this->_base_url.'s')->withMessage('Successfully Imported ' .$created. ' records and Updated ' .$updated. ' records out of ' .$total. ' records!!!');
|
||||
// } else {
|
||||
// return \Redirect::back()->withMessage('Some Error occured!');
|
||||
// }
|
||||
|
||||
|
||||
// exit;
|
||||
// return redirect($this->_base_url.'/importmap')->withMessage('Successfully Uploaded !!!');
|
||||
// } else {
|
||||
// return \Redirect::back()->withMessage('Some Error occured!');
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use DB;
|
||||
|
||||
class ProductattributeController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'catalog';
|
||||
$this->_module = 'productattribute';
|
||||
$this->_viewname = 'productattribute';
|
||||
$this->_title = 'Product Attributes';
|
||||
$this->_base_url = '/productattribute';
|
||||
}
|
||||
|
||||
public function list(Request $request) {
|
||||
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all');
|
||||
//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_fields(){
|
||||
return [
|
||||
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
|
||||
//'media_thumb' => ['title' => 'Media Thumb', 'type' => 'image'],
|
||||
'attribute' => ['title' => 'Attribute', 'type' => 'text'],
|
||||
'status' => ['title' => 'Status', 'type' => 'select'],
|
||||
];
|
||||
}
|
||||
|
||||
protected function get_form_fields($type, $values){
|
||||
return [
|
||||
'attribute' => ['title' => 'Attribute', 'type' => 'text', 'required' => true],
|
||||
'code' => ['title' => 'Code (small caps without spaces and special chars except "_")', 'type' => 'text', 'required' => true],
|
||||
'required' => ['title' => 'Is Required', 'type' => 'yesno', 'required' => true],
|
||||
//'editable' => ['title' => 'Is Editable', 'type' => 'yesno', 'required' => true],
|
||||
'type' => ['title' => 'Attribute Type', 'type' => 'select', 'required' => true, 'values' => ['text' => 'Text', 'number' => 'Number', 'date' => 'Date', 'email' => 'Email', 'url' => 'Url', 'select' => 'Dropdown', 'checkbox' => 'Checkbox', 'radio' => 'Radio'] ],
|
||||
|
||||
'sort_order' => ['title' => 'Sort Order', 'type' => 'number', 'required' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
'options' => ['title' => 'Options', 'type' => 'mapping', 'fullwidth' => true ],
|
||||
];
|
||||
}
|
||||
|
||||
protected function _beforeform($type, $values) {
|
||||
if($type == 'edit') {
|
||||
//$this->_request->session()->put('entity_id', $values->id);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
protected function _beforesave($type, $request) {
|
||||
$data = $request->except('_token');
|
||||
//$data['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] ];
|
||||
}
|
||||
$data['options'] = $options;
|
||||
unset($data['option_value']);
|
||||
unset($data['option_name']);
|
||||
}
|
||||
//echo '<pre>'; print_r($data); exit;
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use DB;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use App\Exports\InvoicesExport;
|
||||
|
||||
class ReportController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->_service = 'ums';
|
||||
$this->_module = 'group';
|
||||
$this->_viewname = 'grid';
|
||||
$this->_title = 'Summary';
|
||||
$this->_base_url = '/report';
|
||||
}
|
||||
|
||||
public function nybfsummary(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/nybfsummary', []);
|
||||
return view('report.nybfsummary')->with(['follow_up' => $response->data->follow_up]);
|
||||
}
|
||||
|
||||
public function nybfdoctorwise(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/nybfdoctorwise', []);
|
||||
return view('report.nybfdoctorwise')->with(['follow_up' => $response->data->follow_up]);
|
||||
}
|
||||
|
||||
public function nyexecutionfollowup(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/nyexecutionfollowup', [], 180);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return view('report.nyexecutionfollowup')->with(['executions' => json_decode(file_get_contents( $response->data->jsonfile ), true) ]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function summary(Request $request)
|
||||
{
|
||||
return view('grid.list')->with(['title' => $this->_title]);
|
||||
}
|
||||
|
||||
public function activitywise(Request $request)
|
||||
{
|
||||
return view('grid.activitywise')->with(['title' => 'Activity Wise']);
|
||||
}
|
||||
|
||||
public function bdesummary(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bdesummaryreport', ["month" => "November 2023"]);
|
||||
return view('report.bdesummary')->with(['days' => $response->data->days, 'ems' => $response->data->ems, 'zbms' => $response->data->zbms, 'rbms' => $response->data->rbms, 'totals' => $response->data->totals]);
|
||||
}
|
||||
|
||||
public function bdescansvscalls(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bdescansvscalls', ["month" => "November 2023"]);
|
||||
return view('report.bdescansvscalls')->with(['zbms' => $response->data->zbms, 'rbms' => $response->data->rbms, 'totals' => $response->data->totals]);
|
||||
}
|
||||
|
||||
public function rbmwiseweekly(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bderbmwiseweekly', ["month" => "November 2023"]);
|
||||
return view('report.bdesummary')->with(['days' => $response->data->days, 'ems' => $response->data->ems, 'zbms' => $response->data->zbms, 'rbms' => $response->data->rbms]);
|
||||
}
|
||||
public function drreferralanalysis(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bdedrreferralanalysis', ["month" => "November 2023"]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return view('report.drreferralanalysis')->with(['doctors' => $response->data->doctors, 'days' => $response->data->days]);
|
||||
}
|
||||
public function drreferralsummary(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bdedrreferralsummary', ["month" => "November 2023"]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return view('report.drreferralsummary')->with(['regions' => $response->data->regions, 'days' => $response->data->days]);
|
||||
}
|
||||
public function bdedevicewise(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bdedevicewise', ["month" => "November 2023"]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return view('report.bdedevicewise')->with(['metrics' => $response->data->metrics]);
|
||||
}
|
||||
public function bderbmwise(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bderbmwise', ["month" => "November 2023"]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return view('report.bderbmwise')->with(['rbms' => $response->data->rbms, 'weeks' => $response->data->weeks]);
|
||||
}
|
||||
public function bdeeducatorwiseaverage(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bdeeducatorwiseaverage', ["month" => "November 2023"]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return view('report.bdeeducatorwiseaverage')->with(['rbms' => $response->data->rbms, 'days' => $response->data->days]);
|
||||
}
|
||||
|
||||
public function bdedevicedashboard(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bdedevicedashboard', ["month" => "November 2023"]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
//return view('report.bdedevicewise')->with(['metrics' => $response->data->metrics]);
|
||||
return response()->json( $response->data );
|
||||
}
|
||||
public function bdedashboardtrend(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bdedashboardtrend', ["month" => "November 2023"]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
//return view('report.bdedevicewise')->with(['metrics' => $response->data->metrics]);
|
||||
return response()->json( $response->data );
|
||||
}
|
||||
|
||||
public function bdedoctorscans(Request $request){
|
||||
return view('report.bdedoctorscans');
|
||||
}
|
||||
public function ajaxbdedoctorscans(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bdedoctorscans');
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return response()->json( $response->data );
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function bfactivitywise(Request $request){
|
||||
$teams = DB::connection('primary')->table('breathefree_team')->select('team')->distinct()->get();
|
||||
$regions = DB::connection('primary')->table('breathefree_team')->select('region')->distinct()->get();
|
||||
//echo '<pre>'; print_r($regions);print_r($teams); exit;
|
||||
return view('report.bfactivitywise')->with(['teams' => $teams, 'regions' => $regions]);
|
||||
}
|
||||
public function postajaxdatabfactivitywise(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bfactivitywise', $request->except('_token'));
|
||||
$request->session()->put('bfactivitywise_files', $response->data->files);
|
||||
return response()->json(["total" => $response->data->total_count , "jsondata" => json_decode(file_get_contents( $response->data->jsonfile ), true)] );
|
||||
}
|
||||
public function ajaxdatabfactivitywise(Request $request){
|
||||
$files = $request->session()->get('bfactivitywise_files');
|
||||
$fileno = $request->input('fileno', '0');
|
||||
return response()->json(json_decode(file_get_contents( $files[$fileno] ), true));
|
||||
}
|
||||
|
||||
public function bfedudoctorwise(Request $request){
|
||||
// $response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bfedudoctorwise');
|
||||
// echo '<pre>'; print_r($response); exit;
|
||||
return view('report.bfedudoctorwise');
|
||||
}
|
||||
public function ajaxdatabfedudoctorwise(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bfedudoctorwise', ["month" => "July 2023"]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return response()->json( json_decode(file_get_contents( $response->data->jsonfile ), true) );
|
||||
}
|
||||
public function bfdoctorwise(Request $request){
|
||||
return view('report.bfdoctorwise');
|
||||
}
|
||||
|
||||
public function bfeducatorwise(Request $request){
|
||||
$specialities = DB::table("bfdashboard_contacts")->select("speciality")->distinct()->get();
|
||||
//print_r($specialities); exit;
|
||||
return view('report.bfeducatorwise')->with(["specialities" => $specialities]);
|
||||
}
|
||||
public function ajaxdatabfeducatorwise(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bfeducatorwise', ["month" => "July 2023"]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
return response()->json( json_decode(file_get_contents( $response->data->jsonfile ), true) );
|
||||
}
|
||||
|
||||
public function bfsummary(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bfsummary', ["month" => "August 2023"]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
$specialities = DB::table("bfdashboard_contacts")->select("speciality")->distinct()->get();
|
||||
$request->session()->put('bfsummary_jsonfile', $response->data->jsonfile);
|
||||
return view('report.bfsummary')->with(['days' => $response->data->days, 'specialities' => $specialities, 'devices' => $response->data->devices, 'brands' => $response->data->brands, 'teams' => $response->data->teams ]);
|
||||
}
|
||||
public function ajaxdatabfsummary(Request $request){
|
||||
$jsonfile = $request->session()->get('bfsummary_jsonfile');
|
||||
return response()->json( json_decode(file_get_contents( $jsonfile ), true) );
|
||||
}
|
||||
|
||||
public function bfsummary2(Request $request){
|
||||
$response = LambdaRequest::signedrequest('get', 'catalog', 'activity/bfsummary2', ["month" => "August 2023"]);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
$specialities = DB::table("bfdashboard_contacts")->select("speciality")->distinct()->get();
|
||||
//$request->session()->put('bfsummary_jsonfile', $response->data->jsonfile);
|
||||
return view('report.bfsummary2')->with(['days' => $response->data->days, 'specialities' => $specialities, 'metrics' => $response->data->metrics ]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -46,6 +46,7 @@ class SurveyController extends Controller
|
|||
'title' => ['title' => 'Title', 'type' => 'text', 'required' => true],
|
||||
'description' => ['title' => 'Description', 'type' => 'textarea', 'required' => true, 'fullwidth' => true],
|
||||
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
|
||||
'export_fields' => ['title' => 'Export Fields', 'type' => 'textarea', 'required' => false, 'fullwidth' => true ],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,6 +173,8 @@ 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);
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
|
||||
$fields = ['Submitted By', 'User identification', 'Email', 'Employee Code', 'Record Date', 'Submitted On'];
|
||||
$fieldoptions = ['', '', '', '', '', ''];
|
||||
foreach ($response->data->questions as $qid => $question) {
|
||||
|
|
@ -225,6 +227,7 @@ class SurveysubmissionController extends Controller
|
|||
case 'text':
|
||||
case 'date':
|
||||
case 'number':
|
||||
case 'textarea':
|
||||
$item[] = isset($submission->formdata->{$qid}) ? $submission->formdata->{$qid} : '';
|
||||
break;
|
||||
case 'dropdown':
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class UserController extends Controller
|
|||
|
||||
protected function get_form_fields($type, $values){
|
||||
$domain = LambdaRequest::signedrequest('get', $this->_service, 'domain/get_one');
|
||||
//echo '<pre>'; print_r($domain); exit;
|
||||
$designations_dd = [];
|
||||
foreach($domain->data->item->designations as $designation){
|
||||
$designations_dd[$designation] = $designation;
|
||||
|
|
@ -59,7 +60,7 @@ class UserController extends Controller
|
|||
foreach($channels->data->items as $channel){
|
||||
$channels_dd[$channel->id] = $channel->name;
|
||||
}
|
||||
return [
|
||||
$fields = [
|
||||
'firstname' => ['title' => 'Firstname', 'type' => 'text', 'required' => true],
|
||||
'lastname' => ['title' => 'Lastname', 'type' => 'text', 'required' => true],
|
||||
'email' => ['title' => 'Email', 'type' => 'email', 'required' => true],
|
||||
|
|
@ -75,6 +76,19 @@ class UserController extends Controller
|
|||
'address' => ['title' => 'Address', 'type' => 'textarea'],
|
||||
'avatar' => ['title' => 'Avatar', 'type' => 'image'],
|
||||
];
|
||||
if(isset($domain->data->item->login_scheme) && $domain->data->item->login_scheme == 'Password') {
|
||||
$fields['password'] = ['title' => 'Password', 'type' => 'text', 'required' => true];
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
protected function validateImport($headers, $records) {
|
||||
return true;
|
||||
echo '<pre>';
|
||||
foreach($records as $record){
|
||||
print_r($record);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
protected function get_import_fields($records){
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class WallController extends Controller
|
|||
|
||||
protected function get_form_fields($type, $values){
|
||||
$groups = $this->getlambda('get', 'ums', 'group', 'dropdown');
|
||||
$groups_dd = [];
|
||||
$groups_dd = ['all'=>'All Users'];
|
||||
foreach($groups->data->items as $group){
|
||||
$groups_dd[$group->id] = $group->name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class VerifyCsrfToken extends Middleware
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = ['/form/metricreport*', '/form/submitpersonalized', '/formdatalist/zipmultiple'
|
||||
protected $except = ['/form/*', '/form/metricreport*', '/form/submitpersonalized', '/formdatalist/zipmultiple'
|
||||
//
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use Log;
|
|||
|
||||
class LambdaRequest
|
||||
{
|
||||
protected const REMOTE_ENV = 'local';
|
||||
protected const REMOTE_ENV = 'production';
|
||||
protected const LOCAL_URLS = [
|
||||
'ums' => 'http://localhost:3010/dev/',
|
||||
'mag' => 'http://localhost:3012/dev/',
|
||||
|
|
@ -18,11 +18,15 @@ class LambdaRequest
|
|||
'detailing' => 'http://localhost:3016/dev/',
|
||||
'competition' => 'http://localhost:3017/dev/',
|
||||
'communication' => 'http://localhost:3018/dev/',
|
||||
'catalog' => 'http://localhost:3020/dev/',
|
||||
];
|
||||
protected const PROD_URL = 'https://rapportapi.click/';
|
||||
|
||||
protected static function genurl($service, $url) {
|
||||
switch(true) {
|
||||
case self::REMOTE_ENV != 'local' && $service == 'ums' && $url == 'hierarchy/get_all':
|
||||
return 'https://ljtw6cnu6kzxm3s76upgsvmz5u0ufrep.lambda-url.ap-south-1.on.aws/';
|
||||
break;
|
||||
case self::REMOTE_ENV != 'local' && $service == 'metric' && $url == 'metric_report/view':
|
||||
return 'https://zbmttswaqimy3nmo5wactmja3i0uosyv.lambda-url.ap-south-1.on.aws/';
|
||||
break;
|
||||
|
|
@ -32,6 +36,12 @@ class LambdaRequest
|
|||
case self::REMOTE_ENV != 'local' && $service == 'form' && $url == 'formentity/getformhistory':
|
||||
return 'https://sgrmuxa46z7xfouezyvg3tnhnq0yptjn.lambda-url.ap-south-1.on.aws/';
|
||||
break;
|
||||
case self::REMOTE_ENV != 'local' && $service == 'form' && $url == 'formentity/getforminfo':
|
||||
return 'https://bopqsnxa2ssc2dqmrs26ekslhu0uqmzx.lambda-url.ap-south-1.on.aws/';
|
||||
break;
|
||||
case self::REMOTE_ENV != 'local' && $service == 'catalog' && $url == 'activity/nyexecutionfollowup':
|
||||
return 'https://4sat7sjmmslqwq6nil2kxjxm6y0afoii.lambda-url.ap-south-1.on.aws/';
|
||||
break;
|
||||
case self::REMOTE_ENV == 'local':
|
||||
return self::LOCAL_URLS[$service] . $url;
|
||||
break;
|
||||
|
|
@ -39,7 +49,7 @@ class LambdaRequest
|
|||
return self::PROD_URL . $service . '/' . $url;
|
||||
break;
|
||||
}
|
||||
// if(self::REMOTE_ENV == 'local') {
|
||||
// if(self::REMOTE_ENV == 'local') {
|
||||
// return self::LOCAL_URLS[$service] . $url;
|
||||
// } else {
|
||||
// return self::PROD_URL . $service . '/' . $url;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use DB;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
use Log;
|
||||
|
||||
class Importdata implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $import_id;
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($import_id)
|
||||
{
|
||||
Log::debug($import_id);
|
||||
$this->import_id = $import_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$import_id = $this->import_id;
|
||||
$import = DB::table('import_jobs')->where('id', $import_id)->first();
|
||||
|
||||
Log::debug(print_r($import, true));
|
||||
$token = DB::table('users')->select('access_token')->where('id', $import->user_id)->first()->access_token;
|
||||
echo $token;
|
||||
$response = LambdaRequest::postrequest($import->service, $import->module.'/import', ['import_id' => $import->id ], $token );
|
||||
echo '<pre>'; print_r($response); exit;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Widgets;
|
||||
|
||||
use Arrilot\Widgets\AbstractWidget;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
|
||||
class CompatitionDashboard extends AbstractWidget
|
||||
{
|
||||
/**
|
||||
* The configuration array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $config = [];
|
||||
|
||||
/**
|
||||
* Treat this method as a controller action.
|
||||
* Return view() or other content to display.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$response = LambdaRequest::signedrequest('get', 'competition', 'contest/list', ['scores' => 'yes'] );
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
if($response->statusCode == 200) {
|
||||
return view('widgets.compatition_dashboard', ['title' => $this->config['title'], 'scores' => $response->data->items]);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Widgets;
|
||||
|
||||
use Arrilot\Widgets\AbstractWidget;
|
||||
use App\Http\Requests\LambdaRequest;
|
||||
class CompatitionTeamDashboard extends AbstractWidget
|
||||
{
|
||||
/**
|
||||
* The configuration array.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $config = [];
|
||||
|
||||
/**
|
||||
* Treat this method as a controller action.
|
||||
* Return view() or other content to display.
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$response = LambdaRequest::signedrequest('get', 'competition', 'contest/teamdashboard', ['scores' => 'yes'] );
|
||||
//echo '<pre>'; print_r($response); exit;
|
||||
if($response->statusCode == 200 && sizeof($response->data->items) > 0 && isset($response->data->items[0]->userscore) ) {
|
||||
return view('widgets.compatition_team_dashboard', ['title' => $this->config['title'], 'scores' => $response->data->items]);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -52,4 +52,8 @@ $app->singleton(
|
|||
|
|
||||
*/
|
||||
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: *');
|
||||
header('Access-Control-Allow-Headers: *');
|
||||
|
||||
return $app;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,193 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Datatables"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{asset('assets/libs/datatables/datatables.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.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-md-6 p-2">
|
||||
<h4 class="page-title">{{$title}} Management</h4>
|
||||
</div>
|
||||
<div class="col-md-6 p-2">
|
||||
@if(isset($buttons))
|
||||
@foreach($buttons as $button)
|
||||
<a href="{{$button['link']}}" class="btn btn-{{$button['title']=='Add New'?'success':'dark'}} waves-effect waves-light float-end me-2" id="btn-{{strtolower(str_replace(' ', '-', $button['title']))}}">{{$button['title']}}</a>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table id="list-page-datatable" class="table w-100 nowrap">
|
||||
<thead>
|
||||
<tr>
|
||||
@foreach($fields as $field => $props)
|
||||
<th>{{$props['title']}}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($items as $item)
|
||||
<tr>
|
||||
@foreach($fields as $field => $props)
|
||||
@if($field != 'actions')
|
||||
<td>
|
||||
@switch($props['type'])
|
||||
@case('image')
|
||||
<img src="{{ $item->{$field} }}" class="img-thumbnail">
|
||||
@break
|
||||
@case('text')
|
||||
@case('select')
|
||||
{{ isset($item->{$field}) ? $item->{$field} : '' }}
|
||||
@break
|
||||
@case('date')
|
||||
{{ date("d M Y", strtotime($item->{$field})) }}
|
||||
@break
|
||||
@case('datetime')
|
||||
{{ date("d M Y, h:iA", strtotime($item->{$field})+19800 ) }}
|
||||
@break
|
||||
|
||||
@endswitch
|
||||
</td>
|
||||
@else
|
||||
<td>
|
||||
@foreach($props['buttons'] as $key => $button)
|
||||
@switch($button)
|
||||
@case('edit')
|
||||
<a href="{{$base_url}}/edit?id={{$item->id}}" class="action-icon"> <i class="mdi mdi-square-edit-outline text-warning"></i></a>
|
||||
@break
|
||||
@case('delete')
|
||||
<a href="{{$base_url}}/delete?id={{$item->id}}" class="action-icon"> <i class="mdi mdi-delete text-danger"></i></a>
|
||||
@break
|
||||
@default
|
||||
@php
|
||||
if(isset($button['href']) && $button['href'] != '') {
|
||||
$href = $item->{$button['href']};
|
||||
} else {
|
||||
$querystring = $button['querystring'];
|
||||
foreach((array)$item as $k => $v) {
|
||||
if(strpos($querystring,'{'.strtoupper($k).'}') !== false)
|
||||
$querystring = str_replace('{'.strtoupper($k).'}', $v, $querystring);
|
||||
}
|
||||
$href = $base_url.'/'.$key.'?'.$querystring;
|
||||
}
|
||||
|
||||
@endphp
|
||||
<a href="{{$href}}" class="action-icon"> <i class="mdi mdi-{{$button['icon']}}"></i></a>
|
||||
@endswitch
|
||||
@endforeach
|
||||
<a href="{{$base_url}}/processimport?id={{$item->id}}" class="btn btn-success btn-xs">Process</a>
|
||||
<!-- @if($item->status == 'active')
|
||||
<a href="{{$base_url}}/step?id={{$item->id}}&step=import" class="btn btn-success btn-xs">Import</a>
|
||||
@elseif($item->status == 'imported')
|
||||
<a href="{{$base_url}}/step?id={{$item->id}}&step=validate_users" class="btn btn-success btn-xs">Validate Users</a>
|
||||
@elseif($item->status == 'users_missing')
|
||||
<a href="{{$base_url}}/step?id={{$item->id}}&step=validate_users" class="btn btn-success btn-xs">Re-Validate Users</a>
|
||||
@elseif($item->status == 'validated_users')
|
||||
<a href="{{$base_url}}/step?id={{$item->id}}&step=validate_contacts" class="btn btn-success btn-xs">Validate Doctors</a>
|
||||
@elseif($item->status == 'validated_contacts')
|
||||
<a href="{{$base_url}}/step?id={{$item->id}}&step=index_data" class="btn btn-success btn-xs">Index Data</a>
|
||||
@endif -->
|
||||
</td>
|
||||
@endif
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
|
||||
<!-- Right modal content -->
|
||||
<div id="date_filter_modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header border-0">
|
||||
<h4 class="modal-title" id="standard-modalLabel">Filter results by date</h4>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<form method="get" id="form-date-filter">
|
||||
<div class="col-12">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">From Date</label>
|
||||
<input type="text" name="startdate" class="form-control" data-provide="datepicker" value="{{isset($startdate)?date("m/d/Y", strtotime($startdate)):''}}" data-date-autoclose="true">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">To Date</label>
|
||||
<input type="text" name="enddate" class="form-control" data-provide="datepicker" value="{{isset($enddate)?date("m/d/Y", strtotime($enddate)):''}}" data-date-autoclose="true">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success btn-sm">Filter</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" data-bs-dismiss="modal">Close</button>
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
.img-thumbnail { max-width: 100px }
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<!-- third party js -->
|
||||
<script src="{{asset('assets/libs/datatables/datatables.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#list-page-datatable').DataTable({
|
||||
stateSave: true,
|
||||
"scrollX": true,
|
||||
"language": {
|
||||
"paginate": {
|
||||
"previous": "<i class='mdi mdi-chevron-left'>",
|
||||
"next": "<i class='mdi mdi-chevron-right'>"
|
||||
}
|
||||
},
|
||||
"drawCallback": function () {
|
||||
$('.dataTables_paginate > .pagination').addClass('pagination-rounded');
|
||||
}
|
||||
});
|
||||
|
||||
$("#btn-date-filter").click(function(){
|
||||
$("#date_filter_modal").modal("show")
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
||||
<!-- end demo js-->
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Datatables"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{asset('assets/libs/datatables/datatables.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.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-md-6 p-2">
|
||||
<h4 class="page-title">Process Import: {{$title}}</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<button class="btn btn-primary disabled btn-lg" style="width:100%">Validate CSV Data</button>
|
||||
<button class="btn btn-outline-primary disabled btn-lg mt-2" style="width:100%">Import CSV Data</button>
|
||||
<button class="btn btn-outline-primary disabled btn-lg mt-2" style="width:100%">Validate Users</button>
|
||||
<button class="btn btn-outline-primary disabled btn-lg mt-2" style="width:100%">Validate Doctors</button>
|
||||
<button class="btn btn-outline-primary disabled btn-lg mt-2" style="width:100%">Index Data</button>
|
||||
</div>
|
||||
<div class="col-md-8 offset-md-1">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
<style type="text/css">
|
||||
.btn.disabled{
|
||||
opacity: 1!important;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<!-- third party js -->
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
var interval = {}
|
||||
function checkStatus() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/activityimport/checkstatus?id={{$id}}',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
console.log(data)
|
||||
showStatus(data.status, data.context)
|
||||
if(data.status == 'in_process') {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function showStatus(status, context) {
|
||||
console.log(status)
|
||||
switch(status) {
|
||||
case 'active':
|
||||
$('.card-body .col-md-8').html('<h4>The CSV file is uploaded, now you need to validate the CSV</h4><button class="btn btn-success step_button" step="validate_csv">Validate CSV</button>')
|
||||
break;
|
||||
case 'in_process':
|
||||
$('.card-body .col-md-8').html('<i class="mdi mdi-spin mdi-loading mdi-48px"></i><h4>Please wait while we process your request!!</h4>')
|
||||
break;
|
||||
case 'fields_missing':
|
||||
$('.card-body .col-md-8').html('')
|
||||
$('.card-body .col-md-8').append('<h4>Please find below a list of missing CSV Fields</h4>')
|
||||
$('.card-body .col-md-8').append('<ol></ol>')
|
||||
for(let miss of context.missing) {
|
||||
$('.card-body .col-md-8 ol').append('<li>'+miss+'</li>')
|
||||
}
|
||||
$('.card-body .col-md-8').append('<button class="btn btn-success step_button" step="validate_csv">Re Validate CSV</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
case 'validated_csv':
|
||||
$('.card-body .col-md-8').html('<h4>The CSV data is now Validated, please proceed to the next step</h4><button class="btn btn-success step_button" step="import">Import CSV Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
case 'imported':
|
||||
$('.card-body .col-md-8').html('<h4>The CSV data is Imported Successfully, please proceed to the next step</h4><button class="btn btn-success step_button" step="validate_users">Validate User Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
case 'users_missing':
|
||||
$('.card-body .col-md-8').html('')
|
||||
$('.card-body .col-md-8').append('<h4>Please find below a list of missing users</h4>')
|
||||
$('.card-body .col-md-8').append('<ol></ol>')
|
||||
for(let miss of context.missing) {
|
||||
$('.card-body .col-md-8 ol').append('<li>'+miss+'</li>')
|
||||
}
|
||||
$('.card-body .col-md-8').append('<button class="btn btn-success step_button" step="validate_users">Re Validate User Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
case 'validated_users':
|
||||
$('.card-body .col-md-8').html('<h4>The CSV data Validated for Users. Please proceed to next step</h4><button class="btn btn-success step_button" step="validate_doctors">Validate Doctors Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
|
||||
case 'doctors_missing':
|
||||
$('.card-body .col-md-8').html('')
|
||||
$('.card-body .col-md-8').append('<h4>Please find below a list of missing doctors</h4>')
|
||||
$('.card-body .col-md-8').append('<ol></ol>')
|
||||
for(let miss of context.missing) {
|
||||
$('.card-body .col-md-8 ol').append('<li>'+miss+'</li>')
|
||||
}
|
||||
$('.card-body .col-md-8').append('<button class="btn btn-success step_button" step="validate_doctors">Re Validate Doctor Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
case 'validated_doctors':
|
||||
$('.card-body .col-md-8').html('<h4>The CSV data Validated for Doctors. Please proceed to next step</h4><button class="btn btn-success step_button" step="index_data">Index Final Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
|
||||
case 'completed':
|
||||
$('.card-body .col-md-8').html('<h4>The CSV data is Indexed and process is Completed!!!</h4>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
|
||||
// default:
|
||||
// clearInterval(interval);
|
||||
// break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
showStatus("{{$status}}", {!! json_encode($context) !!})
|
||||
|
||||
$('.step_button').click(function(){
|
||||
$('.card-body .col-md-8').html('<i class="mdi mdi-spin mdi-loading mdi-48px"></i><h4>Please wait while we process your request!!</h4>')
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/activityimport/step?id={{$id}}&step='+$(this).attr('step'),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
console.log(data)
|
||||
showStatus(data.status, data.context)
|
||||
},
|
||||
});
|
||||
interval = setInterval(checkStatus, 2000);
|
||||
})
|
||||
|
||||
|
||||
|
||||
//var interval = setInterval(checkStatus, 2000); // 2000 ms = start after 2sec
|
||||
|
||||
});
|
||||
</script>
|
||||
<!-- end demo js-->
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Datatables"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{asset('assets/libs/datatables/datatables.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.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-md-6 p-2">
|
||||
<h4 class="page-title">Step:</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body text-center">
|
||||
<i class="mdi mdi-spin mdi-loading mdi-48px"></i>
|
||||
<h2>Please wait while we process your request!!</h2>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<!-- third party js -->
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
var interval = setInterval(checkStatus, 2000); // 2000 ms = start after 2sec
|
||||
function checkStatus() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/activityimport/checkstatus?id={{$id}}&step={{$step}}',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
console.log(data)
|
||||
switch(data.status) {
|
||||
case 'users_missing':
|
||||
$('.card-body').html('')
|
||||
$('.card-body').append('<h2>Please find below a list of missing users</h2>')
|
||||
$('.card-body').append('<h5>' + data.context.missing_users.join(", ") + '</h5>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
}
|
||||
},
|
||||
});
|
||||
//alert('this is a 2 second warning');
|
||||
// clearInterval(interval);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<!-- end demo js-->
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,193 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Datatables"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{asset('assets/libs/datatables/datatables.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.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-md-6 p-2">
|
||||
<h4 class="page-title">{{$title}} Management</h4>
|
||||
</div>
|
||||
<div class="col-md-6 p-2">
|
||||
@if(isset($buttons))
|
||||
@foreach($buttons as $button)
|
||||
<a href="{{$button['link']}}" class="btn btn-{{$button['title']=='Add New'?'success':'dark'}} waves-effect waves-light float-end me-2" id="btn-{{strtolower(str_replace(' ', '-', $button['title']))}}">{{$button['title']}}</a>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table id="list-page-datatable" class="table w-100 nowrap">
|
||||
<thead>
|
||||
<tr>
|
||||
@foreach($fields as $field => $props)
|
||||
<th>{{$props['title']}}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($items as $item)
|
||||
<tr>
|
||||
@foreach($fields as $field => $props)
|
||||
@if($field != 'actions')
|
||||
<td>
|
||||
@switch($props['type'])
|
||||
@case('image')
|
||||
<img src="{{ $item->{$field} }}" class="img-thumbnail">
|
||||
@break
|
||||
@case('text')
|
||||
@case('select')
|
||||
{{ isset($item->{$field}) ? $item->{$field} : '' }}
|
||||
@break
|
||||
@case('date')
|
||||
{{ date("d M Y", strtotime($item->{$field})) }}
|
||||
@break
|
||||
@case('datetime')
|
||||
{{ date("d M Y, h:iA", strtotime($item->{$field})+19800 ) }}
|
||||
@break
|
||||
|
||||
@endswitch
|
||||
</td>
|
||||
@else
|
||||
<td>
|
||||
@foreach($props['buttons'] as $key => $button)
|
||||
@switch($button)
|
||||
@case('edit')
|
||||
<a href="{{$base_url}}/edit?id={{$item->id}}" class="action-icon"> <i class="mdi mdi-square-edit-outline text-warning"></i></a>
|
||||
@break
|
||||
@case('delete')
|
||||
<a href="{{$base_url}}/delete?id={{$item->id}}" class="action-icon"> <i class="mdi mdi-delete text-danger"></i></a>
|
||||
@break
|
||||
@default
|
||||
@php
|
||||
if(isset($button['href']) && $button['href'] != '') {
|
||||
$href = $item->{$button['href']};
|
||||
} else {
|
||||
$querystring = $button['querystring'];
|
||||
foreach((array)$item as $k => $v) {
|
||||
if(strpos($querystring,'{'.strtoupper($k).'}') !== false)
|
||||
$querystring = str_replace('{'.strtoupper($k).'}', $v, $querystring);
|
||||
}
|
||||
$href = $base_url.'/'.$key.'?'.$querystring;
|
||||
}
|
||||
|
||||
@endphp
|
||||
<a href="{{$href}}" class="action-icon"> <i class="mdi mdi-{{$button['icon']}}"></i></a>
|
||||
@endswitch
|
||||
@endforeach
|
||||
<a href="{{$base_url}}/processimport?id={{$item->id}}" class="btn btn-success btn-xs">Process</a>
|
||||
<!-- @if($item->status == 'active')
|
||||
<a href="{{$base_url}}/step?id={{$item->id}}&step=import" class="btn btn-success btn-xs">Import</a>
|
||||
@elseif($item->status == 'imported')
|
||||
<a href="{{$base_url}}/step?id={{$item->id}}&step=validate_users" class="btn btn-success btn-xs">Validate Users</a>
|
||||
@elseif($item->status == 'users_missing')
|
||||
<a href="{{$base_url}}/step?id={{$item->id}}&step=validate_users" class="btn btn-success btn-xs">Re-Validate Users</a>
|
||||
@elseif($item->status == 'validated_users')
|
||||
<a href="{{$base_url}}/step?id={{$item->id}}&step=validate_contacts" class="btn btn-success btn-xs">Validate Doctors</a>
|
||||
@elseif($item->status == 'validated_contacts')
|
||||
<a href="{{$base_url}}/step?id={{$item->id}}&step=index_data" class="btn btn-success btn-xs">Index Data</a>
|
||||
@endif -->
|
||||
</td>
|
||||
@endif
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
|
||||
<!-- Right modal content -->
|
||||
<div id="date_filter_modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header border-0">
|
||||
<h4 class="modal-title" id="standard-modalLabel">Filter results by date</h4>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<form method="get" id="form-date-filter">
|
||||
<div class="col-12">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">From Date</label>
|
||||
<input type="text" name="startdate" class="form-control" data-provide="datepicker" value="{{isset($startdate)?date("m/d/Y", strtotime($startdate)):''}}" data-date-autoclose="true">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">To Date</label>
|
||||
<input type="text" name="enddate" class="form-control" data-provide="datepicker" value="{{isset($enddate)?date("m/d/Y", strtotime($enddate)):''}}" data-date-autoclose="true">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success btn-sm">Filter</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" data-bs-dismiss="modal">Close</button>
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
.img-thumbnail { max-width: 100px }
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<!-- third party js -->
|
||||
<script src="{{asset('assets/libs/datatables/datatables.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#list-page-datatable').DataTable({
|
||||
stateSave: true,
|
||||
"scrollX": true,
|
||||
"language": {
|
||||
"paginate": {
|
||||
"previous": "<i class='mdi mdi-chevron-left'>",
|
||||
"next": "<i class='mdi mdi-chevron-right'>"
|
||||
}
|
||||
},
|
||||
"drawCallback": function () {
|
||||
$('.dataTables_paginate > .pagination').addClass('pagination-rounded');
|
||||
}
|
||||
});
|
||||
|
||||
$("#btn-date-filter").click(function(){
|
||||
$("#date_filter_modal").modal("show")
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
||||
<!-- end demo js-->
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Datatables"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{asset('assets/libs/datatables/datatables.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.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-md-6 p-2">
|
||||
<h4 class="page-title">Process Import: {{$title}}</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<button class="btn btn-primary disabled btn-lg" style="width:100%">Validate CSV Data</button>
|
||||
<button class="btn btn-outline-primary disabled btn-lg mt-2" style="width:100%">Import CSV Data</button>
|
||||
<button class="btn btn-outline-primary disabled btn-lg mt-2" style="width:100%">Validate Users</button>
|
||||
<button class="btn btn-outline-primary disabled btn-lg mt-2" style="width:100%">Validate Doctors</button>
|
||||
<button class="btn btn-outline-primary disabled btn-lg mt-2" style="width:100%">Index Data</button>
|
||||
</div>
|
||||
<div class="col-md-8 offset-md-1">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
<style type="text/css">
|
||||
.btn.disabled{
|
||||
opacity: 1!important;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<!-- third party js -->
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
var interval = {}
|
||||
function checkStatus() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/bdeimport/checkstatus?id={{$id}}',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
console.log(data)
|
||||
showStatus(data.status, data.context)
|
||||
if(data.status == 'in_process') {
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function showStatus(status, context) {
|
||||
console.log(status)
|
||||
switch(status) {
|
||||
case 'active':
|
||||
$('.card-body .col-md-8').html('<h4>The CSV file is uploaded, please proceed to the next step</h4><button class="btn btn-success step_button" step="validate_csv">Validate CSV Data</button>')
|
||||
break;
|
||||
case 'in_process':
|
||||
$('.card-body .col-md-8').html('<i class="mdi mdi-spin mdi-loading mdi-48px"></i><h4>Please wait while we process your request!!</h4>')
|
||||
break;
|
||||
case 'pincodes_missing':
|
||||
$('.card-body .col-md-8').html('')
|
||||
$('.card-body .col-md-8').append('<h4>Please find below a list of missing pincodes</h4>')
|
||||
$('.card-body .col-md-8').append('<ol></ol>')
|
||||
for(let miss of context.missing) {
|
||||
$('.card-body .col-md-8 ol').append('<li>'+miss+'</li>')
|
||||
}
|
||||
$('.card-body .col-md-8').append('<button class="btn btn-success step_button" step="import">Re Import Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
case 'fields_missing':
|
||||
$('.card-body .col-md-8').html('')
|
||||
$('.card-body .col-md-8').append('<h4>Please find below a list of missing CSV Fields</h4>')
|
||||
$('.card-body .col-md-8').append('<ol></ol>')
|
||||
for(let miss of context.missing) {
|
||||
$('.card-body .col-md-8 ol').append('<li>'+miss+'</li>')
|
||||
}
|
||||
$('.card-body .col-md-8').append('<button class="btn btn-success step_button" step="validate_csv">Re Validate CSV</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
case 'validated_csv':
|
||||
$('.card-body .col-md-8').html('<h4>The CSV data is now Validated, please proceed to the next step</h4><button class="btn btn-success step_button" step="import">Import CSV Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
case 'imported':
|
||||
$('.card-body .col-md-8').html('<h4>The CSV data is Imported Successfully, please proceed to the next step</h4><button class="btn btn-success step_button" step="validate_users">Validate User Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
case 'users_missing':
|
||||
$('.card-body .col-md-8').html('')
|
||||
$('.card-body .col-md-8').append('<h4>Please find below a list of missing users</h4>')
|
||||
$('.card-body .col-md-8').append('<ol></ol>')
|
||||
for(let miss of context.missing) {
|
||||
$('.card-body .col-md-8 ol').append('<li>'+miss+'</li>')
|
||||
}
|
||||
$('.card-body .col-md-8').append('<button class="btn btn-success step_button" step="validate_users">Re Validate User Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
case 'validated_users':
|
||||
$('.card-body .col-md-8').html('<h4>The CSV data Validated for Users. Please proceed to next step</h4><button class="btn btn-success step_button" step="validate_doctors">Validate Doctors Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
|
||||
case 'doctors_missing':
|
||||
$('.card-body .col-md-8').html('')
|
||||
$('.card-body .col-md-8').append('<h4>Please find below a list of missing doctors</h4>')
|
||||
$('.card-body .col-md-8').append('<ol></ol>')
|
||||
for(let miss of context.missing) {
|
||||
$('.card-body .col-md-8 ol').append('<li>'+miss+'</li>')
|
||||
}
|
||||
$('.card-body .col-md-8').append('<button class="btn btn-success step_button" step="validate_doctors">Re Validate Doctor Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
case 'validated_doctors':
|
||||
$('.card-body .col-md-8').html('<h4>The CSV data Validated for Doctors. Please proceed to next step</h4><button class="btn btn-success step_button" step="index_data">Index Final Data</button>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
|
||||
case 'completed':
|
||||
$('.card-body .col-md-8').html('<h4>The CSV data is Indexed and process is Completed!!!</h4>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
|
||||
// default:
|
||||
// clearInterval(interval);
|
||||
// break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
showStatus("{{$status}}", {!! json_encode($context) !!})
|
||||
|
||||
$('.step_button').click(function(){
|
||||
$('.card-body .col-md-8').html('<i class="mdi mdi-spin mdi-loading mdi-48px"></i><h4>Please wait while we process your request!!</h4>')
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/bdeimport/step?id={{$id}}&step='+$(this).attr('step'),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
console.log(data)
|
||||
showStatus(data.status, data.context)
|
||||
},
|
||||
});
|
||||
interval = setInterval(checkStatus, 2000);
|
||||
})
|
||||
|
||||
|
||||
|
||||
//var interval = setInterval(checkStatus, 2000); // 2000 ms = start after 2sec
|
||||
|
||||
});
|
||||
</script>
|
||||
<!-- end demo js-->
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Datatables"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{asset('assets/libs/datatables/datatables.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.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-md-6 p-2">
|
||||
<h4 class="page-title">Step:</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body text-center">
|
||||
<i class="mdi mdi-spin mdi-loading mdi-48px"></i>
|
||||
<h2>Please wait while we process your request!!</h2>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<!-- third party js -->
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
var interval = setInterval(checkStatus, 2000); // 2000 ms = start after 2sec
|
||||
function checkStatus() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/activityimport/checkstatus?id={{$id}}&step={{$step}}',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
console.log(data)
|
||||
switch(data.status) {
|
||||
case 'users_missing':
|
||||
$('.card-body').html('')
|
||||
$('.card-body').append('<h2>Please find below a list of missing users</h2>')
|
||||
$('.card-body').append('<h5>' + data.context.missing_users.join(", ") + '</h5>')
|
||||
clearInterval(interval);
|
||||
break;
|
||||
}
|
||||
},
|
||||
});
|
||||
//alert('this is a 2 second warning');
|
||||
// clearInterval(interval);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<!-- end demo js-->
|
||||
@endsection
|
||||
|
|
@ -90,6 +90,16 @@
|
|||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($props['values'] as $k => $v)
|
||||
<div class="col-3">{{$v}}</div>
|
||||
<div class="col-3 mb-1">
|
||||
<input type="text" id="field-{{$k}}" name="{{$field}}[{{$k}}]" class="form-control" value="{{isset($option->val)?$option->val:''}}" {{isset($props['required'])&&$props['required']?'required':'' }}>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@case('yesno')
|
||||
<div>
|
||||
<div class="form-check mb-2 form-check-success form-check-inline">
|
||||
|
|
@ -116,7 +126,7 @@
|
|||
@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" />
|
||||
<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 csv" />
|
||||
<p class="text-muted text-center mt-2 mb-0">1GB Max File size</p>
|
||||
</div>
|
||||
@break
|
||||
|
|
|
|||
|
|
@ -0,0 +1,84 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Datatables"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{asset('assets/libs/datatables/datatables.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.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-md-6 p-2">
|
||||
<h4 class="page-title">Import Progress</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8 offset-md-1">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
<style type="text/css">
|
||||
.btn.disabled{
|
||||
opacity: 1!important;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<!-- third party js -->
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
var interval = {}
|
||||
$('.card-body .col-md-8').html('<i class="mdi mdi-spin mdi-loading mdi-48px"></i><h4>Please wait while we process your request!!</h4>')
|
||||
interval = setInterval(checkStatus, 2000)
|
||||
function checkStatus() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '{{$baseurl}}/importstatus?id={{$id}}',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
console.log(data)
|
||||
//showStatus(data.status, data.context)
|
||||
if(data.status > 1) {
|
||||
clearInterval(interval)
|
||||
$('.card-body .col-md-8').html('<h4>'+data.message+'</h4>')
|
||||
} else {
|
||||
$('.card-body .col-md-8').html('<i class="mdi mdi-spin mdi-loading mdi-48px"></i><h4>'+data.imported_records+' out of '+data.total_records+' records processed successfully!!</h4>')
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
<!-- end demo js-->
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
<!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>
|
||||
<body>
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card border-primary border mb-3" id="compatition_dashboard_{{$competition->id}}">
|
||||
<div class="card-header"><i class="mdi mdi-calendar-month-outline font-18 text-success me-1"></i> {{date("d M Y h:iA", strtotime($competition->validity_start))}} - {{date("d M Y h:iA", strtotime($competition->validity_end)-1 )}}</div>
|
||||
<div class="card-body">
|
||||
<h4 class="card-title text-primary">{{$competition->title}}</h4>
|
||||
<!-- <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<th colspan="2">Team Name</th>
|
||||
<th>Avg Runs</th>
|
||||
<th>TM Count</th>
|
||||
<th>Total Runs</th>
|
||||
@foreach($competition->metrics as $metric)
|
||||
<th>{{$metric->name}}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$rank = 0;
|
||||
$lastscore = 0;
|
||||
$metrics = $competition->metrics;
|
||||
$participants = [];
|
||||
foreach($competition->participants as $participant){
|
||||
$participant->runrate = 0;
|
||||
$score = is_object($participant->score) ? 0 : $participant->score;
|
||||
if($score > 0) {
|
||||
$score = $score / $participant->users_count;
|
||||
$participant->runrate = $score;
|
||||
}
|
||||
$participants[] = $participant;
|
||||
}
|
||||
usort($participants,function($first,$second){
|
||||
return $first->runrate < $second->runrate;
|
||||
});
|
||||
@endphp
|
||||
|
||||
@foreach($participants as $participant)
|
||||
@if($participant->type == 'Team')
|
||||
@php
|
||||
if($lastscore == 0 && $participant->runrate > 0) {
|
||||
$rank++;
|
||||
$lastscore = $participant->runrate;
|
||||
}
|
||||
if($lastscore > 0 && $participant->runrate < $lastscore) {
|
||||
$rank++;
|
||||
$lastscore = $participant->runrate;
|
||||
}
|
||||
@endphp
|
||||
<tr>
|
||||
<td><h2>{{$rank}}</h2></td>
|
||||
<td style="width: 36px;">
|
||||
<img src="{{$participant->team->image}}" alt="contact-img" title="contact-img" class="avatar-md" />
|
||||
</td>
|
||||
<td><h5 class="m-0 fw-normal">{{$participant->team->name}}</h5></td>
|
||||
<td>{{ number_format((float)$participant->runrate, 2, '.', '') }}</td>
|
||||
<td>{{ $participant->users_count }}</td>
|
||||
<td>{{ is_object($participant->score) ? '-' : $participant->score }}</td>
|
||||
@foreach($metrics as $metric)
|
||||
<td>{{ isset($participant->{$metric->id}) ? $participant->{$metric->id} : 0 }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Add & Edit Products"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
|
||||
<!-- third party css end -->
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card border-primary border mb-3" id="compatition_dashboard_{{$competition->id}}">
|
||||
<div class="card-header"><i class="mdi mdi-calendar-month-outline font-18 text-success me-1"></i> {{date("d M Y h:iA", strtotime($competition->validity_start))}} - {{date("d M Y h:iA", strtotime($competition->validity_end)-1 )}}</div>
|
||||
<div class="card-body">
|
||||
<h4 class="card-title text-primary">{{$competition->title}}</h4>
|
||||
<!-- <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<th colspan="2">Team Name</th>
|
||||
<th>Avg Runs</th>
|
||||
<th>TM Count</th>
|
||||
<th>Total Runs</th>
|
||||
@foreach($competition->metrics as $metric)
|
||||
<th>{{$metric->name}}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$rank = 0;
|
||||
$lastscore = 0;
|
||||
$metrics = $competition->metrics;
|
||||
$participants = [];
|
||||
foreach($competition->participants as $participant){
|
||||
$participant->runrate = 0;
|
||||
$score = is_object($participant->score) ? 0 : $participant->score;
|
||||
if($score > 0) {
|
||||
$score = $score / $participant->users_count;
|
||||
$participant->runrate = $score;
|
||||
}
|
||||
$participants[] = $participant;
|
||||
}
|
||||
usort($participants,function($first,$second){
|
||||
return $first->runrate < $second->runrate;
|
||||
});
|
||||
@endphp
|
||||
|
||||
@foreach($participants as $participant)
|
||||
@if($participant->type == 'Team')
|
||||
@php
|
||||
if($lastscore == 0 && $participant->runrate > 0) {
|
||||
$rank++;
|
||||
$lastscore = $participant->runrate;
|
||||
}
|
||||
if($lastscore > 0 && $participant->runrate < $lastscore) {
|
||||
$rank++;
|
||||
$lastscore = $participant->runrate;
|
||||
}
|
||||
@endphp
|
||||
<tr>
|
||||
<td><h2>{{$rank}}</h2></td>
|
||||
<td style="width: 36px;">
|
||||
<img src="{{$participant->team->image}}" alt="contact-img" title="contact-img" class="avatar-md" />
|
||||
</td>
|
||||
<td><h5 class="m-0 fw-normal">{{$participant->team->name}}</h5></td>
|
||||
<td>{{ number_format((float)$participant->runrate, 2, '.', '') }}</td>
|
||||
<td>{{ $participant->users_count }}</td>
|
||||
<td>{{ is_object($participant->score) ? '-' : $participant->score }}</td>
|
||||
@foreach($metrics as $metric)
|
||||
<td>{{ isset($participant->{$metric->id}) ? $participant->{$metric->id} : 0 }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,357 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
</head>
|
||||
<body>
|
||||
<div class="container d-flex justify-content-center align-item-center px-0 px-md-3">
|
||||
<div class="page-container">
|
||||
<div
|
||||
class="card page-content-card score-board-page-content-card text-white border-0 mb-0"
|
||||
style="
|
||||
background-image: linear-gradient(
|
||||
180deg,
|
||||
rgba(2, 0, 36, 1) 25%,
|
||||
rgba(23, 23, 135, 0.9) 50%,
|
||||
rgba(72, 72, 222, 0.65) 56%,
|
||||
rgba(0, 212, 255, 0) 100%
|
||||
),
|
||||
url(/images/team4/score-board-page-bg.jpg);
|
||||
background-size: auto;
|
||||
background-repeat: no-repeat;
|
||||
background-position: bottom center;
|
||||
"
|
||||
>
|
||||
<div class="company-logo d-flex justify-content-end">
|
||||
<img
|
||||
src="/images/team4/company-logo.png"
|
||||
class="img-fluid"
|
||||
alt="company-logo"
|
||||
/>
|
||||
</div>
|
||||
<div id="score-board-page-content" class="card-img-overlay">
|
||||
<div class="row row-cols-4 row-card row-head d-flex flex-nowrap">
|
||||
<div class="col col-card d-flex justify-content-center align-item-center"> RANK </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > LOGO </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center text-wrap"> TEAM NAME </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center"> TEAM RUN RATE </div>
|
||||
</div>
|
||||
@foreach($competition->participants as $participant)
|
||||
<div class="row row-cols-4 row-card d-flex flex-nowrap">
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">{{$participant->rank}}</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
<img src="{{$participant->team->image}}" alt="logo-${item.teamName}" class="mx-auto img-fluid" />
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-start align-item-center text-wrap">{{$participant->team->name}}</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">{{$participant->avg_score}}</div>
|
||||
</div>
|
||||
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style type="text/css">
|
||||
body {
|
||||
padding-bottom:0px!important;
|
||||
}
|
||||
.page-container {
|
||||
width: 700px;
|
||||
height: auto;
|
||||
position: relative;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.company-logo {
|
||||
margin-bottom: 20px;
|
||||
padding-top: 40px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
.company-logo img {
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.col-card {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay {
|
||||
position: relative;
|
||||
background-color: rgba(250, 250, 250, 0);
|
||||
padding: 0px 15px 10px;
|
||||
padding-bottom: 20%;
|
||||
}
|
||||
.page-content-card .card-img-overlay .row-card {
|
||||
background-color: transparent;
|
||||
padding: 0px 2px;
|
||||
margin: 0;
|
||||
min-height: 4.2em;
|
||||
color: #fff;
|
||||
}
|
||||
.page-content-card .card-img-overlay .row.row-card:nth-child(odd) > .col-card {
|
||||
color: #333;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay .row.row-card:nth-child(even) > .col-card {
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(3, 150, 219, 1) 17%,
|
||||
rgba(44, 73, 153, 1) 68%
|
||||
);
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay .col-card {
|
||||
font-size: 14px;
|
||||
padding: 8px 8px;
|
||||
align-items: center;
|
||||
line-height: 1.2;
|
||||
border: 1px solid #96e9ff;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay .col-card img {
|
||||
width: auto;
|
||||
height: 25px;
|
||||
}
|
||||
.page-content-card.score-board-page-content-card
|
||||
.card-img-overlay
|
||||
.row-card.row-head
|
||||
.col-card {
|
||||
background: linear-gradient(0deg, rgba(2, 0, 36, 1) 31%, rgb(22 22 116) 82%);
|
||||
border: 1px solid #ccc;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
padding: 8px 5px;
|
||||
color: #fff;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card {
|
||||
max-width: calc((100% / 4));
|
||||
flex-basis: calc((100% / 4));
|
||||
flex-shrink: 1;
|
||||
}
|
||||
.page-content-card .card-img-overlay .row-card .col-card:nth-child(1) {
|
||||
font-weight: 600;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card:nth-child(3) {
|
||||
max-width: calc((3 * (100% / 4)));
|
||||
flex-basis: calc((3 * (100% / 4)));
|
||||
flex-grow: 1;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card:nth-child(4) {
|
||||
max-width: calc((100% / 4) + 20px);
|
||||
flex-basis: calc((100% / 4) + 20px);
|
||||
}
|
||||
|
||||
/** Team Score Page **/
|
||||
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content {
|
||||
background-color: rgba(250, 250, 250, 0);
|
||||
padding: 0px 25px 25%;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.team-logo-container {
|
||||
min-height: 22em;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
padding: 20px;
|
||||
border-radius: 15px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.team-logo-container
|
||||
img {
|
||||
height: 100%;
|
||||
width: auto;
|
||||
}
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content .col-card {
|
||||
max-width: calc((100% / 8));
|
||||
flex-basis: calc((100% / 8));
|
||||
flex-shrink: 1;
|
||||
align-items: center;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.col-card:nth-child(1) {
|
||||
max-width: calc((3.2 * (100% / 8)));
|
||||
flex-basis: calc((3.2 * (100% / 8)));
|
||||
flex-grow: 1;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.col-card:nth-child(2),
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.col-card:nth-child(3) {
|
||||
max-width: calc(1.4 * (100% / 8));
|
||||
flex-basis: calc(1.4 * (100% / 8));
|
||||
}
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content .row-card {
|
||||
background-color: transparent;
|
||||
padding: 0px 3px;
|
||||
margin: 0;
|
||||
min-height: 5.68em;
|
||||
color: #333;
|
||||
}
|
||||
.page-content-card.team-score-board-card
|
||||
.card-img-overlay
|
||||
.row-card.row-head
|
||||
.col-card {
|
||||
background: linear-gradient(
|
||||
264deg,
|
||||
rgba(196, 36, 22, 1) 15%,
|
||||
rgba(219, 113, 3, 1) 81%
|
||||
) !important;
|
||||
border: 1px solid rgb(240, 140, 32);
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
padding: 8px 3px;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.page-content-card.team-score-board-card
|
||||
.card-img-overlay
|
||||
.row.row-card:nth-child(odd)
|
||||
> .col-card {
|
||||
color: #333;
|
||||
background: linear-gradient(
|
||||
0deg,
|
||||
rgba(101, 197, 239, 1) 15%,
|
||||
rgba(255, 255, 255, 1) 81%
|
||||
);
|
||||
}
|
||||
|
||||
.page-content-card.team-score-board-card
|
||||
.card-img-overlay
|
||||
.row.row-card:nth-child(even)
|
||||
> .col-card {
|
||||
background: linear-gradient(
|
||||
0deg,
|
||||
rgba(87, 107, 175, 1) 15%,
|
||||
rgba(255, 255, 255, 1) 81%
|
||||
);
|
||||
}
|
||||
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.row-card:last-child {
|
||||
min-height: 8.8em;
|
||||
color: #fffe78;
|
||||
|
||||
padding-top: 0.65em;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.row-card:last-child
|
||||
.col-card {
|
||||
font-weight: bold;
|
||||
background: linear-gradient(
|
||||
0deg,
|
||||
rgba(196, 36, 22, 1) 15%,
|
||||
rgba(219, 113, 3, 1) 81%
|
||||
);
|
||||
border: 1px solid rgb(240, 140, 32);
|
||||
color: #fffe78;
|
||||
}
|
||||
|
||||
/* Responsive styles */
|
||||
@media screen and (max-width: 767px) {
|
||||
.page-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.col-card {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay {
|
||||
padding: 0% 10px 30%;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card img {
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.page-content-card.score-board-page-content-card
|
||||
.card-img-overlay
|
||||
.row-card.row-head
|
||||
.col-card {
|
||||
padding: 5px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay .row-card {
|
||||
min-height: 2.75em;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card {
|
||||
font-size: 12px;
|
||||
padding: 4px 8px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
/** Team Score Page **/
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content {
|
||||
padding: 0% 10px 40%;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.team-logo-container {
|
||||
min-height: 12em;
|
||||
margin-bottom: 15px;
|
||||
padding: 20px;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.team-logo-container
|
||||
img {
|
||||
height: 80px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content .row-card {
|
||||
/* background-color: lightblue; */
|
||||
background-color: transparent;
|
||||
padding: 0px 3px;
|
||||
margin: 0;
|
||||
min-height: 2.95em;
|
||||
color: #333;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.row-card:last-child {
|
||||
min-height: 4em;
|
||||
}
|
||||
.page-content-card.team-score-board-card
|
||||
.card-img-overlay
|
||||
.row-card.row-head
|
||||
.col-card {
|
||||
font-size: 12px;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.col-card:nth-child(1) {
|
||||
max-width: calc((1.8 * (100% / 8)));
|
||||
flex-basis: calc((1.8 * (100% / 8)));
|
||||
}
|
||||
.page-content-card.team-score-board-card .card-img-overlay .col-card {
|
||||
font-size: 12px;
|
||||
padding: 5px 8px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
#team-score-board-content {
|
||||
overflow: scroll;
|
||||
}
|
||||
#team-score-board-content > div {
|
||||
min-width: 600px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Add & Edit Products"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
|
||||
<!-- third party css end -->
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card border-primary border mb-3" id="compatition_dashboard_{{$competition->id}}">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title text-primary">{{$competition->title}} dfgdgdfgdfgdfgdfgfd</h4>
|
||||
<!-- <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<th colspan="2">Team Name</th>
|
||||
<th>Avg Runs</th>
|
||||
<th>TM Count</th>
|
||||
<th>Total Runs</th>
|
||||
@foreach($competition->metrics as $metric)
|
||||
<th>{{$metric->name}}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($competition->participants as $participant)
|
||||
<tr>
|
||||
<td><h2>{{$participant->rank}}</h2></td>
|
||||
<td style="width: 36px;">
|
||||
<img src="{{$participant->team->image}}" alt="contact-img" title="contact-img" class="avatar-md" />
|
||||
</td>
|
||||
<td><h5 class="m-0 fw-normal">{{$participant->team->name}}</h5></td>
|
||||
<td>{{ number_format((float)$participant->avg_score, 2, '.', '') }}</td>
|
||||
<td>{{ $participant->users_count }}</td>
|
||||
<td>{{ is_object($participant->score) ? '-' : $participant->score }}</td>
|
||||
@foreach($competition->metrics as $metric)
|
||||
<td>{{ isset($participant->{$metric->id}) ? $participant->{$metric->id} : 0 }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,363 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Team Dashboard"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
</head>
|
||||
<body>
|
||||
<div class="container d-flex justify-content-center align-item-center px-0 px-md-3">
|
||||
<div class="page-container">
|
||||
<div class="card page-content-card team-score-board-card text-white border-0"
|
||||
style="
|
||||
background-image: linear-gradient(
|
||||
180deg,
|
||||
rgba(8, 32, 66, 1) 15%,
|
||||
rgba(49, 56, 108, 0.85) 48%,
|
||||
rgba(84, 69, 106, 0.2) 81%
|
||||
),
|
||||
url('/images/team4/team-page-bg.jpg');
|
||||
background-size: 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-position: bottom center;
|
||||
">
|
||||
<div class="company-logo d-flex justify-content-end">
|
||||
<img src="/images/team4/company-logo.png" class="img-fluid" alt="company-logo" />
|
||||
</div>
|
||||
<div id="team-score-board-page-content" class="card-img-overlay">
|
||||
<div class="team-logo-container"> <img src="{{$competition->team->image}}" class="card-img img-fluid" alt="team-logo" /> </div>
|
||||
<div id="team-score-board-content" class="team-score-board-content">
|
||||
<div>
|
||||
|
||||
<div class="row row-cols-8 row-card row-head d-flex flex-nowrap mb-2">
|
||||
<div class="col col-card d-flex justify-content-center text-wrap align-item-center"> TM Name </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > Conversion Dr Score </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > Consolidation Dr Score </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > Camps Score </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > Visit Score </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > MLC Adult Ach Score </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > MLC Kid Ach Score </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > Total </div>
|
||||
</div>
|
||||
|
||||
@foreach($competition->userscore as $participant)
|
||||
<div class="row row-cols-8 row-card d-flex flex-nowrap">
|
||||
<div class="col col-card d-flex justify-content-start text-wrap align-item-center" > {{$participant->name}} </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > {{ (isset($participant->{'1712380767-05a6d97a-4d83-41b2-8972-5116b7c5fd13'}) ? $participant->{'1712380767-05a6d97a-4d83-41b2-8972-5116b7c5fd13'} : 0) + (isset($participant->{'1712380767-05a6d97a-4d83-41b2-mlcadult-5116b7c5fd13'}) ? $participant->{'1712380767-05a6d97a-4d83-41b2-mlcadult-5116b7c5fd13'} : 0) }} </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > {{ (isset($participant->{'1712380852-948358bf-92df-49f2-ac84-7921ae8ac1e7'}) ? $participant->{'1712380852-948358bf-92df-49f2-ac84-7921ae8ac1e7'} : 0) + (isset($participant->{'1712380852-948358bf-92df-49f2-mlcadult-7921ae8ac1e7'}) ? $participant->{'1712380852-948358bf-92df-49f2-mlcadult-7921ae8ac1e7'} : 0) }} </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > {{ (isset($participant->{'1712380881-26db26d4-d528-4e61-ae92-3ef112ef2443'}) ? $participant->{'1712380881-26db26d4-d528-4e61-ae92-3ef112ef2443'} : 0) }} </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > {{ (isset($participant->{'1712380921-c326a211-ac16-4bb3-86b7-bfb25f3789fd'}) ? $participant->{'1712380921-c326a211-ac16-4bb3-86b7-bfb25f3789fd'} : 0) }} </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > {{ (isset($participant->{'1712294381-98d1e9f1-421d-4aba-bf95-c57406dac49f'}) ? $participant->{'1712294381-98d1e9f1-421d-4aba-bf95-c57406dac49f'} : 0) }} </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > {{ (isset($participant->{'1712294753-99c0b84e-f7c8-4c79-9e2d-720e34550bb4'}) ? $participant->{'1712294753-99c0b84e-f7c8-4c79-9e2d-720e34550bb4'} : 0) }} </div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center" > {{ is_object($participant->score) ? '-' : $participant->score }} </div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
padding-bottom:0px!important;
|
||||
}
|
||||
.page-container {
|
||||
width: 700px;
|
||||
height: auto;
|
||||
position: relative;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.company-logo {
|
||||
margin-bottom: 20px;
|
||||
padding-top: 40px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
.company-logo img {
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.col-card {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay {
|
||||
position: relative;
|
||||
background-color: rgba(250, 250, 250, 0);
|
||||
padding: 0px 15px 10px;
|
||||
padding-bottom: 20%;
|
||||
}
|
||||
.page-content-card .card-img-overlay .row-card {
|
||||
background-color: transparent;
|
||||
padding: 0px 2px;
|
||||
margin: 0;
|
||||
min-height: 4.2em;
|
||||
color: #fff;
|
||||
}
|
||||
.page-content-card .card-img-overlay .row.row-card:nth-child(odd) > .col-card {
|
||||
color: #333;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay .row.row-card:nth-child(even) > .col-card {
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(3, 150, 219, 1) 17%,
|
||||
rgba(44, 73, 153, 1) 68%
|
||||
);
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay .col-card {
|
||||
font-size: 14px;
|
||||
padding: 8px 8px;
|
||||
align-items: center;
|
||||
line-height: 1.2;
|
||||
border: 1px solid #96e9ff;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay .col-card img {
|
||||
width: auto;
|
||||
height: 25px;
|
||||
}
|
||||
.page-content-card.score-board-page-content-card
|
||||
.card-img-overlay
|
||||
.row-card.row-head
|
||||
.col-card {
|
||||
background: linear-gradient(0deg, rgba(2, 0, 36, 1) 31%, rgb(22 22 116) 82%);
|
||||
border: 1px solid #ccc;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
padding: 8px 5px;
|
||||
color: #fff;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card {
|
||||
max-width: calc((100% / 4));
|
||||
flex-basis: calc((100% / 4));
|
||||
flex-shrink: 1;
|
||||
}
|
||||
.page-content-card .card-img-overlay .row-card .col-card:nth-child(1) {
|
||||
font-weight: 600;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card:nth-child(3) {
|
||||
max-width: calc((3 * (100% / 4)));
|
||||
flex-basis: calc((3 * (100% / 4)));
|
||||
flex-grow: 1;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card:nth-child(4) {
|
||||
max-width: calc((100% / 4) + 20px);
|
||||
flex-basis: calc((100% / 4) + 20px);
|
||||
}
|
||||
|
||||
/** Team Score Page **/
|
||||
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content {
|
||||
background-color: rgba(250, 250, 250, 0);
|
||||
padding: 0px 25px 25%;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.team-logo-container {
|
||||
min-height: 22em;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
padding: 20px;
|
||||
border-radius: 15px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.team-logo-container
|
||||
img {
|
||||
height: 100%;
|
||||
width: auto;
|
||||
}
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content .col-card {
|
||||
max-width: calc((100% / 8));
|
||||
flex-basis: calc((100% / 8));
|
||||
flex-shrink: 1;
|
||||
align-items: center;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.col-card:nth-child(1) {
|
||||
max-width: calc((3.2 * (100% / 8)));
|
||||
flex-basis: calc((3.2 * (100% / 8)));
|
||||
flex-grow: 1;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.col-card:nth-child(2),
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.col-card:nth-child(3) {
|
||||
max-width: calc(1.4 * (100% / 8));
|
||||
flex-basis: calc(1.4 * (100% / 8));
|
||||
}
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content .row-card {
|
||||
background-color: transparent;
|
||||
padding: 0px 3px;
|
||||
margin: 0;
|
||||
min-height: 5.68em;
|
||||
color: #333;
|
||||
}
|
||||
.page-content-card.team-score-board-card
|
||||
.card-img-overlay
|
||||
.row-card.row-head
|
||||
.col-card {
|
||||
background: linear-gradient(
|
||||
264deg,
|
||||
rgba(196, 36, 22, 1) 15%,
|
||||
rgba(219, 113, 3, 1) 81%
|
||||
) !important;
|
||||
border: 1px solid rgb(240, 140, 32);
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
padding: 8px 3px;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.page-content-card.team-score-board-card
|
||||
.card-img-overlay
|
||||
.row.row-card:nth-child(odd)
|
||||
> .col-card {
|
||||
color: #333;
|
||||
background: linear-gradient(
|
||||
0deg,
|
||||
rgba(101, 197, 239, 1) 15%,
|
||||
rgba(255, 255, 255, 1) 81%
|
||||
);
|
||||
}
|
||||
|
||||
.page-content-card.team-score-board-card
|
||||
.card-img-overlay
|
||||
.row.row-card:nth-child(even)
|
||||
> .col-card {
|
||||
background: linear-gradient(
|
||||
0deg,
|
||||
rgba(87, 107, 175, 1) 15%,
|
||||
rgba(255, 255, 255, 1) 81%
|
||||
);
|
||||
}
|
||||
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.row-card:last-child {
|
||||
min-height: 8.8em;
|
||||
color: #fffe78;
|
||||
|
||||
padding-top: 0.65em;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.row-card:last-child
|
||||
.col-card {
|
||||
font-weight: bold;
|
||||
background: linear-gradient(
|
||||
0deg,
|
||||
rgba(196, 36, 22, 1) 15%,
|
||||
rgba(219, 113, 3, 1) 81%
|
||||
);
|
||||
border: 1px solid rgb(240, 140, 32);
|
||||
color: #fffe78;
|
||||
}
|
||||
|
||||
/* Responsive styles */
|
||||
@media screen and (max-width: 767px) {
|
||||
.page-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.col-card {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay {
|
||||
padding: 0% 10px 30%;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card img {
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.page-content-card.score-board-page-content-card
|
||||
.card-img-overlay
|
||||
.row-card.row-head
|
||||
.col-card {
|
||||
padding: 5px;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay .row-card {
|
||||
min-height: 2.75em;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card {
|
||||
font-size: 12px;
|
||||
padding: 4px 8px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
/** Team Score Page **/
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content {
|
||||
padding: 0% 10px 40%;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.team-logo-container {
|
||||
min-height: 12em;
|
||||
margin-bottom: 15px;
|
||||
padding: 20px;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.team-logo-container
|
||||
img {
|
||||
height: 80px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content .row-card {
|
||||
/* background-color: lightblue; */
|
||||
background-color: transparent;
|
||||
padding: 0px 3px;
|
||||
margin: 0;
|
||||
min-height: 2.95em;
|
||||
color: #333;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.row-card:last-child {
|
||||
min-height: 4em;
|
||||
}
|
||||
.page-content-card.team-score-board-card
|
||||
.card-img-overlay
|
||||
.row-card.row-head
|
||||
.col-card {
|
||||
font-size: 12px;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.col-card:nth-child(1) {
|
||||
max-width: calc((1.8 * (100% / 8)));
|
||||
flex-basis: calc((1.8 * (100% / 8)));
|
||||
}
|
||||
.page-content-card.team-score-board-card .card-img-overlay .col-card {
|
||||
font-size: 12px;
|
||||
padding: 5px 8px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
#team-score-board-content {
|
||||
overflow: scroll;
|
||||
}
|
||||
#team-score-board-content > div {
|
||||
min-width: 600px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,476 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Add & Edit Products"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
|
||||
<!-- third party css end -->
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<style>
|
||||
.page-container {
|
||||
max-width: 700px;
|
||||
height: auto;
|
||||
position: relative;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.company-logo {
|
||||
margin-bottom: 20px;
|
||||
padding-top: 40px;
|
||||
margin-right: 16px;
|
||||
margin-left: 18px;
|
||||
}
|
||||
.company-logo img {
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.col-card {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay {
|
||||
position: relative;
|
||||
background-color: rgba(250, 250, 250, 0);
|
||||
padding: 0px 15px 10px;
|
||||
padding-bottom: 20%;
|
||||
}
|
||||
.page-content-card .card-img-overlay .row-card {
|
||||
background-color: transparent;
|
||||
padding: 0px 2px;
|
||||
margin: 0;
|
||||
min-height: 4.2em;
|
||||
color: #fff;
|
||||
}
|
||||
.page-content-card .card-img-overlay .row.row-card:nth-child(odd) > .col-card {
|
||||
color: #333;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay .row.row-card:nth-child(even) > .col-card {
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(3, 150, 219, 1) 17%,
|
||||
rgba(44, 73, 153, 1) 68%
|
||||
);
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay .col-card {
|
||||
font-size: 16px;
|
||||
padding: 8px 8px;
|
||||
align-items: center;
|
||||
line-height: 1.2;
|
||||
border: 1px solid #96e9ff;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay .col-card img {
|
||||
width: auto;
|
||||
height: 25px;
|
||||
}
|
||||
.page-content-card.score-board-page-content-card
|
||||
.card-img-overlay
|
||||
.row-card.row-head
|
||||
.col-card {
|
||||
background: linear-gradient(0deg, rgba(2, 0, 36, 1) 31%, rgb(22 22 116) 82%);
|
||||
border: 1px solid #ccc;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
padding: 8px 5px;
|
||||
color: #fff;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card {
|
||||
max-width: calc((100% / 4));
|
||||
flex-basis: calc((100% / 4));
|
||||
flex-shrink: 1;
|
||||
}
|
||||
.page-content-card .card-img-overlay .row-card .col-card:nth-child(1) {
|
||||
font-weight: 600;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card:nth-child(3) {
|
||||
max-width: calc((3 * (100% / 4)));
|
||||
flex-basis: calc((3 * (100% / 4)));
|
||||
flex-grow: 1;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card:nth-child(4) {
|
||||
max-width: calc((100% / 4) + 20px);
|
||||
flex-basis: calc((100% / 4) + 20px);
|
||||
}
|
||||
|
||||
/** Team Score Page **/
|
||||
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content {
|
||||
background-color: rgba(250, 250, 250, 0);
|
||||
padding: 0px 25px 25%;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.team-logo-container {
|
||||
min-height: 22em;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
padding: 20px;
|
||||
border-radius: 15px;
|
||||
background-color: #fff;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.team-logo-container
|
||||
img {
|
||||
height: 100%;
|
||||
width: auto;
|
||||
/* max-width: 250px; */
|
||||
max-height: 160px;
|
||||
object-fit: contain;
|
||||
object-position: center;
|
||||
}
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content .col-card {
|
||||
max-width: calc((100% / 8));
|
||||
flex-basis: calc((100% / 8));
|
||||
flex-shrink: 1;
|
||||
align-items: center;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.col-card:nth-child(1) {
|
||||
max-width: calc((3.2 * (100% / 8)));
|
||||
flex-basis: calc((3.2 * (100% / 8)));
|
||||
flex-grow: 1;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.col-card:nth-child(2),
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.col-card:nth-child(3) {
|
||||
max-width: calc(1.4 * (100% / 8));
|
||||
flex-basis: calc(1.4 * (100% / 8));
|
||||
}
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content .row-card {
|
||||
background-color: transparent;
|
||||
padding: 0px 3px;
|
||||
margin: 0;
|
||||
min-height: 5.68em;
|
||||
color: #333;
|
||||
}
|
||||
.page-content-card.team-score-board-card
|
||||
.card-img-overlay
|
||||
.row-card.row-head
|
||||
.col-card {
|
||||
background: linear-gradient(
|
||||
264deg,
|
||||
rgba(196, 36, 22, 1) 15%,
|
||||
rgba(219, 113, 3, 1) 81%
|
||||
) !important;
|
||||
border: 1px solid rgb(240, 140, 32);
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
padding: 8px 3px;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.page-content-card.team-score-board-card
|
||||
.card-img-overlay
|
||||
.row.row-card:nth-child(odd)
|
||||
> .col-card {
|
||||
color: #333;
|
||||
background: linear-gradient(
|
||||
0deg,
|
||||
rgba(101, 197, 239, 1) 15%,
|
||||
rgba(255, 255, 255, 1) 81%
|
||||
);
|
||||
}
|
||||
|
||||
.page-content-card.team-score-board-card
|
||||
.card-img-overlay
|
||||
.row.row-card:nth-child(even)
|
||||
> .col-card {
|
||||
background: linear-gradient(
|
||||
0deg,
|
||||
rgba(87, 107, 175, 1) 15%,
|
||||
rgba(255, 255, 255, 1) 81%
|
||||
);
|
||||
}
|
||||
|
||||
/* .page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.row-card:last-child {
|
||||
min-height: 8.8em;
|
||||
color: #fffe78;
|
||||
|
||||
padding-top: 0.65em;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.row-card:last-child
|
||||
.col-card {
|
||||
font-weight: bold;
|
||||
background: linear-gradient(
|
||||
0deg,
|
||||
rgba(196, 36, 22, 1) 15%,
|
||||
rgba(219, 113, 3, 1) 81%
|
||||
);
|
||||
border: 1px solid rgb(240, 140, 32);
|
||||
color: #fffe78;
|
||||
} */
|
||||
|
||||
/* Responsive styles */
|
||||
@media screen and (max-width: 767px) {
|
||||
.page-container {
|
||||
/* width: 360px; */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.col-card {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay {
|
||||
padding: 0% 10px 30%;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card img {
|
||||
object-fit: contain;
|
||||
width: auto;
|
||||
height: auto;
|
||||
max-width: 35px;
|
||||
max-height: 20px;
|
||||
object-position: center;
|
||||
}
|
||||
|
||||
.page-content-card.score-board-page-content-card
|
||||
.card-img-overlay
|
||||
.row-card.row-head
|
||||
.col-card {
|
||||
padding: 5px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay .row-card {
|
||||
min-height: 2.75em;
|
||||
}
|
||||
.page-content-card .card-img-overlay .col-card {
|
||||
font-size: 13px;
|
||||
padding: 4px 8px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
/** Team Score Page **/
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content {
|
||||
padding: 0% 10px 40%;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.team-logo-container {
|
||||
min-height: 12em;
|
||||
margin-bottom: 15px;
|
||||
padding: 20px;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.team-logo-container
|
||||
img {
|
||||
height: 80px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.page-content-card .card-img-overlay#team-score-board-page-content .row-card {
|
||||
/* background-color: lightblue; */
|
||||
background-color: transparent;
|
||||
padding: 0px 3px;
|
||||
margin: 0;
|
||||
min-height: 2.95em;
|
||||
color: #333;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.row-card:last-child {
|
||||
min-height: 4em;
|
||||
}
|
||||
.page-content-card.team-score-board-card
|
||||
.card-img-overlay
|
||||
.row-card.row-head
|
||||
.col-card {
|
||||
font-size: 12px;
|
||||
}
|
||||
.page-content-card
|
||||
.card-img-overlay#team-score-board-page-content
|
||||
.col-card:nth-child(1) {
|
||||
max-width: calc((1.8 * (100% / 8)));
|
||||
flex-basis: calc((1.8 * (100% / 8)));
|
||||
}
|
||||
.page-content-card.team-score-board-card .card-img-overlay .col-card {
|
||||
font-size: 13px;
|
||||
padding: 5px 8px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
#team-score-board-content {
|
||||
overflow: scroll;
|
||||
}
|
||||
#team-score-board-content > div {
|
||||
min-width: 600px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
<div class="card">
|
||||
<div class="card-body p-1 p-sm-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card border-primary border mb-3" id="compatition_team_dashboard_{{$competition->id}}">
|
||||
<div class="card-header"><i class="mdi mdi-calendar-month-outline font-18 text-success me-1"></i> {{date("d M Y h:iA", strtotime($competition->validity_start))}} - {{date("d M Y h:iA", strtotime($competition->validity_end)-1 )}}</div>
|
||||
<div class="card-body p-1 p-sm-3">
|
||||
<h4 class="card-title text-primary">{{$competition->title}}</h4>
|
||||
<button class="btn btn-success btn-sm rounded-pill dlscreenshot mb-2"
|
||||
target="contest1">
|
||||
Download PNG
|
||||
</button>
|
||||
|
||||
<div id="contest1" class="page-container">
|
||||
<div
|
||||
class="card page-content-card team-score-board-card text-white border-0"
|
||||
style="background-image: linear-gradient(180deg,rgba(8, 32, 66, 1) 15%,rgba(49, 56, 108, 0.85) 48%,rgba(84, 69, 106, 0.2) 81%), url(/images/team4/team-page-bg.jpg);background-size: 100%;background-repeat: no-repeat;background-position: bottom center;"
|
||||
>
|
||||
<div class="company-logo d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<h4 class="text-warning mb-0 mt-0">{{$competition->title}}</h4>
|
||||
</div>
|
||||
<img src="/images/team4/company-logo.png" class="img-fluid" alt="company-logo" />
|
||||
</div>
|
||||
<div id="team-score-board-page-content" class="card-img-overlay">
|
||||
@php
|
||||
$participant_team = ($competition->team);
|
||||
$logo_img = $participant_team->image;
|
||||
@endphp
|
||||
<div class="team-logo-container">
|
||||
<img src="{{$logo_img}}" class="img-fluid mx-auto" alt="{{$participant_team->name}} logo" />
|
||||
</div>
|
||||
<div id="team-score-board-content" class="team-score-board-content">
|
||||
<div>
|
||||
<div class="row row-cols-8 row-card row-head d-flex flex-nowrap mb-2">
|
||||
<div class="col col-card d-flex justify-content-center text-wrap align-item-center">
|
||||
TM Name
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
Conversion Dr Score
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
Consolidation Dr Score
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
Camps Score
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
Visit Score
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
MLC Adult Ach Score
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
MLC Kid Ach Score
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
Total
|
||||
</div>
|
||||
</div>
|
||||
@foreach($competition->userscore as $participant)
|
||||
<div class="row row-cols-8 row-card d-flex flex-nowrap">
|
||||
<div class="col col-card d-flex justify-content-start text-wrap align-item-center">
|
||||
{{$participant->name}}
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
{{ (isset($participant->{'1712380767-05a6d97a-4d83-41b2-mlcadult-5116b7c5fd13'}) ? $participant->{'1712380767-05a6d97a-4d83-41b2-mlcadult-5116b7c5fd13'} : 0) + (isset($participant->{'1712380767-05a6d97a-4d83-41b2-8972-5116b7c5fd13'}) ? $participant->{'1712380767-05a6d97a-4d83-41b2-8972-5116b7c5fd13'} : 0) }}
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
{{ (isset($participant->{'1712380852-948358bf-92df-49f2-ac84-7921ae8ac1e7'}) ? $participant->{'1712380852-948358bf-92df-49f2-ac84-7921ae8ac1e7'} : 0) + (isset($participant->{'1712380852-948358bf-92df-49f2-mlcadult-7921ae8ac1e7'}) ? $participant->{'1712380852-948358bf-92df-49f2-mlcadult-7921ae8ac1e7'} : 0) }}
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
{{ (isset($participant->{'1712380881-26db26d4-d528-4e61-ae92-3ef112ef2443'}) ? $participant->{'1712380881-26db26d4-d528-4e61-ae92-3ef112ef2443'} : 0) }}
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
{{ (isset($participant->{'1712380921-c326a211-ac16-4bb3-86b7-bfb25f3789fd'}) ? $participant->{'1712380921-c326a211-ac16-4bb3-86b7-bfb25f3789fd'} : 0) }}
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
{{ (isset($participant->{'1712294381-98d1e9f1-421d-4aba-bf95-c57406dac49f'}) ? $participant->{'1712294381-98d1e9f1-421d-4aba-bf95-c57406dac49f'} : 0) }}
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
{{ (isset($participant->{'1712294753-99c0b84e-f7c8-4c79-9e2d-720e34550bb4'}) ? $participant->{'1712294753-99c0b84e-f7c8-4c79-9e2d-720e34550bb4'} : 0) }}
|
||||
</div>
|
||||
<div class="col col-card d-flex justify-content-center align-item-center">
|
||||
{{ is_object($participant->score) ? '-' : $participant->score }}
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="previewImg2" class="d-none"></div>
|
||||
|
||||
<!-- <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> -->
|
||||
<!-- <div class="table-responsive">
|
||||
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<th>User Name</th>
|
||||
<th>Total Runs</th>
|
||||
@foreach($competition->metrics as $metric)
|
||||
<th>{{$metric->name}}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($competition->userscore as $participant)
|
||||
<tr>
|
||||
<td><h2>{{$participant->rank}}</h2></td>
|
||||
<td><h5 class="m-0 fw-normal">{{$participant->name}}</h5></td>
|
||||
<td>{{ is_object($participant->score) ? '-' : $participant->score }}</td>
|
||||
@foreach($competition->metrics as $metric)
|
||||
<td>{{ isset($participant->{$metric->id}) ? $participant->{$metric->id} : 0 }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<script src="{{asset('assets/js/html2canvas.min.js')}}" integrity="sha512-BNaRQnYJYiPSqHHDb58B0yaPfCu+Wgds8Gp/gU33kqBtgNS4tSPHuGibyoeqMV/TJlSKda6FXzoEyYGjTe+vXA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('.dlscreenshot').click(function(){
|
||||
html2canvas(document.getElementById( $(this).attr('target') ), {
|
||||
allowTaint: true, useCORS: true
|
||||
}).then(function (canvas) {
|
||||
var anchorTag = document.createElement("a");
|
||||
document.body.appendChild(anchorTag);
|
||||
document.getElementById("previewImg2").appendChild(canvas);
|
||||
anchorTag.download = "filename.jpg";
|
||||
anchorTag.href = canvas.toDataURL();
|
||||
anchorTag.target = '_blank';
|
||||
anchorTag.click();
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Team Dashboard"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
</head>
|
||||
<body>
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card border-primary border mb-3" id="compatition_team_dashboard_{{$competition->id}}">
|
||||
<div class="card-header"><i class="mdi mdi-calendar-month-outline font-18 text-success me-1"></i> {{date("d M Y h:iA", strtotime($competition->validity_start))}} - {{date("d M Y h:iA", strtotime($competition->validity_end)-1 )}}</div>
|
||||
<div class="card-body">
|
||||
<h4 class="card-title text-primary">{{$competition->title}}</h4>
|
||||
<!-- <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<th>User Name</th>
|
||||
<th>Total Runs</th>
|
||||
@foreach($competition->metrics as $metric)
|
||||
<th>{{$metric->name}}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($competition->userscore as $participant)
|
||||
<tr>
|
||||
<td><h2>{{$participant->rank}}</h2></td>
|
||||
<td><h5 class="m-0 fw-normal">{{$participant->name}}</h5></td>
|
||||
<td>{{ is_object($participant->score) ? '-' : $participant->score }}</td>
|
||||
@foreach($competition->metrics as $metric)
|
||||
<td>{{ isset($participant->{$metric->id}) ? $participant->{$metric->id} : 0 }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Add & Edit Products"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
|
||||
<!-- third party css end -->
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card border-primary border mb-3" id="compatition_team_dashboard_{{$competition->id}}">
|
||||
<div class="card-header"><i class="mdi mdi-calendar-month-outline font-18 text-success me-1"></i> {{date("d M Y h:iA", strtotime($competition->validity_start))}} - {{date("d M Y h:iA", strtotime($competition->validity_end)-1 )}}</div>
|
||||
<div class="card-body">
|
||||
<h4 class="card-title text-primary">{{$competition->title}}</h4>
|
||||
<!-- <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> -->
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<th>User Name</th>
|
||||
<th>Total Runs</th>
|
||||
@foreach($competition->metrics as $metric)
|
||||
<th>{{$metric->name}}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($competition->userscore as $participant)
|
||||
<tr>
|
||||
<td><h2>{{$participant->rank}}</h2></td>
|
||||
<td><h5 class="m-0 fw-normal">{{$participant->name}}</h5></td>
|
||||
<td>{{ is_object($participant->score) ? '-' : $participant->score }}</td>
|
||||
@foreach($competition->metrics as $metric)
|
||||
<td>{{ isset($participant->{$metric->id}) ? $participant->{$metric->id} : 0 }}</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Datatables"])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{asset('assets/libs/datatables/datatables.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="https://cdn.jsdelivr.net/npm/ag-grid-community/styles/ag-grid.css" rel="stylesheet" type="text/css" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/ag-grid-community/styles/ag-theme-alpine.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-md-6 p-2">
|
||||
<h4 class="page-title">{{$title}} Management</h4>
|
||||
</div>
|
||||
<div class="col-md-6 p-2">
|
||||
@if(isset($buttons))
|
||||
@foreach($buttons as $button)
|
||||
<a href="{{$button['link']}}" class="btn btn-{{$button['title']=='Add New'?'success':'dark'}} waves-effect waves-light float-end me-2" id="btn-{{strtolower(str_replace(' ', '-', $button['title']))}}">{{$button['title']}}</a>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div id="myGrid" class="ag-theme-alpine"></div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
<style>
|
||||
.ag-theme-alpine {
|
||||
height:calc(100vh - 200px)
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<!-- third party js -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/ag-grid-community/dist/ag-grid-community.min.noStyle.js"></script>
|
||||
<script type="text/javascript">
|
||||
var fields = {!! json_encode($fields) !!}
|
||||
class CustomTextElements {
|
||||
eGui;
|
||||
|
||||
init(params) {
|
||||
console.log(params)
|
||||
this.eGui = document.createElement('div');
|
||||
//this.eGui.classList.add('custom-element');
|
||||
this.eGui.innerHTML = `<input name="${params.colDef.field}" value="${params.value ? params.value : ''}" class="form-control form-control-sm mt-1"/>`;
|
||||
}
|
||||
|
||||
getGui() {
|
||||
return this.eGui;
|
||||
}
|
||||
|
||||
refresh(params) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class CustomSelectElements {
|
||||
eGui;
|
||||
|
||||
init(params) {
|
||||
console.log(params)
|
||||
this.eGui = document.createElement('div');
|
||||
//this.eGui.classList.add('custom-element');
|
||||
let text = `<select name="${params.colDef.field}" value="${params.value ? params.value : ''}" class="form-control form-control-sm mt-1"/>`
|
||||
text = text + `<option value="">-- Select --</option>`;
|
||||
for(let option of fields[params.colDef.field].options) {
|
||||
text = text + `<option value="${option.value}" ${params.value==option.value ? 'selected' : ''}>${option.display}</option>`;
|
||||
}
|
||||
text = text + `<select>`
|
||||
this.eGui.innerHTML = text;
|
||||
}
|
||||
|
||||
getGui() {
|
||||
return this.eGui;
|
||||
}
|
||||
|
||||
refresh(params) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function cellEditorSelector(params) {
|
||||
return {
|
||||
component: 'agSelectCellEditor',
|
||||
params: {
|
||||
values: ['Male', 'Female'],
|
||||
},
|
||||
popup: true,
|
||||
};
|
||||
}
|
||||
|
||||
// Function to demonstrate calling grid's API
|
||||
function deselect(){
|
||||
gridOptions.api.deselectAll()
|
||||
}
|
||||
|
||||
// Grid Options are properties passed to the grid
|
||||
const gridOptions = {
|
||||
components: {
|
||||
CustomTextElements: CustomTextElements,
|
||||
CustomSelectElements: CustomSelectElements
|
||||
},
|
||||
pagination: true, // Enable client-side pagination
|
||||
paginationPageSize: 10, // Number of rows per page
|
||||
cacheBlockSize: 10,
|
||||
// each entry here represents one column
|
||||
columnDefs: [
|
||||
@foreach($fields as $field => $props)
|
||||
@if($props['editable'])
|
||||
{ "field": "{{$field}}", "headerName": '{{$props['title']}}',editable: true, cellEditorSelector: cellEditorSelector, },
|
||||
@else
|
||||
{ "field": "{{$field}}", "headerName": '{{$props['title']}}' },
|
||||
@endif
|
||||
@endforeach
|
||||
],
|
||||
|
||||
// default col def properties get applied to all columns
|
||||
defaultColDef: {sortable: true, filter: true, singleClickEdit: true},
|
||||
|
||||
rowSelection: 'multiple', // allow rows to be selected
|
||||
animateRows: true, // have rows animate to new positions when sorted
|
||||
|
||||
// example event handler
|
||||
onCellClicked: params => {
|
||||
console.log('cell was clicked', params)
|
||||
}
|
||||
};
|
||||
|
||||
// get div to host the grid
|
||||
const eGridDiv = document.getElementById("myGrid");
|
||||
// new grid instance, passing in the hosting DIV and Grid Options
|
||||
new agGrid.Grid(eGridDiv, gridOptions);
|
||||
|
||||
// Fetch data from server
|
||||
fetch("{{$base_url}}/aggridajaxlist")
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
// load fetched data into grid
|
||||
console.log(data)
|
||||
gridOptions.api.setRowData(data);
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -56,7 +56,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
|
||||
|
|
@ -78,11 +78,11 @@
|
|||
@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':'' }}>
|
||||
<input class="form-check-input" type="radio" name="{{$field}}" id="field-{{$field}}-yes" value="yes" {{$mode=='edit' && isset($item->{$field}) && $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':''}}>
|
||||
<input class="form-check-input" type="radio" name="{{$field}}" id="field-{{$field}}-no" value="no" {{$mode=='edit' && isset($item->{$field}) && $item->{$field} == 'no' ? 'checked':''}}>
|
||||
<label class="form-check-label" for="field-{{$field}}-no">No</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,440 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Contacts & Members Listing"])
|
||||
|
||||
@section('content')
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<ol class="breadcrumb m-0">
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0);">UBold</a></li>
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Apps</a></li>
|
||||
<li class="breadcrumb-item active">Contacts</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Contacts</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row justify-content-between">
|
||||
<div class="col-md-8">
|
||||
<form class="d-flex flex-wrap align-items-center">
|
||||
<label for="inputPassword2" class="visually-hidden">Search</label>
|
||||
<div class="me-3">
|
||||
<input type="search" class="form-control my-1 my-md-0" id="inputPassword2" placeholder="Search...">
|
||||
</div>
|
||||
<label for="status-select" class="me-2">Sort By</label>
|
||||
<div class="me-sm-3">
|
||||
<select class="form-select my-1 my-md-0" id="status-select">
|
||||
<option selected="">All</option>
|
||||
<option value="1">Name</option>
|
||||
<option value="2">Post</option>
|
||||
<option value="3">Followers</option>
|
||||
<option value="4">Followings</option>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="text-md-end mt-3 mt-md-0">
|
||||
<button type="button" class="btn btn-success waves-effect waves-light me-1"><i class="mdi mdi-cog"></i></button>
|
||||
<button type="button" class="btn btn-danger waves-effect waves-light" data-bs-toggle="modal" data-bs-target="#custom-modal"><i class="mdi mdi-plus-circle me-1"></i> Add New</button>
|
||||
</div>
|
||||
</div><!-- end col-->
|
||||
</div> <!-- end row -->
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<div class="text-center card">
|
||||
<div class="card-body">
|
||||
<div class="pt-2 pb-2">
|
||||
<img src="{{asset('assets/images/users/user-3.jpg')}}" class="rounded-circle img-thumbnail avatar-xl" alt="profile-image">
|
||||
|
||||
<h4 class="mt-3"><a href="extras-profile.html" class="text-dark">Freddie J. Plourde</a></h4>
|
||||
<p class="text-muted">@Founder <span> | </span> <span> <a href="#" class="text-pink">websitename.com</a> </span></p>
|
||||
|
||||
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light">Message</button>
|
||||
<button type="button" class="btn btn-light btn-sm waves-effect">Follow</button>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$2563</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Post</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$29.8k</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followers</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>1125</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followings</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end row-->
|
||||
|
||||
</div> <!-- end .padding -->
|
||||
</div>
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col -->
|
||||
|
||||
<div class="col-lg-4">
|
||||
<div class="text-center card">
|
||||
<div class="card-body">
|
||||
<div class="pt-2 pb-2">
|
||||
<img src="{{asset('assets/images/users/user-4.jpg')}}" class="rounded-circle img-thumbnail avatar-xl" alt="profile-image">
|
||||
|
||||
<h4 class="mt-3"><a href="extras-profile.html" class="text-dark">Christopher Gallardo</a></h4>
|
||||
<p class="text-muted">@Webdesigner <span> | </span> <span> <a href="#" class="text-pink">abcweb.com</a> </span></p>
|
||||
|
||||
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light">Message</button>
|
||||
<button type="button" class="btn btn-light btn-sm waves-effect">Follow</button>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$12.7k</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Post</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$65.3k</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followers</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>2184</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followings</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end row-->
|
||||
|
||||
</div> <!-- end .padding -->
|
||||
</div>
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col -->
|
||||
|
||||
<div class="col-lg-4">
|
||||
<div class="text-center card">
|
||||
<div class="card-body">
|
||||
<div class="pt-2 pb-2">
|
||||
<img src="{{asset('assets/images/users/user-5.jpg')}}" class="rounded-circle img-thumbnail avatar-xl" alt="profile-image">
|
||||
|
||||
<h4 class="mt-3"><a href="extras-profile.html" class="text-dark">Joseph M. Rohr</a></h4>
|
||||
<p class="text-muted">@Webdesigner <span> | </span> <span> <a href="#" class="text-pink">mywebs.com</a> </span></p>
|
||||
|
||||
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light">Message</button>
|
||||
<button type="button" class="btn btn-light btn-sm waves-effect">Follow</button>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$1021</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Post</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$25.6k</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followers</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>325</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followings</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end row-->
|
||||
|
||||
</div> <!-- end .padding -->
|
||||
</div>
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<div class="text-center card">
|
||||
<div class="card-body">
|
||||
<div class="pt-2 pb-2">
|
||||
<img src="{{asset('assets/images/users/user-6.jpg')}}" class="rounded-circle img-thumbnail avatar-xl" alt="profile-image">
|
||||
|
||||
<h4 class="mt-3"><a href="extras-profile.html" class="text-dark">Mark K. Horne</a></h4>
|
||||
<p class="text-muted">@Director <span> | </span> <span> <a href="#" class="text-pink">profileq.com</a> </span></p>
|
||||
|
||||
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light">Message</button>
|
||||
<button type="button" class="btn btn-light btn-sm waves-effect">Follow</button>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$7845</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Post</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$16.7k</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followers</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>5846</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followings</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end row-->
|
||||
|
||||
</div> <!-- end .padding -->
|
||||
</div>
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col -->
|
||||
|
||||
<div class="col-lg-4">
|
||||
<div class="text-center card">
|
||||
<div class="card-body">
|
||||
<div class="pt-2 pb-2">
|
||||
<img src="{{asset('assets/images/users/user-7.jpg')}}" class="rounded-circle img-thumbnail avatar-xl" alt="profile-image">
|
||||
|
||||
<h4 class="mt-3"><a href="extras-profile.html" class="text-dark">James M. Fonville</a></h4>
|
||||
<p class="text-muted">@Manager <span> | </span> <span> <a href="#" class="text-pink">coolweb.com</a> </span></p>
|
||||
|
||||
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light">Message</button>
|
||||
<button type="button" class="btn btn-light btn-sm waves-effect">Follow</button>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$4851</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Post</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$10.2k</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followers</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>895</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followings</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end row-->
|
||||
|
||||
</div> <!-- end .padding -->
|
||||
</div>
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col -->
|
||||
|
||||
<div class="col-lg-4">
|
||||
<div class="text-center card">
|
||||
<div class="card-body">
|
||||
<div class="pt-2 pb-2">
|
||||
<img src="{{asset('assets/images/users/user-8.jpg')}}" class="rounded-circle img-thumbnail avatar-xl" alt="profile-image">
|
||||
|
||||
<h4 class="mt-3"><a href="extras-profile.html" class="text-dark">Jade M. Walker</a></h4>
|
||||
<p class="text-muted">@Programmer <span> | </span> <span> <a href="#" class="text-pink">supported.com</a> </span></p>
|
||||
|
||||
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light">Message</button>
|
||||
<button type="button" class="btn btn-light btn-sm waves-effect">Follow</button>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$4560</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Post</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$15.3k</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followers</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>742</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followings</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end row-->
|
||||
|
||||
</div> <!-- end .padding -->
|
||||
</div>
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<div class="text-center card">
|
||||
<div class="card-body">
|
||||
<div class="pt-2 pb-2">
|
||||
<img src="{{asset('assets/images/users/user-2.jpg')}}" class="rounded-circle img-thumbnail avatar-xl" alt="profile-image">
|
||||
|
||||
<h4 class="mt-3"><a href="extras-profile.html" class="text-dark">Marie E. Tate</a></h4>
|
||||
<p class="text-muted">@Webdeveloper <span> | </span> <span> <a href="#" class="text-pink">website.com</a> </span></p>
|
||||
|
||||
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light">Message</button>
|
||||
<button type="button" class="btn btn-light btn-sm waves-effect">Follow</button>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$3520</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Post</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$4587</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followers</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>423</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followings</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end row-->
|
||||
|
||||
</div> <!-- end .padding -->
|
||||
</div>
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col -->
|
||||
|
||||
<div class="col-lg-4">
|
||||
<div class="text-center card">
|
||||
<div class="card-body">
|
||||
<div class="pt-2 pb-2">
|
||||
<img src="{{asset('assets/images/users/user-9.jpg')}}" class="rounded-circle img-thumbnail avatar-xl" alt="profile-image">
|
||||
|
||||
<h4 class="mt-3"><a href="extras-profile.html" class="text-dark">Elyse D. Davidson</a></h4>
|
||||
<p class="text-muted">@Webdesigner <span> | </span> <span> <a href="#" class="text-pink">dumosite.com</a> </span></p>
|
||||
|
||||
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light">Message</button>
|
||||
<button type="button" class="btn btn-light btn-sm waves-effect">Follow</button>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$7851</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Post</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$16.8k</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followers</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>1036</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followings</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end row-->
|
||||
|
||||
</div> <!-- end .padding -->
|
||||
</div>
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col -->
|
||||
|
||||
<div class="col-lg-4">
|
||||
<div class="text-center card">
|
||||
<div class="card-body">
|
||||
<div class="pt-2 pb-2">
|
||||
<img src="{{asset('assets/images/users/user-10.jpg')}}" class="rounded-circle img-thumbnail avatar-xl" alt="profile-image">
|
||||
|
||||
<h4 class="mt-3"><a href="extras-profile.html" class="text-dark">Sarah E. Goin</a></h4>
|
||||
<p class="text-muted">@Manager <span> | </span> <span> <a href="#" class="text-pink">webion.com</a> </span></p>
|
||||
|
||||
<button type="button" class="btn btn-primary btn-sm waves-effect waves-light">Message</button>
|
||||
<button type="button" class="btn btn-light btn-sm waves-effect">Follow</button>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$7421</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Post</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>$29.5k</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followers</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="mt-3">
|
||||
<h4>11k</h4>
|
||||
<p class="mb-0 text-muted text-truncate">Followings</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end row-->
|
||||
|
||||
</div> <!-- end .padding -->
|
||||
</div>
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="text-end">
|
||||
<ul class="pagination pagination-rounded justify-content-end">
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="javascript: void(0);" aria-label="Previous">
|
||||
<span aria-hidden="true">«</span>
|
||||
<span class="visually-hidden">Previous</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="page-item active"><a class="page-link" href="javascript: void(0);">1</a></li>
|
||||
<li class="page-item"><a class="page-link" href="javascript: void(0);">2</a></li>
|
||||
<li class="page-item"><a class="page-link" href="javascript: void(0);">3</a></li>
|
||||
<li class="page-item"><a class="page-link" href="javascript: void(0);">4</a></li>
|
||||
<li class="page-item"><a class="page-link" href="javascript: void(0);">5</a></li>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="javascript: void(0);" aria-label="Next">
|
||||
<span aria-hidden="true">»</span>
|
||||
<span class="visually-hidden">Next</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- container -->
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,189 @@
|
|||
@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>
|
||||
@if($mode=='edit')
|
||||
@if($item->is_published == "no")
|
||||
<a href="{{$base_url}}/status?action=publish&id={{$item->id}}" class="btn btn-info waves-effect waves-light">Publish Contest</a>
|
||||
@elseif($item->is_published == "yes" && $item->is_result_published == "no")
|
||||
<a href="{{$base_url}}/status?action=publish_result&id={{$item->id}}" class="btn btn-info waves-effect waves-light">Publish Results</a>
|
||||
<a href="{{$base_url}}/status?action=unpublish&id={{$item->id}}" class="btn btn-danger waves-effect waves-light">Unpublish Contest</a>
|
||||
@elseif($item->is_published == "yes" && $item->is_result_published == "yes")
|
||||
<a href="{{$base_url}}/status?action=unpublish_result&id={{$item->id}}" class="btn btn-danger waves-effect waves-light">Unpublish Results</a>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
</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' && isset($item->{$field}) && $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' && isset($item->{$field}) && $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 csv" />
|
||||
<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>
|
||||
</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,154 @@
|
|||
@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">Manage Metrics for Contest: {{$item->name}}</h4>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="float-end">
|
||||
<a href="/detailingcontests" 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 class="col-md-12 mb-3">
|
||||
<label for="" class="form-label">Metrics Mapping Auth Key</label>
|
||||
<input type="text" class="form-control" id="field-metric_mapping_auth_key" name="metric_mapping_auth_key" value="{{isset($item->metric_mapping_auth_key) ? $item->metric_mapping_auth_key : ''}}" required>
|
||||
</div>
|
||||
<div class="col-md-12 mb-3">
|
||||
<label for="" class="form-label">Metrics Mapping</label>
|
||||
<div><button type="button" class="btn btn-info btn-xs float-end" id="btn-add-mapping">Add Mapping</button></div>
|
||||
<table class="table mb-0" id="table-metrics">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Metric</th>
|
||||
<th>Parameter</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if(isset($item->metrics))
|
||||
@foreach($item->metrics as $map)
|
||||
<tr>
|
||||
<td>
|
||||
<select class="form-control" name="metric[]" required>
|
||||
<option value=""> -- Select Metric -- </option>
|
||||
@foreach($metrics as $k => $v)
|
||||
<option value="{{$k}}" {{$map->metric == $k ? 'selected="selected"':''}}>{{$v}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select name="parameter[]" class="form-control parameterdropdown">
|
||||
<option value=""> -- Select Parameter -- </option>
|
||||
@foreach($parameters as $k => $v)
|
||||
<option value="{{$k}}" {{$map->parameter == $k ? 'selected="selected"':''}}>{{$v}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</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
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="float-end">
|
||||
<a href="/detailingcontests" 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>
|
||||
</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"
|
||||
});
|
||||
|
||||
$('#btn-add-mapping').click(function(){
|
||||
$('table#table-metrics tbody').append(`<tr>
|
||||
<td>
|
||||
<select class="form-control" name="metric[]" required>
|
||||
<option value=""> -- Select Metric -- </option>
|
||||
@foreach($metrics as $k => $v)
|
||||
<option value="{{$k}}">{{$v}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</td>
|
||||
<td><select name="parameter[]" class="form-control" required>
|
||||
<option value=""> -- Select Parameter -- </option>
|
||||
@foreach($parameters as $k => $v)
|
||||
<option value="{{$k}}">{{$v}}</option>
|
||||
@endforeach
|
||||
</select></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();
|
||||
});
|
||||
$('.cust-date').unbind();
|
||||
$('.cust-date').flatpickr();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,292 @@
|
|||
@extends('layouts.vertical', ['page_title' => 'Datatables'])
|
||||
|
||||
@section('css')
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}" />
|
||||
<style type="text/css">
|
||||
.ag-theme-alpine {
|
||||
--ag-header-column-separator-display: block;
|
||||
--ag-header-column-separator-height: 20%;
|
||||
--ag-header-column-separator-width: 1px;
|
||||
--ag-header-column-separator-color: rgb(0, 0, 0);
|
||||
}
|
||||
#myGrid {
|
||||
height: calc(100vh - 200px);
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
|
||||
<!-- end page title -->
|
||||
@if (session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if (session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row justify-content-between">
|
||||
<div class="col-auto filter-section">
|
||||
<h4 class="page-title">Detailing Contest Report</h4>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="text-lg-end my-1 my-lg-0">
|
||||
<button id="btn-export" class="btn btn-sm btn-primary" style="margin-bottom: 5px; font-weight: bold"> Export to Excel </button>
|
||||
</div>
|
||||
</div><!-- end col-->
|
||||
</div> <!-- end row -->
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div id="myGrid" style="" class="ag-theme-alpine"></div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
|
||||
|
||||
|
||||
<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%;
|
||||
}
|
||||
|
||||
.img-thumbnail {
|
||||
max-width: 100px
|
||||
}
|
||||
|
||||
.filter-section .form-select {
|
||||
max-width: 150px
|
||||
}
|
||||
|
||||
.filter-section .form-control {
|
||||
max-width: 120px
|
||||
}
|
||||
|
||||
.header-cell {
|
||||
background-color: #a6e1ec;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.quarters-cell {
|
||||
background-color: #5bc0de;
|
||||
}
|
||||
|
||||
.row-header {}
|
||||
|
||||
.cell-span {
|
||||
background-color: #f4f7f8;
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('script')
|
||||
<!-- third party js -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/ag-grid-community/dist/ag-grid-community.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.0/xlsx.full.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var cellClassRules = {
|
||||
'header-cell': 'data.section === "big-title"',
|
||||
'quarters-cell': 'data.section === "quarters"',
|
||||
};
|
||||
|
||||
function rowSpan(params) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
const columnDefs = [{
|
||||
headerName: 'Name',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
field: 'name',
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
headerName: 'Employee Code',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
field: 'employee_code',
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
headerName: 'Email',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
field: 'email',
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
headerName: 'Designation',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
field: 'designation',
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
headerName: 'Zone',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
field: 'Zone',
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
headerName: 'Region',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
field: 'Region',
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
headerName: 'Area',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
field: 'Area',
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
headerName: 'Territory',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
field: 'Territory',
|
||||
width: 170,
|
||||
},
|
||||
|
||||
{
|
||||
headerName: 'Marks',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
field: 'marks',
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
headerName: 'Total',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
field: 'total',
|
||||
width: 170,
|
||||
},
|
||||
|
||||
@foreach($parameters as $param)
|
||||
{
|
||||
headerName: '{{$param->title}}',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
field: '{{$param->id}}',
|
||||
width: 170,
|
||||
},
|
||||
@endforeach
|
||||
|
||||
{ headerName: 'Level 2 Name', filter: 'agTextColumnFilter', floatingFilter: true, field: 'level_2_user_name', width: 170, },
|
||||
{ headerName: 'Level 2 Email', filter: 'agTextColumnFilter', floatingFilter: true, field: 'level_2_user_email', width: 170, },
|
||||
{ headerName: 'Level 2 Code', filter: 'agTextColumnFilter', floatingFilter: true, field: 'level_2_user_employee_code', width: 170, },
|
||||
|
||||
{ headerName: 'Level 3 Name', filter: 'agTextColumnFilter', floatingFilter: true, field: 'level_3_user_name', width: 170, },
|
||||
{ headerName: 'Level 3 Email', filter: 'agTextColumnFilter', floatingFilter: true, field: 'level_3_user_email', width: 170, },
|
||||
{ headerName: 'Level 3 Code', filter: 'agTextColumnFilter', floatingFilter: true, field: 'level_3_user_employee_code', width: 170, },
|
||||
|
||||
{ headerName: 'Level 4 Name', filter: 'agTextColumnFilter', floatingFilter: true, field: 'level_4_user_name', width: 170, },
|
||||
{ headerName: 'Level 4 Email', filter: 'agTextColumnFilter', floatingFilter: true, field: 'level_4_user_email', width: 170, },
|
||||
{ headerName: 'Level 4 Code', filter: 'agTextColumnFilter', floatingFilter: true, field: 'level_4_user_employee_code', width: 170, },
|
||||
|
||||
{ headerName: 'Level 5 Name', filter: 'agTextColumnFilter', floatingFilter: true, field: 'level_5_user_name', width: 170, },
|
||||
{ headerName: 'Level 5 Email', filter: 'agTextColumnFilter', floatingFilter: true, field: 'level_5_user_email', width: 170, },
|
||||
{ headerName: 'Level 5 Code', filter: 'agTextColumnFilter', floatingFilter: true, field: 'level_5_user_employee_code', width: 170, },
|
||||
|
||||
];
|
||||
|
||||
const rowData = [];
|
||||
|
||||
$('#btn-export').on('click', function() {
|
||||
gridOptions.api.exportDataAsCsv();
|
||||
});
|
||||
|
||||
const gridOptions = {
|
||||
columnDefs: columnDefs,
|
||||
pagination: true,
|
||||
|
||||
// sets 10 rows per page (default is 100)
|
||||
paginationPageSize: 50,
|
||||
defaultColDef: {
|
||||
resizable: true,
|
||||
sortable: true,
|
||||
},
|
||||
rowData: rowData,
|
||||
domLayout: 'normal',
|
||||
};
|
||||
|
||||
const gridDiv = document.querySelector('#myGrid');
|
||||
new agGrid.Grid(gridDiv, gridOptions);
|
||||
|
||||
let final_data = {!! json_encode($users) !!}
|
||||
gridOptions.api.setRowData(final_data);
|
||||
|
||||
//$("#pageloader").fadeIn();
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: '/report/ajaxbdedoctorscans',
|
||||
// processData: false,
|
||||
// contentType: false,
|
||||
// success: function(data) {
|
||||
// //console.log(data)
|
||||
// // gridOptions.api.setRowData(data.doctors);
|
||||
// // $("#pageloader").fadeOut();
|
||||
// gridOptions.api.setRowData(data.jsondata);
|
||||
// $("#pageloader").fadeOut();
|
||||
// final_data = final_data.concat(data.jsondata)
|
||||
|
||||
// for (var i=0; i<data.total; i+=5000) {
|
||||
// if(i > 0) {
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// async: false,
|
||||
// url: '/report/ajaxbdedoctorscansfiles?type=nextpage&fileno=' + (i/5000),
|
||||
// processData: false,
|
||||
// contentType: false,
|
||||
// success: function(data) {
|
||||
// final_data = final_data.concat(data)
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// gridOptions.api.setRowData(final_data);
|
||||
// },
|
||||
// });
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -70,7 +70,10 @@
|
|||
@else
|
||||
<td>
|
||||
<a href="{{$base_url}}/delete?id={{$item->id}}" class="action-icon"> <i class="mdi mdi-delete text-danger"></i></a>
|
||||
<button type="button" class="btn btn-link view-response" response_id="{{$item->id}}" data_object='{{ json_encode($item) }}'> <i class="mdi mdi-eye text-info mdi-24px"></i></button>
|
||||
<button type="button" class="btn btn-link view-response" response_id="{{$item->id}}" data_object='{{ json_encode( ['user_name'=>$item->user_name,'media_type'=>$item->media_type,'title'=>$item->title,'media_url'=>$item->media_url,'createdAt'=>$item->createdAt] ) }}'> <i class="mdi mdi-eye text-info mdi-24px"></i></button>
|
||||
@if($item->no_of_evaluations > 0)
|
||||
<button type="button" class="btn btn-link view-evaluations" response_id="{{$item->id}}" data_object='{{ json_encode(isset($item->evaluations)?$item->evaluations:"[]") }}'> <i class="mdi mdi-clipboard-check-outline text-success mdi-24px"></i></button>
|
||||
@endif
|
||||
</td>
|
||||
@endif
|
||||
@endforeach
|
||||
|
|
@ -144,11 +147,31 @@
|
|||
<script src="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
var responses =
|
||||
|
||||
$('.view-evaluations').click(function(event){
|
||||
var evals = JSON.parse($(this).attr('data_object'))
|
||||
$('#response_modal .modal-title').html('Evaluations')
|
||||
var html = ''
|
||||
for(let eval of evals) {
|
||||
html += `<h4>Evaluated by <strong>${eval.user_info.name}</strong> on <strong>${ eval.createdAt.split('.')[0].replace("T", " ") }</strong></h4>`
|
||||
html += `<div class="row">`
|
||||
for(let score of eval.scores) {
|
||||
html += `<div class="col-6">${score.name}</div><div class="col-6">${score.score}/${score.scale} (${score.regard})</div>`
|
||||
}
|
||||
html += `<div class="col-12">Feedback: ${eval.feedback}</div>`
|
||||
html += `</div><hr />`
|
||||
}
|
||||
$('#response_modal .modal-body').html(html)
|
||||
$('#response_modal').modal('show')
|
||||
})
|
||||
|
||||
$('.view-response').click(function(event){
|
||||
var resp = JSON.parse($(this).attr('data_object'))
|
||||
$('#response_modal .modal-title').html('Uploaded By: ' + resp.user_name)
|
||||
if(resp.media_type == 'VIDEO') {
|
||||
$('#response_modal .modal-body').html(`<h4>${resp.title}</h4>
|
||||
switch(resp.media_type.toLowerCase()) {
|
||||
case 'video':
|
||||
$('#response_modal .modal-body').html(`<h4>${resp.title}</h4>
|
||||
<h5>${ resp.createdAt.split('.')[0].replace("T", " ") }</h5>
|
||||
<div>
|
||||
<video style="width:100%; hright:100%" controls>
|
||||
|
|
@ -157,8 +180,37 @@
|
|||
Your browser does not support the video tag.
|
||||
</video>
|
||||
</div>
|
||||
|
||||
`)
|
||||
break;
|
||||
case 'audio':
|
||||
$('#response_modal .modal-body').html(`<h4>${resp.title}</h4>
|
||||
<h5>${ resp.createdAt.split('.')[0].replace("T", " ") }</h5>
|
||||
<div>
|
||||
<audio controls>
|
||||
<source src="${resp.media_url}" type="audio/mpeg">
|
||||
<source src="${resp.media_url}" type="audio/ogg">
|
||||
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
</div>
|
||||
`)
|
||||
break;
|
||||
case 'image':
|
||||
$('#response_modal .modal-body').html(`<h4>${resp.title}</h4>
|
||||
<h5>${ resp.createdAt.split('.')[0].replace("T", " ") }</h5>
|
||||
<div>
|
||||
<img src="${resp.media_url}" class="img-fluid">
|
||||
</div>
|
||||
`)
|
||||
break;
|
||||
case 'pdf':
|
||||
$('#response_modal .modal-body').html(`<h4>${resp.title}</h4>
|
||||
<h5>${ resp.createdAt.split('.')[0].replace("T", " ") }</h5>
|
||||
<div>
|
||||
<embed src="${resp.media_url}" style="width:100%; height:100%">
|
||||
</div>
|
||||
`)
|
||||
break;
|
||||
}
|
||||
$('#response_modal').modal('show')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,143 +1,164 @@
|
|||
<!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" />
|
||||
<style type="text/css">
|
||||
.img-thumbnail {
|
||||
max-width: 100px
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/title-meta', ['title' => "History"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
</head>
|
||||
<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">
|
||||
<div class="row">
|
||||
<div class="col-md-6 p-2">
|
||||
<h4 class="page-title">{{ $title }} Listing</h4>
|
||||
</div>
|
||||
<div class="col-md-6 p-2">
|
||||
@if (isset($buttons))
|
||||
@foreach ($buttons as $button)
|
||||
<a href="{{ $button['link'] }}"
|
||||
class="btn btn-{{ $button['title'] == 'Add New' ? 'success' : 'dark' }} waves-effect waves-light float-end me-2"
|
||||
id="btn-{{ strtolower(str_replace(' ', '-', $button['title'])) }}">{{ $button['title'] }}</a>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@if (session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if (session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="col-12 p-0">
|
||||
<div class="card" id="list-wrapper">
|
||||
<div class="card-body">
|
||||
<table id="list-page-datatable" class="table w-100 nowrap">
|
||||
<thead>
|
||||
<tr>
|
||||
@foreach ($fields as $field => $props)
|
||||
<th>{{ $props['title'] }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($items as $item)
|
||||
<div class="responsive-table-plugin">
|
||||
<div class="table-rep-plugin">
|
||||
<div class="table-responsive" data-pattern="priority-columns">
|
||||
<table id="tech-companies-1" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Actions</th>
|
||||
@foreach ($fields as $field => $props)
|
||||
<th>{{ $props['title'] }}</th>
|
||||
@endforeach
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($items as $item)
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" jsondata="{{json_encode($item)}}" class="btn btn-primary btn-xs edit-button">Edit</button>
|
||||
</td>
|
||||
@foreach ($fields as $field => $props)
|
||||
@if ($field != 'actions')
|
||||
<td>
|
||||
@switch($props['type'])
|
||||
@case('image')
|
||||
<img src="{{ $item->{$field} }}" class="img-thumbnail">
|
||||
@break
|
||||
|
||||
@case('text')
|
||||
@case('select')
|
||||
{{ isset($item->{$field}) ? $item->{$field} : '' }}
|
||||
@break
|
||||
|
||||
@case('date')
|
||||
{{ date('d M Y', strtotime($item->{$field})) }}
|
||||
@break
|
||||
@endswitch
|
||||
</td>
|
||||
@else
|
||||
<td>
|
||||
@foreach ($props['buttons'] as $key => $button)
|
||||
@switch($button)
|
||||
@case('edit')
|
||||
<a href="{{ $base_url }}/edit?id={{ $item->id }}"
|
||||
class="action-icon"> <i
|
||||
class="mdi mdi-square-edit-outline text-warning"></i></a>
|
||||
@break
|
||||
|
||||
@case('delete')
|
||||
<a href="{{ $base_url }}/delete?id={{ $item->id }}"
|
||||
class="action-icon"> <i
|
||||
class="mdi mdi-delete text-danger"></i></a>
|
||||
@break
|
||||
|
||||
@default
|
||||
@php
|
||||
if (isset($button['href']) && $button['href'] != '') {
|
||||
$href = $item->{$button['href']};
|
||||
} else {
|
||||
$querystring = $button['querystring'];
|
||||
foreach ((array) $item as $k => $v) {
|
||||
if (strpos($querystring, '{' . strtoupper($k) . '}') !== false) {
|
||||
$querystring = str_replace('{' . strtoupper($k) . '}', $v, $querystring);
|
||||
}
|
||||
}
|
||||
$href = $base_url . '/' . $key . '?' . $querystring;
|
||||
}
|
||||
|
||||
@endphp
|
||||
<a href="{{ $href }}" class="action-icon"> <i
|
||||
class="mdi mdi-{{ $button['icon'] }}"></i></a>
|
||||
@endswitch
|
||||
@endforeach
|
||||
</td>
|
||||
@endif
|
||||
<td>
|
||||
{{ isset($item->{$field}) ? $item->{$field} : '' }}
|
||||
</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end .table-responsive -->
|
||||
|
||||
</div> <!-- end .table-rep-plugin-->
|
||||
</div> <!-- end .responsive-table-plugin-->
|
||||
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
|
||||
|
||||
|
||||
<div class="card" id="edit-wrapper">
|
||||
<form method="post" action="/doctor/submit" id="form-availiblity" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<input type="hidden" id="field-id" name="id" value="">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-6 mb-3">
|
||||
<h4 class="page-title">Edit Doctor</h4>
|
||||
</div>
|
||||
<div class="col-6 mb-3">
|
||||
<div class="float-end">
|
||||
<button type="button" class="btn btn-dark waves-effect waves-light btn-back">Back</button>
|
||||
<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="" >
|
||||
@break
|
||||
@case('date')
|
||||
<input type="text" id="field-{{$field}}" name="{{$field}}" class="form-control" placeholder="Enter {{$props['title']}}" value="" data-provide="datepicker" data-date-format="mm-dd-yyyy" data-date-autoclose="true">
|
||||
@break
|
||||
@case('select')
|
||||
<select class="form-control" id="field-{{$field}}" name="{{$field}}">
|
||||
<option value=""> -- Select {{$props['title']}} -- </option>
|
||||
@foreach($props['values'] as $k => $v)
|
||||
<option value="{{$k}}">{{$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('image')
|
||||
<div class="mt-3" id="file_wrapper">
|
||||
<input type="file" name="{{$field}}" class="dropify" data-default-file="{{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
|
||||
@endswitch
|
||||
@if($props['type'] != 'hidden')
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="float-end">
|
||||
<button type="button" class="btn btn-dark waves-effect waves-light btn-back">Back</button>
|
||||
<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>
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@section('script')
|
||||
<script src="{{ asset('assets/libs/datatables/datatables.min.js') }}"></script>
|
||||
<script src="{{ asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
<!-- end page -->
|
||||
@include('layouts.shared/footer-script')
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($) {
|
||||
$('#list-page-datatable').DataTable({
|
||||
stateSave: true,
|
||||
"scrollX": true,
|
||||
"paging": false
|
||||
});
|
||||
});
|
||||
jQuery(document).ready(function($){
|
||||
$('#edit-wrapper').hide();
|
||||
$('.edit-button').click(function(){
|
||||
$('#edit-wrapper').show();
|
||||
$('#list-wrapper').hide();
|
||||
let data = JSON.parse($(this).attr('jsondata') )
|
||||
$('#form-availiblity')[0].reset()
|
||||
for(let field of Object.keys(data) ) {
|
||||
$('#field-'+field).val(data[field]).change();
|
||||
}
|
||||
console.log(data)
|
||||
})
|
||||
$('.btn-back').click(function(){
|
||||
$('#list-wrapper').show();
|
||||
$('#edit-wrapper').hide();
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,218 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Dashboard", "mode" => $mode ?? "", "demo" => $demo ?? ""])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{ URL::asset('assets/libs/datatables/datatables.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.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">
|
||||
<div class="page-title-right">
|
||||
<a class="btn btn-dark waves-effect waves-light" href="/form/allsubmissions?partition={{$form->partition}}&form_id={{$form->id}}&download=1">Export</a>
|
||||
</div>
|
||||
<h4 class="page-title">All Submissions</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-12">
|
||||
<div class="card-box">
|
||||
<div class="responsive-table-plugin">
|
||||
<div class="table-rep-plugin">
|
||||
<div class="table-responsive" data-pattern="priority-columns">
|
||||
<table id="basic-datatable" class="table dt-responsive nowrap">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th>#</th> -->
|
||||
<th>User Name</th>
|
||||
<th>User Email</th>
|
||||
<th>User Phone</th>
|
||||
<th>Submitted On</th>
|
||||
@foreach($questions as $que)
|
||||
<th>{{$que->question}}</th>
|
||||
@endforeach
|
||||
<th data-priority="1">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end .table-responsive -->
|
||||
|
||||
</div> <!-- end .table-rep-plugin-->
|
||||
</div> <!-- end .responsive-table-plugin-->
|
||||
</div> <!-- end card-box -->
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- container -->
|
||||
|
||||
<div class="modal fade" id="scrollable-modal" tabindex="-1" role="dialog" aria-labelledby="scrollableModalTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-scrollable" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="scrollableModalTitle">Update link</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
|
||||
|
||||
@endsection
|
||||
|
||||
|
||||
@section('script')
|
||||
|
||||
<!-- third party js -->
|
||||
<script src="{{ URL::asset('assets/libs/datatables/datatables.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<!-- third party js ends -->
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
// Default Datatable
|
||||
let table = $('#basic-datatable').DataTable({
|
||||
"order": [[ 0, "desc" ]],
|
||||
"language": {
|
||||
"paginate": {
|
||||
"previous": "<i class='mdi mdi-chevron-left'>",
|
||||
"next": "<i class='mdi mdi-chevron-right'>"
|
||||
}
|
||||
},
|
||||
"drawCallback": function drawCallback() {
|
||||
//$('.dataTables_paginate > .pagination').addStaff('pagination-rounded');
|
||||
},
|
||||
|
||||
fixedHeader: true,
|
||||
"pageLength": 50,
|
||||
"lengthMenu": [[50, 100, 250, 500], [50, 100, 250, 500]],
|
||||
'processing': false,
|
||||
'serverSide': false,
|
||||
'serverMethod': 'get',
|
||||
//searchDelay: 2000,
|
||||
"order": [[ 1, "asc" ]],
|
||||
'searching': true,
|
||||
'info': true,
|
||||
|
||||
"ajax": {
|
||||
url: '{{$submission_json}}',
|
||||
data:{
|
||||
//'listfilters': listfilters
|
||||
},
|
||||
dataSrc: ''
|
||||
},
|
||||
columns: [
|
||||
// { "data": "id" },
|
||||
{ "data": "submitted_by" },
|
||||
{ "data": "user_email" },
|
||||
{ "data": "user_phone" },
|
||||
{ "data": "submitted_on" },
|
||||
@foreach($questions as $que)
|
||||
{ "data": "{{$que->code}}" },
|
||||
@endforeach
|
||||
{ data: null,
|
||||
render: function ( data, type, row ) {
|
||||
return '<button title="View" class="btn btn-info btn-xs waves-effect waves-light"><i class="mdi mdi-eye-outline"></i></button>'
|
||||
}
|
||||
}
|
||||
],
|
||||
"initComplete": function(settings, json) {
|
||||
var api = this.api();
|
||||
var textBox = $('.dataTables_filter label input');
|
||||
textBox.unbind();
|
||||
textBox.bind('keyup input', function(e) {
|
||||
if(e.keyCode == 8 && !textBox.val() || e.keyCode == 46 && !textBox.val()) {
|
||||
// do nothing ¯\_(ツ)_/¯
|
||||
} else if(e.keyCode == 13 || !textBox.val()) {
|
||||
api.search(this.value).draw();
|
||||
}
|
||||
});
|
||||
}
|
||||
}); //Buttons examples
|
||||
|
||||
$('#basic-datatable tbody').on( 'click', 'button', function () {
|
||||
$('#scrollable-modal').modal('show');
|
||||
$('#scrollable-modal .modal-body').html(`<div id="form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="1714578520-efa6c1b8-d34d-4ada-9ab8-661291282b1c">
|
||||
<input type="hidden" name="partition" value="rapport-team3">
|
||||
@csrf
|
||||
<div class="col-12 mb-2">
|
||||
<label for="field-link" class="form-label"> Event Link </label>
|
||||
<input type="text" id="field-link" class="form-control" name="link" value="">
|
||||
<input type="hidden" name="link_status" id="link_status" value="Link Updated">
|
||||
</div>
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
</form>
|
||||
</div>`)
|
||||
|
||||
var submission_formdata = table.row( $(this).parents('tr') ).data();
|
||||
for(let key of Object.keys(submission_formdata)) {
|
||||
if(key != 'link' && key != 'link_status') {
|
||||
$('#report-form').append('<input type="hidden" name="'+key+'" value="'+submission_formdata[key]+'">')
|
||||
}
|
||||
}
|
||||
|
||||
$('#submit-btn').unbind()
|
||||
$('#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'
|
||||
})
|
||||
$('#scrollable-modal').modal('hide');
|
||||
//window.location.reload()
|
||||
//$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
|
|
@ -198,13 +198,23 @@
|
|||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
title: data.hasOwnProperty('message') ? 'You are not mapped to any position code' : 'Data not submitted',
|
||||
text: data.hasOwnProperty('message') ? 'for resolution please email Position code, L1 Manager and L2 Manager details to support1@stratawiz.com':'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
var today = new Date();
|
||||
var dd = String(today.getDate()).padStart(2, '0');
|
||||
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||
var yyyy = today.getFullYear();
|
||||
today = yyyy + '-' + mm + '-' + dd;
|
||||
|
||||
var plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,385 @@
|
|||
@extends('layouts.vertical', ["page_title"=> "Dashboard", "mode" => $mode ?? "", "demo" => $demo ?? ""])
|
||||
|
||||
@section('css')
|
||||
<!-- third party css -->
|
||||
<link href="{{ URL::asset('assets/libs/datatables/datatables.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/ag-grid-community@30.0.0/dist/ag-grid-community.min.js"></script>
|
||||
<!-- third party css end -->
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<!-- Start Content-->
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box">
|
||||
<div class="page-title-right">
|
||||
<button class="btn btn-success" id="btn_approve_all">Approve all Selected</button>
|
||||
<button class="btn btn-danger ms-1" id="btn_reject_all">Reject all Selected</button>
|
||||
<button class="btn btn-primary ms-1" >Show All</button>
|
||||
<button class="btn btn-primary ms-1" id="btn_approve_all">Show Pending</button>
|
||||
<a class="btn btn-dark waves-effect waves-light ms-1" href="/form/allsubmissions?partition={{$form->partition}}&form_id={{$form->id}}&download=1">Export</a>
|
||||
</div>
|
||||
<h4 class="page-title">All Workflow</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-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div id="myGrid" style="" class="ag-theme-alpine"></div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
|
||||
</div> <!-- container -->
|
||||
|
||||
<div class="modal fade" id="scrollable-modal" tabindex="-1" role="dialog" aria-labelledby="scrollableModalTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-xl" role="document">
|
||||
<div class="modal-content ">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="scrollableModalTitle">View Details</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<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%;
|
||||
}
|
||||
.img-thumbnail {max-width: 100px}
|
||||
.filter-section .form-select {max-width: 150px}
|
||||
.filter-section .form-control {max-width: 120px}
|
||||
.header-cell {background-color: #a6e1ec;text-align: center;}
|
||||
.quarters-cell {background-color: #5bc0de;}
|
||||
.row-header {}
|
||||
.cell-span {background-color: #f4f7f8;}
|
||||
</style>
|
||||
|
||||
|
||||
@endsection
|
||||
|
||||
|
||||
@section('script')
|
||||
|
||||
<!-- third party js -->
|
||||
|
||||
<script src="{{ URL::asset('assets/libs/datatables/datatables.min.js')}}"></script>
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<!-- third party js ends -->
|
||||
<script type="text/javascript">
|
||||
let submissions = []
|
||||
function submissionHandle(id) {
|
||||
let submission = submissions.find(s => s.id == id)
|
||||
$('#scrollable-modal').modal('show');
|
||||
$('#scrollable-modal .modal-body').html(`
|
||||
<div class="row gx-0 justify-content-center" id="model_approval_status"><div class="col-2"><div class="avatar-md"><img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" class="img-fluid" alt="processing..." /></div></div></div>
|
||||
<div id="form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="col-12 mb-2">
|
||||
<div class="table-responsive">
|
||||
<table class="table m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><h5 class="m-0 fw-normal">User Name</h5> </td>
|
||||
<td> ${submission['submitted_by']} </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><h5 class="m-0 fw-normal">User Email</h5> </td>
|
||||
<td> ${submission['user_email']} </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><h5 class="m-0 fw-normal">User Phone</h5> </td>
|
||||
<td> ${submission['user_phone']} </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><h5 class="m-0 fw-normal">Submitted On</h5> </td>
|
||||
<td> ${submission['submitted_on']} </td>
|
||||
</tr>
|
||||
@foreach($questions as $que)
|
||||
<tr>
|
||||
<td><h5 class="m-0 fw-normal">{{$que->question}}</h5> </td>
|
||||
<td> ${submission['{{$que->code}}']} </td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center mt-3">
|
||||
<button type="button" class="btn btn-success" submission="${id}" id="btn_approve" ${ ['approved', 'rejected'].includes(submission.workflow_status) ? 'disabled':''}>Approve</button>
|
||||
<button type="button" class="btn btn-danger ms-1" submission="${id}" id="btn_reject" ${ ['approved', 'rejected'].includes(submission.workflow_status) ? 'disabled':''}>Reject</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>`)
|
||||
|
||||
$.ajax({
|
||||
url: '/form/allaprovers',
|
||||
type: 'GET',
|
||||
data: {submission_id:id, form_id:'1719380553-df77ae1b-7861-4e3d-a8ef-6ae1b94bf456'},
|
||||
success: function( data ) {
|
||||
$('#model_approval_status').html('')
|
||||
for(let da of data) {
|
||||
$('#model_approval_status').append(`<div class="col-auto">
|
||||
<div class="widget-rounded-circle card">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center gx-2">
|
||||
<div class="col-auto">
|
||||
<div class="avatar-sm">
|
||||
<img src="https://ui-avatars.com/api/?background=random&name=${da.user_name}" class="img-fluid rounded-circle" alt="user-img">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h5 class="mb-1 mt-2 font-16">${da.user_name}</h5>
|
||||
<p class="mb-2 text-muted">${da.approval_status}</p>
|
||||
</div>
|
||||
</div> <!-- end row-->
|
||||
</div>
|
||||
</div> <!-- end widget-rounded-circle-->
|
||||
</div>`)
|
||||
}
|
||||
console.log(data)
|
||||
},
|
||||
});
|
||||
|
||||
$('#btn_approve').unbind()
|
||||
$('#btn_approve').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let that = $(this)
|
||||
$.ajax({
|
||||
url: '/form/approverejectmultiple',
|
||||
type: 'GET',
|
||||
data: {action:'approve', ids:[that.attr('submission')], form_id:'1719380553-df77ae1b-7861-4e3d-a8ef-6ae1b94bf456'},
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#scrollable-modal').modal('hide');
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
},
|
||||
});
|
||||
})
|
||||
$('#btn_reject').unbind()
|
||||
$('#btn_reject').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let that = $(this)
|
||||
$.ajax({
|
||||
url: '/form/approverejectmultiple',
|
||||
type: 'GET',
|
||||
data: {action:'reject', ids:[that.attr('submission')], form_id:'1719380553-df77ae1b-7861-4e3d-a8ef-6ae1b94bf456'},
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#scrollable-modal').modal('hide');
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
},
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#btn_approve_all').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let selected = []
|
||||
$('input[type=checkbox]').each(function () {
|
||||
if(this.checked) {
|
||||
selected.push($(this).val())
|
||||
}
|
||||
});
|
||||
if(selected.length > 0) {
|
||||
$.ajax({
|
||||
url: '/form/approverejectmultiple',
|
||||
type: 'GET',
|
||||
data: {action:'approve', ids:selected, form_id:'1719380553-df77ae1b-7861-4e3d-a8ef-6ae1b94bf456'},
|
||||
dataType: "json",
|
||||
success: function(resultData) {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'No Submission Selected',
|
||||
text: 'Please select at least 1 submission'
|
||||
})
|
||||
}
|
||||
console.log(selected)
|
||||
})
|
||||
|
||||
$('#btn_reject_all').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let selected = []
|
||||
$('input[type=checkbox]').each(function () {
|
||||
if(this.checked) {
|
||||
selected.push($(this).val())
|
||||
}
|
||||
});
|
||||
if(selected.length > 0) {
|
||||
$.ajax({
|
||||
url: '/form/approverejectmultiple',
|
||||
type: 'GET',
|
||||
data: {action:'reject', ids:selected, form_id:'1719380553-df77ae1b-7861-4e3d-a8ef-6ae1b94bf456'},
|
||||
dataType: "json",
|
||||
success: function(resultData) {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("#pageloader").fadeOut();
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'No Submission Selected',
|
||||
text: 'Please select at least 1 submission'
|
||||
})
|
||||
}
|
||||
console.log(selected)
|
||||
})
|
||||
|
||||
const columnDefs = [{
|
||||
headerName: "Select",
|
||||
width: 120,
|
||||
cellRenderer: params => {
|
||||
return `<input type="checkbox" value="${params.data.id}" name="row-${params.data.id}" ${ ['approved', 'rejected'].includes(params.data.workflow_status) ? 'disabled':''} class="form-check-input mt-2" /> <button type="button" onClick="submissionHandle('${params.data.id}')" class="btn btn-info btn-xs ms-1 btn_submission_view">View</button>`;
|
||||
}
|
||||
},
|
||||
{
|
||||
headerName: 'Approval Status',
|
||||
field: 'workflow_status',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
headerName: 'User Name',
|
||||
field: 'submitted_by',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
headerName: 'User Email',
|
||||
field: 'user_email',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
headerName: 'User Phone',
|
||||
field: 'user_phone',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
width: 170,
|
||||
},
|
||||
{
|
||||
headerName: 'Submitted On',
|
||||
field: 'submitted_on',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
width: 170,
|
||||
},
|
||||
@foreach($questions as $que)
|
||||
{
|
||||
headerName: '{{$que->question}}',
|
||||
field: '{{$que->code}}',
|
||||
filter: 'agTextColumnFilter',
|
||||
floatingFilter: true,
|
||||
width: {{ strlen($que->question)*14 > 250 ? 250 : ( strlen($que->question)*14 < 150 ? 150 : strlen($que->question)*14 ) }},
|
||||
},
|
||||
@endforeach
|
||||
]
|
||||
|
||||
const rowData = [];
|
||||
const gridOptions = {
|
||||
columnDefs: columnDefs,
|
||||
pagination: true,
|
||||
paginationPageSize: 50,
|
||||
defaultColDef: {
|
||||
resizable: true,
|
||||
sortable: true,
|
||||
},
|
||||
rowData: rowData,
|
||||
domLayout: 'autoHeight',
|
||||
};
|
||||
|
||||
const gridDiv = document.querySelector('#myGrid');
|
||||
new agGrid.Grid(gridDiv, gridOptions);
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '{{$submission_json}}',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
//console.log(data)
|
||||
submissions = data
|
||||
gridOptions.api.setRowData(data);
|
||||
$("#pageloader").fadeOut();
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
$('.btn_submission_view').on( 'click', 'button', function () {
|
||||
$('#scrollable-modal').modal('show');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
|
|
@ -41,6 +41,9 @@
|
|||
<tr>
|
||||
<th data-priority="1">Submission Date</th>
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'hidden')
|
||||
@continue;
|
||||
@endif
|
||||
<th data-priority="1">{{$question->label}}</th>
|
||||
@endforeach
|
||||
<th data-priority="1">Action</th>
|
||||
|
|
@ -51,6 +54,9 @@
|
|||
<tr>
|
||||
<th>{{date("d M Y", strtotime($submission->updatedAt))}}</th>
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'hidden')
|
||||
@continue;
|
||||
@endif
|
||||
@if($question->type == 'file')
|
||||
<td><a target="_blank" href="{{ isset($submission->formdata->{$code}) ? is_array($submission->formdata->{$code})? implode(', ', $submission->formdata->{$code}) :(is_string($submission->formdata->{$code}) ? $submission->formdata->{$code} : '' ) : $code }}" download="{{ isset($submission->formdata->{$code}) ? is_array($submission->formdata->{$code})? implode(', ', $submission->formdata->{$code}) : (is_string($submission->formdata->{$code}) ? $submission->formdata->{$code} : '' ) : $code }}" class="btn btn-dark btn-xs"><i class="mdi mdi-cloud-download me-1"></i> Download</a></td>
|
||||
@elseif(count((array)$question->options) > 0 && 1==2 )
|
||||
|
|
@ -61,7 +67,14 @@
|
|||
@endforeach
|
||||
<th>
|
||||
@if($question->can_edit == 'yes' || sizeof($submission->workflow_approvals) == 0 )
|
||||
<a href="/form/show?id={{$submission->id}}" class="btn btn-primary btn-xs">Edit</button>
|
||||
@if($submission->workflow == 'yes' && $submission->workflow_status == 'approved' )
|
||||
<p>Approved</p>
|
||||
@else
|
||||
<a href="/form/show?form_id={{$submission->formdata->form_id}}&id={{$submission->id}}" class="btn btn-primary btn-xs">Edit</button>
|
||||
@if(isset($form->allow_delete_by_user) && $form->allow_delete_by_user == 'yes')
|
||||
<a href="/form/delete?form_id={{$submission->formdata->form_id}}&id={{$submission->id}}" onclick="return confirm('Are you sure you want to delete this submission? This is not recoverable!');" class="btn btn-danger btn-xs mt-1">Delete</button>
|
||||
@endif
|
||||
@endif
|
||||
@endif
|
||||
</th>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
<!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">
|
||||
<h6>Upload your file</h6>
|
||||
</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 type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#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>
|
||||
|
|
@ -55,6 +55,9 @@
|
|||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'multitextbox')
|
||||
@foreach( $question->options as $k => $v )
|
||||
@if($question->type == 'hidden')
|
||||
@continue;
|
||||
@endif
|
||||
<th data-priority="1">{{$v}} ({{$question->label}})</th>
|
||||
@endforeach
|
||||
@else
|
||||
|
|
@ -80,6 +83,9 @@
|
|||
<td>{{ucwords($submission->workflow_status)}}</td>
|
||||
@endif
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'hidden')
|
||||
@continue;
|
||||
@endif
|
||||
@if($question->type == 'multitextbox')
|
||||
@foreach( $question->options as $k => $v )
|
||||
<td>{{ isset($submission->formdata->{$k}) ? (is_array($submission->formdata->{$k}) ? implode(', ', $submission->formdata->{$k}) : $submission->formdata->{$k}) : '' }}</td>
|
||||
|
|
@ -175,6 +181,8 @@
|
|||
|
||||
|
||||
$('.btn-approve').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let that = $(this)
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/approvereject?action=approve&id=' + $(this).attr('submission'),
|
||||
|
|
@ -184,10 +192,13 @@
|
|||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
console.log(data)
|
||||
that.parent().html('')
|
||||
},
|
||||
});
|
||||
})
|
||||
$('.btn-reject').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
let that = $(this)
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/approvereject?action=reject&id=' + $(this).attr('submission'),
|
||||
|
|
@ -197,6 +208,7 @@
|
|||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
console.log(data)
|
||||
that.parent().html('')
|
||||
},
|
||||
});
|
||||
})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,434 @@
|
|||
<!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
|
||||
@if (isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{ $form->user_info->name }}</h6>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<input type="hidden" id="pansec_grp_pob_units" name="pansec_grp_pob_units" value="0">
|
||||
<input type="hidden" id="pansec_grp_pob_value" name="pansec_grp_pob_value" value="0">
|
||||
|
||||
<input type="hidden" id="pansec_80_pob_units" name="pansec_80_pob_units" value="0">
|
||||
<input type="hidden" id="pansec_80_pob_value" name="pansec_80_pob_value" value="0">
|
||||
|
||||
<input type="hidden" id="ncv_adult_pob_units" name="ncv_adult_pob_units" value="0">
|
||||
<input type="hidden" id="ncv_adult_pob_value" name="ncv_adult_pob_value" value="0">
|
||||
<input type="hidden" id="ncv_pedia_pob_units" name="ncv_pedia_pob_units" value="0">
|
||||
<input type="hidden" id="ncv_pedia_pob_value" name="ncv_pedia_pob_value" value="0">
|
||||
<input type="hidden" id="emeset_oral_pob_units" name="emeset_oral_pob_units"
|
||||
value="0">
|
||||
<input type="hidden" id="emeset_oral_pob_value" name="emeset_oral_pob_value"
|
||||
value="0">
|
||||
<input type="hidden" id="emeset_liq_pob_units" name="emeset_liq_pob_units" value="0">
|
||||
<input type="hidden" id="emeset_liq_pob_value" name="emeset_liq_pob_value" value="0">
|
||||
<input type="hidden" id="cheston_grp_pob_units" name="cheston_grp_pob_units"
|
||||
value="0">
|
||||
<input type="hidden" id="cheston_grp_pob_value" name="cheston_grp_pob_value"
|
||||
value="0">
|
||||
<input type="hidden" id="farobact_pob_units" name="farobact_pob_units" value="0">
|
||||
<input type="hidden" id="farobact_pob_value" name="farobact_pob_value" value="0">
|
||||
<input type="hidden" id="oflox_oz_pob_units" name="oflox_oz_pob_units" value="0">
|
||||
<input type="hidden" id="oflox_oz_pob_value" name="oflox_oz_pob_value" value="0">
|
||||
<input type="hidden" id="unobiotics_grp_pob_units" name="unobiotics_grp_pob_units"
|
||||
value="0">
|
||||
<input type="hidden" id="unobiotics_grp_pob_value" name="unobiotics_grp_pob_value"
|
||||
value="0">
|
||||
|
||||
|
||||
<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' ? ' msl_code=' . $option->contact->msl_code . ' speciality=' . $option->contact->speciality : '' }} {{ $question->code == 'brand_name' ? ' cost=' . $option->cost : '' }}>
|
||||
{{ $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')
|
||||
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||||
<input type="file" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control" value=""
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
@elseif(isset($question->value))
|
||||
<img src="{{ $question->value }}" class="img-fluid">
|
||||
@endif
|
||||
@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();
|
||||
result();
|
||||
var formData = new FormData($('#report-form')[0]);
|
||||
|
||||
formData.append('pansec_grp_pob_units', $('#pansec_grp_pob_units').val());
|
||||
formData.append('pansec_grp_pob_value', $('#pansec_grp_pob_value').val());
|
||||
|
||||
formData.append('pansec_80_pob_units', $('#pansec_80_pob_units').val());
|
||||
formData.append('pansec_80_pob_value', $('#pansec_80_pob_value').val());
|
||||
|
||||
formData.append('ncv_adult_pob_units', $('#ncv_adult_pob_units').val());
|
||||
formData.append('ncv_adult_pob_value', $('#ncv_adult_pob_value').val());
|
||||
|
||||
formData.append('ncv_pedia_pob_units', $('#ncv_pedia_pob_units').val());
|
||||
formData.append('ncv_pedia_pob_value', $('#ncv_pedia_pob_value').val());
|
||||
|
||||
formData.append('emeset_oral_pob_units', $('#emeset_oral_pob_units').val());
|
||||
formData.append('emeset_oral_pob_value', $('#emeset_oral_pob_value').val());
|
||||
|
||||
formData.append('emeset_liq_pob_units', $('#emeset_liq_pob_units').val());
|
||||
formData.append('emeset_liq_pob_value', $('#emeset_liq_pob_value').val());
|
||||
|
||||
formData.append('cheston_grp_pob_units', $('#cheston_grp_pob_units').val());
|
||||
formData.append('cheston_grp_pob_value', $('#cheston_grp_pob_value').val());
|
||||
|
||||
formData.append('farobact_pob_units', $('#farobact_pob_units').val());
|
||||
formData.append('farobact_pob_value', $('#farobact_pob_value').val());
|
||||
|
||||
formData.append('oflox_oz_pob_units', $('#oflox_oz_pob_units').val());
|
||||
formData.append('oflox_oz_pob_value', $('#oflox_oz_pob_value').val());
|
||||
|
||||
formData.append('unobiotics_grp_pob_units', $('#unobiotics_grp_pob_units').val());
|
||||
formData.append('unobiotics_grp_pob_value', $('#unobiotics_grp_pob_value').val());
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
resetval();
|
||||
$("#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!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('#field-msl_code').prop('readonly', true)
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
|
||||
var today = new Date();
|
||||
var dd = String(today.getDate()).padStart(2, '0');
|
||||
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||
var yyyy = today.getFullYear();
|
||||
today = yyyy + '-' + mm + '-' + dd;
|
||||
var cost = 0;
|
||||
|
||||
var plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
|
||||
$('#field-other_brand_name').hide();
|
||||
$('label[for="field-other_brand_name"]').hide();
|
||||
|
||||
|
||||
$('#field-brand_name').on('change', function() {
|
||||
if( parseInt($('#field-pob_units').val()) > 0 ) {
|
||||
$('#field-pob_value').val( parseInt($('option:selected', $('#field-brand_name')).attr("cost") * parseInt($('#field-pob_units').val()) ) )
|
||||
}
|
||||
console.log($('option:selected', $('#field-brand_name')).attr("cost"))
|
||||
cost = parseInt($('option:selected', $('#field-brand_name')).attr("cost"))
|
||||
console.log(cost)
|
||||
if ($(this).val() == 'Others') {
|
||||
$('#field-other_brand_name').show();
|
||||
$('label[for="field-other_brand_name"]').show();
|
||||
} else {
|
||||
$('#field-other_brand_name').hide();
|
||||
$('label[for="field-other_brand_name"]').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#field-pob_units').on('change', function() {
|
||||
console.log(cost)
|
||||
console.log($('#field-pob_units').val())
|
||||
$('#field-pob_value').val( parseInt(cost * parseInt($('#field-pob_units').val())) )
|
||||
});
|
||||
|
||||
function result() {
|
||||
var selectedVal = $('#field-brand_name').find(":selected").val();
|
||||
var unit = $('#field-pob_units').val();
|
||||
var val = $('#field-pob_value').val();
|
||||
|
||||
if (selectedVal == 'Pansec grp') {
|
||||
$('#pansec_grp_pob_units').val(unit);
|
||||
$('#pansec_grp_pob_value').val(val);
|
||||
} else if (selectedVal == 'Pansec 80') {
|
||||
$('#pansec_80_pob_units').val(unit);
|
||||
$('#pansec_80_pob_value').val(val);
|
||||
} else if (selectedVal == 'NCV Adult') {
|
||||
$('#ncv_adult_pob_units').val(unit);
|
||||
$('#ncv_adult_pob_value').val(val);
|
||||
} else if (selectedVal == 'NCV Pedia') {
|
||||
$('#ncv_pedia_pob_units').val(unit);
|
||||
$('#ncv_pedia_pob_value').val(val);
|
||||
} else if (selectedVal == 'Emeset Oral') {
|
||||
$('#emeset_oral_pob_units').val(unit);
|
||||
$('#emeset_oral_pob_value').val(val);
|
||||
} else if (selectedVal == 'Emeset Liq') {
|
||||
$('#emeset_liq_pob_units').val(unit);
|
||||
$('#emeset_liq_pob_value').val(val);
|
||||
} else if (selectedVal == 'Cheston grp') {
|
||||
$('#cheston_grp_pob_units').val(unit);
|
||||
$('#cheston_grp_pob_value').val(val);
|
||||
} else if (selectedVal == 'Farobact') {
|
||||
$('#farobact_pob_units').val(unit);
|
||||
$('#farobact_pob_value').val(val);
|
||||
} else if (selectedVal == 'Oflox OZ') {
|
||||
$('#oflox_oz_pob_units').val(unit);
|
||||
$('#oflox_oz_pob_value').val(val);
|
||||
} else if (selectedVal == 'Unobiotics grp') {
|
||||
$('#unobiotics_grp_pob_units').val(unit);
|
||||
$('#unobiotics_grp_pob_value').val(val);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function resetval() {
|
||||
$('#pansec_grp_pob_units').val('0');
|
||||
$('#pansec_grp_pob_value').val('0');
|
||||
$('#pansec_80_pob_units').val('0');
|
||||
$('#pansec_80_pob_value').val('0');
|
||||
$('#ncv_adult_pob_units').val('0');
|
||||
$('#ncv_adult_pob_value').val('0');
|
||||
$('#ncv_pedia_pob_units').val('0');
|
||||
$('#ncv_pedia_pob_value').val('0');
|
||||
$('#emeset_oral_pob_units').val('0');
|
||||
$('#emeset_oral_pob_value').val('0');
|
||||
$('#emeset_liq_pob_units').val('0');
|
||||
$('#emeset_liq_pob_value').val('0');
|
||||
$('#cheston_grp_pob_units').val('0');
|
||||
$('#cheston_grp_pob_value').val('0');
|
||||
$('#farobact_pob_units').val('0');
|
||||
$('#farobact_pob_value').val('0');
|
||||
$('#oflox_oz_pob_units').val('0');
|
||||
$('#oflox_oz_pob_value').val('0');
|
||||
$('#unobiotics_grp_pob_units').val('0');
|
||||
$('#unobiotics_grp_pob_value').val('0');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,87 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "History"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
</head>
|
||||
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-8 p-2">
|
||||
<h4 class="page-title">{{$formname}}</h4>
|
||||
</div>
|
||||
<div class="col-4 p-2">
|
||||
<a href="/form/show" class="float-end pt-1">New Submission</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12 p-0">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="responsive-table-plugin">
|
||||
<div class="table-rep-plugin">
|
||||
<div class="table-responsive" data-pattern="priority-columns">
|
||||
<table id="tech-companies-1" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-priority="1">Submission Date</th>
|
||||
@foreach($questions as $code => $question)
|
||||
<th data-priority="1">{{$question->label}}</th>
|
||||
@endforeach
|
||||
<th data-priority="1">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($submissions as $submission)
|
||||
<tr>
|
||||
<th>{{date("d M Y", strtotime($submission->updatedAt))}}</th>
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'file')
|
||||
<td><a target="_blank" href="{{ isset($submission->formdata->{$code}) ? is_array($submission->formdata->{$code})? implode(', ', $submission->formdata->{$code}) :(is_string($submission->formdata->{$code}) ? $submission->formdata->{$code} : '' ) : $code }}" download="{{ isset($submission->formdata->{$code}) ? is_array($submission->formdata->{$code})? implode(', ', $submission->formdata->{$code}) : (is_string($submission->formdata->{$code}) ? $submission->formdata->{$code} : '' ) : $code }}" class="btn btn-dark btn-xs"><i class="mdi mdi-cloud-download me-1"></i> Download</a></td>
|
||||
@elseif(count((array)$question->options) > 0 && 1==2 )
|
||||
<td>{{ $question->options->{ $submission->formdata->{$code} } }}</td>
|
||||
@else
|
||||
<td>{{ isset($submission->formdata->{$code}) ? is_array($submission->formdata->{$code})? implode(', ', $submission->formdata->{$code}) :$submission->formdata->{$code} : $code }}</td>
|
||||
@endif
|
||||
@endforeach
|
||||
<th>
|
||||
@if($question->can_edit == 'yes' || sizeof($submission->workflow_approvals) == 0 )
|
||||
<a href="/form/show?id={{$submission->id}}" class="btn btn-primary btn-xs">Edit</button>
|
||||
@endif
|
||||
</th>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end .table-responsive -->
|
||||
|
||||
</div> <!-- end .table-rep-plugin-->
|
||||
</div> <!-- end .responsive-table-plugin-->
|
||||
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
|
||||
</div>
|
||||
<!-- end page -->
|
||||
@include('layouts.shared/footer-script')
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "History"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
</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">
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-8 p-2">
|
||||
<h4 class="page-title">{{$formname}}</h4>
|
||||
</div>
|
||||
<div class="col-4 p-2">
|
||||
<a href="/form/downloaddata?form_id={{$form_id}}" class="btn btn-info btn-xs float-end">Download</a>
|
||||
<button type="button" id="emailme" class="btn btn-warning btn-xs float-end me-2">Email</button>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<p>Showing data for last 30 days, please use above button "Download" to download all submissions</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div id="notifications"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 p-0">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="responsive-table-plugin">
|
||||
<div class="table-rep-plugin">
|
||||
<div class="table-responsive" data-pattern="priority-columns">
|
||||
<table id="tech-companies-1" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-priority="1">Submission Date</th>
|
||||
<th data-priority="1" colspan="2">Submitted By</th>
|
||||
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
|
||||
<th data-priority="1">Workflow Status</th>
|
||||
@endif
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'multitextbox')
|
||||
@foreach( $question->options as $k => $v )
|
||||
<th data-priority="1">{{$v}} ({{$question->label}})</th>
|
||||
@endforeach
|
||||
@else
|
||||
<th data-priority="1">{{$question->label}}</th>
|
||||
@endif
|
||||
@endforeach
|
||||
<th data-priority="1">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($submissions as $submission)
|
||||
@if(isset($submission->user_info->name))
|
||||
<tr>
|
||||
<th>{{date("d M Y", strtotime(isset($submission->record_date) ? $submission->record_date : $submission->updatedAt))}}</th>
|
||||
<th>
|
||||
<img src="{{isset($submission->user_info->avatar) ? $submission->user_info->avatar : 'https://ui-avatars.com/api/?background=random&name='.$submission->user_info->name}}" class="rounded-circle avatar-sm" />
|
||||
</th>
|
||||
<td>
|
||||
<h5 class="m-0 fw-normal">{{$submission->user_info->name}}</h5>
|
||||
<p class="mb-0 text-muted"><small>{{$submission->user_info->designation}}</small></p>
|
||||
</td>
|
||||
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' )
|
||||
<td>{{ucwords($submission->workflow_status)}}</td>
|
||||
@endif
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'multitextbox')
|
||||
@foreach( $question->options as $k => $v )
|
||||
<td>{{ isset($submission->formdata->{$k}) ? (is_array($submission->formdata->{$k}) ? implode(', ', $submission->formdata->{$k}) : $submission->formdata->{$k}) : '' }}</td>
|
||||
@endforeach
|
||||
@elseif($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>
|
||||
@endif
|
||||
@endforeach
|
||||
<th>
|
||||
@if( in_array('edit', $submission->actions) )
|
||||
<a href="/form/edit?id={{$submission->id}}" class="btn btn-primary btn-xs">Edit</a>
|
||||
@endif
|
||||
@if(isset($formdata) && isset($formdata->workflow) && $formdata->workflow == 'yes' && $submission->workflow_status == 'unapproved' )
|
||||
<button class="btn btn-success btn-xs btn-approve m-1" submission="{{$submission->id}}">Approve</button>
|
||||
<button class="btn btn-danger btn-xs btn-reject m-1" submission="{{$submission->id}}">Reject</button>
|
||||
@endif
|
||||
</th>
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end .table-responsive -->
|
||||
|
||||
</div> <!-- end .table-rep-plugin-->
|
||||
</div> <!-- end .responsive-table-plugin-->
|
||||
@if($lastkey)
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-info" type="button" id="load-btn"> Load More ... </button>
|
||||
</div>
|
||||
@endif
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
|
||||
</div>
|
||||
<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>
|
||||
|
||||
<!-- end page -->
|
||||
@include('layouts.shared/footer-script')
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('.btn-primary').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
})
|
||||
|
||||
$('#emailme').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/downloaddata?form_id={{$form_id}}&email=1',
|
||||
success: function( data ) {
|
||||
$('#notifications').append('<div class="alert alert-success">Email Sent Successfully</div>');
|
||||
$("#pageloader").fadeOut();
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
var lastkey = '{{$lastkey}}';
|
||||
$('#load-btn').click(function(){
|
||||
$("#pageloader").fadeIn();
|
||||
$.get( "/form/loadmore?lastkey=" + lastkey, function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
lastkey = data.lastkey;
|
||||
$( "#tech-companies-1 tbody" ).append( data.html );
|
||||
if(!data.lastkey) {
|
||||
$('#load-btn').hide()
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
$('.btn-approve').click(function(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/approvereject?action=approve&id=' + $(this).attr('submission'),
|
||||
//data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
console.log(data)
|
||||
},
|
||||
});
|
||||
})
|
||||
$('.btn-reject').click(function(){
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/approvereject?action=reject&id=' + $(this).attr('submission'),
|
||||
//data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
console.log(data)
|
||||
},
|
||||
});
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -52,13 +52,15 @@
|
|||
}
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id, date("m-01-Y", $target) , date("m-t-Y", $target) );
|
||||
|
||||
$conts = [];
|
||||
$contacts = [];
|
||||
foreach($questions as $question) {
|
||||
if($question->code == 'contact_id') {
|
||||
$contacts = $question->options;
|
||||
$conts = $question->options;
|
||||
}
|
||||
}
|
||||
foreach($contacts as &$contact) {
|
||||
|
||||
foreach($conts as $contact) {
|
||||
$contact->duolin_rx = 0;
|
||||
$contact->glycohale_fb_rx = 0;
|
||||
$contact->maxiflo_rx = 0;
|
||||
|
|
@ -78,10 +80,11 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
$contacts[] = $contact;
|
||||
}
|
||||
//echo '<pre>'; print_r($contacts); exit;
|
||||
@endphp
|
||||
|
||||
|
||||
<div class="col-12">
|
||||
<div class="row mb-3">
|
||||
<label for="inputEmail3" class="col-4 col-xl-3 col-form-label">Selected Month</label>
|
||||
|
|
|
|||
|
|
@ -20,31 +20,31 @@
|
|||
<div class="card-body p-3 row">
|
||||
|
||||
@if (Session::has('error'))
|
||||
<div class="alert alert-danger">{{ Session::get('error') }}</div>
|
||||
<br>
|
||||
<div class="alert alert-danger">{{ Session::get('error') }}</div>
|
||||
<br>
|
||||
@endif
|
||||
@if (session('success'))
|
||||
<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>
|
||||
<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> -->
|
||||
<button type="button" class="btn btn-primary btn-xs" id="add-camp-btn">Add
|
||||
Plan</button>
|
||||
@else
|
||||
<a href="{{ url()->previous() }}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@if ($form->link_type == 'form')
|
||||
<!-- <a href="/form/history" class="float-end pt-1">View History</a> -->
|
||||
<button type="button" class="btn btn-primary btn-xs" id="add-camp-btn">Add
|
||||
Plan</button>
|
||||
@else
|
||||
<a href="{{ url()->previous() }}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||
@endphp
|
||||
|
||||
<div class="col-12" id="table-wrapper">
|
||||
|
|
@ -62,47 +62,51 @@
|
|||
<th>Doctor Name</th>
|
||||
<th>Specialty</th>
|
||||
<th>MSL Code</th>
|
||||
<th>Glycohale FB Rx (no)</th>
|
||||
<th>Glycohale FB DPI Rx (no)</th>
|
||||
<th>Glycohale FB MDI Rx (no)</th>
|
||||
<th>Glycohale F Rx (no)</th>
|
||||
<th>Maxiflo Syncrobreathe Rx</th>
|
||||
<th>Maxiflo Rx</th>
|
||||
<th>Duolin Inhaler Rx</th>
|
||||
<th>Duolin Forte Inhaler Rx</th>
|
||||
<th>Duolin Rotacap Rx</th>
|
||||
<th>Duolin Forte Rotacap Rx</th>
|
||||
<th>HQ</th>
|
||||
<th>State</th>
|
||||
<th>Executed as per planned</th>
|
||||
<!-- <th>Upload Glycohale FB DPI Rx</th>
|
||||
<th>Upload Glycohale FB MDI Rx</th>
|
||||
<th>Upload Glycohale F Rx</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($history->data->submissions as $sub)
|
||||
@php
|
||||
$sub->formdata->id = $sub->id;
|
||||
@endphp
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info edit-btn"
|
||||
plan_details="{{ json_encode($sub->formdata) }}" contacts="{{ json_encode($sub->contacts) }}"><i
|
||||
class="mdi mdi-pencil"></i> Edit</button>
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->execution_date) && $sub->formdata->execution_date != '' ? 'Yes' : 'No' }}
|
||||
</td>
|
||||
<td>{{ $sub->formdata->plan_date }}
|
||||
</td>
|
||||
<td>{{ $sub->formdata->execution_date }}
|
||||
</td>
|
||||
<td>
|
||||
<h5 class="m-0 fw-normal">{{ $sub->formdata->contact_id }}</h5>
|
||||
</td>
|
||||
<td>{{ $sub->formdata->speciality }}
|
||||
<td>{{ $sub->formdata->msl_code }}
|
||||
<td>{{ $sub->formdata->gfb_glycohale_fb_rx }}
|
||||
<td>{{ $sub->formdata->gfb_glycohale_f_rx }}
|
||||
<td>{{ $sub->formdata->gfb_maxiflo_syncrobreathe_rx }}
|
||||
<td>{{ $sub->formdata->gfb_maxiflo_rx }}
|
||||
<td>{{ $sub->formdata->gfb_duolin_inhaler_rx }}
|
||||
<td>{{ $sub->formdata->gfb_duolin_rotacap_rx }}</td>
|
||||
<td>{{ $sub->formdata->gfb_duolin_forte_rotacap_rx }}</td>
|
||||
<td>{{ $sub->formdata->gfb_duolin_forte_inhaler_rx }}</td>
|
||||
</tr>
|
||||
@php
|
||||
$sub->formdata->id = $sub->id;
|
||||
@endphp
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info edit-btn" plan_details="{{ json_encode($sub->formdata) }}" contacts="{{ json_encode($sub->contacts) }}"><i class="mdi mdi-pencil"></i> Edit</button>
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->execution_date) && $sub->formdata->execution_date != '' ? 'Yes' : 'No' }}
|
||||
</td>
|
||||
<td>{{ $sub->formdata->plan_date }}
|
||||
</td>
|
||||
<td>{{ $sub->formdata->execution_date }}
|
||||
</td>
|
||||
<td>
|
||||
<h5 class="m-0 fw-normal">
|
||||
{{-- {{print_r($sub->formdata)}} --}}
|
||||
{{ $sub->formdata->contact_id !== '' ? $sub->formdata->contact_id : $sub->formdata->doctor_name }}
|
||||
</h5>
|
||||
</td>
|
||||
<td>{{ $sub->formdata->speciality }}
|
||||
<td>{{ $sub->formdata->msl_code }}
|
||||
<td>{{ $sub->formdata->gfb_glycohale_fb_rx }}
|
||||
<td>{{ $sub->formdata->gfb_glycohale_fb_mdi_rx }}
|
||||
<td>{{ $sub->formdata->gfb_glycohale_f_rx }}
|
||||
<td>{{ $sub->formdata->hq }} </td>
|
||||
<td>{{ $sub->formdata->state }}</td>
|
||||
<td>{{ $sub->formdata->execution_as_per_planned }}</td>
|
||||
<!-- <td>{{ isset($sub->formdata->upload_rx) ? $sub->formdata->upload_rx : '' }}</td>
|
||||
<td>{{ isset($sub->formdata->upload_glycohale_fb_mdi_rx) ? $sub->formdata->upload_glycohale_fb_mdi_rx : '' }}</td>
|
||||
<td>{{ isset($sub->formdata->upload_glycohale_f_rx) ? $sub->formdata->upload_glycohale_f_rx : '' }}</td> -->
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -111,203 +115,159 @@
|
|||
</div>
|
||||
|
||||
<div id="form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="report-form"
|
||||
enctype="multipart/form-data">
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{ $form_id }}">
|
||||
<input type="hidden" name="other_doctor_name" value="">
|
||||
@csrf
|
||||
@if ($id)
|
||||
<input type="hidden" name="id" value="{{ $id }}">
|
||||
<input type="hidden" name="id" value="{{ $id }}">
|
||||
@endif
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'execution_date',
|
||||
'gfb_glycohale_fb_rx',
|
||||
'gfb_glycohale_f_rx',
|
||||
'gfb_duolin_rx',
|
||||
'gfb_maxiflo_syncrobreathe_rx',
|
||||
'gfb_maxiflo_rx',
|
||||
'gfb_duolin_inhaler_rx',
|
||||
'gfb_duolin_rotacap_rx',
|
||||
'gfb_duolin_forte_rotacap_rx',
|
||||
'gfb_duolin_forte_inhaler_rx',
|
||||
'number_patients_screened'
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<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
|
||||
@if (in_array($question->code, [
|
||||
'execution_date',
|
||||
'gfb_glycohale_fb_rx',
|
||||
'gfb_glycohale_fb_mdi_rx',
|
||||
'gfb_glycohale_f_rx',
|
||||
'hq',
|
||||
'state',
|
||||
'execution_as_per_planned',
|
||||
'number_patients_screened',
|
||||
'upload_rx',
|
||||
'upload_glycohale_fb_mdi_rx',
|
||||
'upload_glycohale_f_rx'
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<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('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('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 datepicker"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
@case('date')
|
||||
<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 }}">
|
||||
@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('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'
|
||||
? 'comp_rxber="' . (isset($option->contact->comp_rxber) ? $option->contact->comp_rxber : '') . '"'
|
||||
: '' !!} {!! $question->code == 'contact_id'
|
||||
? 'contact=\'' . (isset($option->contact) ? json_encode($option->contact) : '[]') . '\''
|
||||
: '' !!}>
|
||||
{{ $option->display }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@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'
|
||||
? 'comp_rxber="' . (isset($option->contact->comp_rxber) ? $option->contact->comp_rxber : '') . '"'
|
||||
: '' !!} {!! $question->code == 'contact_id'
|
||||
? 'gfb_mdi="' . (isset($option->contact->gfb_mdi) ? $option->contact->gfb_mdi : '') . '"'
|
||||
: '' !!}
|
||||
{!! $question->code == 'contact_id'
|
||||
? 'contact=\'' . (isset($option->contact) ? json_encode($option->contact) : '[]') . '\''
|
||||
: '' !!}>
|
||||
{{ $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" required>
|
||||
@break
|
||||
@endswitch
|
||||
@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" required>
|
||||
@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>
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="execution-form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="execution-form"
|
||||
enctype="multipart/form-data">
|
||||
<form method="POST" action="/form/submit" id="execution-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{ $form_id }}">
|
||||
@csrf
|
||||
<input type="hidden" name="id" value="" id="execution-id">
|
||||
@foreach ($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $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="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}"
|
||||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $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="execution-{{ $question->code }}" name="{{ $question->code }}" value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('text')
|
||||
@case('email')
|
||||
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{ $question->type }}" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{ $question->type }}" id="execution-{{ $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="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||||
value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{ $question->type }}" min="0" max="9999999999" step="1" id="execution-{{ $question->code }}" name="{{ $question->code }}" class="form-control" {{ $question->required == 'yes' ? 'required' : '' }} value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
|
||||
@case('textarea')
|
||||
<textarea id="execution-{{ $question->code }}" name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}>{{ isset($question->value) ? $question->value : '' }}</textarea>
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="execution-{{ $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="execution-{{ $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'
|
||||
? 'comp_rxber="' . (isset($option->contact->comp_rxber) ? $option->contact->comp_rxber : '') . '"'
|
||||
: '' !!}>{{ $option->display }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="execution-{{ $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'
|
||||
? 'comp_rxber="' . (isset($option->contact->comp_rxber) ? $option->contact->comp_rxber : '') . '"'
|
||||
: '' !!}>{{ $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="execution-{{ $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="execution-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
|
||||
@case('file')
|
||||
<input type="file" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control" value=""
|
||||
accept="image/jpg, image/jpeg, image/png"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
@break
|
||||
@endswitch
|
||||
@case('checkbox')
|
||||
@foreach ($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox" id="execution-{{ $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="execution-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
|
||||
@case('file')
|
||||
<input type="file" id="execution-{{ $question->code }}" name="{{ $question->code }}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
@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>
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
|
@ -350,6 +310,9 @@
|
|||
jQuery(document).ready(function($) {
|
||||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
$('#field-doctor_name').hide();
|
||||
$('label[for="field-doctor_name"]').hide();
|
||||
|
||||
|
||||
$('#add-camp-btn').click(function() {
|
||||
$('#execution-form-wrapper').hide()
|
||||
|
|
@ -361,9 +324,11 @@
|
|||
let c3_doctors = []
|
||||
let all_doctors = []
|
||||
let contacts = []
|
||||
let gfb_mdi_doctor = []
|
||||
|
||||
$('#field-contact_id option').each(function() {
|
||||
if ($(this).val() != '') {
|
||||
console.log($(this).attr('contact'))
|
||||
// console.log($(this).attr('contact'))
|
||||
contacts.push(JSON.parse($(this).attr('contact')))
|
||||
all_doctors.push({
|
||||
value: $(this).val(),
|
||||
|
|
@ -375,35 +340,68 @@
|
|||
text: $(this).html()
|
||||
})
|
||||
}
|
||||
if ($(this).attr('gfb_mdi') == 'Yes') {
|
||||
gfb_mdi_doctor.push({
|
||||
value: $(this).val(),
|
||||
text: $(this).html()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$('#field-activity').change(function() {
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append('<option value=""> -- Select -- </option>')
|
||||
if ($(this).val() == 'GFB Clinic (Glycohale FB)') {
|
||||
if ($(this).val() == 'GFB DPI Clinic' || $(this).val() == 'DRT') {
|
||||
for (let doc of c3_doctors) {
|
||||
$('#field-contact_id').append('<option value="' + doc.value + '">' + doc.text +
|
||||
'</option>')
|
||||
}
|
||||
} else if ($(this).val() == 'GFB MDI clinic') {
|
||||
for (let doc of gfb_mdi_doctor) {
|
||||
$('#field-contact_id').append('<option value="' + doc.value + '">' + doc.text +
|
||||
'</option>')
|
||||
}
|
||||
} else {
|
||||
for (let doc of all_doctors) {
|
||||
console.log(doc)
|
||||
$('#field-contact_id').append('<option value="' + doc.value + '">' + doc.text +
|
||||
'</option>')
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$('#field-speciality').prop('readonly', true)
|
||||
$('#field-msl_code').prop('readonly', true)
|
||||
$('#field-contact_id').change(function() {
|
||||
console.log(contacts)
|
||||
|
||||
let selectedValue = $(this).val();
|
||||
if (selectedValue == 'other') {
|
||||
console.log('jhg')
|
||||
$('#field-contact_id').empty();
|
||||
$('#field-contact_id').append('<option value="">--Select Other Doctor--</option>')
|
||||
|
||||
for (let doc of all_doctors) {
|
||||
$('#field-contact_id').append('<option value="' + doc.value + '">' + doc.text +
|
||||
'</option>');
|
||||
}
|
||||
} else {
|
||||
$("label[for='field-contact_id']").text("Doctor Name")
|
||||
|
||||
}
|
||||
|
||||
let contact = contacts.find(c => c.id == $(this).val())
|
||||
//console.log(contact)
|
||||
$('#field-speciality').val(contact.speciality)
|
||||
$('#field-msl_code').val(contact.msl_code)
|
||||
|
||||
$("label[for='field-contact_id']").text("Select Other Doctor Name")
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
$('.edit-btn').click(function() {
|
||||
let selected = JSON.parse($(this).attr('plan_details'))
|
||||
let contacts = JSON.parse($(this).attr('contacts'))
|
||||
|
|
@ -415,24 +413,25 @@
|
|||
if (k == 'attach_prescription')
|
||||
continue;
|
||||
if (k == 'contact_id') {
|
||||
$('#execution-contact_id').append('<option value="'+contacts[0].id+'" selected>'+contacts[0].name+'</option>');
|
||||
$('#execution-contact_id').append('<option value="' + contacts[0].id +
|
||||
'" selected>' + contacts[0].name + '</option>');
|
||||
console.log(contacts)
|
||||
if(contacts.length > 0) {
|
||||
if (contacts.length > 0) {
|
||||
$('#execution-contact_id')
|
||||
.val(contacts[0].id)
|
||||
.trigger('change');
|
||||
.val(contacts[0].id)
|
||||
.trigger('change');
|
||||
editable = false
|
||||
} else {
|
||||
$('#execution-contact_id')
|
||||
.val($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'))
|
||||
.trigger('change');
|
||||
.val($("#execution-contact_id option:contains(" + selected[k] + ")")
|
||||
.attr('value'))
|
||||
.trigger('change');
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
$('#execution-' + k).val(selected[k]);
|
||||
}
|
||||
}
|
||||
if(!editable){
|
||||
if (!editable) {
|
||||
$('#execution-contact_id').prop('disabled', true)
|
||||
}
|
||||
$('#execution-id').val(selected['id'])
|
||||
|
|
@ -546,16 +545,36 @@
|
|||
|
||||
$('.edit-btn').click(function() {
|
||||
var executionexeField = document.getElementById('execution-execution_date');
|
||||
executionexeField.setAttribute('min', executionDateField.value);
|
||||
// executionexeField.setAttribute('min', executionDateField.value);
|
||||
executionexeField.setAttribute('max', today);
|
||||
|
||||
var doctorNameValue = $('#execution-doctor_name').val();
|
||||
if (doctorNameValue !== '') {
|
||||
$('#execution-doctor_name').show();
|
||||
$('label[for="execution-doctor_name"]').show();
|
||||
|
||||
$('#execution-contact_id').hide();
|
||||
$('label[for="execution-contact_id"]').hide();
|
||||
|
||||
} else {
|
||||
$('#execution-doctor_name').hide();
|
||||
$('label[for="execution-doctor_name"]').hide();
|
||||
|
||||
$('#execution-contact_id').show();
|
||||
$('label[for="execution-contact_id"]').show();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
executionDateField.addEventListener('change', function() {
|
||||
console.log('gg');
|
||||
// console.log('gg');
|
||||
var executionexeField = document.getElementById('execution-execution_date');
|
||||
executionexeField.setAttribute('min', executionDateField.value);
|
||||
// executionexeField.setAttribute('min', executionDateField.value);
|
||||
executionexeField.setAttribute('max', today);
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,540 @@
|
|||
<!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" />
|
||||
<link href="{{ URL::asset('assets/libs/dropify/dropify.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
|
||||
@if (isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{ $form->user_info->name }}</h6>
|
||||
</div>
|
||||
@endif
|
||||
<input type="hidden" name="expert_forum_gfb_clinics_zvt_camp"
|
||||
id="expert_forum_gfb_clinics_zvt_camp" value="0">
|
||||
<input type="hidden" name="expert_forum_gfb_clinics_zvt" id="expert_forum_gfb_clinics_zvt"
|
||||
value="0">
|
||||
<input type="hidden" name="gfb_clinics_zvt" id="gfb_clinics_zvt" value="0">
|
||||
|
||||
<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)
|
||||
@if (
|
||||
$question->type == 'file' &&
|
||||
strpos($question->code, 'upload_rx_file') == 0 &&
|
||||
$question->code != 'upload_rx_file_1')
|
||||
@continue;
|
||||
@endif
|
||||
|
||||
<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>' : '' !!}
|
||||
{{ strpos($question->code, 'upload_rx_file') }}
|
||||
</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->code == 'no_of_rx_count' || $question->code == 'no_of_attachments' ? 'readonly' : '' }}
|
||||
{{ $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)
|
||||
@if ($question->code == 'contact_id')
|
||||
@if (isset($option->contact->gfb_mdi) && $option->contact->gfb_mdi == 'Yes')
|
||||
<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>
|
||||
@endif
|
||||
@elseif($question->code == 'other_doctor_name')
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
||||
{{ $question->code == 'other_doctor_name' ? ' msl_code=' . $option->contact->msl_code : '' }}>
|
||||
{{ $option->display }}</option>
|
||||
@else
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
@if ($question->code == 'contact_id')
|
||||
<option value="other">other</option>
|
||||
@else
|
||||
@endif
|
||||
</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')
|
||||
<div class="row">
|
||||
<div class="col-9 mt-2">
|
||||
<input type="file" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control dropify"
|
||||
value="" accept="image/jpg, image/jpeg, image/png">
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<button type="button" id="btn-add-file"
|
||||
class="btn btn-xs btn-success waves-effect waves-light">Add
|
||||
Attachment</button>
|
||||
|
||||
</div>
|
||||
<div class="image-block">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@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 dropify" 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 src="{{ URL::asset('assets/libs/dropify/dropify.min.js')}}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($) {
|
||||
$('.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).'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#report-form').trigger("reset");
|
||||
$('#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)
|
||||
})
|
||||
|
||||
function delay(time) {
|
||||
return new Promise(resolve => setTimeout(resolve, time));
|
||||
}
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
|
||||
let attachcount = 0;
|
||||
$('input[type=file]').each(function(index) {
|
||||
if ($(this).val()) {
|
||||
attachcount++
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
delay(1000).then(() => {
|
||||
$('#field-no_of_rx_count').val(attachcount)
|
||||
$('#field-no_of_attachments').val(attachcount)
|
||||
var formData = new FormData($('#report-form')[0]);
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
// resetval();
|
||||
$("#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!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// result();
|
||||
|
||||
|
||||
// formData.append('expert_forum_gfb_clinics_zvt_camp', $('#expert_forum_gfb_clinics_zvt_camp')
|
||||
// .val());
|
||||
// formData.append('expert_forum_gfb_clinics_zvt', $('#expert_forum_gfb_clinics_zvt').val());
|
||||
// formData.append('gfb_clinics_zvt', $('#gfb_clinics_zvt').val());
|
||||
|
||||
|
||||
});
|
||||
|
||||
// $('#field-engagement_commitment_1').on('change', function() {
|
||||
// var engagement_commitment_1_val = $('#field-engagement_commitment_1 option:selected').val();
|
||||
// $('#engagement_1').val(engagement_commitment_1_val)
|
||||
// });
|
||||
|
||||
// $('#field-engagement_commitment_2').on('change', function() {
|
||||
// var engagement_commitment_2_val = $('#field-engagement_commitment_2 option:selected').val();
|
||||
// $('#engagement_2').val(engagement_commitment_2_val)
|
||||
// });
|
||||
|
||||
// $('#field-engagement_commitment_3').on('change', function() {
|
||||
// var engagement_commitment_3_val = $('#field-engagement_commitment_3 option:selected').val();
|
||||
// $('#engagement_3').val(engagement_commitment_3_val)
|
||||
// });
|
||||
|
||||
// function result() {
|
||||
// var valueCounts = {};
|
||||
// for (var i = 1; i <= 3; i++) {
|
||||
// var engagementValue = $('#engagement_' + i).val();
|
||||
// if (!(engagementValue in valueCounts)) {
|
||||
// valueCounts[engagementValue] = 0;
|
||||
// }
|
||||
// valueCounts[engagementValue]++;
|
||||
// }
|
||||
|
||||
// for (var value in valueCounts) {
|
||||
// if (valueCounts.hasOwnProperty(value)) {
|
||||
// console.log('Value: ' + value + ', Count: ' + valueCounts[value]);
|
||||
// $('#' + value).val(valueCounts[value])
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
$('#field-gfb_mdi_clinics_execution_date').hide();
|
||||
$('label[for="field-gfb_mdi_clinics_execution_date"]').hide();
|
||||
$('#field-gfb_mdi_clinic_execution').on('change', function() {
|
||||
if ($(this).val() == 'Yes') {
|
||||
$('#field-gfb_mdi_clinics_execution_date').show();
|
||||
$('label[for="field-gfb_mdi_clinics_execution_date"]').show();
|
||||
} else {
|
||||
$('#field-gfb_mdi_clinics_execution_date').hide();
|
||||
$('label[for="field-gfb_mdi_clinics_execution_date"]').hide();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#field-msl_code').prop('readonly', true)
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-other_doctor_name').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-other_doctor_name').hide();
|
||||
$('label[for="field-other_doctor_name"]').hide();
|
||||
|
||||
$('#field-contact_id').on('change', function() {
|
||||
if ($(this).val() == 'other') {
|
||||
$('#field-other_doctor_name').show();
|
||||
$('label[for="field-other_doctor_name"]').show();
|
||||
$('#field-msl_code').prop('readonly', false)
|
||||
|
||||
} else {
|
||||
$('#field-other_doctor_name').hide();
|
||||
$('label[for="field-other_doctor_name"]').hide();
|
||||
$('#field-msl_code').prop('readonly', true)
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#field-chemist_1_pob_unit, #field-chemist_2_pob_unit, #field-chemist_3_pob_unit, #field-chemist_4_pob_unit, #field-chemist_5_pob_unit')
|
||||
.on('keyup', function() {
|
||||
var val1 = Number($('#field-chemist_1_pob_unit').val());
|
||||
var val2 = Number($('#field-chemist_2_pob_unit').val());
|
||||
var val3 = Number($('#field-chemist_3_pob_unit').val());
|
||||
var val4 = Number($('#field-chemist_4_pob_unit').val());
|
||||
var val5 = Number($('#field-chemist_5_pob_unit').val());
|
||||
$('#field-total_pob_unit').val(val1 + val2 + val3 + val4 + val5);
|
||||
});
|
||||
|
||||
|
||||
|
||||
var today = new Date();
|
||||
var dd = String(today.getDate()).padStart(2, '0');
|
||||
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||
var yyyy = today.getFullYear();
|
||||
today = yyyy + '-' + mm + '-' + dd;
|
||||
|
||||
var plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
|
||||
|
||||
// function result() {
|
||||
// var selectedVal = $('#field-engagement_commitment').find(":selected").val();
|
||||
// var unit = $('#field-pob_received_no_inhaler_unit').val();
|
||||
|
||||
// if (selectedVal == 'expert_forum_gfb_clinics_zvt_camp') {
|
||||
// $('#expert_forum_gfb_clinics_zvt_camp').val(unit);
|
||||
// } else if (selectedVal == 'expert_forum_gfb_clinics_zvt') {
|
||||
// $('#expert_forum_gfb_clinics_zvt').val(unit);
|
||||
// } else if (selectedVal == 'gfb_clinics_zvt') {
|
||||
// $('#gfb_clinics_zvt').val(unit);
|
||||
// } else {
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
// function resetval() {
|
||||
// $('#expert_forum_gfb_clinics_zvt_camp').val('0');
|
||||
// $('#expert_forum_gfb_clinics_zvt').val('0');
|
||||
// $('#gfb_clinics_zvt').val('0');
|
||||
// }
|
||||
});
|
||||
|
||||
var fileInputCount = 1;
|
||||
var attachmentcount = 0;
|
||||
var addedFiles = [];
|
||||
|
||||
$('#field-no_of_rx_count').text(attachmentcount)
|
||||
$('#field-no_of_attachments').val(attachmentcount)
|
||||
$('#btn-add-file').click(function() {
|
||||
|
||||
if (fileInputCount > 9) {
|
||||
$("#btn-add-file").prop('disabled', true);
|
||||
return
|
||||
}
|
||||
|
||||
fileInputCount++;
|
||||
attachmentcount++;
|
||||
|
||||
var fileInputId = 'field-upload_rx_' + fileInputCount;
|
||||
|
||||
$('.image-block').append(
|
||||
'<div class="row"><div class="col-9 mt-2"><input type="file" name="upload_rx_file_' +
|
||||
fileInputCount + '" id="field-upload_rx_file_' + fileInputCount +
|
||||
'" class="form-control dropify" required></div><div class="col-3 mt-2"><button type="button" class="btn btn-danger waves-effect waves-light btn-remove">Remove</button></div></div>'
|
||||
);
|
||||
|
||||
addedFiles.push(fileInputId);
|
||||
console.log(addedFiles);
|
||||
|
||||
$('.btn-remove').unbind();
|
||||
$('.btn-remove').click(function() {
|
||||
$(this).parent().parent().remove();
|
||||
attachmentcount--;
|
||||
$('#field-no_of_rx_count').val(attachmentcount)
|
||||
$('#field-no_of_attachments').val(attachmentcount)
|
||||
});
|
||||
$('#field-no_of_rx_count').val(attachmentcount)
|
||||
$('#field-no_of_attachments').val(attachmentcount)
|
||||
|
||||
$('.dropify').unbind()
|
||||
$('.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).'
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#field-upload_rx_file_1')
|
||||
.change(function() {
|
||||
if ($(this)[0].files.length > 0) {
|
||||
attachmentcount++;
|
||||
} else {
|
||||
attachmentcount--;
|
||||
}
|
||||
$('#field-no_of_rx_count').val(attachmentcount)
|
||||
$('#field-no_of_attachments').val(attachmentcount)
|
||||
});
|
||||
|
||||
|
||||
// var fileCount = 0;
|
||||
// $('#execution-upload_rx_file_1, #execution-upload_rx_file_2, #execution-upload_rx_file_3, #execution-upload_rx_file_4, #execution-upload_rx_file_5, #execution-upload_rx_file_6, #execution-upload_rx_file_7, #execution-upload_rx_file_8, #execution-upload_rx_file_9, #execution-upload_rx_file_10')
|
||||
// .change(function() {
|
||||
// if ($(this)[0].files.length > 0) {
|
||||
// fileCount++;
|
||||
// }else{
|
||||
// fileCount--;
|
||||
// }
|
||||
// $("#field-no_of_rx_count").val(fileCount);
|
||||
// $("#field-no_of_attachments").val(fileCount);
|
||||
// });
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,438 @@
|
|||
<!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
|
||||
@if (isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{ $form->user_info->name }}</h6>
|
||||
</div>
|
||||
@endif
|
||||
<input type="hidden" name="expert_forum_gfb_clinics_zvt_camp"
|
||||
id="expert_forum_gfb_clinics_zvt_camp" value="0">
|
||||
<input type="hidden" name="expert_forum_gfb_clinics_zvt" id="expert_forum_gfb_clinics_zvt"
|
||||
value="0">
|
||||
<input type="hidden" name="gfb_clinics_zvt" id="gfb_clinics_zvt" value="0">
|
||||
|
||||
<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->code == 'no_of_rx_count' || $question->code == 'no_of_attachments' ? 'readonly' : '' }}
|
||||
{{ $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)
|
||||
@if ($question->code == 'contact_id')
|
||||
@if (isset($option->contact->gfb_mdi) && $option->contact->gfb_mdi == 'Yes')
|
||||
<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>
|
||||
@endif
|
||||
@else
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
@if ($question->code == 'contact_id')
|
||||
<option value="other">other</option>
|
||||
@else
|
||||
@endif
|
||||
</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="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control file-box"
|
||||
value="" accept="image/jpg, image/jpeg, image/png">
|
||||
@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($) {
|
||||
$('#report-form').trigger("reset");
|
||||
$('#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();
|
||||
// result();
|
||||
var formData = new FormData($('#report-form')[0]);
|
||||
|
||||
// formData.append('expert_forum_gfb_clinics_zvt_camp', $('#expert_forum_gfb_clinics_zvt_camp')
|
||||
// .val());
|
||||
// formData.append('expert_forum_gfb_clinics_zvt', $('#expert_forum_gfb_clinics_zvt').val());
|
||||
// formData.append('gfb_clinics_zvt', $('#gfb_clinics_zvt').val());
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
// resetval();
|
||||
$("#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!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// $('#field-engagement_commitment_1').on('change', function() {
|
||||
// var engagement_commitment_1_val = $('#field-engagement_commitment_1 option:selected').val();
|
||||
// $('#engagement_1').val(engagement_commitment_1_val)
|
||||
// });
|
||||
|
||||
// $('#field-engagement_commitment_2').on('change', function() {
|
||||
// var engagement_commitment_2_val = $('#field-engagement_commitment_2 option:selected').val();
|
||||
// $('#engagement_2').val(engagement_commitment_2_val)
|
||||
// });
|
||||
|
||||
// $('#field-engagement_commitment_3').on('change', function() {
|
||||
// var engagement_commitment_3_val = $('#field-engagement_commitment_3 option:selected').val();
|
||||
// $('#engagement_3').val(engagement_commitment_3_val)
|
||||
// });
|
||||
|
||||
// function result() {
|
||||
// var valueCounts = {};
|
||||
// for (var i = 1; i <= 3; i++) {
|
||||
// var engagementValue = $('#engagement_' + i).val();
|
||||
// if (!(engagementValue in valueCounts)) {
|
||||
// valueCounts[engagementValue] = 0;
|
||||
// }
|
||||
// valueCounts[engagementValue]++;
|
||||
// }
|
||||
|
||||
// for (var value in valueCounts) {
|
||||
// if (valueCounts.hasOwnProperty(value)) {
|
||||
// console.log('Value: ' + value + ', Count: ' + valueCounts[value]);
|
||||
// $('#' + value).val(valueCounts[value])
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
$('#field-gfb_mdi_clinics_execution_date').hide();
|
||||
$('label[for="field-gfb_mdi_clinics_execution_date"]').hide();
|
||||
$('#field-gfb_mdi_clinic_execution').on('change', function() {
|
||||
if ($(this).val() == 'Yes') {
|
||||
$('#field-gfb_mdi_clinics_execution_date').show();
|
||||
$('label[for="field-gfb_mdi_clinics_execution_date"]').show();
|
||||
} else {
|
||||
$('#field-gfb_mdi_clinics_execution_date').hide();
|
||||
$('label[for="field-gfb_mdi_clinics_execution_date"]').hide();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#field-msl_code').prop('readonly', true)
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-other_doctor_name').hide();
|
||||
$('label[for="field-other_doctor_name"]').hide();
|
||||
|
||||
$('#field-contact_id').on('change', function() {
|
||||
if ($(this).val() == 'other') {
|
||||
$('#field-other_doctor_name').show();
|
||||
$('label[for="field-other_doctor_name"]').show();
|
||||
$('#field-msl_code').prop('readonly', false)
|
||||
|
||||
} else {
|
||||
$('#field-other_doctor_name').hide();
|
||||
$('label[for="field-other_doctor_name"]').hide();
|
||||
$('#field-msl_code').prop('readonly', true)
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$('#field-chemist_1_pob_unit, #field-chemist_2_pob_unit, #field-chemist_3_pob_unit, #field-chemist_4_pob_unit, #field-chemist_5_pob_unit')
|
||||
.on('keyup', function() {
|
||||
var val1 = Number($('#field-chemist_1_pob_unit').val());
|
||||
var val2 = Number($('#field-chemist_2_pob_unit').val());
|
||||
var val3 = Number($('#field-chemist_3_pob_unit').val());
|
||||
var val4 = Number($('#field-chemist_4_pob_unit').val());
|
||||
var val5 = Number($('#field-chemist_5_pob_unit').val());
|
||||
$('#field-total_pob_unit').val(val1 + val2 + val3 + val4 + val5);
|
||||
});
|
||||
|
||||
|
||||
|
||||
var today = new Date();
|
||||
var dd = String(today.getDate()).padStart(2, '0');
|
||||
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||
var yyyy = today.getFullYear();
|
||||
today = yyyy + '-' + mm + '-' + dd;
|
||||
|
||||
var plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
|
||||
|
||||
// function result() {
|
||||
// var selectedVal = $('#field-engagement_commitment').find(":selected").val();
|
||||
// var unit = $('#field-pob_received_no_inhaler_unit').val();
|
||||
|
||||
// if (selectedVal == 'expert_forum_gfb_clinics_zvt_camp') {
|
||||
// $('#expert_forum_gfb_clinics_zvt_camp').val(unit);
|
||||
// } else if (selectedVal == 'expert_forum_gfb_clinics_zvt') {
|
||||
// $('#expert_forum_gfb_clinics_zvt').val(unit);
|
||||
// } else if (selectedVal == 'gfb_clinics_zvt') {
|
||||
// $('#gfb_clinics_zvt').val(unit);
|
||||
// } else {
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
// function resetval() {
|
||||
// $('#expert_forum_gfb_clinics_zvt_camp').val('0');
|
||||
// $('#expert_forum_gfb_clinics_zvt').val('0');
|
||||
// $('#gfb_clinics_zvt').val('0');
|
||||
// }
|
||||
});
|
||||
|
||||
// var fileInputCount = 0;
|
||||
// var attachmentcount = 0;
|
||||
// var addedFiles = [];
|
||||
|
||||
// $('#field-no_of_rx_count').val(attachmentcount)
|
||||
// $('#btn-add-file').click(function() {
|
||||
// fileInputCount++;
|
||||
// attachmentcount++;
|
||||
|
||||
// var fileInputId = 'field-{{ $question->code }}_' + fileInputCount;
|
||||
|
||||
// $('.image-block').append(
|
||||
// '<div class="row"><div class="col-9 mt-2"><input type="file" name="field-{{ $question->code }}_' +
|
||||
// fileInputCount + '" id="field-{{ $question->code }}_' + fileInputCount +
|
||||
// '" class="form-control" required></div><div class="col-3 mt-2"><button type="button" class="btn btn-danger waves-effect waves-light btn-remove">Remove</button></div></div>'
|
||||
// );
|
||||
|
||||
// addedFiles.push(fileInputId);
|
||||
// console.log(addedFiles);
|
||||
|
||||
// $('.btn-remove').unbind();
|
||||
// $('.btn-remove').click(function() {
|
||||
// $(this).parent().parent().remove();
|
||||
// attachmentcount--;
|
||||
// $('#field-no_of_rx_count').val(attachmentcount)
|
||||
// });
|
||||
// $('#field-no_of_rx_count').val(attachmentcount)
|
||||
// });
|
||||
|
||||
var fileCount = 0;
|
||||
$('#execution-upload_rx_file_1, #execution-upload_rx_file_2, #execution-upload_rx_file_3, #execution-upload_rx_file_4, #execution-upload_rx_file_5, #execution-upload_rx_file_6, #execution-upload_rx_file_7, #execution-upload_rx_file_8, #execution-upload_rx_file_9, #execution-upload_rx_file_10')
|
||||
.change(function() {
|
||||
if ($(this)[0].files.length > 0) {
|
||||
fileCount++;
|
||||
}else{
|
||||
fileCount--;
|
||||
}
|
||||
$("#field-no_of_rx_count").val(fileCount);
|
||||
$("#field-no_of_attachments").val(fileCount);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,276 @@
|
|||
<!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
|
||||
@if(isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{$form->user_info->name}}</h6>
|
||||
</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)
|
||||
@if ($question->code == 'contact_id')
|
||||
@if (isset($option->contact->glycohale_fb_sb) && $option->contact->glycohale_fb_sb == 'Yes')
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endif
|
||||
@else
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endif
|
||||
@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')
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" {{$question->required == 'yes'?'required':'' }}>
|
||||
@elseif(isset($question->value))
|
||||
<img src="{{$question->value}}" class="img-fluid">
|
||||
@endif
|
||||
|
||||
@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)
|
||||
})
|
||||
|
||||
$('<option value="others">Others</option>').appendTo('#field-contact_id');
|
||||
$('#field-doctor_name').parent().hide();
|
||||
$('#field-pcode').parent().hide();
|
||||
const doctorName = document.querySelector("#field-doctor_name");
|
||||
const pcode=document.querySelector("#field-pcode");
|
||||
$(doctorName).prop('required',false);
|
||||
$(pcode).prop('required',false);
|
||||
|
||||
// let selVal = $('#field-contact_id').value();
|
||||
// if(selVal !== 'others') {
|
||||
// const doctorName = document.querySelector("#field-doctor_name");
|
||||
// const pcode=document.querySelector("#field-pcode");
|
||||
// $(doctorName).prop('required',false);
|
||||
// $(pcode).prop('required',false);
|
||||
// }
|
||||
$('#field-contact_id').on('change', function(e) {
|
||||
|
||||
|
||||
const doctorName = document.querySelector("#field-doctor_name");
|
||||
const pcode=document.querySelector("#field-pcode");
|
||||
|
||||
|
||||
if (this.value.toLowerCase() === 'others') {
|
||||
$(doctorName).parent().css('display', 'block');
|
||||
$(pcode).parent().css('display', 'block');
|
||||
$(doctorName).prop('required',true);
|
||||
$(pcode).prop('required',true);
|
||||
|
||||
|
||||
}
|
||||
else if(this.value.toLowerCase() === ''){
|
||||
$(doctorName).parent().css('display', 'none');
|
||||
$(pcode).parent().css('display', 'none');
|
||||
$(doctorName).prop('required',false);
|
||||
$(pcode).prop('required',false);
|
||||
}
|
||||
|
||||
else {
|
||||
$(doctorName).parent().css('display', 'none');
|
||||
$(pcode).parent().css('display', 'none');
|
||||
$(doctorName).prop('required',false);
|
||||
$(pcode).prop('required',false);
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('#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!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
var today = new Date();
|
||||
var dd = String(today.getDate()).padStart(2, '0');
|
||||
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||
var yyyy = today.getFullYear();
|
||||
today = yyyy + '-' + mm + '-' + dd;
|
||||
|
||||
var plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -20,31 +20,31 @@
|
|||
<div class="card-body p-3 row">
|
||||
|
||||
@if (Session::has('error'))
|
||||
<div class="alert alert-danger">{{ Session::get('error') }}</div>
|
||||
<br>
|
||||
<div class="alert alert-danger">{{ Session::get('error') }}</div>
|
||||
<br>
|
||||
@endif
|
||||
@if (session('success'))
|
||||
<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>
|
||||
<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>
|
||||
@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">Planned HBA1C Camps</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> -->
|
||||
<button type="button" class="btn btn-primary btn-xs" id="add-camp-btn">Add
|
||||
Plan</button>
|
||||
@else
|
||||
<a href="{{ url()->previous() }}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@if ($form->link_type == 'form')
|
||||
<!-- <a href="/form/history" class="float-end pt-1">View History</a> -->
|
||||
<button type="button" class="btn btn-primary btn-xs" id="add-camp-btn">Add
|
||||
Plan</button>
|
||||
@else
|
||||
<a href="{{ url()->previous() }}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||
@endphp
|
||||
|
||||
<div class="col-12" id="table-wrapper">
|
||||
|
|
@ -61,29 +61,32 @@
|
|||
<th>Doctor</th>
|
||||
<th>Gforce ID/UID No.</th>
|
||||
<th>Time</th>
|
||||
<th>Document</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($history->data->submissions as $sub)
|
||||
@php
|
||||
$sub->formdata->id = $sub->id;
|
||||
@endphp
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info edit-btn"
|
||||
plan_details="{{ json_encode($sub->formdata) }}"><i
|
||||
class="mdi mdi-pencil"></i> Edit</button>
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->hba1c_total_rx) && $sub->formdata->hba1c_total_rx > 0 ? 'Yes' : 'No' }}
|
||||
</td>
|
||||
<td>{{ $sub->formdata->camp_date }}</td>
|
||||
<td>
|
||||
<h5 class="m-0 fw-normal">{{ $sub->formdata->contact_id }}</h5>
|
||||
</td>
|
||||
<td>{{ $sub->formdata->gforce_id }}</td>
|
||||
<td>{{ $sub->formdata->start_time_of_camp }}</td>
|
||||
</tr>
|
||||
@php
|
||||
$sub->formdata->id = $sub->id;
|
||||
@endphp
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info edit-btn" plan_details="{{ json_encode($sub->formdata) }}"><i class="mdi mdi-pencil"></i> Edit</button>
|
||||
</td>
|
||||
<td>{{ isset($sub->formdata->hba1c_total_rx) && $sub->formdata->hba1c_total_rx > 0 ? 'Yes' : 'No' }}
|
||||
</td>
|
||||
<td>{{ $sub->formdata->camp_date }}</td>
|
||||
<td>
|
||||
<h5 class="m-0 fw-normal">{{ $sub->formdata->contact_id }}</h5>
|
||||
</td>
|
||||
<td>{{ $sub->formdata->gforce_id }}</td>
|
||||
<td>{{ $sub->formdata->start_time_of_camp }}</td>
|
||||
<td>{{ $sub->formdata->camp_to_be_executed_by }}</td>
|
||||
<td>
|
||||
<a target="_blank" href="{{ isset($sub->formdata->supported_document) ? $sub->formdata->supported_document : '' }}" download="{{ isset($sub->formdata->supported_document) ? $sub->formdata->supported_document : '' }}" class="btn btn-dark btn-xs"><i class="mdi mdi-cloud-download me-1"></i> Download</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -92,189 +95,315 @@
|
|||
</div>
|
||||
|
||||
<div id="form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="report-form"
|
||||
enctype="multipart/form-data">
|
||||
<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 }}">
|
||||
<input type="hidden" name="id" value="{{ $id }}">
|
||||
@endif
|
||||
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'record_date',
|
||||
'no_of_patients',
|
||||
'hba1c_zitamet_zita_rx',
|
||||
'hba1c_zita_pio_met_rx',
|
||||
'hba1c_zita_d_rx',
|
||||
'hba1c_telma_ln_range_rx',
|
||||
'hba1c_total_rx',
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<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
|
||||
@if (in_array($question->code, [
|
||||
'record_date',
|
||||
'no_of_patients',
|
||||
'hba1c_zitamet_zita_rx',
|
||||
'hba1c_zita_pio_met_rx',
|
||||
'hba1c_zita_d_rx',
|
||||
'hba1c_telma_ln_range_rx',
|
||||
'hba1c_total_rx',
|
||||
'hba1c_zita_dm_rx',
|
||||
'executed_as_planned',
|
||||
'supported_document',
|
||||
'upload_support_docimage',
|
||||
|
||||
@case('text')
|
||||
@case('email')
|
||||
'upload_any_other_supporting_document'
|
||||
|
||||
@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
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
|
||||
@case('date')
|
||||
<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
|
||||
<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('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('text')
|
||||
@case('email')
|
||||
|
||||
@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('tel')
|
||||
<input type="{{ $question->type }}" id="field-{{ $question->code }}" name="{{ $question->code }}" class="form-control" {{ $question->required == 'yes' ? 'required' : '' }} {{-- {{ $question->code == 'camp_location_pincode' ? 'pattern="\d*" maxlength="6"' : '' }} --}} {{ $question->code == 'camp_date' ? 'min="' . date('Y-m-d', strtotime('now') + 604800) . '"' : '' }} value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@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('date')
|
||||
<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('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('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('file')
|
||||
<input type="file" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control" value=""
|
||||
accept="image/jpg, image/jpeg, image/png" required>
|
||||
@break
|
||||
@endswitch
|
||||
@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">
|
||||
@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>
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="execution-form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="execution-form"
|
||||
enctype="multipart/form-data">
|
||||
<form method="POST" action="/form/submit" id="execution-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{ $form_id }}">
|
||||
@csrf
|
||||
<input type="hidden" name="id" value="" id="execution-id">
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'hba1c_zitamet_zita_rx',
|
||||
'hba1c_zita_pio_met_rx',
|
||||
'hba1c_zita_d_rx',
|
||||
'hba1c_telma_ln_range_rx',
|
||||
'hba1c_total_rx',
|
||||
'hba1c_zita_dm_rx',
|
||||
'supported_document',
|
||||
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
|
||||
<label for="execution-{{ $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="execution-{{ $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="execution-{{ $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 }}" {{ $question->code == 'camp_location_pincode' ? 'min=0 max=999999' : 'min=0 max=9999999999' }} step="1" id="execution-{{ $question->code }}" name="{{ $question->code }}" class="form-control" {{ $question->required == 'yes' ? 'required' : '' }} value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
|
||||
@case('textarea')
|
||||
<textarea id="execution-{{ $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="execution-{{ $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="execution-{{ $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="execution-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
|
||||
@case('file')
|
||||
<input type="file" id="execution-{{ $question->code }}" name="{{ $question->code }}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png">
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<div class="col-md-12 mb-2 p-1" style="background-color: #C8E6C9; border: 1px solid black !important">
|
||||
<h6>Focus Brands / SKU</h6>
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'record_date',
|
||||
'no_of_patients',
|
||||
'doctor_email',
|
||||
'camp_location_pincode',
|
||||
'camp_date',
|
||||
'camp_to_be_executed_by',
|
||||
'hba1c_zita_pio_met_rx',
|
||||
'hba1c_zita_d_rx',
|
||||
'hba1c_telma_ln_range_rx',
|
||||
'hba1c_total_rx',
|
||||
'fso_mobile_no',
|
||||
'fso_whatsapp_no',
|
||||
'contact_id',
|
||||
'speciality',
|
||||
'gforce_id',
|
||||
'camp_address',
|
||||
'start_time_of_camp',
|
||||
'tentative_closing_time',
|
||||
'expected_no_of_testing',
|
||||
'hba1c_zita_dm_rx',
|
||||
'executed_as_planned',
|
||||
'supported_document',
|
||||
'upload_support_docimage',
|
||||
'upload_any_other_supporting_document'
|
||||
|
||||
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $question->code }}"
|
||||
class="form-label">{{ $question->question }} {!! $question->required == 'yes' ? '<span class="text-danger">*</span>' : '' !!}
|
||||
<label for="execution-{{ $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="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}"
|
||||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
@case('hidden')
|
||||
<input type="{{ $question->type }}" id="execution-{{ $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="execution-{{ $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="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||||
value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
|
||||
@case('textarea')
|
||||
<textarea id="execution-{{ $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="execution-{{ $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="execution-{{ $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="execution-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
|
||||
@case('file')
|
||||
<input type="file" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control" value=""
|
||||
accept="image/jpg, image/jpeg, image/png" required>
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{ $question->type }}" min="0" max="9999999999" step="1" id="execution-{{ $question->code }}" name="{{ $question->code }}" class="form-control" {{ $question->required == 'yes' ? 'required' : '' }} value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@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>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mb-2 p-1" style="border: 1px solid black !important">
|
||||
<h6>Other Brands / SKU</h6>
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'record_date',
|
||||
'no_of_patients',
|
||||
'doctor_email',
|
||||
'camp_location_pincode',
|
||||
'camp_date',
|
||||
'camp_to_be_executed_by',
|
||||
'fso_mobile_no',
|
||||
'fso_whatsapp_no',
|
||||
'contact_id',
|
||||
'speciality',
|
||||
'gforce_id',
|
||||
'camp_address',
|
||||
'start_time_of_camp',
|
||||
'tentative_closing_time',
|
||||
'expected_no_of_testing',
|
||||
'hba1c_zitamet_zita_rx',
|
||||
'hba1c_total_rx',
|
||||
'executed_as_planned',
|
||||
'supported_document',
|
||||
'upload_support_docimage',
|
||||
|
||||
'upload_any_other_supporting_document'
|
||||
|
||||
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $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="execution-{{ $question->code }}" name="{{ $question->code }}" value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
|
||||
@case('number')
|
||||
<input type="{{ $question->type }}" min="0" max="9999999999" step="1" id="execution-{{ $question->code }}" name="{{ $question->code }}" class="form-control" {{ $question->required == 'yes' ? 'required' : '' }} value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'record_date',
|
||||
'no_of_patients',
|
||||
'doctor_email',
|
||||
'camp_location_pincode',
|
||||
'camp_date',
|
||||
'camp_to_be_executed_by',
|
||||
'hba1c_zita_pio_met_rx',
|
||||
'hba1c_zita_d_rx',
|
||||
'hba1c_telma_ln_range_rx',
|
||||
'fso_mobile_no',
|
||||
'fso_whatsapp_no',
|
||||
'contact_id',
|
||||
'speciality',
|
||||
'gforce_id',
|
||||
'camp_address',
|
||||
'start_time_of_camp',
|
||||
'tentative_closing_time',
|
||||
'expected_no_of_testing',
|
||||
'hba1c_zitamet_zita_rx',
|
||||
'hba1c_zita_dm_rx',
|
||||
'executed_as_planned',
|
||||
'upload_support_docimage',
|
||||
'upload_any_other_supporting_document'
|
||||
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $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="execution-{{ $question->code }}" name="{{ $question->code }}" value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
|
||||
@case('number')
|
||||
<input type="{{ $question->type }}" min="0" max="9999999999" step="1" id="execution-{{ $question->code }}" name="{{ $question->code }}" class="form-control" {{ $question->required == 'yes' ? 'required' : '' }} value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
@case('file')
|
||||
<input type="file" id="field-{{ $question->code }}" name="{{ $question->code }}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png">
|
||||
@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>
|
||||
|
|
@ -314,7 +443,37 @@
|
|||
<script src="{{ asset('assets/libs/sweetalert2/sweetalert2.min.js') }}"></script>
|
||||
<script src="{{ asset('assets/libs/flatpickr/flatpickr.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
function restrictAlphabets(e) {
|
||||
var x = e.which || e.keycode;
|
||||
if ((x >= 48 && x <= 57))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-gforce_id').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-camp_location_pincode').on('change', function() {
|
||||
let pincode = document.getElementById("field-camp_location_pincode").value;
|
||||
if (pincode.length < 6 || pincode.length > 6) {
|
||||
alert('Pincode must have 6 digit numeric value');
|
||||
$('#field-camp_location_pincode').val('');
|
||||
return false;
|
||||
}
|
||||
if (!/^[0-9]+$/.test(pincode)) {
|
||||
alert("Please only enter numeric characters only");
|
||||
$('#field-camp_location_pincode').val('');
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
|
||||
|
|
@ -327,7 +486,7 @@
|
|||
$('#execution-fso_mobile_no').prop('readonly', true)
|
||||
$('#execution-fso_whatsapp_no').prop('readonly', true)
|
||||
$('#execution-doctor_email').prop('readonly', true)
|
||||
//$('#execution-contact_id').prop('disabled', true)
|
||||
$('#execution-contact_id').prop('readonly', true)
|
||||
$('#execution-speciality').prop('readonly', true)
|
||||
$('#execution-gforce_id').prop('readonly', true)
|
||||
$('#execution-camp_address').prop('readonly', true)
|
||||
|
|
@ -336,12 +495,26 @@
|
|||
$('#execution-tentative_closing_time').prop('readonly', true)
|
||||
$('#execution-expected_no_of_testing').prop('readonly', true)
|
||||
$('#execution-camp_date').prop('readonly', true)
|
||||
$('#execution-camp_to_be_executed_by').prop('readonly', true)
|
||||
//$('#execution-time').prop('disabled', true)
|
||||
|
||||
let selected = JSON.parse($(this).attr('plan_details'))
|
||||
console.log(selected)
|
||||
for (let k of Object.keys(selected)) {
|
||||
if (selected[k] != '')
|
||||
$('#execution-' + k).val(selected[k]);
|
||||
if (selected[k] != '') {
|
||||
if (k == 'contact_id') {
|
||||
console.log(selected['cont_id'])
|
||||
//$("#execution-contact_id option:contains(" + selected[k] + ")").prop('selected', true)
|
||||
// console.log($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'))
|
||||
//$('#execution-contact_id').val($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'));
|
||||
//$('#execution-contact_id').val(selected['cont_id']).trigger("change");
|
||||
//$('#execution-contact_id option [value='+selected['cont_id']+']').attr('selected', 'true');
|
||||
$('#execution-contact_id').append('<option value="'+selected['cont_id']+'" selected>'+selected['contact_id']+'</option>')
|
||||
} else
|
||||
$('#execution-' + k).val(selected[k]);
|
||||
}
|
||||
// if(selected[k] != '')
|
||||
// $('#execution-'+k).val(selected[k]);
|
||||
}
|
||||
let docid = $('#execution-contact_id option').map(function() {
|
||||
if ($(this).text() == selected['contact_id']) return this;
|
||||
|
|
@ -355,12 +528,15 @@
|
|||
|
||||
$('#execution-hba1c_total_rx').prop('readonly', true);
|
||||
|
||||
$('#execution-hba1c_zitamet_zita_rx,#execution-hba1c_zita_pio_met_rx,#execution-hba1c_zita_d_rx,#execution-hba1c_telma_ln_range_rx')
|
||||
$('#execution-hba1c_zitamet_zita_rx,#execution-hba1c_zita_pio_met_rx,#execution-hba1c_zita_d_rx,#execution-hba1c_telma_ln_range_rx,#execution-hba1c_zita_dm_rx')
|
||||
.change(function() {
|
||||
$('#execution-hba1c_total_rx').val(parseInt($('#execution-hba1c_zitamet_zita_rx').val()) +
|
||||
parseInt($('#execution-hba1c_zita_pio_met_rx').val()) +
|
||||
parseInt($('#execution-hba1c_zita_d_rx').val()) +
|
||||
parseInt($('#execution-hba1c_telma_ln_range_rx').val()))
|
||||
parseInt($('#execution-hba1c_telma_ln_range_rx').val()) +
|
||||
parseInt($('#execution-hba1c_zita_dm_rx').val())
|
||||
)
|
||||
|
||||
})
|
||||
|
||||
document.getElementById("field-camp_date").value = "{{ date('Y-m-d') }}";
|
||||
|
|
@ -384,6 +560,7 @@
|
|||
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
|
|
@ -470,4 +647,4 @@
|
|||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -111,6 +111,9 @@
|
|||
'ddc_total_rx',
|
||||
'remarks',
|
||||
'rx_upload',
|
||||
'ddc_zita_zita_met_rx',
|
||||
'ddc_zita_dm_rx',
|
||||
'executed_as_planned'
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
|
|
@ -156,7 +159,8 @@
|
|||
<option value=""> -- Select -- </option>
|
||||
@foreach ($question->options as $option)
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>{{ $option->display }}</option>
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
|
|
@ -198,6 +202,19 @@
|
|||
@csrf
|
||||
<input type="hidden" name="id" value="" id="execution-id">
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'ddc_zita_zita_met_rx',
|
||||
'ddc_zitaplus_zitamet_plus_rx',
|
||||
'ddc_zitaplus_r_rx',
|
||||
'ddc_zitapio_rx',
|
||||
'ddc_telma_ln_lnc_lnbeta_rx',
|
||||
'ddc_zita_d_rx',
|
||||
'ddc_zita_pio_met_rx',
|
||||
'ddc_total_rx',
|
||||
'ddc_zita_dm_rx'
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $question->code }}"
|
||||
class="form-label">{{ $question->question }} {!! $question->required == 'yes' ? '<span class="text-danger">*</span>' : '' !!}
|
||||
|
|
@ -240,7 +257,8 @@
|
|||
<option value=""> -- Select -- </option>
|
||||
@foreach ($question->options as $option)
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>{{ $option->display }}</option>
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
|
|
@ -266,6 +284,200 @@
|
|||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
|
||||
<div class="col-md-12 mb-2 p-1"
|
||||
style="background-color: #C8E6C9; border: 1px solid black !important">
|
||||
<h6>Focus Brands / SKU</h6>
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'contact_id',
|
||||
'city',
|
||||
'speciality',
|
||||
'gforce_id_uid',
|
||||
'plan_date',
|
||||
'time',
|
||||
'record_date',
|
||||
'no_of_patients',
|
||||
'remarks',
|
||||
'rx_upload',
|
||||
'ddc_zitaplus_zitamet_plus_rx',
|
||||
'ddc_zitaplus_r_rx',
|
||||
'ddc_zitapio_rx',
|
||||
'ddc_telma_ln_lnc_lnbeta_rx',
|
||||
'ddc_zita_d_rx',
|
||||
'ddc_zita_pio_met_rx',
|
||||
'ddc_total_rx',
|
||||
'ddc_zita_dm_rx',
|
||||
'executed_as_planned'
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $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="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}"
|
||||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
|
||||
@case('number')
|
||||
<input type="{{ $question->type }}" min="0" max="9999999999"
|
||||
step="1" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||||
value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mb-2 p-1" style="border: 1px solid black !important">
|
||||
<h6>Other Brands / SKU</h6>
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'contact_id',
|
||||
'city',
|
||||
'speciality',
|
||||
'gforce_id_uid',
|
||||
'plan_date',
|
||||
'time',
|
||||
'record_date',
|
||||
'no_of_patients',
|
||||
'remarks',
|
||||
'rx_upload',
|
||||
'ddc_zita_zita_met_rx',
|
||||
'ddc_total_rx',
|
||||
'executed_as_planned'
|
||||
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $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="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}"
|
||||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
|
||||
@case('number')
|
||||
<input type="{{ $question->type }}" min="0" max="9999999999"
|
||||
step="1" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||||
value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'contact_id',
|
||||
'city',
|
||||
'speciality',
|
||||
'gforce_id_uid',
|
||||
'plan_date',
|
||||
'time',
|
||||
'record_date',
|
||||
'no_of_patients',
|
||||
'remarks',
|
||||
'rx_upload',
|
||||
'ddc_zita_zita_met_rx',
|
||||
'ddc_zitaplus_zitamet_plus_rx',
|
||||
'ddc_zitaplus_r_rx',
|
||||
'ddc_zitapio_rx',
|
||||
'ddc_telma_ln_lnc_lnbeta_rx',
|
||||
'ddc_zita_d_rx',
|
||||
'ddc_zita_pio_met_rx',
|
||||
'ddc_zita_dm_rx',
|
||||
'executed_as_planned'
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $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="execution-{{ $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="execution-{{ $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="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||||
value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
|
||||
@case('textarea')
|
||||
<textarea id="execution-{{ $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="execution-{{ $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="execution-{{ $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="execution-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
|
||||
@case('file')
|
||||
<input type="file" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control" value=""
|
||||
accept="image/jpg, image/jpeg, image/png">
|
||||
@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
|
||||
|
|
@ -343,15 +555,17 @@
|
|||
|
||||
$('#execution-ddc_total_rx').prop('readonly', true);
|
||||
|
||||
$('#execution-ddc_zitaplus_zitamet_plus_rx,#execution-ddc_zitaplus_r_rx,#execution-ddc_zitapio_rx,#execution-ddc_zitaplus_r_rx,#execution-ddc_zitapio_rx,#execution-ddc_telma_ln_lnc_lnbeta_rx,#execution-ddc_zita_d_rx,#execution-ddc_zita_pio_met_rx')
|
||||
$('#execution-ddc_zitaplus_zitamet_plus_rx,#execution-ddc_zitaplus_r_rx,#execution-ddc_zitapio_rx,#execution-ddc_zitaplus_r_rx,#execution-ddc_zitapio_rx,#execution-ddc_telma_ln_lnc_lnbeta_rx,#execution-ddc_zita_d_rx,#execution-ddc_zita_pio_met_rx,#execution-ddc_zita_dm_rx')
|
||||
.change(function() {
|
||||
$('#execution-ddc_total_rx').val(parseInt($('#execution-ddc_zitaplus_zitamet_plus_rx')
|
||||
.val()) +
|
||||
.val()) +
|
||||
parseInt($('#execution-ddc_zitaplus_r_rx').val()) +
|
||||
parseInt($('#execution-ddc_zitapio_rx').val()) +
|
||||
parseInt($('#execution-ddc_telma_ln_lnc_lnbeta_rx').val()) +
|
||||
parseInt($('#execution-ddc_zita_d_rx').val()) +
|
||||
parseInt($('#execution-ddc_zita_pio_met_rx').val()))
|
||||
parseInt($('#execution-ddc_zita_pio_met_rx').val())+
|
||||
parseInt($('#execution-ddc_zita_dm_rx').val())
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
|
|
@ -438,7 +652,7 @@
|
|||
var executionexeField = document.getElementById('execution-record_date');
|
||||
executionexeField.setAttribute('min', executionDateField.value);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,402 @@
|
|||
<!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
|
||||
@if (isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{ $form->user_info->name }}</h6>
|
||||
</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)
|
||||
@if (in_array($question->code, [
|
||||
'cgm_camp_zitamet_zita_rx',
|
||||
'cgm_camp_zitapiomet_zitapio_rx',
|
||||
'cgm_camp_zita_d_dm_rx',
|
||||
'cgm_camp_telma_ln_range',
|
||||
'total_rx',
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<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' ? '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')
|
||||
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||||
<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' : '' }}>
|
||||
@elseif(isset($question->value))
|
||||
<img src="{{ $question->value }}" class="img-fluid">
|
||||
@endif
|
||||
@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
|
||||
|
||||
<div class="col-md-12 mb-2 p-1"
|
||||
style="background-color: #C8E6C9; border: 1px solid black !important">
|
||||
<h6>Focus Brands / SKU</h6>
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'record_date',
|
||||
'contact_id',
|
||||
'msl_code',
|
||||
'speciality',
|
||||
'upload_doc_1',
|
||||
'upload_doc_2',
|
||||
'upload_doc_3',
|
||||
'upload_doc_4',
|
||||
'cgm_camp_zitapiomet_zitapio_rx',
|
||||
'cgm_camp_zita_d_dm_rx',
|
||||
'cgm_camp_telma_ln_range',
|
||||
'total_rx',
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<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('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
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mb-2 p-1"
|
||||
style="border: 1px solid black !important">
|
||||
<h6>Other Brands / SKU</h6>
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'record_date',
|
||||
'contact_id',
|
||||
'speciality',
|
||||
'msl_code',
|
||||
'upload_doc_1',
|
||||
'upload_doc_2',
|
||||
'upload_doc_3',
|
||||
'upload_doc_4',
|
||||
'cgm_camp_zitamet_zita_rx',
|
||||
'total_rx'
|
||||
]))
|
||||
@continue
|
||||
@endif
|
||||
<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('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
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, [
|
||||
'total_rx',
|
||||
]))
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $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="execution-{{ $question->code }}" name="{{ $question->code }}"
|
||||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
|
||||
@case('number')
|
||||
<input type="{{ $question->type }}" min="0" max="9999999999"
|
||||
step="1" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||||
value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endif
|
||||
@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-contact_id').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#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!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('#field-cgm_camp_zitamet_zita_rx, #field-cgm_camp_zitapiomet_zitapio_rx, #field-cgm_camp_zita_d_dm_rx, #field-cgm_camp_telma_ln_range')
|
||||
.on("input", function() {
|
||||
var total_rx =
|
||||
parseInt($('#field-cgm_camp_zitamet_zita_rx').val()) +
|
||||
parseInt($('#field-cgm_camp_zitapiomet_zitapio_rx').val()) +
|
||||
parseInt($('#field-cgm_camp_zita_d_dm_rx').val()) +
|
||||
parseInt($('#field-cgm_camp_telma_ln_range').val());
|
||||
$('#field-total_rx').val(total_rx);
|
||||
console.log('clk');
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "History"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
</head>
|
||||
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-8 p-2">
|
||||
<h4 class="page-title">{{$formname}}</h4>
|
||||
</div>
|
||||
<div class="col-4 p-2">
|
||||
<a href="/form/show" class="float-end pt-1">New Submission</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12 p-0">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="responsive-table-plugin">
|
||||
<div class="table-rep-plugin">
|
||||
<div class="table-responsive" data-pattern="priority-columns">
|
||||
<table id="tech-companies-1" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-priority="1">Submission Date</th>
|
||||
@foreach($questions as $code => $question)
|
||||
<th data-priority="1">{{$question->label}}</th>
|
||||
@endforeach
|
||||
<th data-priority="1">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($submissions as $submission)
|
||||
<tr>
|
||||
<th>{{date("d M Y", strtotime($submission->updatedAt))}}</th>
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'file')
|
||||
<td><a target="_blank" href="{{ isset($submission->formdata->{$code}) ? is_array($submission->formdata->{$code})? implode(', ', $submission->formdata->{$code}) :(is_string($submission->formdata->{$code}) ? $submission->formdata->{$code} : '' ) : $code }}" download="{{ isset($submission->formdata->{$code}) ? is_array($submission->formdata->{$code})? implode(', ', $submission->formdata->{$code}) : (is_string($submission->formdata->{$code}) ? $submission->formdata->{$code} : '' ) : $code }}" class="btn btn-dark btn-xs"><i class="mdi mdi-cloud-download me-1"></i> Download</a></td>
|
||||
@elseif(count((array)$question->options) > 0 && 1==2 )
|
||||
<td>{{ $question->options->{ $submission->formdata->{$code} } }}</td>
|
||||
@else
|
||||
<td>{{ isset($submission->formdata->{$code}) ? is_array($submission->formdata->{$code})? implode(', ', $submission->formdata->{$code}) :$submission->formdata->{$code} : $code }}</td>
|
||||
@endif
|
||||
@endforeach
|
||||
<th>
|
||||
@if($question->can_edit == 'yes' || sizeof($submission->workflow_approvals) == 0 )
|
||||
@if($submission->workflow == 'yes' && $submission->workflow_status == 'approved' )
|
||||
<p>Approved</p>
|
||||
@else
|
||||
<a href="/form/show?id={{$submission->id}}" class="btn btn-primary btn-xs">Edit</button>
|
||||
@endif
|
||||
@endif
|
||||
</th>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end .table-responsive -->
|
||||
|
||||
</div> <!-- end .table-rep-plugin-->
|
||||
</div> <!-- end .responsive-table-plugin-->
|
||||
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
|
||||
</div>
|
||||
<!-- end page -->
|
||||
@include('layouts.shared/footer-script')
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,359 @@
|
|||
<!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
|
||||
@if (isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{ $form->user_info->name }}</h6>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<input type="hidden" name="count_doctor_converted" id="count_doctor_converted"
|
||||
value="0">
|
||||
<input type="hidden" name="count_other_doctor_converted" id="count_other_doctor_converted"
|
||||
value="0">
|
||||
<input type="hidden" name="count_target_doctor" id="count_target_doctor" value="0">
|
||||
|
||||
<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 }}"
|
||||
{{ $question->code == 'contact_id' ? 'msl_code= ' . $option->contact->msl_code . ' ' : '' }}
|
||||
{{ 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')
|
||||
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||||
<input type="file" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control" value=""
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
@elseif(isset($question->value))
|
||||
<img src="{{ $question->value }}" class="img-fluid">
|
||||
@endif
|
||||
@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) {
|
||||
|
||||
if ($('#field-count_of_rx').val() > 0 && $('#field-target_doctor').val() == 'Yes') {
|
||||
$('#count_doctor_converted').val(1);
|
||||
} else if ($('#field-count_of_rx').val() > 0 && $('#field-target_doctor').val() == 'No') {
|
||||
$('#count_other_doctor_converted').val(1);
|
||||
} else {
|
||||
$('#count_doctor_converted').val(0);
|
||||
$('#count_other_doctor_converted').val(0);
|
||||
}
|
||||
|
||||
if ($('#field-target_doctor').val() == 'Yes') {
|
||||
$('#count_target_doctor').val(1);
|
||||
} else {
|
||||
$('#count_target_doctor').val(0);
|
||||
}
|
||||
|
||||
var formData = new FormData($('#report-form')[0]);
|
||||
formData.append('count_doctor_converted', $('#count_doctor_converted').val());
|
||||
formData.append('count_other_doctor_converted', $('#count_other_doctor_converted').val());
|
||||
formData.append('count_target_doctor', $('#count_target_doctor').val());
|
||||
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: formData,
|
||||
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!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
var today = new Date();
|
||||
var dd = String(today.getDate()).padStart(2, '0');
|
||||
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||
var yyyy = today.getFullYear();
|
||||
today = yyyy + '-' + mm + '-' + dd;
|
||||
|
||||
var plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
|
||||
// $('#field-msl_code').prop('readonly', true)
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
function toggleFields(doctorVisible, retailerVisible) {
|
||||
$('#field-contact_id, [for="field-contact_id"]').toggle(doctorVisible);
|
||||
$('#field-source, [for="field-source"]').toggle(doctorVisible);
|
||||
|
||||
$('#field-count_of_rx, [for="field-count_of_rx"]').toggle(doctorVisible);
|
||||
$('#field-no_of_patients_catered_to, [for="field-no_of_patients_catered_to"]').toggle(
|
||||
doctorVisible);
|
||||
$('#field-pob_strips, [for="field-pob_strips"]').toggle(doctorVisible);
|
||||
$('#field-target_doctor, [for="field-target_doctor"]').toggle(doctorVisible);
|
||||
|
||||
$('#field-upload_image, [for="field-upload_image"]').toggle(doctorVisible);
|
||||
$('#field-msl_code, [for="field-msl_code"]').toggle(doctorVisible);
|
||||
$('#field-speciality, [for="field-speciality"]').toggle(doctorVisible);
|
||||
$('#field-source_of_lirafit_delivery, [for="field-source_of_lirafit_delivery"]').toggle(
|
||||
doctorVisible);
|
||||
|
||||
$('#field-no_of_retailers_having_lirafit_stocks, [for="field-no_of_retailers_having_lirafit_stocks"]')
|
||||
.toggle(retailerVisible);
|
||||
|
||||
$('select[data-flag="other_doctor_name"]').hide();
|
||||
$('label[label-flag="other_doctor_label"]').hide();
|
||||
|
||||
|
||||
}
|
||||
toggleFields(false, false);
|
||||
|
||||
$('#field-type').on('change', function() {
|
||||
const isDoctor = $(this).val() === 'Doctor';
|
||||
const isRetailer = $(this).val() === 'Retailer';
|
||||
if (isRetailer) {
|
||||
$('#field-contact_id, #field-source, #field-doctor_converted, #field-count_of_rx, #field-no_of_patients_catered_to',
|
||||
'#fields-pob_strips', '#field-upload_image', '#msl_code', '#target_doctor',
|
||||
'#speciality', 'field-source_of_lirafit_delivery')
|
||||
.prop('required', false);
|
||||
} else {
|
||||
$('#field-contact_id, #field-source, #field-doctor_converted, #field-count_of_rx, #field-no_of_patients_catered_to',
|
||||
'#fields-pob_strips', '#field-upload_image', '#msl_code', "#target_doctor",
|
||||
'#speciality', '#field-source_of_lirafit_delivery')
|
||||
.prop('required', true);
|
||||
}
|
||||
toggleFields(isDoctor, isRetailer);
|
||||
});
|
||||
|
||||
$('input[type="number"]').on('input', function() {
|
||||
let enteredValue = $(this).val();
|
||||
|
||||
let intValue = parseInt(enteredValue);
|
||||
|
||||
if (isNaN(intValue) || intValue < 0) {
|
||||
$(this).val('');
|
||||
} else {
|
||||
$(this).val(intValue);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,340 @@
|
|||
<!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
|
||||
@if (isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{ $form->user_info->name }}</h6>
|
||||
</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)
|
||||
@if (in_array($question->code, ['zita_zita_met_rx', 'zitapio_rx', 'zitapiomet_rx', 'zita_d_rx', 'zita_dm_rx', 'telma_ln_range']))
|
||||
@continue
|
||||
@endif
|
||||
<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')
|
||||
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||||
<input type="file" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control" value=""
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
@elseif(isset($question->value))
|
||||
<img src="{{ $question->value }}" class="img-fluid">
|
||||
@endif
|
||||
@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
|
||||
|
||||
|
||||
<div class="col-md-12 mb-2 p-1" style="background-color: #C8E6C9; border: 1px solid black !important">
|
||||
<h6>Focus Brands / SKU</h6>
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, ['contact_id', 'msl_code', 'record_date', 'doctor_address', 'zitapio_rx', 'zitapiomet_rx', 'zita_d_rx', 'zita_dm_rx', 'telma_ln_range', 'upload_activity_image']))
|
||||
@continue
|
||||
@endif
|
||||
<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('number')
|
||||
<div class="col-md-12 mb-2">
|
||||
<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 }}">
|
||||
</div>
|
||||
@break
|
||||
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 mb-2 p-1" style="border: 1px solid black !important">
|
||||
<h6>Other Brands / SKU</h6>
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, ['contact_id', 'msl_code', 'record_date', 'doctor_address', 'zita_zita_met_rx', 'upload_activity_image']))
|
||||
@continue
|
||||
@endif
|
||||
<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('number')
|
||||
<div class="col-md-12 mb-2">
|
||||
<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 }}">
|
||||
</div>
|
||||
@break
|
||||
|
||||
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
</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');
|
||||
$('#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!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
var today = new Date();
|
||||
var dd = String(today.getDate()).padStart(2, '0');
|
||||
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||
var yyyy = today.getFullYear();
|
||||
today = yyyy + '-' + mm + '-' + dd;
|
||||
|
||||
var plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,414 @@
|
|||
<!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="/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">
|
||||
<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">Activation Plan</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> -->
|
||||
<button type="button" class="btn btn-primary btn-xs" id="add-camp-btn">Add
|
||||
Plan</button>
|
||||
@else
|
||||
<a href="{{ url()->previous() }}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||
@endphp
|
||||
|
||||
<div class="col-12" id="table-wrapper">
|
||||
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
||||
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Action.</th>
|
||||
<th>Plan Date</th>
|
||||
<th>Execution Done</th>
|
||||
<th>Doctor Name</th>
|
||||
<th>Date of CGM Camp</th>
|
||||
<th>Gforce ID</th>
|
||||
<th>Speciality</th>
|
||||
<th>Upload Patient CGM Report</th>
|
||||
<th>Upload Patient CGM Report</th>
|
||||
<th>Upload Patient CGM Report</th>
|
||||
<th>Upload Patient CGM Report</th>
|
||||
<th>Rx generated for ZitaMet / Zita Rx</th>
|
||||
<th>Rx generated for ZitaPioMet / ZitaPio Rx</th>
|
||||
<th>Rx generated for Zita D / DM Rx</th>
|
||||
<th>Rx generated for Telma LN Range</th>
|
||||
<th>Total Rx</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($history->data->submissions as $sub)
|
||||
@php
|
||||
$sub->formdata->id = $sub->id;
|
||||
@endphp
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info edit-btn" plan_details="{{ json_encode($sub->formdata) }}"><i class="mdi mdi-pencil"></i> Edit</button>
|
||||
</td>
|
||||
<td>{{ $sub->formdata->record_date }}</td>
|
||||
<td>{{ isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'yes' ? 'Yes' : 'No' }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@if (isset($sub->formdata->contact_id) && $sub->formdata->contact_id !== '')
|
||||
{{ $sub->formdata->contact_id }}
|
||||
@elseif (isset($sub->formdata->doctor_name))
|
||||
{{ $sub->formdata->doctor_name }}
|
||||
@else
|
||||
{{-- Default value or empty string, adjust as needed --}}
|
||||
{{ '' }}
|
||||
@endif
|
||||
</td>
|
||||
<td>{{$sub->formdata->execution_date}}</td>
|
||||
<td>{{isset($sub->formdata->msl_code) ? $sub->formdata->msl_code : '' }}</td>
|
||||
<td>{{isset($sub->formdata->speciality ) ? $sub->formdata->speciality : ''}}</td>
|
||||
<td>{{isset($sub->formdata->{'upload_doc_1'} ) ? $sub->formdata->upload_doc_1 : ''}}</td>
|
||||
<td>{{isset($sub->formdata->{'upload_doc_2'} ) ? $sub->formdata->upload_doc_2 : ''}}</td>
|
||||
<td>{{isset($sub->formdata->{'upload_doc_3'} ) ? $sub->formdata->upload_doc_2 : ''}}</td>
|
||||
<td>{{isset($sub->formdata->{'upload_doc_4'} ) ? $sub->formdata->upload_doc_2 : ''}}</td>
|
||||
<td>{{isset($sub->formdata->{'cgm_camp_zitamet_zita_rx'} ) ? $sub->formdata->cgm_camp_zitamet_zita_rx : ''}}</td>
|
||||
<td>{{isset($sub->formdata->{'cgm_camp_zitapiomet_zitapio_rx'} ) ? $sub->formdata->cgm_camp_zitapiomet_zitapio_rx : ''}}</td>
|
||||
<td>{{isset($sub->formdata->{'cgm_camp_zita_d_dm_rx'} ) ? $sub->formdata->cgm_camp_zita_d_dm_rx : ''}}</td>
|
||||
<td>{{isset($sub->formdata->{'cgm_camp_telma_ln_range'} ) ? $sub->formdata->cgm_camp_telma_ln_range : ''}}</td>
|
||||
<td>{{isset($sub->formdata->{'execution-total_rx'} ) ? $sub->formdata->{'execution-total_rx'} : ''}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="form-wrapper">
|
||||
<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
|
||||
@foreach ($questions as $question)
|
||||
@if (in_array($question->code, ['upload_doc_1','upload_doc_2','upload_doc_3','upload_doc_4','cgm_camp_zitamet_zita_rx','cgm_camp_zitapiomet_zitapio_rx','cgm_camp_zita_d_dm_rx','cgm_camp_telma_ln_range' ,'execution-total_rx','execution_date']))
|
||||
@continue
|
||||
@endif
|
||||
<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" required>
|
||||
@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>
|
||||
|
||||
<div id="execution-form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="execution-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{ $form_id }}">
|
||||
@csrf
|
||||
<input type="hidden" name="id" value="" id="execution-id">
|
||||
<input type="hidden" name="execution_done" value="yes">
|
||||
@foreach ($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $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="execution-{{ $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="execution-{{ $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="execution-{{ $question->code }}" name="{{ $question->code }}" class="form-control" {{ $question->required == 'yes' ? 'required' : '' }} value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
|
||||
@case('textarea')
|
||||
<textarea id="execution-{{ $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="execution-{{ $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="execution-{{ $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="execution-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
|
||||
@case('file')
|
||||
<input type="file" id="execution-{{ $question->code }}" name="{{ $question->code }}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png">
|
||||
@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>
|
||||
|
||||
</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($) {
|
||||
$('#form-wrapper').hide()
|
||||
$('#execution-form-wrapper').hide()
|
||||
|
||||
$('#add-camp-btn').click(function() {
|
||||
$('#form-wrapper').show()
|
||||
$('#table-wrapper').hide()
|
||||
})
|
||||
|
||||
$('.edit-btn').click(function() {
|
||||
$('#execution-form-wrapper').show()
|
||||
$('#table-wrapper').hide()
|
||||
//$('#execution-contact_id').prop('disabled', true)
|
||||
// $('#execution-contact_id').prop('readonly', true)
|
||||
// $('#execution-activity_type').prop('readonly', true)
|
||||
// $('#execution-speciality').prop('readonly', true)
|
||||
// $('#execution-plan_date').prop('readonly', true)
|
||||
//$('#execution-time').prop('disabled', true)
|
||||
|
||||
let selected = JSON.parse($(this).attr('plan_details'))
|
||||
for (let k of Object.keys(selected)) {
|
||||
if (selected[k] != '') {
|
||||
if (k == 'contact_id') {
|
||||
//$("#execution-contact_id option:contains(" + selected[k] + ")").prop('selected', true)
|
||||
// console.log($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'))
|
||||
$('#execution-contact_id').val($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'));
|
||||
} else
|
||||
$('#execution-' + k).val(selected[k]);
|
||||
}
|
||||
// if(selected[k] != '')
|
||||
// $('#execution-'+k).val(selected[k]);
|
||||
}
|
||||
let docid = $('#execution-contact_id option').map(function() {
|
||||
if ($(this).text() == selected['contact_id']) return this;
|
||||
}).attr('value')
|
||||
$('#execution-contact_id').val(docid)
|
||||
$('#execution-id').val(selected['id'])
|
||||
|
||||
|
||||
})
|
||||
|
||||
$('#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'
|
||||
})
|
||||
window.location.reload();
|
||||
//$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#execution-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
data: new FormData($('#execution-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'
|
||||
})
|
||||
window.location.reload();
|
||||
//$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
var today = new Date();
|
||||
var dd = String(today.getDate()).padStart(2, '0');
|
||||
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||
var yyyy = today.getFullYear();
|
||||
today = yyyy + '-' + mm + '-' + dd;
|
||||
|
||||
var recordDateField = document.getElementById('field-plan_date');
|
||||
recordDateField.setAttribute('min', today);
|
||||
|
||||
var executionDateField = document.getElementById('execution-plan_date');
|
||||
// executionDateField.setAttribute('min', today);
|
||||
|
||||
$('.edit-btn').click(function() {
|
||||
var executionexeField = document.getElementById('execution-record_date');
|
||||
executionexeField.setAttribute('min', executionDateField.value);
|
||||
});
|
||||
|
||||
executionDateField.addEventListener('change', function() {
|
||||
console.log('gg');
|
||||
var executionexeField = document.getElementById('execution-record_date');
|
||||
executionexeField.setAttribute('min', executionDateField.value);
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
<!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" />
|
||||
<link href="{{ asset('assets/libs/select2/select2.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>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'
|
||||
) )
|
||||
|
||||
@endif
|
||||
@if(isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{$form->user_info->name}}</h6>
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
<input type="hidden" name="user_id" value="{{$form->user_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
|
||||
<div class="col-md-12 mb-2">
|
||||
<div class="table-responsive sticky-table">
|
||||
<table id="doctor_table" class="table table-borderless table-hover table-nowrap table-centered m-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Doctor Name</th>
|
||||
<th>Zita eCME</th>
|
||||
<th>Telma LN eCME</th>
|
||||
<th>RTM</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$doctors = [];
|
||||
foreach ($questions as $question) {
|
||||
if($question->code == 'contact_id') {
|
||||
$doctors = $question->options;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
@foreach($doctors as $i => $doctor)
|
||||
<tr>
|
||||
<th>{{$doctor->display}}<br/><small>{{isset($doctor->contact->speciality)?$doctor->contact->speciality:'-'}}<input type="hidden" name="contact_id[{{$i}}]" value="{{$doctor->value}}" /></th>
|
||||
<th><input type="checkbox" name="zita_ecme[{{$i}}]" {!! isset($doctor->contact->zita_ecme) && $doctor->contact->zita_ecme == 'Yes' ?'checked onclick="return false"':'' !!} value="Yes"/></th>
|
||||
<th><input type="checkbox" name="telma_ln_ecme[{{$i}}]" {!! isset($doctor->contact->telma_ln_ecme) && $doctor->contact->telma_ln_ecme == 'Yes' ?'checked onclick="return false"':'' !!} value="Yes"/></th>
|
||||
<th><input type="checkbox" name="rtm[{{$i}}]" {!! isset($doctor->contact->rtm) && $doctor->contact->rtm == 'Yes' ?'checked onclick="return false"':'' !!} value="Yes"/></th>
|
||||
</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%;
|
||||
}
|
||||
small {
|
||||
font-size:10px;
|
||||
}
|
||||
div.sticky-table {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
max-height: 500px;
|
||||
}
|
||||
div.sticky-table table thead {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script src="{{ asset('assets/libs/select2/select2.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($) {
|
||||
let doctors = [];
|
||||
$('#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) {
|
||||
console.log('data = ',data)
|
||||
$("#pageloader").fadeOut();
|
||||
if (data.status == 'success') {
|
||||
Swal.fire({
|
||||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
// $('#report-form').trigger("reset");
|
||||
// $('#doctor_table tbody').html('')
|
||||
window.location.reload()
|
||||
} 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,290 @@
|
|||
<!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" />
|
||||
<link href="{{ URL::asset('assets/libs/cropper/cropper.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ URL::asset('assets/libs/dropify/dropify.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>
|
||||
<div id="template-wrapper" class="row">
|
||||
<h5>Select any one of the templates</h5>
|
||||
@foreach($personalizations as $pers)
|
||||
<div class="col-6 col-md-4 mt-3">
|
||||
<img src="{{$pers->icon}}" class="img-fluid" persdata='{!! json_encode($pers) !!}'><br />
|
||||
<span>{{$pers->title}}</span>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div id="form-wrapper">
|
||||
<form method="POST" action="/form/submitpersonalized" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
<input type="hidden" name="form_info" id="form_info" value="">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-7">
|
||||
<label for="field-template_id" class="form-label"> Selected Template </label>
|
||||
</div>
|
||||
<div class="col-4 mb-2" id="wrapper-template_id">
|
||||
<img src="" class="img-thumbnail" style="max-height:150px">
|
||||
</div>
|
||||
<br class="clearfix" />
|
||||
@foreach($questions as $question)
|
||||
<div class="col-md-12 mb-2 question-wrapper" id="wrapper-{{$question->id}}">
|
||||
<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" name="{{$question->code}}" class="dropify"
|
||||
data-allowed-file-extensions="png jpg jpeg" />
|
||||
<p class="text-muted text-center mt-2 mb-0">500MB Max File size</p>
|
||||
@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="text" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($option->val)?$option->val:''}}">
|
||||
</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
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="cropper-wrapper">
|
||||
<form method="POST" action="/form/submitpersonalizedimages" id="image-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-12 img-container">
|
||||
|
||||
</div>
|
||||
<div class="col-12 mt-1">
|
||||
<button class="btn btn-primary" id="cropandgo">Use Image and download</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</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 src="{{asset('assets/libs/cropper/cropper.min.js')}}"></script>
|
||||
<script src="{{ URL::asset('assets/libs/dropify/dropify.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('#form-wrapper').hide()
|
||||
$('#cropper-wrapper').hide()
|
||||
$('#template-wrapper .img-fluid').click(function(){
|
||||
$('#form_info').val( $(this).attr('persdata') )
|
||||
console.log($(this).attr('persdata'))
|
||||
let personalize = JSON.parse( $(this).attr('persdata') )
|
||||
$('.question-wrapper').hide()
|
||||
for(let que of personalize.questions) {
|
||||
$('#wrapper-'+que).show()
|
||||
$(':input').removeAttr('readonly')
|
||||
//$('#wrapper-'+que).
|
||||
}
|
||||
$('#wrapper-template_id img').attr('src', personalize.icon)
|
||||
$('#template-wrapper').hide()
|
||||
$('#form-wrapper').show()
|
||||
|
||||
// $('.dropify').unbind()
|
||||
// $('.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).'
|
||||
// }
|
||||
// });
|
||||
|
||||
})
|
||||
|
||||
$('.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).'
|
||||
}
|
||||
});
|
||||
|
||||
$('#wrapper-template_id img').click(function(){
|
||||
$('#form-wrapper').hide()
|
||||
$('#cropper-wrapper').hide()
|
||||
$('#template-wrapper').show()
|
||||
})
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/submitpersonalized',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$('#cropper-wrapper').show()
|
||||
$('#form-wrapper').hide()
|
||||
$("#pageloader").fadeOut();
|
||||
console.log(data)
|
||||
if(data.hasOwnProperty('images_fields') && data.images_fields.length > 0 ) {
|
||||
for(let im of data.images_fields) {
|
||||
let pos = data.form_info.positions.map(p => JSON.parse(p))
|
||||
console.log(pos)
|
||||
pos = pos.map(p => p.find(pi => pi.field_name == im ) )
|
||||
console.log(pos)
|
||||
pos = pos[0]
|
||||
//im = JSON.parse(im)
|
||||
console.log(pos)
|
||||
//if(im.type == 'image') {
|
||||
$('.img-container').append(`<div class="mt-5">
|
||||
<img id="image-${im}" src="${data[im]}" alt="Picture" class="img-fluid">
|
||||
<input type="hidden" id="field-image-${im}" name="${im}" value="">
|
||||
</div>`)
|
||||
$('#cropper-wrapper #image-'+im).attr('src', data[im])
|
||||
var tmpImg = new Image() ;
|
||||
tmpImg.src = data[im];
|
||||
tmpImg.onload = function() {
|
||||
let $image = $('#image-'+im);
|
||||
let options = {
|
||||
aspectRatio: pos.width/pos.height,
|
||||
crop: function (e) {
|
||||
console.log(e);
|
||||
},
|
||||
cropend: function (e) {
|
||||
$('#field-image-'+im).val($image.cropper("getCroppedCanvas", { maxWidth: pos.width*2, maxHeight: pos.height*2 }).toDataURL());
|
||||
},
|
||||
ready: function (e) {
|
||||
$('#field-image-'+im).val($image.cropper("getCroppedCanvas", { maxWidth: pos.width*2, maxHeight: pos.height*2 }).toDataURL());
|
||||
},
|
||||
};
|
||||
$image.cropper(options);
|
||||
}
|
||||
//}
|
||||
}
|
||||
} else {
|
||||
document.location.href = '/form/generatepersonalization'
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// $('#image-form').on('submit', function(event){
|
||||
// event.preventDefault();
|
||||
// $("#pageloader").fadeIn();
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: '/form/submitpersonalizedimages',
|
||||
// data: new FormData($('#image-form')[0]),
|
||||
// processData: false,
|
||||
// contentType: false,
|
||||
// success: function( data ) {
|
||||
// console.log(data)
|
||||
// },
|
||||
// });
|
||||
// });
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -266,15 +266,18 @@
|
|||
}
|
||||
|
||||
$('#field-hysodew_grp').on('input', function(event) {
|
||||
calculateTotal('#field-hysodew_grp', 216, '#field-total_hysodew_grp');
|
||||
calculateTotal('#field-hysodew_grp', 217, '#field-total_hysodew_grp');
|
||||
});
|
||||
|
||||
$('#field-hydrakem_grp').on('input', function(event) {
|
||||
calculateTotal('#field-hydrakem_grp', 103.47, '#field-total_hydrakem_grp');
|
||||
calculateTotal('#field-hydrakem_grp', 104, '#field-total_hydrakem_grp');
|
||||
});
|
||||
|
||||
$('#field-moxam_grp').on('input', function(event) {
|
||||
calculateTotal('#field-moxam_grp', 45.44, '#field-total_moxam_grp');
|
||||
calculateTotal('#field-moxam_grp', 45.6, '#field-total_moxam_grp');
|
||||
});
|
||||
$('#field-glaucoma_grp').on('input', function(event) {
|
||||
calculateTotal('#field-glaucoma_grp', 141.2, '#field-total_glaucoma_grp');
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue