This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 1.2.0 - Corporation Title Affiliation (#19)
This is a major update to SeAT-Groups as it introduces many asked features and refactoring lots of front end mistakes i made. This is just an initial working release. I will continue to improve SeAT Groups and refactor even classes i have introuced with this release and i see room for improvement. * Introducing `Corporation Title Filter` * Refactor affiliation box on `edit` ** Introducing of actions and custom validation for corporation-titles ** Serverside processed affiliation-table ** Logic refactoring to prevent assigning of corp-title affiliation whilst there is corp affiliated ** Logic introduction to prevent assigning other corporation wit `All Corporations` option enabled * Refactor `index`-page ** Removing of laravel-form-builder inside ** Refactoring of many routes. ** split view in many partials to optimize maintainability. ** Reworked `managed` SeAT group modal: using `Datatables` asynchronously and bigger buttons. * Refactor of `SeatGroups` ** Introducing of `isQualified()` method ** `GroupSync` will take use of this method. ** Refactoring of `isMember()` function ** Reducing of switch-complexity in `GroupSync` ![image](https://user-images.githubusercontent.com/6583519/45206929-af3a5e80-b286-11e8-9a27-ed9994a24cd3.png) This closes #5
- Loading branch information
1 parent
3088093
commit d4c7083
Showing
48 changed files
with
1,788 additions
and
827 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: felix | ||
* Date: 05.09.2018 | ||
* Time: 17:57 | ||
*/ | ||
|
||
namespace Herpaderpaldent\Seat\SeatGroups\Actions\Corporations; | ||
|
||
|
||
use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup; | ||
use Seat\Eveapi\Models\Corporation\CorporationInfo; | ||
|
||
class GetCorporationListAction | ||
{ | ||
public function execute(array $data) | ||
{ | ||
|
||
$seatgroup = Seatgroup::find($data['seatgroup_id']); | ||
|
||
$existing_affiliations = collect(); | ||
|
||
if($seatgroup->all_corporations && !$data['origin'] === 'SeatGroupsController') | ||
return; | ||
|
||
//if either corporation or a corporation-title is assigned don't show it in available list | ||
$existing_affiliations->push($seatgroup->corporation->pluck('corporation_id')); | ||
|
||
|
||
if($data['origin'] != 'corporation-tile-form') | ||
$existing_affiliations->push($seatgroup->corporationTitles->pluck('corporation_id')); | ||
|
||
$existing_affiliations = $existing_affiliations->filter(function ($affiliation){ | ||
return !$affiliation->isEmpty(); | ||
})->flatten()->unique(); | ||
|
||
if($existing_affiliations->isEmpty()) | ||
return CorporationInfo::select('corporation_id','name')->get(); | ||
|
||
|
||
return CorporationInfo::whereNotIn('corporation_id',$existing_affiliations) | ||
->select('corporation_id','name') | ||
->get(); | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
src/Actions/Corporations/RemoveAllCorporationAffiliationAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: felix | ||
* Date: 06.09.2018 | ||
* Time: 09:13 | ||
*/ | ||
|
||
namespace Herpaderpaldent\Seat\SeatGroups\Actions\Corporations; | ||
|
||
|
||
use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup; | ||
|
||
class RemoveAllCorporationAffiliationAction | ||
{ | ||
public function execute(array $data) | ||
{ | ||
try { | ||
$seatgroup_id = $data['seatgroup_id']; | ||
$seatgroup = Seatgroup::find($seatgroup_id); | ||
|
||
$seatgroup->all_corporations = false; | ||
$seatgroup->save(); | ||
|
||
return true; | ||
} catch (\Exception $e){ | ||
return false; | ||
} | ||
|
||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Herpaderpaldent\Seat\SeatGroups\Actions\Corporations; | ||
|
||
use Herpaderpaldent\Seat\SeatGroups\Http\Validation\RemoveCorporationAffiliationRequest; | ||
use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup; | ||
use Illuminate\Http\Request; | ||
use Seat\Services\Repositories\Corporation\Corporation; | ||
|
||
|
||
class RemoveCorpAffiliationAction | ||
{ | ||
use Corporation; | ||
/** | ||
* @param array $data | ||
* | ||
* @return mixed | ||
*/ | ||
public function execute(array $data) | ||
{ | ||
try{ | ||
$group_id = $data['seatgroup_id']; | ||
$corporation_id = $data['corporation_id']; | ||
|
||
$seat_group = Seatgroup::find($group_id); | ||
|
||
$seat_group->corporation()->detach($corporation_id); | ||
|
||
return true; | ||
|
||
} catch (\Exception $e) { | ||
return false; | ||
} | ||
|
||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/Actions/Corporations/Titles/AddCorporationTitleAffiliation.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: felix | ||
* Date: 05.09.2018 | ||
* Time: 15:21 | ||
*/ | ||
|
||
namespace Herpaderpaldent\Seat\SeatGroups\Actions\Corporations\Titles; | ||
|
||
|
||
use Herpaderpaldent\Seat\SeatGroups\Models\CorporationTitleSeatgroups; | ||
|
||
class AddCorporationTitleAffiliation | ||
{ | ||
public function execute (array $data) | ||
{ | ||
|
||
$seatgroup_corporation_id = $data['seatgroup-corporation-id']; | ||
$seatgroup_id = $data['seatgroup_id']; | ||
$seatgroup_title_id = $data['seatgroup-title-id']; | ||
|
||
return CorporationTitleSeatgroups::firstOrCreate([ | ||
'seatgroup_id' => $seatgroup_id, | ||
'corporation_id' => $seatgroup_corporation_id, | ||
'title_id' => $seatgroup_title_id | ||
]); | ||
|
||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
src/Actions/Corporations/Titles/GetCorporationTitleAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: felix | ||
* Date: 05.09.2018 | ||
* Time: 16:42 | ||
*/ | ||
|
||
namespace Herpaderpaldent\Seat\SeatGroups\Actions\Corporations\Titles; | ||
|
||
use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup; | ||
use Seat\Eveapi\Models\Corporation\CorporationTitle; | ||
|
||
class GetCorporationTitleAction | ||
{ | ||
public function execute(array $data) | ||
{ | ||
$corporationId = $data['corporation_id']; | ||
$seatgroup_id = $data['seatgroup_id']; | ||
|
||
$existing_affiliations = Seatgroup::find($seatgroup_id) | ||
->corporationTitles | ||
->where('corporation_id',$corporationId) | ||
->pluck('title_id'); | ||
|
||
|
||
if (!empty($corporationId)) { | ||
$titles = CorporationTitle::where('corporation_id', $corporationId) | ||
->whereNotIn('title_id',$existing_affiliations) | ||
->select('title_id', 'name') | ||
->get(); | ||
return $titles->map(function($item){ | ||
return [ | ||
'title_id' => $item->title_id, | ||
'name' => strip_tags($item->name) | ||
]; | ||
}); | ||
} | ||
return []; | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/Actions/Corporations/Titles/RemoveCorporationTitleAffiliationAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: felix | ||
* Date: 06.09.2018 | ||
* Time: 09:56 | ||
*/ | ||
|
||
namespace Herpaderpaldent\Seat\SeatGroups\Actions\Corporations\Titles; | ||
|
||
use Herpaderpaldent\Seat\SeatGroups\Models\CorporationTitleSeatgroups; | ||
|
||
class RemoveCorporationTitleAffiliationAction | ||
{ | ||
public function execute(array $data) | ||
{ | ||
try{ | ||
$corporation_id = $data['corporation_id']; | ||
$seatgroup_id = $data['seatgroup_id']; | ||
$title_id = $data['title_id']; | ||
|
||
CorporationTitleSeatgroups::where('corporation_id', $corporation_id) | ||
->where('title_id', $title_id) | ||
->where('seatgroup_id', $seatgroup_id) | ||
->delete(); | ||
return true; | ||
} catch (\Exception $e){ | ||
return false; | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
} |
Oops, something went wrong.