This commit is contained in:
Ravi Gulhane 2023-04-19 15:55:47 +05:30
parent a7fad5f933
commit c05d134768
57 changed files with 5399 additions and 99 deletions

View File

@ -45,9 +45,9 @@ class BannerController extends Controller
protected function _beforesave($type, $request) {
$data = $request->except('_token');
if($type == 'edit') {
$values->channels = explode('#', $values->channels);
}
// if($type == 'edit') {
// $values->channels = explode('#', $values->channels);
// }
if( $request->file('media_url') ) {
$data['media_url'] = $this->_uploadMedia($request, 'media_url', 'banners');
}

View File

@ -0,0 +1,139 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\LambdaRequest;
use DB;
use \stdClass;
use Maatwebsite\Excel\Facades\Excel;
use App\Exports\InvoicesExport;
class ComcampaignController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->_service = 'communication';
$this->_module = 'comcampaign';
$this->_viewname = 'comcampaign';
$this->_title = 'Campaign';
$this->_base_url = '/comcampaign';
}
protected function get_list_fields()
{
return [
'actions' => ['title' => 'Actions', 'buttons' => ['edit', 'delete', 'messages' => ['icon' => 'chart-box', 'querystring' => 'id={ID}']]],
'name' => ['title' => 'Name', 'type' => 'text'],
'type' => ['title' => 'Type', 'type' => 'text'],
'message_count' => ['title' => 'Message Count', 'type' => 'text'],
'message_sent' => ['title' => 'Message Sent', 'type' => 'text'],
'message_read' => ['title' => 'Message Read', 'type' => 'text'],
'status' => ['title' => 'Status', 'type' => 'select']
];
}
protected function get_form_fields($type, $values)
{
$teams = $this->getlambda('get', 'communication', 'template', 'dropdown');
// echo '<pre>'; print_r($teams); exit;
$templates = [];
foreach ($teams->data->items as $team) {
$templates[$team->template_code] = $team->name;
}
$chans = $this->getlambda('get', 'communication', 'channel', 'dropdown');
// echo '<pre>'; print_r($teams); exit;
$channels = [];
foreach ($chans->data->items as $chan) {
$channels[$chan->id] = $chan->name;
}
$conlists = $this->getlambda('get', 'ums', 'contact_list', 'dropdown');
$contactlists = [];
foreach ($conlists->data->items as $conlist) {
$contactlists[$conlist->id] = $conlist->name;
}
$metrics = $this->getlambda('get', 'metric', 'metric', 'get_all');
$metric_dd = [];
foreach($metrics->data->items as $metric){
$metric_dd[$metric->id] = $metric->name;
}
return [
'name' => ['title' => 'Name', 'type' => 'text', 'required' => true],
'template_code' => ['title' => 'Template', 'type' => 'select', 'values' => $templates, 'required' => true],
'channel' => ['title' => 'Channel', 'type' => 'select', 'values' => $channels, 'required' => true],
'contacts' => ['title' => 'Contact Lists', 'type' => 'multiselect', 'values' => $contactlists, 'required' => true],
'type' => ['title' => 'Type', 'type' => 'select', 'required' => true, 'values' => ['whatsapp' => 'Whatsapp', 'sms' => 'SMS', 'email' => 'Email']],
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled']],
'is_scheduled' => ['title' => 'Is Scheduled', 'type' => 'yesno', 'required' => true],
'scheduled_time' => ['title' => 'Schedule date & time', 'type' => 'datetime', 'required' => true,],
'sent_metric' => ['title' => 'Sent Metric', 'type' => 'select', 'values' => $metric_dd, 'required' => true],
'read_metric' => ['title' => 'Read Metric', 'type' => 'select', 'values' => $metric_dd, 'required' => true],
];
}
protected function _beforesave($type, $request)
{
$data = $request->except('_token');
if ($request->file('image')) {
$data['image'] = $this->_uploadMedia($request, 'image', 'template');
}
return $data;
}
public function messages($request) {
$id = $request->input('id');
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all_messages', ['id' => $id]);
return $this->view('list')->with([
'title' => 'Messages',
'fields' => [
'name' => ['title' => 'Name', 'type' => 'text'],
'phone' => ['title' => 'Phone', 'type' => 'text'],
'email' => ['title' => 'Email', 'type' => 'text'],
'type' => ['title' => 'Type', 'type' => 'text'],
'is_sent' => ['title' => 'Is Sent', 'type' => 'text'],
'sent_time' => ['title' => 'Sent Time', 'type' => 'datetime'],
'is_read' => ['title' => 'Is Read', 'type' => 'text'],
'read_time' => ['title' => 'Read Time', 'type' => 'datetime'],
],
'base_url' => $this->_base_url,
'items' => $response->data->messages,
'buttons' => [['title' => 'Export Excel', 'link' => $this->_base_url . '/exportmessages?id='.$id]]
]);
//echo '<pre>'; print_r($response); exit;
//echo '<pre>'; print_r($response); exit;
}
public function exportmessages($request) {
$id = $request->input('id');
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all_messages', ['id' => $id]);
$headers = ['Name', 'Phone', 'Email', 'Type', 'Is Sent', 'Sent Time', 'Is Read', 'Read Time'];
$exceldata[] = $headers;
foreach($response->data->messages as $message) {
$row = [];
$row[] = isset($message->name) ? $message->name : '-';
$row[] = isset($message->phone) ? $message->phone : '-';
$row[] = isset($message->email) ? $message->email : '-';
$row[] = isset($message->type) ? $message->type : '-';
$row[] = isset($message->is_sent) ? $message->is_sent : '-';
$row[] = isset($message->sent_time) ? $message->sent_time : '-';
$row[] = isset($message->is_read) ? $message->is_read : '-';
$row[] = isset($message->read_time) ? $message->read_time : '-';
$exceldata[] = $row;
}
return Excel::download(new InvoicesExport($exceldata), 'message.xlsx');
}
}

View File

@ -0,0 +1,117 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\LambdaRequest;
use DB;
use \stdClass;
class CommbotController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->_service = 'communication';
$this->_module = 'comm_bot';
$this->_viewname = 'commbot';
$this->_title = 'Communication Bot';
$this->_base_url = '/commbot';
}
protected function get_list_fields()
{
return [
'actions' => ['title' => 'Actions', 'buttons' => ['edit', 'delete', 'messages' => ['icon' => 'message-text-outline', 'querystring' => 'id={ID}'], 'intents' => ['icon' => 'family-tree', 'querystring' => 'id={ID}'] ]],
'name' => ['title' => 'Channel Name', 'type' => 'text'],
'type' => ['title' => 'Type', 'type' => 'text'],
'status' => ['title' => 'Status', 'type' => 'select'],
];
}
protected function get_form_fields($type, $values)
{
return [
'name' => ['title' => 'Bot Name', 'type' => 'text', 'required' => true],
'type' => ['title' => 'Bot Type', 'type' => 'select', 'required' => true, 'values' => ['whatsapp' => 'Whatsapp', 'sms' => 'SMS']],
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled']],
];
}
public function messages(Request $request) {
$entity_id = $request->input('id', 0);
if($entity_id === 0) {
return redirect('/commbots')->withError('Bot not found!');
} else {
$request->session()->put('entity_id', $entity_id);
return redirect('/commbotmessages');
}
}
public function intents(Request $request) {
$entity_id = $request->input('id', 0);
if($entity_id === 0) {
return redirect('/commbots')->withError('Bot not found!');
} else {
$request->session()->put('entity_id', $entity_id);
return redirect('/commbotintents');
}
}
// public function form($type, $id = null) {
// $values = [];
// $items = [];
// if($type == 'edit') {
// $response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_one', ['id' => $id]);
// $values = $response->data->item;
// $response = LambdaRequest::signedrequest('get', $this->_service, 'comm_bot_intent/get_all');
// $items = [];
// foreach($response->data->items as $item) {
// $items[$item->parent_id][] = $item;
// }
// //echo '<pre>'; print_r($items); exit;
// }
// $data = $this->_beforeform($type, $values);
// $fields = $this->get_form_fields($type, $values);
// return $this->view('form')->with([
// 'title' => $this->_title,
// 'mode' => $type,
// 'fields' => $fields,
// 'base_url' => $this->_base_url,
// 'item' => $values,
// 'items' => $items
// ]);
// }
public function postaddchild(Request $request) {
$post = $request->input();
if($post['id'] != '') {
$url = '/update';
} else {
$url = '/create';
}
$buttons = [];
foreach($post['button-id'] as $k => $v) {
if(isset($v) && $v != '') {
$buttons[] = ['id' => $v, 'title' => $post['button-title'][$k] ];
}
}
$post['buttons'] = $buttons;
unset($post['button-id']);
unset($post['button-title']);
if(!isset($post['id']) || $post['id'] == '') unset($post['id']);
//echo '<pre>'; print_r($post); exit;
$response = LambdaRequest::signedrequest('post', $this->_service, 'comm_bot_intent'.$url, $post);
//echo '<pre>'; print_r($response); exit;
if($response->statusCode == 200 && $response->status == "success") {
return redirect($this->_base_url.'/edit?id='.$post['bot_id'])->withMessage('Successfully Saved !!!');
} else {
return redirect($this->_base_url.'/edit?id='.$post['bot_id'])->withError('Some Error occured! '. $response->body->message);
}
}
}

View File

@ -0,0 +1,101 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\LambdaRequest;
use DB;
class CommbotintentController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->_service = 'communication';
$this->_module = 'comm_bot_intent';
$this->_viewname = 'commbotintent';
$this->_title = 'Bot Intents';
$this->_base_url = '/commbotintent';
}
public function list(Request $request) {
$entity_id = $request->session()->get('entity_id');
if($entity_id === 0) {
return redirect('/commbots')->withError('Bot not found!');
}
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all', ['entity_id' => $entity_id]);
$items = [];
foreach($response->data->items as $item) {
$items[$item->parent_id][] = $item;
}
$messs = $this->getlambda('get', $this->_service, 'comm_bot_message', 'dropdown');
$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(),
'bot_id' => $entity_id,
'messages' => $messs->data->items
]);
}
protected function get_list_buttons() {
return [ ['title' => 'Add New', 'link' => $this->_base_url.'/addnew' ], ['title' => 'Back to Bots', 'link' => '/commbots'] ];
}
protected function get_list_fields(){
return [
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
//'media_thumb' => ['title' => 'Media Thumb', 'type' => 'image'],
'name' => ['title' => 'Name', 'type' => 'text'],
'type' => ['title' => 'Type', 'type' => 'text'],
'status' => ['title' => 'Status', 'type' => 'select'],
];
}
protected function get_form_fields($type, $values){
$groups = $this->getlambda('get', 'ums', 'group', 'dropdown');
$groups_dd = [];
foreach($groups->data->items as $group){
$groups_dd[$group->id] = $group->name;
}
return [
'name' => ['title' => 'Title', 'type' => 'text', 'required' => true],
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
'type' => ['title' => 'Type', 'type' => 'select', 'required' => true, 'values' => ['text' => 'Text', 'image' => 'Image', 'date' => 'Date', 'template' => 'Template', 'interactive' => 'Interactive'] ],
'header_type' => ['title' => 'Header Type', 'type' => 'select', 'required' => true, 'values' => ['none' => 'None', 'text' => 'Text', 'video' => 'Video', 'image' => 'Image', 'document' => 'Document'] ],
'header_text' => ['title' => 'Header Text (if header type is text)', 'type' => 'text'],
'header_media' => ['title' => 'Header Media (video, image or document)', 'type' => 'file'],
'body_text' => ['title' => 'Body Text', 'type' => 'textarea', 'required' => true, 'fullwidth' => true ],
'footer_text' => ['title' => 'Footer Text', 'type' => 'text', 'fullwidth' => true ],
'interactive_type' => ['title' => 'Interactive Type', 'type' => 'select', 'required' => true, 'values' => ['button' => 'Button', 'list' => 'List'] ],
'buttons' => ['title' => 'Options', 'type' => 'mapping', 'fullwidth' => true ],
];
}
public function postaddchild(Request $request) {
$post = $request->input();
if($post['id'] != '') {
$url = '/update';
} else {
$url = '/create';
}
if(!isset($post['id']) || $post['id'] == '') unset($post['id']);
//echo '<pre>'; print_r($post); exit;
$response = LambdaRequest::signedrequest('post', $this->_service, 'comm_bot_intent'.$url, $post);
//echo '<pre>'; print_r($response); exit;
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);
}
}
}

View File

@ -0,0 +1,112 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\LambdaRequest;
use DB;
class CommbotmessageController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->_service = 'communication';
$this->_module = 'comm_bot_message';
$this->_viewname = 'commbotmessage';
$this->_title = 'Bot Messages';
$this->_base_url = '/commbotmessage';
}
public function list(Request $request) {
$entity_id = $request->session()->get('entity_id');
if($entity_id === 0) {
return redirect('/commbots')->withError('Bot not found!');
}
$response = LambdaRequest::signedrequest('get', $this->_service, $this->_module.'/get_all', ['entity_id' => $entity_id]);
//echo '<pre>'; print_r($response); exit;
$fields = $this->get_list_fields();
return $this->view('list')->with([
'title' => $this->_title,
'fields' => $fields,
'base_url' => $this->_base_url,
'items' => $response->data->items,
'buttons' => $this->get_list_buttons()
]);
}
protected function get_list_buttons() {
return [ ['title' => 'Add New', 'link' => $this->_base_url.'/addnew' ], ['title' => 'Back to Bots', 'link' => '/commbots'] ];
}
protected function get_list_fields(){
return [
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
//'media_thumb' => ['title' => 'Media Thumb', 'type' => 'image'],
'name' => ['title' => 'Name', 'type' => 'text'],
'type' => ['title' => 'Type', 'type' => 'text'],
'status' => ['title' => 'Status', 'type' => 'select'],
];
}
protected function get_form_fields($type, $values){
$groups = $this->getlambda('get', 'ums', 'group', 'dropdown');
$groups_dd = [];
foreach($groups->data->items as $group){
$groups_dd[$group->id] = $group->name;
}
return [
'name' => ['title' => 'Title', 'type' => 'text', 'required' => true],
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
'type' => ['title' => 'Type', 'type' => 'select', 'required' => true, 'values' => ['text' => 'Text', 'image' => 'Image', 'document' => 'Document', 'template' => 'Template', 'interactive' => 'Interactive'] ],
'header_type' => ['title' => 'Header Type', 'type' => 'select', 'required' => true, 'values' => ['none' => 'None', 'text' => 'Text', 'video' => 'Video', 'image' => 'Image', 'document' => 'Document'] ],
'header_text' => ['title' => 'Header Text (if header type is text)', 'type' => 'text'],
'header_media' => ['title' => 'Header Media (video, image or document)', 'type' => 'file'],
'body_text' => ['title' => 'Body Text', 'type' => 'textarea', 'required' => true, 'fullwidth' => true ],
'footer_text' => ['title' => 'Footer Text', 'type' => 'text', 'fullwidth' => true ],
'interactive_type' => ['title' => 'Interactive Type (only 3 buttons are allowed, select list for more than 3)', 'type' => 'select', 'values' => ['button' => 'Button', 'list' => 'List'] ],
'buttons' => ['title' => 'Options', 'type' => 'mapping', 'fullwidth' => true ],
];
}
protected function _beforesave($type, $request) {
$data = $request->except('_token');
$data['bot_id'] = $request->session()->get('entity_id');
$buttons = [];
foreach($data as $k => $v) {
if(!isset($v)) {
unset($data[$k]);
}
}
if( $request->file('header_media') ) {
$data['header_media'] = $this->_uploadMedia($request, 'header_media', 'messages');
}
if($data['header_type'] == 'text') {
$data['header'] = ['type' => 'text', 'text' => $data['header_text'] ];
} elseif($data['header_type'] != 'none' && $data['header_type'] != 'text') {
$data['header'] = ['type' => $data['header_type'], $data['header_type'] => $data['header_media'] ];
}
unset($data['header_type']);
unset($data['header_text']);
unset($data['header_media']);
//echo '<pre>'; print_r($data); exit;
if($data['type'] == 'interactive') {
foreach($data['button']['type'] as $i => $type) {
$buttons[] = ['type' => $type, 'id' => $data['button']['id'][$i], 'title' => $data['button']['title'][$i], 'description' => $data['button']['description'][$i] ];
}
}
$data['buttons'] = $buttons;
return $data;
}
protected function _beforeform($type, $values) {
//echo '<pre>'; print_r($values); exit;
return $values;
}
}

View File

