Rates, Build
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 12s

This commit is contained in:
2023-12-04 20:04:46 +01:00
parent aff90ceb86
commit 148a010f4d
8 changed files with 99 additions and 18 deletions

View File

@@ -15,4 +15,4 @@ jobs:
run: | run: |
ls /var/www/html ls /var/www/html
- run: echo "🍏 This job's status is ${{ job.status }}." - run: echo "🍏 This job's status is ${{ job.status }}."
- uses: actions/checkout@v3 - uses: actions/checkout@v2

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\CurrencyRates;
class CurrencyRatesController extends Controller
{
public function index()
{
return CurrencyRates::all();
}
}

View File

@@ -1,3 +1,4 @@
<?php <?php
namespace App\Models; namespace App\Models;

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class CurrencyRates extends Model
{
use HasFactory;
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'v_currency';
/**
* The primary key associated with the table.
*
* @var string
*/
protected $primaryKey = 'currency';
/**
* Indicates if the model's ID is auto-incrementing.
*
* @var bool
*/
public $incrementing = false;
use HasFactory;
protected function actual(String $status)
{
return $this->get();
}
}

View File

@@ -96,5 +96,6 @@
"referenceerror: ccount is not defined": "ReferenceError: ccount is not defined", "referenceerror: ccount is not defined": "ReferenceError: ccount is not defined",
"referenceerror: currency_code is not defined": "ReferenceError: currency_code is not defined", "referenceerror: currency_code is not defined": "ReferenceError: currency_code is not defined",
"referenceerror: assignment to undeclared variable acntry": "ReferenceError: assignment to undeclared variable aCntry", "referenceerror: assignment to undeclared variable acntry": "ReferenceError: assignment to undeclared variable aCntry",
"referenceerror: _code is not defined": "ReferenceError: _code is not defined" "referenceerror: _code is not defined": "ReferenceError: _code is not defined",
"referenceerror: acntry is not defined": "ReferenceError: aCntry is not defined"
} }

View File

@@ -19,20 +19,19 @@ defineExpose({ focus: () => input.value.focus() });
</script> </script>
<template> <template>
<form> <div class="flex items-center max-w-md mx-auto bg-white rounded-md">
<div class="flex items-center justify-center"> <div class="w-full">
<div class="flex border-2 rounded"> <input type="search" class="border-0 w-full px-4 py-1 text-gray-800 rounded-full focus:outline-none focus:ring-0"
<input type="text" class="px-4 py-2 w-80" placeholder="search" x-model="search">
:value="modelValue" </div>
@input="$emit('update:modelValue', $event.target.value)" placeholder="Search..."> <div>
<button class="flex items-center justify-center px-4 border-l bg-slate-500"> <button type="submit" class="flex items-center bg-blue-500 justify-center w-12 h-12 text-white rounded-r-md">
<svg class="w-6 h-6 text-white" fill="currentColor" xmlns="http://www.w3.org/2000/svg" <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"
viewBox="0 0 24 24"> xmlns="http://www.w3.org/2000/svg">
<path <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M16.32 14.9l5.39 5.4a1 1 0 0 1-1.42 1.4l-5.38-5.38a8 8 0 1 1 1.41-1.41zM10 16a6 6 0 1 0 0-12 6 6 0 0 0 0 12z" /> d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
</svg> </svg>
</button> </button>
</div> </div>
</div> </div>
</form>
</template> </template>

View File

@@ -25,6 +25,12 @@ const ccountry_filter = ref([['Country'],]);
const ccountry_list = ref(['TEST']); const ccountry_list = ref(['TEST']);
const selected = ref(null); const selected = ref(null);
const article = ref(''); const article = ref('');
const hrates = ref([
{ text: "Currency", value: "currency", sortable: true},
{ text: "Country", value: "country_name", sortable: true},
{ text: "Rate", value: "rate", sortable: true}
]);
const rates = ref([]);
const options = { const options = {
region: 150, region: 150,
@@ -72,6 +78,24 @@ const fetch = async () => {
} }
} }
const fetch_rates = async () => {
try {
const response = await axios.get(route('rates.index'))
rates.value = response.data;
console.log("RATE=", rates.value);
} catch (e) {
const response = await Swal.fire({
title: __('are you want to try again') + '?',
text: __(`${e}`),
icon: 'question',
showCancelButton: true,
showCloseButton: true,
})
response.isConfirmed && fetch()
}
}
const headers = ref([ const headers = ref([
{ text: "Id", value: "id", sortable: true }, { text: "Id", value: "id", sortable: true },
{ text: "Country", value: "country", sortable: true }, { text: "Country", value: "country", sortable: true },
@@ -88,6 +112,7 @@ function selectCountry(item, id) {
} }
onMounted(fetch); onMounted(fetch);
onMounted(fetch_rates);
</script> </script>
<template> <template>
@@ -138,7 +163,9 @@ onMounted(fetch);
<div class="mt-5"> <div class="mt-5">
<EasyTable :rows-per-page=10 :headers="headers" :items="items"></EasyTable> <EasyTable :rows-per-page=10 :headers="headers" :items="items"></EasyTable>
</div> </div>
<div class="mt-5">
<EasyTable :rows-per-page=15 :headers="hrates" :items="rates"></EasyTable>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -4,6 +4,7 @@ use Illuminate\Support\Facades\Route;
use Inertia\Inertia; use Inertia\Inertia;
use App\Http\Controllers\CountryCodeController; use App\Http\Controllers\CountryCodeController;
use App\Http\Controllers\CountryCompareController; use App\Http\Controllers\CountryCompareController;
use App\Http\Controllers\CurrencyRatesController;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Web Routes | Web Routes
@@ -22,6 +23,8 @@ Route::get('/', function () {
Route::get('/ccountry/', [CountryCodeController::class, 'index'])->name('ccountry.index'); Route::get('/ccountry/', [CountryCodeController::class, 'index'])->name('ccountry.index');
Route::get('/ccountry/active/', [CountryCodeController::class, 'active'])->name('ccountry.active'); Route::get('/ccountry/active/', [CountryCodeController::class, 'active'])->name('ccountry.active');
Route::get('/search/{id}',[CountryCompareController::class,'search'])->name('ccompare.search'); Route::get('/search/{id}',[CountryCompareController::class,'search'])->name('ccompare.search');
Route::get('/rates/', [CurrencyRatesController::class, 'index'])->name('rates.index');
Route::middleware(['auth:sanctum', config('jetstream.auth_session'), 'verified'])->group(function () { Route::middleware(['auth:sanctum', config('jetstream.auth_session'), 'verified'])->group(function () {
// Route::get('/', function () { // Route::get('/', function () {