Compare commits

...

11 Commits

Author SHA1 Message Date
decoder
157a5a1939 fix lang bug 2024-04-26 20:45:01 +05:00
decoder
a46ec03369 Merge branch 'Lang_function_update' of https://git.softuniq.eu/NW/Aknaproff into Lang_function_update 2024-04-25 23:40:56 +05:00
decoder
3485957da4 fix lang bug 2024-04-25 23:40:12 +05:00
decoder
2d0d36af7e fix lang bug 2024-04-25 23:29:44 +05:00
NW
262b8003f4 env insert 2024-03-20 17:19:44 +00:00
decoder
d8a271adb4 fix bug in auth 2024-03-19 11:00:29 +05:00
decoder
cf7c57228a change table struct 2024-03-18 19:33:31 +05:00
decoder
4cb505276f add locale middleware 2024-03-17 17:40:23 +05:00
decoder
c5295f0fee add locale middleware 2024-03-13 10:31:30 +05:00
decoder
fd9dc5d545 added translate for form name 2024-03-06 23:11:10 +05:00
decoder
c18c2d0f32 Lang function update 2024-03-04 09:33:00 +05:00
22 changed files with 2571 additions and 1578 deletions

87
.env Normal file
View File

@ -0,0 +1,87 @@
APP_NAME="AKNAPROFF"
APP_ENV="live"
APP_KEY=base64:dvbkNw1BmEGND2DRWIauV7ub306TMEiPws0A9yOhiMU=
APP_DEBUG=true
APP_URL=https://uniquesoft.es
APP_LOCALE="en"
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST="smtp.mailtrap.io"
MAIL_PORT="2525"
MAIL_USERNAME="hello@example.com"
MAIL_PASSWORD="12345"
MAIL_ENCRYPTION="TLS/SSL"
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="Example"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
ENVATO_PURCHASE_CODE="780fc1cd-62c9-4b1f-8798-7f4f6f7048ef"
SUPERADMIN_EMAILS=admin@admin.com
ENABLE_REGISTRATION="0"
CURRENCY_NAME="Euro"
CURRENCY_SYMBOL="€"
CURRENCY_CODE="EUR"
APP_TIMEZONE="Europe/Helsinki"
ENABLE_SAAS_MODULE="0"
PAYPAL_MODE="sandbox"
#PayPal Setting & API Credentials - sandbox
PAYPAL_SANDBOX_API_USERNAME=
PAYPAL_SANDBOX_API_PASSWORD=
PAYPAL_SANDBOX_API_SECRET=
PAYPAL_SANDBOX_API_CERTIFICATE=
#PayPal Setting & API Credentials - live
PAYPAL_LIVE_API_USERNAME=
PAYPAL_LIVE_API_PASSWORD=
PAYPAL_LIVE_API_SECRET=
PAYPAL_LIVE_API_CERTIFICATE=
#Stripe Payment Api & Credentials
STRIPE_PUB_KEY=
STRIPE_SECRET_KEY=
APP_DATE_FORMAT="d.m.Y"
APP_TIME_FORMAT="24"
DEBUGBAR_ENABLED=false
ENABLE_OFFLINE_PAYMENT="0"
ACELLE_MAIL_NAME=""
ACELLE_MAIL_API=""
APP_TITLE="Vormid"

View File