@ -0,0 +1,117 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\LambdaRequest;
use DB;
use \stdClass;
class CommchannelController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->_service = 'communication';
$this->_module = 'channel';
$this->_viewname = 'commchannel';
$this->_title = 'Communication Channels';
$this->_base_url = '/communicationchannel';
}
protected function get_list_fields()
{
return [
'actions' => ['title' => 'Actions', 'buttons' => ['edit', 'delete']],
'name' => ['title' => 'Channel Name', 'type' => 'text'],
'type' => ['title' => 'Type', 'type' => 'text'],
'status' => ['title' => 'Status', 'type' => 'select'],
];
}
protected function get_form_fields($type, $values)
{
$bots = $this->getlambda('get', 'communication', 'comm_bot', 'dropdown');
$bots_dd = [];
foreach ($bots->data->items as $bot) {
$bots_dd[$bot->id] = $bot->name;
}
return [
'name' => ['title' => 'Channel Name', 'type' => 'text', 'required' => true],
'number' => ['title' => 'Sender Number', 'type' => 'text', 'required' => true],
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled']],
'type' => ['title' => 'Channel Type', 'type' => 'select', 'required' => true, 'values' => ['whatsapp' => 'Whatsapp', 'email' => 'Email', 'sms' => 'SMS']],
'bot_id' => ['title' => 'Attached Bot', 'type' => 'select', 'values' => $bots_dd],
'credentials' => ['title' => 'Credentials', 'type' => 'textarea', 'required' => true, 'fullwidth' => true],
//'api_secret' => ['title' => 'API Secret', 'type' => 'text', 'required' => true],
'minute' => ['title' => 'Limits in Minutes', 'type' => 'number', 'required' => false],
'hour' => ['title' => 'Limits in Hours', 'type' => 'number', 'required' => false],
'day' => ['title' => 'Limits in Days', 'type' => 'number', 'required' => false],
'week' => ['title' => 'Limits in Weeks', 'type' => 'number', 'required' => false],
'month' => ['title' => 'Limits in Months', 'type' => 'number', 'required' => false],
];
}
// public function form($type, $id = null)
// {
// $values = [];
// if ($type == 'edit') {
// $response = LambdaRequest::signedrequest('get', $this->_service, $this->_module . '/get_one', ['id' => $id]);
// // echo '<pre>'; print_r($response); exit;
// $values = $response->data->item;
// }
// $data = $this->_beforeform($type, $values);
// $fields = $this->get_form_fields($type, $values);
// echo '<pre>'; print_r($data); exit;
// return $this->view('form')->with([
// 'title' => $this->_title,
// 'mode' => $type,
// 'fields' => $fields,
// 'base_url' => $this->_base_url,
// 'item' => $values,
// ]);
// }
protected function _beforeform($type, $values) {
if($type == 'edit') {
$values->credentials = json_encode($values->credentials);
$values->minute = $values->limits->minute;
$values->day = $values->limits->day;
$values->month = $values->limits->month;
$values->hour = $values->limits->hour;
$values->week = $values->limits->week;
}
return $values;
}
protected function _beforesave($type, $request)
{
$data = $request->except('_token');
// $credentials = new stdClass();
// $credentials->api_key = $data["api_key"];
// $credentials->api_secret = $data["api_secret"];
// unset($data["api_key"]);
// unset($data["api_secret"]);
$data["credentials"] = json_decode($data["credentials"]);
$limits = new stdClass();
$limits->minute = $data["minute"];
$limits->hour = $data["hour"];
$limits->day = $data["day"];
$limits->week = $data["week"];
$limits->month = $data["month"];
unset($data["minute"]);
unset($data["hour"]);
unset($data["day"]);
unset($data["week"]);
unset($data["month"]);
$data["limits"] = $limits;
//echo '<pre>'; print_r($data); exit;
return $data;
}
}

View File

@ -22,6 +22,7 @@ class ContactController extends Controller
public function list(Request $request) {
$fields = $this->get_list_fields();
//echo $this->_listtype; exit;
return $this->view($this->_listtype)->with([
'title' => $this->_title,
'fields' => $fields,
@ -155,6 +156,20 @@ class ContactController extends Controller
]);
}
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 postimport(Request $request) {
// if( $request->file('importfile') ) {

View File

@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\LambdaRequest;
use DB;
use \stdClass;
class ContactlistController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->_service = 'ums';
$this->_module = 'contact_list';
$this->_viewname = 'contactlist';
$this->_title = 'Contact List';
$this->_base_url = '/contactlist';
}
protected function get_list_fields()
{
return [
'actions' => ['title' => 'Actions', 'buttons' => ['edit', 'delete']],
'name' => ['title' => 'Name', 'type' => 'text'],
'status' => ['title' => 'Status', 'type' => 'select']
];
}
protected function get_form_fields($type, $values)
{
$teams = $this->getlambda('get', 'communication', 'template', 'dropdown');
// echo '<pre>'; print_r($teams); exit;
$templates = [];
foreach ($teams->data->items as $team) {
$templates[$team->template_code] = $team->name;
}
$chans = $this->getlambda('get', 'communication', 'channel', 'dropdown');
// echo '<pre>'; print_r($teams); exit;
$channels = [];
foreach ($chans->data->items as $chan) {
$channels[$chan->id] = $chan->name;
}
return [
'name' => ['title' => 'Name', 'type' => 'text', 'required' => true],
'template_code' => ['title' => 'Template', 'type' => 'select', 'values' => $templates, 'required' => true],
'channel' => ['title' => 'Channel', 'type' => 'select', 'values' => $channels, 'required' => true],
'type' => ['title' => 'Type', 'type' => 'select', 'required' => true, 'values' => ['whatsapp' => 'Whatsapp', 'sms' => 'SMS', 'email' => 'Email']],
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled']],
];
}
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);
//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('image')) {
$data['image'] = $this->_uploadMedia($request, 'image', 'template');
}
return $data;
}
}

View File

@ -110,6 +110,9 @@ class Controller extends BaseController
$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']){

View File

@ -63,7 +63,7 @@ class DetailingcontestController extends Controller
'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',] ],
'file' => ['title' => 'Media', 'type' => 'image', 'required' => true],
'media' => ['title' => 'Media', 'type' => 'file', 'required' => true],
'cover_image' => ['title' => 'Cover Image', 'type' => 'image', 'required' => true],
'response_types' => ['title' => 'Response Types', 'type' => 'checkbox', 'required' => true, 'values' => ['audio' => 'Audio', 'video' => 'Video', 'pdf' => 'PDF', 'image' => 'Image',] ],
@ -84,8 +84,8 @@ class DetailingcontestController extends Controller
if( $request->file('cover_image') ) {
$data['cover_image'] = $this->_uploadMedia($request, 'cover_image', 'detailing');
}
if( $request->file('file') ) {
$data['file'] = $this->_uploadMedia($request, 'file', 'detailing');
if( $request->file('media') ) {
$data['media'] = $this->_uploadMedia($request, 'media', 'detailing');
}
return $data;
}

View File

@ -70,9 +70,9 @@ class DomainController extends Controller
'description' => ['title' => 'Description', 'type' => 'textarea', 'required' => true],
'use_default_otp' => ['title' => 'Use Default OTP', 'type' => 'select', 'required' => true, 'values' => ['Yes' => 'Yes', 'No' => 'No'] ],
'default_otp' => ['title' => 'Default OTP to be used', 'type' => 'number', 'required' => true],
'terms_text' => ['title' => 'Login Terms & Conditions Text', 'type' => 'textarea', 'required' => true, 'fullwidth' => true],
'android_server_key' => ['title' => 'Android Server Key', 'type' => 'textarea', 'fullwidth' => true],
'ios_server_key' => ['title' => 'IOS Server Key', 'type' => 'textarea', 'fullwidth' => true],
];
}

View File

@ -87,7 +87,9 @@ class FormController extends Controller
return $this->deliverform($finfo->data->formdata, $finfo->data->questions);
} elseif($finfo->status == 'success' && $finfo->data->formdata->link_type == 'list') {
//echo '<pre>'; print_r($finfo->data); exit;
if (\View::exists('form.list-'.$finfo->data->formdata->form_id)) {
if (\View::exists('form.'.$finfo->data->formdata->partition.'.list-'.$finfo->data->formdata->form_id)) {
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 ]);
} 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 ]);
} 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 ]);
@ -146,7 +148,7 @@ class FormController extends Controller
foreach($files as $fname => $file) {
$post[$fname] = $this->_uploadMedia($request, $fname, 'form/'.$post['form_id'].'/'.$fname);
}
if($post['id']=='') unset($post['id']);
if(isset($post['id']) && $post['id']=='') unset($post['id']);
$formdata = $request->session()->get('formdata');
if(isset($post['user_id']) && $post['user_id'] != '') {
$formdata->user_id = $post['user_id'];
@ -375,6 +377,30 @@ class FormController extends Controller
LambdaRequest::postrequest('form', 'formentity/submitform', ['formdata' => $rxformdata, 'entity_id' => $rxformdata['form_id'], 'user_id' => $user_id, 'partition' => $partition ]);
}
break;
case '1653655224-724ec5b3-fccb-4a88-bf28-cf894fa27a78':
$contacts = [];
$indamet_80_rx = [];
$indamet_160_rx = [];
$indamet_320_rx = [];
$doctor_tagging = [];
$campaign = [];
foreach($post['contact_id'] as $i => $c) {
if($post['indamet_80_rx'][$i] > 0 || $post['indamet_160_rx'][$i] > 0 || $post['indamet_320_rx'][$i] > 0) {
$contacts[] = $c;
$indamet_80_rx[] = $post['indamet_80_rx'][$i];
$indamet_160_rx[] = $post['indamet_160_rx'][$i];
$indamet_320_rx[] = $post['indamet_320_rx'][$i];
$doctor_tagging[] = $post['doctor_tagging'][$i];
$campaign[] = $post['campaign'][$i];
}
}
$post['contact_id'] = $contacts;
$post['indamet_80_rx'] = $indamet_80_rx;
$post['indamet_160_rx'] = $indamet_160_rx;
$post['indamet_320_rx'] = $indamet_320_rx;
$post['doctor_tagging'] = $doctor_tagging;
$post['campaign'] = $campaign;
break;
}
@ -730,6 +756,10 @@ class FormController extends Controller
$folder = storage_path('app/public/personalized/'.$form_info['form_id']);
$templatename = 'template-'.$form_info['form_info']->id.'.'.$template['extension'];
$outputImage = $this->retimage($folder.'/'.$templatename);
// $form_info['form_info']->positions = json_decode('[{"x":"100-279","y":"485","align":"center","size":20,"type":"text","font":"klavika-medium.ttf","color":"110-23-19","field_name":"event_date_date"},{"x":"100-279","y":"526","align":"center","size":22,"type":"text","font":"klavika-light.ttf","color":"110-23-19","field_name":"event_date_year"},{"x":"340-514","y":"485","align":"center","size":20,"type":"text","font":"klavika-medium.ttf","color":"110-23-19","field_name":"venue_line_3"},{"x":"584-767","y":"480","align":"center","size":18,"type":"text","font":"klavika-medium.ttf","color":"110-23-19","field_name":"venue_line_1"},{"x":"584-767","y":"508","align":"center","size":18,"type":"text","font":"klavika-medium.ttf","color":"110-23-19","field_name":"venue_line_2"},{"x":"584-767","y":"535","align":"center","size":18,"type":"text","font":"klavika-medium.ttf","color":"110-23-19","field_name":"venue_line_3"},{"x":"264-613","y":"910","align":"center","size":11,"type":"text","font":"gadugib.ttf","color":"0-0-0","field_name":"speaker_details_line_1"},{"x":"264-613","y":"930","align":"center","size":11,"type":"text","font":"gadugib.ttf","color":"0-0-0","field_name":"speaker_details_line_2"},{"x":"264-613","y":"950","align":"center","size":11,"type":"text","font":"gadugib.ttf","color":"0-0-0","field_name":"speaker_details_line_3"},{"x":"264-613","y":"970","align":"center","size":11,"type":"text","font":"gadugib.ttf","color":"0-0-0","field_name":"speaker_details_line_4"},{"x":362,"width":154,"y":658,"type":"image","fill":"mask","height":154,"field_name":"speaker_image"},{"x":"259-618","y":"873","align":"center","size":23,"type":"text","font":"klavika-medium.ttf","color":"255-255-255","field_name":"speaker_name"}]');
//echo '<pre>'; print_r($form_info); echo '</pre>';
foreach($form_info['form_info']->positions as $pos) {
switch($pos->type) {
@ -737,11 +767,27 @@ class FormController extends Controller
$image = storage_path( str_replace('/storage', 'app/public', $form_info['cropped-'.$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]);
if(isset($pos->fill) && $pos->fill == 'mask') {
$w = imagesx($outputImage);
$h = imagesy($outputImage);
$tempimage = imagecreatetruecolor($w, $h);
imagecopyresized($tempimage,$photoimg,$pos->x,$pos->y,0,0,$pos->width,$pos->height, $photosize[0], $photosize[1]);
imagecopyresized($tempimage,$outputImage,0,0,0,0,$w,$h,$w,$h);
$outputImage = $tempimage;
//imagedestroy($tempimage);
} else {
imagecopyresized($outputImage,$photoimg,$pos->x,$pos->y,0,0,$pos->width,$pos->height, $photosize[0], $photosize[1]);
}
break;
case 'text':
$font = storage_path('app').'/fonts/Poppins-Medium.ttf';
$white = imagecolorallocate($outputImage, 0, 0, 0);
$font = storage_path('app').'/fonts/'.$pos->font;
$pos->color = explode('-',$pos->color);
$white = imagecolorallocate($outputImage, $pos->color[0], $pos->color[1], $pos->color[2]);
if(isset($pos->align) && $pos->align == 'center') {
$box = imagettfbbox($pos->size, 0, $font, $form_info[$pos->field_name]);
$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, $form_info[$pos->field_name] );
break;
}
@ -757,6 +803,8 @@ class FormController extends Controller
$post = $this->processformdata($formdata->form_id, $post, $formdata->user_id, $formdata->partition);
$finfo = LambdaRequest::postrequest('form', 'formentity/submitform', ['formdata' => $form_info, 'entity_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition ]);
}
//return view('form.download')->with('image_url', 'personalized/'.$form_info['form_id'].'/'.$form_info['genareted_image']);
$request->session()->put('form_info', $form_info);
return redirect('/form/downloadpersonalization');
}
@ -979,4 +1027,11 @@ class FormController extends Controller
return response()->json(['status' => 'failure']);
}
}
public function zipmultiple(Request $request) {
$files = $request->input('files', []);
$response = LambdaRequest::postrequest('form', 'formentity/zipmultiple', ['files' => $files], '');
//Log::debug(print_r($response, true));
return response()->json($response->data);
}
}

View File

@ -39,4 +39,8 @@ class FormdataController extends Controller
return redirect('/formsubmissions');
}
}
protected function get_list_buttons() {
return [];
}
}

View File

@ -41,7 +41,11 @@ class FormsubmissionController extends Controller
else
$enddate = date("Y/m/d", strtotime("now") + 86400 );
$reqdata = ["partition" => 'rapport-'.$user->domain, "form_id" => $form_id, "alldata" => true, "date_range" => $startdate.'_'.$enddate ];
$reqdata = ["partition" => 'rapport-'.$user->domain, "form_id" => $form_id, "alldata" => true ];
if(isset($post['startdate']) && isset($post['enddate'])) {
$reqdata['date_range'] = $startdate.'_'.$enddate;
}
$request->session()->put('formdata_request', $reqdata);
//echo '<pre>'; print_r($reqdata); exit;
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/getformhistory', $reqdata);

View File

