This commit is contained in:
2024-10-01 23:11:03 +05:00
parent 87a1c2764d
commit 7095880f7a
6 changed files with 51 additions and 32 deletions

View File

@@ -3,7 +3,6 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
class FetchCardHistoryController extends Controller class FetchCardHistoryController extends Controller
{ {
@@ -16,14 +15,34 @@ class FetchCardHistoryController extends Controller
'card_expiry_date' => ['required', 'string', 'max:255'], 'card_expiry_date' => ['required', 'string', 'max:255'],
]); ]);
$response = Http::withBody('{ $curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'http://10.3.158.102:9999/api/clientinfo',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"idSeria": "I-AS", "idSeria": "I-AS",
"idNo": "314567", "idNo": "314567",
"cardMaskNumber":"993403******3258", "clientType": "recipient",
"cardMaskNumber": "993403******3258",
"expDate": "07/49" "expDate": "07/49"
"clientType":"recipient", }',
}')->acceptJson()->post('http://10.3.158.102:9999/api/clientinfo'); CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Content-Type: application/json',
],
]);
return $response->body(); $response = curl_exec($curl);
curl_close($curl);
return $response;
} }
} }

View File

@@ -25,7 +25,6 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\Gate;
use Laravel\Nova\Fields\Date; use Laravel\Nova\Fields\Date;
use Laravel\Nova\Fields\Email; use Laravel\Nova\Fields\Email;
use Laravel\Nova\Fields\Heading;
use Laravel\Nova\Fields\Hidden; use Laravel\Nova\Fields\Hidden;
use Laravel\Nova\Fields\ID; use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Image; use Laravel\Nova\Fields\Image;

View File

@@ -93,7 +93,7 @@ class LoanOrderMobileFieldsForDetail
new Panel(__('Card'), [ new Panel(__('Card'), [
NovaCustomHtml::make(__('Data'), 'card_name') NovaCustomHtml::make(__('Data'), 'card_name')
->html(view('orders.loan.mobile.card-history', [ ->html(view('orders.loan.mobile.card-history', [
'resource' => $resource 'resource' => $resource,
])->render()) ])->render())
->fillUsing(NovaForm::fillEmpty()), ->fillUsing(NovaForm::fillEmpty()),
]), ]),

View File

@@ -7,7 +7,7 @@ use Laravel\Nova\Fields\SupportsDependentFields;
class NovaCustomHtml extends Field class NovaCustomHtml extends Field
{ {
use SupportsDependentFields; use SupportsDependentFields;
/** /**
* The field's component. * The field's component.
@@ -46,7 +46,8 @@ class NovaCustomHtml extends Field
/** /**
* Hide * Hide
* @param bool|boolean *
* @param bool|bool
*/ */
public function hidden(bool $hidden = true): self public function hidden(bool $hidden = true): self
{ {

View File

@@ -27,33 +27,34 @@ async function fetchCardHistory(passport_serie, passport_id, card_number, card_e
}) })
.then(response => response.json()) .then(response => response.json())
.then(result => { .then(result => {
console.log({result: result})
if (result.errCode != 0) { if (result.errCode != 0) {
Nova.error('Barlap bolmady, tor näsazlygy') Nova.error('Barlap bolmady, tor näsazlygy')
} }
cardHistoryDetailContainer.innerHTML = ` // cardHistoryDetailContainer.innerHTML = `
<h4 class="mb-4">Şahamça: <strong>${result.depName}, </strong></h4> // <h4 class="mb-4">Şahamça: <strong>${result.depName}, </strong></h4>
<p> // <p>
<ul> // <ul>
${Array.from(result.transactions).map(transaction => { // ${Array.from(result.transactions).map(transaction => {
return `<li style="background: #a3c1f5;color: black;" class="p-3 relative rounded-lg"> // return `<li style="background: #a3c1f5;color: black;" class="p-3 relative rounded-lg">
<strong>${transaction['actionName']}</strong> <strong>${transaction['opersum']}</strong> <strong>${transaction['currency']}</strong> // <strong>${transaction['actionName']}</strong> <strong>${transaction['opersum']}</strong> <strong>${transaction['currency']}</strong>
<strong style="top: 0; right: 0;" class="absolute p-2">${transaction['opername']}</strong> // <strong style="top: 0; right: 0;" class="absolute p-2">${transaction['opername']}</strong>
<p><strong>${ // <p><strong>${
new Date(transaction['trandate']).toLocaleDateString('en-GB', { // new Date(transaction['trandate']).toLocaleDateString('en-GB', {
year: 'numeric', // year: 'numeric',
month: '2-digit', // month: '2-digit',
day: '2-digit', // day: '2-digit',
}).replaceAll('/', '.') // }).replaceAll('/', '.')
}</strong></p> // }</strong></p>
</li>`; // </li>`;
})} // })}
</ul> // </ul>
</p> // </p>
`; // `;
}) })
.catch(error => console.log('error', error)); .catch(error => console.log('error', error));
} }

View File

@@ -3,7 +3,6 @@
use App\Http\Controllers\Auth\LoginController; use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\Auth\RegisterController; use App\Http\Controllers\Auth\RegisterController;
use App\Http\Controllers\Auth\ResetPasswordController; use App\Http\Controllers\Auth\ResetPasswordController;
use App\Http\Controllers\FetchCardHistoryController;
use App\Http\Controllers\LocaleController; use App\Http\Controllers\LocaleController;
use App\Http\Controllers\OnlinePaymentController; use App\Http\Controllers\OnlinePaymentController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
@@ -39,7 +38,7 @@ Route::middleware(['auth', 'unVerified'])->group(function () {
Route::get('online-payment-store', [OnlinePaymentController::class, 'store'])->name('online-payment-store'); Route::get('online-payment-store', [OnlinePaymentController::class, 'store'])->name('online-payment-store');
Route::get('online-payment-store-visa-master', [ Route::get('online-payment-store-visa-master', [
OnlinePaymentController::class, 'visaMaster' OnlinePaymentController::class, 'visaMaster',
])->name('online-payment-store-visa-master'); ])->name('online-payment-store-visa-master');
Route::redirect('/', config('nova.path')); Route::redirect('/', config('nova.path'));