@ -16,6 +16,11 @@ use ZipArchive;
class FormController extends Controller
{
public function __construct() {
$this->middleware('auth');
}
/**
* Display a listing of the resource.
*
@ -191,7 +196,7 @@ class FormController extends Controller
public function update($id)
{
try {
$input = request()->only('name', 'description', 'slug');
$input = request()->only('name', 'name_ru', 'name_est', 'description', 'description_ru', 'description_est', 'slug');
$form_data = [
'form' => request()->input('form'),
'emailConfig' => request()->input('email_config'),
@ -201,6 +206,8 @@ class FormController extends Controller
'form_attributes' => request()->input('form_attributes'),
'contains_page_break' => request()->input('contains_page_break'),
];
// dd($form_data);
$is_template = request()->input('is_template');
$input['schema'] = $form_data;
@ -208,8 +215,12 @@ class FormController extends Controller
$form = Form::find($id);
$form->name = $input['name'];
$form->name_ru = $input['name_ru'];
$form->name_est = $input['name_est'];
$form->slug = $input['slug'];
$form->description = $input['description'];
$form->description_ru = $input['description_ru'];
$form->description_est = $input['description_est'];
$form->schema = $input['schema'];
$form->is_template = $is_template;
$form->mailchimp_details = request()->input('mailchimp_details');

View File

@ -183,7 +183,7 @@ class HomeController extends Controller
if (request()->ajax()) {
$user_id = request()->user()->id;
$forms = Form::select('name', 'description', 'id', 'slug', 'is_global_template')
$forms = Form::select('name', 'name_est', 'name_ru', 'description', 'description_ru', 'description_est', 'id', 'slug', 'is_global_template')
->where(function ($query) use ($user_id) {
$query->where('is_template', 1)
->where('created_by', $user_id)
@ -278,7 +278,7 @@ class HomeController extends Controller
$forms = UserForm::join('forms', 'user_forms.form_id', '=', 'forms.id')
->leftJoin('users', 'forms.created_by', '=', 'users.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.name_ru as name_ru', 'forms.name_est as name_est', 'forms.description as description', 'forms.description_ru as description_ru', 'forms.description_est as description_est', 'forms.id as form_id', 'forms.created_at as created_at', 'forms.slug as slug', 'users.name as created_by');
return DataTables::of($forms)
->addColumn(

View File

@ -0,0 +1,31 @@
<?php
namespace App\Http\Controllers;
use App\UserSetting;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Session;
class LocaleController extends Controller
{
public function __invoke($locale) {
if (! in_array($locale, ['en', 'ru', 'est'])) {
abort(400);
}
Session::put('locale', $locale);
app()->setLocale($locale);
$userSetting = UserSetting::where('user_id', auth()->user()->id)->first();
if (!empty($userSetting)) {
$userSetting->update([
'language' => $locale
]);
}
return redirect()->back();
}
}

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use App\UserSetting;
use DateTimeZone;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
class ManageSettingsController extends Controller
{
@ -57,6 +58,14 @@ class ManageSettingsController extends Controller
$setting = UserSetting::where('user_id', $input['user_id'])->first();
if (! in_array($request->language, ['en', 'ru', 'est'])) {
abort(400);
}
Session::put('locale', $request->language);
app()->setLocale($request->language);
if (empty($setting)) {
UserSetting::create($input);
} else {

View File

@ -64,5 +64,6 @@ class Kernel extends HttpKernel
'bootstrap' => \App\Http\Middleware\Callbacks::class,
'setDefaultConfig' => \App\Http\Middleware\SetDefaultConfigForUser::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'locale' => \App\Http\Middleware\LocaleMiddleware::class,
];
}

View File

@ -0,0 +1,37 @@
<?php
namespace App\Http\Middleware;
use App\UserSetting;
use Closure;
use Illuminate\Support\Facades\Session;
class LocaleMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (empty(Session::get('locale'))) {
$userSetting = UserSetting::where('user_id', auth()->user()->id)->first();
$locale = 'en';
if (!empty($userSetting)) {
if (!in_array($userSetting->language, ['en', 'ru', 'est'])) {
$locale = $userSetting->language;
}
}
Session::put('locale', $locale);
app()->setLocale($locale);
}
return $next($request);
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->string('name_ru')->after('name')->nullable();
$table->string('name_est')->after('name_ru')->nullable();
$table->string('description_ru')->after('description')->nullable();
$table->string('description_est')->after('description_ru')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('forms', function (Blueprint $table) {
//
});
}
};

View File

@ -81,8 +81,8 @@ return [
'click_to_add_tags' => 'Click to add the tags',
'body' => 'Body',
'email_body' => 'Email Body',
'auto_response_settings' => 'Auto Response Settings',
'enable_auto_response' => 'Enable Auto Response?',
'auto_restonse_settings' => 'Auto Restonse Settings',
'enable_auto_restonse' => 'Enable Auto Restonse?',
'smtp_settings' => 'SMTP Settings',
'use_system_smtp' => 'Use System SMTP?',
'host' => 'Host',
@ -425,7 +425,7 @@ return [
'tour_step_2_intro' => '<b class="text-success">Step 2:</b></br> Drop the element here & click it to configure.',
'tour_step_3_intro' => '<b class="text-success">Step 3:</b></br> Form & Element configuration will appear here.',
'tour_step_4_intro' => '<b class="text-success">Step 4:</b></br> Add conditions to show/hide element based on other element values.',
'tour_step_5_intro' => '<b class="text-success">Step 5:</b></br> Configure receiving of submission email & auto-respond email to the user.',
'tour_step_5_intro' => '<b class="text-success">Step 5:</b></br> Configure receiving of submission email & auto-restond email to the user.',
'tour_step_6_intro' => '<b class="text-success">Step 6:</b></br> Configure form reCaptcha, design, notifications, scheduling, submission reference number & others.',
'tour_step_7_intro' => '<b class="text-success">Step 7:</b></br> Integrate mailchimp.',
'tour_step_8_intro' => '<b class="text-success">Step 8:</b></br> Add additional Js/css in the form.',
@ -451,7 +451,7 @@ return [
'field_name_should_nt_have_space' => 'Field name should not have space',
'duplicate_field_name_choose_unique' => 'Duplicate field name, choose unique name',
'field_dont_have_name_property' => ":input field don't have name property",
'field_contain_space' => ':input field contain whitespace in name',
'field_contain_space' => ':input field contain whitestace in name',
'field_contain_duplicate_field_name' => ':input field contain duplicate name',
'key' => 'Key',
'add_form_custom_attribute' => 'Add form custom attribute',
@ -677,4 +677,16 @@ return [
'error_msg_for_not_allowed_value' => 'Error message for not allowed value',
'enter_allowed_value_per_line' => 'Enter one allowed value per line.',
'values_allowed_tooltip' => 'Values provided here will only be allowed while submitting the form, keep it empty to allow all values',
'field_label_est' => 'Field Label in est',
'field_label_ru' => 'Field Label in Ru',
'content_est' => 'Content in est',
'content_ru' => 'Content in Ru',
'placeholder_est' => 'Placeholder in est',
'placeholder_ru' => 'Placeholder in Ru',
'options_est' => 'Options in est',
'options_ru' => 'Options in Ru',
'form_name_est' => 'Form Name est',
'form_name_ru' => 'Form Name ru',
'form_description_est' => 'Form Description est',
'form_description_ru' => 'Form Description ru',
];

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "uniquesoft.es",
"name": "Aknaproff",
"lockfileVersion": 3,
"requires": true,
"packages": {

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,26 @@
v-model="element.label">
</div>
<div class="form-group"
v-if="!_.includes(['heading', 'hr', 'html_text'], element.type)">
<label>
{{trans('messages.field_label_est')}}
<span class="error">*</span>
</label>
<input type="text" class="form-control form-control-sm"
v-model="element.label_est">
</div>
<div class="form-group"
v-if="!_.includes(['heading', 'hr', 'html_text'], element.type)">
<label>
{{trans('messages.field_label_ru')}}
<span class="error">*</span>
</label>
<input type="text" class="form-control form-control-sm"
v-model="element.label_ru">
</div>
<div class="form-group">
<label>
{{trans('messages.field_name')}}
@ -88,7 +108,6 @@
:element="element">
</pdf-uploader>
</div>
<!-- countdown -->
<div v-if="_.includes(['countdown'], element.type)">
<div class="mb-1">
@ -275,6 +294,20 @@
<input type="text" class="form-control form-control-sm"
v-model="element.placeholder">
</div>
<div class="form-group"
v-if="_.includes(['text', 'textarea', 'text_editor'], element.type)">
<label>{{trans('messages.placeholder_est')}}</label>
<input type="text" class="form-control form-control-sm"
v-model="element.placeholder_est">
</div>
<div class="form-group"
v-if="_.includes(['text', 'textarea', 'text_editor'], element.type)">
<label>{{trans('messages.placeholder_ru')}}</label>
<input type="text" class="form-control form-control-sm"
v-model="element.placeholder_ru">
</div>
<div class="form-group"
v-if="!_.includes(['heading', 'terms_and_condition', 'hr', 'html_text', 'rating', 'youtube', 'iframe', 'pdf', 'countdown'], element.type)">
@ -622,6 +655,26 @@
</small>
</div>
<div class="form-group"
v-if="_.includes(['radio', 'checkbox', 'dropdown'], element.type)">
<label>{{trans('messages.options_est')}}</label>
<textarea class="form-control form-control-sm"
v-model="element.options_est"></textarea>
<small class="form-text">
{{trans('messages.enter_one_option_per_line')}}
</small>
</div>
<div class="form-group"
v-if="_.includes(['radio', 'checkbox', 'dropdown'], element.type)">
<label>{{trans('messages.options_ru')}}</label>
<textarea class="form-control form-control-sm"
v-model="element.options_ru"></textarea>
<small class="form-text">
{{trans('messages.enter_one_option_per_line')}}
</small>
</div>
<div class="row mb-1"
v-if="_.includes(['radio', 'checkbox'], element.type)">
<div class="col-md-12">
@ -686,6 +739,20 @@
v-model="element.content"></textarea>
</div>
<div class="form-group"
v-if="_.includes(['heading'], element.type)">
<label>{{trans('messages.content_est')}}</label>
<textarea class="form-control form-control-sm"
v-model="element.content_est"></textarea>
</div>
<div class="form-group"
v-if="_.includes(['heading'], element.type)">
<label>{{trans('messages.content_ru')}}</label>
<textarea class="form-control form-control-sm"
v-model="element.content_ru"></textarea>
</div>
<div class="form-group"
v-if="_.includes(['heading'], element.type)">
<label for="heading_text_color">

View File

@ -8,7 +8,7 @@
<i class="fas fa-sort handle pointer font_icon_size float-left mr-3" :class="[display_handler]"
:title="trans('messages.drag_element_using_icon')"></i>
<span :style="{'color': settings.color.label}">
{{ element.label }}
{{ form_trans_label(element, 'label') }}
</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
<i class="fas fa-info-circle cursor-pointer modal_trigger"
@ -24,7 +24,7 @@
</div>
<input :type="element.subtype" class="form-control"
:name="element.name"
:placeholder="element.placeholder"
:placeholder="form_trans_label(element, 'placeholder')"
:class="[element.size, element.custom_class, element.conditional_class]"
:required="element.required && applyValidations"
v-bind="getDynamicallyGeneratedAttributeObj(element.validations, element.custom_attributes)"
@ -54,7 +54,7 @@
<i class="fas fa-sort handle pointer font_icon_size float-left mr-3" :class="[display_handler]"
:title="trans('messages.drag_element_using_icon')"></i>
<span :style="{'color': settings.color.label}">
{{ element.label }}
{{ form_trans_label(element, 'label') }}
</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
<i class="fas fa-info-circle cursor-pointer modal_trigger"
@ -98,7 +98,7 @@
<i class="fas fa-sort handle pointer font_icon_size float-left mr-3" :class="[display_handler]"
:title="trans('messages.drag_element_using_icon')"></i>
<span :style="{'color': settings.color.label}">
{{ element.label }}
{{ form_trans_label(element, 'label') }}
</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
<i class="fas fa-info-circle cursor-pointer modal_trigger"
@ -155,7 +155,7 @@
<i class="fas fa-sort handle pointer font_icon_size float-left mr-3" :class="[display_handler]"
:title="trans('messages.drag_element_using_icon')"></i>
<span :style="{'color': settings.color.label}">
{{ element.label }}
{{ form_trans_label(element, 'label') }}
</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
<i class="fas fa-info-circle cursor-pointer modal_trigger"
@ -175,7 +175,7 @@
:name="element.name"
:id="element.name"
:cols="element.columns"
:placeholder="element.placeholder"
:placeholder="form_trans_label(element, 'placeholder')"
:class="[element.custom_class, element.conditional_class]"
:required="element.required && applyValidations"
v-bind="getDynamicallyGeneratedAttributeObj(element.validations, element.custom_attributes)"
@ -204,7 +204,7 @@
<label :for="element.name">
<i class="fas fa-sort handle pointer font_icon_size float-left mr-3" :class="[display_handler]"
:title="trans('messages.drag_element_using_icon')"></i>
<span :style="{'color': settings.color.label}">{{ element.label }}</span>
<span :style="{'color': settings.color.label}">{{ form_trans_label(element, 'label') }} </span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
<i class="fas fa-info-circle cursor-pointer modal_trigger"
v-if="!_.isUndefined(element.popover_help_text) && element.popover_help_text.enable"
@ -213,7 +213,7 @@
</label>
<div class="row">
<div :class="[spreadColumnForElement(element)]"
v-for="(option, index) in element.options.split('\n')">
v-for="(option, index) in form_trans_label(element, 'options').split('\n')">
<div class="custom-control" :class="[element.type == 'radio' ? 'custom-radio' : 'custom-checkbox']">
<input class="custom-control-input"
:type="element.type"
@ -248,7 +248,7 @@
<label :for="element.name">
<i class="fas fa-sort handle pointer font_icon_size float-left mr-3" :class="[display_handler]"
:title="trans('messages.drag_element_using_icon')"></i>
<span :style="{'color': settings.color.label}">{{ element.label }}</span>
<span :style="{'color': settings.color.label}">{{ form_trans_label(element, 'label') }}</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
<i class="fas fa-info-circle cursor-pointer modal_trigger"
v-if="!_.isUndefined(element.popover_help_text) && element.popover_help_text.enable"
@ -270,7 +270,7 @@
@change="$emit('apply_conditions')"
:data-msg-required="element.required_error_msg"
>
<option v-for="option in element.options.split('\n')"
<option v-for="option in form_trans_label(element, 'options').split('\n')"
:selected="_.includes(_.get(submitted_data, element.name, ''), option)"
>
{{ option }}
@ -297,7 +297,7 @@
<i class="fas fa-sort handle pointer font_icon_size float-left mr-3" :class="[display_handler]"
:title="trans('messages.drag_element_using_icon')"></i>
<div
v-html="'<' + element.tag + ' style=color:' + element.text_color + '>' + element.content + '</' + element.tag + '>'"
v-html="'<' + element.tag + ' style=color:' + element.text_color + '>' + form_trans_label(element, 'content') + '</' + element.tag + '>'"
:class="[element.custom_class]">
</div>
</div>
@ -308,7 +308,7 @@
<label :for="element.name">
<i class="fas fa-sort handle pointer font_icon_size float-left mr-3" :class="[display_handler]"
:title="trans('messages.drag_element_using_icon')"></i>
<span :style="{'color': settings.color.label}">{{ element.label }}</span>
<span :style="{'color': settings.color.label}">{{ form_trans_label(element, 'label') }}</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
<i class="fas fa-info-circle cursor-pointer modal_trigger"
v-if="!_.isUndefined(element.popover_help_text) && element.popover_help_text.enable"
@ -336,7 +336,7 @@
<label :for="element.name">
<i class="fas fa-sort handle pointer font_icon_size float-left mr-3" :class="[display_handler]"
:title="trans('messages.drag_element_using_icon')"></i>
<span :style="{'color': settings.color.label}">{{ element.label }}</span>
<span :style="{'color': settings.color.label}">{{ form_trans_label(element, 'label') }}</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
<i class="fas fa-info-circle cursor-pointer modal_trigger"
v-if="!_.isUndefined(element.popover_help_text) && element.popover_help_text.enable"
@ -375,9 +375,9 @@
>
<label class="custom-control-label" for="terms_and_condition">
<a :href="element.link" target="_blank" v-if="element.link">
{{ element.label }}
{{ form_trans_label(element, 'label') }}
</a>
<span v-else>{{ element.label }}</span>
<span v-else>{{ form_trans_label(element, 'label') }}</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
<i class="fas fa-info-circle cursor-pointer modal_trigger"
v-if="!_.isUndefined(element.popover_help_text) && element.popover_help_text.enable"
@ -412,7 +412,7 @@
<label :for="element.name">
<i class="fas fa-sort handle pointer font_icon_size float-left mr-3" :class="[display_handler]"
:title="trans('messages.drag_element_using_icon')"></i>
<span :style="{'color': settings.color.label}">{{ element.label }}</span>
<span :style="{'color': settings.color.label}">{{ form_trans_label(element, 'label') }}</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
<i class="fas fa-info-circle cursor-pointer modal_trigger"
v-if="!_.isUndefined(element.popover_help_text) && element.popover_help_text.enable"
@ -451,7 +451,7 @@
>
<label :for="element.name">
<span :style="{'color': settings.color.label}" class="ml-2">
{{ element.label }}
{{ form_trans_label(element, 'label') }}
</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
<i class="fas fa-info-circle cursor-pointer modal_trigger"
@ -476,7 +476,7 @@
:title="trans('messages.drag_element_using_icon')"></i>
<label :for="element.name">
<span :style="{'color': settings.color.label}" class="ml-2">
{{ element.label }}
{{ form_trans_label(element, 'label') }}
</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
<i class="fas fa-info-circle cursor-pointer modal_trigger"
@ -535,7 +535,7 @@
:title="trans('messages.drag_element_using_icon')"></i>
<label :for="element.name">
<span :style="{'color': settings.color.label}" class="ml-2">
{{ element.label }}
{{ form_trans_label(element, 'label') }}
</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
</label>
@ -563,7 +563,7 @@
:title="trans('messages.drag_element_using_icon')"></i>
<label :for="element.name">
<span :style="{'color': settings.color.label}" class="ml-2">
{{ element.label }}
{{ form_trans_label(element, 'label') }}
</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
</label>
@ -588,7 +588,7 @@
:title="trans('messages.drag_element_using_icon')"></i>
<label :for="element.name">
<span :style="{'color': settings.color.label}" class="ml-2">
{{ element.label }}
{{ form_trans_label(element, 'label') }}
</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
</label>
@ -617,7 +617,7 @@
:title="trans('messages.drag_element_using_icon')"></i>
<label :for="element.name">
<span :style="{'color': settings.color.label}" class="ml-2">
{{ element.label }}
{{ form_trans_label(element, 'label') }}
</span>
<span :style="{'color': settings.color.required_asterisk_color}" v-if="element.required">*</span>
</label>

File diff suppressed because it is too large Load Diff

View File

@ -508,6 +508,21 @@ export default {
initialize_countdowntimer(element);
}, 2000); //initialize after 2 sec
}
},
form_trans_label (data, key) {
const currLang = document.documentElement.lang
if (currLang === 'ru') {
if (data[`${key}_ru`] == '' || data[`${key}_ru`] === undefined || data[`${key}_ru`] === null) {
return data[key];
}
return data[`${key}_ru`]
} else if (currLang === 'est') {
if (data[`${key}_est`] == '' || data[`${key}_est`] === undefined || data[`${key}_est`] === null) {
return data[key];
}
return data[`${key}_est`]
}
return data[key];
}
},
};

View File

@ -8,7 +8,6 @@
$additional_js = $form->schema['additional_js_css']['js'];
$page_color = $form->schema['settings']['color']['page_color'] ?? '#f4f6f9';
@endphp
<div class="@if(!empty($iframe_enabled) && $iframe_enabled) container-fluid @else container @endif">
<div class="row justify-content-center">
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">

View File

@ -16,7 +16,8 @@
visibility: hidden;
}
#printSection, #printSection * {
#printSection,
#printSection * {
visibility: visible;
}
@ -40,7 +41,7 @@
$date_format = config('constants.APP_DATE_FORMAT');
if (config('constants.APP_TIME_FORMAT') == '12') {
$date_format .= ' h:i A';
} else if (config('constants.APP_TIME_FORMAT') == '24') {
} elseif (config('constants.APP_TIME_FORMAT') == '24') {
$date_format .= ' H:i';
} else {
$date_format = 'm/d/Y h:i A';
@ -48,16 +49,18 @@
@endphp
<div class="card">
<div class="card-header">
{{$form->name}}
{{ $form->name }}
</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() }}">
<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() }}">
<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">
@ -67,13 +70,16 @@
@php
$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']
) {
$is_enabled_sub_ref_no = true;
}
@endphp
<div class="tab-content card-body table-responsive" role="tabpanel">
@if(!empty($form->schema))
@if (!empty($form->schema))
@php
$schema = $form->schema['form'];
$col_visible = $form['schema']['settings']['form_data']['col_visible'];
@ -81,101 +87,108 @@
@endphp
<table class="table" id="submitted_data_table" style="width: 100%;">
<thead>
<tr>
@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)
<th>@lang('messages.submission_numbering')</th>
@endif
<th>@lang('messages.username')</th>
@foreach($schema as $element)
@if(in_array($element['name'], $col_visible))
<th>
{{$element['label']}}
</th>
<tr>
@if (auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value, \App\Enums\User\RoleEnum::ADMIN->value], 'web'))
<th>@lang('messages.action')</th>
@endif
@endforeach
<th>@lang('messages.submitted_on')</th>
</tr>
@if ($is_enabled_sub_ref_no)
<th>@lang('messages.submission_numbering')</th>
@endif
<th>@lang('messages.username')</th>
@foreach ($schema as $element)
@if (in_array($element['name'], $col_visible))
<th>
{{-- $element['label'] --}}
@if (in_array(session()->get('locale'), ['ru', 'est']) && isset($element['label_' . session()->get('locale')]))
{{ $element['label_' . session()->get('locale')] }}
@else
{{ $element['label'] }}
@endif
</th>
@endif
@endforeach
<th>@lang('messages.submitted_on')</th>
</tr>
</thead>
<tbody>
@foreach($data as $k => $row)
<tr>
@if(auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value, \App\Enums\User\RoleEnum::ADMIN->value], 'web'))
<td>
@if(in_array('view', $btn_enabled))
<button type="button" class="btn btn-info btn-sm view_form_data m-1"
data-href="{{action([\App\Http\Controllers\FormDataController::class, 'viewData'], [$row->id])}}"
data-toggle="modal">
<i class="fa fa-eye" aria-hidden="true"></i>
@lang('messages.view')
</button>
@endif
@if(in_array('delete', $btn_enabled))
<button type="button"
class="btn btn-danger btn-sm delete_form_data m-1"
data-href="{{action([\App\Http\Controllers\FormDataController::class, 'destroy'], [$row->id])}}">
<i class="fa fa-trash" aria-hidden="true"></i>
@lang('messages.delete')
</button>
@endif
@php
$form_id = !empty($form->slug) ? $form->slug : $form->id;
@endphp
<a class="btn btn-dark btn-sm m-1"
href="{{action([\App\Http\Controllers\FormDataController::class, 'getEditformData'], ['slug' => $form_id,'id' => $row->id])}}">
<i class="far fa-edit" aria-hidden="true"></i>
@lang('messages.edit')
</a>
</td>
@endif
@if($is_enabled_sub_ref_no)
<td>
{{$row['submission_ref']}}
</td>
@endif
<td>{{ $row->submittedBy?->name }}</td>
@foreach($schema as $row_element)
@if(in_array($row_element['name'], $col_visible))
@foreach ($data as $k => $row)
<tr>
@if (auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value, \App\Enums\User\RoleEnum::ADMIN->value], 'web'))
<td>
@isset($row->data[$row_element['name']])
@if($row_element['type'] == 'file_upload')
@include('form_data.file_view', ['form_upload' => $row->data[$row_element['name']]])
@elseif($row_element['type'] == 'signature')
@if(!empty($row->data[$row_element['name']]))
<a target="_blank"
href="{{$row->data[$row_element['name']]}}"
download="Signature">
<img src="{{$row->data[$row_element['name']]}}"
class="signature">
</a>
@endif
@elseif(is_array($row->data[$row_element['name']]) && $row_element['type'] != 'file_upload')
{{implode(', ', $row->data[$row_element['name']])}}
@else
{!! nl2br($row->data[$row_element['name']]) !!}
@endif
@endisset
@if (in_array('view', $btn_enabled))
<button type="button"
class="btn btn-info btn-sm view_form_data m-1"
data-href="{{ action([\App\Http\Controllers\FormDataController::class, 'viewData'], [$row->id]) }}"
data-toggle="modal">
<i class="fa fa-eye" aria-hidden="true"></i>
@lang('messages.view')
</button>
@endif
@if (in_array('delete', $btn_enabled))
<button type="button"
class="btn btn-danger btn-sm delete_form_data m-1"
data-href="{{ action([\App\Http\Controllers\FormDataController::class, 'destroy'], [$row->id]) }}">
<i class="fa fa-trash" aria-hidden="true"></i>
@lang('messages.delete')
</button>
@endif
@php
$form_id = !empty($form->slug) ? $form->slug : $form->id;
@endphp
<a class="btn btn-dark btn-sm m-1"
href="{{ action([\App\Http\Controllers\FormDataController::class, 'getEditformData'], ['slug' => $form_id, 'id' => $row->id]) }}">
<i class="far fa-edit" aria-hidden="true"></i>
@lang('messages.edit')
</a>
</td>
@endif
@endforeach
<td>
{{\Carbon\Carbon::createFromTimestamp(strtotime($row->updated_at))->format($date_format)}}
<br/>
<small>
{{$row->updated_at->diffForHumans()}}
</small>
</td>
</tr>
@endforeach
@if ($is_enabled_sub_ref_no)
<td>
{{ $row['submission_ref'] }}
</td>
@endif
<td>{{ $row->submittedBy?->name }}</td>
@foreach ($schema as $row_element)
@if (in_array($row_element['name'], $col_visible))
<td>
@isset($row->data[$row_element['name']])
@if ($row_element['type'] == 'file_upload')
@include('form_data.file_view', [
'form_upload' =>
$row->data[$row_element['name']],
])
@elseif($row_element['type'] == 'signature')
@if (!empty($row->data[$row_element['name']]))
<a target="_blank"
href="{{ $row->data[$row_element['name']] }}"
download="Signature">
<img src="{{ $row->data[$row_element['name']] }}"
class="signature">
</a>
@endif
@elseif(is_array($row->data[$row_element['name']]) && $row_element['type'] != 'file_upload')
{{ implode(', ', $row->data[$row_element['name']]) }}
@else
{!! nl2br($row->data[$row_element['name']]) !!}
@endif
@endisset
</td>
@endif
@endforeach
<td>
{{ \Carbon\Carbon::createFromTimestamp(strtotime($row->updated_at))->format($date_format) }}
<br />
<small>
{{ $row->updated_at->diffForHumans() }}
</small>
</td>
</tr>
@endforeach
</tbody>
</table>
@else
@ -189,7 +202,7 @@
@endsection
@section('footer')
<script type="text/javascript">
$(document).ready(function () {
$(document).ready(function() {
$('#submitted_data_table').DataTable({
scrollY: "600px",
scrollX: true,
@ -200,20 +213,20 @@
}
});
// view form data
$(document).on('click', '.view_form_data', function () {
$(document).on('click', '.view_form_data', function() {
var url = $(this).data("href");
$.ajax({
method: "GET",
dataType: "html",
url: url,
success: function (result) {
success: function(result) {
$("#modal_div").html(result).modal("show");
}
});
});
//delete form data
$(document).on('click', '.delete_form_data', function () {
$(document).on('click', '.delete_form_data', function() {
var url = $(this).data("href");
var result = confirm('Are You Sure?');
if (result == true) {
@ -221,10 +234,10 @@
method: "DELETE",
url: url,
dataType: "json",
success: function (result) {
success: function(result) {
if (result.success == true) {
toastr.success(result.msg);
setTimeout(function () {
setTimeout(function() {
location.reload();
}, 1000);
} else {
@ -236,17 +249,17 @@
});
//print form data on btn click
$(document).on('click', '.formDataPrintBtn', function () {
$(document).on('click', '.formDataPrintBtn', function() {
printElement(document.getElementById("print_form_data"));
});
$("#modal_div").on('shown.bs.modal', function () {
$("#modal_div").on('shown.bs.modal', function() {
if ($("form#add_comment_form").length) {
$("form#add_comment_form").validate();
}
});
$(document).on('submit', 'form#add_comment_form', function (e) {
$(document).on('submit', 'form#add_comment_form', function(e) {
e.preventDefault();
var data = $("form#add_comment_form").serialize();
var url = $("form#add_comment_form").attr('action');
@ -257,7 +270,7 @@
url: url,
dataType: "json",
data: data,
success: function (response) {
success: function(response) {
ladda.stop();
if (response.success) {
$("#comment").val('');
@ -270,7 +283,7 @@
});
});
$(document).on('click', '.delete-comment', function (e) {
$(document).on('click', '.delete-comment', function(e) {
e.preventDefault();
var element = $(this);
var comment_id = $(this).data('comment_id');
@ -280,7 +293,7 @@
method: 'DELETE',
dataType: 'json',
url: '/form-data-comment/' + comment_id + '?form_data_id=' + form_data_id,
success: function (response) {
success: function(response) {
if (response.success) {
toastr.success(response.msg);
element.closest('.direct-chat-msg').remove();

View File

@ -2,12 +2,12 @@
<div class="modal-content" id="print_form_data">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">
{{ucFirst($form_data->form->name)}}
@if(!empty($form_data->submittedBy))
{{ ucFirst($form_data->form->name) }}
@if (!empty($form_data->submittedBy))
<small>
(
<b>@lang('messages.submitted_by'): </b>
{{$form_data->submittedBy->name}}
<b>@lang('messages.submitted_by'): </b>
{{ $form_data->submittedBy->name }}
)
</small>
@endif
@ -23,9 +23,11 @@
<div class="modal-body">
<div class="row mb-2">
<div class="col-md-6">
@if(isset($form_data->form->schema['settings']['form_submision_ref']['is_enabled']) && $form_data->form->schema['settings']['form_submision_ref']['is_enabled'] && !empty($form_data->submission_ref))
<b>@lang('messages.submission_numbering'):</b>
{{$form_data->submission_ref}}
@if (isset($form_data->form->schema['settings']['form_submision_ref']['is_enabled']) &&
$form_data->form->schema['settings']['form_submision_ref']['is_enabled'] &&
!empty($form_data->submission_ref))
<b>@lang('messages.submission_numbering'):</b>
{{ $form_data->submission_ref }}
@endif
</div>
</div>
@ -37,42 +39,49 @@
</tr>
</thead>
<tbody>
@foreach($form_data->form->schema['form'] as $element)
@foreach ($form_data->form->schema['form'] as $element)
@isset($form_data->data[$element['name']])
<tr>
<td>
<strong>{{$element['label']}}</strong>
</td>
<td>
@if($element['type'] == 'file_upload')
@include('form_data.file_view', ['form_upload' => $form_data->data[$element['name']]])
@elseif($element['type'] == 'signature')
@if(!empty($form_data->data[$element['name']]))
<a target="_blank" href="{{$form_data->data[$element['name']]}}"
download="Signature">
<img src="{{$form_data->data[$element['name']]}}" class="signature">
</a>
<tr>
<td>
<strong>
@if (in_array(session()->get('locale'), ['ru', 'est']) && isset($element['label_' . session()->get('locale')]))
{{ $element['label_' . session()->get('locale')] }}
@else
{{ $element['label'] }}
@endif
</strong>
</td>
<td>
@if ($element['type'] == 'file_upload')
@include('form_data.file_view', [
'form_upload' => $form_data->data[$element['name']],
])
@elseif($element['type'] == 'signature')
@if (!empty($form_data->data[$element['name']]))
<a target="_blank" href="{{ $form_data->data[$element['name']] }}"
download="Signature">
<img src="{{ $form_data->data[$element['name']] }}" class="signature">
</a>
@endif
@elseif(is_array($form_data->data[$element['name']]) && $element['type'] != 'file_upload')
{{ implode(', ', $form_data->data[$element['name']]) }}
@else
{!! nl2br($form_data->data[$element['name']]) !!}
@endif
@elseif(is_array($form_data->data[$element['name']]) && $element['type'] != 'file_upload')
{{implode(', ', $form_data->data[$element['name']])}}
@else
{!! nl2br($form_data->data[$element['name']]) !!}
@endif
</td>
</tr>
</td>
</tr>
@endisset
@endforeach
</tbody>
</table>
<div class="no-print mt-4">
<hr>
<form id="add_comment_form" action="{{action([\App\Http\Controllers\FormDataCommentController::class, 'store'])}}" method="POST">
<form id="add_comment_form"
action="{{ action([\App\Http\Controllers\FormDataCommentController::class, 'store']) }}"
method="POST">
{{ csrf_field() }}
<!-- hiden fields -->
<input type="hidden" name="form_data_id" id="form_data_id" value="{{$form_data->id}}">
<input type="hidden" name="form_data_id" id="form_data_id" value="{{ $form_data->id }}">
<div class="form-group">
<label for="comment">
@lang('messages.comment'):
@ -104,10 +113,11 @@
<i class="fas fa-print"></i>
@lang('messages.print')
</button>
<a class="btn float-right btn-primary btn-sm m-1" target="_blank" href="{{action([\App\Http\Controllers\FormDataController::class, 'downloadPdf'], [$form_data->id])}}">
<a class="btn float-right btn-primary btn-sm m-1" target="_blank"
href="{{ action([\App\Http\Controllers\FormDataController::class, 'downloadPdf'], [$form_data->id]) }}">
<i class="far fa-file-pdf" aria-hidden="true"></i>
@lang('messages.download_pdf')
</a>
</div>
</div>
</div>
</div>

View File

@ -8,7 +8,7 @@
@include('layouts/partials/status')
</div>
</div>
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
@if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
<div class="row mb-5">
<div class="col-12 col-sm-6 col-md-3">
<div class="info-box">
@ -16,20 +16,19 @@
<div class="info-box-content">
<span class="info-box-text">@lang('messages.forms')</span>
<span class="info-box-number">{{$form_count}}</span>
<span class="info-box-number">{{ $form_count }}</span>
</div>
</div>
</div>
@if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::ADMIN->value))
@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>
<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>
<span class="info-box-number">{{ $template_count }}</span>
</div>
</div>
</div>
@ -41,15 +40,14 @@
<div class="info-box-content">
<span class="info-box-text">@lang('messages.submissions')</span>
<span class="info-box-number">{{$submission_count}}</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">
<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>
@ -59,84 +57,76 @@
<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
@endif"
@if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form) nav-justified @endif"
id="custom-tabs-four-tab" role="tablist">
@if(auth()->user()->hasRole([\App\Enums\User\RoleEnum::SUPERVISOR->value]) || 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">
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))
@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')
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">
<a class="nav-link
@if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) && !auth()->user()->can_create_form)
active
@endif
" id="custome-tabs-shared-forms" data-toggle="pill"
href="#custome-tabs-shared-forms-assigned" role="tab"
aria-controls="custome-tabs-shared-forms-assigned"
@if(!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) && !auth()->user()->can_create_form)
aria-selected="true"
@endif>
<i class="fas fa-file-alt"
aria-hidden="true"></i> @lang('messages.assigned_forms')
@if (!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) && !auth()->user()->can_create_form) active @endif
"
id="custome-tabs-shared-forms" data-toggle="pill"
href="#custome-tabs-shared-forms-assigned" role="tab"
aria-controls="custome-tabs-shared-forms-assigned"
@if (!auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) && !auth()->user()->can_create_form) aria-selected="true" @endif>
<i class="fas fa-file-alt" aria-hidden="true"></i> @lang('messages.assigned_forms')
</a>
</li>
</ul>
</div>
<div class="card-body">
<div class="tab-content" id="custom-tabs-four-tabContent">
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
@if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value) || auth()->user()->can_create_form)
<div class="tab-pane fade active show" id="custome-tabs-forms" role="tabpanel"
aria-labelledby="custome-tabs-all-forms">
aria-labelledby="custome-tabs-all-forms">
<div class="table-responsive">
<table class="table" id="form_table" style="width: 100%;">
<thead>
<tr>
<th>@lang('messages.description')</th>
<th>@lang('messages.name')</th>
<th>@lang('messages.created_at')</th>
<th>@lang('messages.submissions')</th>
<th>@lang('messages.action')</th>
</tr>
<tr>
<th>@lang('messages.description')</th>
<th>@lang('messages.name')</th>
<th>@lang('messages.created_at')</th>
<th>@lang('messages.submissions')</th>
<th>@lang('messages.action')</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<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">
<table class="table" id="template_table" style="width: 100%;">
<thead>
<tr>
<th>@lang('messages.description')</th>
<th>@lang('messages.name')</th>
@if(auth()->user()->can('superadmin'))
<th>
@lang('messages.is_global_template')
<i class="fas fa-info-circle"
data-toggle="tooltip"
title="@lang('messages.is_global_template_tooltip')"></i>
</th>
@endif
<th>@lang('messages.action')</th>
</tr>
<tr>
<th>@lang('messages.description')</th>
<th>@lang('messages.name')</th>
@if (auth()->user()->can('superadmin'))
<th>
@lang('messages.is_global_template')
<i class="fas fa-info-circle" data-toggle="tooltip"
title="@lang('messages.is_global_template_tooltip')"></i>
</th>
@endif
<th>@lang('messages.action')</th>
</tr>
</thead>
<tbody></tbody>
</table>
@ -144,22 +134,22 @@
</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">
@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.description')</th>
<th>@lang('messages.name')</th>
@if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
<th>@lang('messages.created_by')</th>
@endif
<th>@lang('messages.action')</th>
</tr>
<tr>
<th>@lang('messages.description')</th>
<th>@lang('messages.name')</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>
<tbody></tbody>
</table>
@ -177,7 +167,21 @@
@section('footer')
<script type="text/javascript">
$(document).ready(function () {
$(document).ready(function() {
var lang = `{{ session()->get('locale') }}`
var titleColName = 'name';
if (lang === 'est') {
titleColName = 'name_est'
} else if (lang === 'ru') {
titleColName = 'name_ru'
}
var descColName = 'description';
if (lang === 'est') {
descColName = 'description_est'
} else if (lang === 'ru') {
descColName = 'description_ru'
}
// form dataTable
var form_table = $('#form_table').DataTable({
@ -187,20 +191,62 @@
buttons: [],
dom: 'lfrtip',
fixedHeader: false,
aaSorting: [[2, 'desc']],
"columnDefs": [
{"width": "22%", "targets": 0},
{"width": "40%", "targets": 1},
{"width": "15%", "targets": 2},
{"width": "3%", "targets": 3},
{"width": "20%", "targets": 4}
aaSorting: [
[1, 'desc']
],
columns: [
{data: 'name', name: 'name'},
{data: 'description', name: 'description'},
{data: 'created_at', name: 'created_at'},
{data: 'data_count', name: 'data_count', searchable: false},
{data: 'action', name: 'action', sortable: false}
"columnDefs": [{
"width": "22%",
"targets": 0
},
{
"width": "40%",
"targets": 1
},
{
"width": "15%",
"targets": 2
},
{
"width": "3%",
"targets": 3
},
{
"width": "20%",
"targets": 4
}
],
columns: [{
data: descColName,
name: descColName,
createdCell: function(td, cellData, rowData, row, col) {
if (td.innerHTML.length === 0) {
td.innerHTML = rowData.name
}
},
},
{
data: titleColName,
name: titleColName,
createdCell: function(td, cellData, rowData, row, col) {
if (td.innerHTML.length === 0) {
td.innerHTML = rowData.name
}
},
},
{
data: 'created_at',
name: 'created_at'
},
{
data: 'data_count',
name: 'data_count',
searchable: false
},
{
data: 'action',
name: 'action',
sortable: false
}
]
});
@ -212,22 +258,41 @@
buttons: [],
dom: 'lfrtip',
fixedHeader: false,
columns: [
{data: 'name', name: 'name'},
{data: 'description', name: 'description'},
@if(auth()->user()->can('superadmin'))
{
data: 'is_global_template', name: 'is_global_template', sortable: false, searchable: false
columns: [{
data: descColName,
name: descColName,
createdCell: function(td, cellData, rowData, row, col) {
if (td.innerHTML.length === 0) {
td.innerHTML = rowData.name
}
},
},
@endif
{
data: 'action', name: 'action', sortable: false
data: titleColName,
name: titleColName,
createdCell: function(td, cellData, rowData, row, col) {
if (td.innerHTML.length === 0) {
td.innerHTML = rowData.name
}
},
},
@if (auth()->user()->can('superadmin'))
{
data: 'is_global_template',
name: 'is_global_template',
sortable: false,
searchable: false
},
@endif {
data: 'action',
name: 'action',
sortable: false
}
]
});
//delete form
$(document).on('click', '.delete_form', function () {
$(document).on('click', '.delete_form', function() {
var url = $(this).data("href");
var result = confirm('Are You Sure?');
if (result == true) {
@ -235,7 +300,7 @@
method: "DELETE",
url: url,
dataType: "json",
success: function (result) {
success: function(result) {
if (result.success == true) {
toastr.success(result.msg);
form_table.ajax.reload();
@ -248,7 +313,7 @@
});
//delete template
$(document).on('click', '.delete_template', function () {
$(document).on('click', '.delete_template', function() {
var url = $(this).data("href");
var result = confirm('Are You Sure?');
if (result == true) {
@ -256,7 +321,7 @@
method: "DELETE",
url: url,
dataType: "json",
success: function (result) {
success: function(result) {
if (result.success == true) {
toastr.success(result.msg);
template_table.ajax.reload();
@ -269,39 +334,39 @@
});
// create form
$(document).on('click', '.createForm', function () {
$(document).on('click', '.createForm', function() {
var url = $(this).data('href');
$.ajax({
method: "GET",
url: url,
dataType: "html",
success: function (response) {
success: function(response) {
$("#modal_div").html(response).modal("show");
}
});
});
// create widget
$(document).on('click', '.generate_widget', function () {
$(document).on('click', '.generate_widget', function() {
var url = $(this).data('href');
$.ajax({
method: "GET",
url: url,
dataType: "html",
success: function (response) {
success: function(response) {
$("#modal_div").html(response).modal("show");
}
});
});
//copy form
$(document).on('click', '.copy_form', function () {
$(document).on('click', '.copy_form', function() {
var url = $(this).data('href');
$.ajax({
method: "GET",
url: url,
dataType: "html",
success: function (response) {
success: function(response) {
$("#modal_div").html(response).modal("show");
}
});
@ -315,49 +380,81 @@
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 }
aaSorting: [
[0, 'desc']
],
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'
"columnDefs": [{
"width": "25%",
"targets": 0
},
@endif
{
data: 'action', name: 'action', sortable: false
"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: descColName,
name: 'forms.' + descColName,
createdCell: function(td, cellData, rowData, row, col) {
if (td.innerHTML.length === 0) {
td.innerHTML = rowData.description
}
},
},
{
data: titleColName,
name: 'forms.' + titleColName,
createdCell: function(td, cellData, rowData, row, col) {
if (td.innerHTML.length === 0) {
td.innerHTML = rowData.name
}
},
},
@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 () {
$(document).on('click', '.collab_btn', function() {
var url = $(this).data('href');
$.ajax({
method: "GET",
url: url,
dataType: "html",
success: function (response) {
success: function(response) {
$("#collab_modal").html(response).modal("show");
}
});
});
$("#collab_modal").on('shown.bs.modal', function () {
$("#collab_modal").on('shown.bs.modal', function() {
if ($("#form_design").length) {
$(document).on('change', '#form_design', function () {
$(document).on('change', '#form_design', function() {
if ($("#form_design").is(":checked")) {
$("#form_view").attr('checked', true);
} else {
@ -367,7 +464,7 @@
}
});
$(document).on('submit', 'form#collaborate_form', function (e) {
$(document).on('submit', 'form#collaborate_form', function(e) {
e.preventDefault();
var data = $("form#collaborate_form").serialize();
var url = $("form#collaborate_form").attr('action');
@ -378,7 +475,7 @@
url: url,
dataType: "json",
data: data,
success: function (response) {
success: function(response) {
ladda.stop();
if (response.success) {
$("#collab_modal").modal('hide');
@ -390,7 +487,7 @@
});
});
$('a[data-toggle="pill"]').on('shown.bs.tab', function (e) {
$('a[data-toggle="pill"]').on('shown.bs.tab', function(e) {
var target = $(e.target).attr('href');
if (target == '#custome-tabs-forms') {
if (typeof form_table != 'undefined') {
@ -407,25 +504,25 @@
}
});
@if(auth()->user()->can('superadmin'))
$(document).on('click', '.toggle_global_template', function () {
$.ajax({
method: "POST",
url: "{{route('toggle.global.template')}}",
dataType: "json",
data: {
is_checked: $(this).is(":checked") ? 1 : 0,
form_id: $(this).data("form_id"),
},
success: function (response) {
if (response.success) {
template_table.ajax.reload();
} else {
toastr.error(response.msg);
@if (auth()->user()->can('superadmin'))
$(document).on('click', '.toggle_global_template', function() {
$.ajax({
method: "POST",
url: "{{ route('toggle.global.template') }}",
dataType: "json",
data: {
is_checked: $(this).is(":checked") ? 1 : 0,
form_id: $(this).data("form_id"),
},
success: function(response) {
if (response.success) {
template_table.ajax.reload();
} else {
toastr.error(response.msg);
}
}
}
});
});
});
@endif
});
</script>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<html lang="{{ str_replace('_', '-', session()->get('locale', 'en')) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -19,6 +19,33 @@
<!-- Right Side Of Navbar -->
<ul class="navbar-nav ml-auto">
<!-- Authentication Links -->
<li class="nav-item dropdown">
<a id="superadminDropdown" href="#" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false" class="nav-link dropdown-toggle">
{{str(session()->get('locale'))->upper()}}
</a>
<ul aria-labelledby="superadminDropdown" class="dropdown-menu border-0 shadow">
<li>
<a href="{{route('locale', 'en')}}"
class="dropdown-item @if (session()->get('locale') == 'en') active @endif">
English
</a>
</li>
<li>
<a href="{{route('locale', 'ru')}}"
class="dropdown-item @if (session()->get('locale') == 'ru') active @endif">
Русский
</a>
</li>
<li>
<a href="{{route('locale', 'est')}}"
class="dropdown-item @if (session()->get('locale') == 'est') active @endif">
Eesti keel
</a>
</li>
</ul>
</li>
@guest
<li class="nav-item d-none d-sm-inline-block">
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
@ -140,4 +167,4 @@
</div>
</nav>
<!-- /.navbar -->
<!-- /.navbar -->

View File

@ -4,6 +4,7 @@ use App\Http\Controllers\FormController;
use App\Http\Controllers\FormDataCommentController;
use App\Http\Controllers\FormDataController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\LocaleController;
use App\Http\Controllers\ManageProfileController;
use App\Http\Controllers\ManageSettingsController;
use App\Http\Controllers\RegistrationController;
@ -33,13 +34,15 @@ Route::get('/', function () {
return view('welcome');
});
Route::get('locale/{locale}', LocaleController::class)->name('locale');
Route::middleware(['IsInstalled'])->group(function () {
Auth::routes(['register' => env('ENABLE_REGISTRATION', false)]);
Route::post('registration', [RegistrationController::class, 'store']);
});
Route::middleware(['IsInstalled', 'auth', 'bootstrap', 'setDefaultConfig'])->group(function () {
Route::middleware(['IsInstalled', 'auth', 'bootstrap', 'setDefaultConfig', 'locale',])->group(function () {
Route::get('/home', [HomeController::class, 'index'])->name('home');
Route::get('/home-template', [HomeController::class, 'getTemplate']);
Route::get('/home-assigned-forms', [HomeController::class, 'getAssignedForms']);