@ -179,20 +179,20 @@ class HierarchyController extends Controller
$row[] = isset($user->positions->Area) ? $user->positions->Area : '-';
$row[] = isset($user->positions->Territory) ? $user->positions->Territory : '-';
if(isset($user->manager_level1) && isset($user->manager_level1->owner_info) && isset($user->manager_level1->owner_info->employee_code)){
$row[] = $user->manager_level1->owner_info->employee_code;
$row[] = $user->manager_level1->owner_info->firstname . ' ' . $user->manager_level1->owner_info->lastname;
$row[] = $user->manager_level1->owner_info->email;
if(isset($user->manager_level1) && isset($user->manager_level1->employee_code)) {
$row[] = $user->manager_level1->employee_code;
$row[] = $user->manager_level1->name;
$row[] = $user->manager_level1->email;
} else {
$row[] = '';
$row[] = '';
$row[] = '';
}
if(isset($user->manager_level2) && isset($user->manager_level2->owner_info) && isset($user->manager_level2->owner_info->employee_code)){
$row[] = $user->manager_level2->owner_info->employee_code;
$row[] = $user->manager_level2->owner_info->firstname . ' ' . $user->manager_level2->owner_info->lastname;
$row[] = $user->manager_level2->owner_info->email;
if(isset($user->manager_level2) && isset($user->manager_level2->employee_code)) {
$row[] = $user->manager_level2->employee_code;
$row[] = $user->manager_level2->name;
$row[] = $user->manager_level2->email;
} else {
$row[] = '';
$row[] = '';

View File

@ -50,7 +50,7 @@ class MetricreportController extends Controller
public function report(Request $request) {
$post = $request->except('_token');
//echo '<pre>';print_r($post); exit;
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/view', $post, 60);
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/view', $post, 300);
//echo '<pre>'; print_r($response); exit;
if($post['type'] == 'trend' && $post['chart'] == 'tabularperuser') {
echo '<pre>'; print_r($tabledata); print_r($response); exit;
@ -68,7 +68,7 @@ class MetricreportController extends Controller
krsort($breadcrumbs);
}
//echo '<pre>'; print_r(['periods' => $response->data->periods, 'charts' => $response->data->available_charts, 'graph' => $response->data->graph, 'post' => $post, 'colors' => $colors, 'breadcrumbs' => $breadcrumbs]); exit;
return $this->view('report')->with(['periods' => $response->data->periods, 'charts' => $response->data->available_charts, 'graph' => $response->data->graph, 'post' => $post, 'colors' => $colors, 'breadcrumbs' => $breadcrumbs]);
return $this->view('report')->with(['periods' => $response->data->periods, 'charts' => $response->data->available_charts, 'graph' => $response->data->graph, 'post' => array_merge((array)$response->data->post,$post) , 'colors' => $colors, 'breadcrumbs' => $breadcrumbs]);
}
public function export(Request $request) {
@ -76,6 +76,7 @@ class MetricreportController extends Controller
$post['export'] = 1;
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module.'/view', $post, 60);
//echo '<pre>'; print_r($response); print_r($post); exit;
$post = (array)$response->data->post;
$exceldata = [];
$exceldata[] = [$response->data->graph->name];
$exceldata[] = ['Report: '.ucwords($response->data->graph->agg_type).' Report'];

View File

@ -126,6 +126,9 @@ class MetricviewController extends Controller
'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'] ],
'default_interval' => ['title' => 'Default Interval', 'type' => 'select', 'required' => true, 'values' => ['month-0' => 'This Month','month-1' => 'Last Month','month-3' => 'Last 3 Months','month-6' => 'Last 6 Months','month-12' => 'Last 12 Months','day-0' => 'Today','day-1' => 'Yesterday','day-7' => 'Last 7 Days','day-30' => 'Last 30 Days','week-0' => 'This week','week-1' => 'Last week','week-2' => '-2 week','week-3' => '-3 week','week-4' => '-4 week','yearfy-0' => 'This Financial Year','yearfy-1' => 'Last Financial Year','yearcy-0' => 'This Calender Year','yearcy-1' => 'Last Calender Year'] ],
'combined_metrics' => ['title' => 'Combined Metrics (if any)', 'type' => 'textarea', 'fullwidth' => true ],
'report_roles' => ['title' => 'Data Report from Roles', 'type' => 'multiselect', 'values' => $roles_dd, 'required' => true],
@ -148,7 +151,7 @@ class MetricviewController extends Controller
} else {
foreach($data['metric'] as $k => $metric) {
$data['metrics'][] = ['metric' => $metric, 'display' => $data['display_unit'][$k], 'sort_order' => $data['sort_order'][$k] ];
$data['metrics'][] = ['metric' => $metric, 'display' => $data['display_unit'][$k], 'sort_order' => isset($data['sort_order'][$k]) ? $data['sort_order'][$k] : 0 ];
}
}
unset($data['metric']);

View File

@ -68,10 +68,11 @@ class ReminderController extends Controller
//echo '<pre>'; print_r($data['reminder']); exit;
$reminds = [];
foreach ($data['reminder']['time'] as $k => $v) {
$reminds[] = ['time' => $v, 'days' => $data['reminder']['days'][$k], 'beore_or_after' => $data['reminder']['beore_or_after'][$k], 'manager' => $data['reminder']['manager'][$k] , 'message' => $data['reminder']['message'][$k] ];
$reminds[] = ['time' => $v, 'days' => $data['reminder']['days'][$k], 'beore_or_after' => $data['reminder']['beore_or_after'][$k], 'manager' => $data['reminder']['manager'][$k] , 'message' => $data['reminder']['message'][$k] , 'checksubmission' => $data['reminder']['checksubmission'][$k] , 'plan_date_field' => $data['reminder']['plan_date_field'][$k] ];
}
unset($data['reminder']);
$data['reminders'] = $reminds;
//echo '<pre>'; print_r($data); exit;
return $data;
}

View File

@ -48,10 +48,11 @@ class SurveysubmissionController extends Controller
$request->session()->put('formdata_request', $reqdata);
//echo '<pre>'; print_r($reqdata); exit;
$response = LambdaRequest::signedrequest('post', $this->_service, $this->_module . '/getformhistory', $reqdata);
//echo '<pre>'; print_r($response); exit;
if ($response->statusCode == 401) {
return redirect('/unauthorised');
}
//echo '<pre>'; print_r($response); exit;
$fields = [
'user' => ['title' => 'Submitted By', 'type' => 'text'],
'date' => ['title' => 'Record Date', 'type' => 'text'],

View File

@ -0,0 +1,77 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\LambdaRequest;
use DB;
use \stdClass;
class TemplateController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->_service = 'communication';
$this->_module = 'template';
$this->_viewname = 'template';
$this->_title = 'Template';
$this->_base_url = '/template';
}
protected function get_list_fields()
{
return [
'actions' => ['title' => 'Actions', 'buttons' => ['edit', 'delete']],
'name' => ['title' => 'Template Name', 'type' => 'text'],
'type' => ['title' => 'Type', 'type' => 'text'],
'template_code' => ['title' => 'Template Code', 'type' => 'text'],
'status' => ['title' => 'Status', 'type' => 'select']
];
}
protected function get_form_fields($type, $values)
{
return [
'name' => ['title' => 'Template Name', 'type' => 'text', 'required' => true],
'type' => ['title' => 'Type', 'type' => 'select', 'required' => true, 'values' => ['whatsapp' => 'Whatsapp', 'whatsapp_interakt' => 'Whatsapp Interakt', 'sms' => 'SMS']],
'template_code' => ['title' => 'Template Code', 'type' => 'text', 'required' => true],
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled']],
'header_type' => ['title' => 'Header Type', 'type' => 'select', 'required' => true, 'values' => ['none' => 'None', 'text' => 'Text', 'video' => 'Video', 'image' => 'Image', 'document' => 'Document'] ],
'header_text' => ['title' => 'Header Text (if header type is text)', 'type' => 'text'],
'template_body' => ['title' => 'Template Body', 'type' => 'textarea', 'required' => true, 'fullwidth' => true],
'footer_text' => ['title' => 'Footer Text', 'type' => 'text'],
// 'header_params' => ['title' => 'Header Params', 'type' => 'textarea', 'required' => true],
// 'body_params' => ['title' => 'Body Params', 'type' => 'textarea', 'required' => true],
// 'button_params' => ['title' => 'Button Params', 'type' => 'textarea', 'required' => true],
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled']],
'buttons' => ['title' => 'Options', 'type' => 'mapping', 'fullwidth' => true ],
//'image' => ['title' => 'Template Image', 'type' => 'image', 'required' => true]
];
}
protected function _beforesave($type, $request)
{
$data = $request->except('_token');
$data['header_param_count'] = substr_count($data['header_text'],"{{");
$data['body_param_count'] = substr_count($data['template_body'],"{{");
return $data;
}
protected function _beforeform($type, $values) {
if ($type == 'edit') {
$buttons = [];
foreach($values )
echo '<pre>'; print_r($values); exit;
$values->body_params = json_encode($values->body_params);
$values->button_params = json_encode($values->button_params);
$values->header_params = json_encode($values->header_params);
}
return $values;
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\LambdaRequest;
use DB;
use \stdClass;
class TopicController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->_service = 'communication';
$this->_module = 'topic';
$this->_viewname = 'topic';
$this->_title = 'Topics';
$this->_base_url = '/topic';
}
protected function get_list_fields()
{
return [
'actions' => ['title' => 'Actions', 'buttons' => ['edit', 'delete']],
'name' => ['title' => 'Template Name', 'type' => 'text'],
'message' => ['title' => 'Message', 'type' => 'text'],
'description' => ['title' => 'Description', 'type' => 'text'],
'status' => ['title' => 'Status', 'type' => 'select']
];
}
protected function get_form_fields($type, $values)
{
return [
'name' => ['title' => 'Template Name', 'type' => 'text', 'required' => true],
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled']],
'description' => ['title' => 'Description', 'type' => 'text', 'required' => true, 'fullwidth' => true],
'message' => ['title' => 'Message', 'type' => 'textarea', 'required' => true, 'fullwidth' => true],
'image' => ['title' => 'Template Image', 'type' => 'image', 'required' => true]
];
}
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);
//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 ($type == 'edit') {
// $values->channels = explode('#', $values->channels);
// }
if ($request->file('image')) {
$data['image'] = $this->_uploadMedia($request, 'image', 'template');
}
return $data;
}
}

View File

@ -0,0 +1,88 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\LambdaRequest;
use DB;
use \stdClass;
class TopicmediaController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->_service = 'communication';
$this->_module = 'topicmedia';
$this->_viewname = 'topicmedia';
$this->_title = 'Topic Media';
$this->_base_url = '/topicmedia';
}
protected function get_list_fields()
{
return [
'actions' => ['title' => 'Actions', 'buttons' => ['edit', 'delete']],
'caption' => ['title' => 'Caption', 'type' => 'text'],
'type' => ['title' => 'Type', 'type' => 'text'],
'message' => ['title' => 'Message', 'type' => 'text'],
'status' => ['title' => 'Status', 'type' => 'select']
];
}
protected function get_form_fields($type, $values)
{
$teams = $this->getlambda('get', 'communication', 'topic', 'dropdown');
// echo '<pre>'; print_r($teams); exit;
$templates = [];
foreach ($teams->data->items as $team) {
$templates[$team->id] = $team->name;
}
return [
'template_id' => ['title' => 'Template', 'type' => 'multiselect', 'values' => $templates, 'required' => true, 'fullwidth' => true],
'caption' => ['title' => 'Caption', 'type' => 'text', 'required' => true],
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled']],
'message' => ['title' => 'Message', 'type' => 'textarea', 'required' => true],
'show_post_complete' => ['title' => 'Show Post Complete', 'type' => 'select', 'required' => true, 'values' => ['true' => 'Yes', 'false' => 'No']],
'post_complete_content' => ['title' => 'Post Complete Content', 'type' => 'textarea', 'required' => true],
'get_viewer_info' => ['title' => 'Get Viewer Info', 'type' => 'select', 'required' => true, 'values' => ['true' => 'Yes', 'false' => 'No']],
'viewer_info_fields' => ['title' => 'Viewer Info Fields', 'type' => 'checkbox', 'required' => true, 'values' => ['name' => 'Name', 'phone' => 'Phone', 'email' => 'Email', 'place' => 'Place']],
'show_post_quiz' => ['title' => 'Show Post Quiz', 'type' => 'select', 'required' => true, 'values' => ['true' => 'Yes', 'false' => 'No']],
'post_complete_quiz' => ['title' => 'Post Quiz', 'type' => 'select', 'required' => false, 'values' => $templates],
'type' => ['title' => 'Media Type', 'type' => 'select', 'required' => true, 'values' => ['video' => 'Video', 'pdf' => 'Pdf', 'audio' => 'Audio', 'image' => 'Image', 'external_url' => 'External Url']],
'media_url' => ['title' => 'Media Url', 'type' => 'text', 'required' => true],
'image' => ['title' => 'Media', 'type' => 'image', 'required' => true]
];
}
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);
//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('image')) {
$data['image'] = $this->_uploadMedia($request, 'image', 'template');
}
return $data;
}
}

View File

@ -11,7 +11,7 @@ class VerifyCsrfToken extends Middleware
*
* @var array
*/
protected $except = ['/form/metricreport*', '/form/submitpersonalized'
protected $except = ['/form/metricreport*', '/form/submitpersonalized', '/formdatalist/zipmultiple'
//
];
}

View File

