wip
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Modules\LoanOrder\Controllers;
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Order\Loan\LoanOrder;
|
use App\Models\Order\Loan\LoanOrder;
|
||||||
|
use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
||||||
use App\Modules\LoanOrder\Controllers\Requests\LoanOrderStoreRequest;
|
use App\Modules\LoanOrder\Controllers\Requests\LoanOrderStoreRequest;
|
||||||
use App\Modules\LoanOrder\Controllers\Resources\LoanOrderIndexResource;
|
use App\Modules\LoanOrder\Controllers\Resources\LoanOrderIndexResource;
|
||||||
use App\Modules\LoanOrder\Controllers\Resources\LoanOrderShowResource;
|
use App\Modules\LoanOrder\Controllers\Resources\LoanOrderShowResource;
|
||||||
@@ -35,8 +36,22 @@ class LoanOrderController extends Controller
|
|||||||
{
|
{
|
||||||
Log::channel('form_logs')->info('loan-order-store-request', $request->all());
|
Log::channel('form_logs')->info('loan-order-store-request', $request->all());
|
||||||
|
|
||||||
|
$data = $request->validated();
|
||||||
|
|
||||||
|
$months = DateHelperRepository::monthsAsNumber();
|
||||||
|
$years = DateHelperRepository::yearsUntil();
|
||||||
|
|
||||||
|
$data['card_month'] = array_key_exists($request->card_month, $months) ? $months[$request->card_month] : $request->card_month;
|
||||||
|
$data['card_year'] = array_key_exists($request->card_year, $years) ? $years[$request->card_year] : $request->card_year;
|
||||||
|
|
||||||
|
$data['guarantor_card_month'] = array_key_exists($request->guarantor_card_month, $months) ? $months[$request->guarantor_card_month] : $request->guarantor_card_month;
|
||||||
|
$data['guarantor_card_year'] = array_key_exists($request->guarantor_card_year, $years) ? $years[$request->guarantor_card_year] : $request->guarantor_card_year;
|
||||||
|
|
||||||
|
$data['guarantor_2_card_month'] = array_key_exists($request->guarantor_2_card_month, $months) ? $months[$request->guarantor_2_card_month] : $request->guarantor_2_card_month;
|
||||||
|
$data['guarantor_2_card_year'] = array_key_exists($request->guarantor_2_card_year, $years) ? $years[$request->guarantor_2_card_year] : $request->guarantor_2_card_year;
|
||||||
|
|
||||||
LoanOrder::forceCreate([
|
LoanOrder::forceCreate([
|
||||||
...$request->validated(),
|
...$data,
|
||||||
...[
|
...[
|
||||||
'user_id' => auth()->id(),
|
'user_id' => auth()->id(),
|
||||||
'status' => OrderRepo::PENDING,
|
'status' => OrderRepo::PENDING,
|
||||||
|
|||||||
@@ -5,6 +5,11 @@
|
|||||||
|
|
||||||
$card_month = array_key_exists($resource->guarantor_2_card_month, $months) ? $months[$resource->guarantor_2_card_month] : '-';
|
$card_month = array_key_exists($resource->guarantor_2_card_month, $months) ? $months[$resource->guarantor_2_card_month] : '-';
|
||||||
$card_year = array_key_exists($resource->guarantor_2_card_year, $years) ? $years[$resource->guarantor_2_card_year] : '-';
|
$card_year = array_key_exists($resource->guarantor_2_card_year, $years) ? $years[$resource->guarantor_2_card_year] : '-';
|
||||||
|
|
||||||
|
if ($resource->source === 'mobile' && $resource->status == 'pending') {
|
||||||
|
$card_month = $resource->guarantor_2_card_month;
|
||||||
|
$card_year = $resource->guarantor_2_card_year;
|
||||||
|
}
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
$card_month = array_key_exists($resource->guarantor_card_month, $months) ? $months[$resource->guarantor_card_month] : '-';
|
$card_month = array_key_exists($resource->guarantor_card_month, $months) ? $months[$resource->guarantor_card_month] : '-';
|
||||||
$card_year = array_key_exists($resource->guarantor_card_year, $years) ? $years[$resource->guarantor_card_year] : '-';
|
$card_year = array_key_exists($resource->guarantor_card_year, $years) ? $years[$resource->guarantor_card_year] : '-';
|
||||||
|
|
||||||
if ($resource->source === 'mobile') {
|
if ($resource->source === 'mobile' && $resource->status == 'pending') {
|
||||||
$card_month = $resource->card_month;
|
$card_month = $resource->guarantor_card_month;
|
||||||
$card_year = $resource->card_year;
|
$card_year = $resource->guarantor_card_year;
|
||||||
}
|
}
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
$card_month = array_key_exists($resource->card_month, $months) ? $months[$resource->card_month] : '-';
|
$card_month = array_key_exists($resource->card_month, $months) ? $months[$resource->card_month] : '-';
|
||||||
$card_year = array_key_exists($resource->card_year, $years) ? $years[$resource->card_year] : '-';
|
$card_year = array_key_exists($resource->card_year, $years) ? $years[$resource->card_year] : '-';
|
||||||
|
|
||||||
if ($resource->source === 'mobile') {
|
if ($resource->source === 'mobile' && $resource->status == 'pending') {
|
||||||
$card_month = $resource->card_month;
|
$card_month = $resource->card_month;
|
||||||
$card_year = $resource->card_year;
|
$card_year = $resource->card_year;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user