mining operations

This commit is contained in:
2021-06-03 01:27:58 +09:00
parent 2349f1031c
commit 3b02745302
4 changed files with 54 additions and 14 deletions

View File

@@ -28,6 +28,7 @@ use App\Models\Moon\MineralPrice;
use App\Models\Esi\EsiToken;
use App\Models\Esi\EsiScope;
use App\Models\Structure\Structure;
use App\Models\MiningTax\MiningOperation;
class MiningTaxesAdminController extends Controller
{
@@ -48,32 +49,32 @@ class MiningTaxesAdminController extends Controller
$coll = new Collection;
$structures = array();
//Get all of the structures
$athanors = $sHelper->GetStructuresByType('Athanor');
$tataras = $sHelper->GetStructuresByType('Tatara');
//Cycle through each athanor and add it to the stack
foreach($athanors as $athanor) {
$coll->push([
$structures->push([
$athanor->structure_id => $athanor->structure_name,
]);
}
//Cycle through each tatara and add it to the stack
foreach($tataras as $tatara) {
$coll->push([
$structures->push([
$tatara->structure_id => $tatara->structure_name,
]);
}
//Sort all of the structures
$structures->sort();
$coll->sort();
//Get the current mining operations.
$operations = MiningOperation::where([
'processed' => 'No',
])->get();
foreach($coll as $key => $value) {
array_push($structures, [
$key => $value,
]);
}
return view('miningtax.admin.display.miningops.form')->with('structures', $structures);
return view('miningtax.admin.display.miningops.form')->with('structures', $structures)
->with('operations', $operations);
}
/**
@@ -87,19 +88,20 @@ class MiningTaxesAdminController extends Controller
'structure' => 'required',
]);
dd($request);
//Get the name of the structure from the table
$moon = Observer::where([
'observer_id' => $request->structure,
])->get();
dd($moon);
//Save the mining operation into the database
$operation = new MiningOperation;
$operation->structure_id = $request->structure;
$operation->structure_name = $moon->observer_name;
$operation->authorized_by_id = auth()->user()->getId();
$operation->authorized_by_name = auth()->user()->getName();
$operation->operation_name = $request->name;
$operation->operation_date = $request->date;
$operation->processed = 'No';
$operation->processed_on = null;

View File

@@ -27,6 +27,7 @@ class MiningOperation extends Model
'authorized_by_id',
'authorized_by_name',
'operation_date',
'operation_name',
'processed',
'processed_on',
];

View File

@@ -21,6 +21,7 @@ class CreateMiningTaxMiningOperationsTable extends Migration
$table->unsignedBigInteger('authorized_by_id');
$table->string('authorized_by_name');
$table->date('operation_date');
$table->string('operation_name');
$table->enum('processed', [
'No',
'Yes',

View File

@@ -26,4 +26,40 @@
</div>
</div>
</div>
<br>
<div class="container">
<div class="card">
<div class="card-header">
<h2>Current Alliance Mining Operations</h2>
</div>
<div class="card-body">
<table class="table table-bordered table-striped">
<thead>
<th>Operation Date</th>
<th>Operation Name</th>
<th>Structure Name</th>
<th>Authorized By</th>
</thead>
<tbody>
@if($operations != null)
@foreach($operations as $operation)
<tr>
<td>$operation->operation_date</td>
<td>$operation->operation_name</td>
<td>$operation->structure_name</td>
<td>$operation->authorized_by_name</td>
</tr>
@endforeach
@else
<tr>
<td></td>
<td></td>
<td></td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
@endsection