@ -17,6 +17,7 @@ class LambdaRequest
'form' => 'http://localhost:3015/dev/',
'detailing' => 'http://localhost:3016/dev/',
'competition' => 'http://localhost:3017/dev/',
'communication' => 'http://localhost:3018/dev/',
];
protected const PROD_URL = 'https://rapportapi.click/';
@ -34,6 +35,10 @@ class LambdaRequest
if(self::REMOTE_ENV != 'local' && $service == 'form' && $url == 'formentity/getformhistory') {
$fullurl = 'https://sgrmuxa46z7xfouezyvg3tnhnq0yptjn.lambda-url.ap-south-1.on.aws/';
}
if(self::REMOTE_ENV != 'local' && $service == 'form' && $url == 'survey/getformhistory') {
$fullurl = 'https://tvp2drn5c2jpf7dpxdwwykdez40ikfbz.lambda-url.ap-south-1.on.aws/';
}
if($token == '') {
$response = Http::post($fullurl, $params);
} else {
@ -61,6 +66,11 @@ class LambdaRequest
$fullurl = self::genurl($service, $url);
if(self::REMOTE_ENV != 'local' && $service == 'metric' && $url == 'metric_report/view') {
$fullurl = 'https://zbmttswaqimy3nmo5wactmja3i0uosyv.lambda-url.ap-south-1.on.aws/';
$timeout = 600;
}
if(self::REMOTE_ENV != 'local' && $service == 'form' && $url == 'survey/getformhistory') {
$fullurl = 'https://tvp2drn5c2jpf7dpxdwwykdez40ikfbz.lambda-url.ap-south-1.on.aws/';
$timeout = 600;
}
if($type == 'post') {
$response = Http::timeout($timeout)->withHeaders(['Authorization' => Auth::user()->access_token])->post($fullurl, $data);

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

View File

@ -19,13 +19,13 @@
<div class="auth-logo">
<a href="{{route('any', 'index')}}" class="logo logo-dark text-center">
<span class="logo-lg">
<img src="{{asset('/images/rapport-logo.png')}}" alt="" class="img-fluid">
<img src="{{asset('/images/velogo-light.png')}}" alt="" class="img-fluid">
</span>
</a>
<a href="{{route('any', 'index')}}" class="logo logo-light text-center">
<span class="logo-lg">
<img src="{{asset('/images/rapport-logo.png')}}" alt="" class="img-fluid">
<img src="{{asset('/images/rvelogo-light.png')}}" alt="" class="img-fluid">
</span>
</a>
</div>

View File

@ -20,12 +20,12 @@
<div class="auth-logo">
<a href="{{route('any', 'index')}}" class="logo logo-dark text-center">
<span class="logo-lg">
<img src="{{asset('/images/rapport-logo.png')}}" alt="" class="img-fluid">
<img src="{{asset('/images/velogo-light.png')}}" alt="" class="img-fluid">
</span>
</a>
<a href="{{route('any', 'index')}}" class="logo logo-light text-center">
<span class="logo-lg">
<img src="{{asset('/images/rapport-logo.png')}}" alt="" class="img-fluid">
<img src="{{asset('/images/velogo-light.png')}}" alt="" class="img-fluid">
</span>
</a>
</div>

View File

@ -0,0 +1,136 @@
@extends('layouts.vertical', ["page_title"=> "Add & Edit Products"])
@section('css')
<!-- third party css -->
<link href="{{asset('assets/libs/nestable2/nestable2.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">
<div class="card-body">
<div class="row">
<div class="col-md-6 p-2">
<h4 class="page-title">Bot Intents</h4>
</div>
<div class="col-md-6 p-2">
<button class="btn btn-success float-end add-child-btn" myid="root" myname="Top" title="Add child">Add Root Intent</button>
</div>
<div class="col-md-12">
<div class="custom-dd dd" id="nestable_list_1">
@include('commbotintent.part', ['myid' => 'root', 'items' => $items])
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div>
<div id="add-clild-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<form method="post" id="hierarchy-add-form" enctype="multipart/form-data" action="/commbotintent/addchild">
@csrf
<input type="hidden" name="bot_id" value="{{$bot_id}}">
<input type="hidden" name="parent_id" id="intent-parent_id" value="">
<input type="hidden" name="id" id="intent-id" value="">
<input type="hidden" name="previous_parent" id="intent-previous_parent" value="">
<div class="modal-header">
<h4 class="modal-title">Add new Child to </h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body p-4">
<div class="row">
<div class="col-md-12">
<div class="mb-1">
<label for="field-1" class="form-label">Name (for identification)</label>
<input type="text" class="form-control" id="intent-name" name="name" required>
</div>
</div>
<div class="col-md-12">
<div class="mb-2">
<label for="field-1" class="form-label">Tags (comma seperated)</label>
<input type="text" class="form-control selectize-close-btn selectized" id="intent-tags" name="tags" required>
</div>
</div>
<div class="col-md-12">
<div class="mb-2">
<label for="field-2" class="form-label">Message</label>
<select class="form-control" id="intent-message" name="message" required>
<option value=""> -- Select Message -- </option>
@foreach($messages as $msg)
<option value="{{$msg->id}}">{{$msg->name}}</option>
@endforeach
</select>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-info waves-effect waves-light">Save changes</button>
</div>
</form>
</div>
</div>
</div><!-- /.modal -->
</div>
<style type="text/css">
.ms-container {max-width: 100%}
</style>
@endsection
@section('script')
<script src="{{asset('assets/libs/nestable2/nestable2.min.js')}}"></script>
<script type="text/javascript">
$(document).ready(function(){
$(document).on('click', '.add-child-btn', function(){
$('#intent-parent_id').val($(this).attr('myid'));
$('#hierarchy-add-form').trigger("reset");
$('#add-clild-modal').modal("show")
});
$(document).on('click', '.edit-btn', function(){
$('#hierarchy-add-form').trigger("reset");
let data = JSON.parse($(this).attr("mydata"))
console.log(data)
$('#intent-id').val(data.id)
$('#intent-parent_id').val(data.parent_id);
$('#intent-name').val(data.name)
$('#intent-tags').val(data.tags)
$('#intent-message').val(data.message)
$('#intent-tags').val(data.tags)
let bc = 1;
for(let btn of data.buttons) {
$('#button-id'+bc).val(btn.id)
$('#button-title'+bc).val(btn.title)
bc++;
}
// var selectize = tagsElement[0].selectize;
// selectize.setValue(data.tags, false)
// console.log(data.tags.split(","))
$('#add-clild-modal').modal("show")
});
$(document).on('click', '.delete-btn', function(){
window.location.href = "/commbotintent/delete?id=" + $(this).attr('myid');
});
});
</script>
@endsection

View File

@ -0,0 +1,16 @@
@if(isset($items[$myid]))
<ol class="dd-list">
@foreach($items[$myid] as $item)
<li class="dd-item" data-id="{{$item->id}}">
<div class="dd-handle">
{{$item->name}}
<button type="button" class="btn btn-soft-secondary btn-xs float-end delete-btn" myid="{{$item->id}}" title="Delete"><i class="mdi mdi-delete text-danger"></i></button>
<button type="button" class="btn btn-soft-secondary btn-xs float-end edit-btn" myid="{{$item->id}}" mydata="{{json_encode($item)}}" title="Edit"><i class="mdi mdi-square-edit-outline text-warning"></i></button>
<!-- <button type="button" class="btn btn-soft-secondary btn-xs float-end move-btn" myid="{{$item->id}}" mydata="{{json_encode($item)}}" title="Move"><i class="mdi mdi-arrow-decision text-info"></i></button> -->
<button type="button" class="btn btn-soft-secondary btn-xs float-end add-child-btn" myid="{{$item->id}}" myname="{{$item->name}}" title="Add child"><i class="mdi mdi-file-tree text-dark"></i></button>
</div>
@include('commbotintent.part', ['myid' => $item->id, 'items' => $items])
</li>
@endforeach
</ol>
@endif

View File

@ -0,0 +1,259 @@
@extends('layouts.vertical', ["page_title"=> "Add & Edit Products"])
@section('css')
<!-- third party css -->
<link href="{{asset('assets/libs/select2/select2.min.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/libs/multiselect/multiselect.min.css')}}" rel="stylesheet" type="text/css" />
<link href="{{ URL::asset('assets/libs/dropify/dropify.min.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/libs/flatpickr/flatpickr.min.css')}}" rel="stylesheet" type="text/css" />
<!-- third party css end -->
@endsection
@section('content')
<!-- Start Content-->
<div class="container-fluid">
<!-- end page title -->
@if(session()->has('message'))
<div class="alert alert-success mt-3">
{{ session()->get('message') }}
</div>
@endif
<div class="row mt-3">
<div class="col-xl-12">
<div class="card">
<form method="post" action="" id="form-availiblity" enctype="multipart/form-data">
@csrf
<div class="card-body">
<div class="row">
<div class="col-md-6 mb-3">
<h4 class="page-title">Add / Edit {{$title}}</h4>
</div>
<div class="col-md-6 mb-3">
<div class="float-end">
<a href="{{$base_url}}s" class="btn btn-dark waves-effect waves-light">Back</a>
<button type="submit" class="btn btn-success waves-effect waves-light">Submit</button>
</div>
</div>
@foreach($fields as $field => $props)
@if($props['type'] != 'hidden')
<div class="col-md-{{isset($props['fullwidth'])?'12':'6'}} mb-3">
<label for="field-{{$field}}" class="form-label">{{$props['title']}} {!!isset($props['required'])&&$props['required'] ? '<span class="text-danger">*</span>':''!!} </label>
@endif
@switch($props['type'])
@case('hidden')
<input type="{{$props['type']}}" id="field-{{$field}}" name="{{$field}}" value="{{$mode=='edit'?$item->{$field}:''}}">
@break
@case('text')
@case('email')
@case('number')
@case('tel')
<input type="{{$props['type']}}" id="field-{{$field}}" name="{{$field}}" class="form-control" placeholder="Enter {{$props['title']}}" value="{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}" {{isset($props['required'])&&$props['required']?'required':'' }}>
@break
@case('date')
<input type="text" id="field-{{$field}}" name="{{$field}}" class="form-control" placeholder="Enter {{$props['title']}}" value="{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}" data-provide="datepicker" data-date-format="mm-dd-yyyy" data-date-autoclose="true" {{isset($props['required'])&&$props['required']?'required':'' }}>
@break
@case('datetime')
<input type="text" id="field-{{$field}}" name="{{$field}}" class="form-control datetime" placeholder="Enter {{$props['title']}}" value="{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}" {{isset($props['required'])&&$props['required']?'required':'' }}>
@break
@case('textarea')
<textarea id="field-{{$field}}" name="{{$field}}" class="form-control" placeholder="Enter {{$props['title']}}" {{isset($props['required'])&&$props['required']?'required':'' }}>{{$mode=='edit'&&isset($item->{$field})?$item->{$field}:''}}</textarea>
@break
@case('select')
<select class="form-control" id="field-{{$field}}" name="{{$field}}" {{isset($props['required'])&&$props['required']?'required':'' }}>
<option value=""> -- Select {{$props['title']}} -- </option>
@foreach($props['values'] as $k => $v)
<option value="{{$k}}" {{$mode=='edit' && isset($item->{$field}) && $item->{$field} == $k ? 'selected="selected"':''}}>{{$v}}</option>
@endforeach
</select>
@break
@case('checkbox')
@foreach($props['values'] as $k => $v)
<div class="form-check mb-2 form-check-blue">
<input class="form-check-input" type="checkbox" name="{{$field}}[]" value="{{$k}}" id="field-{{$field}}-{{$k}}" {{$mode=='edit' && isset($item->{$field}) && in_array($k, $item->{$field}) ? 'checked':''}}>
<label class="form-check-label" for="field-{{$field}}-{{$k}}">{{$v}}</label>
</div>
@endforeach
@break
@case('multiselect')
<select class="form-control select2-multiple" data-toggle="select2" data-width="100%" multiple="multiple" data-placeholder="Choose {{$props['title']}}" id="field-{{$field}}" name="{{$field}}[]" {{isset($props['required'])&&$props['required']?'required':'' }}>
<option value=""> -- Select {{$props['title']}} -- </option>
@foreach($props['values'] as $k => $v)
<option value="{{$k}}" {{$mode=='edit' && isset($item->{$field}) && in_array($k, $item->{$field}) ? 'selected="selected"':''}}>{{$v}}</option>
@endforeach
</select>
@break
@case('bigmultiselect')
<select multiple="multiple" class="bigmultiselect multi-select" id="field-{{$field}}" name="{{$field}}[]" {{isset($props['required'])&&$props['required']?'required':'' }}>
@foreach($props['values'] as $k => $v)
<option value="{{$k}}" {{$mode=='edit' && in_array($k, $item->{$field}) ? 'selected="selected"':''}}>{{$v}}</option>
@endforeach
</select>
@break
@case('yesno')
<div>
<div class="form-check mb-2 form-check-success form-check-inline">
<input class="form-check-input" type="radio" name="{{$field}}" id="field-{{$field}}-yes" value="yes" {{$mode=='edit' && 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' && isset($item->{$field})?$item->{$field}:''}}" data-allowed-file-extensions="png jpg jpeg gif mp4 pdf mp3 zip" />
<p class="text-muted text-center mt-2 mb-0">1GB Max File size</p>
</div>
@break
@case('mapping')
<div class="col-md-12"><button type="button" class="btn btn-info btn-xs float-end" id="btn-add-approver">Add Button</button></div>
<div id="approver-wrapper" class="row">
<div class="col-md-12 mb-2">
<div class="row">
<div class="col-md-1">
<label>Type</label>
</div>
<div class="col-md-3">
<label>Id</label>
</div>
<div class="col-md-3">
<label>Title</label>
</div>
<div class="col-md-4">
<label>Description (only for list type)</label>
</div>
<div class="col-1">
</div>
</div>
</div>
@if($mode=='edit')
@foreach($item->{$field} as $map)
<div class="col-md-12 mb-2">
<div class="row">
<div class="col-md-1">
<select class="form-control" name="button[type][]" required>
<option value="reply" {{$map->type == 'reply' ? 'seledted':''}}>Reply</option>
<option value="url" {{$map->type == 'url' ? 'seledted':''}}>URL</option>
</select>
</div>
<div class="col-md-3">
<input type="text" class="form-control" name="button[id][]" value="{{$map->id}}" required>
</div>
<div class="col-md-3">
<input type="text" class="form-control" name="button[title][]" value="{{$map->title}}" maxlength="24" required>
</div>
<div class="col-md-4">
<input type="text" class="form-control" name="button[description][]" value="{{isset($map->description)?$map->description:""}}">
</div>
<div class="col-md-1">
<button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button>
</div>
</div>
</div>
@endforeach
@endif
</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"
});
$('#btn-add-approver').click(function(){
$('#approver-wrapper').append(`<div class="col-md-12 mb-2">
<div class="row">
<div class="col-md-1">
<select class="form-control" name="button[type][]" required>
<option value="reply">Reply</option>
<option value="url">URL</option>
</select>
</div>
<div class="col-md-3">
<input type="text" class="form-control" name="button[id][]" value="" required>
</div>
<div class="col-md-3">
<input type="text" class="form-control" name="button[title][]" value="" maxlength="24" required>
</div>
<div class="col-md-4">
<input type="text" class="form-control" name="button[description][]" value="" required>
</div>
<div class="col-md-3">
<button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button>
</div>
</div>
</div>`);
$('.btn-remove').unbind();
$('.btn-remove').click(function(){
$(this).parent().parent().remove();
});
$('.cust-date').unbind();
$('.cust-date').flatpickr();
});
});
</script>
@endsection

View File

@ -0,0 +1,327 @@
<?php
// echo "<pre>";
// print_r($fields);
// exit();
?>
@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="{{ asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet"
type="text/css" />
<link href="{{ URL::asset('assets/libs/dropify/dropify.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" id="form-availiblity" enctype="multipart/form-data">
@csrf
<div class="card-body">
<div class="row">
<div class="col-md-6 mb-3">
<h4 class="page-title">Add / Edit {{ $title }}</h4>
</div>
<div class="col-md-6 mb-3">
<div class="float-end">
<a href="{{ $base_url }}s"
class="btn btn-dark waves-effect waves-light">Back</a>
<button type="submit"
class="btn btn-success waves-effect waves-light">Submit</button>
</div>
</div>
@foreach ($fields as $field => $props)
@if ($props['type'] != 'hidden')
<div class="col-md-{{ isset($props['fullwidth']) ? '12' : '6' }} mb-3">
<label for="field-{{ $field }}" class="form-label">{{ $props['title'] }}
{!! isset($props['required']) && $props['required'] ? '<span class="text-danger">*</span>' : '' !!} </label>
@endif
@switch($props['type'])
@case('hidden')
<input type="{{ $props['type'] }}" id="field-{{ $field }}"
name="{{ $field }}" value="{{ $mode == 'edit' ? $item->{$field} : '' }}">
@break
@case('text')
@case('email')
@case('number')
@case('tel')
<input type="{{ $props['type'] }}" id="field-{{ $field }}"
name="{{ $field }}" class="form-control"
placeholder="Enter {{ $props['title'] }}"
value="{{ $mode == 'edit' && isset($item->{$field})
? $item->{$field}
: (isset($item->credentials->{$field})
? $item->credentials->{$field}
: (isset($item->limits->limits->{$field})
? $item->limits->limits->{$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-autoclose="true" data-date-format="mm/dd/yyyy"
{{ 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' ? $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('multiselect')
<select class="form-control select2-multiple" data-toggle="select2" data-width="100%"
multiple="multiple" data-placeholder="Choose {{ $props['title'] }}"
id="field-{{ $field }}" name="{{ $field }}[]"
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
<option value=""> -- Select {{ $props['title'] }} -- </option>
@foreach ($props['values'] as $k => $v)
<option value="{{ $k }}"
{{ $mode == 'edit' && isset($item->{$field}) && in_array($k, $item->{$field}) ? 'selected="selected"' : '' }}>
{{ $v }}</option>
@endforeach
</select>
@break
@case('bigmultiselect')
<select multiple="multiple" class="bigmultiselect multi-select"
id="field-{{ $field }}" name="{{ $field }}[]"
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
@foreach ($props['values'] as $k => $v)
<option value="{{ $k }}"
{{ $mode == 'edit' && in_array($k, $item->{$field}) ? 'selected="selected"' : '' }}>
{{ $v }}</option>
@endforeach
</select>
@break
@case('yesno')
<div>
<div class="form-check mb-2 form-check-success form-check-inline">
<input class="form-check-input" type="radio" name="{{ $field }}"
id="field-{{ $field }}-yes" value="yes"
{{ $mode == 'edit' && $item->{$field} == 'yes' ? 'checked' : '' }}
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
<label class="form-check-label" for="field-{{ $field }}-yes">Yes</label>
</div>
<div class="form-check mb-2 form-check-danger form-check-inline">
<input class="form-check-input" type="radio" name="{{ $field }}"
id="field-{{ $field }}-no" value="no"
{{ $mode == 'edit' && $item->{$field} == 'no' ? 'checked' : '' }}>
<label class="form-check-label" for="field-{{ $field }}-no">No</label>
</div>
</div>
@break
@case('image')
<div class="mt-3" id="file_wrapper">
<input type="file" name="{{ $field }}" class="dropify"
data-default-file="{{ $mode == 'edit' ? $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('file')
<div class="mt-3" id="file_wrapper">
<input type="file" name="{{ $field }}" class="dropify"
data-default-file="{{ $mode == 'edit' ? $item->{$field} : '' }}"
data-allowed-file-extensions="png jpg jpeg gif mp4 pdf mp3 zip" />
<p class="text-muted text-center mt-2 mb-0">1GB Max File size</p>
</div>
@break
@case('mapping')
<div><button type="button" class="btn btn-info btn-xs float-end"
id="btn-add-mapping">Add Participant</button></div>
<table class="table mb-0">
<thead>
<tr>
<th>Type</th>
<th>Team (if team)</th>
<th>Position/Person (Emp or Pos Code)</th>
</tr>
</thead>
<tbody>
@if ($mode == 'edit')
@foreach ($item->{$field} as $map)
<tr>
<td>
<select class="form-control" name="participants[type][]"
required>
<option value=""> -- Select Type -- </option>
@foreach ($props['types'] as $v)
<option value="{{ $v }}"
{{ $map->type == $v ? 'selected="selected"' : '' }}>
{{ $v }}</option>
@endforeach
</select>
</td>
<td>
<select class="form-control" name="participants[team][]">
<option value=""> -- Select Type -- </option>
@foreach ($props['teams'] as $k => $v)
<option value="{{ $k }}"
{{ $map->target == $k ? 'selected="selected"' : '' }}>
{{ $v }}</option>
@endforeach
</select>
</td>
<td><input type="text" name="participants[person][]"
class="form-control"
value="{{ $map->type != 'Team' ? $map->target : '' }}">
</td>
<th><button type="button"
class="btn btn-danger waves-effect waves-light btn-remove"><i
class="mdi mdi-close"></i></button></th>
</tr>
@endforeach
@else
<tr>
<td>
<select class="form-control" name="participants[type][]" required>
<option value=""> -- Select Type -- </option>
@foreach ($props['types'] as $v)
<option value="{{ $v }}">{{ $v }}
</option>
@endforeach
</select>
</td>
<td>
<select class="form-control" name="participants[team][]">
<option value=""> -- Select Type -- </option>
@foreach ($props['teams'] as $k => $v)
<option value="{{ $k }}">{{ $v }}
</option>
@endforeach
</select>
</td>
<td><input type="text" name="participants[person][]"
class="form-control" value=""></td>
<th><button type="button"
class="btn btn-danger waves-effect waves-light btn-remove"><i
class="mdi mdi-close"></i></button></th>
</tr>
@endif
</tbody>
</table>
@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%
}
.dropify-wrapper .dropify-message span.file-icon {
font-size: 20px;
color: #CCC;
}
</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/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ URL::asset('assets/libs/dropify/dropify.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).'
}
});
@if (isset($fields['participants']))
$('#btn-add-mapping').click(function() {
$('table tbody').append(`<tr>
<td>
<select class="form-control" name="participants[type][]" required>
<option value=""> -- Select Type -- </option>
<option value="Team"> Team </option>
<option value="Position"> Position </option>
<option value="User"> User </option>
</select>
</td>
<td>
<select class="form-control" name="participants[team][]">
<option value=""> -- Select Type -- </option>
@foreach ($fields['participants']['teams'] as $k => $v)
<option value="{{ $k }}">{{ $v }}</option>
@endforeach
</select>
</td>
<td><input type="text" name="participants[person][]" class="form-control" value=""></td>
<th><button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button></th>
</tr>`);
$('.btn-remove').unbind();
$('.btn-remove').click(function() {
$(this).parent().parent().remove();
});
$('.cust-date').unbind();
$('.cust-date').flatpickr();
});
$('.btn-remove').click(function() {
$(this).parent().parent().remove();
});
@endif
});
</script>
@endsection

