migrations done, account preview done

This commit is contained in:
Mahri Ilmedova 2022-09-16 02:07:57 +05:00
parent 1ced167f31
commit 69a99d429b
18 changed files with 159 additions and 88 deletions

View File

@ -42,19 +42,19 @@ public function setup()
protected function setupListOperation()
{
CRUD::addColumn([
'name' => 'personal',
'type' => 'json',
'label' => 'Personal'
'name' => 'name',
'type' => 'text',
'label' => 'Name'
]);
CRUD::addColumn([
'name' => 'document',
'type' => 'json',
'label' => 'Document'
'name' => 'surname',
'type' => 'text',
'label' => 'Surname'
]);
CRUD::addColumn([
'name' => 'job',
'type' => 'json',
'label' => 'Job'
'name' => 'patronomic_name',
'type' => 'text',
'label' => 'Patronomic'
]);

View File

@ -17,7 +17,6 @@ class ClientCrudController extends CrudController
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
@ -60,9 +59,6 @@ protected function setupCreateOperation()
CRUD::field('email');
CRUD::field('status');
CRUD::field('is_suspended');
CRUD::field('account_id');
CRUD::field('created_at');
CRUD::field('updated_at');
}
/**

View File

@ -20,7 +20,7 @@ public function up()
$table->string('email')->unique()->nullable();
$table->string('password')->nullable();
$table->boolean('is_suspended')->default(0);
$table->bigInteger('account_id')->nullable();
$table->foreignId('account_id')->nullable();
$table->string('verification_token')->nullable();
$table->boolean('is_verified')->default(0);
$table->timestamps();

View File

@ -18,7 +18,7 @@ public function up()
$table->text('contacts')->nullable();
$table->text('bank')->nullable();
$table->string('vat')->nullable();
$table->integer('country_id')->nullable();
$table->foreignId('country_id')->nullable();
$table->string('legalization_number')->nullable();
$table->morphs('accountable');
$table->timestamps();

View File

@ -16,7 +16,7 @@ public function up()
Schema::create('applications', function (Blueprint $table) {
$table->id();
$table->boolean('status')->default(0);
$table->integer('account_id')->nullable();
$table->foreignId('account_id')->references('id')->on('accounts')->onDelete('cascade');
$table->timestamps();
});
}

View File

@ -19,8 +19,8 @@ public function up()
$table->string('size')->nullable();
$table->string('type')->nullable();
$table->string('file')->nullable();
$table->bigInteger('document_id')->nullable();
$table->bigInteger('application_id')->nullable();
$table->foreignId('document_id')->onDelete('cascade');
$table->foreignId('application_id')->references('id')->on('applications')->onDelete('cascade');
$table->timestamps();
});
}

View File

@ -15,7 +15,7 @@ public function up()
{
Schema::create('answers', function (Blueprint $table) {
$table->id();
$table->bigInteger('question_id')->nullable();
$table->foreignId('question_id')->onDelete('cascade');
$table->text('question_text')->nullable();
$table->text('answer_text')->nullable();
$table->timestamps();

View File

@ -15,8 +15,8 @@ public function up()
{
Schema::create('documentgroup_documents', function (Blueprint $table) {
$table->id();
$table->bigInteger('documentgroup_id');
$table->bigInteger('document_id');
$table->foreignId('documentgroup_id')->references('id')->on('documentgroups')->onDelete('cascade');
$table->foreignId('document_id')->references('id')->on('documents')->onDelete('cascade');
$table->timestamps();
});
}

View File

@ -15,8 +15,8 @@ public function up()
{
Schema::create('documentgroup_countries', function (Blueprint $table) {
$table->id();
$table->bigInteger('documentgroup_id');
$table->bigInteger('country_id');
$table->foreignId('documentgroup_id')->references('id')->on('documentgroups')->onDelete('cascade');
$table->foreignId('country_id')->references('id')->on('countries')->onDelete('cascade');
$table->timestamps();
});
}

View File

@ -17,9 +17,9 @@ public function up()
$table->id();
$table->string('title');
$table->string('content');
$table->foreignId('client_id');
$table->foreignId('status_id');
$table->foreignId('category_id');
$table->foreignId('client_id')->references('id')->on('clients')->onDelete('cascade');
$table->foreignId('status_id')->nullable();
$table->foreignId('category_id')->nullable();
$table->timestamps();
});
}

View File

@ -15,7 +15,7 @@ public function up()
{
Schema::create('messages', function (Blueprint $table) {
$table->id();
$table->foreignId('ticket_id')->references('id')->on('tickets')->onDelete('cascade');;
$table->foreignId('ticket_id')->references('id')->on('tickets')->onDelete('cascade')->onUpdate('cascade');
$table->boolean('is_client'); //if client diplay as client's message, else display as admin reply
$table->string('content');
$table->foreignId('admin_id')->nullable();;

View File

@ -16,13 +16,10 @@ class AdminSeeder extends Seeder
*/
public function run()
{
User::truncate();
$user = User::create([
User::create([
'name' => 'Admin',
'email' => 'admin@mail.com',
'password' => Hash::make('Admin123')
]);
}
}

View File

@ -15,8 +15,6 @@ class CategorySeeder extends Seeder
*/
public function run()
{
Category::truncate();
$categories = [
['name' => 'Bug report'],
['name' => 'Application issue'],

View File

@ -17,8 +17,6 @@ class ClientSeeder extends Seeder
*/
public function run()
{
Client::truncate();
$client = Client::create([
'firstname' => 'Test',
'lastname' => 'Testov',

View File

@ -15,8 +15,6 @@ class CountrySeeder extends Seeder
*/
public function run()
{
Country::truncate();
$countries = [
['name' => 'Afghanistan', 'code' => 'AF'],
['name' => 'Åland Islands', 'code' => 'AX'],

View File

@ -14,7 +14,6 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
$this->call([
SettingsSeeder::class,
CountrySeeder::class,

View File

@ -15,8 +15,6 @@ class StatusSeeder extends Seeder
*/
public function run()
{
Status::truncate();
$statuses = [
['name' => 'Open', 'color' => 'orange'],
['name' => 'Closed', 'color' => 'green']

View File

@ -15,22 +15,22 @@
</ol>
<div class="row">
<div class="col-md-12">
<div class="col-lg-12">
<div class="card">
<div class="card-header">Account Information</div>
<div class="card-header">Account Stats</div>
<div class="card-body">
<div class="row">
<div class="col-sm-6">
<div class="row">
<div class="col-sm-6">
<div class="callout callout-info"><small class="text-muted">Clients</small><br><strong class="h4">{{ count($account->clients) }}</strong>
<div class="col-lg-6">
<div class="callout callout-info"><small class="text-muted">Contacts</small><br><strong class="h4">{{ count($account->clients) }}</strong>
<div class="chart-wrapper">
<canvas id="sparkline-chart-1" width="100" height="30"></canvas>
</div>
</div>
</div>
<!-- /.col-->
<div class="col-sm-6">
<div class="col-lg-6">
<div class="callout callout-danger"><small class="text-muted">Applications</small><br><strong class="h4">{{ count($account->applications) }}</strong>
<div class="chart-wrapper">
<canvas id="sparkline-chart-2" width="100" height="30"></canvas>
@ -43,16 +43,16 @@
<!-- /.col-->
<div class="col-sm-6">
<div class="row">
<div class="col-sm-6">
<div class="callout callout-warning"><small class="text-muted">Test</small><br><strong class="h4">90</strong>
<div class="col-lg-6">
<div class="callout callout-warning"><small class="text-muted">Test</small><br><strong class="h4">0</strong>
<div class="chart-wrapper">
<canvas id="sparkline-chart-3" width="100" height="30"></canvas>
</div>
</div>
</div>
<!-- /.col-->
<div class="col-sm-6">
<div class="callout callout-success"><small class="text-muted">Test</small><br><strong class="h4">40</strong>
<div class="col-lg-6">
<div class="callout callout-success"><small class="text-muted">Test</small><br><strong class="h4">0</strong>
<div class="chart-wrapper">
<canvas id="sparkline-chart-4" width="100" height="30"></canvas>
</div>
@ -70,46 +70,133 @@
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">Last Applications</div>
<div class="card-body p-0">
<table class="table table-responsive-sm table-striped mb-0">
<thead class="thead-light">
<tr>
<th>ID</th>
<th>Status</th>
<th class="text-center">State</th>
<th>Created at</th>
</tr>
</thead>
<tbody>
@foreach ($account->applications as $application)
<tr>
<td>
{{ $application->id }}
</td>
<td>
<div>
@if($application->status)
<div>Closed</div>
@else
<div>Open</div>
@endif
</div>
</td>
<td class="text-center">
{{ $application->state }}
</td>
<td>
<div class="small text-muted"></div><strong>Registered: {{ Carbon\Carbon::parse($application->created_at)->format('M d Y') }}</strong>
</td>
</tr>
@endforeach
</tbody>
</table>
<div class="col-lg-4">
<div class="card">
<div class="card-header">Profile</div>
<div class="card-body">
<div class="form-group">
<label for="company"><small>Country</small></label>
<h6><strong>{{ $account->country->name }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Name</small></label>
<h6><strong>{{ $account->profile->name }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Surname</small></label>
<h6><strong>{{ $account->profile->surname }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Patronomic</small></label>
<h6><strong>{{ $account->profile->patronomic_name }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Date of birth</small></label>
<h6><strong>{{ Carbon\Carbon::parse($account->profile->date_of_birth)->format('d.m.Y') }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Birthplace</small></label>
<h6><strong>{{ $account->profile->birth_place }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Registration address</small></label>
<h6><strong>{{ $account->profile->registration_address }}</strong></h6>
</div>
</div>
</div>
</div>
<div class="col-lg-8">
<div class="card">
<div class="card-header"><i class="fa fa-align-justify"></i> Account information tables</div>
<div class="card-body">
<div id="accordion" role="tablist">
<div class="card mb-0">
<div class="card-header p-1 bg-gray-200" id="headingOne" role="tab">
<h5 class="mb-0"><a data-toggle="collapse" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne" class="nav-link text-dark">Contacts</a></h5>
</div>
<div class="collapse show" id="collapseOne" role="tabpanel" aria-labelledby="headingOne" data-parent="#accordion" style="">
<div class="card-body">
<table class="table table-responsive-sm table-striped mb-0">
<thead class="thead-light">
<tr>
<th>ID</th>
<th>Full Name</th>
<th>Email</th>
<th>Registered at</th>
</tr>
</thead>
<tbody>
@foreach ($account->clients as $client)
<tr>
<td>
<a class="nav-link" href="/admin/client/{{ $client->id }}/edit">{{ $client->id }}</a>
</td>
<td>
{{ $client->lastname }} {{ $client->firstname }}
</td>
<td>
{{ $client->email }}
</td>
<td>
<div class="small text-muted"></div><strong>Registered: {{ Carbon\Carbon::parse($client->created_at)->format('M d Y') }}</strong>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<br>
<div class="card mb-0">
<div class="card-header p-1 bg-gray-200" id="headingTwo" role="tab">
<h5 class="mb-0"><a class="collapsed nav-link text-dark" data-toggle="collapse" href="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo">Applications</a></h5>
</div>
<div class="collapse show" id="collapseTwo" role="tabpanel" aria-labelledby="headingTwo" data-parent="#accordion">
<div class="card-body">
<table class="table table-responsive-sm table-striped mb-0">
<thead class="thead-light">
<tr>
<th>ID</th>
<th>Status</th>
<th>State</th>
<th>Created at</th>
</tr>
</thead>
<tbody>
@foreach ($account->applications as $application)
<tr>
<td>
<a class="nav-link" href="/admin/application/{{ $application->id }}/edit">{{ $application->id }}</a>
</td>
<td>
<div>
@if($application->status)
<div>Closed</div>
@else
<div>Open</div>
@endif
</div>
</td>
<td>
{{ $application->state }}
</td>
<td>
<div class="small text-muted"></div><strong>Registered: {{ Carbon\Carbon::parse($application->created_at)->format('M d Y') }}</strong>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection