diff --git a/app/Http/Controllers/MiningTaxes/MiningTaxesAdminController.php b/app/Http/Controllers/MiningTaxes/MiningTaxesAdminController.php index e11ee90d3..15f037d41 100644 --- a/app/Http/Controllers/MiningTaxes/MiningTaxesAdminController.php +++ b/app/Http/Controllers/MiningTaxes/MiningTaxesAdminController.php @@ -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; diff --git a/app/Models/MiningTax/MiningOperation.php b/app/Models/MiningTax/MiningOperation.php index 1595d4c6f..d8506766b 100644 --- a/app/Models/MiningTax/MiningOperation.php +++ b/app/Models/MiningTax/MiningOperation.php @@ -27,6 +27,7 @@ class MiningOperation extends Model 'authorized_by_id', 'authorized_by_name', 'operation_date', + 'operation_name', 'processed', 'processed_on', ]; diff --git a/database/migrations/2021_06_01_151828_create_mining_tax_mining_operations_table.php b/database/migrations/2021_06_01_151828_create_mining_tax_mining_operations_table.php index 595f88d56..eef72894e 100644 --- a/database/migrations/2021_06_01_151828_create_mining_tax_mining_operations_table.php +++ b/database/migrations/2021_06_01_151828_create_mining_tax_mining_operations_table.php @@ -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', diff --git a/resources/views/miningtax/admin/display/miningops/form.blade.php b/resources/views/miningtax/admin/display/miningops/form.blade.php index c4a0a55d2..e214eaad3 100644 --- a/resources/views/miningtax/admin/display/miningops/form.blade.php +++ b/resources/views/miningtax/admin/display/miningops/form.blade.php @@ -26,4 +26,40 @@ +
+
+
+
+

Current Alliance Mining Operations

+
+
+ + + + + + + + + @if($operations != null) + @foreach($operations as $operation) + + + + + + + @endforeach + @else + + + + + + @endif + +
Operation DateOperation NameStructure NameAuthorized By
$operation->operation_date$operation->operation_name$operation->structure_name$operation->authorized_by_name
+
+
+
@endsection \ No newline at end of file