View File

@ -93,11 +93,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>

View File

@ -64,6 +64,9 @@
@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>

View File

@ -0,0 +1,272 @@
@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>
<!-- <tfoot>
<tr>
@foreach($fields as $field => $props)
<th>
@if($field != 'actions')
<input type="text" placeholder="Search" class="form-control" />
@endif
</th>
@endforeach
</tr>
</tfoot> -->
<tbody>
</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>
/* placing the footer on top */
thead {display: table-header-group;}
tfoot {display: table-header-group;}
#con-close-modal .checkbox input[type=checkbox] {margin-left: -16px;}
.mdi-square-edit-outline{color: #FF5722;}
.mdi-account-circle{color: #4CAF50;}
</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($){
var selectedContacts = [];
var table = $('#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');
},
fixedHeader: true,
"pageLength": 50,
"lengthMenu": [[50, 100, 250, 500], [50, 100, 250, 500]],
'processing': true,
'serverSide': true,
'serverMethod': 'get',
searchDelay: 2000,
"order": [[ 1, "asc" ]],
'searching': true,
'info': true,
"ajax": {
url: '{{$base_url}}/ajaxlist',
data:{
//'listfilters': listfilters
},
dataSrc: 'data'
},
columns: [
@foreach($fields as $field => $props)
@if($field == 'actions')
{
data: null,
render: function ( data, type, row ) {
return '<input type="checkbox" class="contact-select" value="'+row.id+'" '+((selectedContacts.indexOf(row.id)>-1)?'checked="checked"':'' )+'>' + (data.actions.map(l => '<a href="{{$base_url}}'+l.link+'" class="action-icon"> <i class="mdi mdi-'+l.icon+'"></i></a>').join(''))
}
},
@else
{ "data": "{{$field}}" },
@endif
@endforeach
],
"drawCallback": function () {
$('.dataTables_paginate > .pagination').addClass('pagination-rounded');
$('.contact-select').unbind();
$('.contact-select').click(function(){
if($(this).is(':checked')) {
selectedContacts.push($(this).val());
} else {
selectedContacts.splice(selectedContacts.indexOf($(this).val()), 1);
}
});
$('[data-toggle="tooltip"]').unbind();
$('[data-toggle="tooltip"]').tooltip();
},
"initComplete": function(settings, json) {
$('#list-page-datatable_length').append('<button class="btn btn-outline-dark btn-xs ms-5" type="button" id="save-search-btn">Save Search</button>');
$('#list-page-datatable_length').append('<button class="btn btn-outline-secondary btn-xs ms-2" type="button" id="save-selected-btn">Save Selected</button>');
$('#save-search-btn').click(function(){
var segment = prompt("Enter Segment ", "");
if (segment == null || segment == "") {
txt = "User cancelled the prompt.";
} else {
$.ajax({
type: "POST",
url: '/contact/savesegment',
data: {name:segment, _token: $('meta[name="csrf-token"]').attr('content')},
success: function( data ) {
if(data.status == 'success') {
$('#notifications').append('<div class="alert alert-success">Segment Saved Successfully</div>');
}
},
});
}
});
$('#save-selected-btn').click(function(){
var selected = prompt("Enter User list Name", "");
if (selected == null || selected == "") {
txt = "User cancelled the prompt.";
} else {
$.ajax({
type: "POST",
url: '/contact/savelist',
data: {name:selected, contacts:selectedContacts, _token: $('meta[name="csrf-token"]').attr('content')},
success: function( data ) {
if(data.status == 'success') {
$('#notifications').append('<div class="alert alert-success">Segment Saved Successfully</div>');
}
},
});
}
});
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();
}
});
$searchButton = $('<button class="btn btn-success btn-xs p-1 m-2">')
.text('Search')
.click(function() {
api.search(textBox.val()).draw();
}),
$clearButton = $('<button class="btn btn-warning btn-xs p-1">')
.text('Clear')
.click(function() {
textBox.val('');
$searchButton.click();
})
$('.dataTables_filter').append($searchButton, $clearButton);
}
});
// table.columns().every( function (index) {
// var that = this;
// $( 'input', this.footer() ).on( 'keyup change clear', function () {
// console.log(this.value)
// that.search( this.value ).draw();
// });
// });
$('.dataTables_filter input')
.unbind('keypress keyup')
.bind('keypress keyup', function(e){
if ($(this).val().length < 3 && e.keyCode != 13) return;
table.fnFilter($(this).val());
});
$("#btn-date-filter").click(function(){
$("#date_filter_modal").modal("show")
})
});
</script>
<!-- end demo js-->
@endsection

View File

@ -18,7 +18,7 @@
<div class="text-center">
<p class="text-muted font-14 mt-2"> Now click below button to download </p>
<a href="/storage/{{$image_url}}" download class="btn btn-primary waves-effect waves-light mt-3">Download</a>
<a href="/" class="btn btn-dark waves-effect waves-light mt-3">Homepage</a>
<!-- <a href="/" class="btn btn-dark waves-effect waves-light mt-3">Homepage</a> -->
</div>
</div> <!-- end card-body -->

View File

@ -116,6 +116,9 @@
@include('layouts.shared/footer-script')
<script type="text/javascript">
jQuery(document).ready(function($){
$('.btn-primary').click(function(){
$("#pageloader").fadeIn();
})
var lastkey = '{{$lastkey}}';
$('#load-btn').click(function(){
$("#pageloader").fadeIn();

View File

@ -84,6 +84,16 @@
@case('file')
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" required>
@break
@case('multitextbox')
<div class="row">
@foreach($question->options as $option)
<div class="col-6">{{$option->display}}</div>
<div class="col-6 mb-1">
<input type="text" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:''}}">
</div>
@endforeach
</div>
@break
@endswitch
</div>
@endforeach

View File

@ -111,14 +111,12 @@
<th>Action</th>
<th>Doctor</th>
<th>Powerof5 ?</th>
<th>Duova Rx</th>
<th>Duolin Rx</th>
<th>Glycohale F Rx</th>
<th>Glycohale FB Rx</th>
<th>Maxiflo Rx</th>
<th>Maxiflo SB Rx</th>
<th>Nistami Rx</th>
<th>Tiova Rx</th>
<th>Tiova SB Rx</th>
<th>Triohale Rx</th>
<th>Asthalin Rx</th>
</tr>
</thead>
<tbody>
@ -129,15 +127,12 @@
</td>
<td><h5 class="m-0 fw-normal">{{$contact->display}}</h5></td>
<td>{{isset($contact->contact->powerof5) ? $contact->contact->powerof5 : 'No'}}</td>
<td>{{$contact->duova_rx}}</td>
<td>{{$contact->glycohale_fb_rx}}</td>
<td>{{$contact->maxiflo_rx}}</td>
<td>{{$contact->maxiflo_sb_rx}}</td>
<td>{{$contact->nistami_rx}}</td>
<td>{{$contact->tiova_rx}}</td>
<td>{{$contact->tiova_sb_rx}}</td>
<td>{{$contact->triohale_rx}}</td>
<td>{{isset($contact->duolin_rx) ? $contact->duolin_rx : '0'}}</td>
<td>{{isset($contact->glycohale_f_rx) ? $contact->glycohale_f_rx : '0'}}</td>
<td>{{isset($contact->glycohale_fb_rx) ? $contact->glycohale_fb_rx : '0'}}</td>
<td>{{isset($contact->maxiflo_rx) ? $contact->maxiflo_rx : '0'}}</td>
<td>{{isset($contact->maxiflo_sb_rx) ? $contact->maxiflo_sb_rx : '0'}}</td>
<td>{{isset($contact->asthalin_rx) ? $contact->asthalin_rx : '0'}}</td>
</tr>
@endforeach

View File

@ -0,0 +1,319 @@
<!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> -->
<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-md-12" id="table-wrapper">
<div class="card">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-striped table-hover table-nowrap table-centered m-0">
<thead class="table-light">
<tr>
<th>Action</th>
<th>Execution Done</th>
<th>Doctor Name</th>
<th>Plan Date</th>
<th>Execution Date</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->execution_date) && $sub->formdata->execution_date > 0) ?'Yes':'No' }}</td>
<td>{{$sub->formdata->contact_id}}</td>
<td>{{$sub->formdata->record_date}}</td>
<td>{{$sub->formdata->execution_date}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="form-wrapper">
<form method="POST" action="/form/submit" id="report-form">
<input type="hidden" name="form_id" value="{{$form_id}}">
@csrf
@foreach($questions as $question)
@if(in_array($question->code, ['record_date','contact_id']))
<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
@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>
<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">
@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">
const slugify = str =>
str
.toLowerCase()
.trim()
.replace(/[^\w\s-]/g, '')
.replace(/[\s_-]+/g, '-')
.replace(/^-+|-+$/g, '');
$('#form-wrapper').hide()
$('#execution-form-wrapper').hide()
$('#add-camp-btn').click(function(){
$('#form-wrapper').show()
$('#table-wrapper').hide()
$('#execution-form-wrapper').hide()
})
$('.edit-btn').click(function(){
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').val($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'));
else
$('#execution-'+k).val(selected[k]);
}
}
$('#execution-id').val(selected['id'])
$('#form-wrapper').hide()
$('#execution-form-wrapper').show()
$('#table-wrapper').hide()
})
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'
})
window.location.reload();
} 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!'
})
}
},
});
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,319 @@
<!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> -->
<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-md-12" id="table-wrapper">
<div class="card">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-striped table-hover table-nowrap table-centered m-0">
<thead class="table-light">
<tr>
<th>Action</th>
<th>Execution Done</th>
<th>Doctor Name</th>
<th>Plan Date</th>
<th>Execution Date</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->execution_date) && $sub->formdata->execution_date > 0) ?'Yes':'No' }}</td>
<td>{{$sub->formdata->contact_id}}</td>
<td>{{$sub->formdata->record_date}}</td>
<td>{{$sub->formdata->execution_date}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="form-wrapper">
<form method="POST" action="/form/submit" id="report-form">
<input type="hidden" name="form_id" value="{{$form_id}}">
@csrf
@foreach($questions as $question)
@if(in_array($question->code, ['record_date','contact_id']))
<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
@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>
<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">
@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">
const slugify = str =>
str
.toLowerCase()
.trim()
.replace(/[^\w\s-]/g, '')
.replace(/[\s_-]+/g, '-')
.replace(/^-+|-+$/g, '');
$('#form-wrapper').hide()
$('#execution-form-wrapper').hide()
$('#add-camp-btn').click(function(){
$('#form-wrapper').show()
$('#table-wrapper').hide()
$('#execution-form-wrapper').hide()
})
$('.edit-btn').click(function(){
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').val($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'));
else
$('#execution-'+k).val(selected[k]);
}
}
$('#execution-id').val(selected['id'])
$('#form-wrapper').hide()
$('#execution-form-wrapper').show()
$('#table-wrapper').hide()
})
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'
})
window.location.reload();
} 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!'
})
}
},
});
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,331 @@
<!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>Execution Done</th>
<th>Plan Date</th>
<th>Activity Date</th>
<th>Activity Type</th>
<th>Doctor</th>
<th>Speciality</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->record_date) && $sub->formdata->record_date > 0) ?'Yes':'No' }}</td>
<td>{{$sub->formdata->plan_date}}</td>
<td>{{$sub->formdata->record_date}}</td>
<td>{{$sub->formdata->activity_type}}</td>
<td><h5 class="m-0 fw-normal">{{$sub->formdata->contact_id}}</h5></td>
<td>{{$sub->formdata->speciality}}</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, ['remark','record_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">
@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-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').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'])
$('#execution-form-wrapper').show()
$('#table-wrapper').hide()
})
$('#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!'
})
}
},
});
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,358 @@
<!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/flatpickr/flatpickr.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">{{$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>
@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>Execution Done</th>
<th>SBM Name</th>
<th>Doctor Name</th>
<th>Plan Date</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->speciality) && $sub->formdata->speciality != '') ?'Yes':'No' }}</td>
<td>{{$sub->formdata->name_of_sbm}}</td>
<td><h5 class="m-0 fw-normal">{{$sub->formdata->doctor_name}}</h5></td>
<td>{{$sub->formdata->record_date}}</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, ['remark','expected_business','speciality','activity_place']))
@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')
<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('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">
@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" 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> <!-- 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/flatpickr/flatpickr.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-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-speciality').prop('readonly', true)
$('#execution-gforce_id').prop('readonly', true)
$('#execution-camp_address').prop('readonly', true)
$('#execution-camp_location_pincode').prop('readonly', true)
$('#execution-start_time_of_camp').prop('readonly', true)
$('#execution-tentative_closing_time').prop('readonly', true)
$('#execution-expected_no_of_testing').prop('readonly', true)
$('#execution-camp_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] != '')
$('#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'])
$('#execution-form-wrapper').show()
$('#table-wrapper').hide()
})
$('#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').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() ) )
})
document.getElementById("field-camp_date").min = "{{date("Y-m-d", strtotime("now")+604800)}}";
// $('#field-camp_date').change(function(event){
// let seldate = new Date($('#field-camp_date').val())
// let mindate = new Date();
// mindate.setDate(mindate.getDate() + 7);
// if(seldate < mindate) {
// alert( "Please select Camp date greater than " + mindate.toDateString() )
// $('#field-camp_date').val( mindate.toISOString().split('T')[0] )
// }
// })
// $('.datepicker').flatpickr({
// dateFormat: "m-d-Y"
// });
$('#report-form').on('submit', function(event){
event.preventDefault();
$("#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!'
})
}
},
});
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,187 @@
<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.shared/title-meta', ['title' => "Form"])
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
</head>
<div id="pageloader">
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
</div>
<body class="loading">
<div class="account-pages">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
<div class="card bg-pattern">
<div class="card-body p-3 row">
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
<br>@endif
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
</div>
<br>@endif
<div class="col-8">
<h4 class="page-title">{{$form->title}}</h4>
</div>
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="col-4">
@if($form->link_type == 'form')
<a href="/form/history" class="float-end pt-1">View History</a>
@else
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
@endif
</div>
@endif
@php
$start = strtotime("1 May 2021");
$till = strtotime("now");
if( request()->get('record_date') ) {
$target = strtotime(request()->get('record_date'));
} else {
$target = strtotime("now");
}
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id, date("m-01-Y", $target) , date("m-t-Y", $target) );
$contacts = [];
if(sizeof($history->data->submissions) > 0) {
foreach($history->data->submissions as $sub){
$contacts[$sub->formdata->contact_id] = ['id' => $sub->id, 'indamet_80_rx' => isset($sub->formdata->indamet_80_rx) ? $sub->formdata->indamet_80_rx : 0, 'indamet_160_rx' => isset($sub->formdata->indamet_160_rx) ? $sub->formdata->indamet_160_rx : 0, 'indamet_320_rx' => isset($sub->formdata->indamet_320_rx) ? $sub->formdata->indamet_320_rx : 0 ];
}
}
//echo '<pre>';print_r($contacts);echo '</pre>'; exit;
@endphp
<form method="POST" action="/form/submitmultiple" id="report-form">
<input type="hidden" name="form_id" value="{{$form_id}}">
@csrf
@if($id)
<input type="hidden" name="id" value="{{$id}}">
@endif
<div class="col-md-12 mb-2">
<label for="field-date" class="form-label">Date<span class="text-danger">*</span></label>
<input type="date" id="field-date" name="date" class="form-control" required value="{{ (sizeof($contacts) > 0 ) ? $history->data->submissions[1]->formdata->date : '' }}">
</div>
<div class="col-md-12 mb-2">
<label for="field-record_date" class="form-label">Month<span class="text-danger">*</span></label>
<select id="field-record_date" name="record_date" class="form-control" required>
@while ($start < $till)
<option value="{{ date("M Y", $start) }}" {{ date("M Y", $target)==date("M Y", $start)?'selected':'' }} >{{ date("M Y", $start) }}</option>
{{ $start = $start = $start + 60*60*24*(date("t", $start)) }}
@endwhile
</select>
</div>
<div class="col-md-12 mb-2">
<div class="table-responsive">
<table class="table table-borderless table-hover table-nowrap table-centered m-0">
<thead class="table-light">
<tr>
<th>Doctor Name</th>
<th>Indamet 80</th>
<th>Indamet 160</th>
<th>Indamet 320</th>
</tr>
</thead>
<tbody>
@foreach($questions[2]->options as $doctor)
@if(sizeof($contacts) > 0 && isset($contacts[$doctor->display]) )
<input type="hidden" name="id[]" value="{{$contacts[$doctor->display]['id']}}">
@endif
<input type="hidden" name="contact_id[]" value="{{$doctor->value}}">
<input type="hidden" name="brand[]" value="{{isset($doctor->contact->brand) ? $doctor->contact->brand : ''}}">
<tr>
<td>{{$doctor->display}}</td>
<td style="min-width: 100px;">
<input type="number" id="" name="indamet_80_rx[]" class="form-control" required value="{{ (sizeof($contacts)>0 && isset($contacts[$doctor->display]) ) ? $contacts[$doctor->display]['indamet_80_rx'] : '0' }}">
</td>
<td style="min-width: 100px;">
<input type="number" id="" name="indamet_160_rx[]" class="form-control" required value="{{ (sizeof($contacts)>0 && isset($contacts[$doctor->display]) ) ? $contacts[$doctor->display]['indamet_160_rx'] : '0' }}">
</td>
<td style="min-width: 100px;">
<input type="number" id="" name="indamet_320_rx[]" class="form-control" required value="{{ (sizeof($contacts)>0 && isset($contacts[$doctor->display]) ) ? $contacts[$doctor->display]['indamet_320_rx'] : '0' }}">
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="text-center d-grid mt-3">
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
</div>
@endif
</form>
</div> <!-- end card-body -->
</div>
<!-- end card -->
<!-- end row -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<style type="text/css">
#pageloader {
background: rgba( 255, 255, 255, 0.8 );
display: none;
height: 100%;
position: fixed;
width: 100%;
z-index: 9999;
}
#pageloader img {
left: 50%;
margin-left: -32px;
margin-top: -32px;
position: absolute;
top: 50%;
}
</style>
@include('layouts.shared/footer-script')
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#report-form').on('submit', function(event){
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/ajaxsubmitmultiple',
data: new FormData($('#report-form')[0]),
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
if(data.status == 'success') {
Swal.fire({
title: 'Great!',
text: 'Your data is successfully submitted!',
icon: 'success'
})
} else {
Swal.fire({
icon: 'error',
title: 'Data not submitted',
text: 'Something went wrong, please try again after some time!'
})
}
},
});
});
$('#field-record_date').change(function(){
window.location.href = window.location.href.split('?')[0] + '?record_date=' + $(this).val()
})
});
</script>
</body>
</html>

