added some graphics as well as changed all mail jobs to the correct mail queue

This commit is contained in:
2019-05-17 21:08:40 -05:00
parent b29d557e5b
commit 3b13a6a4ee
17 changed files with 47 additions and 32 deletions

View File

@@ -10,12 +10,17 @@ use Carbon\Carbon;
//Libraries //Libraries
use App\Library\Esi\Mail; use App\Library\Esi\Mail;
//Jobs
use App\Jobs\SendEveMailJob;
//Models //Models
use App\User; use App\User;
use App\Models\User\UserPermission; use App\Models\User\UserPermission;
use App\Models\Contracts\Contract; use App\Models\Contracts\Contract;
use App\Models\Contracts\Bid; use App\Models\Contracts\Bid;
use App\Models\Contracts\AcceptedBid; use App\Models\Contracts\AcceptedBid;
use App\Models\Mail\EveMail;
use App\Models\Jobs\JobSendEveMail;
class ContractAdminController extends Controller class ContractAdminController extends Controller
{ {
@@ -66,6 +71,9 @@ class ContractAdminController extends Controller
$contract->type = $request->type; $contract->type = $request->type;
$contract->save(); $contract->save();
//Send a mail out to all of the people who can bid on a contract
$this->NewContractMail();
return redirect('/contracts/admin/display')->with('success', 'Contract written.'); return redirect('/contracts/admin/display')->with('success', 'Contract written.');
} }
@@ -143,18 +151,22 @@ class ContractAdminController extends Controller
$body .= $contract['body'] . '<br>'; $body .= $contract['body'] . '<br>';
$body .= 'Please remit contract when the items are ready to Spatial Forces. Description should be the contract identification number. Request ISK should be the bid amount.'; $body .= 'Please remit contract when the items are ready to Spatial Forces. Description should be the contract identification number. Request ISK should be the bid amount.';
$body .= 'Sincerely,<br>Spatial Forces Contracting Department'; $body .= 'Sincerely,<br>Spatial Forces Contracting Department';
while($mail->SendMail($bid['character_id'], 'character', $subject, $body)) {
$tries++;
if($tries == 5) {
TidyContract($contract, $bid);
return redirect('/contracts/admin/display')->with('error', 'Could not deliver mail. Please manually send the mail to the winner.'); //Setup the mail job
} $mail = new EveMail;
} $mail->subject = $subject;
$mail->recipient_type = 'character';
$mail->recipient = $bid['character_id'];
$mail->body = $body;
$mail->sender = 93738489;
//Dispatch the mail job
SendEveMailJob::dispatch($mail)->onQueue('mail');
//Tidy up the contract by doing a few things.
TidyContract($contract, $bid); TidyContract($contract, $bid);
return redirect('/contracts/admin/display')->with('success', 'Contract finalized. Mail took ' . $tries . ' attempt to send to the winner.'); //Redirect back to the contract admin dashboard.
return redirect('/contracts/admin/display')->with('success', 'Contract finalized. Mail has been sent to the queue for processing.');
} }
private function TidyContract($contract, $bid) { private function TidyContract($contract, $bid) {
@@ -170,4 +182,22 @@ class ContractAdminController extends Controller
$accepted->notes = $bid['notes']; $accepted->notes = $bid['notes'];
$accepted->save(); $accepted->save();
} }
private function NewContractMail() {
//Get all the users with a specific permission set
$users = User::all(['name', 'character_id'])->toArray();
foreach($users as $user) {
if($user->hasPermission('contract.canbid')) {
$mail = new EveMail;
$mail->sender = 93738489;
$mail->subject = 'New Alliance Contract Available';
$mail->recipient = $user['character_id'];
$mail->recipient_type = 'character';
$mail->body = "A new contract is available for the alliance contracting system. Please check out <a href='https://services.w4rp.space'>Services Site</a>.";
SendEveMailJob::dispatch($mail)->onQueue('mail');
$mail->delete();
}
}
}
} }

View File

@@ -47,9 +47,8 @@ class Esi {
$mail->body = "Please register on https://services.w4rp.space with the scope: " . $scope; $mail->body = "Please register on https://services.w4rp.space with the scope: " . $scope;
$mail->recipient = (int)$charId; $mail->recipient = (int)$charId;
$mail->recipient_type = 'character'; $mail->recipient_type = 'character';
$mail->save();
SendEveMailJob::dispatch($mail)->delay(Carbon::now()->addSeconds(5)); SendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds(5));
return false; return false;
} }

View File

@@ -315,9 +315,8 @@ class FinanceHelper {
$mail->body = 'You need to register an ESI API on the services site for esi-wallet.read_corporation_wallet.v1<br>This is also labeled Corporation Wallets'; $mail->body = 'You need to register an ESI API on the services site for esi-wallet.read_corporation_wallet.v1<br>This is also labeled Corporation Wallets';
$mail->recipient = (int)$charId; $mail->recipient = (int)$charId;
$mail->recipient_type = 'character'; $mail->recipient_type = 'character';
$mail->save();
SendEveMailJob::dispatch($mail); SendEveMailJob::dispatch($mail)->onQueue('mail');
return true; return true;
} }

View File

@@ -6,9 +6,6 @@ use Illuminate\Database\Eloquent\Model;
class JobSendEveMail extends Model class JobSendEveMail extends Model
{ {
//Table Name
//protected $table = 'eve_mails';
//Timestamps //Timestamps
public $timestamps = true; public $timestamps = true;

View File

@@ -16,12 +16,6 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
public function boot() public function boot()
{ {
parent::boot(); parent::boot();
// Horizon::routeSmsNotificationsTo('15556667777');
// Horizon::routeMailNotificationsTo('example@example.com');
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
// Horizon::night();
} }
/** /**

View File

@@ -3,7 +3,7 @@
namespace App; namespace App;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail; //use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Models\User\UserRole; use App\Models\User\UserRole;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -4,8 +4,9 @@
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-8"> <div class="col-md-8">
<div class="card"> <div class="card">
<div class="card-header">Dashboard</div> <div class="card-header">
Dashboard
</div>
<div class="card-body"> <div class="card-body">
@if (session('status')) @if (session('status'))
<div class="alert alert-success" role="alert"> <div class="alert alert-success" role="alert">

View File

@@ -2,6 +2,5 @@
@section('content') @section('content')
<div class="container"> <div class="container">
<h2>Services Profile</h2><br> <h2>Services Profile</h2><br>
</div> </div>
@endsection @endsection

View File

@@ -5,14 +5,10 @@
<div class="col-md-8"> <div class="col-md-8">
<div class="card"> <div class="card">
<div class="card-header">Welcome to the W4RP Services Page</div> <div class="card-header">Welcome to the W4RP Services Page</div>
<div class="card-body"> <div class="card-body">
@if (session('status')) <div class="container" align="center">
<div class="alert alert-success" role="alert"> <a href="/login" img='/img/eve-soo-login-white-large.png'>Login</a>
{{ session('status') }} </div>
</div>
@endif
<a href="/login">Login</a>
</div> </div>
</div> </div>
</div> </div>