update_10.09.23
This commit is contained in:
parent
4a9c23c4ea
commit
98a7d01134
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums\User;
|
||||
|
||||
enum PermissionEnum: string
|
||||
{
|
||||
case CREATE_FORM = 'create form';
|
||||
case VIEW_FORM = 'view form';
|
||||
case EDIT_FORM = 'edit form';
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Enums\User;
|
||||
|
||||
enum RoleEnum: string
|
||||
{
|
||||
case SUPERVISOR = 'supervisor';
|
||||
case ADMIN = 'admin';
|
||||
case USER = 'user';
|
||||
}
|
|
@ -92,12 +92,6 @@ class HomeController extends Controller
|
|||
</a>';
|
||||
}
|
||||
|
||||
$action .= '<a href="'.action([\App\Http\Controllers\FormDataController::class, 'getReport'], ['id' => $form->id]).'"'.'"
|
||||
target="_blank"
|
||||
class="btn btn-sm btn-success m-1" data-toggle="tooltip" title="'.__('messages.report').'">
|
||||
<i class="fas fa-chart-pie" aria-hidden="true"></i>
|
||||
</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').'">
|
||||
<i class="fas fa-handshake text-white" aria-hidden="true"></i>
|
||||
</a>';
|
||||
|
@ -265,7 +259,7 @@ class HomeController extends Controller
|
|||
'action',
|
||||
function ($row) {
|
||||
$action = '';
|
||||
if (! empty($row->permissions) && in_array('can_view_form', $row->permissions)) {
|
||||
if (! empty($row->permissions) && in_array('can_view_form', $row->permissions) && auth()->user()->show_edit_buttons_form) {
|
||||
$action = '<a href="'.action([\App\Http\Controllers\FormController::class, 'show'], ['form' => $row->slug ?: $row->form_id]).'"'.'
|
||||
target="_blank"
|
||||
class="btn btn-sm btn-info m-1" data-toggle="tooltip" title="'.__('messages.view').'">
|
||||
|
@ -273,23 +267,18 @@ class HomeController extends Controller
|
|||
</a>';
|
||||
}
|
||||
|
||||
if (! empty($row->permissions) && in_array('can_design_form', $row->permissions)) {
|
||||
if (! empty($row->permissions) && in_array('can_design_form', $row->permissions) && auth()->user()->show_edit_buttons_form) {
|
||||
$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').'">
|
||||
<i class="fa fa-edit" aria-hidden="true"></i>
|
||||
</a>';
|
||||
}
|
||||
|
||||
if (! empty($row->permissions) && in_array('can_view_data', $row->permissions)) {
|
||||
if (! empty($row->permissions) && in_array('can_view_data', $row->permissions) && auth()->user()->show_edit_buttons_form) {
|
||||
$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').'">
|
||||
<i class="fa fa-list" aria-hidden="true"></i>
|
||||
</a>
|
||||
<a href="'.action([\App\Http\Controllers\FormDataController::class, 'getReport'], ['id' => $row->form_id]).'"'.'"
|
||||
target="_blank"
|
||||
class="btn btn-sm btn-success m-1" data-toggle="tooltip" title="'.__('messages.report').'">
|
||||
<i class="fas fa-chart-pie" aria-hidden="true"></i>
|
||||
</a>';
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ class ManageUsersController extends Controller
|
|||
return $this->notAllowedInDemo();
|
||||
}
|
||||
|
||||
$input = $request->only('name', 'email', 'is_active', 'can_create_form');
|
||||
$input = $request->only('name', 'email', 'is_active', 'can_create_form', 'show_form_response_user', 'show_edit_buttons_form');
|
||||
|
||||
if (! empty($request->input('password'))) {
|
||||
$input['password'] = bcrypt($request->input('password'));
|
||||
|
@ -134,6 +134,8 @@ class ManageUsersController extends Controller
|
|||
|
||||
$input['is_active'] = ! empty($input['is_active']) ? 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);
|
||||
|
||||
|
@ -219,9 +221,11 @@ class ManageUsersController extends Controller
|
|||
return $this->notAllowedInDemo();
|
||||
}
|
||||
|
||||
$input = $request->only('name', 'email', 'is_active', 'can_create_form');
|
||||
$input = $request->only('name', 'email', 'is_active', 'can_create_form', 'show_form_response_user', 'show_edit_buttons_form');
|
||||
$input['is_active'] = ! empty($input['is_active']) ? 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'))) {
|
||||
$input['password'] = bcrypt($request->input('password'));
|
||||
|
|
|
@ -4,10 +4,12 @@ namespace App;
|
|||
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
use Notifiable,
|
||||
HasRoles;
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.0",
|
||||
"php": "^8.1",
|
||||
"carlos-meneses/laravel-mpdf": "^2.1",
|
||||
"composer/semver": "^3.2",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
|
@ -18,6 +18,7 @@
|
|||
"laravel/ui": "^3.3",
|
||||
"milon/barcode": "^9.0",
|
||||
"spatie/laravel-newsletter": "*",
|
||||
"spatie/laravel-permission": "^5.11",
|
||||
"spatie/laravel-webhook-server": "^3.1",
|
||||
"srmklive/paypal": "^3.0",
|
||||
"stripe/stripe-php": "^7.108",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -190,6 +190,7 @@ return [
|
|||
Srmklive\PayPal\Providers\PayPalServiceProvider::class,
|
||||
// Meneses\LaravelMpdf\LaravelMpdfServiceProvider::class,
|
||||
Milon\Barcode\BarcodeServiceProvider::class,
|
||||
Spatie\Permission\PermissionServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'models' => [
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your permissions. Of course, it
|
||||
* is often just the "Permission" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Permission model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Permission` contract.
|
||||
*/
|
||||
|
||||
'permission' => Spatie\Permission\Models\Permission::class,
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your roles. Of course, it
|
||||
* is often just the "Role" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Role model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Role` contract.
|
||||
*/
|
||||
|
||||
'role' => Spatie\Permission\Models\Role::class,
|
||||
|
||||
],
|
||||
|
||||
'table_names' => [
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'roles' => 'roles',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your permissions. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'permissions' => 'permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_permissions' => 'model_has_permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models roles. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_roles' => 'model_has_roles',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'role_has_permissions' => 'role_has_permissions',
|
||||
],
|
||||
|
||||
'column_names' => [
|
||||
/*
|
||||
* Change this if you want to name the related pivots other than defaults
|
||||
*/
|
||||
'role_pivot_key' => null, //default 'role_id',
|
||||
'permission_pivot_key' => null, //default 'permission_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to name the related model primary key other than
|
||||
* `model_id`.
|
||||
*
|
||||
* For example, this would be nice if your primary keys are all UUIDs. In
|
||||
* that case, name this `model_uuid`.
|
||||
*/
|
||||
|
||||
'model_morph_key' => 'model_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to use the teams feature and your related model's
|
||||
* foreign key is other than `team_id`.
|
||||
*/
|
||||
|
||||
'team_foreign_key' => 'team_id',
|
||||
],
|
||||
|
||||
/*
|
||||
* When set to true, the method for checking permissions will be registered on the gate.
|
||||
* Set this to false, if you want to implement custom logic for checking permissions.
|
||||
*/
|
||||
|
||||
'register_permission_check_method' => true,
|
||||
|
||||
/*
|
||||
* When set to true the package implements teams using the 'team_foreign_key'. If you want
|
||||
* the migrations to register the 'team_foreign_key', you must set this to true
|
||||
* before doing the migration. If you already did the migration then you must make a new
|
||||
* migration to also add 'team_foreign_key' to 'roles', 'model_has_roles', and
|
||||
* 'model_has_permissions'(view the latest version of package's migration file)
|
||||
*/
|
||||
|
||||
'teams' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required permission names are added to the exception
|
||||
* message. This could be considered an information leak in some contexts, so
|
||||
* the default setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_permission_in_exception' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required role names are added to the exception
|
||||
* message. This could be considered an information leak in some contexts, so
|
||||
* the default setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_role_in_exception' => false,
|
||||
|
||||
/*
|
||||
* By default wildcard permission lookups are disabled.
|
||||
*/
|
||||
|
||||
'enable_wildcard_permission' => false,
|
||||
|
||||
'cache' => [
|
||||
|
||||
/*
|
||||
* By default all permissions are cached for 24 hours to speed up performance.
|
||||
* When permissions or roles are updated the cache is flushed automatically.
|
||||
*/
|
||||
|
||||
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
|
||||
|
||||
/*
|
||||
* The cache key used to store all permissions.
|
||||
*/
|
||||
|
||||
'key' => 'spatie.permission.cache',
|
||||
|
||||
/*
|
||||
* You may optionally indicate a specific cache driver to use for permission and
|
||||
* role caching using any of the `store` drivers listed in the cache.php config
|
||||
* file. Using 'default' here means to use the `default` set in cache.php.
|
||||
*/
|
||||
|
||||
'store' => 'default',
|
||||
],
|
||||
];
|
|
@ -19,6 +19,10 @@ return new class extends Migration
|
|||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
|
||||
$table->boolean('show_form_response_user')->default(false);
|
||||
$table->boolean('show_edit_buttons_form');
|
||||
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Spatie\Permission\PermissionRegistrar;
|
||||
|
||||
class CreatePermissionTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$teams = config('permission.teams');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
|
||||
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
|
||||
Schema::create($tableNames['permissions'], function (Blueprint $table) {
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name'); // For MySQL 8.0 use string('name', 125);
|
||||
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
|
||||
$table->bigIncrements('id'); // role id
|
||||
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name'); // For MySQL 8.0 use string('name', 125);
|
||||
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([PermissionRegistrar::$pivotPermission, PermissionRegistrar::$pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
}
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
}
|
|
@ -13,8 +13,12 @@ class DatabaseSeeder extends Seeder
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->call(UsersTableSeeder::class);
|
||||
$this->call(SystemsTableSeeder::class);
|
||||
$this->call(TemplateSeeder::class);
|
||||
$this->call([
|
||||
PermissionSeeder::class,
|
||||
RoleSeeder::class,
|
||||
UsersTableSeeder::class,
|
||||
SystemsTableSeeder::class,
|
||||
TemplateSeeder::class
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\User\PermissionEnum;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
|
||||
class PermissionSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
Permission::query()
|
||||
->upsert([
|
||||
['name' => PermissionEnum::CREATE_FORM->value, 'guard_name' => 'web'],
|
||||
['name' => PermissionEnum::VIEW_FORM->value, 'guard_name' => 'web'],
|
||||
['name' => PermissionEnum::EDIT_FORM->value, 'guard_name' => 'web']
|
||||
], ['name', 'guard_name']);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\User\RoleEnum;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class RoleSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
Role::query()
|
||||
->upsert([
|
||||
['name' => RoleEnum::SUPERVISOR->value, 'guard_name' => 'web'],
|
||||
['name' => RoleEnum::ADMIN->value, 'guard_name' => 'web'],
|
||||
['name' => RoleEnum::USER->value, 'guard_name' => 'web']
|
||||
], ['name', 'guard_name']);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\User\RoleEnum;
|
||||
use App\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
|
@ -14,14 +15,13 @@ class UsersTableSeeder extends Seeder
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
$info = [
|
||||
User::query()
|
||||
->create([
|
||||
'name' => 'admin',
|
||||
'email' => 'admin@admin.com',
|
||||
'password' => bcrypt(12345678),
|
||||
'is_active' => 1,
|
||||
];
|
||||
|
||||
//create user
|
||||
$user = User::create($info);
|
||||
])
|
||||
->assignRole(RoleEnum::SUPERVISOR->value);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -477,6 +477,10 @@ return [
|
|||
'outline' => 'Outline',
|
||||
'can_create_form' => 'Can create form',
|
||||
'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',
|
||||
'permission_for_forms' => 'Permission for shared forms',
|
||||
'can_design_form' => 'Can design form',
|
||||
|
|
|
@ -477,6 +477,10 @@ return [
|
|||
'outline' => 'Контур',
|
||||
'can_create_form' => 'Может создавать форму',
|
||||
'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' => 'Поделиться формами',
|
||||
'permission_for_forms' => 'Разрешение на общие формы',
|
||||
'can_design_form' => 'Может проектировать форму',
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,6 +25,7 @@
|
|||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.no-print {
|
||||
display: none;
|
||||
}
|
||||
|
@ -70,6 +71,9 @@
|
|||
@if($is_enabled_sub_ref_no)
|
||||
<th>@lang('messages.submission_numbering')</th>
|
||||
@endif
|
||||
@if(auth()->user()->show_form_response_user)
|
||||
<th>@lang('messages.username')</th>
|
||||
@endif
|
||||
@foreach($schema as $element)
|
||||
@if(in_array($element['name'], $col_visible))
|
||||
<th>
|
||||
|
@ -86,25 +90,25 @@
|
|||
<tr>
|
||||
<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">
|
||||
<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])}}">
|
||||
<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
|
||||
<a class="btn btn-primary btn-sm m-1" target="_blank" href="{{action([\App\Http\Controllers\FormDataController::class, 'downloadPdf'], [$row->id])}}">
|
||||
<i class="far fa-file-pdf" aria-hidden="true"></i>
|
||||
@lang('messages.download_pdf')
|
||||
</a>
|
||||
@php
|
||||
$form_id = !empty($form->slug) ? $form->slug : $form->id;
|
||||
@endphp
|
||||
<a class="btn btn-dark btn-sm m-1" target="_blank" href="{{action([\App\Http\Controllers\FormDataController::class, 'getEditformData'], ['slug' => $form_id,'id' => $row->id])}}">
|
||||
<a class="btn btn-dark btn-sm m-1" target="_blank"
|
||||
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>
|
||||
|
@ -114,6 +118,11 @@
|
|||
{{$row['submission_ref']}}
|
||||
</td>
|
||||
@endif
|
||||
|
||||
@if(auth()->user()->show_form_response_user)
|
||||
<td>{{ $row->submittedBy?->name }}</td>
|
||||
@endif
|
||||
|
||||
@foreach($schema as $row_element)
|
||||
@if(in_array($row_element['name'], $col_visible))
|
||||
<td>
|
||||
|
@ -123,9 +132,11 @@
|
|||
@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']]}}"
|
||||
<a target="_blank"
|
||||
href="{{$row->data[$row_element['name']]}}"
|
||||
download="Signature">
|
||||
<img src="{{$row->data[$row_element['name']]}}" class="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')
|
||||
|
|
|
@ -137,7 +137,6 @@
|
|||
<tr>
|
||||
<th>@lang('messages.name')</th>
|
||||
<th>@lang('messages.description')</th>
|
||||
<th>@lang('messages.created_by')</th>
|
||||
<th>@lang('messages.action')</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -295,13 +294,11 @@
|
|||
"columnDefs": [
|
||||
{ "width": "25%", "targets": 0 },
|
||||
{ "width": "40%", "targets": 1 },
|
||||
{ "width": "15%", "targets": 2 },
|
||||
{ "width": "20%", "targets": 3 }
|
||||
{ "width": "20%", "targets": 2 }
|
||||
],
|
||||
columns: [
|
||||
{ data: 'name' , name: 'forms.name'},
|
||||
{ data: 'description' , name: 'forms.description'},
|
||||
{ data: 'created_by' , name: 'users.name', sortable:false},
|
||||
{ data: 'action', name: 'action', sortable:false }
|
||||
]
|
||||
});
|
||||
|
|
|
@ -138,34 +138,7 @@
|
|||
[25, 50, 100, 200, 500, 1000, -1], [25, 50, 100, 200, 500, 1000, "{{__('messages.all')}}"]
|
||||
],
|
||||
iDisplayLength: 25,
|
||||
dom: 'lBfrtip',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'copy',
|
||||
text: "{{__('messages.copy')}}",
|
||||
exportOptions: {
|
||||
columns: ':visible',
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'excel',
|
||||
text: "{{__('messages.excel')}}",
|
||||
exportOptions: {
|
||||
columns: ':visible',
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: "{{__('messages.csv')}}",
|
||||
exportOptions: {
|
||||
columns: ':visible',
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'colvis',
|
||||
text: "{{__('messages.column_visibility')}}",
|
||||
},
|
||||
],
|
||||
dom: 'lfrtip',
|
||||
"language": {
|
||||
"emptyTable": "{{__('messages.emptyTable')}}",
|
||||
"info": "{{__('messages.dt_info')}}",
|
||||
|
|
|
@ -76,6 +76,25 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="show_form_response_user" id="show_form_response_user" value="1">
|
||||
<label class="form-check-label" for="show_form_response_user">
|
||||
@lang('messages.show_form_response_user')
|
||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.show_form_response_user_tooltip')"></i>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group form-check">
|
||||
<input type="checkbox" class="form-check-input" name="show_edit_buttons_form" id="show_edit_buttons_form" value="1">
|
||||
<label class="form-check-label" for="show_edit_buttons_form">
|
||||
@lang('messages.show_edit_buttons_form')
|
||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.show_edit_buttons_form_tooltip')"></i>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card assign-form p-3">
|
||||
<div class="row">
|
||||
|
|
|
@ -78,6 +78,25 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="form-group form-check">
|
||||
<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>
|
||||
<label class="form-check-label" for="show_form_response_user">
|
||||
@lang('messages.show_form_response_user')
|
||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.show_form_response_user_tooltip')"></i>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group form-check">
|
||||
<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>
|
||||
<label class="form-check-label" for="show_edit_buttons_form">
|
||||
@lang('messages.show_edit_buttons_form')
|
||||
<i class="fas fa-info-circle text-info" data-toggle="tooltip" title="@lang('messages.show_edit_buttons_form_tooltip')"></i>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if(auth()->user()->id != $user->id)
|
||||
@php
|
||||
|
|
Loading…
Reference in New Issue