View File

@ -34,24 +34,6 @@
</div>
@endif
@php
$start = strtotime("1 May 2021");
$till = strtotime("now");
if( request()->get('record_date') ) {
$target = strtotime(request()->get('record_date'));
} else {
$target = strtotime("now");
}
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id, date("m-01-Y", $target) , date("m-t-Y", $target) );
$contacts = [];
if(sizeof($history->data->submissions) > 0) {
foreach($history->data->submissions as $sub){
$contacts[$sub->formdata->contact_id] = ['id' => $sub->id, 'indamet_80_rx' => isset($sub->formdata->indamet_80_rx) ? $sub->formdata->indamet_80_rx : 0, 'indamet_160_rx' => isset($sub->formdata->indamet_160_rx) ? $sub->formdata->indamet_160_rx : 0, 'indamet_320_rx' => isset($sub->formdata->indamet_320_rx) ? $sub->formdata->indamet_320_rx : 0 ];
}
}
//echo '<pre>';print_r($contacts);echo '</pre>'; exit;
@endphp
<form method="POST" action="/form/submitmultiple" id="report-form">
<input type="hidden" name="form_id" value="{{$form_id}}">
@csrf
@ -60,16 +42,7 @@
@endif
<div class="col-md-12 mb-2">
<label for="field-date" class="form-label">Date<span class="text-danger">*</span></label>
<input type="date" id="field-date" name="date" class="form-control" required value="{{ (sizeof($contacts) > 0 ) ? $history->data->submissions[1]->formdata->date : '' }}">
</div>
<div class="col-md-12 mb-2">
<label for="field-record_date" class="form-label">Month<span class="text-danger">*</span></label>
<select id="field-record_date" name="record_date" class="form-control" required>
@while ($start < $till)
<option value="{{ date("M Y", $start) }}" {{ date("M Y", $target)==date("M Y", $start)?'selected':'' }} >{{ date("M Y", $start) }}</option>
{{ $start = $start = $start + 60*60*24*(date("t", $start)) }}
@endwhile
</select>
<input type="date" id="field-date" name="record_date" class="form-control" required value="">
</div>
<div class="col-md-12 mb-2">
@ -78,30 +51,45 @@
<thead class="table-light">
<tr>
<th>Doctor Name</th>
<th>Campaign</th>
<th>Doctor Tagging</th>
<th>Indamet 80</th>
<th>Indamet 160</th>
<th>Indamet 320</th>
</tr>
</thead>
<tbody>
@foreach($questions[2]->options as $doctor)
@if(sizeof($contacts) > 0 && isset($contacts[$doctor->display]) )
<input type="hidden" name="id[]" value="{{$contacts[$doctor->display]['id']}}">
@endif
@foreach($questions[1]->options as $doctor)
{{-- @if(isset($doctor->contact->campaign) && $doctor->contact->campaign != "") --}}
<input type="hidden" name="contact_id[]" value="{{$doctor->value}}">
<input type="hidden" name="brand[]" value="{{isset($doctor->contact->brand) ? $doctor->contact->brand : ''}}">
<input type="hidden" name="campaign[]" value="{{isset($doctor->contact->campaign) ? $doctor->contact->campaign : ''}}">
<tr>
<td>{{$doctor->display}}</td>
<td>{{isset($doctor->contact->campaign) ? $doctor->contact->campaign : '-'}}</td>
<td style="min-width: 100px;">
<input type="number" id="" name="indamet_80_rx[]" class="form-control" required value="{{ (sizeof($contacts)>0 && isset($contacts[$doctor->display]) ) ? $contacts[$doctor->display]['indamet_80_rx'] : '0' }}">
<select class="form-control" id="" name="doctor_tagging[]">
<option value="">--Select--</option>
<option value="CME speaker">CME speaker</option>
<option value="CME delegate">CME delegate</option>
<option value="RTM moderator">RTM moderator</option>
<option value="RTM delegate">RTM delegate</option>
<option value="Indamet CME speaker">Indamet CME speaker</option>
<option value="Indamet CME delegate">Indamet CME delegate</option>
<option value="Airz FF RTM moderator">Airz FF RTM moderator</option>
<option value="Airz FF RTM delegate">Airz FF RTM delegate</option>
</select>
</td>
<td style="min-width: 100px;">
<input type="number" id="" name="indamet_160_rx[]" class="form-control" required value="{{ (sizeof($contacts)>0 && isset($contacts[$doctor->display]) ) ? $contacts[$doctor->display]['indamet_160_rx'] : '0' }}">
<input type="number" id="" name="indamet_80_rx[]" class="form-control" required value="0">
</td>
<td style="min-width: 100px;">
<input type="number" id="" name="indamet_320_rx[]" class="form-control" required value="{{ (sizeof($contacts)>0 && isset($contacts[$doctor->display]) ) ? $contacts[$doctor->display]['indamet_320_rx'] : '0' }}">
<input type="number" id="" name="indamet_160_rx[]" class="form-control" required value="0">
</td>
<td style="min-width: 100px;">
<input type="number" id="" name="indamet_320_rx[]" class="form-control" required value="0">
</td>
</tr>
{{-- @endif --}}
@endforeach
</tbody>
</table>

View File

@ -0,0 +1,209 @@
<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.shared/title-meta', ['title' => "Form"])
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
</head>
<div id="pageloader">
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
</div>
<body class="loading">
<div class="account-pages">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
<div class="card bg-pattern">
<div class="card-body p-3 row">
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
<br>@endif
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
</div>
<br>@endif
<div class="col-8">
<h4 class="page-title">{{$form->title}}</h4>
</div>
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="col-4">
@if($form->link_type == 'form')
<a href="/form/history" class="float-end pt-1">View History</a>
@else
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
@endif
</div>
@endif
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
<input type="hidden" name="form_id" value="{{$form_id}}">
@csrf
@if($id)
<input type="hidden" name="id" value="{{$id}}">
@endif
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
<div class="col-md-12 mb-2">
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
<select class="form-control" id="field-user_id" name="user_id" required>
<option value=""> -- Select -- </option>
@foreach($form->users as $option)
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
@endforeach
</select>
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
</div>
@endif
@foreach($questions as $question)
@if($id && in_array($question->code, ['format_attached','provision_of_cv','image_of_pan_card','cancelled_cheque']))
@continue;
@endif
@if(!$id && $question->code == 'status')
<input type="hidden" name="status" value="Plan">
@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" {{$question->required == 'yes'?'required':'' }}>
@break
@case('multitextbox')
<div class="row">
@foreach($question->options as $option)
<div class="col-6">{{$option->display}}</div>
<div class="col-6 mb-1">
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
</div>
@endforeach
</div>
@break
@endswitch
</div>
@endforeach
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="text-center d-grid mt-3">
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
</div>
@endif
</form>
</div> <!-- end card-body -->
</div>
<!-- end card -->
<!-- end row -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<style type="text/css">
#pageloader {
background: rgba( 255, 255, 255, 0.8 );
display: none;
height: 100%;
position: fixed;
width: 100%;
z-index: 9999;
}
#pageloader img {
left: 50%;
margin-left: -32px;
margin-top: -32px;
position: absolute;
top: 50%;
}
</style>
@include('layouts.shared/footer-script')
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#field-user_id').change(function(){
let hierarchy = $('option:selected', this).attr('hierarchy');
$('#field-hierarchy_id').val(hierarchy)
event.preventDefault();
$.ajax({
type: "GET",
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
$('#field-contact_id').html('')
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
for(let itm of data) {
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
}
},
});
console.log(hierarchy)
})
$('#report-form').on('submit', function(event){
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/ajaxsubmit',
data: new FormData($('#report-form')[0]),
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
if(data.status == 'success') {
Swal.fire({
title: 'Great!',
text: 'Your data is successfully submitted!',
icon: 'success'
})
$('#report-form').trigger("reset");
} else {
Swal.fire({
icon: 'error',
title: 'Data not submitted',
text: 'Something went wrong, please try again after some time!'
})
}
},
});
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,209 @@
<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.shared/title-meta', ['title' => "Form"])
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
</head>
<div id="pageloader">
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
</div>
<body class="loading">
<div class="account-pages">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
<div class="card bg-pattern">
<div class="card-body p-3 row">
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
<br>@endif
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
</div>
<br>@endif
<div class="col-8">
<h4 class="page-title">{{$form->title}}</h4>
</div>
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="col-4">
@if($form->link_type == 'form')
<a href="/form/history" class="float-end pt-1">View History</a>
@else
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
@endif
</div>
@endif
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
<input type="hidden" name="form_id" value="{{$form_id}}">
@csrf
@if($id)
<input type="hidden" name="id" value="{{$id}}">
@endif
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
<div class="col-md-12 mb-2">
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
<select class="form-control" id="field-user_id" name="user_id" required>
<option value=""> -- Select -- </option>
@foreach($form->users as $option)
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
@endforeach
</select>
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
</div>
@endif
@foreach($questions as $question)
@if($id && in_array($question->code, ['format_attached']))
@continue;
@endif
@if(!$id && $question->code == 'status')
<input type="hidden" name="status" value="Planned">
@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" {{$question->required == 'yes'?'required':'' }}>
@break
@case('multitextbox')
<div class="row">
@foreach($question->options as $option)
<div class="col-6">{{$option->display}}</div>
<div class="col-6 mb-1">
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
</div>
@endforeach
</div>
@break
@endswitch
</div>
@endforeach
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="text-center d-grid mt-3">
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
</div>
@endif
</form>
</div> <!-- end card-body -->
</div>
<!-- end card -->
<!-- end row -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<style type="text/css">
#pageloader {
background: rgba( 255, 255, 255, 0.8 );
display: none;
height: 100%;
position: fixed;
width: 100%;
z-index: 9999;
}
#pageloader img {
left: 50%;
margin-left: -32px;
margin-top: -32px;
position: absolute;
top: 50%;
}
</style>
@include('layouts.shared/footer-script')
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#field-user_id').change(function(){
let hierarchy = $('option:selected', this).attr('hierarchy');
$('#field-hierarchy_id').val(hierarchy)
event.preventDefault();
$.ajax({
type: "GET",
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
$('#field-contact_id').html('')
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
for(let itm of data) {
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
}
},
});
console.log(hierarchy)
})
$('#report-form').on('submit', function(event){
event.preventDefault();
$("#pageloader").fadeIn();
$.ajax({
type: "POST",
url: '/form/ajaxsubmit',
data: new FormData($('#report-form')[0]),
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
if(data.status == 'success') {
Swal.fire({
title: 'Great!',
text: 'Your data is successfully submitted!',
icon: 'success'
})
$('#report-form').trigger("reset");
} else {
Swal.fire({
icon: 'error',
title: 'Data not submitted',
text: 'Something went wrong, please try again after some time!'
})
}
},
});
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,228 @@
<?php
// echo '<pre>';
// print_r($submissions);
// echo '<pre>';
// print_r($questions);
?>
<!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 Data</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>
<th data-priority="1" colspan="2">Submitted By</th>
@foreach ($questions as $code => $question)
@if ($question->type == 'file')
@continue;
@else
<th data-priority="1">{{ $question->label }}</th>
@endif
@endforeach
<th data-priority="1" colspan="2">Action</th>
</tr>
</thead>
<tbody>
@foreach ($submissions as $submission)
<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>
@php
$lastButton = null;
@endphp
@foreach ($questions as $code => $question)
@if ($question->type == 'file')
@if ($lastButton)
<input type="hidden"
class="btn btn-dark btn-xs download-multi"
data-formid="{{ $submission->id }}"
data-name="{{ $code }}"
data-path="{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}">
@else
<td>
<button
class="btn btn-dark btn-xs download-multi"
data-formid="{{ $submission->id }}"
data-name="{{ $code }}"
data-path="{{ isset($submission->formdata->{$code}) ? (is_array($submission->formdata->{$code}) ? implode(', ', $submission->formdata->{$code}) : $submission->formdata->{$code}) : '' }}"
onclick="downloadmultiple('{{ $submission->id }}')">Download</button>
@php
$lastButton = $code;
@endphp
</td>
@endif
@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
</th>
</tr>
@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($) {
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-primary').click(function(){
$("#pageloader").fadeIn();
})
})
function downloadmultiple(submissionId) {
$("#pageloader").fadeIn();
console.log('Submission ID:', submissionId);
const elements = document.querySelectorAll('[data-formid]');
const filteredElements = Array.from(elements).filter(el => el.dataset.formid == submissionId);
const filesArray = filteredElements.map(el => {
return {
path: el.dataset.path,
name: el.dataset.name
}
});
const data = {
files: filesArray
};
console.log(data);
$.ajax({
type: 'POST',
url: '/formdatalist/zipmultiple',
processData: false,
contentType: false,
data: JSON.stringify(data),
contentType: 'application/json',
success: function(response) {
$("#pageloader").fadeOut();
console.log('Success:', response.zipurl);
const link = document.createElement('a');
link.style.display = 'none';
link.href = response.zipurl;
link.download = 'multiple_files.zip';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log('Error:', errorThrown);
}
});
}
</script>
</body>
</html>

View File

