rest of moon controller functions

This commit is contained in:
2018-10-23 22:21:26 -05:00
parent 124f02367b
commit b294e2d645
6 changed files with 83 additions and 37 deletions

View File

@@ -52,36 +52,26 @@ class MoonsController extends Controller
return redirect('/dashboard')->with('success', 'Moon Added');
}
/**
* Returns a view with a table select for all of the structures in the corp owned by the player
*/
public function moonminedisplay() {
// Disable all caching by setting the NullCache as the
// preferred cache handler. By default, Eseye will use the
// FileCache.
$configuration = Configuration::getInstance();
$configuration->cache = NullCache::class;
public function updateMoon() {
return view('moons.updatemoon');
}
/**
* Create the auth user space.
* Get the character Id.
* Check the character id against the esi token table
* If the refresh token is available then request an ESI pull
* If the refresh token is not available, display an error message
*/
$user = Auth::user();
$characterId = $user->getCharacterId();
// Prepare an authentication container for ESI
$authentication = new EsiAuthentication([
'client_id' => env('ESI_CLIENT_ID'),
'secret' => env('ESI_SECRET_KEY'),
'refresh_token' => null,
public function storeUpdateMoon(Request $request) {
$this->validate($request, [
'name' => 'required',
'renter' => 'required',
'date' => 'required'
]);
// Instantiate a new ESI instance.
$esi = new Eseye($authentication);
$date = strtotime($request->date . '00:00:01');
return 'Work In Progress!';
DB::table('moons')
->where('StructureName', $request->name)
->update([
'RentalCorp' => $request->renter,
'RentalEnd' => $date,
]);
return redirect('/dashboard')->with('success', 'Moon Updated');
}
}

View File

@@ -4,26 +4,20 @@
<a class="navbar-brand" href="#">W4RP</a>
</div>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="/dashboard/profile">Profile</a>
</li>
@can('isAdmin')
<li class="nav-item">
<a class="nav-link" href="/dashboard/finances">Finances</a>
</li>
@endcan
<li class="nav-item">
<a class="nav-link" href="/dashboard/moons">Display Moons</a>
<a class="nav-link" href="/moons/display">Display Moons</a>
</li>
@can('isAdmin')
<li class="nav-item">
<a class="nav-link" href="/dashboard/addmoon">Add Moon</a>
<a class="nav-link" href="/moons/addmoon">Add Moon</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/dashboard/updatemoon">Update Moon</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/dashboard/moonmine">Moon Mining</a>
<a class="nav-link" href="/moons/updatemoon">Update Moon</a>
</li>
@endcan
<li class="nav-item">

View File

@@ -1,5 +1,4 @@
@extends('layouts.b4')
@include('inc.messages')
@include('layouts.navbar')
@section('content')
<div class="container">

View File

@@ -0,0 +1,45 @@
@extends('layouts.b4')
@include('layouts.navbar')
@section('content')
<div class="container">
<div class="jumbotron">
<table class="table table-striped">
<thead>
<th>Region</th>
<th>System</th>
<th>Name</th>
<th>First Ore</th>
<th>Quantity</th>
<th>Second Ore</th>
<th>Quantity</th>
<th>Third Ore</th>
<th>Quantity</th>
<th>Fourth Ore</th>
<th>Quantity</th>
<th>Rental Price</th>
<th>Renter</th>
<th>Rental End</th>
</thead>
<tbody>
@foreach ($moons as $moon)
<tr>
<td>{{ $moon->region }}</td>
<td>{{ $moon->system }}</td>
<td>{{ $moon->structure }}</td>
<td>{{ $moon->firstore }}</td>
<td>{{ $moon->firstquan }}</td>
<td>{{ $moon->secondore }}</td>
<td>{{ $moon->secondquan }}</td>
<td>{{ $moon->thirdore }}</td>
<td>{{ $moon->thirdquan }}</td>
<td>{{ $moon->fourthore }}</td>
<td>{{ $moon->price }}</td>
<td>{{ $moon->renter }}</td>
<td>{{ $moon->rentend }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection

View File

@@ -0,0 +1,18 @@
@extends('layouts.b4')
@include('layouts.navbar')
@section('content')
<div class="container">
<h2>Update Existing Moon</h2>
{!! Form::open(['action' => 'MoonsController@storeUpdateMoon', 'method' => 'POST']) !!}
<div class="form-group col-md-6">
{{ Form::label('name', 'Structure Name') }}
{{ Form::text('name', '', ['class' => 'form-control', 'placeholder' => 'Name']) }}
{{ Form::label('renter', 'Renter') }}
{{ Form::text('renter', '', ['class' => 'form-control', 'placeholder' => 'Renter']) }}
{{ Form::label('date', 'Rental End Date') }}
{{ Form::text('date', '', ['class' => 'form-control', 'placeholder' => '01/01/1970'] )}}
</div>
{{ Form:;submit('Submit', ['class' => 'btn btn-primary']) }}
{!! Form::close() !!}
</div>
@endsection