change table struct
This commit is contained in:
@@ -191,7 +191,7 @@ class FormController extends Controller
|
|||||||
public function update($id)
|
public function update($id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$input = request()->only('name', 'name_ru', 'name_est', 'description', 'slug');
|
$input = request()->only('name', 'name_ru', 'name_est', 'description', 'description_ru', 'description_est', 'slug');
|
||||||
$form_data = [
|
$form_data = [
|
||||||
'form' => request()->input('form'),
|
'form' => request()->input('form'),
|
||||||
'emailConfig' => request()->input('email_config'),
|
'emailConfig' => request()->input('email_config'),
|
||||||
@@ -214,6 +214,8 @@ class FormController extends Controller
|
|||||||
$form->name_est = $input['name_est'];
|
$form->name_est = $input['name_est'];
|
||||||
$form->slug = $input['slug'];
|
$form->slug = $input['slug'];
|
||||||
$form->description = $input['description'];
|
$form->description = $input['description'];
|
||||||
|
$form->description_ru = $input['description_ru'];
|
||||||
|
$form->description_est = $input['description_est'];
|
||||||
$form->schema = $input['schema'];
|
$form->schema = $input['schema'];
|
||||||
$form->is_template = $is_template;
|
$form->is_template = $is_template;
|
||||||
$form->mailchimp_details = request()->input('mailchimp_details');
|
$form->mailchimp_details = request()->input('mailchimp_details');
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ class HomeController extends Controller
|
|||||||
if (request()->ajax()) {
|
if (request()->ajax()) {
|
||||||
$user_id = request()->user()->id;
|
$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) {
|
->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)
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ return new class extends Migration
|
|||||||
Schema::table('forms', function (Blueprint $table) {
|
Schema::table('forms', function (Blueprint $table) {
|
||||||
$table->string('name_ru')->after('name')->nullable();
|
$table->string('name_ru')->after('name')->nullable();
|
||||||
$table->string('name_est')->after('name_ru')->nullable();
|
$table->string('name_est')->after('name_ru')->nullable();
|
||||||
|
$table->string('description_ru')->after('description')->nullable();
|
||||||
|
$table->string('description_est')->after('description_ru')->nullable();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -687,4 +687,6 @@ return [
|
|||||||
'options_ru' => 'Options in Ru',
|
'options_ru' => 'Options in Ru',
|
||||||
'form_name_est' => 'Form Name est',
|
'form_name_est' => 'Form Name est',
|
||||||
'form_name_ru' => 'Form Name ru',
|
'form_name_ru' => 'Form Name ru',
|
||||||
|
'form_description_est' => 'Form Description est',
|
||||||
|
'form_description_ru' => 'Form Description ru',
|
||||||
];
|
];
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
|||||||
@include('layouts/partials/status')
|
@include('layouts/partials/status')
|
||||||
</div>
|
</div>
|
||||||
</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="row mb-5">
|
||||||
<div class="col-12 col-sm-6 col-md-3">
|
<div class="col-12 col-sm-6 col-md-3">
|
||||||
<div class="info-box">
|
<div class="info-box">
|
||||||
@@ -16,20 +16,19 @@
|
|||||||
|
|
||||||
<div class="info-box-content">
|
<div class="info-box-content">
|
||||||
<span class="info-box-text">@lang('messages.forms')</span>
|
<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>
|
</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="col-12 col-sm-6 col-md-3">
|
||||||
<div class="info-box">
|
<div class="info-box">
|
||||||
<span class="info-box-icon bg-danger elevation-1"><i
|
<span class="info-box-icon bg-danger elevation-1"><i class="fas fa-align-justify"></i></span>
|
||||||
class="fas fa-align-justify"></i></span>
|
|
||||||
|
|
||||||
<div class="info-box-content">
|
<div class="info-box-content">
|
||||||
<span class="info-box-text">@lang('messages.templates')</span>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -41,15 +40,14 @@
|
|||||||
|
|
||||||
<div class="info-box-content">
|
<div class="info-box-content">
|
||||||
<span class="info-box-text">@lang('messages.submissions')</span>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-sm-6 col-md-3">
|
<div class="col-12 col-sm-6 col-md-3">
|
||||||
<button type="button"
|
<button type="button" data-href="{{ action([\App\Http\Controllers\FormController::class, 'create']) }}"
|
||||||
data-href="{{action([\App\Http\Controllers\FormController::class, 'create'])}}"
|
class="btn btn-primary float-right col-md-9 createForm mt-3">
|
||||||
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>
|
<i class="fas fa-plus" aria-hidden="true"></i> @lang('messages.new_form')</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -59,84 +57,76 @@
|
|||||||
<div class="card card-primary card-outline card-outline-tabs">
|
<div class="card card-primary card-outline card-outline-tabs">
|
||||||
<div class="card-header p-0 border-bottom-0">
|
<div class="card-header p-0 border-bottom-0">
|
||||||
<ul class="nav nav-tabs
|
<ul class="nav nav-tabs
|
||||||
@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) nav-justified @endif"
|
||||||
nav-justified
|
|
||||||
@endif"
|
|
||||||
id="custom-tabs-four-tab" role="tablist">
|
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">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" id="custome-tabs-all-forms" data-toggle="pill"
|
<a class="nav-link active" id="custome-tabs-all-forms" data-toggle="pill"
|
||||||
href="#custome-tabs-forms" role="tab" aria-controls="custome-tabs-forms"
|
href="#custome-tabs-forms" role="tab" aria-controls="custome-tabs-forms"
|
||||||
aria-selected="true">
|
aria-selected="true">
|
||||||
<i class="fas fa-file-alt" aria-hidden="true"></i> @lang('messages.all_forms')
|
<i class="fas fa-file-alt" aria-hidden="true"></i> @lang('messages.all_forms')
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</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">
|
<li class="nav-item">
|
||||||
<a class="nav-link" id="custome-tabs-all-templates" data-toggle="pill"
|
<a class="nav-link" id="custome-tabs-all-templates" data-toggle="pill"
|
||||||
href="#custome-tabs-templates" role="tab"
|
href="#custome-tabs-templates" role="tab"
|
||||||
aria-controls="custome-tabs-templates">
|
aria-controls="custome-tabs-templates">
|
||||||
<i class="fas fa-align-justify"
|
<i class="fas fa-align-justify" aria-hidden="true"></i> @lang('messages.all_templates')
|
||||||
aria-hidden="true"></i> @lang('messages.all_templates')
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link
|
<a class="nav-link
|
||||||
@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) active @endif
|
||||||
active
|
"
|
||||||
@endif
|
id="custome-tabs-shared-forms" data-toggle="pill"
|
||||||
" id="custome-tabs-shared-forms" data-toggle="pill"
|
href="#custome-tabs-shared-forms-assigned" role="tab"
|
||||||
href="#custome-tabs-shared-forms-assigned" role="tab"
|
aria-controls="custome-tabs-shared-forms-assigned"
|
||||||
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>
|
||||||
@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"
|
|
||||||
@endif>
|
|
||||||
<i class="fas fa-file-alt"
|
|
||||||
aria-hidden="true"></i> @lang('messages.assigned_forms')
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="tab-content" id="custom-tabs-four-tabContent">
|
<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"
|
<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">
|
<div class="table-responsive">
|
||||||
<table class="table" id="form_table" style="width: 100%;">
|
<table class="table" id="form_table" style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>@lang('messages.name')</th>
|
<th>@lang('messages.description')</th>
|
||||||
<th>@lang('messages.description')</th>
|
<th>@lang('messages.name')</th>
|
||||||
<th>@lang('messages.created_at')</th>
|
<th>@lang('messages.created_at')</th>
|
||||||
<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.description')</th>
|
||||||
<th>@lang('messages.description')</th>
|
<th>@lang('messages.name')</th>
|
||||||
@if(auth()->user()->can('superadmin'))
|
@if (auth()->user()->can('superadmin'))
|
||||||
<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>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -144,22 +134,21 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<div class="tab-pane fade
|
<div class="tab-pane fade
|
||||||
@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) active show @endif
|
||||||
active show
|
"
|
||||||
@endif
|
id="custome-tabs-shared-forms-assigned" role="tabpanel"
|
||||||
" id="custome-tabs-shared-forms-assigned" role="tabpanel"
|
aria-labelledby="custome-tabs-shared-forms">
|
||||||
aria-labelledby="custome-tabs-shared-forms">
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table" id="assigned_form_table" style="width: 100%;">
|
<table class="table" id="assigned_form_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>
|
||||||
@if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
|
@if (auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
|
||||||
<th>@lang('messages.created_by')</th>
|
<th>@lang('messages.created_by')</th>
|
||||||
@endif
|
@endif
|
||||||
<th>@lang('messages.action')</th>
|
<th>@lang('messages.action')</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody></tbody>
|
<tbody></tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -177,16 +166,21 @@
|
|||||||
|
|
||||||
@section('footer')
|
@section('footer')
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function() {
|
||||||
var lang = `{{session()->get('locale')}}`
|
var lang = `{{ session()->get('locale') }}`
|
||||||
var titleColName = 'name';
|
var titleColName = 'name';
|
||||||
console.log(lang);
|
if (lang === 'est') {
|
||||||
|
titleColName = 'name_est'
|
||||||
|
} else if (lang === 'ru') {
|
||||||
|
titleColName = 'name_ru'
|
||||||
|
}
|
||||||
|
|
||||||
if (lang === 'est') {
|
var descColName = 'description';
|
||||||
titleColName = 'name_est'
|
if (lang === 'est') {
|
||||||
} else if (lang === 'ru') {
|
descColName = 'description_est'
|
||||||
titleColName = 'name_ru'
|
} else if (lang === 'ru') {
|
||||||
}
|
descColName = 'description_ru'
|
||||||
|
}
|
||||||
|
|
||||||
// form dataTable
|
// form dataTable
|
||||||
var form_table = $('#form_table').DataTable({
|
var form_table = $('#form_table').DataTable({
|
||||||
@@ -196,28 +190,62 @@
|
|||||||
buttons: [],
|
buttons: [],
|
||||||
dom: 'lfrtip',
|
dom: 'lfrtip',
|
||||||
fixedHeader: false,
|
fixedHeader: false,
|
||||||
aaSorting: [[2, 'desc']],
|
aaSorting: [
|
||||||
"columnDefs": [
|
[1, 'desc']
|
||||||
{"width": "22%", "targets": 0},
|
|
||||||
{"width": "40%", "targets": 1},
|
|
||||||
{"width": "15%", "targets": 2},
|
|
||||||
{"width": "3%", "targets": 3},
|
|
||||||
{"width": "20%", "targets": 4}
|
|
||||||
],
|
],
|
||||||
columns: [
|
"columnDefs": [{
|
||||||
|
"width": "22%",
|
||||||
|
"targets": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
data: titleColName,
|
"width": "40%",
|
||||||
name: titleColName,
|
"targets": 1
|
||||||
createdCell: function (td, cellData, rowData, row, col) {
|
},
|
||||||
|
{
|
||||||
|
"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) {
|
if (td.innerHTML.length === 0) {
|
||||||
td.innerHTML = rowData.name
|
td.innerHTML = rowData.name
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{data: 'description', name: 'description'},
|
{
|
||||||
{data: 'created_at', name: 'created_at'},
|
data: titleColName,
|
||||||
{data: 'data_count', name: 'data_count', searchable: false},
|
name: titleColName,
|
||||||
{data: 'action', name: 'action', sortable: false}
|
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
|
||||||
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -229,22 +257,41 @@
|
|||||||
buttons: [],
|
buttons: [],
|
||||||
dom: 'lfrtip',
|
dom: 'lfrtip',
|
||||||
fixedHeader: false,
|
fixedHeader: false,
|
||||||
columns: [
|
columns: [{
|
||||||
{data: 'name', name: 'name'},
|
data: descColName,
|
||||||
{data: 'description', name: 'description'},
|
name: descColName,
|
||||||
@if(auth()->user()->can('superadmin'))
|
createdCell: function(td, cellData, rowData, row, col) {
|
||||||
{
|
if (td.innerHTML.length === 0) {
|
||||||
data: 'is_global_template', name: 'is_global_template', sortable: false, searchable: false
|
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
|
//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) {
|
||||||
@@ -252,7 +299,7 @@
|
|||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (result) {
|
success: function(result) {
|
||||||
if (result.success == true) {
|
if (result.success == true) {
|
||||||
toastr.success(result.msg);
|
toastr.success(result.msg);
|
||||||
form_table.ajax.reload();
|
form_table.ajax.reload();
|
||||||
@@ -265,7 +312,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//delete template
|
//delete template
|
||||||
$(document).on('click', '.delete_template', function () {
|
$(document).on('click', '.delete_template', 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) {
|
||||||
@@ -273,7 +320,7 @@
|
|||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (result) {
|
success: function(result) {
|
||||||
if (result.success == true) {
|
if (result.success == true) {
|
||||||
toastr.success(result.msg);
|
toastr.success(result.msg);
|
||||||
template_table.ajax.reload();
|
template_table.ajax.reload();
|
||||||
@@ -286,39 +333,39 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// create form
|
// create form
|
||||||
$(document).on('click', '.createForm', function () {
|
$(document).on('click', '.createForm', function() {
|
||||||
var url = $(this).data('href');
|
var url = $(this).data('href');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
success: function (response) {
|
success: function(response) {
|
||||||
$("#modal_div").html(response).modal("show");
|
$("#modal_div").html(response).modal("show");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// create widget
|
// create widget
|
||||||
$(document).on('click', '.generate_widget', function () {
|
$(document).on('click', '.generate_widget', function() {
|
||||||
var url = $(this).data('href');
|
var url = $(this).data('href');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
success: function (response) {
|
success: function(response) {
|
||||||
$("#modal_div").html(response).modal("show");
|
$("#modal_div").html(response).modal("show");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//copy form
|
//copy form
|
||||||
$(document).on('click', '.copy_form', function () {
|
$(document).on('click', '.copy_form', function() {
|
||||||
var url = $(this).data('href');
|
var url = $(this).data('href');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
success: function (response) {
|
success: function(response) {
|
||||||
$("#modal_div").html(response).modal("show");
|
$("#modal_div").html(response).modal("show");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -332,49 +379,70 @@
|
|||||||
buttons: [],
|
buttons: [],
|
||||||
dom: 'lfrtip',
|
dom: 'lfrtip',
|
||||||
fixedHeader: false,
|
fixedHeader: false,
|
||||||
aaSorting: [[0, 'desc']],
|
aaSorting: [
|
||||||
"columnDefs": [
|
[0, 'desc']
|
||||||
{"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: [
|
"columnDefs": [{
|
||||||
{data: 'name', name: 'forms.name'},
|
"width": "25%",
|
||||||
{data: 'description', name: 'forms.description'},
|
"targets": 0
|
||||||
@if(auth()->user()->hasRole(\App\Enums\User\RoleEnum::SUPERVISOR->value))
|
|
||||||
{
|
|
||||||
data: 'created_by', name: 'forms.created_by'
|
|
||||||
},
|
},
|
||||||
@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: '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
|
//form collaborate
|
||||||
$(document).on('click', '.collab_btn', function () {
|
$(document).on('click', '.collab_btn', function() {
|
||||||
var url = $(this).data('href');
|
var url = $(this).data('href');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "html",
|
dataType: "html",
|
||||||
success: function (response) {
|
success: function(response) {
|
||||||
$("#collab_modal").html(response).modal("show");
|
$("#collab_modal").html(response).modal("show");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#collab_modal").on('shown.bs.modal', function () {
|
$("#collab_modal").on('shown.bs.modal', function() {
|
||||||
if ($("#form_design").length) {
|
if ($("#form_design").length) {
|
||||||
$(document).on('change', '#form_design', function () {
|
$(document).on('change', '#form_design', function() {
|
||||||
if ($("#form_design").is(":checked")) {
|
if ($("#form_design").is(":checked")) {
|
||||||
$("#form_view").attr('checked', true);
|
$("#form_view").attr('checked', true);
|
||||||
} else {
|
} else {
|
||||||
@@ -384,7 +452,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('submit', 'form#collaborate_form', function (e) {
|
$(document).on('submit', 'form#collaborate_form', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var data = $("form#collaborate_form").serialize();
|
var data = $("form#collaborate_form").serialize();
|
||||||
var url = $("form#collaborate_form").attr('action');
|
var url = $("form#collaborate_form").attr('action');
|
||||||
@@ -395,7 +463,7 @@
|
|||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: data,
|
data: data,
|
||||||
success: function (response) {
|
success: function(response) {
|
||||||
ladda.stop();
|
ladda.stop();
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
$("#collab_modal").modal('hide');
|
$("#collab_modal").modal('hide');
|
||||||
@@ -407,7 +475,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');
|
var target = $(e.target).attr('href');
|
||||||
if (target == '#custome-tabs-forms') {
|
if (target == '#custome-tabs-forms') {
|
||||||
if (typeof form_table != 'undefined') {
|
if (typeof form_table != 'undefined') {
|
||||||
@@ -424,25 +492,25 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@if(auth()->user()->can('superadmin'))
|
@if (auth()->user()->can('superadmin'))
|
||||||
$(document).on('click', '.toggle_global_template', function () {
|
$(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) {
|
||||||
template_table.ajax.reload();
|
template_table.ajax.reload();
|
||||||
} else {
|
} else {
|
||||||
toastr.error(response.msg);
|
toastr.error(response.msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user