update_21.09.23
This commit is contained in:
@@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
|
use App\Traits\UsesUuid;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class FormData extends Model
|
class FormData extends Model
|
||||||
{
|
{
|
||||||
use \App\Traits\UsesUuid;
|
use UsesUuid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that aren't mass assignable.
|
* The attributes that aren't mass assignable.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Enums\User\RoleEnum;
|
||||||
use App\Form;
|
use App\Form;
|
||||||
use App\PackageSubscription;
|
use App\PackageSubscription;
|
||||||
use App\User;
|
use App\User;
|
||||||
@@ -143,9 +144,10 @@ class FormController extends Controller
|
|||||||
$request->session()->forget('validated_protected_form');
|
$request->session()->forget('validated_protected_form');
|
||||||
$nav = false;
|
$nav = false;
|
||||||
$iframe_enabled = $request->get('iframe', false);
|
$iframe_enabled = $request->get('iframe', false);
|
||||||
|
$action_by = auth()->user()->roles->first()->name;
|
||||||
|
|
||||||
return view('form.show')
|
return view('form.show')
|
||||||
->with(compact('form', 'nav', 'is_form_closed', 'form_closed_msg', 'iframe_enabled'));
|
->with(compact('form', 'nav', 'is_form_closed', 'form_closed_msg', 'iframe_enabled', 'action_by'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,7 +170,7 @@ class FormController extends Controller
|
|||||||
|
|
||||||
//check permission if user is not a creator
|
//check permission if user is not a creator
|
||||||
$has_permission = ($form->created_by != $user_id) ? $this->doUserHavePermission($form->id, 'can_design_form') : true;
|
$has_permission = ($form->created_by != $user_id) ? $this->doUserHavePermission($form->id, 'can_design_form') : true;
|
||||||
if (! $has_permission) {
|
if (!$form->created_by !== $user_id && !auth()->user()->hasRole([RoleEnum::ADMIN->value, RoleEnum::SUPERVISOR->value])) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Enums\User\RoleEnum;
|
||||||
use App\Form;
|
use App\Form;
|
||||||
use App\FormData;
|
use App\FormData;
|
||||||
use App\Mail\FormSubmitted;
|
use App\Mail\FormSubmitted;
|
||||||
@@ -10,6 +11,7 @@ use Carbon\Carbon;
|
|||||||
use DB;
|
use DB;
|
||||||
use DNS1D;
|
use DNS1D;
|
||||||
use DNS2D;
|
use DNS2D;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
@@ -41,15 +43,15 @@ class FormDataController extends Controller
|
|||||||
|
|
||||||
//Verification for google reCaptcha
|
//Verification for google reCaptcha
|
||||||
if (isset($is_enable_recaptcha) && $is_enable_recaptcha == 1) {
|
if (isset($is_enable_recaptcha) && $is_enable_recaptcha == 1) {
|
||||||
if (isset($form_data['data']['g-recaptcha-response']) && ! empty($form_data['data']['g-recaptcha-response'])) {
|
if (isset($form_data['data']['g-recaptcha-response']) && !empty($form_data['data']['g-recaptcha-response'])) {
|
||||||
//your site secret key
|
//your site secret key
|
||||||
$secret_key = $form->schema['settings']['recaptcha']['secret_key'];
|
$secret_key = $form->schema['settings']['recaptcha']['secret_key'];
|
||||||
//get verify response data
|
//get verify response data
|
||||||
$verify_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret_key.'&response='.$form_data['data']['g-recaptcha-response']);
|
$verify_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . $secret_key . '&response=' . $form_data['data']['g-recaptcha-response']);
|
||||||
|
|
||||||
$response_data = json_decode($verify_response);
|
$response_data = json_decode($verify_response);
|
||||||
|
|
||||||
if (! $response_data->success) {
|
if (!$response_data->success) {
|
||||||
$msg = 'reCaptcha error';
|
$msg = 'reCaptcha error';
|
||||||
|
|
||||||
return $this->respondWithError($msg);
|
return $this->respondWithError($msg);
|
||||||
@@ -76,22 +78,33 @@ class FormDataController extends Controller
|
|||||||
|
|
||||||
//if token, get existing data for token
|
//if token, get existing data for token
|
||||||
$existing_token_form_data = [];
|
$existing_token_form_data = [];
|
||||||
if (! empty($request->get('token'))) {
|
if (!empty($request->get('token'))) {
|
||||||
$existing_token_form_data = FormData::where('form_id', $form->id)
|
$existing_token_form_data = FormData::where('form_id', $form->id)
|
||||||
->where('token', $request->get('token'))
|
->when(
|
||||||
|
$request->get('token') === 'null',
|
||||||
|
function (Builder $builder) {
|
||||||
|
$builder->whereNull('token');
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->when(
|
||||||
|
$request->get('token') !== 'null',
|
||||||
|
function (Builder $builder) use ($request) {
|
||||||
|
$builder->where('token', $request->get('token'));
|
||||||
|
}
|
||||||
|
)
|
||||||
->findOrFail($request->get('form_data_id'));
|
->findOrFail($request->get('form_data_id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
//if draft(incomplete) generate token & edit form url for user
|
//if draft(incomplete) generate token & edit form url for user
|
||||||
if ($form_data['status'] == 'incomplete') {
|
if ($form_data['status'] == 'incomplete') {
|
||||||
if (! empty($request->get('token'))) {
|
if (!empty($request->get('token'))) {
|
||||||
$form_data['token'] = $existing_token_form_data['token'];
|
$form_data['token'] = $existing_token_form_data['token'];
|
||||||
} else {
|
} else {
|
||||||
$form_data['token'] = Str::random(4);
|
$form_data['token'] = Str::random(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_submit_action['notification']['token'] = $form_data['token'];
|
$post_submit_action['notification']['token'] = $form_data['token'];
|
||||||
$post_submit_action['notification']['form_editable_url'] = action([\App\Http\Controllers\FormController::class, 'show'], ['form' => $form->slug ?: $form_id]).'?token='.$form_data['token'];
|
$post_submit_action['notification']['form_editable_url'] = action([\App\Http\Controllers\FormController::class, 'show'], ['form' => $form->slug ?: $form_id]) . '?token=' . $form_data['token'];
|
||||||
} else {
|
} else {
|
||||||
//if form submission status:complete, set token as null & get form view url
|
//if form submission status:complete, set token as null & get form view url
|
||||||
$post_submit_action['notification']['view_form_url'] = action([\App\Http\Controllers\FormController::class, 'show'], ['form' => $form->slug ?: $form_id]);
|
$post_submit_action['notification']['view_form_url'] = action([\App\Http\Controllers\FormController::class, 'show'], ['form' => $form->slug ?: $form_id]);
|
||||||
@@ -112,20 +125,31 @@ class FormDataController extends Controller
|
|||||||
$form_data['submission_ref'] = $number;
|
$form_data['submission_ref'] = $number;
|
||||||
|
|
||||||
if (isset($form->schema['settings']['form_submision_ref']['prefix'])) {
|
if (isset($form->schema['settings']['form_submision_ref']['prefix'])) {
|
||||||
$form_data['submission_ref'] = $form->schema['settings']['form_submision_ref']['prefix'].$form_data['submission_ref'];
|
$form_data['submission_ref'] = $form->schema['settings']['form_submision_ref']['prefix'] . $form_data['submission_ref'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($form->schema['settings']['form_submision_ref']['suffix'])) {
|
if (isset($form->schema['settings']['form_submision_ref']['suffix'])) {
|
||||||
$form_data['submission_ref'] = $form_data['submission_ref'].$form->schema['settings']['form_submision_ref']['suffix'];
|
$form_data['submission_ref'] = $form_data['submission_ref'] . $form->schema['settings']['form_submision_ref']['suffix'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$form_data['data']['submission_ref'] = $form_data['submission_ref'];
|
$form_data['data']['submission_ref'] = $form_data['submission_ref'];
|
||||||
}
|
}
|
||||||
|
|
||||||
//if token exist update the submitted data
|
//if token exist update the submitted data
|
||||||
if (! empty($request->get('token'))) {
|
if (!empty($request->get('token'))) {
|
||||||
$submission = FormData::where('form_id', $form->id)
|
$submission = FormData::where('form_id', $form->id)
|
||||||
->where('token', $request->get('token'))
|
->when(
|
||||||
|
$request->get('token') === 'null',
|
||||||
|
function (Builder $builder) {
|
||||||
|
$builder->whereNull('token');
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->when(
|
||||||
|
$request->get('token') !== 'null',
|
||||||
|
function (Builder $builder) use ($request) {
|
||||||
|
$builder->where('token', $request->get('token'));
|
||||||
|
}
|
||||||
|
)
|
||||||
->findOrFail($request->get('form_data_id'));
|
->findOrFail($request->get('form_data_id'));
|
||||||
|
|
||||||
$submission->data = $form_data['data'];
|
$submission->data = $form_data['data'];
|
||||||
@@ -141,7 +165,7 @@ class FormDataController extends Controller
|
|||||||
|
|
||||||
//if submission is draft(incomplete) then return form_data_id & saved draft msg
|
//if submission is draft(incomplete) then return form_data_id & saved draft msg
|
||||||
if (isset($form_data['data']['status']) && $form_data['data']['status'] == 'incomplete') {
|
if (isset($form_data['data']['status']) && $form_data['data']['status'] == 'incomplete') {
|
||||||
$post_submit_action['notification']['form_data_id'] = ! empty($request->get('form_data_id')) ? $request->get('form_data_id') : $submission->id;
|
$post_submit_action['notification']['form_data_id'] = !empty($request->get('form_data_id')) ? $request->get('form_data_id') : $submission->id;
|
||||||
$post_submit_action['notification']['success_msg'] = __('messages.draft_saved');
|
$post_submit_action['notification']['success_msg'] = __('messages.draft_saved');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +176,7 @@ class FormDataController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check for demo environment & form is complete or not
|
//check for demo environment & form is complete or not
|
||||||
if (! $this->isDemo() && $form_data['status'] == 'complete') {
|
if (!$this->isDemo() && $form_data['status'] == 'complete') {
|
||||||
//Send notification for form
|
//Send notification for form
|
||||||
$emailConfig = $form->schema['emailConfig'];
|
$emailConfig = $form->schema['emailConfig'];
|
||||||
|
|
||||||
@@ -175,7 +199,7 @@ class FormDataController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get signature attachments
|
//get signature attachments
|
||||||
if (! empty($signature_attachments)) {
|
if (!empty($signature_attachments)) {
|
||||||
foreach ($signature_attachments as $index => $signature) {
|
foreach ($signature_attachments as $index => $signature) {
|
||||||
$signature_attachments[$index]['base_64_uri'] = $form_data['data'][$signature['field_name']];
|
$signature_attachments[$index]['base_64_uri'] = $form_data['data'][$signature['field_name']];
|
||||||
}
|
}
|
||||||
@@ -185,11 +209,11 @@ class FormDataController extends Controller
|
|||||||
if ((isset($emailConfig['email']['attach_pdf']) && $emailConfig['email']['attach_pdf']) || (isset($emailConfig['auto_response']['attach_pdf']) && $emailConfig['auto_response']['attach_pdf'])) {
|
if ((isset($emailConfig['email']['attach_pdf']) && $emailConfig['email']['attach_pdf']) || (isset($emailConfig['auto_response']['attach_pdf']) && $emailConfig['auto_response']['attach_pdf'])) {
|
||||||
$id = $submission->id;
|
$id = $submission->id;
|
||||||
$pdf = $this->__generatePdf($id);
|
$pdf = $this->__generatePdf($id);
|
||||||
$pdf_name = Str::slug($form->name, '-').'.pdf';
|
$pdf_name = Str::slug($form->name, '-') . '.pdf';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set user defined SMTP : use_system_smtp = User SMTP
|
//Set user defined SMTP : use_system_smtp = User SMTP
|
||||||
if (! empty($emailConfig['email']['enable']) && $emailConfig['smtp']['use_system_smtp']) {
|
if (!empty($emailConfig['email']['enable']) && $emailConfig['smtp']['use_system_smtp']) {
|
||||||
//User SMTP
|
//User SMTP
|
||||||
$form = Form::with('createdBy')->findOrFail($form_id);
|
$form = Form::with('createdBy')->findOrFail($form_id);
|
||||||
$smtp = $form->createdBy->settings['smtp'];
|
$smtp = $form->createdBy->settings['smtp'];
|
||||||
@@ -216,20 +240,20 @@ class FormDataController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Form submission Notification
|
//Form submission Notification
|
||||||
if (! empty($emailConfig['email']['enable'])) {
|
if (!empty($emailConfig['email']['enable'])) {
|
||||||
|
|
||||||
//Replace the tags with values.
|
//Replace the tags with values.
|
||||||
$temp = $this->_replaceTags(
|
$temp = $this->_replaceTags(
|
||||||
$form_data['data'],
|
$form_data['data'],
|
||||||
['subject' => $emailConfig['email']['subject'],
|
['subject' => $emailConfig['email']['subject'],
|
||||||
'body' => $emailConfig['email']['body'], ],
|
'body' => $emailConfig['email']['body'],],
|
||||||
$form['schema']['form']
|
$form['schema']['form']
|
||||||
);
|
);
|
||||||
$emailConfig['email']['subject'] = $temp['subject'];
|
$emailConfig['email']['subject'] = $temp['subject'];
|
||||||
$emailConfig['email']['body'] = $temp['body'];
|
$emailConfig['email']['body'] = $temp['body'];
|
||||||
|
|
||||||
//Attachments
|
//Attachments
|
||||||
if (! empty($attachments)) {
|
if (!empty($attachments)) {
|
||||||
$emailConfig['email']['attachment'] = $this->getAttachments($attachments, $form_data['data']);
|
$emailConfig['email']['attachment'] = $this->getAttachments($attachments, $form_data['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,8 +264,8 @@ class FormDataController extends Controller
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
isset($emailConfig['email']['reply_to_email']) &&
|
isset($emailConfig['email']['reply_to_email']) &&
|
||||||
! empty($emailConfig['email']['reply_to_email']) &&
|
!empty($emailConfig['email']['reply_to_email']) &&
|
||||||
! empty($form_data['data'][$emailConfig['email']['reply_to_email']])
|
!empty($form_data['data'][$emailConfig['email']['reply_to_email']])
|
||||||
) {
|
) {
|
||||||
$emailConfig['email']['reply_to'] = $form_data['data'][$emailConfig['email']['reply_to_email']];
|
$emailConfig['email']['reply_to'] = $form_data['data'][$emailConfig['email']['reply_to_email']];
|
||||||
}
|
}
|
||||||
@@ -249,11 +273,11 @@ class FormDataController extends Controller
|
|||||||
//get barcode & qr code attachment
|
//get barcode & qr code attachment
|
||||||
if (
|
if (
|
||||||
isset($form_data['data']['submission_ref']) &&
|
isset($form_data['data']['submission_ref']) &&
|
||||||
! empty($form_data['data']['submission_ref'])
|
!empty($form_data['data']['submission_ref'])
|
||||||
) {
|
) {
|
||||||
$ref_num = $form_data['data']['submission_ref'];
|
$ref_num = $form_data['data']['submission_ref'];
|
||||||
$emailConfig['email']['barcode'][$ref_num.'_barcode.png'] = $this->_generateSubmissionRefBarCode($form->schema, $form_data['data'], 'bar_code');
|
$emailConfig['email']['barcode'][$ref_num . '_barcode.png'] = $this->_generateSubmissionRefBarCode($form->schema, $form_data['data'], 'bar_code');
|
||||||
$emailConfig['email']['barcode'][$ref_num.'_qrcode.png'] = $this->_generateSubmissionRefBarCode($form->schema, $form_data['data'], 'qr_code');
|
$emailConfig['email']['barcode'][$ref_num . '_qrcode.png'] = $this->_generateSubmissionRefBarCode($form->schema, $form_data['data'], 'qr_code');
|
||||||
}
|
}
|
||||||
Mail::send(new FormSubmitted($emailConfig['email']));
|
Mail::send(new FormSubmitted($emailConfig['email']));
|
||||||
}
|
}
|
||||||
@@ -265,7 +289,7 @@ class FormDataController extends Controller
|
|||||||
$temp = $this->_replaceTags(
|
$temp = $this->_replaceTags(
|
||||||
$form_data['data'],
|
$form_data['data'],
|
||||||
['subject' => $emailConfig['auto_response']['subject'],
|
['subject' => $emailConfig['auto_response']['subject'],
|
||||||
'body' => $emailConfig['auto_response']['body'], ],
|
'body' => $emailConfig['auto_response']['body'],],
|
||||||
$form['schema']['form']
|
$form['schema']['form']
|
||||||
);
|
);
|
||||||
$emailConfig['auto_response']['subject'] = $temp['subject'];
|
$emailConfig['auto_response']['subject'] = $temp['subject'];
|
||||||
@@ -274,12 +298,12 @@ class FormDataController extends Controller
|
|||||||
//"TO" field is dynamic input value.
|
//"TO" field is dynamic input value.
|
||||||
$emailConfig['auto_response']['to'] = isset($form_data['data'][$emailConfig['auto_response']['to']]) ? $form_data['data'][$emailConfig['auto_response']['to']] : null;
|
$emailConfig['auto_response']['to'] = isset($form_data['data'][$emailConfig['auto_response']['to']]) ? $form_data['data'][$emailConfig['auto_response']['to']] : null;
|
||||||
|
|
||||||
if (! empty($attachments)) {
|
if (!empty($attachments)) {
|
||||||
$emailConfig['auto_response']['attachment'] = $this->getAttachments($attachments, $form_data['data']);
|
$emailConfig['auto_response']['attachment'] = $this->getAttachments($attachments, $form_data['data']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//get signature attachments
|
//get signature attachments
|
||||||
if (! empty($signature_attachments)) {
|
if (!empty($signature_attachments)) {
|
||||||
foreach ($signature_attachments as $index => $signature) {
|
foreach ($signature_attachments as $index => $signature) {
|
||||||
$signature_attachments[$index]['base_64_uri'] = $form_data['data'][$signature['field_name']];
|
$signature_attachments[$index]['base_64_uri'] = $form_data['data'][$signature['field_name']];
|
||||||
}
|
}
|
||||||
@@ -294,27 +318,27 @@ class FormDataController extends Controller
|
|||||||
//get barcode & qr code attachment for response
|
//get barcode & qr code attachment for response
|
||||||
if (
|
if (
|
||||||
isset($form_data['data']['submission_ref']) &&
|
isset($form_data['data']['submission_ref']) &&
|
||||||
! empty($form_data['data']['submission_ref'])
|
!empty($form_data['data']['submission_ref'])
|
||||||
) {
|
) {
|
||||||
$ref_num = $form_data['data']['submission_ref'];
|
$ref_num = $form_data['data']['submission_ref'];
|
||||||
$emailConfig['auto_response']['barcode'][$ref_num.'_barcode.png'] = $this->_generateSubmissionRefBarCode($form->schema, $form_data['data'], 'bar_code');
|
$emailConfig['auto_response']['barcode'][$ref_num . '_barcode.png'] = $this->_generateSubmissionRefBarCode($form->schema, $form_data['data'], 'bar_code');
|
||||||
$emailConfig['auto_response']['barcode'][$ref_num.'_qrcode.png'] = $this->_generateSubmissionRefBarCode($form->schema, $form_data['data'], 'qr_code');
|
$emailConfig['auto_response']['barcode'][$ref_num . '_qrcode.png'] = $this->_generateSubmissionRefBarCode($form->schema, $form_data['data'], 'qr_code');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($emailConfig['auto_response']['to'])) {
|
if (!empty($emailConfig['auto_response']['to'])) {
|
||||||
Mail::send(new FormSubmitted($emailConfig['auto_response']));
|
Mail::send(new FormSubmitted($emailConfig['auto_response']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Send data to mailchimp if enabled.
|
//Send data to mailchimp if enabled.
|
||||||
if (! empty($form->mailchimp_details['is_enable']) && $form->mailchimp_details['is_enable'] == 1) {
|
if (!empty($form->mailchimp_details['is_enable']) && $form->mailchimp_details['is_enable'] == 1) {
|
||||||
|
|
||||||
//Set config details.
|
//Set config details.
|
||||||
config(['newsletter.apiKey' => $form->mailchimp_details['api_key']]);
|
config(['newsletter.apiKey' => $form->mailchimp_details['api_key']]);
|
||||||
config(['newsletter.lists.subscribers.id' => $form->mailchimp_details['list_id']]);
|
config(['newsletter.lists.subscribers.id' => $form->mailchimp_details['list_id']]);
|
||||||
|
|
||||||
//Subscribe if email is set.
|
//Subscribe if email is set.
|
||||||
if (isset($form_data['data'][$form->mailchimp_details['email_field']]) && ! empty($form_data['data'][$form->mailchimp_details['email_field']])) {
|
if (isset($form_data['data'][$form->mailchimp_details['email_field']]) && !empty($form_data['data'][$form->mailchimp_details['email_field']])) {
|
||||||
|
|
||||||
//Get dynamic field from form input.
|
//Get dynamic field from form input.
|
||||||
$email = $form_data['data'][$form->mailchimp_details['email_field']];
|
$email = $form_data['data'][$form->mailchimp_details['email_field']];
|
||||||
@@ -322,7 +346,7 @@ class FormDataController extends Controller
|
|||||||
//explode name to get first & last name
|
//explode name to get first & last name
|
||||||
$name = explode(' ', $form_data['data'][$form->mailchimp_details['name_field']], 2);
|
$name = explode(' ', $form_data['data'][$form->mailchimp_details['name_field']], 2);
|
||||||
$fname = $name[0];
|
$fname = $name[0];
|
||||||
$lname = ! empty($name[1]) ? $name[1] : '';
|
$lname = !empty($name[1]) ? $name[1] : '';
|
||||||
if ($form->mailchimp_details['status'] == 'subscribe') {
|
if ($form->mailchimp_details['status'] == 'subscribe') {
|
||||||
Newsletter::subscribe($email, ['FNAME' => $fname, 'LNAME' => $lname]);
|
Newsletter::subscribe($email, ['FNAME' => $fname, 'LNAME' => $lname]);
|
||||||
} elseif ($form->mailchimp_details['status'] == 'subscribe_pending') {
|
} elseif ($form->mailchimp_details['status'] == 'subscribe_pending') {
|
||||||
@@ -349,11 +373,11 @@ class FormDataController extends Controller
|
|||||||
{
|
{
|
||||||
$acelle_mail_info = $form->acelle_mail_info;
|
$acelle_mail_info = $form->acelle_mail_info;
|
||||||
if (
|
if (
|
||||||
! empty($acelle_mail_info) &&
|
!empty($acelle_mail_info) &&
|
||||||
$acelle_mail_info['is_enable'] &&
|
$acelle_mail_info['is_enable'] &&
|
||||||
! empty($acelle_mail_info['api_token']) &&
|
!empty($acelle_mail_info['api_token']) &&
|
||||||
! empty($acelle_mail_info['list_id']) &&
|
!empty($acelle_mail_info['list_id']) &&
|
||||||
! empty($acelle_mail_info['campaign_fields'])
|
!empty($acelle_mail_info['campaign_fields'])
|
||||||
) {
|
) {
|
||||||
$args = [
|
$args = [
|
||||||
'api_token' => trim($acelle_mail_info['api_token']),
|
'api_token' => trim($acelle_mail_info['api_token']),
|
||||||
@@ -361,12 +385,12 @@ class FormDataController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
foreach ($acelle_mail_info['campaign_fields'] as $field) {
|
foreach ($acelle_mail_info['campaign_fields'] as $field) {
|
||||||
if (! empty($field['key']) && ! empty($field['param_field_name']) && ! empty($data[$field['param_field_name']])) {
|
if (!empty($field['key']) && !empty($field['param_field_name']) && !empty($data[$field['param_field_name']])) {
|
||||||
$args[$field['key']] = is_array($data[$field['param_field_name']]) ? implode(', ', $data[$field['param_field_name']]) : strip_tags($data[$field['param_field_name']]);
|
$args[$field['key']] = is_array($data[$field['param_field_name']]) ? implode(', ', $data[$field['param_field_name']]) : strip_tags($data[$field['param_field_name']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$request_uri = config('constants.ACELLE_MAIL_API').'/subscribers'.'?'.http_build_query($args);
|
$request_uri = config('constants.ACELLE_MAIL_API') . '/subscribers' . '?' . http_build_query($args);
|
||||||
|
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
curl_setopt($curl, CURLOPT_URL, $request_uri);
|
curl_setopt($curl, CURLOPT_URL, $request_uri);
|
||||||
@@ -385,8 +409,8 @@ class FormDataController extends Controller
|
|||||||
if (
|
if (
|
||||||
isset($webhook['is_enable']) &&
|
isset($webhook['is_enable']) &&
|
||||||
$webhook['is_enable'] &&
|
$webhook['is_enable'] &&
|
||||||
! empty($webhook['url']) &&
|
!empty($webhook['url']) &&
|
||||||
! empty($webhook['secret_key'])
|
!empty($webhook['secret_key'])
|
||||||
) {
|
) {
|
||||||
|
|
||||||
//get playload to send
|
//get playload to send
|
||||||
@@ -407,16 +431,16 @@ class FormDataController extends Controller
|
|||||||
|
|
||||||
protected function _getBarCodeForRefNum($ref_num = '', $type = 'qr_code', $is_img_format = false)
|
protected function _getBarCodeForRefNum($ref_num = '', $type = 'qr_code', $is_img_format = false)
|
||||||
{
|
{
|
||||||
if (! empty($ref_num) && in_array($type, ['bar_code'])) {
|
if (!empty($ref_num) && in_array($type, ['bar_code'])) {
|
||||||
$bar_code = (string)Image::canvas(305,150,"#fff")->insert(base64_decode(DNS1D::getBarcodePNG($ref_num, 'C128', 2.5,100,array(27,41,75), true)), 'center')->encode('data-url');
|
$bar_code = (string)Image::canvas(305, 150, "#fff")->insert(base64_decode(DNS1D::getBarcodePNG($ref_num, 'C128', 2.5, 100, array(27, 41, 75), true)), 'center')->encode('data-url');
|
||||||
|
|
||||||
return $is_img_format ? '<img src="'.$bar_code.'" alt="barcode"/>' : $bar_code;
|
return $is_img_format ? '<img src="' . $bar_code . '" alt="barcode"/>' : $bar_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($ref_num) && in_array($type, ['qr_code'])) {
|
if (!empty($ref_num) && in_array($type, ['qr_code'])) {
|
||||||
$qr_code = (string)Image::canvas(300,300,"#fff")->insert(base64_decode(DNS2D::getBarcodePNG($ref_num, 'QRCODE', 12,12,array(27,41,75), true)), 'center')->encode('data-url');
|
$qr_code = (string)Image::canvas(300, 300, "#fff")->insert(base64_decode(DNS2D::getBarcodePNG($ref_num, 'QRCODE', 12, 12, array(27, 41, 75), true)), 'center')->encode('data-url');
|
||||||
|
|
||||||
return $is_img_format ? '<img src="'.$qr_code.'" alt="qrcode"/>' : $qr_code;
|
return $is_img_format ? '<img src="' . $qr_code . '" alt="qrcode"/>' : $qr_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
@@ -431,7 +455,7 @@ class FormDataController extends Controller
|
|||||||
foreach ($strings as $key => $string) {
|
foreach ($strings as $key => $string) {
|
||||||
//If value is array(like for multiselect or checkbox) then implode it.
|
//If value is array(like for multiselect or checkbox) then implode it.
|
||||||
$value = is_array($value) ? implode(',', $value) : $value;
|
$value = is_array($value) ? implode(',', $value) : $value;
|
||||||
$string = str_replace('__'.$name.'__', $value, $string);
|
$string = str_replace('__' . $name . '__', $value, $string);
|
||||||
|
|
||||||
//replace qr/bar code
|
//replace qr/bar code
|
||||||
$string = str_replace('__submission_ref_qr_code__', $ref_num_qr_code, $string);
|
$string = str_replace('__submission_ref_qr_code__', $ref_num_qr_code, $string);
|
||||||
@@ -448,13 +472,62 @@ class FormDataController extends Controller
|
|||||||
$user_id = $request->user()->id;
|
$user_id = $request->user()->id;
|
||||||
|
|
||||||
$form = Form::findOrFail($form_id);
|
$form = Form::findOrFail($form_id);
|
||||||
$data = FormData::where('form_id', $form_id)
|
$data = FormData::query()
|
||||||
->orderBy('created_at', 'desc')
|
->where('form_id', $form_id)
|
||||||
->get();
|
->orderBy('created_at', 'desc')
|
||||||
|
->get()
|
||||||
|
->filter(function (FormData $formData) use ($request) {
|
||||||
|
if (is_array($formData->data)) {
|
||||||
|
$date = strtotime(
|
||||||
|
array_values(
|
||||||
|
array_filter($formData->data, fn($item) => is_string($item) && strtotime($item))
|
||||||
|
)[0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$date = Carbon::createFromTimestamp($date)->toDateString();
|
||||||
|
$isValidStartDate = $request->filled('start_date') ?
|
||||||
|
$request->get('start_date') <= $date :
|
||||||
|
Carbon::now()->subDays(7)->toDateString() <= $date;
|
||||||
|
$isValidEndDate = $request->filled('end_date') ?
|
||||||
|
$request->get('end_date') >= $date :
|
||||||
|
Carbon::now()->toDateString() >= $date;
|
||||||
|
|
||||||
|
return $isValidStartDate && $isValidEndDate;
|
||||||
|
});
|
||||||
|
|
||||||
|
// ->when(
|
||||||
|
// $request->filled('start_date'),
|
||||||
|
// function (Builder $builder) use ($request) {
|
||||||
|
// $startDate = Carbon::createFromFormat('Y-m-d', $request->get('start_date'));
|
||||||
|
//
|
||||||
|
// $builder->where('created_at', '>=', $startDate->toDateTimeString());
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// ->when(
|
||||||
|
// $request->filled('end_date'),
|
||||||
|
// function (Builder $builder) use ($request) {
|
||||||
|
// $endDate = Carbon::createFromFormat('Y-m-d', $request->get('end_date'));
|
||||||
|
//
|
||||||
|
// $builder->where('created_at', '<=', $endDate->toDateTimeString());
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// ->when(
|
||||||
|
// !$request->filled('start_date'),
|
||||||
|
// function (Builder $builder) {
|
||||||
|
// $builder->where('created_at', '>=', Carbon::now()->subDays(7)->toDateTimeString());
|
||||||
|
// }
|
||||||
|
// )
|
||||||
|
// ->when(
|
||||||
|
// !$request->filled('end_date'),
|
||||||
|
// function (Builder $builder) {
|
||||||
|
// $builder->where('created_at', '<=', Carbon::now()->toDateTimeString());
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
//check permission if user is not a creator
|
//check permission if user is not a creator
|
||||||
$has_permission = ($form->created_by != $user_id) ? $this->doUserHavePermission($form->id, 'can_view_data') : true;
|
$has_permission = ($form->created_by != $user_id) ? $this->doUserHavePermission($form->id, 'can_view_data') : true;
|
||||||
if (! $has_permission) {
|
if (!$form->created_by !== $user_id && !auth()->user()->hasRole([RoleEnum::SUPERVISOR->value, RoleEnum::ADMIN->value]) && !$has_permission) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,7 +542,7 @@ class FormDataController extends Controller
|
|||||||
'comments' => function ($q) {
|
'comments' => function ($q) {
|
||||||
$q->latest();
|
$q->latest();
|
||||||
},
|
},
|
||||||
'comments.commentedBy', ])->findOrFail($id);
|
'comments.commentedBy',])->findOrFail($id);
|
||||||
|
|
||||||
return view('form_data.view_form_data')
|
return view('form_data.view_form_data')
|
||||||
->with(compact('form_data'));
|
->with(compact('form_data'));
|
||||||
@@ -516,11 +589,11 @@ class FormDataController extends Controller
|
|||||||
{
|
{
|
||||||
$user = request()->user();
|
$user = request()->user();
|
||||||
$form = Form::with('data')
|
$form = Form::with('data')
|
||||||
->findOrFail($id);
|
->findOrFail($id);
|
||||||
|
|
||||||
//check permission if user is not a creator
|
//check permission if user is not a creator
|
||||||
$has_permission = ($form->created_by != $user->id) ? $this->doUserHavePermission($form->id, 'can_view_data') : true;
|
$has_permission = ($form->created_by != $user->id) ? $this->doUserHavePermission($form->id, 'can_view_data') : true;
|
||||||
if (! $has_permission) {
|
if (!$has_permission) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,11 +644,11 @@ class FormDataController extends Controller
|
|||||||
private function __getVisitorsReport($form_id, $chart_type)
|
private function __getVisitorsReport($form_id, $chart_type)
|
||||||
{
|
{
|
||||||
$query = Visitor::where('form_id', $form_id)
|
$query = Visitor::where('form_id', $form_id)
|
||||||
->whereBetween(DB::raw('date(created_at)'), [Carbon::now()->subDays(30), Carbon::now()])
|
->whereBetween(DB::raw('date(created_at)'), [Carbon::now()->subDays(30), Carbon::now()])
|
||||||
->select(
|
->select(
|
||||||
DB::raw('count(form_id) as total_visits'),
|
DB::raw('count(form_id) as total_visits'),
|
||||||
DB::raw('SUM(IF(is_unique = 1,1,0)) as unique_visits')
|
DB::raw('SUM(IF(is_unique = 1,1,0)) as unique_visits')
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($chart_type == 'line') {
|
if ($chart_type == 'line') {
|
||||||
$query->addSelect(DB::raw('Date(created_at) as date'))
|
$query->addSelect(DB::raw('Date(created_at) as date'))
|
||||||
@@ -619,8 +692,8 @@ class FormDataController extends Controller
|
|||||||
}
|
}
|
||||||
//if date match store values
|
//if date match store values
|
||||||
if ($visitor_date == $date) {
|
if ($visitor_date == $date) {
|
||||||
$total_visits_in_last_30_days[] = (float) $total_visits;
|
$total_visits_in_last_30_days[] = (float)$total_visits;
|
||||||
$unique_visits_in_last_30_days[] = (float) $unique_visits;
|
$unique_visits_in_last_30_days[] = (float)$unique_visits;
|
||||||
} else {
|
} else {
|
||||||
$total_visits_in_last_30_days[] = 0;
|
$total_visits_in_last_30_days[] = 0;
|
||||||
$unique_visits_in_last_30_days[] = 0;
|
$unique_visits_in_last_30_days[] = 0;
|
||||||
@@ -646,7 +719,7 @@ class FormDataController extends Controller
|
|||||||
//get referrer as key value
|
//get referrer as key value
|
||||||
$referrers = [];
|
$referrers = [];
|
||||||
foreach ($visitors as $key => $visitor) {
|
foreach ($visitors as $key => $visitor) {
|
||||||
if (! empty($visitor->referrer)) {
|
if (!empty($visitor->referrer)) {
|
||||||
$referrers[] = ['name' => $visitor->referrer, 'y' => $visitor->total_visits];
|
$referrers[] = ['name' => $visitor->referrer, 'y' => $visitor->total_visits];
|
||||||
} else {
|
} else {
|
||||||
$referrers[] = ['name' => __('messages.direct_visits'), 'y' => $visitor->total_visits];
|
$referrers[] = ['name' => __('messages.direct_visits'), 'y' => $visitor->total_visits];
|
||||||
@@ -678,7 +751,7 @@ class FormDataController extends Controller
|
|||||||
{
|
{
|
||||||
$formData = FormData::with(['form'])->find($id);
|
$formData = FormData::with(['form'])->find($id);
|
||||||
|
|
||||||
if (! (auth()->user()->can('superadmin') || $this->checkIfUserIsCreatorOfGivenForm($formData->form->id) || $this->doUserHavePermission($formData->form->id, 'can_view_data'))) {
|
if (!(auth()->user()->can('superadmin') || $this->checkIfUserIsCreatorOfGivenForm($formData->form->id) || $this->doUserHavePermission($formData->form->id, 'can_view_data'))) {
|
||||||
abort(403, 'Unauthorized action.');
|
abort(403, 'Unauthorized action.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,23 +763,23 @@ class FormDataController extends Controller
|
|||||||
public function getEditformData($id_or_slug, $data_id)
|
public function getEditformData($id_or_slug, $data_id)
|
||||||
{
|
{
|
||||||
$form = Form::where('id', $id_or_slug)
|
$form = Form::where('id', $id_or_slug)
|
||||||
->orWhere('slug', $id_or_slug)
|
->orWhere('slug', $id_or_slug)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (empty($form)) {
|
if (empty($form)) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if submitted data id available get submitted data
|
//if submitted data id available get submitted data
|
||||||
if (! empty($data_id)) {
|
if (!empty($data_id)) {
|
||||||
$form->load(['data' => function ($query) use ($data_id, $form) {
|
$form->load(['data' => function ($query) use ($data_id, $form) {
|
||||||
$query->where('id', $data_id)
|
$query->where('id', $data_id)
|
||||||
->where('form_id', $form->id);
|
->where('form_id', $form->id);
|
||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$nav = false;
|
$nav = false;
|
||||||
$action_by = 'admin';
|
$action_by = auth()->user()->roles->first()->name;
|
||||||
|
|
||||||
return view('form.show')
|
return view('form.show')
|
||||||
->with(compact('form', 'nav', 'action_by'));
|
->with(compact('form', 'nav', 'action_by'));
|
||||||
@@ -719,9 +792,9 @@ class FormDataController extends Controller
|
|||||||
$form_data = [];
|
$form_data = [];
|
||||||
parse_str(request()->get('form_data'), $form_data['data']);
|
parse_str(request()->get('form_data'), $form_data['data']);
|
||||||
|
|
||||||
if (! empty($data_id)) {
|
if (!empty($data_id)) {
|
||||||
$existing_data = FormData::where('form_id', $form->id)
|
$existing_data = FormData::where('form_id', $form->id)
|
||||||
->findOrFail($data_id);
|
->findOrFail($data_id);
|
||||||
|
|
||||||
$existing_data->data = $form_data['data'];
|
$existing_data->data = $form_data['data'];
|
||||||
$existing_data->save();
|
$existing_data->save();
|
||||||
@@ -742,7 +815,7 @@ class FormDataController extends Controller
|
|||||||
$header = '';
|
$header = '';
|
||||||
if (
|
if (
|
||||||
isset($form_data->form['schema']['settings']['pdf_design']) &&
|
isset($form_data->form['schema']['settings']['pdf_design']) &&
|
||||||
! empty($form_data->form['schema']['settings']['pdf_design']['header'])
|
!empty($form_data->form['schema']['settings']['pdf_design']['header'])
|
||||||
) {
|
) {
|
||||||
$form_name = $form_data->form->name;
|
$form_name = $form_data->form->name;
|
||||||
$submission_date = Carbon::parse($form_data->created_at)->format(config('constants.APP_DATE_FORMAT', 'Y-m-d'));
|
$submission_date = Carbon::parse($form_data->created_at)->format(config('constants.APP_DATE_FORMAT', 'Y-m-d'));
|
||||||
@@ -756,8 +829,8 @@ class FormDataController extends Controller
|
|||||||
protected function _generateSubmissionMsgHtml($form, $data)
|
protected function _generateSubmissionMsgHtml($form, $data)
|
||||||
{
|
{
|
||||||
$submission_msg = View::make('form_data.partials.submission_msg')
|
$submission_msg = View::make('form_data.partials.submission_msg')
|
||||||
->with(compact('form', 'data'))
|
->with(compact('form', 'data'))
|
||||||
->render();
|
->render();
|
||||||
|
|
||||||
return $submission_msg;
|
return $submission_msg;
|
||||||
}
|
}
|
||||||
@@ -767,18 +840,18 @@ class FormDataController extends Controller
|
|||||||
$string = '';
|
$string = '';
|
||||||
$array = [];
|
$array = [];
|
||||||
if (
|
if (
|
||||||
! in_array($schema['settings']['notification']['post_submit_action'], ['redirect']) &&
|
!in_array($schema['settings']['notification']['post_submit_action'], ['redirect']) &&
|
||||||
isset($schema['settings']['is_qr_code_enabled']) &&
|
isset($schema['settings']['is_qr_code_enabled']) &&
|
||||||
$schema['settings']['is_qr_code_enabled']
|
$schema['settings']['is_qr_code_enabled']
|
||||||
) {
|
) {
|
||||||
foreach ($schema['form'] as $key => $element) {
|
foreach ($schema['form'] as $key => $element) {
|
||||||
if (
|
if (
|
||||||
! in_array($element['type'], ['heading', 'html_text', 'hr', 'signature', 'file_upload'])
|
!in_array($element['type'], ['heading', 'html_text', 'hr', 'signature', 'file_upload'])
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
isset($form_data[$element['name']]) &&
|
isset($form_data[$element['name']]) &&
|
||||||
! is_array($form_data[$element['name']]) &&
|
!is_array($form_data[$element['name']]) &&
|
||||||
! empty($form_data[$element['name']])
|
!empty($form_data[$element['name']])
|
||||||
) {
|
) {
|
||||||
//check data format & set data
|
//check data format & set data
|
||||||
if (
|
if (
|
||||||
@@ -787,12 +860,12 @@ class FormDataController extends Controller
|
|||||||
) {
|
) {
|
||||||
$array[$element['label']] = strip_tags($form_data[$element['name']]);
|
$array[$element['label']] = strip_tags($form_data[$element['name']]);
|
||||||
} else {
|
} else {
|
||||||
$string .= $element['label'].': '.strip_tags($form_data[$element['name']]).', ';
|
$string .= $element['label'] . ': ' . strip_tags($form_data[$element['name']]) . ', ';
|
||||||
}
|
}
|
||||||
} elseif (
|
} elseif (
|
||||||
isset($form_data[$element['name']]) &&
|
isset($form_data[$element['name']]) &&
|
||||||
is_array($form_data[$element['name']]) &&
|
is_array($form_data[$element['name']]) &&
|
||||||
! empty($form_data[$element['name']])
|
!empty($form_data[$element['name']])
|
||||||
) {
|
) {
|
||||||
//check data format & set data
|
//check data format & set data
|
||||||
if (
|
if (
|
||||||
@@ -801,7 +874,7 @@ class FormDataController extends Controller
|
|||||||
) {
|
) {
|
||||||
$array[$element['label']] = implode(', ', $form_data[$element['name']]);
|
$array[$element['label']] = implode(', ', $form_data[$element['name']]);
|
||||||
} else {
|
} else {
|
||||||
$string .= $element['label'].': '.implode(', ', $form_data[$element['name']]).', ';
|
$string .= $element['label'] . ': ' . implode(', ', $form_data[$element['name']]) . ', ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -809,7 +882,7 @@ class FormDataController extends Controller
|
|||||||
if (
|
if (
|
||||||
in_array($element['type'], ['file_upload']) &&
|
in_array($element['type'], ['file_upload']) &&
|
||||||
isset($form_data[$element['name']]) &&
|
isset($form_data[$element['name']]) &&
|
||||||
! empty($form_data[$element['name']])
|
!empty($form_data[$element['name']])
|
||||||
) {
|
) {
|
||||||
//convert file name to an array
|
//convert file name to an array
|
||||||
$file = implode($form_data[$element['name']]);
|
$file = implode($form_data[$element['name']]);
|
||||||
@@ -817,7 +890,7 @@ class FormDataController extends Controller
|
|||||||
|
|
||||||
$file_urls = [];
|
$file_urls = [];
|
||||||
foreach ($files as $key => $value) {
|
foreach ($files as $key => $value) {
|
||||||
$file_urls[] = \Storage::url(config('constants.doc_path').'/'.$value);
|
$file_urls[] = \Storage::url(config('constants.doc_path') . '/' . $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//check data format & set data
|
//check data format & set data
|
||||||
@@ -827,7 +900,7 @@ class FormDataController extends Controller
|
|||||||
) {
|
) {
|
||||||
$array[$element['label']] = implode(', ', $file_urls);
|
$array[$element['label']] = implode(', ', $file_urls);
|
||||||
} else {
|
} else {
|
||||||
$string .= $element['label'].': '.implode(', ', $file_urls).', ';
|
$string .= $element['label'] . ': ' . implode(', ', $file_urls) . ', ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Enums\User\RoleEnum;
|
||||||
use App\Form;
|
use App\Form;
|
||||||
use App\Mail\TestEmail;
|
use App\Mail\TestEmail;
|
||||||
use App\PackageSubscription;
|
use App\PackageSubscription;
|
||||||
use App\UserForm;
|
use App\UserForm;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use DB;
|
use DB;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Yajra\DataTables\Facades\DataTables;
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
@@ -33,115 +35,139 @@ class HomeController extends Controller
|
|||||||
{
|
{
|
||||||
$user = request()->user();
|
$user = request()->user();
|
||||||
|
|
||||||
|
if (auth()->user()->hasRole(RoleEnum::SUPERVISOR->value, 'web')) {
|
||||||
|
$forms = Form::query()
|
||||||
|
->withCount('data')
|
||||||
|
->where('is_template', 0)
|
||||||
|
->get();
|
||||||
|
} else {
|
||||||
|
$forms = Form::query()
|
||||||
|
->withCount('data')
|
||||||
|
->where('is_template', 0)
|
||||||
|
->where('created_by', $user->id)
|
||||||
|
->groupBy('id');
|
||||||
|
}
|
||||||
|
|
||||||
if (request()->ajax()) {
|
if (request()->ajax()) {
|
||||||
$subscription = PackageSubscription::activeSubscription($user->id);
|
$subscription = PackageSubscription::activeSubscription($user->id);
|
||||||
|
|
||||||
$forms = Form::leftJoin('form_data', 'forms.id', '=', 'form_data.form_id')
|
if (auth()->user()->hasRole(RoleEnum::SUPERVISOR->value, 'web')) {
|
||||||
->select('name', 'slug', 'description', 'forms.created_at', 'forms.id', DB::raw('COUNT(form_data.form_id) as data_count'), 'schema')
|
$forms = Form::query()
|
||||||
->where('is_template', 0)
|
->withCount('data')
|
||||||
->where('created_by', $user->id)
|
->where('is_template', 0)
|
||||||
->groupBy('id');
|
->get();
|
||||||
|
} else {
|
||||||
|
$forms = Form::query()
|
||||||
|
->withCount('data')
|
||||||
|
->where('is_template', 0)
|
||||||
|
->where('created_by', $user->id)
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
return DataTables::of($forms)
|
return DataTables::of($forms)
|
||||||
->addColumn(
|
->addColumn(
|
||||||
'action',
|
'action',
|
||||||
function (Form $form) use ($subscription, $user) {
|
function (Form $form) use ($subscription, $user) {
|
||||||
$action = '';
|
$action = '';
|
||||||
|
|
||||||
if (! empty($form->schema)) {
|
if (!empty($form->schema)) {
|
||||||
$action = '<a href="'.action([\App\Http\Controllers\FormController::class, 'show'], ['form' => $form->slug ?: $form->id]).'"'.'
|
$action = '<a href="' . action([\App\Http\Controllers\FormController::class, 'show'], ['form' => $form->slug ?: $form->id]) . '"' . '
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="btn btn-sm btn-info m-1" data-toggle="tooltip" title="'.__('messages.view').'">
|
class="btn btn-sm btn-info m-1" data-toggle="tooltip" title="' . __('messages.view') . '">
|
||||||
<i class="fa fa-eye" aria-hidden="true"></i>
|
<i class="fa fa-eye" aria-hidden="true"></i>
|
||||||
</a>';
|
</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$action .= '<a href="'.action([\App\Http\Controllers\FormController::class, 'edit'], ['form' => $form->id]).'"'.'
|
$action .= '<a href="' . action([\App\Http\Controllers\FormController::class, 'edit'], ['form' => $form->id]) . '"' . '
|
||||||
class="btn btn-sm btn-warning m-1" data-toggle="tooltip" title="'.__('messages.edit').'">
|
class="btn btn-sm btn-warning m-1" data-toggle="tooltip" title="' . __('messages.edit') . '">
|
||||||
<i class="fa fa-edit" aria-hidden="true"></i>
|
<i class="fa fa-edit" aria-hidden="true"></i>
|
||||||
</a>';
|
</a>';
|
||||||
|
|
||||||
$action .= '<button type="button" data-href="'.action([\App\Http\Controllers\FormController::class, 'destroy'], ['form' => $form->id]).'"'.' class="btn btn-sm btn-danger delete_form m-1" data-toggle="tooltip"
|
if (auth()->user()->hasRole(RoleEnum::SUPERVISOR->value) || auth()->user()->id === $form->created_by) {
|
||||||
title="'.__('messages.delete').'">
|
$action .= '<button type="button" data-href="' . action([\App\Http\Controllers\FormController::class, 'destroy'], ['form' => $form->id]) . '"' . ' class="btn btn-sm btn-danger delete_form m-1" data-toggle="tooltip"
|
||||||
|
title="' . __('messages.delete') . '">
|
||||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||||
</button>';
|
</button>';
|
||||||
|
}
|
||||||
|
|
||||||
$action .= '<button type="button" data-href="'.action([\App\Http\Controllers\FormController::class, 'copyForm'], ['id' => $form->id]).'"'.' class="btn btn-sm btn-primary copy_form m-1" data-toggle="tooltip"
|
if (auth()->user()->hasRole(RoleEnum::SUPERVISOR->value) || auth()->user()->id === $form->created_by) {
|
||||||
title="'.__('messages.copy_this_form').'">
|
$action .= '<button type="button" data-href="' . action([\App\Http\Controllers\FormController::class, 'copyForm'], ['id' => $form->id]) . '"' . ' class="btn btn-sm btn-primary copy_form m-1" data-toggle="tooltip"
|
||||||
|
title="' . __('messages.copy_this_form') . '">
|
||||||
<i class="fas fa-copy"></i>
|
<i class="fas fa-copy"></i>
|
||||||
</button>';
|
</button>';
|
||||||
|
}
|
||||||
|
|
||||||
$action .= '<button type="button" data-href="'.action([\App\Http\Controllers\FormController::class, 'generateWidget'], ['id' => $form->id]).'"'.' class="btn btn-sm btn-info generate_widget m-1" data-toggle="tooltip"
|
if (auth()->user()->hasRole(RoleEnum::SUPERVISOR->value) || auth()->user()->id === $form->created_by) {
|
||||||
title="'.__('messages.widget').'">
|
$action .= '<button type="button" data-href="' . action([\App\Http\Controllers\FormController::class, 'generateWidget'], ['id' => $form->id]) . '"' . ' class="btn btn-sm btn-info generate_widget m-1" data-toggle="tooltip"
|
||||||
|
title="' . __('messages.widget') . '">
|
||||||
<i class="fa fa-random" aria-hidden="true"></i>
|
<i class="fa fa-random" aria-hidden="true"></i>
|
||||||
</button>';
|
</button>';
|
||||||
|
}
|
||||||
|
|
||||||
$action .= '<a href="'.action([\App\Http\Controllers\FormDataController::class, 'show'], ['id' => $form->id]).'"'.'"
|
$action .= '<a href="' . action([\App\Http\Controllers\FormDataController::class, 'show'], ['id' => $form->id]) . '"' . '"
|
||||||
target="_blank"
|
class="btn btn-sm btn-success m-1" data-toggle="tooltip" title="' . __('messages.view_form_data') . '">
|
||||||
class="btn btn-sm btn-success m-1" data-toggle="tooltip" title="'.__('messages.view_form_data').'">
|
|
||||||
<i class="fa fa-list" aria-hidden="true"></i>
|
<i class="fa fa-list" aria-hidden="true"></i>
|
||||||
</a>';
|
</a>';
|
||||||
|
|
||||||
$superadmins = env('SUPERADMIN_EMAILS');
|
if (auth()->user()->hasRole(RoleEnum::SUPERVISOR->value) || auth()->user()->id === $form->created_by) {
|
||||||
$superadmin_emails = explode(',', $superadmins);
|
$action .= '<a href="' . action([\App\Http\Controllers\FormController::class, 'downloadCode'], ['id' => $form->id]) . '"' . '" class="btn btn-sm btn-dark m-1" data-toggle="tooltip"
|
||||||
if (in_array($user->email, $superadmin_emails) ||
|
title="' . __('messages.download_code') . '">
|
||||||
(is_saas_enabled() && (isset($subscription->package_details['is_form_downloadable']) && $subscription->package_details['is_form_downloadable'])) || ! is_saas_enabled()) {
|
|
||||||
$action .= '<a href="'.action([\App\Http\Controllers\FormController::class, 'downloadCode'], ['id' => $form->id]).'"'.'" class="btn btn-sm btn-dark m-1" data-toggle="tooltip"
|
|
||||||
title="'.__('messages.download_code').'">
|
|
||||||
<i class="fas fa-download" aria-hidden="true"></i>
|
<i class="fas fa-download" aria-hidden="true"></i>
|
||||||
</a>';
|
</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$action .= '<a data-href="'.action([\App\Http\Controllers\FormController::class, 'getCollab'], ['id' => $form->id]).'"'.'class="btn btn-sm btn-primary m-1 collab_btn" data-toggle="tooltip" title="'.__('messages.collaborate').'">
|
if (auth()->user()->hasRole(RoleEnum::SUPERVISOR->value) || auth()->user()->id === $form->created_by) {
|
||||||
|
$action .= '<a data-href="' . action([\App\Http\Controllers\FormController::class, 'getCollab'], ['id' => $form->id]) . '"' . 'class="btn btn-sm btn-primary m-1 collab_btn" data-toggle="tooltip" title="' . __('messages.collaborate') . '">
|
||||||
<i class="fas fa-handshake text-white" aria-hidden="true"></i>
|
<i class="fas fa-handshake text-white" aria-hidden="true"></i>
|
||||||
</a>';
|
</a>';
|
||||||
|
|
||||||
return $action;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
->editColumn('created_at', function ($row) {
|
|
||||||
$date_format = config('constants.APP_DATE_FORMAT');
|
|
||||||
if (config('constants.APP_TIME_FORMAT') == '12') {
|
|
||||||
$date_format .= ' h:i A';
|
|
||||||
} elseif (config('constants.APP_TIME_FORMAT') == '24') {
|
|
||||||
$date_format .= ' H:i';
|
|
||||||
} else {
|
|
||||||
$date_format = 'm/d/Y h:i A';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ! empty($row->created_at) ? Carbon::createFromTimestamp(strtotime($row->created_at))->format($date_format) : null;
|
return $action;
|
||||||
})
|
}
|
||||||
->editColumn('data_count', function ($row) {
|
)
|
||||||
return $row->data_count;
|
->editColumn('created_at', function ($row) {
|
||||||
})
|
$date_format = config('constants.APP_DATE_FORMAT');
|
||||||
->editColumn('name', function ($row) {
|
if (config('constants.APP_TIME_FORMAT') == '12') {
|
||||||
$html = $row->name;
|
$date_format .= ' h:i A';
|
||||||
if (empty($row->schema)) {
|
} elseif (config('constants.APP_TIME_FORMAT') == '24') {
|
||||||
$html .= '<br><small class="text-danger">('.(__('messages.form_is_incomplete')).')</small>';
|
$date_format .= ' H:i';
|
||||||
}
|
} else {
|
||||||
|
$date_format = 'm/d/Y h:i A';
|
||||||
|
}
|
||||||
|
|
||||||
return $html;
|
return !empty($row->created_at) ? Carbon::createFromTimestamp(strtotime($row->created_at))->format($date_format) : null;
|
||||||
})
|
})
|
||||||
->removeColumn('id')
|
->editColumn('data_count', function ($row) {
|
||||||
->rawColumns(['action', 'created_at', 'data_count', 'name'])
|
return $row->data_count;
|
||||||
->make(true);
|
})
|
||||||
|
->editColumn('name', function ($row) {
|
||||||
|
$html = $row->name;
|
||||||
|
if (empty($row->schema)) {
|
||||||
|
$html .= '<br><small class="text-danger">(' . (__('messages.form_is_incomplete')) . ')</small>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
})
|
||||||
|
->removeColumn('id')
|
||||||
|
->rawColumns(['action', 'created_at', 'data_count', 'name'])
|
||||||
|
->make(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Count forms
|
//Count forms
|
||||||
$form_count = Form::where('created_by', $user->id)
|
$form_count = $forms->count();
|
||||||
->where('is_template', 0)
|
|
||||||
->count();
|
|
||||||
|
|
||||||
//Count templates.
|
//Count templates.
|
||||||
$template_count = Form::where('created_by', $user->id)
|
$template_count = Form::where('created_by', $user->id)
|
||||||
->where('is_template', 1)
|
->where('is_template', 1)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
//Count submissions.
|
//Count submissions.
|
||||||
$submission_count = Form::join('form_data as fd', 'forms.id', '=', 'fd.form_id')
|
$submission_count = Form::join('form_data as fd', 'forms.id', '=', 'fd.form_id')
|
||||||
->where('is_template', 0)
|
->where('is_template', 0)
|
||||||
->where('created_by', $user->id)
|
->when(auth()->user()->hasRole(RoleEnum::USER->value), function (Builder $builder) use ($user) {
|
||||||
->count();
|
$builder->where('created_by', $user->id);
|
||||||
|
})
|
||||||
|
->count();
|
||||||
|
|
||||||
return view('home')
|
return view('home')
|
||||||
->with(compact('form_count', 'template_count', 'submission_count'));
|
->with(compact('form_count', 'template_count', 'submission_count'));
|
||||||
@@ -158,56 +184,56 @@ class HomeController extends Controller
|
|||||||
$user_id = request()->user()->id;
|
$user_id = request()->user()->id;
|
||||||
|
|
||||||
$forms = Form::select('name', 'description', 'id', 'slug', 'is_global_template')
|
$forms = Form::select('name', 'description', 'id', 'slug', 'is_global_template')
|
||||||
->where(function ($query) use($user_id) {
|
->where(function ($query) use ($user_id) {
|
||||||
$query->where('is_template', 1)
|
$query->where('is_template', 1)
|
||||||
->where('created_by', $user_id)
|
->where('created_by', $user_id)
|
||||||
->orWhere('is_global_template', 1);
|
->orWhere('is_global_template', 1);
|
||||||
})
|
})
|
||||||
->groupBy('id');
|
->groupBy('id');
|
||||||
|
|
||||||
return DataTables::of($forms)
|
return DataTables::of($forms)
|
||||||
->addColumn('action', function ($row) {
|
->addColumn('action', function ($row) {
|
||||||
$action = '<a href="'.action([\App\Http\Controllers\FormController::class, 'show'], ['form' => $row->slug ?: $row->id]).'"'.'
|
$action = '<a href="' . action([\App\Http\Controllers\FormController::class, 'show'], ['form' => $row->slug ?: $row->id]) . '"' . '
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="btn btn-sm btn-info m-1" data-toggle="tooltip" title="'.__('messages.view').'">
|
class="btn btn-sm btn-info m-1" data-toggle="tooltip" title="' . __('messages.view') . '">
|
||||||
<i class="fa fa-eye" aria-hidden="true"></i>
|
<i class="fa fa-eye" aria-hidden="true"></i>
|
||||||
</a>';
|
</a>';
|
||||||
|
|
||||||
if (! $row->is_global_template || auth()->user()->can('superadmin')) {
|
if (!$row->is_global_template || auth()->user()->can('superadmin')) {
|
||||||
$action .= '<a href="'.action([\App\Http\Controllers\FormController::class, 'edit'], ['form' => $row->id]).'"'.'
|
$action .= '<a href="' . action([\App\Http\Controllers\FormController::class, 'edit'], ['form' => $row->id]) . '"' . '
|
||||||
class="btn btn-sm btn-warning m-1" data-toggle="tooltip" title="'.__('messages.edit').'">
|
class="btn btn-sm btn-warning m-1" data-toggle="tooltip" title="' . __('messages.edit') . '">
|
||||||
<i class="fa fa-edit" aria-hidden="true"></i>
|
<i class="fa fa-edit" aria-hidden="true"></i>
|
||||||
</a>
|
</a>
|
||||||
<button type="button" data-href="'.action([\App\Http\Controllers\FormController::class, 'destroy'], ['form' => $row->id]).'"'.' class="btn btn-sm btn-danger delete_template m-1" data-toggle="tooltip"
|
<button type="button" data-href="' . action([\App\Http\Controllers\FormController::class, 'destroy'], ['form' => $row->id]) . '"' . ' class="btn btn-sm btn-danger delete_template m-1" data-toggle="tooltip"
|
||||||
title="'.__('messages.delete').'">
|
title="' . __('messages.delete') . '">
|
||||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||||
</button>';
|
</button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $action;
|
return $action;
|
||||||
})
|
})
|
||||||
->editColumn('is_global_template', function ($row) {
|
->editColumn('is_global_template', function ($row) {
|
||||||
if (auth()->user()->can('superadmin')) {
|
if (auth()->user()->can('superadmin')) {
|
||||||
$checked = $row->is_global_template ? 'checked' : '';
|
$checked = $row->is_global_template ? 'checked' : '';
|
||||||
$html = '<div class="form-check">
|
$html = '<div class="form-check">
|
||||||
<input class="form-check-input toggle_global_template" type="checkbox" value="1" '.$checked.' data-form_id="'.$row->id.'">
|
<input class="form-check-input toggle_global_template" type="checkbox" value="1" ' . $checked . ' data-form_id="' . $row->id . '">
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->editColumn('name', function ($row) {
|
->editColumn('name', function ($row) {
|
||||||
$name = $row->name;
|
$name = $row->name;
|
||||||
|
|
||||||
if ($row->is_global_template) {
|
if ($row->is_global_template) {
|
||||||
$name .= '<br><span class="badge badge-pill badge-info">'.__('messages.pre_made').'</span>';
|
$name .= '<br><span class="badge badge-pill badge-info">' . __('messages.pre_made') . '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $name;
|
return $name;
|
||||||
})
|
})
|
||||||
->removeColumn('id')
|
->removeColumn('id')
|
||||||
->rawColumns(['action', 'is_global_template', 'name'])
|
->rawColumns(['action', 'is_global_template', 'name'])
|
||||||
->make(true);
|
->make(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('home');
|
return view('home');
|
||||||
@@ -233,7 +259,7 @@ class HomeController extends Controller
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
Mail::to(request()->from_address)
|
Mail::to(request()->from_address)
|
||||||
->send(new TestEmail());
|
->send(new TestEmail());
|
||||||
|
|
||||||
return $this->respondSuccess();
|
return $this->respondSuccess();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -250,47 +276,54 @@ class HomeController extends Controller
|
|||||||
{
|
{
|
||||||
if ($request->ajax()) {
|
if ($request->ajax()) {
|
||||||
$forms = UserForm::join('forms', 'user_forms.form_id', '=', 'forms.id')
|
$forms = UserForm::join('forms', 'user_forms.form_id', '=', 'forms.id')
|
||||||
->leftJoin('users', 'forms.created_by', '=', 'users.id')
|
->leftJoin('users', 'forms.created_by', '=', 'users.id')
|
||||||
->where('user_forms.assigned_to', \Auth::id())
|
->where('user_forms.assigned_to', \Auth::id())
|
||||||
->select('user_forms.permissions as permissions', 'forms.name as name', 'forms.description as description', 'forms.id as form_id', 'forms.created_at as created_at', 'forms.slug as slug', 'users.name as created_by');
|
->select('user_forms.permissions as permissions', 'forms.name as name', 'forms.description as description', 'forms.id as form_id', 'forms.created_at as created_at', 'forms.slug as slug', 'users.name as created_by');
|
||||||
|
|
||||||
return DataTables::of($forms)
|
return DataTables::of($forms)
|
||||||
->addColumn(
|
->addColumn(
|
||||||
'action',
|
'action',
|
||||||
function ($row) {
|
function ($row) {
|
||||||
$action = '';
|
$action = '';
|
||||||
if (! empty($row->permissions) && in_array('can_view_form', $row->permissions) && auth()->user()->show_edit_buttons_form) {
|
if ((!empty($row->permissions) && in_array('can_view_form', $row->permissions)) || auth()->user()->hasRole(RoleEnum::SUPERVISOR->value)) {
|
||||||
$action = '<a href="'.action([\App\Http\Controllers\FormController::class, 'show'], ['form' => $row->slug ?: $row->form_id]).'"'.'
|
$action = '<a href="' . action([\App\Http\Controllers\FormController::class, 'show'], ['form' => $row->slug ?: $row->form_id]) . '"' . '
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="btn btn-sm btn-info m-1" data-toggle="tooltip" title="'.__('messages.view').'">
|
class="btn btn-sm btn-info m-1" data-toggle="tooltip" title="' . __('messages.view') . '">
|
||||||
<i class="fa fa-eye" aria-hidden="true"></i>
|
<i class="fa fa-eye" aria-hidden="true"></i>
|
||||||
</a>';
|
</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($row->permissions) && in_array('can_design_form', $row->permissions) && auth()->user()->show_edit_buttons_form) {
|
if ((!empty($row->permissions) && in_array('can_design_form', $row->permissions)) || auth()->user()->hasRole(RoleEnum::SUPERVISOR->value)) {
|
||||||
$action .= '<a href="'.action([\App\Http\Controllers\FormController::class, 'edit'], ['form' => $row->form_id]).'"'.'
|
$action .= '<a href="' . action([\App\Http\Controllers\FormController::class, 'edit'], ['form' => $row->form_id]) . '"' . '
|
||||||
class="btn btn-sm btn-warning m-1" data-toggle="tooltip" title="'.__('messages.edit').'">
|
class="btn btn-sm btn-warning m-1" data-toggle="tooltip" title="' . __('messages.edit') . '">
|
||||||
<i class="fa fa-edit" aria-hidden="true"></i>
|
<i class="fa fa-edit" aria-hidden="true"></i>
|
||||||
</a>';
|
</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($row->permissions) && in_array('can_view_data', $row->permissions) && auth()->user()->show_edit_buttons_form) {
|
if ((!empty($row->permissions) && in_array('can_view_data', $row->permissions)) || auth()->user()->hasRole(RoleEnum::SUPERVISOR->value)) {
|
||||||
$action .= '<a href="'.action([\App\Http\Controllers\FormDataController::class, 'show'], ['id' => $row->form_id]).'"'.'"
|
$action .= '<a href="' . action([\App\Http\Controllers\FormDataController::class, 'show'], ['id' => $row->form_id]) . '"' . '"
|
||||||
target="_blank"
|
class="btn btn-sm btn-success m-1" data-toggle="tooltip" title="' . __('messages.view_form_data') . '">
|
||||||
class="btn btn-sm btn-success m-1" data-toggle="tooltip" title="'.__('messages.view_form_data').'">
|
|
||||||
<i class="fa fa-list" aria-hidden="true"></i>
|
<i class="fa fa-list" aria-hidden="true"></i>
|
||||||
</a>';
|
</a>';
|
||||||
}
|
|
||||||
|
|
||||||
return $action;
|
|
||||||
}
|
}
|
||||||
)
|
|
||||||
->editColumn('created_by', function ($row) {
|
if (auth()->user()->hasRole(RoleEnum::SUPERVISOR->value)) {
|
||||||
return ucfirst($row->created_by);
|
$action .= '<a href="' . action([\App\Http\Controllers\FormDataController::class, 'getReport'], ['id' => $row->form_id]) . '"' . '"
|
||||||
})
|
target="_blank"
|
||||||
->removeColumn(['id', 'permissions'])
|
class="btn btn-sm btn-success m-1" data-toggle="tooltip" title="' . __('messages.report') . '">
|
||||||
->rawColumns(['action', 'created_by'])
|
<i class="fas fa-chart-pie" aria-hidden="true"></i>
|
||||||
->make(true);
|
</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $action;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->editColumn('created_by', function ($row) {
|
||||||
|
return ucfirst($row->created_by);
|
||||||
|
})
|
||||||
|
->removeColumn(['id', 'permissions'])
|
||||||
|
->rawColumns(['action', 'created_by'])
|
||||||
|
->make(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Superadmin;
|
namespace App\Http\Controllers\Superadmin;
|
||||||
|
|
||||||
|
use App\Enums\User\RoleEnum;
|
||||||
use App\Form;
|
use App\Form;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Notifications\UserNotification;
|
use App\Notifications\UserNotification;
|
||||||
use App\Package;
|
use App\Package;
|
||||||
use App\User;
|
use App\User;
|
||||||
use App\UserForm;
|
use App\UserForm;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Yajra\DataTables\Facades\DataTables;
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
@@ -20,12 +22,20 @@ class ManageUsersController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
if (! auth()->user()->can('superadmin')) {
|
if (!auth()->user()->hasRole([RoleEnum::ADMIN->value, RoleEnum::SUPERVISOR->value], 'web')) {
|
||||||
abort(403, 'Unauthorized action.');
|
abort(403, 'Unauthorized action.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->ajax()) {
|
if ($request->ajax()) {
|
||||||
$users = User::select('name', 'email', 'is_active', 'created_at', 'id');
|
$supervisor = User::role(RoleEnum::SUPERVISOR->value)->first();
|
||||||
|
$users = User::query()
|
||||||
|
->when(
|
||||||
|
!auth()->user()->hasRole(RoleEnum::SUPERVISOR->value),
|
||||||
|
function (Builder $builder) use ($supervisor) {
|
||||||
|
$builder->whereNotIn('id', [$supervisor->id]);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
->select(['id', 'name', 'email', 'is_active', 'created_at']);
|
||||||
|
|
||||||
if (! empty($request->input('status'))) {
|
if (! empty($request->input('status'))) {
|
||||||
$is_active = ($request->input('status') == 'active') ? 1 : 0;
|
$is_active = ($request->input('status') == 'active') ? 1 : 0;
|
||||||
@@ -52,9 +62,11 @@ class ManageUsersController extends Controller
|
|||||||
<a class="btn btn-link btn-icon btn-sm text-info edit_user pointer" data-href="{{action([\App\Http\Controllers\Superadmin\ManageUsersController::class, "edit"], [$id])}}" title="@lang("messages.edit")">
|
<a class="btn btn-link btn-icon btn-sm text-info edit_user pointer" data-href="{{action([\App\Http\Controllers\Superadmin\ManageUsersController::class, "edit"], [$id])}}" title="@lang("messages.edit")">
|
||||||
<i class="fas fa-edit font_icon_size"></i>
|
<i class="fas fa-edit font_icon_size"></i>
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-link btn-icon btn-sm text-info upgrade_account pointer" data-href="{{action([\App\Http\Controllers\Superadmin\ManageUsersController::class, "upgrade"], [$id])}}" title="@lang("messages.edit")">
|
@if(1 === 0)
|
||||||
<i class="fas fa-money-check font_icon_size"></i>
|
<a class="btn btn-link btn-icon btn-sm text-info upgrade_account pointer" data-href="{{action([\App\Http\Controllers\Superadmin\ManageUsersController::class, "upgrade"], [$id])}}" title="@lang("messages.edit")">
|
||||||
</a>
|
<i class="fas fa-money-check font_icon_size"></i>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
<a class="btn btn-link btn-icon btn-sm text-danger delete_user pointer" data-href="{{action([\App\Http\Controllers\Superadmin\ManageUsersController::class, "destroy"], [$id])}}" title="@lang("messages.delete")">
|
<a class="btn btn-link btn-icon btn-sm text-danger delete_user pointer" data-href="{{action([\App\Http\Controllers\Superadmin\ManageUsersController::class, "destroy"], [$id])}}" title="@lang("messages.delete")">
|
||||||
<i class="fas fa-trash-alt font_icon_size"></i>
|
<i class="fas fa-trash-alt font_icon_size"></i>
|
||||||
</a>
|
</a>
|
||||||
@@ -104,7 +116,6 @@ class ManageUsersController extends Controller
|
|||||||
$user = request()->user();
|
$user = request()->user();
|
||||||
|
|
||||||
$forms = Form::where('is_template', 0)
|
$forms = Form::where('is_template', 0)
|
||||||
->where('created_by', $user->id)
|
|
||||||
->pluck('name', 'id')
|
->pluck('name', 'id')
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
@@ -126,7 +137,7 @@ class ManageUsersController extends Controller
|
|||||||
return $this->notAllowedInDemo();
|
return $this->notAllowedInDemo();
|
||||||
}
|
}
|
||||||
|
|
||||||
$input = $request->only('name', 'email', 'is_active', 'can_create_form', 'show_form_response_user', 'show_edit_buttons_form');
|
$input = $request->only('name', 'email', 'is_active', 'is_admin', 'can_create_form');
|
||||||
|
|
||||||
if (! empty($request->input('password'))) {
|
if (! empty($request->input('password'))) {
|
||||||
$input['password'] = bcrypt($request->input('password'));
|
$input['password'] = bcrypt($request->input('password'));
|
||||||
@@ -134,10 +145,14 @@ class ManageUsersController extends Controller
|
|||||||
|
|
||||||
$input['is_active'] = ! empty($input['is_active']) ? 1 : 0;
|
$input['is_active'] = ! empty($input['is_active']) ? 1 : 0;
|
||||||
$input['can_create_form'] = ! empty($input['can_create_form']) ? 1 : 0;
|
$input['can_create_form'] = ! empty($input['can_create_form']) ? 1 : 0;
|
||||||
$input['show_form_response_user'] = ! empty($input['show_form_response_user']) ? 1 : 0;
|
|
||||||
$input['show_edit_buttons_form'] = ! empty($input['show_edit_buttons_form']) ? 1 : 0;
|
|
||||||
|
|
||||||
$user = User::create($input);
|
$user = User::query()->create($input);
|
||||||
|
|
||||||
|
if ($request->filled('is_admin')) {
|
||||||
|
$user->assignRole(RoleEnum::ADMIN->value);
|
||||||
|
} else {
|
||||||
|
$user->assignRole(RoleEnum::USER->value);
|
||||||
|
}
|
||||||
|
|
||||||
//save user forms (assgined)
|
//save user forms (assgined)
|
||||||
$permissions = $request->input('permissions');
|
$permissions = $request->input('permissions');
|
||||||
@@ -190,17 +205,26 @@ class ManageUsersController extends Controller
|
|||||||
if (request()->ajax()) {
|
if (request()->ajax()) {
|
||||||
$user = User::findOrFail($id);
|
$user = User::findOrFail($id);
|
||||||
|
|
||||||
$logged_in_user = request()->user();
|
if (auth()->user()->hasRole([RoleEnum::SUPERVISOR->value, RoleEnum::ADMIN->value])) {
|
||||||
|
$forms = Form::where('is_template', 0)
|
||||||
|
->pluck('name', 'id')
|
||||||
|
->toArray();
|
||||||
|
|
||||||
$forms = Form::where('is_template', 0)
|
$assigned_forms = UserForm::with('form')
|
||||||
->where('created_by', $logged_in_user->id)
|
->where('assigned_to', $id)
|
||||||
->pluck('name', 'id')
|
->get();
|
||||||
->toArray();
|
} else {
|
||||||
|
$logged_in_user = request()->user();
|
||||||
|
$forms = Form::where('is_template', 0)
|
||||||
|
->where('created_by', $logged_in_user->id)
|
||||||
|
->pluck('name', 'id')
|
||||||
|
->toArray();
|
||||||
|
|
||||||
$assigned_forms = UserForm::with('form')
|
$assigned_forms = UserForm::with('form')
|
||||||
->where('assigned_by', \Auth::id())
|
->where('assigned_by', \Auth::id())
|
||||||
->where('assigned_to', $id)
|
->where('assigned_to', $id)
|
||||||
->get();
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
return view('superadmin.users.edit')
|
return view('superadmin.users.edit')
|
||||||
->with(compact('user', 'forms', 'assigned_forms'));
|
->with(compact('user', 'forms', 'assigned_forms'));
|
||||||
@@ -221,11 +245,9 @@ class ManageUsersController extends Controller
|
|||||||
return $this->notAllowedInDemo();
|
return $this->notAllowedInDemo();
|
||||||
}
|
}
|
||||||
|
|
||||||
$input = $request->only('name', 'email', 'is_active', 'can_create_form', 'show_form_response_user', 'show_edit_buttons_form');
|
$input = $request->only('name', 'email', 'is_active', 'is_admin', 'can_create_form');
|
||||||
$input['is_active'] = ! empty($input['is_active']) ? 1 : 0;
|
$input['is_active'] = ! empty($input['is_active']) ? 1 : 0;
|
||||||
$input['can_create_form'] = ! empty($input['can_create_form']) ? 1 : 0;
|
$input['can_create_form'] = ! empty($input['can_create_form']) ? 1 : 0;
|
||||||
$input['show_form_response_user'] = ! empty($input['show_form_response_user']) ? 1 : 0;
|
|
||||||
$input['show_edit_buttons_form'] = ! empty($input['show_edit_buttons_form']) ? 1 : 0;
|
|
||||||
|
|
||||||
if (! empty($request->input('password'))) {
|
if (! empty($request->input('password'))) {
|
||||||
$input['password'] = bcrypt($request->input('password'));
|
$input['password'] = bcrypt($request->input('password'));
|
||||||
@@ -234,6 +256,14 @@ class ManageUsersController extends Controller
|
|||||||
$user = User::findOrFail($id);
|
$user = User::findOrFail($id);
|
||||||
$user->update($input);
|
$user->update($input);
|
||||||
|
|
||||||
|
if ($request->filled('is_admin') && $request->input('is_admin') === 'on') {
|
||||||
|
$user->assignRole(RoleEnum::ADMIN->value);
|
||||||
|
$user->removeRole(RoleEnum::USER->value);
|
||||||
|
} else {
|
||||||
|
$user->removeRole(RoleEnum::ADMIN->value);
|
||||||
|
$user->assignRole(RoleEnum::USER->value);
|
||||||
|
}
|
||||||
|
|
||||||
//update user forms (assgined)
|
//update user forms (assgined)
|
||||||
$edit_permissions = $request->input('edit_permissions');
|
$edit_permissions = $request->input('edit_permissions');
|
||||||
$assgined_form_ids = $request->input('edit_assigned_form_id');
|
$assgined_form_ids = $request->input('edit_assigned_form_id');
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ class System extends Model
|
|||||||
public static function dateFormats()
|
public static function dateFormats()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'd.m.Y' => 'dd.mm.yyyy',
|
||||||
|
'm.d.Y' => 'mm.dd.yyyy',
|
||||||
'd-m-Y' => 'dd-mm-yyyy',
|
'd-m-Y' => 'dd-mm-yyyy',
|
||||||
'm-d-Y' => 'mm-dd-yyyy',
|
'm-d-Y' => 'mm-dd-yyyy',
|
||||||
'd/m/Y' => 'dd/mm/yyyy',
|
'd/m/Y' => 'dd/mm/yyyy',
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ return new class extends Migration
|
|||||||
$table->timestamp('email_verified_at')->nullable();
|
$table->timestamp('email_verified_at')->nullable();
|
||||||
$table->string('password');
|
$table->string('password');
|
||||||
|
|
||||||
$table->boolean('show_form_response_user')->default(false);
|
|
||||||
$table->boolean('show_edit_buttons_form');
|
|
||||||
|
|
||||||
$table->rememberToken();
|
$table->rememberToken();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -297,6 +297,9 @@ return [
|
|||||||
'rtl' => 'Right To Left',
|
'rtl' => 'Right To Left',
|
||||||
'ltr' => 'Left To Right',
|
'ltr' => 'Left To Right',
|
||||||
'display_type' => 'Display Type',
|
'display_type' => 'Display Type',
|
||||||
|
'supervisor' => 'Supervisor',
|
||||||
|
'admin' => 'Admin',
|
||||||
|
'user' => 'user',
|
||||||
'superadmin' => 'Superadmin',
|
'superadmin' => 'Superadmin',
|
||||||
'packages' => 'Packages',
|
'packages' => 'Packages',
|
||||||
'create' => 'Create',
|
'create' => 'Create',
|
||||||
@@ -328,6 +331,7 @@ return [
|
|||||||
'users' => 'Users',
|
'users' => 'Users',
|
||||||
'all_users' => 'All Users',
|
'all_users' => 'All Users',
|
||||||
'is_active' => 'Is Active ?',
|
'is_active' => 'Is Active ?',
|
||||||
|
'is_admin' => 'Admin',
|
||||||
'mark_active' => 'Mark As Active',
|
'mark_active' => 'Mark As Active',
|
||||||
'mark_inactive' => 'Mark As Inactive',
|
'mark_inactive' => 'Mark As Inactive',
|
||||||
'user_inactive' => 'User Account Is Inactive',
|
'user_inactive' => 'User Account Is Inactive',
|
||||||
@@ -467,6 +471,7 @@ return [
|
|||||||
'send_email' => 'Send Email',
|
'send_email' => 'Send Email',
|
||||||
'send_email_tooltip' => 'If checked email address and password will be sent to user',
|
'send_email_tooltip' => 'If checked email address and password will be sent to user',
|
||||||
'is_active_tooltip' => 'Check/Uncheck to make a user active/inactive.',
|
'is_active_tooltip' => 'Check/Uncheck to make a user active/inactive.',
|
||||||
|
'is_admin_tooltip' => 'Check to make a admin user.',
|
||||||
'edit_user' => 'Edit User',
|
'edit_user' => 'Edit User',
|
||||||
'dont_want_to_change_keep_it_blank' => "Keep it blank, if you don't want to change",
|
'dont_want_to_change_keep_it_blank' => "Keep it blank, if you don't want to change",
|
||||||
'comment' => 'Comment',
|
'comment' => 'Comment',
|
||||||
@@ -477,10 +482,6 @@ return [
|
|||||||
'outline' => 'Outline',
|
'outline' => 'Outline',
|
||||||
'can_create_form' => 'Can create form',
|
'can_create_form' => 'Can create form',
|
||||||
'can_create_form_tooltip' => 'If checked user can create forms for him/herself',
|
'can_create_form_tooltip' => 'If checked user can create forms for him/herself',
|
||||||
'show_form_response_user' => 'Can view form response author',
|
|
||||||
'show_form_response_user_tooltip' => 'If checked user can view form response author',
|
|
||||||
'show_edit_buttons_form' => 'Can view form edit buttons',
|
|
||||||
'show_edit_buttons_form_tooltip' => 'If checked user can view edit buttons',
|
|
||||||
'assign_forms' => 'Share forms',
|
'assign_forms' => 'Share forms',
|
||||||
'permission_for_forms' => 'Permission for shared forms',
|
'permission_for_forms' => 'Permission for shared forms',
|
||||||
'can_design_form' => 'Can design form',
|
'can_design_form' => 'Can design form',
|
||||||
@@ -623,6 +624,7 @@ return [
|
|||||||
'loadingRecords' => 'Loading...',
|
'loadingRecords' => 'Loading...',
|
||||||
'processing' => 'Processing...',
|
'processing' => 'Processing...',
|
||||||
'search' => 'Search:',
|
'search' => 'Search:',
|
||||||
|
'search_without_dots' => 'Search',
|
||||||
'zeroRecords' => 'No matching records found',
|
'zeroRecords' => 'No matching records found',
|
||||||
'first' => 'First',
|
'first' => 'First',
|
||||||
'last' => 'Last',
|
'last' => 'Last',
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -298,6 +298,9 @@ return [
|
|||||||
'ltr' => 'Слева направо',
|
'ltr' => 'Слева направо',
|
||||||
'display_type' => 'Тип отображения',
|
'display_type' => 'Тип отображения',
|
||||||
'superadmin' => 'Суперадмин',
|
'superadmin' => 'Суперадмин',
|
||||||
|
'supervisor' => 'Супервизор',
|
||||||
|
'admin' => 'Админ',
|
||||||
|
'user' => 'Пользователь',
|
||||||
'packages' => 'Пакеты',
|
'packages' => 'Пакеты',
|
||||||
'create' => 'Создать',
|
'create' => 'Создать',
|
||||||
'no_of_active_forms' => 'Количество активных форм',
|
'no_of_active_forms' => 'Количество активных форм',
|
||||||
@@ -328,6 +331,7 @@ return [
|
|||||||
'users' => 'Пользователи',
|
'users' => 'Пользователи',
|
||||||
'all_users' => 'Все пользователи',
|
'all_users' => 'Все пользователи',
|
||||||
'is_active' => 'Активен?',
|
'is_active' => 'Активен?',
|
||||||
|
'is_admin' => 'Админ',
|
||||||
'mark_active' => 'Пометить как активный',
|
'mark_active' => 'Пометить как активный',
|
||||||
'mark_inactive' => 'Пометить как неактивный',
|
'mark_inactive' => 'Пометить как неактивный',
|
||||||
'user_inactive' => 'Учетная запись пользователя неактивна',
|
'user_inactive' => 'Учетная запись пользователя неактивна',
|
||||||
@@ -467,6 +471,7 @@ return [
|
|||||||
'send_email' => 'Отправить электронную почту',
|
'send_email' => 'Отправить электронную почту',
|
||||||
'send_email_tooltip' => 'Если установлено, пользователю будет отправлены адрес электронной почты и пароль',
|
'send_email_tooltip' => 'Если установлено, пользователю будет отправлены адрес электронной почты и пароль',
|
||||||
'is_active_tooltip' => 'Отметьте / снимите отметку, чтобы сделать пользователя активным / неактивным.',
|
'is_active_tooltip' => 'Отметьте / снимите отметку, чтобы сделать пользователя активным / неактивным.',
|
||||||
|
'is_admin_tooltip' => 'Установите отметку, чтобы сделать пользователя администратором.',
|
||||||
'edit_user' => 'Редактировать пользователя',
|
'edit_user' => 'Редактировать пользователя',
|
||||||
'dont_want_to_change_keep_it_blank' => "Оставьте поле пустым, если вы не хотите менять",
|
'dont_want_to_change_keep_it_blank' => "Оставьте поле пустым, если вы не хотите менять",
|
||||||
'comment' => 'Комментарий',
|
'comment' => 'Комментарий',
|
||||||
@@ -477,10 +482,6 @@ return [
|
|||||||
'outline' => 'Контур',
|
'outline' => 'Контур',
|
||||||
'can_create_form' => 'Может создавать форму',
|
'can_create_form' => 'Может создавать форму',
|
||||||
'can_create_form_tooltip' => 'Если установлено, пользователь может создавать формы для себя',
|
'can_create_form_tooltip' => 'Если установлено, пользователь может создавать формы для себя',
|
||||||
'show_form_response_user' => 'Can view form response author',
|
|
||||||
'show_form_response_user_tooltip' => 'If checked user can view form response author',
|
|
||||||
'show_edit_buttons_form' => 'Can view form edit buttons',
|
|
||||||
'show_edit_buttons_form_tooltip' => 'If checked user can view edit buttons',
|
|
||||||
'assign_forms' => 'Поделиться формами',
|
'assign_forms' => 'Поделиться формами',
|
||||||
'permission_for_forms' => 'Разрешение на общие формы',
|
'permission_for_forms' => 'Разрешение на общие формы',
|
||||||
'can_design_form' => 'Может проектировать форму',
|
'can_design_form' => 'Может проектировать форму',
|
||||||
@@ -623,6 +624,7 @@ return [
|
|||||||
'loadingRecords' => 'Загрузка...',
|
'loadingRecords' => 'Загрузка...',
|
||||||
'processing' => 'Обработка...',
|
'processing' => 'Обработка...',
|
||||||
'search' => 'Поиск:',
|
'search' => 'Поиск:',
|
||||||
|
'search_without_dots' => 'Поиск',
|
||||||
'zeroRecords' => 'Совпадающих записей не найдено',
|
'zeroRecords' => 'Совпадающих записей не найдено',
|
||||||
'first' => 'Первый',
|
'first' => 'Первый',
|
||||||
'last' => 'Последний',
|
'last' => 'Последний',
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -71,6 +71,7 @@
|
|||||||
:element="element"
|
:element="element"
|
||||||
:settings="settings"
|
:settings="settings"
|
||||||
:applyValidations="applyValidations"
|
:applyValidations="applyValidations"
|
||||||
|
action=""
|
||||||
></fieldGenerator>
|
></fieldGenerator>
|
||||||
<div class="element-config-action-btn float-right"
|
<div class="element-config-action-btn float-right"
|
||||||
v-show="element.extras.showConfigurator">
|
v-show="element.extras.showConfigurator">
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
:element="element"
|
:element="element"
|
||||||
:settings="settings"
|
:settings="settings"
|
||||||
:submitted_data="submitted_data"
|
:submitted_data="submitted_data"
|
||||||
|
:action="action"
|
||||||
|
:action-by="actionBy"
|
||||||
@apply_conditions="applyConditions">
|
@apply_conditions="applyConditions">
|
||||||
</fieldGenerator>
|
</fieldGenerator>
|
||||||
</div>
|
</div>
|
||||||
@@ -64,7 +66,7 @@
|
|||||||
import fieldGenerator from "./FieldGenerator";
|
import fieldGenerator from "./FieldGenerator";
|
||||||
|
|
||||||
export default{
|
export default{
|
||||||
props: ['form', 'actionBy'],
|
props: ['form', 'actionBy', 'action'],
|
||||||
components: {
|
components: {
|
||||||
fieldGenerator
|
fieldGenerator
|
||||||
},
|
},
|
||||||
@@ -121,7 +123,9 @@
|
|||||||
messages: messages,
|
messages: messages,
|
||||||
submitHandler: function(form, e) {
|
submitHandler: function(form, e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
let disabled = $('#show_form :input:disabled').removeAttr('disabled');
|
||||||
var form_data = $('#show_form').serialize();
|
var form_data = $('#show_form').serialize();
|
||||||
|
disabled.attr('disabled', 'disabled');
|
||||||
$("button.submit_btn, button.draft_btn").attr('disabled', 'disabled');
|
$("button.submit_btn, button.draft_btn").attr('disabled', 'disabled');
|
||||||
var status = $("input[name=status]").val();
|
var status = $("input[name=status]").val();
|
||||||
if (status == 'complete') {
|
if (status == 'complete') {
|
||||||
@@ -139,9 +143,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let url = '/form-data/' + self.form_parsed.id + '?token=' + self.token + '&form_data_id=' + self.form_data_id;
|
let url = '/form-data/' + self.form_parsed.id + '?token=' + self.token + '&form_data_id=' + self.form_data_id;
|
||||||
if (self.actionBy.length && self.actionBy == 'admin') {
|
// if (self.actionBy.length && self.actionBy === 'admin') {
|
||||||
url = '/update/'+self.form_parsed.id+'/data/'+self.form_data_id;
|
// url = '/update/'+self.form_parsed.id+'/data/'+self.form_data_id;
|
||||||
}
|
// }
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.post(url, {form_data})
|
.post(url, {form_data})
|
||||||
@@ -209,6 +213,10 @@
|
|||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
window.location.href = document.referrer;
|
||||||
|
}, 3000);
|
||||||
} else {
|
} else {
|
||||||
toastr.error(response.data.msg);
|
toastr.error(response.data.msg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,16 @@
|
|||||||
$error_msg_color = $form->schema['settings']['color']['error_msg'];
|
$error_msg_color = $form->schema['settings']['color']['error_msg'];
|
||||||
$bg_type = $form->schema['settings']['background']['bg_type'];
|
$bg_type = $form->schema['settings']['background']['bg_type'];
|
||||||
$bg_image = $form->schema['settings']['color']['image_path'];
|
$bg_image = $form->schema['settings']['color']['image_path'];
|
||||||
|
$action = '';
|
||||||
|
|
||||||
|
switch (request()->route()->getName()) {
|
||||||
|
case 'form-data.edit':
|
||||||
|
$action = 'edit';
|
||||||
|
break;
|
||||||
|
case 'forms.show':
|
||||||
|
$action = 'show';
|
||||||
|
break;
|
||||||
|
}
|
||||||
@endphp
|
@endphp
|
||||||
<div class="tab-content card-body"
|
<div class="tab-content card-body"
|
||||||
id="" role="tabpanel" style='@if(!empty($bg_image) && $bg_type == 'bg_image')background-image: url("{{Storage::url(config('constants.doc_path').'/'.$bg_image)}}"); background-repeat: no-repeat;background-size: cover;background-position: right top;@else background-color: {{$bg_color}}; @endif'>
|
id="" role="tabpanel" style='@if(!empty($bg_image) && $bg_type == 'bg_image')background-image: url("{{Storage::url(config('constants.doc_path').'/'.$bg_image)}}"); background-repeat: no-repeat;background-size: cover;background-position: right top;@else background-color: {{$bg_color}}; @endif'>
|
||||||
@@ -13,7 +23,7 @@
|
|||||||
{!! $form_closed_msg !!}
|
{!! $form_closed_msg !!}
|
||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
<show-form form="{{json_encode($form)}}" action-by="{{$action_by ?? ''}}"></show-form>
|
<show-form form="{{json_encode($form)}}" action-by="{{$action_by ?? ''}}" action="{{ $action }}"></show-form>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -50,6 +50,21 @@
|
|||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
{{$form->name}}
|
{{$form->name}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<form action="{{ @route('form-data.show', ['id' => $form->id]) }}" class="form row mt-3 mx-2 mb-0">
|
||||||
|
<div class="form-group mb-0 col-1">
|
||||||
|
<input type="date" class="form-control" name="start_date" value="{{ request()->get('start_date') ?? \Carbon\Carbon::now()->subDays(7)->toDateString() }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-0 col-1">
|
||||||
|
<input type="date" class="form-control" name="end_date" value="{{ request()->get('end_date') ?? \Carbon\Carbon::now()->toDateString() }}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-0 col-2 d-flex">
|
||||||
|
<button class="btn btn-primary mx-1" type="submit">@lang('messages.search_without_dots')</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$is_enabled_sub_ref_no = false;
|
$is_enabled_sub_ref_no = false;
|
||||||
if(isset($form->schema['settings']['form_submision_ref']['is_enabled']) && $form->schema['settings']['form_submision_ref']['is_enabled']) {
|
if(isset($form->schema['settings']['form_submision_ref']['is_enabled']) && $form->schema['settings']['form_submision_ref']['is_enabled']) {
|
||||||
@@ -67,13 +82,14 @@
|
|||||||
<table class="table" id="submitted_data_table" style="width: 100%;">
|
<table class="table" id="submitted_data_table" style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>@lang('messages.action')</th>
|
@if(auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value, \App\Enums\User\RoleEnum::ADMIN->value], 'web'))
|
||||||
|
<th>@lang('messages.action')</th>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if($is_enabled_sub_ref_no)
|
@if($is_enabled_sub_ref_no)
|
||||||
<th>@lang('messages.submission_numbering')</th>
|
<th>@lang('messages.submission_numbering')</th>
|
||||||
@endif
|
@endif
|
||||||
@if(auth()->user()->show_form_response_user)
|
<th>@lang('messages.username')</th>
|
||||||
<th>@lang('messages.username')</th>
|
|
||||||
@endif
|
|
||||||
@foreach($schema as $element)
|
@foreach($schema as $element)
|
||||||
@if(in_array($element['name'], $col_visible))
|
@if(in_array($element['name'], $col_visible))
|
||||||
<th>
|
<th>
|
||||||
@@ -88,40 +104,42 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@foreach($data as $k => $row)
|
@foreach($data as $k => $row)
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
@if(auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value, \App\Enums\User\RoleEnum::ADMIN->value], 'web'))
|
||||||
@if(in_array('view', $btn_enabled))
|
<td>
|
||||||
<button type="button" class="btn btn-info btn-sm view_form_data m-1"
|
@if(in_array('view', $btn_enabled))
|
||||||
data-href="{{action([\App\Http\Controllers\FormDataController::class, 'viewData'], [$row->id])}}"
|
<button type="button" class="btn btn-info btn-sm view_form_data m-1"
|
||||||
data-toggle="modal">
|
data-href="{{action([\App\Http\Controllers\FormDataController::class, 'viewData'], [$row->id])}}"
|
||||||
<i class="fa fa-eye" aria-hidden="true"></i>
|
data-toggle="modal">
|
||||||
@lang('messages.view')
|
<i class="fa fa-eye" aria-hidden="true"></i>
|
||||||
</button>
|
@lang('messages.view')
|
||||||
@endif
|
</button>
|
||||||
@if(in_array('delete', $btn_enabled))
|
@endif
|
||||||
<button type="button" class="btn btn-danger btn-sm delete_form_data m-1"
|
@if(in_array('delete', $btn_enabled))
|
||||||
data-href="{{action([\App\Http\Controllers\FormDataController::class, 'destroy'], [$row->id])}}">
|
<button type="button"
|
||||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
class="btn btn-danger btn-sm delete_form_data m-1"
|
||||||
@lang('messages.delete')
|
data-href="{{action([\App\Http\Controllers\FormDataController::class, 'destroy'], [$row->id])}}">
|
||||||
</button>
|
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||||
@endif
|
@lang('messages.delete')
|
||||||
@php
|
</button>
|
||||||
$form_id = !empty($form->slug) ? $form->slug : $form->id;
|
@endif
|
||||||
@endphp
|
@php
|
||||||
<a class="btn btn-dark btn-sm m-1" target="_blank"
|
$form_id = !empty($form->slug) ? $form->slug : $form->id;
|
||||||
href="{{action([\App\Http\Controllers\FormDataController::class, 'getEditformData'], ['slug' => $form_id,'id' => $row->id])}}">
|
@endphp
|
||||||
<i class="far fa-edit" aria-hidden="true"></i>
|
<a class="btn btn-dark btn-sm m-1"
|
||||||
@lang('messages.edit')
|
href="{{action([\App\Http\Controllers\FormDataController::class, 'getEditformData'], ['slug' => $form_id,'id' => $row->id])}}">
|
||||||
</a>
|
<i class="far fa-edit" aria-hidden="true"></i>
|
||||||
</td>
|
@lang('messages.edit')
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if($is_enabled_sub_ref_no)
|
@if($is_enabled_sub_ref_no)
|
||||||
<td>
|
<td>
|
||||||
{{$row['submission_ref']}}
|
{{$row['submission_ref']}}
|
||||||
</td>
|
</td>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if(auth()->user()->show_form_response_user)
|
<td>{{ $row->submittedBy?->name }}</td>
|
||||||
<td>{{ $row->submittedBy?->name }}</td>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@foreach($schema as $row_element)
|
@foreach($schema as $row_element)
|
||||||
@if(in_array($row_element['name'], $col_visible))
|
@if(in_array($row_element['name'], $col_visible))
|
||||||
@@ -150,10 +168,10 @@
|
|||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
<td>
|
<td>
|
||||||
{{\Carbon\Carbon::createFromTimestamp(strtotime($row->created_at))->format($date_format)}}
|
{{\Carbon\Carbon::createFromTimestamp(strtotime($row->updated_at))->format($date_format)}}
|
||||||
<br/>
|
<br/>
|
||||||
<small>
|
<small>
|
||||||
{{$row->created_at->diffForHumans()}}
|
{{$row->updated_at->diffForHumans()}}
|
||||||
</small>
|
</small>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,96 +1,112 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@include('layouts/partials/status')
|
@include('layouts/partials/status')
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@if(auth()->user()->can('superadmin') || Auth::user()->can_create_form)
|
|
||||||
<div class="row mb-5">
|
|
||||||
<div class="col-12 col-sm-6 col-md-3">
|
|
||||||
<div class="info-box">
|
|
||||||
<span class="info-box-icon bg-info elevation-1"><i class="fas fa-file-alt"></i></span>
|
|
||||||
|
|
||||||
<div class="info-box-content">
|
|
||||||
<span class="info-box-text">@lang('messages.forms')</span>
|
|
||||||
<span class="info-box-number">{{$form_count}}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-12 col-sm-6 col-md-3">
|
|
||||||
<div class="info-box">
|
|
||||||
<span class="info-box-icon bg-danger elevation-1"><i class="fas fa-align-justify"></i></span>
|
|
||||||
|
|
||||||
<div class="info-box-content">
|
|
||||||
<span class="info-box-text">@lang('messages.templates')</span>
|
|
||||||
<span class="info-box-number">{{$template_count}}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-12 col-sm-6 col-md-3">
|
|
||||||
<div class="info-box">
|
|
||||||
<span class="info-box-icon bg-green elevation-1"><i class="fas fa-hand-pointer"></i></span>
|
|
||||||
|
|
||||||
<div class="info-box-content">
|
|
||||||
<span class="info-box-text">@lang('messages.submissions')</span>
|
|
||||||
<span class="info-box-number">{{$submission_count}}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-12 col-sm-6 col-md-3">
|
|
||||||
<button type="button" data-href="{{action([\App\Http\Controllers\FormController::class, 'create'])}}" class="btn btn-primary float-right col-md-9 createForm mt-3">
|
|
||||||
<i class="fas fa-plus" aria-hidden="true"></i> @lang('messages.new_form')</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
|
||||||
<div class="row">
|
<div class="row mb-5">
|
||||||
<div class="col-12 col-sm-12">
|
<div class="col-12 col-sm-6 col-md-3">
|
||||||
<div class="card card-primary card-outline card-outline-tabs">
|
<div class="info-box">
|
||||||
<div class="card-header p-0 border-bottom-0">
|
<span class="info-box-icon bg-info elevation-1"><i class="fas fa-file-alt"></i></span>
|
||||||
<ul class="nav nav-tabs
|
|
||||||
@if(auth()->user()->can('superadmin') || Auth::user()->can_create_form)
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text">@lang('messages.forms')</span>
|
||||||
|
<span class="info-box-number">{{$form_count}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::ADMIN->value))
|
||||||
|
<div class="col-12 col-sm-6 col-md-3">
|
||||||
|
<div class="info-box">
|
||||||
|
<span class="info-box-icon bg-danger elevation-1"><i
|
||||||
|
class="fas fa-align-justify"></i></span>
|
||||||
|
|
||||||
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text">@lang('messages.templates')</span>
|
||||||
|
<span class="info-box-number">{{$template_count}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="col-12 col-sm-6 col-md-3">
|
||||||
|
<div class="info-box">
|
||||||
|
<span class="info-box-icon bg-green elevation-1"><i class="fas fa-hand-pointer"></i></span>
|
||||||
|
|
||||||
|
<div class="info-box-content">
|
||||||
|
<span class="info-box-text">@lang('messages.submissions')</span>
|
||||||
|
<span class="info-box-number">{{$submission_count}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12 col-sm-6 col-md-3">
|
||||||
|
<button type="button"
|
||||||
|
data-href="{{action([\App\Http\Controllers\FormController::class, 'create'])}}"
|
||||||
|
class="btn btn-primary float-right col-md-9 createForm mt-3">
|
||||||
|
<i class="fas fa-plus" aria-hidden="true"></i> @lang('messages.new_form')</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-sm-12">
|
||||||
|
<div class="card card-primary card-outline card-outline-tabs">
|
||||||
|
<div class="card-header p-0 border-bottom-0">
|
||||||
|
<ul class="nav nav-tabs
|
||||||
|
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
|
||||||
nav-justified
|
nav-justified
|
||||||
@endif"
|
@endif"
|
||||||
id="custom-tabs-four-tab" role="tablist">
|
id="custom-tabs-four-tab" role="tablist">
|
||||||
@if(auth()->user()->can('superadmin') || Auth::user()->can_create_form)
|
@if(auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value]) || auth()->user()->can_create_form)
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" id="custome-tabs-all-forms" data-toggle="pill"
|
||||||
|
href="#custome-tabs-forms" role="tab" aria-controls="custome-tabs-forms"
|
||||||
|
aria-selected="true">
|
||||||
|
<i class="fas fa-file-alt" aria-hidden="true"></i> @lang('messages.all_forms')
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::ADMIN->value))
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="custome-tabs-all-templates" data-toggle="pill"
|
||||||
|
href="#custome-tabs-templates" role="tab"
|
||||||
|
aria-controls="custome-tabs-templates">
|
||||||
|
<i class="fas fa-align-justify"
|
||||||
|
aria-hidden="true"></i> @lang('messages.all_templates')
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" id="custome-tabs-all-forms" data-toggle="pill" href="#custome-tabs-forms" role="tab" aria-controls="custome-tabs-forms" aria-selected="true">
|
<a class="nav-link
|
||||||
<i class="fas fa-file-alt" aria-hidden="true"></i> @lang('messages.all_forms')
|
@if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) && !auth()->user()->can_create_form)
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" id="custome-tabs-all-templates" data-toggle="pill" href="#custome-tabs-templates" role="tab" aria-controls="custome-tabs-templates">
|
|
||||||
<i class="fas fa-align-justify" aria-hidden="true"></i> @lang('messages.all_templates')
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
@endif
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link
|
|
||||||
@if(!auth()->user()->can('superadmin') && !Auth::user()->can_create_form)
|
|
||||||
active
|
active
|
||||||
@endif
|
@endif
|
||||||
" id="custome-tabs-shared-forms" data-toggle="pill" href="#custome-tabs-shared-forms-assigned" role="tab" aria-controls="custome-tabs-shared-forms-assigned"
|
" id="custome-tabs-shared-forms" data-toggle="pill"
|
||||||
@if(!auth()->user()->can('superadmin') && !Auth::user()->can_create_form)
|
href="#custome-tabs-shared-forms-assigned" role="tab"
|
||||||
aria-selected="true"
|
aria-controls="custome-tabs-shared-forms-assigned"
|
||||||
@endif>
|
@if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) && !auth()->user()->can_create_form)
|
||||||
<i class="fas fa-file-alt" aria-hidden="true"></i> @lang('messages.assigned_forms')
|
aria-selected="true"
|
||||||
</a>
|
@endif>
|
||||||
</li>
|
<i class="fas fa-file-alt"
|
||||||
</ul>
|
aria-hidden="true"></i> @lang('messages.assigned_forms')
|
||||||
</div>
|
</a>
|
||||||
<div class="card-body">
|
</li>
|
||||||
<div class="tab-content" id="custom-tabs-four-tabContent">
|
</ul>
|
||||||
@if(auth()->user()->can('superadmin') || Auth::user()->can_create_form)
|
</div>
|
||||||
<div class="tab-pane fade active show" id="custome-tabs-forms" role="tabpanel" aria-labelledby="custome-tabs-all-forms">
|
<div class="card-body">
|
||||||
<div class="table-responsive">
|
<div class="tab-content" id="custom-tabs-four-tabContent">
|
||||||
<table class="table" id="form_table" style="width: 100%;">
|
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
|
||||||
<thead>
|
<div class="tab-pane fade active show" id="custome-tabs-forms" role="tabpanel"
|
||||||
|
aria-labelledby="custome-tabs-all-forms">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table" id="form_table" style="width: 100%;">
|
||||||
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>@lang('messages.name')</th>
|
<th>@lang('messages.name')</th>
|
||||||
<th>@lang('messages.description')</th>
|
<th>@lang('messages.description')</th>
|
||||||
@@ -98,15 +114,16 @@
|
|||||||
<th>@lang('messages.submissions')</th>
|
<th>@lang('messages.submissions')</th>
|
||||||
<th>@lang('messages.action')</th>
|
<th>@lang('messages.action')</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="tab-pane fade" id="custome-tabs-templates" role="tabpanel"
|
||||||
<div class="tab-pane fade" id="custome-tabs-templates" role="tabpanel" aria-labelledby="custome-tabs-all-templates">
|
aria-labelledby="custome-tabs-all-templates">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table" id="template_table" style="width: 100%;">
|
<table class="table" id="template_table" style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>@lang('messages.name')</th>
|
<th>@lang('messages.name')</th>
|
||||||
<th>@lang('messages.description')</th>
|
<th>@lang('messages.description')</th>
|
||||||
@@ -114,52 +131,56 @@
|
|||||||
<th>
|
<th>
|
||||||
@lang('messages.is_global_template')
|
@lang('messages.is_global_template')
|
||||||
<i class="fas fa-info-circle"
|
<i class="fas fa-info-circle"
|
||||||
data-toggle="tooltip"
|
data-toggle="tooltip"
|
||||||
title="@lang('messages.is_global_template_tooltip')"></i>
|
title="@lang('messages.is_global_template_tooltip')"></i>
|
||||||
</th>
|
</th>
|
||||||
@endif
|
@endif
|
||||||
<th>@lang('messages.action')</th>
|
<th>@lang('messages.action')</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<div class="tab-pane fade
|
||||||
|
@if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || !auth()->user()->can_create_form)
|
||||||
|
active show
|
||||||
|
@endif
|
||||||
|
" id="custome-tabs-shared-forms-assigned" role="tabpanel"
|
||||||
|
aria-labelledby="custome-tabs-shared-forms">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table" id="assigned_form_table" style="width: 100%;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>@lang('messages.name')</th>
|
||||||
|
<th>@lang('messages.description')</th>
|
||||||
|
@if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
|
||||||
|
<th>@lang('messages.created_by')</th>
|
||||||
|
@endif
|
||||||
|
<th>@lang('messages.action')</th>
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
<div class="tab-pane fade
|
|
||||||
@if(!auth()->user()->can('superadmin') && !Auth::user()->can_create_form)
|
|
||||||
active show
|
|
||||||
@endif
|
|
||||||
" id="custome-tabs-shared-forms-assigned" role="tabpanel" aria-labelledby="custome-tabs-shared-forms">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table" id="assigned_form_table" style="width: 100%;">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>@lang('messages.name')</th>
|
|
||||||
<th>@lang('messages.description')</th>
|
|
||||||
<th>@lang('messages.action')</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody></tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- /.card -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /.card -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="modal fade" id="collab_modal" role="dialog" aria-hidden="true"></div>
|
||||||
<div class="modal fade" id="collab_modal" role="dialog" aria-hidden="true"></div>
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('footer')
|
@section('footer')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function(){
|
$(document).ready(function () {
|
||||||
|
|
||||||
// form dataTable
|
// form dataTable
|
||||||
var form_table = $('#form_table').DataTable({
|
var form_table = $('#form_table').DataTable({
|
||||||
processing: true,
|
processing: true,
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
ajax: '/home',
|
ajax: '/home',
|
||||||
@@ -168,23 +189,23 @@
|
|||||||
fixedHeader: false,
|
fixedHeader: false,
|
||||||
aaSorting: [[2, 'desc']],
|
aaSorting: [[2, 'desc']],
|
||||||
"columnDefs": [
|
"columnDefs": [
|
||||||
{ "width": "22%", "targets": 0 },
|
{"width": "22%", "targets": 0},
|
||||||
{ "width": "40%", "targets": 1 },
|
{"width": "40%", "targets": 1},
|
||||||
{ "width": "15%", "targets": 2 },
|
{"width": "15%", "targets": 2},
|
||||||
{ "width": "3%", "targets": 3 },
|
{"width": "3%", "targets": 3},
|
||||||
{ "width": "20%", "targets": 4 }
|
{"width": "20%", "targets": 4}
|
||||||
],
|
],
|
||||||
columns: [
|
columns: [
|
||||||
{ data: 'name' , name: 'name'},
|
{data: 'name', name: 'name'},
|
||||||
{ data: 'description' , name: 'description'},
|
{data: 'description', name: 'description'},
|
||||||
{ data: 'created_at' , name: 'created_at'},
|
{data: 'created_at', name: 'created_at'},
|
||||||
{ data: 'data_count', name: 'data_count', searchable:false},
|
{data: 'data_count', name: 'data_count', searchable: false},
|
||||||
{ data: 'action', name: 'action', sortable:false }
|
{data: 'action', name: 'action', sortable: false}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
// template dataTable
|
// template dataTable
|
||||||
var template_table = $('#template_table').DataTable({
|
var template_table = $('#template_table').DataTable({
|
||||||
processing: true,
|
processing: true,
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
ajax: '/home-template',
|
ajax: '/home-template',
|
||||||
@@ -192,191 +213,209 @@
|
|||||||
dom: 'lfrtip',
|
dom: 'lfrtip',
|
||||||
fixedHeader: false,
|
fixedHeader: false,
|
||||||
columns: [
|
columns: [
|
||||||
{ data: 'name' , name: 'name'},
|
{data: 'name', name: 'name'},
|
||||||
{ data: 'description' , name: 'description'},
|
{data: 'description', name: 'description'},
|
||||||
@if(auth()->user()->can('superadmin'))
|
@if(auth()->user()->can('superadmin'))
|
||||||
{ data: 'is_global_template', name: 'is_global_template', sortable:false, searchable:false },
|
{
|
||||||
@endif
|
data: 'is_global_template', name: 'is_global_template', sortable: false, searchable: false
|
||||||
{ data: 'action', name: 'action', sortable:false }
|
},
|
||||||
|
@endif
|
||||||
|
{
|
||||||
|
data: 'action', name: 'action', sortable: false
|
||||||
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
//delete form
|
//delete form
|
||||||
$(document).on('click', '.delete_form', function(){
|
$(document).on('click', '.delete_form', function () {
|
||||||
var url = $(this).data("href");
|
var url = $(this).data("href");
|
||||||
var result = confirm('Are You Sure?');
|
var result = confirm('Are You Sure?');
|
||||||
if (result == true) {
|
if (result == true) {
|
||||||
|
$.ajax({
|
||||||
|
method: "DELETE",
|
||||||
|
url: url,
|
||||||
|
dataType: "json",
|
||||||
|
success: function (result) {
|
||||||
|
if (result.success == true) {
|
||||||
|
toastr.success(result.msg);
|
||||||
|
form_table.ajax.reload();
|
||||||
|
} else {
|
||||||
|
toastr.error(result.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//delete template
|
||||||
|
$(document).on('click', '.delete_template', function () {
|
||||||
|
var url = $(this).data("href");
|
||||||
|
var result = confirm('Are You Sure?');
|
||||||
|
if (result == true) {
|
||||||
|
$.ajax({
|
||||||
|
method: "DELETE",
|
||||||
|
url: url,
|
||||||
|
dataType: "json",
|
||||||
|
success: function (result) {
|
||||||
|
if (result.success == true) {
|
||||||
|
toastr.success(result.msg);
|
||||||
|
template_table.ajax.reload();
|
||||||
|
} else {
|
||||||
|
toastr.error(result.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// create form
|
||||||
|
$(document).on('click', '.createForm', function () {
|
||||||
|
var url = $(this).data('href');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "DELETE",
|
method: "GET",
|
||||||
|
url: url,
|
||||||
|
dataType: "html",
|
||||||
|
success: function (response) {
|
||||||
|
$("#modal_div").html(response).modal("show");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// create widget
|
||||||
|
$(document).on('click', '.generate_widget', function () {
|
||||||
|
var url = $(this).data('href');
|
||||||
|
$.ajax({
|
||||||
|
method: "GET",
|
||||||
|
url: url,
|
||||||
|
dataType: "html",
|
||||||
|
success: function (response) {
|
||||||
|
$("#modal_div").html(response).modal("show");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//copy form
|
||||||
|
$(document).on('click', '.copy_form', function () {
|
||||||
|
var url = $(this).data('href');
|
||||||
|
$.ajax({
|
||||||
|
method: "GET",
|
||||||
|
url: url,
|
||||||
|
dataType: "html",
|
||||||
|
success: function (response) {
|
||||||
|
$("#modal_div").html(response).modal("show");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//assigned form to user
|
||||||
|
var assigned_form_table = $('#assigned_form_table').DataTable({
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
|
ajax: '/home-assigned-forms',
|
||||||
|
buttons: [],
|
||||||
|
dom: 'lfrtip',
|
||||||
|
fixedHeader: false,
|
||||||
|
aaSorting: [[0, 'desc']],
|
||||||
|
"columnDefs": [
|
||||||
|
{"width": "25%", "targets": 0},
|
||||||
|
{"width": "40%", "targets": 1},
|
||||||
|
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
|
||||||
|
{
|
||||||
|
"width": "15%", "targets": 2
|
||||||
|
},
|
||||||
|
@endif
|
||||||
|
{
|
||||||
|
"width": "20%",
|
||||||
|
"targets": @php echo auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) ? 3 : 2 @endphp }
|
||||||
|
],
|
||||||
|
columns: [
|
||||||
|
{data: 'name', name: 'forms.name'},
|
||||||
|
{data: 'description', name: 'forms.description'},
|
||||||
|
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
|
||||||
|
{
|
||||||
|
data: 'created_by', name: 'forms.created_by'
|
||||||
|
},
|
||||||
|
@endif
|
||||||
|
{
|
||||||
|
data: 'action', name: 'action', sortable: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
//form collaborate
|
||||||
|
$(document).on('click', '.collab_btn', function () {
|
||||||
|
var url = $(this).data('href');
|
||||||
|
$.ajax({
|
||||||
|
method: "GET",
|
||||||
|
url: url,
|
||||||
|
dataType: "html",
|
||||||
|
success: function (response) {
|
||||||
|
$("#collab_modal").html(response).modal("show");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#collab_modal").on('shown.bs.modal', function () {
|
||||||
|
if ($("#form_design").length) {
|
||||||
|
$(document).on('change', '#form_design', function () {
|
||||||
|
if ($("#form_design").is(":checked")) {
|
||||||
|
$("#form_view").attr('checked', true);
|
||||||
|
} else {
|
||||||
|
$("#form_view").attr('checked', false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('submit', 'form#collaborate_form', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var data = $("form#collaborate_form").serialize();
|
||||||
|
var url = $("form#collaborate_form").attr('action');
|
||||||
|
var ladda = Ladda.create(document.querySelector('.submit_btn'));
|
||||||
|
ladda.start();
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(result){
|
data: data,
|
||||||
if(result.success == true){
|
success: function (response) {
|
||||||
toastr.success(result.msg);
|
ladda.stop();
|
||||||
form_table.ajax.reload();
|
if (response.success) {
|
||||||
|
$("#collab_modal").modal('hide');
|
||||||
|
toastr.success(response.msg);
|
||||||
} else {
|
} else {
|
||||||
toastr.error(result.msg);
|
toastr.error(response.msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
//delete template
|
$('a[data-toggle="pill"]').on('shown.bs.tab', function (e) {
|
||||||
$(document).on('click', '.delete_template', function(){
|
var target = $(e.target).attr('href');
|
||||||
var url = $(this).data("href");
|
if (target == '#custome-tabs-forms') {
|
||||||
var result = confirm('Are You Sure?');
|
if (typeof form_table != 'undefined') {
|
||||||
if (result == true) {
|
form_table.ajax.reload();
|
||||||
$.ajax({
|
|
||||||
method: "DELETE",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
success: function(result){
|
|
||||||
if(result.success == true){
|
|
||||||
toastr.success(result.msg);
|
|
||||||
template_table.ajax.reload();
|
|
||||||
} else {
|
|
||||||
toastr.error(result.msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
} else if (target == '#custome-tabs-templates') {
|
||||||
}
|
if (typeof template_table != 'undefined') {
|
||||||
});
|
template_table.ajax.reload();
|
||||||
|
|
||||||
// create form
|
|
||||||
$(document).on('click', '.createForm', function(){
|
|
||||||
var url = $(this).data('href');
|
|
||||||
$.ajax({
|
|
||||||
method: "GET",
|
|
||||||
url: url,
|
|
||||||
dataType: "html",
|
|
||||||
success: function(response) {
|
|
||||||
$("#modal_div").html(response).modal("show");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// create widget
|
|
||||||
$(document).on('click', '.generate_widget', function(){
|
|
||||||
var url = $(this).data('href');
|
|
||||||
$.ajax({
|
|
||||||
method: "GET",
|
|
||||||
url: url,
|
|
||||||
dataType: "html",
|
|
||||||
success: function(response) {
|
|
||||||
$("#modal_div").html(response).modal("show");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//copy form
|
|
||||||
$(document).on('click', '.copy_form', function(){
|
|
||||||
var url = $(this).data('href');
|
|
||||||
$.ajax({
|
|
||||||
method: "GET",
|
|
||||||
url: url,
|
|
||||||
dataType: "html",
|
|
||||||
success: function(response) {
|
|
||||||
$("#modal_div").html(response).modal("show");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//assigned form to user
|
|
||||||
var assigned_form_table = $('#assigned_form_table').DataTable({
|
|
||||||
processing: true,
|
|
||||||
serverSide: true,
|
|
||||||
ajax: '/home-assigned-forms',
|
|
||||||
buttons: [],
|
|
||||||
dom: 'lfrtip',
|
|
||||||
fixedHeader: false,
|
|
||||||
aaSorting: [[0, 'desc']],
|
|
||||||
"columnDefs": [
|
|
||||||
{ "width": "25%", "targets": 0 },
|
|
||||||
{ "width": "40%", "targets": 1 },
|
|
||||||
{ "width": "20%", "targets": 2 }
|
|
||||||
],
|
|
||||||
columns: [
|
|
||||||
{ data: 'name' , name: 'forms.name'},
|
|
||||||
{ data: 'description' , name: 'forms.description'},
|
|
||||||
{ data: 'action', name: 'action', sortable:false }
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
//form collaborate
|
|
||||||
$(document).on('click', '.collab_btn', function() {
|
|
||||||
var url = $(this).data('href');
|
|
||||||
$.ajax({
|
|
||||||
method: "GET",
|
|
||||||
url: url,
|
|
||||||
dataType: "html",
|
|
||||||
success: function(response) {
|
|
||||||
$("#collab_modal").html(response).modal("show");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#collab_modal").on('shown.bs.modal', function () {
|
|
||||||
if ($("#form_design").length) {
|
|
||||||
$(document).on('change', '#form_design', function(){
|
|
||||||
if ($("#form_design").is(":checked")) {
|
|
||||||
$("#form_view").attr('checked', true);
|
|
||||||
} else {
|
|
||||||
$("#form_view").attr('checked', false);
|
|
||||||
}
|
}
|
||||||
});
|
} else if (target == '#custome-tabs-shared-forms-assigned') {
|
||||||
}
|
if (typeof assigned_form_table != 'undefined') {
|
||||||
});
|
assigned_form_table.ajax.reload();
|
||||||
|
|
||||||
$(document).on('submit', 'form#collaborate_form', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var data = $("form#collaborate_form").serialize();
|
|
||||||
var url = $("form#collaborate_form").attr('action');
|
|
||||||
var ladda = Ladda.create(document.querySelector('.submit_btn'));
|
|
||||||
ladda.start();
|
|
||||||
$.ajax({
|
|
||||||
method: "POST",
|
|
||||||
url: url,
|
|
||||||
dataType: "json",
|
|
||||||
data: data,
|
|
||||||
success: function (response) {
|
|
||||||
ladda.stop();
|
|
||||||
if (response.success) {
|
|
||||||
$("#collab_modal").modal('hide');
|
|
||||||
toastr.success(response.msg);
|
|
||||||
} else {
|
|
||||||
toastr.error(response.msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
$('a[data-toggle="pill"]').on('shown.bs.tab', function (e) {
|
@if(auth()->user()->can('superadmin'))
|
||||||
var target = $(e.target).attr('href');
|
$(document).on('click', '.toggle_global_template', function () {
|
||||||
if (target == '#custome-tabs-forms') {
|
|
||||||
if(typeof form_table != 'undefined') {
|
|
||||||
form_table.ajax.reload();
|
|
||||||
}
|
|
||||||
} else if (target == '#custome-tabs-templates') {
|
|
||||||
if(typeof template_table != 'undefined') {
|
|
||||||
template_table.ajax.reload();
|
|
||||||
}
|
|
||||||
} else if (target == '#custome-tabs-shared-forms-assigned') {
|
|
||||||
if(typeof assigned_form_table != 'undefined') {
|
|
||||||
assigned_form_table.ajax.reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
@if(auth()->user()->can('superadmin'))
|
|
||||||
$(document).on('click', '.toggle_global_template', function() {
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "{{route('toggle.global.template')}}",
|
url: "{{route('toggle.global.template')}}",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: {
|
data: {
|
||||||
is_checked : $(this).is(":checked") ? 1 : 0,
|
is_checked: $(this).is(":checked") ? 1 : 0,
|
||||||
form_id : $(this).data("form_id"),
|
form_id: $(this).data("form_id"),
|
||||||
},
|
},
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -387,7 +426,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
$form = !empty($form) ? $form : '';
|
$form = !empty($form) ? $form : '';
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<!-- reCaptcha -->
|
<!-- reCaptcha -->
|
||||||
<script src="//www.google.com/recaptcha/api.js?v={{$asset_version}}" async defer></script>
|
<script src="//www.google.com/recaptcha/api.js?v={{$asset_version}}" async defer></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
if(typeof jQuery == 'undefined'){
|
if (typeof jQuery == 'undefined') {
|
||||||
document.write('<script src="//code.jquery.com/jquery-3.4.1.min.js?v={{$asset_version}}"></'+'script>');
|
document.write('<script src="//code.jquery.com/jquery-3.4.1.min.js?v={{$asset_version}}"></' + 'script>');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -20,18 +20,26 @@
|
|||||||
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/moment@2.24.0/moment.min.js?v={{$asset_version}}"></script>
|
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/moment@2.24.0/moment.min.js?v={{$asset_version}}"></script>
|
||||||
<script src="//cdn.jsdelivr.net/npm/toastr@2.1.4/build/toastr.min.js?v={{$asset_version}}"></script>
|
<script src="//cdn.jsdelivr.net/npm/toastr@2.1.4/build/toastr.min.js?v={{$asset_version}}"></script>
|
||||||
<script src="//cdn.jsdelivr.net/npm/jquery-validation@1.17.0/dist/jquery.validate.min.js?v={{$asset_version}}"></script>
|
<script src="//cdn.jsdelivr.net/npm/jquery-validation@1.17.0/dist/jquery.validate.min.js?v={{$asset_version}}"></script>
|
||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/rangeslider.js/2.3.2/rangeslider.min.js?v={{$asset_version}}"></script>
|
<script type="text/javascript"
|
||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.1.2/js/tempusdominus-bootstrap-4.min.js?v={{$asset_version}}"></script>
|
src="//cdnjs.cloudflare.com/ajax/libs/rangeslider.js/2.3.2/rangeslider.min.js?v={{$asset_version}}"></script>
|
||||||
|
<script type="text/javascript"
|
||||||
|
src="//cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.1.2/js/tempusdominus-bootstrap-4.min.js?v={{$asset_version}}"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.js?v={{$asset_version}}"></script>
|
<script type="text/javascript"
|
||||||
|
src="//cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/min/dropzone.min.js?v={{$asset_version}}"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.10/js/bootstrap-select.min.js?v={{$asset_version}}"></script>
|
<script type="text/javascript"
|
||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/summernote/0.8.12/summernote-bs4.min.js?v={{$asset_version}}"></script>
|
src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.10/js/bootstrap-select.min.js?v={{$asset_version}}"></script>
|
||||||
|
<script type="text/javascript"
|
||||||
|
src="//cdnjs.cloudflare.com/ajax/libs/summernote/0.8.12/summernote-bs4.min.js?v={{$asset_version}}"></script>
|
||||||
|
|
||||||
<!-- Boostrap star rating -->
|
<!-- Boostrap star rating -->
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.6/js/star-rating.min.js?v={{$asset_version}}" type="text/javascript"></script>
|
<script
|
||||||
|
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.6/js/star-rating.min.js?v={{$asset_version}}"
|
||||||
|
type="text/javascript"></script>
|
||||||
<!-- if you need to use a theme, then include the theme Js file -->
|
<!-- if you need to use a theme, then include the theme Js file -->
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.6/themes/krajee-svg/theme.js?v={{$asset_version}}"></script>
|
<script
|
||||||
|
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.6/themes/krajee-svg/theme.js?v={{$asset_version}}"></script>
|
||||||
<!-- optionally if you need translation for your language then include locale file as mentioned below -->
|
<!-- optionally if you need translation for your language then include locale file as mentioned below -->
|
||||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.6/js/locales/<lang>.js"></script> -->
|
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-star-rating/4.0.6/js/locales/<lang>.js"></script> -->
|
||||||
<!-- signature pad (https://github.com/szimek/signature_pad)-->
|
<!-- signature pad (https://github.com/szimek/signature_pad)-->
|
||||||
@@ -56,7 +64,7 @@
|
|||||||
APP.ACELLE_MAIL_ENABLED = true;
|
APP.ACELLE_MAIL_ENABLED = true;
|
||||||
@endif
|
@endif
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
beforeSend: function(jqXHR, settings) {
|
beforeSend: function (jqXHR, settings) {
|
||||||
if (settings.url.indexOf('http') === -1) {
|
if (settings.url.indexOf('http') === -1) {
|
||||||
settings.url = APP.APP_URL + settings.url;
|
settings.url = APP.APP_URL + settings.url;
|
||||||
}
|
}
|
||||||
@@ -82,27 +90,34 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="//cdn.jsdelivr.net/npm/jquery-validation-unobtrusive@3.2.10/dist/jquery.validate.unobtrusive.min.js?v={{$asset_version}}"></script>
|
<script
|
||||||
|
src="//cdn.jsdelivr.net/npm/jquery-validation-unobtrusive@3.2.10/dist/jquery.validate.unobtrusive.min.js?v={{$asset_version}}"></script>
|
||||||
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11?v={{$asset_version}}"></script>
|
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11?v={{$asset_version}}"></script>
|
||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js?v={{$asset_version}}"></script>
|
<script type="text/javascript"
|
||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js?v={{$asset_version}}"></script>
|
src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js?v={{$asset_version}}"></script>
|
||||||
<script type="text/javascript" src="//cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.18/b-1.5.6/b-colvis-1.5.6/b-flash-1.5.6/b-html5-1.5.6/b-print-1.5.6/fc-3.3.1/fh-3.1.4/datatables.min.js?v={{$asset_version}}"></script>
|
<script type="text/javascript"
|
||||||
|
src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js?v={{$asset_version}}"></script>
|
||||||
|
<script type="text/javascript"
|
||||||
|
src="//cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.10.18/b-1.5.6/b-colvis-1.5.6/b-flash-1.5.6/b-html5-1.5.6/b-print-1.5.6/fc-3.3.1/fh-3.1.4/datatables.min.js?v={{$asset_version}}"></script>
|
||||||
|
|
||||||
<!-- ladda.js -->
|
<!-- ladda.js -->
|
||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.6/spin.min.js?v={{$asset_version}}"></script>
|
<script type="text/javascript"
|
||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.6/ladda.min.js?v={{$asset_version}}"></script>
|
src="//cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.6/spin.min.js?v={{$asset_version}}"></script>
|
||||||
|
<script type="text/javascript"
|
||||||
|
src="//cdnjs.cloudflare.com/ajax/libs/Ladda/1.0.6/ladda.min.js?v={{$asset_version}}"></script>
|
||||||
<!-- localization -->
|
<!-- localization -->
|
||||||
<script src="{{ url('/js/lang.js') . '?v=' . $asset_version }}"></script>
|
<script src="{{ url('/js/lang.js') . '?v=' . $asset_version }}"></script>
|
||||||
<script src="{{ asset(mix('js/app.js')) }}" defer></script>
|
<script src="{{ asset(mix('js/app.js')) }}" defer></script>
|
||||||
<!-- intro.js -->
|
<!-- intro.js -->
|
||||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/intro.js/2.9.3/intro.min.js?v={{$asset_version}}"></script>
|
<script type="text/javascript"
|
||||||
|
src="https://cdnjs.cloudflare.com/ajax/libs/intro.js/2.9.3/intro.min.js?v={{$asset_version}}"></script>
|
||||||
<script src="{{ asset('js/iframeResizercontentWindow.js') }}"></script>
|
<script src="{{ asset('js/iframeResizercontentWindow.js') }}"></script>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
jQuery.validator.setDefaults({
|
jQuery.validator.setDefaults({
|
||||||
errorPlacement: function(error, element) {
|
errorPlacement: function (error, element) {
|
||||||
if (element.hasClass('select2') && element.parent().hasClass('input-group')) {
|
if (element.hasClass('select2') && element.parent().hasClass('input-group')) {
|
||||||
error.insertAfter(element.parent());
|
error.insertAfter(element.parent());
|
||||||
} else if (element.hasClass('select2')) {
|
} else if (element.hasClass('select2')) {
|
||||||
@@ -111,11 +126,11 @@
|
|||||||
error.insertAfter(element.parent());
|
error.insertAfter(element.parent());
|
||||||
} else if (element.parent().hasClass('multi-input')) {
|
} else if (element.parent().hasClass('multi-input')) {
|
||||||
error.insertAfter(element.closest('.multi-input'));
|
error.insertAfter(element.closest('.multi-input'));
|
||||||
} else if(element.hasClass('summer_note')){
|
} else if (element.hasClass('summer_note')) {
|
||||||
error.insertAfter(element.next('.note-editor'));
|
error.insertAfter(element.next('.note-editor'));
|
||||||
} else if(element.hasClass('custom-control-input')) {
|
} else if (element.hasClass('custom-control-input')) {
|
||||||
error.insertAfter(element.parent().parent().parent());
|
error.insertAfter(element.parent().parent().parent());
|
||||||
} else if(element.hasClass('star_rating')) {
|
} else if (element.hasClass('star_rating')) {
|
||||||
error.insertAfter(element.parent().parent());
|
error.insertAfter(element.parent().parent());
|
||||||
} else if (element.hasClass('switch')) {
|
} else if (element.hasClass('switch')) {
|
||||||
error.insertAfter(element.parent().parent());
|
error.insertAfter(element.parent().parent());
|
||||||
@@ -125,52 +140,57 @@
|
|||||||
error.insertAfter(element);
|
error.insertAfter(element);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
invalidHandler: function() {
|
invalidHandler: function () {
|
||||||
toastr.error("{{ __('messages.some_error_in_input_field') }}");
|
toastr.error("{{ __('messages.some_error_in_input_field') }}");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function () {
|
||||||
@if(!$is_download)
|
@if(!$is_download)
|
||||||
jQuery.extend($.fn.dataTable.defaults, {
|
jQuery.extend($.fn.dataTable.defaults, {
|
||||||
fixedHeader: false,
|
fixedHeader: false,
|
||||||
aLengthMenu: [
|
aLengthMenu: [
|
||||||
[25, 50, 100, 200, 500, 1000, -1], [25, 50, 100, 200, 500, 1000, "{{__('messages.all')}}"]
|
[25, 50, 100, 200, 500, 1000, -1], [25, 50, 100, 200, 500, 1000, "{{__('messages.all')}}"]
|
||||||
],
|
],
|
||||||
iDisplayLength: 25,
|
iDisplayLength: 25,
|
||||||
dom: 'lfrtip',
|
dom: 'lfrtip',
|
||||||
"language": {
|
"language": {
|
||||||
"emptyTable": "{{__('messages.emptyTable')}}",
|
"emptyTable": "{{__('messages.emptyTable')}}",
|
||||||
"info": "{{__('messages.dt_info')}}",
|
"info": "{{__('messages.dt_info')}}",
|
||||||
"infoEmpty": "{{__('messages.infoEmpty')}}",
|
"infoEmpty": "{{__('messages.infoEmpty')}}",
|
||||||
"infoFiltered": "{{__('messages.infoFiltered')}}",
|
"infoFiltered": "{{__('messages.infoFiltered')}}",
|
||||||
"lengthMenu": "{{__('messages.lengthMenu')}}",
|
"lengthMenu": "{{__('messages.lengthMenu')}}",
|
||||||
"loadingRecords": "{{__('messages.loadingRecords')}}",
|
"loadingRecords": "{{__('messages.loadingRecords')}}",
|
||||||
"processing": "{{__('messages.processing')}}",
|
"processing": "{{__('messages.processing')}}",
|
||||||
"search": "{{__('messages.search')}}",
|
"search": "{{__('messages.search')}}",
|
||||||
"zeroRecords": "{{__('messages.zeroRecords')}}",
|
"zeroRecords": "{{__('messages.zeroRecords')}}",
|
||||||
"paginate": {
|
"paginate": {
|
||||||
"first": "{{__('messages.first')}}",
|
"first": "{{__('messages.first')}}",
|
||||||
"last": "{{__('messages.last')}}",
|
"last": "{{__('messages.last')}}",
|
||||||
"next": "{{__('messages.next')}}",
|
"next": "{{__('messages.next')}}",
|
||||||
"previous": "{{__('messages.previous')}}"
|
"previous": "{{__('messages.previous')}}"
|
||||||
},
|
},
|
||||||
buttons: {
|
buttons: {
|
||||||
copyTitle: "{{__('messages.copy_to_clipboard')}}",
|
copyTitle: "{{__('messages.copy_to_clipboard')}}",
|
||||||
copySuccess: {
|
copySuccess: {
|
||||||
_: "{{__('messages.copied_n_rows_to_clipboard')}}"
|
_: "{{__('messages.copied_n_rows_to_clipboard')}}"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }
|
headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}
|
||||||
});
|
});
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
$('button[type=reset]').on('click', function () {
|
||||||
|
$(this).parents('form').find('input').val('');
|
||||||
|
window.location.href = $(this).parents('form').attr('action');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function initialize_datetimepicker(element_name, start_date, end_date, date_format, time_format, disabled_days, enable_time_picker, time_picker_inline){
|
function initialize_datetimepicker(element_name, element_date, start_date, end_date, date_format, time_format, disabled_days, enable_time_picker, time_picker_inline) {
|
||||||
var start = null;
|
var start = null;
|
||||||
var end = null;
|
var end = null;
|
||||||
var format = '';
|
var format = '';
|
||||||
@@ -215,7 +235,7 @@
|
|||||||
end = moment().endOf('month');
|
end = moment().endOf('month');
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#'+element_name).datetimepicker({
|
$('#' + element_name).datetimepicker({
|
||||||
icons: {
|
icons: {
|
||||||
time: 'far fa-clock',
|
time: 'far fa-clock',
|
||||||
},
|
},
|
||||||
@@ -226,24 +246,25 @@
|
|||||||
showClear: true,
|
showClear: true,
|
||||||
ignoreReadonly: true,
|
ignoreReadonly: true,
|
||||||
sideBySide: side_by_side,
|
sideBySide: side_by_side,
|
||||||
defaultDate: $("input#"+element_name).data("defaultdate")
|
defaultDate: element_date.length ? moment(element_date, format) : ''
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize_rangeslider(element_name) {
|
function initialize_rangeslider(element_name) {
|
||||||
$('#'+element_name).rangeslider({
|
$('#' + element_name).rangeslider({
|
||||||
polyfill: false,
|
polyfill: false,
|
||||||
//Callback function
|
//Callback function
|
||||||
onInit: function() {
|
onInit: function () {
|
||||||
},
|
},
|
||||||
// Callback function
|
// Callback function
|
||||||
onSlide: function(position, value) {
|
onSlide: function (position, value) {
|
||||||
$('.'+element_name).text(value);
|
$('.' + element_name).text(value);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Dropzone.autoDiscover = false;
|
Dropzone.autoDiscover = false;
|
||||||
|
|
||||||
function initialize_dropzone(element_name, file_upload_msg, no_of_files_can_be_uploaded, max_file_size, allowed_file_type, url = null) {
|
function initialize_dropzone(element_name, file_upload_msg, no_of_files_can_be_uploaded, max_file_size, allowed_file_type, url = null) {
|
||||||
|
|
||||||
var file_remove_url = "library/delete_file.php";
|
var file_remove_url = "library/delete_file.php";
|
||||||
@@ -254,11 +275,11 @@
|
|||||||
|
|
||||||
var file_names = [];
|
var file_names = [];
|
||||||
|
|
||||||
if ($('input#'+element_name).val().length > 0) {
|
if ($('input#' + element_name).val().length > 0) {
|
||||||
file_names.push($('input#'+element_name).val());
|
file_names.push($('input#' + element_name).val());
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#'+element_name).dropzone({
|
$('#' + element_name).dropzone({
|
||||||
paramName: "file",
|
paramName: "file",
|
||||||
addRemoveLinks: true,
|
addRemoveLinks: true,
|
||||||
url: url,
|
url: url,
|
||||||
@@ -266,23 +287,23 @@
|
|||||||
dictDefaultMessage: file_upload_msg,
|
dictDefaultMessage: file_upload_msg,
|
||||||
maxFiles: no_of_files_can_be_uploaded,
|
maxFiles: no_of_files_can_be_uploaded,
|
||||||
headers: {
|
headers: {
|
||||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||||
},
|
},
|
||||||
acceptedFiles: allowed_file_type,
|
acceptedFiles: allowed_file_type,
|
||||||
init: function() {
|
init: function () {
|
||||||
//function to be use on editing a form, to display existing files
|
//function to be use on editing a form, to display existing files
|
||||||
if ($('input#'+element_name).val().length > 0) {
|
if ($('input#' + element_name).val().length > 0) {
|
||||||
window[`${element_name}_myDropzone`] = this;
|
window[`${element_name}_myDropzone`] = this;
|
||||||
var file_obj = { files : $('input#'+element_name).val()};
|
var file_obj = {files: $('input#' + element_name).val()};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: '/existing-file-display',
|
url: '/existing-file-display',
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: file_obj,
|
data: file_obj,
|
||||||
success: function(result){
|
success: function (result) {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
$.each(result.files, function(key,file) {
|
$.each(result.files, function (key, file) {
|
||||||
var mockFile = { name: file.name, uploaded_as: file.uploaded_as, size: file.size};
|
var mockFile = {name: file.name, uploaded_as: file.uploaded_as, size: file.size};
|
||||||
window[`${element_name}_myDropzone`].emit("addedfile", mockFile);
|
window[`${element_name}_myDropzone`].emit("addedfile", mockFile);
|
||||||
window[`${element_name}_myDropzone`].emit("thumbnail", mockFile, file.path);
|
window[`${element_name}_myDropzone`].emit("thumbnail", mockFile, file.path);
|
||||||
window[`${element_name}_myDropzone`].emit("complete", mockFile);
|
window[`${element_name}_myDropzone`].emit("complete", mockFile);
|
||||||
@@ -293,35 +314,35 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//function to be use on removeing a file
|
//function to be use on removeing a file
|
||||||
this.on("removedfile", function(file) {
|
this.on("removedfile", function (file) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: file_remove_url,
|
url: file_remove_url,
|
||||||
data: { "file_name": file.uploaded_as },
|
data: {"file_name": file.uploaded_as},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
success: function(result) {
|
success: function (result) {
|
||||||
if (typeof(result) == 'string') {
|
if (typeof (result) == 'string') {
|
||||||
var result = JSON.parse(result);
|
var result = JSON.parse(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result.success == 1){
|
if (result.success == 1) {
|
||||||
toastr.success(result.msg);
|
toastr.success(result.msg);
|
||||||
var index = file_names.indexOf(file.uploaded_as);
|
var index = file_names.indexOf(file.uploaded_as);
|
||||||
|
|
||||||
if(index!=-1){
|
if (index != -1) {
|
||||||
file_names.splice(index, 1);
|
file_names.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var elementVal = $('input#'+element_name).val();
|
var elementVal = $('input#' + element_name).val();
|
||||||
var oldVal = elementVal.split(",");
|
var oldVal = elementVal.split(",");
|
||||||
|
|
||||||
index = oldVal.indexOf(file.uploaded_as);
|
index = oldVal.indexOf(file.uploaded_as);
|
||||||
|
|
||||||
if(index!=-1){
|
if (index != -1) {
|
||||||
oldVal.splice(index, 1);
|
oldVal.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var newVal = oldVal.join(",");
|
var newVal = oldVal.join(",");
|
||||||
$('input#'+element_name).val(newVal);
|
$('input#' + element_name).val(newVal);
|
||||||
} else {
|
} else {
|
||||||
toastr.error(result.msg);
|
toastr.error(result.msg);
|
||||||
}
|
}
|
||||||
@@ -329,15 +350,15 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
success:function(file, response) {
|
success: function (file, response) {
|
||||||
if (typeof(response) == 'string') {
|
if (typeof (response) == 'string') {
|
||||||
var response = JSON.parse(response);
|
var response = JSON.parse(response);
|
||||||
}
|
}
|
||||||
if (response.success == true) {
|
if (response.success == true) {
|
||||||
toastr.success(response.msg);
|
toastr.success(response.msg);
|
||||||
file_names.push(response.path);
|
file_names.push(response.path);
|
||||||
file.uploaded_as = response.path;
|
file.uploaded_as = response.path;
|
||||||
$('input#'+element_name).val(file_names); //store file_names
|
$('input#' + element_name).val(file_names); //store file_names
|
||||||
} else {
|
} else {
|
||||||
toastr.error(response.msg);
|
toastr.error(response.msg);
|
||||||
}
|
}
|
||||||
@@ -347,14 +368,14 @@
|
|||||||
|
|
||||||
function initialize_text_editor(element_name, placeholder, height) {
|
function initialize_text_editor(element_name, placeholder, height) {
|
||||||
|
|
||||||
$('#'+element_name).summernote({
|
$('#' + element_name).summernote({
|
||||||
placeholder: placeholder,
|
placeholder: placeholder,
|
||||||
height: height
|
height: height
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize_star_rating(element_name) {
|
function initialize_star_rating(element_name) {
|
||||||
$("#"+element_name).rating({
|
$("#" + element_name).rating({
|
||||||
theme: 'krajee-fas',
|
theme: 'krajee-fas',
|
||||||
filledStar: '<i class="fas fa-star"></i>',
|
filledStar: '<i class="fas fa-star"></i>',
|
||||||
emptyStar: '<i class="fas fa-star"></i>'
|
emptyStar: '<i class="fas fa-star"></i>'
|
||||||
@@ -388,58 +409,58 @@
|
|||||||
var signaturePad = element;
|
var signaturePad = element;
|
||||||
var canvas = document.getElementById(element);
|
var canvas = document.getElementById(element);
|
||||||
signaturePad = new SignaturePad(canvas, {
|
signaturePad = new SignaturePad(canvas, {
|
||||||
onEnd: function(event) {
|
onEnd: function (event) {
|
||||||
var element = $(this)[0]._canvas.id
|
var element = $(this)[0]._canvas.id
|
||||||
var signature = $(this)[0].toDataURL();
|
var signature = $(this)[0].toDataURL();
|
||||||
$('#output_'+element).val(signature);
|
$('#output_' + element).val(signature);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($('#output_'+element).val().length > 0) {
|
if ($('#output_' + element).val().length > 0) {
|
||||||
|
|
||||||
signaturePad.fromDataURL($('#output_'+element).val());
|
signaturePad.fromDataURL($('#output_' + element).val());
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('click', '#clear_'+element, function() {
|
$(document).on('click', '#clear_' + element, function () {
|
||||||
signaturePad.clear();
|
signaturePad.clear();
|
||||||
$('#output_'+$(this).data('name')).val('');
|
$('#output_' + $(this).data('name')).val('');
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '#undo_'+element, function() {
|
$(document).on('click', '#undo_' + element, function () {
|
||||||
var data = signaturePad.toData();
|
var data = signaturePad.toData();
|
||||||
if (data) {
|
if (data) {
|
||||||
data.pop(); // remove the last dot or line
|
data.pop(); // remove the last dot or line
|
||||||
signaturePad.fromData(data); //draw signature from array of data
|
signaturePad.fromData(data); //draw signature from array of data
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
var signature = signaturePad.toDataURL();
|
var signature = signaturePad.toDataURL();
|
||||||
$('#output_'+$(this).data('name')).val(signature);
|
$('#output_' + $(this).data('name')).val(signature);
|
||||||
} else {
|
} else {
|
||||||
$('#output_'+$(this).data('name')).val('');
|
$('#output_' + $(this).data('name')).val('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initializeToastrSettingsForForm (position) {
|
function initializeToastrSettingsForForm(position) {
|
||||||
var toastr_position = 'toast-top-right';
|
var toastr_position = 'toast-top-right';
|
||||||
if (position) {
|
if (position) {
|
||||||
toastr_position = position;
|
toastr_position = position;
|
||||||
}
|
}
|
||||||
toastr.options = {
|
toastr.options = {
|
||||||
"positionClass": toastr_position
|
"positionClass": toastr_position
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize_countdowntimer(element) {
|
function initialize_countdowntimer(element) {
|
||||||
$("#"+element.name).countdowntimer({
|
$("#" + element.name).countdowntimer({
|
||||||
hours: element.hours,
|
hours: element.hours,
|
||||||
minutes: element.minutes,
|
minutes: element.minutes,
|
||||||
seconds: element.seconds,
|
seconds: element.seconds,
|
||||||
size : element.size,
|
size: element.size,
|
||||||
labelsFormat : element.labels_format,
|
labelsFormat: element.labels_format,
|
||||||
borderColor : element.border_color,
|
borderColor: element.border_color,
|
||||||
fontColor: element.font_color,
|
fontColor: element.font_color,
|
||||||
backgroundColor : element.bg_color,
|
backgroundColor: element.bg_color,
|
||||||
timeSeparator: element.time_separator,
|
timeSeparator: element.time_separator,
|
||||||
displayFormat: element.display_format
|
displayFormat: element.display_format
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,18 +2,18 @@
|
|||||||
<nav class="main-header navbar navbar-expand navbar-light @guest navbar-laravel @else navbar-white @endguest">
|
<nav class="main-header navbar navbar-expand navbar-light @guest navbar-laravel @else navbar-white @endguest">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@auth
|
@auth
|
||||||
<a href="{{action([\App\Http\Controllers\HomeController::class, 'index'])}}" class="navbar-brand">
|
<a href="{{action([\App\Http\Controllers\HomeController::class, 'index'])}}" class="navbar-brand">
|
||||||
<!-- <img src="dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
|
<!-- <img src="dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
|
||||||
style="opacity: .8"> -->
|
style="opacity: .8"> -->
|
||||||
<span class="brand-text font-weight-light">{{ config('app.name', 'Laravel') }}</span>
|
<span class="brand-text font-weight-light">{{ config('app.name', 'Laravel') }}</span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
<li class="nav-item d-none d-sm-inline-block">
|
<li class="nav-item d-none d-sm-inline-block">
|
||||||
<a class="nav-link" href="{{ action([\App\Http\Controllers\HomeController::class, 'index']) }}">
|
<a class="nav-link" href="{{ action([\App\Http\Controllers\HomeController::class, 'index']) }}">
|
||||||
<i class="fas fa-home"></i>
|
<i class="fas fa-home"></i>
|
||||||
{{ __('messages.home') }}</a>
|
{{ __('messages.home') }}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@endauth
|
@endauth
|
||||||
|
|
||||||
<!-- Right Side Of Navbar -->
|
<!-- Right Side Of Navbar -->
|
||||||
@@ -30,37 +30,42 @@
|
|||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
<!-- superadmin menu -->
|
<!-- superadmin menu -->
|
||||||
@php
|
@if(auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value, \App\Enums\User\RoleEnum::ADMIN->value], 'web'))
|
||||||
$superadmin_emails = env('SUPERADMIN_EMAILS');
|
|
||||||
$email_array = explode(',', $superadmin_emails);
|
|
||||||
@endphp
|
|
||||||
@if(in_array(Auth::user()->email, $email_array))
|
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a id="superadminDropdown" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link dropdown-toggle">
|
<a id="superadminDropdown" href="#" data-toggle="dropdown" aria-haspopup="true"
|
||||||
|
aria-expanded="false" class="nav-link dropdown-toggle">
|
||||||
<i class="fas fa-universal-access"></i>
|
<i class="fas fa-universal-access"></i>
|
||||||
@lang('messages.superadmin')
|
@lang('messages.' . auth()->user()->roles->first()->name)
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<ul aria-labelledby="superadminDropdown" class="dropdown-menu border-0 shadow">
|
<ul aria-labelledby="superadminDropdown" class="dropdown-menu border-0 shadow">
|
||||||
<li>
|
<li>
|
||||||
@if($__enable_saas)
|
@if($__enable_saas)
|
||||||
<a href="{{action([\App\Http\Controllers\Superadmin\PackageController::class, 'index'])}}" class="dropdown-item">
|
<a href="{{action([\App\Http\Controllers\Superadmin\PackageController::class, 'index'])}}"
|
||||||
|
class="dropdown-item">
|
||||||
<i class="fas fa-money-check"></i>
|
<i class="fas fa-money-check"></i>
|
||||||
@lang('messages.packages')
|
@lang('messages.packages')
|
||||||
</a>
|
</a>
|
||||||
<a href="{{action([\App\Http\Controllers\Superadmin\PackageSubscriptionsController::class, 'index'])}}" class="dropdown-item">
|
<a href="{{action([\App\Http\Controllers\Superadmin\PackageSubscriptionsController::class, 'index'])}}"
|
||||||
|
class="dropdown-item">
|
||||||
<i class="fas fa-sync"></i>
|
<i class="fas fa-sync"></i>
|
||||||
@lang('messages.package_subscription')
|
@lang('messages.package_subscription')
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
<a href="{{action([\App\Http\Controllers\Superadmin\ManageUsersController::class, 'index'])}}" class="dropdown-item">
|
|
||||||
|
<a href="{{action([\App\Http\Controllers\Superadmin\ManageUsersController::class, 'index'])}}"
|
||||||
|
class="dropdown-item">
|
||||||
<i class="fas fa-users"></i>
|
<i class="fas fa-users"></i>
|
||||||
@lang('messages.users')
|
@lang('messages.users')
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{{action([\App\Http\Controllers\Superadmin\SuperadminSettingsController::class, 'create'])}}">
|
|
||||||
<i class="fa fa-cogs"></i>
|
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
|
||||||
@lang('messages.system_settings')
|
<a class="dropdown-item"
|
||||||
</a>
|
href="{{action([\App\Http\Controllers\Superadmin\SuperadminSettingsController::class, 'create'])}}">
|
||||||
|
<i class="fa fa-cogs"></i>
|
||||||
|
@lang('messages.system_settings')
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
@@ -68,30 +73,34 @@
|
|||||||
<!-- /superadmin menu -->
|
<!-- /superadmin menu -->
|
||||||
|
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a id="navbarDropdown" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link dropdown-toggle">
|
<a id="navbarDropdown" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
|
||||||
|
class="nav-link dropdown-toggle">
|
||||||
<i class="fas fa-user-tie"></i>
|
<i class="fas fa-user-tie"></i>
|
||||||
{{ ucfirst(Auth::user()->name) }}
|
{{ ucfirst(Auth::user()->name) }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<ul aria-labelledby="navbarDropdown" class="dropdown-menu border-0 shadow">
|
<ul aria-labelledby="navbarDropdown" class="dropdown-menu border-0 shadow">
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="{{action([\App\Http\Controllers\ManageProfileController::class, 'getProfile'])}}">
|
<a class="dropdown-item"
|
||||||
|
href="{{action([\App\Http\Controllers\ManageProfileController::class, 'getProfile'])}}">
|
||||||
<i class="fas fa-user-edit"></i>
|
<i class="fas fa-user-edit"></i>
|
||||||
@lang('messages.profile')
|
@lang('messages.profile')
|
||||||
</a>
|
</a>
|
||||||
@if($__enable_saas)
|
@if($__enable_saas)
|
||||||
<a class="dropdown-item" href="{{action([\App\Http\Controllers\SubscriptionsController::class, 'index'])}}">
|
<a class="dropdown-item"
|
||||||
|
href="{{action([\App\Http\Controllers\SubscriptionsController::class, 'index'])}}">
|
||||||
<i class="fas fa-sync"></i>
|
<i class="fas fa-sync"></i>
|
||||||
@lang('messages.my_subscription')
|
@lang('messages.my_subscription')
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
<a class="dropdown-item" href="{{action([\App\Http\Controllers\ManageSettingsController::class, 'getSettings'])}}">
|
<a class="dropdown-item"
|
||||||
|
href="{{action([\App\Http\Controllers\ManageSettingsController::class, 'getSettings'])}}">
|
||||||
<i class="fas fa-user-cog"></i>
|
<i class="fas fa-user-cog"></i>
|
||||||
@lang('messages.my_settings')
|
@lang('messages.my_settings')
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item"
|
<a class="dropdown-item"
|
||||||
href="{{ route('logout') }}"
|
href="{{ route('logout') }}"
|
||||||
onclick="event.preventDefault();
|
onclick="event.preventDefault();
|
||||||
document.getElementById('logout-form').submit();">
|
document.getElementById('logout-form').submit();">
|
||||||
<i class="fas fa-sign-out-alt"></i>
|
<i class="fas fa-sign-out-alt"></i>
|
||||||
{{ __('Logout') }}
|
{{ __('Logout') }}
|
||||||
@@ -106,7 +115,7 @@
|
|||||||
@endguest
|
@endguest
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!-- Left navbar links -->
|
<!-- Left navbar links -->
|
||||||
<!-- <ul class="navbar-nav">
|
<!-- <ul class="navbar-nav">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<div class="modal-dialog modal-lg">
|
<div class="modal-dialog modal-lg">
|
||||||
<form id="add_user_form" action="{{action([\App\Http\Controllers\Superadmin\ManageUsersController::class, 'store'])}}" method="POST">
|
<form id="add_user_form"
|
||||||
|
action="{{action([\App\Http\Controllers\Superadmin\ManageUsersController::class, 'store'])}}" method="POST">
|
||||||
{{ csrf_field() }}
|
{{ csrf_field() }}
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input type="text" class="form-control"
|
<input type="text" class="form-control"
|
||||||
name="name" id="name" required>
|
name="name" id="name" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@@ -31,7 +32,7 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input type="email" class="form-control"
|
<input type="email" class="form-control"
|
||||||
name="email" id="email" required>
|
name="email" id="email" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,57 +45,61 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input type="password" class="form-control"
|
<input type="password" class="form-control"
|
||||||
name="password" id="password" required>
|
name="password" id="password" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-2">
|
||||||
<div class="form-group form-check">
|
<div class="form-group form-check">
|
||||||
<input type="checkbox" class="form-check-input" id="is_active" name="is_active" value="1" checked>
|
<input type="checkbox" class="form-check-input" id="is_active" name="is_active" value="1"
|
||||||
|
checked>
|
||||||
<label class="form-check-label" for="is_active">
|
<label class="form-check-label" for="is_active">
|
||||||
@lang('messages.is_active')
|
@lang('messages.is_active')
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.is_active_tooltip')"></i>
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
</label>
|
title="@lang('messages.is_active_tooltip')"></i>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group form-check">
|
|
||||||
<input type="checkbox" class="form-check-input" name="send_email" id="send_email" value="1">
|
|
||||||
<label class="form-check-label" for="send_email">
|
|
||||||
@lang('messages.send_email')
|
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.send_email_tooltip')"></i>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group form-check">
|
|
||||||
<input type="checkbox" class="form-check-input" name="can_create_form" id="can_create_form" value="1">
|
|
||||||
<label class="form-check-label" for="can_create_form">
|
|
||||||
@lang('messages.can_create_form')
|
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.can_create_form_tooltip')"></i>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4">
|
@if(auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value, \App\Enums\User\RoleEnum::ADMIN->value]))
|
||||||
<div class="form-group form-check">
|
<div class="col-md-2">
|
||||||
<input type="checkbox" class="form-check-input" name="show_form_response_user" id="show_form_response_user" value="1">
|
<div class="form-group form-check">
|
||||||
<label class="form-check-label" for="show_form_response_user">
|
<input type="checkbox" class="form-check-input" id="is_admin" name="is_admin">
|
||||||
@lang('messages.show_form_response_user')
|
<label class="form-check-label" for="is_admin">
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.show_form_response_user_tooltip')"></i>
|
@lang('messages.is_admin')
|
||||||
</label>
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.is_admin_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@endif
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group form-check">
|
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
|
||||||
<input type="checkbox" class="form-check-input" name="show_edit_buttons_form" id="show_edit_buttons_form" value="1">
|
<div class="col-md-4">
|
||||||
<label class="form-check-label" for="show_edit_buttons_form">
|
<div class="form-group form-check">
|
||||||
@lang('messages.show_edit_buttons_form')
|
<input type="checkbox" class="form-check-input" name="send_email" id="send_email"
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.show_edit_buttons_form_tooltip')"></i>
|
value="1">
|
||||||
</label>
|
<label class="form-check-label" for="send_email">
|
||||||
|
@lang('messages.send_email')
|
||||||
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.send_email_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-group form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" name="can_create_form"
|
||||||
|
id="can_create_form" value="1">
|
||||||
|
<label class="form-check-label" for="can_create_form">
|
||||||
|
@lang('messages.can_create_form')
|
||||||
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.can_create_form_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div class="card assign-form p-3">
|
<div class="card assign-form p-3">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -115,30 +120,40 @@
|
|||||||
</div>
|
</div>
|
||||||
<h5>@lang('messages.permission_for_forms'):</h5>
|
<h5>@lang('messages.permission_for_forms'):</h5>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
|
||||||
<div class="form-group form-check">
|
<div class="col-md-4">
|
||||||
<input type="checkbox" class="form-check-input" name="permissions[]" id="form_design" value="can_design_form">
|
<div class="form-group form-check">
|
||||||
<label class="form-check-label" for="form_design">
|
<input type="checkbox" class="form-check-input" name="permissions[]"
|
||||||
@lang('messages.can_design_form')
|
id="form_design"
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.can_design_form_tooltip')"></i>
|
value="can_design_form">
|
||||||
</label>
|
<label class="form-check-label" for="form_design">
|
||||||
|
@lang('messages.can_design_form')
|
||||||
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.can_design_form_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@endif
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group form-check">
|
<div class="form-group form-check">
|
||||||
<input type="checkbox" class="form-check-input" name="permissions[]" id="form_data" value="can_view_data">
|
<input type="checkbox" class="form-check-input" name="permissions[]" id="form_data"
|
||||||
|
value="can_view_data">
|
||||||
<label class="form-check-label" for="form_data">
|
<label class="form-check-label" for="form_data">
|
||||||
@lang('messages.can_view_data')
|
@lang('messages.can_view_data')
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.can_view_data_tooltip')"></i>
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.can_view_data_tooltip')"></i>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<div class="form-group form-check">
|
<div class="form-group form-check">
|
||||||
<input type="checkbox" class="form-check-input" name="permissions[]" id="form_view" value="can_view_form">
|
<input type="checkbox" class="form-check-input" name="permissions[]" id="form_view"
|
||||||
|
value="can_view_form">
|
||||||
<label class="form-check-label" for="form_view">
|
<label class="form-check-label" for="form_view">
|
||||||
@lang('messages.can_view_form')
|
@lang('messages.can_view_form')
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.can_view_form_tooltip')"></i>
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.can_view_form_tooltip')"></i>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<div class="modal-dialog modal-lg">
|
<div class="modal-dialog modal-lg">
|
||||||
<form id="edit_user_form" action="{{action([\App\Http\Controllers\Superadmin\ManageUsersController::class, 'update'], [$user->id])}}" method="PUT">
|
<form id="edit_user_form"
|
||||||
|
action="{{action([\App\Http\Controllers\Superadmin\ManageUsersController::class, 'update'], [$user->id])}}"
|
||||||
|
method="PUT">
|
||||||
{{ csrf_field() }}
|
{{ csrf_field() }}
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@@ -21,7 +23,7 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input type="text" class="form-control"
|
<input type="text" class="form-control"
|
||||||
name="name" id="name" value="{{$user->name}}" required>
|
name="name" id="name" value="{{$user->name}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@@ -32,7 +34,7 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input type="email" class="form-control"
|
<input type="email" class="form-control"
|
||||||
name="email" id="email" value="{{$user->email}}" required>
|
name="email" id="email" value="{{$user->email}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -43,7 +45,7 @@
|
|||||||
@lang('messages.password')
|
@lang('messages.password')
|
||||||
</label>
|
</label>
|
||||||
<input type="password" class="form-control"
|
<input type="password" class="form-control"
|
||||||
name="password" id="password" aria-describedby="passwordHelp">
|
name="password" id="password" aria-describedby="passwordHelp">
|
||||||
<small id="passwordHelp" class="form-text text-muted">
|
<small id="passwordHelp" class="form-text text-muted">
|
||||||
@lang('messages.dont_want_to_change_keep_it_blank')
|
@lang('messages.dont_want_to_change_keep_it_blank')
|
||||||
</small>
|
</small>
|
||||||
@@ -51,166 +53,189 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-2">
|
||||||
<div class="form-group form-check">
|
<div class="form-group form-check">
|
||||||
<input type="checkbox" class="form-check-input" id="is_active" name="is_active" value="1" @if($user->is_active) checked @endif>
|
<input type="checkbox" class="form-check-input" id="is_active" name="is_active" value="1"
|
||||||
|
@if($user->is_active) checked @endif>
|
||||||
<label class="form-check-label" for="is_active">
|
<label class="form-check-label" for="is_active">
|
||||||
@lang('messages.is_active')
|
@lang('messages.is_active')
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.is_active_tooltip')"></i>
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
</label>
|
title="@lang('messages.is_active_tooltip')"></i>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group form-check">
|
|
||||||
<input type="checkbox" class="form-check-input" name="send_email" id="send_email" value="1">
|
|
||||||
<label class="form-check-label" for="send_email">
|
|
||||||
@lang('messages.send_email')
|
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.send_email_tooltip')"></i>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group form-check">
|
|
||||||
<input type="checkbox" class="form-check-input" name="can_create_form" id="can_create_form" value="1" @if($user->can_create_form) checked @endif>
|
|
||||||
<label class="form-check-label" for="can_create_form">
|
|
||||||
@lang('messages.can_create_form')
|
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.can_create_form_tooltip')"></i>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4">
|
@if(auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value, \App\Enums\User\RoleEnum::ADMIN->value], 'web'))
|
||||||
<div class="form-group form-check">
|
<div class="col-md-2">
|
||||||
<input type="checkbox" class="form-check-input" name="show_form_response_user" id="show_form_response_user" value="1" @if($user->show_form_response_user) checked @endif>
|
<div class="form-group form-check">
|
||||||
<label class="form-check-label" for="show_form_response_user">
|
<input type="checkbox" class="form-check-input" id="is_admin" name="is_admin"
|
||||||
@lang('messages.show_form_response_user')
|
@if($user->hasRole(\App\Enums\User\RoleEnum::ADMIN->value)) checked @endif>
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.show_form_response_user_tooltip')"></i>
|
<label class="form-check-label" for="is_admin">
|
||||||
|
@lang('messages.is_admin')
|
||||||
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.is_admin_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-group form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" name="send_email" id="send_email"
|
||||||
|
value="1">
|
||||||
|
<label class="form-check-label" for="send_email">
|
||||||
|
@lang('messages.send_email')
|
||||||
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.send_email_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-group form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" name="can_create_form"
|
||||||
|
id="can_create_form" value="1" @if($user->can_create_form) checked @endif>
|
||||||
|
<label class="form-check-label" for="can_create_form">
|
||||||
|
@lang('messages.can_create_form')
|
||||||
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.can_create_form_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@php
|
||||||
|
$form_ids = $assigned_forms->pluck('form_id')->toArray();
|
||||||
|
@endphp
|
||||||
|
@if($assigned_forms->count() > 0)
|
||||||
|
<h5>@lang('messages.assigned_forms'):</h5>
|
||||||
|
@foreach($assigned_forms as $key => $assigned_form)
|
||||||
|
<div class="card edit-assigned-form mb-4 p-3">
|
||||||
|
<label>
|
||||||
|
<i class="fab fa-wpforms"></i>
|
||||||
|
{{$assigned_form->form->name}}
|
||||||
</label>
|
</label>
|
||||||
|
<div class="row">
|
||||||
|
<input type="hidden" name="edit_assigned_form_id[]" value="{{$assigned_form->id}}">
|
||||||
|
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-group form-check">
|
||||||
|
<input type="checkbox" class="form-check-input"
|
||||||
|
name="edit_permissions[{{$assigned_form->id}}][]"
|
||||||
|
id="form_design_{{$key}}" value="can_design_form"
|
||||||
|
@if(in_array('can_design_form', $assigned_form->permissions))
|
||||||
|
checked
|
||||||
|
@endif>
|
||||||
|
<label class="form-check-label" for="form_design_{{$key}}">
|
||||||
|
@lang('messages.can_design_form')
|
||||||
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.can_design_form_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-group form-check">
|
||||||
|
<input type="checkbox" class="form-check-input"
|
||||||
|
name="edit_permissions[{{$assigned_form->id}}][]"
|
||||||
|
id="form_data_{{$key}}" value="can_view_data"
|
||||||
|
@if(in_array('can_view_data', $assigned_form->permissions))
|
||||||
|
checked
|
||||||
|
@endif>
|
||||||
|
<label class="form-check-label" for="form_data_{{$key}}">
|
||||||
|
@lang('messages.can_view_data')
|
||||||
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.can_view_data_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-group form-check">
|
||||||
|
<input type="checkbox" class="form-check-input"
|
||||||
|
name="edit_permissions[{{$assigned_form->id}}][]"
|
||||||
|
id="can_view_form_{{$key}}" value="can_view_form"
|
||||||
|
@if(in_array('can_view_form', $assigned_form->permissions))
|
||||||
|
checked
|
||||||
|
@endif>
|
||||||
|
<label class="form-check-label" for="can_view_form_{{$key}}">
|
||||||
|
@lang('messages.can_view_form')
|
||||||
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.can_view_form_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
<div class="card assign-form p-3">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="assign_form">
|
||||||
|
@lang('messages.assign_forms'):
|
||||||
|
</label>
|
||||||
|
<select multiple class="form-control" id="assign_form" name="form_id[]">
|
||||||
|
@foreach($forms as $key => $value)
|
||||||
|
@if(!in_array($key, $form_ids))
|
||||||
|
<option value="{{$key}}">
|
||||||
|
{{$value}}
|
||||||
|
</option>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<h5>@lang('messages.permission_for_forms'):</h5>
|
||||||
<div class="form-group form-check">
|
<div class="row">
|
||||||
<input type="checkbox" class="form-check-input" name="show_edit_buttons_form" id="show_edit_buttons_form" value="1" @if($user->show_edit_buttons_form) checked @endif>
|
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
|
||||||
<label class="form-check-label" for="show_edit_buttons_form">
|
<div class="col-md-4">
|
||||||
@lang('messages.show_edit_buttons_form')
|
<div class="form-group form-check">
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.show_edit_buttons_form_tooltip')"></i>
|
<input type="checkbox" class="form-check-input" name="permissions[]"
|
||||||
</label>
|
id="form_design" value="can_design_form">
|
||||||
|
<label class="form-check-label" for="form_design">
|
||||||
|
@lang('messages.can_design_form')
|
||||||
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.can_design_form_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-group form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" name="permissions[]" id="form_data"
|
||||||
|
value="can_view_data">
|
||||||
|
<label class="form-check-label" for="form_data">
|
||||||
|
@lang('messages.can_view_data')
|
||||||
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.can_view_data_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-group form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" name="permissions[]" id="form_view"
|
||||||
|
value="can_view_form">
|
||||||
|
<label class="form-check-label" for="form_view">
|
||||||
|
@lang('messages.can_view_form')
|
||||||
|
<i class="fas fa-info-circle text-info" data-toggle="tooltip"
|
||||||
|
title="@lang('messages.can_view_form_tooltip')"></i>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if(auth()->user()->id != $user->id)
|
<div class="modal-footer">
|
||||||
@php
|
<button type="submit" class="btn btn-sm btn-primary submit_btn">
|
||||||
$form_ids = $assigned_forms->pluck('form_id')->toArray();
|
@lang('messages.update')
|
||||||
@endphp
|
</button>
|
||||||
@if($assigned_forms->count() > 0)
|
<button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">
|
||||||
<h5>@lang('messages.assigned_forms'):</h5>
|
@lang('messages.close')
|
||||||
@foreach($assigned_forms as $key => $assigned_form)
|
</button>
|
||||||
<div class="card edit-assigned-form mb-4 p-3">
|
</div>
|
||||||
<label>
|
|
||||||
<i class="fab fa-wpforms"></i>
|
|
||||||
{{$assigned_form->form->name}}
|
|
||||||
</label>
|
|
||||||
<div class="row">
|
|
||||||
<input type="hidden" name="edit_assigned_form_id[]" value="{{$assigned_form->id}}">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group form-check">
|
|
||||||
<input type="checkbox" class="form-check-input" name="edit_permissions[{{$assigned_form->id}}][]" id="form_design_{{$key}}" value="can_design_form"
|
|
||||||
@if(in_array('can_design_form', $assigned_form->permissions))
|
|
||||||
checked
|
|
||||||
@endif>
|
|
||||||
<label class="form-check-label" for="form_design_{{$key}}">
|
|
||||||
@lang('messages.can_design_form')
|
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.can_design_form_tooltip')"></i>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group form-check">
|
|
||||||
<input type="checkbox" class="form-check-input" name="edit_permissions[{{$assigned_form->id}}][]" id="form_data_{{$key}}" value="can_view_data"
|
|
||||||
@if(in_array('can_view_data', $assigned_form->permissions))
|
|
||||||
checked
|
|
||||||
@endif>
|
|
||||||
<label class="form-check-label" for="form_data_{{$key}}">
|
|
||||||
@lang('messages.can_view_data')
|
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.can_view_data_tooltip')"></i>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group form-check">
|
|
||||||
<input type="checkbox" class="form-check-input" name="edit_permissions[{{$assigned_form->id}}][]" id="can_view_form_{{$key}}" value="can_view_form"
|
|
||||||
@if(in_array('can_view_form', $assigned_form->permissions))
|
|
||||||
checked
|
|
||||||
@endif>
|
|
||||||
<label class="form-check-label" for="can_view_form_{{$key}}">
|
|
||||||
@lang('messages.can_view_form')
|
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.can_view_form_tooltip')"></i>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
@endif
|
|
||||||
<div class="card assign-form p-3">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="assign_form">
|
|
||||||
@lang('messages.assign_forms'):
|
|
||||||
</label>
|
|
||||||
<select multiple class="form-control" id="assign_form" name="form_id[]">
|
|
||||||
@foreach($forms as $key => $value)
|
|
||||||
@if(!in_array($key, $form_ids))
|
|
||||||
<option value="{{$key}}">
|
|
||||||
{{$value}}
|
|
||||||
</option>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<h5>@lang('messages.permission_for_forms'):</h5>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group form-check">
|
|
||||||
<input type="checkbox" class="form-check-input" name="permissions[]" id="form_design" value="can_design_form">
|
|
||||||
<label class="form-check-label" for="form_design">
|
|
||||||
@lang('messages.can_design_form')
|
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.can_design_form_tooltip')"></i>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group form-check">
|
|
||||||
<input type="checkbox" class="form-check-input" name="permissions[]" id="form_data" value="can_view_data">
|
|
||||||
<label class="form-check-label" for="form_data">
|
|
||||||
@lang('messages.can_view_data')
|
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.can_view_data_tooltip')"></i>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group form-check">
|
|
||||||
<input type="checkbox" class="form-check-input" name="permissions[]" id="form_view" value="can_view_form">
|
|
||||||
<label class="form-check-label" for="form_view">
|
|
||||||
@lang('messages.can_view_form')
|
|
||||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.can_view_form_tooltip')"></i>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary submit_btn">
|
|
||||||
@lang('messages.update')
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">
|
|
||||||
@lang('messages.close')
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -60,7 +60,6 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<div id="export-btns" class="float-right"></div>
|
|
||||||
<table class="table" id="users_table">
|
<table class="table" id="users_table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -117,7 +116,7 @@
|
|||||||
title: '{{config("app.name") ."-". __("messages.all_users")}}'
|
title: '{{config("app.name") ."-". __("messages.all_users")}}'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
dom: 'lBfrtip',
|
dom: 'lfrtip',
|
||||||
fixedHeader: false,
|
fixedHeader: false,
|
||||||
columns: [
|
columns: [
|
||||||
{ data: 'name' , name: 'name'},
|
{ data: 'name' , name: 'name'},
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ Route::middleware(['IsInstalled', 'auth', 'bootstrap', 'setDefaultConfig'])->gro
|
|||||||
Route::get('/get-acelle-list-info', [FormController::class, 'getAcelleMailListInfo']);
|
Route::get('/get-acelle-list-info', [FormController::class, 'getAcelleMailListInfo']);
|
||||||
Route::get('/form/{id}/get-collaborate', [FormController::class, 'getCollab']);
|
Route::get('/form/{id}/get-collaborate', [FormController::class, 'getCollab']);
|
||||||
Route::post('/form/post-collaborate', [FormController::class, 'postCollab']);
|
Route::post('/form/post-collaborate', [FormController::class, 'postCollab']);
|
||||||
Route::get('/edit/{slug}/data/{id}', [FormDataController::class, 'getEditformData']);
|
Route::get('/edit/{slug}/data/{id}', [FormDataController::class, 'getEditformData'])->name('form-data.edit');
|
||||||
Route::post('/update/{slug}/data/{id}', [FormDataController::class, 'postEditformData']);
|
Route::post('/update/{slug}/data/{id}', [FormDataController::class, 'postEditformData']);
|
||||||
Route::get('/form-data/{id}', [FormDataController::class, 'show']);
|
Route::get('/form-data/{id}', [FormDataController::class, 'show'])->name('form-data.show');
|
||||||
Route::get('/form-data-view/{id}', [FormDataController::class, 'viewData']);
|
Route::get('/form-data-view/{id}', [FormDataController::class, 'viewData']);
|
||||||
Route::get('/download/{id}/pdf', [FormDataController::class, 'downloadPdf']);
|
Route::get('/download/{id}/pdf', [FormDataController::class, 'downloadPdf']);
|
||||||
Route::delete('/form-data-destroy/{id}', [FormDataController::class, 'destroy']);
|
Route::delete('/form-data-destroy/{id}', [FormDataController::class, 'destroy']);
|
||||||
|
|||||||
Reference in New Issue
Block a user