@ -0,0 +1,209 @@
<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.shared/title-meta', ['title' => "Form"])
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
</head>
<div id="pageloader">
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
</div>
<body class="loading">
<div class="account-pages">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
<div class="card bg-pattern">
<div class="card-body p-3 row">
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
<br>@endif
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
</div>
<br>@endif
<div class="col-8">
<h4 class="page-title">{{$form->title}}</h4>
</div>
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="col-4">
@if($form->link_type == 'form')
<a href="/form/history" class="float-end pt-1">View History</a>
@else
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
@endif
</div>
@endif
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
<input type="hidden" name="form_id" value="{{$form_id}}">
@csrf
@if($id)
<input type="hidden" name="id" value="{{$id}}">
@endif
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
<div class="col-md-12 mb-2">
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
<select class="form-control" id="field-user_id" name="user_id" required>
<option value=""> -- Select -- </option>
@foreach($form->users as $option)
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
@endforeach
</select>
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
</div>
@endif
@foreach($questions as $question)
<div class="col-md-12 mb-2">
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
@switch($question->type)
@case('hidden')
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
@break
@case('text')
@case('email')
@case('tel')
@case('date')
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
@break
@case('number')
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
<input type="hidden" id="field-camdoc_{{$question->code}}" name="camdoc_{{$question->code}}" value="">
@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':''}} campaign_doctors="{{$question->code=='contact_id'&&isset($option->contact->campaign_doctors)&&$option->contact->campaign_doctors=='Yes'?'Yes':'No' }}">{{$option->display}}</option>
@endforeach
</select>
@break
@case('checkbox')
@foreach($question->options as $option)
<div class="form-check mb-2 form-check-primary">
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
</div>
@endforeach
@break
@case('file')
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
@break
@case('multitextbox')
<div class="row">
@foreach($question->options as $option)
<div class="col-6">{{$option->display}}</div>
<div class="col-6 mb-1">
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
</div>
@endforeach
</div>
@break
@endswitch
</div>
@endforeach
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="text-center d-grid mt-3">
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
</div>
@endif
</form>
</div> <!-- end card-body -->
</div>
<!-- end card -->
<!-- end row -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<style type="text/css">
#pageloader {
background: rgba( 255, 255, 255, 0.8 );
display: none;
height: 100%;
position: fixed;
width: 100%;
z-index: 9999;
}
#pageloader img {
left: 50%;
margin-left: -32px;
margin-top: -32px;
position: absolute;
top: 50%;
}
</style>
@include('layouts.shared/footer-script')
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#field-user_id').change(function(){
let hierarchy = $('option:selected', this).attr('hierarchy');
$('#field-hierarchy_id').val(hierarchy)
event.preventDefault();
$.ajax({
type: "GET",
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
$('#field-contact_id').html('')
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
for(let itm of data) {
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
}
},
});
console.log(hierarchy)
})
$('#report-form').on('submit', function(event){
event.preventDefault();
$("#pageloader").fadeIn();
console.log($('option:selected', $('#field-contact_id')).attr('campaign_doctors'))
if($('option:selected', $('#field-contact_id')).attr('campaign_doctors') == 'Yes') {
$('input[type=number]').each(function(){
$('#field-camdoc_' + $(this).attr("name")).val($(this).val())
})
}
$.ajax({
type: "POST",
url: '/form/ajaxsubmit',
data: new FormData($('#report-form')[0]),
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
if(data.status == 'success') {
Swal.fire({
title: 'Great!',
text: 'Your data is successfully submitted!',
icon: 'success'
})
$('#report-form').trigger("reset");
} else {
Swal.fire({
icon: 'error',
title: 'Data not submitted',
text: 'Something went wrong, please try again after some time!'
})
}
},
});
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,209 @@
<!DOCTYPE html>
<html lang="en">
<head>
@include('layouts.shared/title-meta', ['title' => "Form"])
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
</head>
<div id="pageloader">
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
</div>
<body class="loading">
<div class="account-pages">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
<div class="card bg-pattern">
<div class="card-body p-3 row">
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
<br>@endif
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
</div>
<br>@endif
<div class="col-8">
<h4 class="page-title">{{$form->title}}</h4>
</div>
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="col-4">
@if($form->link_type == 'form')
<a href="/form/history" class="float-end pt-1">View History</a>
@else
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
@endif
</div>
@endif
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
<input type="hidden" name="form_id" value="{{$form_id}}">
@csrf
@if($id)
<input type="hidden" name="id" value="{{$id}}">
@endif
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
<div class="col-md-12 mb-2">
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
<select class="form-control" id="field-user_id" name="user_id" required>
<option value=""> -- Select -- </option>
@foreach($form->users as $option)
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
@endforeach
</select>
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
</div>
@endif
@foreach($questions as $question)
<div class="col-md-12 mb-2">
<label for="field-{{$question->code}}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
@switch($question->type)
@case('hidden')
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" value="{{isset($question->value)?$question->value:''}}">
@break
@case('text')
@case('email')
@case('tel')
@case('date')
<input type="{{$question->type}}" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
@break
@case('number')
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
<input type="hidden" id="field-camdoc_{{$question->code}}" name="camdoc_{{$question->code}}" value="">
@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':''}} campaign_doctors="{{$question->code=='contact_id'&&isset($option->contact->campaign_doctors)&&$option->contact->campaign_doctors=='Yes'?'Yes':'No' }}">{{$option->display}}</option>
@endforeach
</select>
@break
@case('checkbox')
@foreach($question->options as $option)
<div class="form-check mb-2 form-check-primary">
<input class="form-check-input" type="checkbox" id="field-{{$question->code}}-{{$option->value}}" name="{{$question->code}}[]" value="{{$option->value}}" {{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
</div>
@endforeach
@break
@case('file')
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" accept="image/jpg, image/jpeg, image/png" {{$question->required == 'yes'?'required':'' }}>
@break
@case('multitextbox')
<div class="row">
@foreach($question->options as $option)
<div class="col-6">{{$option->display}}</div>
<div class="col-6 mb-1">
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
</div>
@endforeach
</div>
@break
@endswitch
</div>
@endforeach
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
<div class="text-center d-grid mt-3">
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
</div>
@endif
</form>
</div> <!-- end card-body -->
</div>
<!-- end card -->
<!-- end row -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<style type="text/css">
#pageloader {
background: rgba( 255, 255, 255, 0.8 );
display: none;
height: 100%;
position: fixed;
width: 100%;
z-index: 9999;
}
#pageloader img {
left: 50%;
margin-left: -32px;
margin-top: -32px;
position: absolute;
top: 50%;
}
</style>
@include('layouts.shared/footer-script')
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#field-user_id').change(function(){
let hierarchy = $('option:selected', this).attr('hierarchy');
$('#field-hierarchy_id').val(hierarchy)
event.preventDefault();
$.ajax({
type: "GET",
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
$('#field-contact_id').html('')
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
for(let itm of data) {
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
}
},
});
console.log(hierarchy)
})
$('#report-form').on('submit', function(event){
event.preventDefault();
$("#pageloader").fadeIn();
console.log($('option:selected', $('#field-contact_id')).attr('campaign_doctors'))
if($('option:selected', $('#field-contact_id')).attr('campaign_doctors') == 'Yes') {
$('input[type=number]').each(function(){
$('#field-camdoc_' + $(this).attr("name")).val($(this).val())
})
}
$.ajax({
type: "POST",
url: '/form/ajaxsubmit',
data: new FormData($('#report-form')[0]),
processData: false,
contentType: false,
success: function( data ) {
$("#pageloader").fadeOut();
if(data.status == 'success') {
Swal.fire({
title: 'Great!',
text: 'Your data is successfully submitted!',
icon: 'success'
})
$('#report-form').trigger("reset");
} else {
Swal.fire({
icon: 'error',
title: 'Data not submitted',
text: 'Something went wrong, please try again after some time!'
})
}
},
});
});
});
</script>
</body>
</html>

View File

@ -31,14 +31,14 @@
<div class="card">
<div class="card-body">
<h4 class="header-title mb-0">{{$metric->name}}</h4>
<h6>{{$metric->periods[0]->label}}</h6>
<h6>{{$metric->current_period}}</h6>
<div class="widget-chart text-center" dir="ltr">
<div id="chart-{{$metric->id}}" class="mt-0" data-colors="#f1556c"></div>
<h5 class="text-muted mt-0">{{$metric->label}}</h5>
<h2>{{$metric->value}} {{$metric->type=='verses' ? ' / ' . $metric->max : ''}} </h2>
<div class="button-list">
@foreach($metric->available_charts as $chart)
<a href="/metricreport/report?id={{$metric->id}}&type={{$chart->type}}&chart={{$chart->chart}}&period={{$metric->periods[0]->value}}" class="btn btn-soft-blue btn-rounded">{{$chart->name}} Chart</a>
<a href="/metricreport/report?id={{$metric->id}}&type={{$chart->type}}&chart={{$chart->chart}}" class="btn btn-soft-blue btn-rounded">{{$chart->name}} Chart</a>
@endforeach
</div>
</div>

View File

