This commit is contained in:
Kilian Hofmann 2021-08-14 19:20:57 +02:00
parent a3696de0c7
commit 3b1b587806
9 changed files with 354 additions and 1 deletions

View File

@ -1,2 +1,13 @@
# Relations
## Member
- BelongsTo MemberRank (External DB)
- **TODO** BelongsTo Passenger (External DB)
- **TODO** BelongsTo Charter (External DB)
- **TODO** BelongsTo Cargo (External DB)
- **TODO** BelongsTo Heritage (External DB)
- **TODO** BelongsTo Visual (External DB)
- **TODO** BelongsTo Tour (External DB)
- HasMany ExamMemberRank (External DB)
- HasMany ExamTypeRating (External DB

16
controllers/Member.php Normal file
View File

@ -0,0 +1,16 @@
<?php namespace GermanAirlinesVa\Social\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class Member extends Controller
{
public $implement = ['Backend\Behaviors\ListController'];
public $listConfig = 'config_list.yaml';
public function __construct()
{
parent::__construct();
}
}

View File

@ -0,0 +1,17 @@
<div data-control="toolbar">
<button
class="btn btn-default oc-icon-trash-o"
disabled="disabled"
onclick="$(this).data('request-data', {
checked: $('.control-list').listWidget('getChecked')
})"
data-request="onDelete"
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
data-trigger-action="enable"
data-trigger=".control-list input[type=checkbox]"
data-trigger-condition="checked"
data-request-success="$(this).prop('disabled', true)"
data-stripe-load-indicator>
<?= e(trans('backend::lang.list.delete_selected')) ?>
</button>
</div>

View File

@ -0,0 +1,11 @@
list: $/germanairlinesva/social/models/member/columns.yaml
modelClass: GermanAirlinesVa\Social\Models\Member
title: Member
noRecordsMessage: 'backend::lang.list.no_records'
showSetup: true
showCheckboxes: true
recordsPerPage: 20
toolbar:
buttons: list_toolbar
search:
prompt: 'backend::lang.list.search_prompt'

View File

@ -0,0 +1 @@
<?= $this->listRender() ?>

37
models/Member.php Normal file
View File

@ -0,0 +1,37 @@
<?php namespace GermanAirlinesVa\Social\Models;
use Model;
/**
* Model
*/
class Member extends Model
{
use \October\Rain\Database\Traits\Validation;
/*
* Disable timestamps by default.
* Remove this line if timestamps are defined in the database table.
*/
public $timestamps = false;
/**
* @var string The database table used by the model.
*/
public $table = 'members';
public $connection = 'germanairlinesva_social';
/**
* @var array Validation rules
*/
public $rules = [];
public $belongsTo = [
'member_rank' => 'GermanAirlinesVa\Schooling\Models\MemberRank',
];
public $hasMany = [
'exam_member_ranks' => 'GermanAirlinesVa\Schooling\Models\ExamMemberRank',
'exam_typeratings' => 'GermanAirlinesVa\Schooling\Models\ExamTyperating',
];
}

141
models/member/columns.yaml Normal file
View File

@ -0,0 +1,141 @@
columns:
id:
label: id
type: number
member_rank:
label: member_rank
type: text
relation: member_rank
valueFrom: name
passenger_id:
label: passenger_id
type: number
charter_id:
label: charter_id
type: number
cargo_id:
label: cargo_id
type: number
heritage_id:
label: heritage_id
type: number
visual_id:
label: visual_id
type: number
tour_id:
label: tour_id
type: number
passenger_briefing:
label: passenger_briefing
type: text
charter_briefing:
label: charter_briefing
type: text
cargo_briefing:
label: cargo_briefing
type: text
heritage_briefing:
label: heritage_briefing
type: text
visual_briefing:
label: visual_briefing
type: text
tour_briefing:
label: tour_briefing
type: text
is_team:
label: is_team
type: switch
is_instructor:
label: is_instructor
type: switch
show_contact:
label: show_contact
type: switch
account_status:
label: account_status
type: text
last_active:
label: last_active
type: datetime
name:
label: name
type: text
surname:
label: surname
type: text
password:
label: password
type: text
email:
label: email
type: text
zip:
label: zip
type: text
state:
label: state
type: text
city:
label: city
type: text
vatsim_id:
label: vatsim_id
type: number
ivao_id:
label: ivao_id
type: number
pilot_id:
label: pilot_id
type: text
birthday:
label: birthday
type: date
member_since:
label: member_since
type: date
about_me:
label: about_me
type: text
job:
label: job
type: text
legacy_points:
label: legacy_points
type: number
legacy_flights:
label: legacy_flights
type: number
signature:
label: signature
type: text
team_sort_index:
label: team_sort_index
type: text
team_position_short:
label: team_position_short
type: text
team_position_long:
label: team_position_long
type: text
team_member_story:
label: team_member_story
type: text
team_favourite_real_aircraft:
label: team_favourite_real_aircraft
type: text
team_favourite_fs_aircraft:
label: team_favourite_fs_aircraft
type: text
team_favourite_airport:
label: team_favourite_airport
type: text
gdpr_forum:
label: gdpr_forum
type: switch
gdpr_newsletter:
label: gdpr_newsletter
type: switch
gdpr_general:
label: gdpr_general
type: switch

