Merge branch 'nabeelio:dev' into dev

This commit is contained in:
Kai Ming 2022-11-28 13:30:13 +08:00 committed by GitHub
commit f8477e315c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 20 deletions

View File

@ -33,7 +33,7 @@ class Money
/**
* Create from a dollar amount
*
* @param mixed $amount The amount in pennies
* @param mixed $amount The amount in dollar
*
* @throws \UnexpectedValueException
* @throws \InvalidArgumentException
@ -52,12 +52,12 @@ class Money
*
* @param mixed $amount
*
* @return float|int
* @return int
*/
public static function convertToSubunit($amount)
{
$currency = setting('units.currency', 'USD');
return (int) $amount * config('money.'.$currency.'.subunit');
return (int) ($amount * config('money.'.$currency.'.subunit'));
}
/**

View File

@ -270,7 +270,7 @@
<div class="row">
<!-- Active Field -->
<div class="col-sm-4">
<div class="col-sm-3">
<div class="checkbox">
<label class="checkbox-inline">
{{ Form::label('active', 'Active:') }}
@ -279,7 +279,17 @@
</label>
</div>
</div>
<div class="col-8">
<!-- Visible Field -->
<div class="col-sm-3">
<div class="checkbox">
<label class="checkbox-inline">
{{ Form::label('visible', 'Visible:') }}
<input name="visible" type="hidden" value="0" />
{{ Form::checkbox('visible') }}
</label>
</div>
</div>
<div class="col-6">
<div class="text-right">
{{ Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-info']) }}
</div>

View File

@ -9,6 +9,7 @@
<th>Arr Time</th>
<th>Notes</th>
<th style="text-align: center;">Active</th>
<th style="text-align: center;">Visible</th>
<th colspan="3" style="text-align: right;">Action</th>
</thead>
<tbody>
@ -37,6 +38,13 @@
<span class="label label-default">@lang('common.inactive')</span>
@endif
</td>
<td style="text-align: center;">
@if($flight->visible == 1)
<span class="text-success"><i class="fas fa-check fa2x" title="Visible"></i></span>
@else
<span class="text-danger"><i class="fas fa-times fa2x" title="Hidden"></i></span>
@endif
</td>
<td style="text-align: right;">
{{ Form::open(['route' => ['admin.flights.destroy', $flight->id], 'method' => 'delete']) }}
<a href="{{ route('admin.flights.edit', [$flight->id]) }}" class='btn btn-sm btn-success btn-icon'><i

View File

@ -72,6 +72,7 @@
</div>
</div>
@if(!empty($pirep->distance))
<div class="row">
<div class="col-12">
<div class="progress" style="margin: 20px 0;">
@ -82,6 +83,7 @@
</div>
</div>
</div>
@endif
<div class="row">
<div class="col-12">

View File

@ -712,20 +712,20 @@ class FinanceTest extends TestCase
$journalRepo->post(
$journal,
Money::createFromAmount(100),
Money::createFromAmount(100.5),
null,
$user
);
$balance = $journalRepo->getBalance($journal);
$this->assertEquals(100, $balance->getValue());
$this->assertEquals(100, $journal->balance->getValue());
$this->assertEquals(100.5, $balance->getValue());
$this->assertEquals(100.5, $journal->balance->getValue());
// add another transaction
$journalRepo->post(
$journal,
Money::createFromAmount(25),
Money::createFromAmount(24.5),
null,
$user
);
@ -912,7 +912,7 @@ class FinanceTest extends TestCase
// $this->assertCount(9, $transactions['transactions']);
$this->assertEquals(3020, $transactions['credits']->getValue());
$this->assertEquals(2050.0, $transactions['debits']->getValue());
$this->assertEquals(2050.4, $transactions['debits']->getValue());
// Check that all the different transaction types are there
// test by the different groups that exist
@ -967,7 +967,7 @@ class FinanceTest extends TestCase
// $this->assertCount(9, $transactions['transactions']);
$this->assertEquals(3020, $transactions['credits']->getValue());
$this->assertEquals(2050.0, $transactions['debits']->getValue());
$this->assertEquals(2050.4, $transactions['debits']->getValue());
// Check that all the different transaction types are there
// test by the different groups that exist
@ -1006,7 +1006,7 @@ class FinanceTest extends TestCase
$transactions = $journalRepo->getAllForObject($pirep2);
$this->assertEquals(3020, $transactions['credits']->getValue());
$this->assertEquals(2150.0, $transactions['debits']->getValue());
$this->assertEquals(2150.4, $transactions['debits']->getValue());
// Check that all the different transaction types are there
// test by the different groups that exist
@ -1115,6 +1115,6 @@ class FinanceTest extends TestCase
// $this->assertCount(9, $transactions['transactions']);
$this->assertEquals(3020, $transactions['credits']->getValue());
$this->assertEquals(2050.0, $transactions['debits']->getValue());
$this->assertEquals(2050.4, $transactions['debits']->getValue());
}
}