@ -132,6 +132,11 @@
<a href="/contactattributes">Attributes</a>
</li>
@endif
@if(in_array('contact_list_get_all', $permissions))
<li>
<a href="/contactlists">Contact Lists</a>
</li>
@endif
</ul>
</div>
</li>
@ -214,6 +219,51 @@
</li>
@endif
@if(in_array('channel_get_all', $permissions) ||
in_array('template_get_all', $permissions) ||
in_array('templatemedia_get_all', $permissions) )
<li>
<a href="#sidebarCommunication" data-bs-toggle="collapse">
<i data-feather="message-square"></i>
<span> Communications </span>
<span class="menu-arrow"></span>
</a>
<div class="collapse" id="sidebarCommunication">
<ul class="nav-second-level">
@if(in_array('comm_bot_get_all', $permissions))
<li>
<a href="/commbots">Bots</a>
</li>
@endif
@if(in_array('channel_get_all', $permissions))
<li>
<a href="/communicationchannels">Channels</a>
</li>
@endif
@if(in_array('topic_get_all', $permissions))
<li>
<a href="/topics">Topics</a>
</li>
@endif
@if(in_array('topicmedia_get_all', $permissions))
<li>
<a href="/topicmedias">Topic Media</a>
</li>
@endif
@if(in_array('template_get_all', $permissions))
<li>
<a href="/templates">Templates</a>
</li>
@endif
@if(in_array('comcampaign_get_all', $permissions))
<li>
<a href="/comcampaigns">Campaigns</a>
</li>
@endif
</ul>
</div>
</li>
@endif
@if(in_array('metric_get_all', $permissions) ||
in_array('injestion_mapping_get_all', $permissions) ||

View File

@ -5,4 +5,5 @@
<meta content="Coderthemes" name="author" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- App favicon -->
<link rel="shortcut icon" href="../assets/images/favicon.ico">
<link rel="shortcut icon" href="../assets/images/favicon.ico">
<meta name="csrf-token" content="{{ csrf_token() }}">

View File

@ -1,5 +1,5 @@
<!-- Topbar Start -->
<div class="navbar-custom">
<div class="navbar-custom" style="background-color: #6658dd;">
<div class="container-fluid">
<ul class="list-unstyled topnav-menu float-end mb-0">
@ -44,24 +44,24 @@
</ul>
<!-- LOGO -->
<div class="logo-box">
<div class="logo-box" style="padding: 5px;">
<a href="{{route('any', 'index')}}" class="logo logo-dark text-center">
<span class="logo-sm">
<img src="{{asset('/images/rapport-logo-sm.png')}}" alt="" height="60">
<img src="{{asset('/images/velogo-light.png.png')}}" alt="" height="35">
<!-- <span class="logo-lg-text-light">UBold</span> -->
</span>
<span class="logo-lg">
<img src="{{asset('/images/rapport-logo.png')}}" alt="" height="60">
<img src="{{asset('/images/velogo-light.png.png')}}" alt="" height="35">
<!-- <span class="logo-lg-text-light">U</span> -->
</span>
</a>
<a href="{{route('any', 'index')}}" class="logo logo-light text-center">
<span class="logo-sm">
<img src="{{asset('/images/rapport-logo-sm.png')}}" alt="" height="60">
<img src="{{asset('/images/velogo-light.png')}}" alt="" height="35">
</span>
<span class="logo-lg">
<img src="{{asset('/images/rapport-logo.png')}}" alt="" height="60">
<img src="{{asset('/images/velogo-light.png')}}" alt="" height="35">
</span>
</a>
</div>

View File

@ -134,7 +134,7 @@
<div id="approver-wrapper" class="row">
<div class="col-md-12 mb-2">
<div class="row">
<div class="col-md-3">
<div class="col-md-2">
<label>Time</label>
</div>
<div class="col-md-2">
@ -146,6 +146,9 @@
<div class="col-md-3">
<label>Include Manager</label>
</div>
<div class="col-md-1">
<label>Check Submission</label>
</div>
<div class="col-2">
</div>
@ -157,7 +160,7 @@
@foreach($item->{$field} as $map)
<div class="col-md-12 mb-5">
<div class="row">
<div class="col-md-3">
<div class="col-md-2">
<input type="text" class="form-control 24hours-timepicker" name="reminder[time][]" value="{{$map->time}}" required>
</div>
<div class="col-md-2">
@ -177,12 +180,21 @@
<option value="l1,l2" {{$map->manager=='l1,l2'?'selected':''}}>Both L1 & L2</option>
</select>
</div>
<div class="col-md-1">
<select class="form-control" name="reminder[checksubmission][]" required>
<option value="yes" {{isset($map->checksubmission)&&$map->checksubmission=='yes'?'selected':''}}>Yes</option>
<option value="no" {{isset($map->checksubmission)&&$map->checksubmission=='no'?'selected':''}}>No</option>
</select>
</div>
<div class="col-2">
<button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button>
</div>
<div class="col-10 mt-2">
<textarea name="reminder[message][]" class="form-control" placeholder="Enter Message" required>{{$map->message}}</textarea>
</div>
<div class="col-2 mt-2">
<input type="text" class="form-control" name="reminder[plan_date_field][]" value="{{isset($map->plan_date_field)?$map->plan_date_field:''}}" placeholder="Plan date field">
</div>
</div>
</div>
@endforeach
@ -247,7 +259,7 @@
$('#btn-add-approver').click(function(){
$('#approver-wrapper').append(`<div class="col-md-12 mb-5">
<div class="row">
<div class="col-md-3">
<div class="col-md-2">
<input type="text" class="form-control 24hours-timepicker" name="reminder[time][]" value="" required>
</div>
<div class="col-md-2">
@ -267,12 +279,21 @@
<option value="L1,L2">Both L1 & L2</option>
</select>
</div>
<div class="col-md-1">
<select class="form-control" name="reminder[checksubmission][]" required>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</div>
<div class="col-2">
<button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button>
</div>
<div class="col-10 mt-2">
<textarea name="reminder[message][]" class="form-control" placeholder="Enter Message" required></textarea>
</div>
<div class="col-2 mt-2">
<input type="text" class="form-control" name="reminder[plan_date_field][]" value="" placeholder="Plan date field">
</div>
</div>
</div>`);

View File

@ -0,0 +1,289 @@
<?php
// echo "<pre>";
// print_r($fields);
// exit();
?>
@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="{{ asset('assets/libs/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet"
type="text/css" />
<link href="{{ URL::asset('assets/libs/dropify/dropify.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" id="form-availiblity" enctype="multipart/form-data">
@csrf
<div class="card-body">
<div class="row">
<div class="col-md-6 mb-3">
<h4 class="page-title">Add / Edit {{ $title }}</h4>
</div>
<div class="col-md-6 mb-3">
<div class="float-end">
<a href="{{ $base_url }}s"
class="btn btn-dark waves-effect waves-light">Back</a>
<button type="submit"
class="btn btn-success waves-effect waves-light">Submit</button>
</div>
</div>
@foreach ($fields as $field => $props)
@if ($props['type'] != 'hidden')
<div class="col-md-{{ isset($props['fullwidth']) ? '12' : '6' }} mb-3">
<label for="field-{{ $field }}" class="form-label">{{ $props['title'] }}
{!! isset($props['required']) && $props['required'] ? '<span class="text-danger">*</span>' : '' !!} </label>
@endif
@switch($props['type'])
@case('hidden')
<input type="{{ $props['type'] }}" id="field-{{ $field }}"
name="{{ $field }}" value="{{ $mode == 'edit' ? $item->{$field} : '' }}">
@break
@case('text')
@case('email')
@case('number')
@case('tel')
<input type="{{ $props['type'] }}" id="field-{{ $field }}"
name="{{ $field }}" class="form-control"
placeholder="Enter {{ $props['title'] }}"
value="{{ $mode == 'edit' && isset($item->{$field})
? $item->{$field}
: (isset($item->credentials->{$field})
? $item->credentials->{$field}
: (isset($item->limits->limits->{$field})
? $item->limits->limits->{$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-autoclose="true" data-date-format="mm/dd/yyyy"
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
@break
@case('textarea')
<textarea id="field-{{ $field }}" name="{{ $field }}" class="form-control" rows="7"
placeholder="Enter {{ $props['title'] }}" {{ isset($props['required']) && $props['required'] ? 'required' : '' }}>{{ $mode == 'edit' ? $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('multiselect')
<select class="form-control select2-multiple" data-toggle="select2" data-width="100%"
multiple="multiple" data-placeholder="Choose {{ $props['title'] }}"
id="field-{{ $field }}" name="{{ $field }}[]"
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
<option value=""> -- Select {{ $props['title'] }} -- </option>
@foreach ($props['values'] as $k => $v)
<option value="{{ $k }}"
{{ $mode == 'edit' && isset($item->{$field}) && in_array($k, $item->{$field}) ? 'selected="selected"' : '' }}>
{{ $v }}</option>
@endforeach
</select>
@break
@case('bigmultiselect')
<select multiple="multiple" class="bigmultiselect multi-select"
id="field-{{ $field }}" name="{{ $field }}[]"
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
@foreach ($props['values'] as $k => $v)
<option value="{{ $k }}"
{{ $mode == 'edit' && in_array($k, $item->{$field}) ? 'selected="selected"' : '' }}>
{{ $v }}</option>
@endforeach
</select>
@break
@case('yesno')
<div>
<div class="form-check mb-2 form-check-success form-check-inline">
<input class="form-check-input" type="radio" name="{{ $field }}"
id="field-{{ $field }}-yes" value="yes"
{{ $mode == 'edit' && $item->{$field} == 'yes' ? 'checked' : '' }}
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
<label class="form-check-label" for="field-{{ $field }}-yes">Yes</label>
</div>
<div class="form-check mb-2 form-check-danger form-check-inline">
<input class="form-check-input" type="radio" name="{{ $field }}"
id="field-{{ $field }}-no" value="no"
{{ $mode == 'edit' && $item->{$field} == 'no' ? 'checked' : '' }}>
<label class="form-check-label" for="field-{{ $field }}-no">No</label>
</div>
</div>
@break
@case('image')
<div class="mt-3" id="file_wrapper">
<input type="file" name="{{ $field }}" class="dropify"
data-default-file="{{ $mode == 'edit' && isset($item->{$field}) ? $item->{$field} : '' }}"
data-allowed-file-extensions="png jpg jpeg gif" />
<p class="text-muted text-center mt-2 mb-0">500MB Max File size</p>
</div>
@break
@case('file')
<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 mp4 pdf mp3 zip" />
<p class="text-muted text-center mt-2 mb-0">1GB Max File size</p>
</div>
@break
@case('mapping')
<div class="col-md-12"><button type="button" class="btn btn-info btn-xs float-end" id="btn-add-approver">Add Button</button></div>
<div id="approver-wrapper" class="row">
<div class="col-md-12 mb-2">
<div class="row">
<div class="col-md-3">
<label>Type</label>
</div>
<div class="col-md-3">
<label>Index</label>
</div>
<div class="col-md-4">
<label>Title</label>
</div>
<div class="col-md-2">
</div>
</div>
</div>
@if($mode=='edit' && isset($item->{$field}))
@foreach($item->{$field} as $map)
<div class="col-md-12 mb-2">
<div class="row">
<div class="col-md-3">
<select class="form-control" name="button[type][]" required>
<option value="reply" {{$map->type == 'reply' ? 'seledted':''}}>Reply</option>
<option value="url" {{$map->type == 'url' ? 'seledted':''}}>URL</option>
</select>
</div>
<div class="col-md-3">
<input type="text" class="form-control" name="button[index][]" value="{{$map->index}}" required>
</div>
<div class="col-md-4">
<input type="text" class="form-control" name="button[title][]" value="" maxlength="24" value="{{$map->title}}" required>
</div>
<div class="col-md-1">
<button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button>
</div>
</div>
</div>
@endforeach
@endif
</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%
}
.dropify-wrapper .dropify-message span.file-icon {
font-size: 20px;
color: #CCC;
}
</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/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ URL::asset('assets/libs/dropify/dropify.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).'
}
});
$('#btn-add-approver').click(function(){
$('#approver-wrapper').append(`<div class="col-md-12 mb-2">
<div class="row">
<div class="col-md-3">
<select class="form-control" name="button[type][]" required>
<option value="reply">Reply</option>
<option value="url">URL</option>
</select>
</div>
<div class="col-md-3">
<input type="text" class="form-control" name="button[index][]" value="" required>
</div>
<div class="col-md-4">
<input type="text" class="form-control" name="button[title][]" value="" maxlength="24" required>
</div>
<div class="col-md-2">
<button type="button" class="btn btn-danger waves-effect waves-light btn-remove"><i class="mdi mdi-close"></i></button>
</div>
</div>
</div>`);
$('.btn-remove').unbind();
$('.btn-remove').click(function(){
$(this).parent().parent().remove();
});
});
});
</script>
@endsection

View File

@ -0,0 +1,317 @@
@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" />
<!-- third party css end -->
@endsection
@section('content')
<!-- Start Content-->
<div class="container-fluid">
<!-- end page title -->
@if (session()->has('message'))
<div class="alert alert-success mt-3">
{{ session()->get('message') }}
</div>
@endif
<div class="row mt-3">
<div class="col-xl-12">
<div class="card">
<form method="post" action="" id="form-availiblity" enctype="multipart/form-data">
@csrf
<div class="card-body">
<div class="row">
<div class="col-md-6 mb-3">
<h4 class="page-title">Add / Edit {{ $title }}</h4>
</div>
<div class="col-md-6 mb-3">
<div class="float-end">
<a href="{{ $base_url }}s"
class="btn btn-dark waves-effect waves-light">Back</a>
<button type="submit"
class="btn btn-success waves-effect waves-light">Submit</button>
</div>
</div>
@foreach ($fields as $field => $props)
@if ($props['type'] != 'hidden')
<div class="col-md-{{ isset($props['fullwidth']) ? '12' : '6' }} mb-3">
<label for="field-{{ $field }}" class="form-label">{{ $props['title'] }}
{!! isset($props['required']) && $props['required'] ? '<span class="text-danger">*</span>' : '' !!} </label>
@endif
@switch($props['type'])
@case('hidden')
<input type="{{ $props['type'] }}" id="field-{{ $field }}"
name="{{ $field }}" value="{{ $mode == 'edit' ? $item->{$field} : '' }}">
@break
@case('text')
@case('email')
@case('number')
@case('tel')
<input type="{{ $props['type'] }}" id="field-{{ $field }}"
name="{{ $field }}" class="form-control"
placeholder="Enter {{ $props['title'] }}"
value="{{ $mode == 'edit' && isset($item->{$field}) ? $item->{$field} : '' }}"
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
@break
@case('date')
<input type="text" id="field-{{ $field }}" name="{{ $field }}"
class="form-control" placeholder="Enter {{ $props['title'] }}"
value="{{ $mode == 'edit' && isset($item->{$field}) ? $item->{$field} : '' }}"
data-provide="datepicker" data-date-format="mm-dd-yyyy" data-date-autoclose="true"
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
@break
@case('datetime')
<input type="text" id="field-{{ $field }}" name="{{ $field }}"
class="form-control" 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('textarea')
<textarea id="field-{{ $field }}" name="{{ $field }}" class="form-control"
placeholder="Enter {{ $props['title'] }}" {{ isset($props['required']) && $props['required'] ? 'required' : '' }}>{{ $mode == 'edit' && isset($item->{$field}) ? $item->{$field} : '' }}</textarea>
@break
@case('select')
<select class="form-control" id="field-{{ $field }}" name="{{ $field }}"
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
<option value=""> -- Select {{ $props['title'] }} -- </option>
@foreach ($props['values'] as $k => $v)
<option value="{{ $k }}"
{{ $mode == 'edit' && isset($item->{$field}) && $item->{$field} == $k ? 'selected="selected"' : '' }}>
{{ $v }}</option>
@endforeach
</select>
@break
@case('checkbox')
@foreach ($props['values'] as $k => $v)
<div class="form-check mb-2 form-check-blue">
<input class="form-check-input" type="checkbox" name="{{ $field }}[]"
value="{{ $k }}"
id="field-{{ $field }}-{{ $k }}"
{{ $mode == 'edit' && isset($item->{$field}) && in_array($k, $item->{$field}) ? 'checked' : '' }}>
<label class="form-check-label"
for="field-{{ $field }}-{{ $k }}">{{ $v }}</label>
</div>
@endforeach
@break
@case('multiselect')
<select class="form-control select2-multiple" data-toggle="select2" data-width="100%"
multiple="multiple" data-placeholder="Choose {{ $props['title'] }}"
id="field-{{ $field }}" name="{{ $field }}[]"
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
<option value=""> -- Select {{ $props['title'] }} -- </option>
@foreach ($props['values'] as $k => $v)
<option value="{{ $k }}"
{{ $mode == 'edit' && isset($item->{$field}) && in_array($k, $item->{$field}) ? 'selected="selected"' : '' }}>
{{ $v }}</option>
@endforeach
</select>
@break
@case('bigmultiselect')
<select multiple="multiple" class="bigmultiselect multi-select"
id="field-{{ $field }}" name="{{ $field }}[]"
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
@foreach ($props['values'] as $k => $v)
<option value="{{ $k }}"
{{ $mode == 'edit' && in_array($k, $item->{$field}) ? 'selected="selected"' : '' }}>
{{ $v }}</option>
@endforeach
</select>
@break
@case('yesno')
<div>
<div class="form-check mb-2 form-check-success form-check-inline">
<input class="form-check-input" type="radio" name="{{ $field }}"
id="field-{{ $field }}-yes" value="yes"
{{ $mode == 'edit' && $item->{$field} == 'yes' ? 'checked' : '' }}
{{ isset($props['required']) && $props['required'] ? 'required' : '' }}>
<label class="form-check-label"
for="field-{{ $field }}-yes">Yes</label>
</div>
<div class="form-check mb-2 form-check-danger form-check-inline">
<input class="form-check-input" type="radio" name="{{ $field }}"
id="field-{{ $field }}-no" value="no"
{{ $mode == 'edit' && $item->{$field} == 'no' ? 'checked' : '' }}>
<label class="form-check-label" for="field-{{ $field }}-no">No</label>
</div>
</div>
@break
@case('image')
<div class="mt-3" id="file_wrapper">
<input type="file" name="{{ $field }}" class="dropify"
data-default-file="{{ $mode == 'edit' && isset($item->{$field}) ? $item->{$field} : '' }}"
data-allowed-file-extensions="png jpg jpeg gif" />
<p class="text-muted text-center mt-2 mb-0">500MB Max File size</p>
</div>
@break
@case('multiimage')
<div class="mt-3" id="file_wrapper">
<input type="file" name="{{ $field }}[]" multiple class="dropify"
data-allowed-file-extensions="png jpg jpeg gif" />
<p class="text-muted text-center mt-2 mb-0">500MB Max File size</p>
</div>
@break
@case('file')
<div class="mt-3" id="file_wrapper">
<input type="file" name="{{ $field }}" class="dropify"
data-default-file="{{ $mode == 'edit' ? $item->{$field} : '' }}"
data-allowed-file-extensions="png jpg jpeg gif mp4 pdf mp3 zip" />
<p class="text-muted text-center mt-2 mb-0">1GB Max File size</p>
</div>
@break
@endswitch
@if ($props['type'] != 'hidden')
</div>
@endif
@endforeach
<div class="col-md-12 mb-3">
<div class="float-end">
<a href="{{ $base_url }}s" class="btn btn-dark waves-effect waves-light">Back</a>
<button type="submit"
class="btn btn-success waves-effect waves-light">Submit</button>
</div>
</div>
</div>
</div> <!-- end card-body -->
</form>
</div> <!-- end card-->
</div> <!-- end col -->
</div>
</div>
<style type="text/css">
.ms-container {
max-width: 100%
}
.dropify-wrapper .dropify-message span.file-icon {
font-size: 20px;
color: #CCC;
}
</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 type="text/javascript">
$(document).ready(function() {
var optionSelected = $('#field-type').find("option:selected");
var valueSelected = optionSelected.val();
if (valueSelected == 'external_url') {
$('#file_wrapper').hide();
$('#file_wrapper').prop('required', false);
$('label[for="field-image"]').hide();
$('label[for="field-media_url"]').show();
$('#field-media_url').show();
$('#field-media_url').prop('required', true);
} else {
$('#file_wrapper').show();
$('#file_wrapper').prop('required', true);
$('label[for="field-image"]').show();
$('label[for="field-media_url"]').hide();
$('#field-media_url').hide();
$('#field-media_url').prop('required', false);
}
$('#field-type').change(function() {
var optionSelected = $(this).find("option:selected");
var valueSelected = optionSelected.val();
if (valueSelected == 'external_url') {
$('#file_wrapper').hide();
$('#field-media_url').attr('value', '');
$('#file_wrapper').prop('required', false);
$('label[for="field-image"]').hide();
$('label[for="field-media_url"]').show();
$('#field-media_url').show();
$('#field-media_url').prop('required', true);
} else {
$('#file_wrapper').show();
$('#file_wrapper').prop('required', true);
$('label[for="field-image"]').show();
$('label[for="field-media_url"]').hide();
$('#field-media_url').hide();
$('#field-media_url').attr('value', '');
$('#field-media_url').prop('required', false);
}
})
$('[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).'
}
});
$('.bigmultiselect').multiSelect({
selectableHeader: "<div class='custom-header'><strong>Selectable</strong></div><input type='text' class='form-control' autocomplete='off' placeholder='Search Selectable'>",
selectionHeader: "<div class='custom-header'><strong>Selected</strong></div><input type='text' class='form-control' autocomplete='off' placeholder='Search Selected'>",
afterInit: function(ms) {
var that = this,
$selectableSearch = that.$selectableUl.prev(),
$selectionSearch = that.$selectionUl.prev(),
selectableSearchString = '#' + that.$container.attr('id') +
' .ms-elem-selectable:not(.ms-selected)',
selectionSearchString = '#' + that.$container.attr('id') +
' .ms-elem-selection.ms-selected';
that.qs1 = $selectableSearch.quicksearch(selectableSearchString)
.on('keydown', function(e) {
if (e.which === 40) {
that.$selectableUl.focus();
return false;
}
});
that.qs2 = $selectionSearch.quicksearch(selectionSearchString)
.on('keydown', function(e) {
if (e.which == 40) {
that.$selectionUl.focus();
return false;
}
});
},
afterSelect: function() {
this.qs1.cache();
this.qs2.cache();
},
afterDeselect: function() {
this.qs1.cache();
this.qs2.cache();
}
});
});
</script>
@endsection

View File

@ -31,6 +31,7 @@ use App\Http\Controllers\FormactionController;
use App\Http\Controllers\FormController;
use App\Http\Controllers\ContactattributeController;
use App\Http\Controllers\ContactController;
use App\Http\Controllers\ContactlistController;
use App\Http\Controllers\FormproductController;
use App\Http\Controllers\ReminderController;
use App\Http\Controllers\WidgetController;
@ -50,10 +51,19 @@ use App\Http\Controllers\SurveysubmissionController;
use App\Http\Controllers\CampaignController;
use App\Http\Controllers\CampaignruleController;
use App\Http\Controllers\CampaignreportController;
use App\Http\Controllers\CommbotController;
use App\Http\Controllers\CommbotmessageController;
use App\Http\Controllers\CommbotintentController;
use App\Http\Controllers\CommchannelController;
use App\Http\Controllers\TemplateController;
use App\Http\Controllers\TemplatemediaController;
use App\Http\Controllers\ComcampaignController;
use App\Http\Controllers\TopicController;
use App\Http\Controllers\TopicmediaController;
use App\Http\Controllers\QuizController;
use App\Http\Controllers\QuizquestionController;
use App\Http\Controllers\QuizsubmissionController;
/*
|--------------------------------------------------------------------------
@ -111,6 +121,7 @@ $modules = ['user' => UserController::class,
'formproduct' => FormproductController::class,
'contactattribute' => ContactattributeController::class,
'contact' => ContactController::class,
'contactlist' => ContactlistController::class,
'reminder' => ReminderController::class,
'widget' => WidgetController::class,
'formdata' => FormdataController::class,
@ -133,7 +144,17 @@ $modules = ['user' => UserController::class,
'communicationchannel' => CommchannelController::class,
'template' => TemplateController::class,
'templatemedia' => TemplatemediaController::class,
'comcampaign' => ComcampaignController::class,
'topic' => TopicController::class,
'topicmedia' => TopicmediaController::class,
'commbot' => CommbotController::class,
'commbotmessage' => CommbotmessageController::class,
'commbotintent' => CommbotintentController::class,
'quiz' => QuizController::class,
'quizquestion' => QuizquestionController::class,
'quizsubmission' => QuizsubmissionController::class,
];
foreach ($modules as $mod => $class) {
Route::get('/'.$mod.'s', [$class, 'list'])->name($mod.'-list');
@ -165,6 +186,10 @@ Route::get('/form/{finfo}', [FormController::class, 'handle']);
Route::get('/srvey/{finfo}', [FormController::class, 'surveyhandle']);
Route::post('/srvey/ajaxsubmit', [FormController::class, 'ajaxsurveysubmit']);
Route::get('/quizly/{finfo}', [FormController::class, 'quizhandle']);
Route::post('/quizly/ajaxsubmit', [FormController::class, 'ajaxquizsubmit']);
Route::post('/formdatalist/zipmultiple', [FormController::class, 'zipmultiple']);
Route::get('/srvey/ciplatodoctor', [SurveyController::class, 'ajaxgnpsubmit']);
Route::post('doctor/submitnew', [DoctorController::class, 'createdoctor']);