View File

@ -0,0 +1,116 @@
<?php namespace GermanAirlinesVa\Social\Updates;
use Schema;
use DB;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateGermanAirlinesVaSocialMembers extends Migration
{
public function up()
{
Schema::connection('germanairlinesva_social')->create('members', function ($table) {
$table->engine = 'InnoDB';
$table->bigIncrements('id')->unsigned();
$table
->bigInteger('member_rank_id')
->unsigned()
->default(1);
$table
->foreign('member_rank_id')
->references('id')
->on('germanairlinesva_schooling.member_ranks');
$table
->bigInteger('passenger_id')
->nullable()
->unsigned();
$table
->bigInteger('charter_id')
->nullable()
->unsigned();
$table
->bigInteger('cargo_id')
->nullable()
->unsigned();
$table
->bigInteger('heritage_id')
->nullable()
->unsigned();
$table
->bigInteger('visual_id')
->nullable()
->unsigned();
$table
->bigInteger('tour_id')
->nullable()
->unsigned();
$table->text('passenger_briefing')->nullable();
$table->text('charter_briefing')->nullable();
$table->text('cargo_briefing')->nullable();
$table->text('heritage_briefing')->nullable();
$table->text('visual_briefing')->nullable();
$table->text('tour_briefing')->nullable();
$table->boolean('is_team')->default(0);
$table->boolean('is_instructor')->default(0);
$table->boolean('show_contact')->default(0);
$table->enum('account_status', ['active', 'pending', 'inactive', 'suspended']);
$table->dateTime('last_active')->default(DB::raw('NOW()'));
$table->text('name');
$table->text('surname');
$table->text('password');
$table->string('email', 320)->unique();
$table->text('zip');
$table->text('state');
$table->text('city');
$table
->bigInteger('vatsim_id')
->nullable()
->unsigned();
$table
->bigInteger('ivao_id')
->nullable()
->unsigned();
$table->string('pilot_id', 4)->unique();
$table->date('birthday');
$table->date('member_since');
$table->text('about_me')->nullable();
$table->text('job')->nullable();
$table->double('legacy_points', 10, 0)->default(0);
$table
->bigInteger('legacy_flights')
->unsigned()
->default(0);
$table->text('signature')->nullable();
$table->bigInteger('team_sort_index')->nullable();
$table->text('team_position_short')->nullable();
$table->text('team_position_long')->nullable();
$table->text('team_member_story')->nullable();
$table->text('team_favourite_real_aircraft')->nullable();
$table->text('team_favourite_fs_aircraft')->nullable();
$table->text('team_favourite_airport')->nullable();
$table->boolean('gdpr_forum')->default(0);
$table->boolean('gdpr_newsletter')->default(0);
$table->boolean('gdpr_general')->default(0);
});
Schema::connection('germanairlinesva_schooling')->table('exams', function ($table) {
$table
->foreign('member_id')
->references('id')
->on('germanairlinesva_social.members');
});
Schema::connection('germanairlinesva_graphql')->table('graphql_keys', function ($table) {
$table
->foreign('member_id')
->references('id')
->on('germanairlinesva_social.members');
});
}
public function down()
{
Schema::connection('germanairlinesva_social')->disableForeignKeyConstraints();
Schema::connection('germanairlinesva_social')->dropIfExists('members');
Schema::connection('germanairlinesva_social')->enableForeignKeyConstraints();
}
}

View File

@ -1,4 +1,7 @@
1.0.1:
- Initialize plugin.
- 'Initialize plugin.'
- 'Create table deferred_bindings'
- builder_table_create_deferred_bindings.php
1.0.2:
- 'Created table members'
- builder_table_create_members.php