Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #82 from herpaderpaldent/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
herpaderpaldent authored Feb 12, 2019
2 parents 59b41f3 + fd0fc34 commit 071a284
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Version 1.6.9
Small improvement based on community feedback:

* SeAT Groups are now sort alphabetically instead of in order of creation thank you @eingang for suggesting
* Fixed a bug where managed groups did not show number of open applications on button. Thank you @warlof for reporting this
* Added other outstanding applications to discord and slack notification. Thank you @warlof for suggesting this feature.

# Version 1.6.8
This update adds application notification about candidates which are applying to a managed group. Works only for private channel notification to managers and superusers only.

Expand Down
25 changes: 24 additions & 1 deletion src/Http/Controllers/SeatGroupsController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php
/**
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatGroups\Http\Controllers;

Expand Down Expand Up @@ -36,7 +59,7 @@ public function index()

$seatgroups = SeatGroup::all()->filter(function ($seatgroup) {
return $seatgroup->isAllowedToSeeSeatGroup();
});
})->sortBy('name');

return view('seatgroups::index', compact('seatgroups'));
}
Expand Down
30 changes: 26 additions & 4 deletions src/Notifications/SeatGroupApplicationNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ class SeatGroupApplicationNotification extends BaseNotification

protected $main_character;

protected $seatgroup_string;

protected $usergroup_string;

protected $pending_applications;

/**
* @var \Seat\Web\Models\Group
*/
Expand All @@ -70,6 +76,20 @@ public function __construct(Seatgroup $seatgroup, Group $group)
$this->main_character = $this->getMainCharacter($group);
$this->image = 'https://imageserver.eveonline.com/Character/' . $this->main_character->character_id . '_128.jpg';
$this->url = route('seatgroups.index') . '#managed_group';

$this->seatgroup_string = (string) $this->seatgroup->name;
$this->usergroup_string = (string) $this->group->users->map(function ($user) {return $user->name; })->implode(', ');

$applications_helper = $this->seatgroup
->waitlist
->filter(function ($group) {
return $group->id !== $this->group->id;
})
->map(function ($group) {
return $this->getMainCharacter($group)->name;
});

$this->pending_applications = (string) $applications_helper->isNotEmpty() ? $applications_helper->implode(', ') : 'none';
}

/**
Expand Down Expand Up @@ -108,8 +128,9 @@ public function toDiscord($notifiable)
->color('1548984')
->description(sprintf('%s just applied to a SeAT Group you are managing. Head over to [SeAT Groups](%s) and accept or deny the candidate.',
$this->main_character->name, $this->url))
->field('SeAT Group', $this->seatgroup->name, true)
->field('User group', $this->group->users->map(function ($user) {return $user->name; })->implode(', '), true);
->field('SeAT Group', $this->seatgroup_string, true)
->field('User group', $this->usergroup_string, true)
->field('Other pending applications', $this->pending_applications, false);
});
}

Expand All @@ -130,8 +151,9 @@ public function toSlack($notifiable)
->content(sprintf('%s just applied to a SeAT Group you are managing. Head over to SeAT Groups and accept or deny the candidate.',
$this->main_character->name))
->fields([
'SeAT Group' => $this->seatgroup->name,
'User group' => $this->group->users->map(function ($user) {return $user->name; })->implode(', '),
'SeAT Group' => $this->seatgroup_string,
'User group' => $this->usergroup_string,
'Other pending applications' => $this->pending_applications,
]);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/seatgroups.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/

return [
'version' => '1.6.8',
'version' => '1.6.9',
];

//TODO: Update Version
23 changes: 15 additions & 8 deletions src/resources/views/partials/manager-modal.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-xs btn-info pull-right" data-toggle="modal" data-target="#ModalSeATGroup{{$seatgroup->id}}">Manage Members <span class="badge">{{$seatgroup->waitlist()->count() >=1 ?: ''}}</span></button>
<button type="button" class="btn btn-xs btn-info pull-right" data-toggle="modal"
data-target="#ModalSeATGroup{{$seatgroup->id}}">Manage Members
@if($seatgroup->waitlist->isNotEmpty())
<span class="badge" data-toggle="tooltip"
title="{{ $seatgroup->waitlist()->count() }} open applications.">{{ $seatgroup->waitlist()->count() }}</span>
@endif
</button>

<!-- Modal -->
<div id="ModalSeATGroup{{$seatgroup->id}}" class="modal fade" role="dialog">
Expand All @@ -12,10 +18,11 @@
<h4 class="modal-title">{{ trans('seatgroups::seat.manage_members')}}: {{$seatgroup->name}}</h4>
</div>
<div class="modal-body">
<table id="current_member_table_{{$seatgroup->id}}" class="display table-hover table-condensed table-striped" style="width:100%" >
<table id="current_member_table_{{$seatgroup->id}}" class="display table-hover table-condensed table-striped"
style="width:100%">
<thead>
<th>Member</th>
<th>Action</th>
<th>Member</th>
<th>Action</th>
</thead>

</table>
Expand All @@ -28,19 +35,19 @@

@push('javascript')
<script type="application/javascript">
$(function(){
$(function () {
@if(session('ModalSeATGroup') == $seatgroup->id)
$('#ModalSeATGroup{{session('ModalSeATGroup')}}').modal('show');
@endif
$('table#current_member_table_{{$seatgroup->id}}').DataTable({
processing: true,
serverSide: true,
ajax: {
url: '{{ route('seatgroups.get.members.table', $seatgroup->id) }}',
ajax : {
url : '{{ route('seatgroups.get.members.table', $seatgroup->id) }}',
type: "GET"
},
columns: [
columns : [
{className: 'col-sm-9', data: 'name'},
{className: 'col-sm-3', data: 'actions'},
],
Expand Down

0 comments on commit 071a284

Please sign in to comment.