106 lines
6.1 KiB
PHP
106 lines
6.1 KiB
PHP
@extends('layouts.app')
|
|
@section('title', __('accounting::lang.exchange_rates'))
|
|
@section('content')
|
|
@include('accounting::layouts.nav')
|
|
<section class="content-header"><h1>@lang('accounting::lang.exchange_rates')</h1></section>
|
|
<section class="content">
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<div class="box box-primary">
|
|
<div class="box-header with-border"><h3 class="box-title">@lang('accounting::lang.add_exchange_rate')</h3></div>
|
|
<form action="{{ route('accounting.storeExchangeRate') }}" method="POST" class="box-body">
|
|
@csrf
|
|
<div class="form-group">
|
|
<label>@lang('accounting::lang.from_currency')</label>
|
|
<input name="from_currency" class="form-control" maxlength="10" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>@lang('accounting::lang.to_currency')</label>
|
|
<input name="to_currency" value="{{ $base_currency_code }}" class="form-control" maxlength="10" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>@lang('accounting::lang.rate')</label>
|
|
<input name="rate" type="number" step="0.000001" min="0.000001" class="form-control" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>@lang('accounting::lang.rate_date')</label>
|
|
<input name="rate_date" type="date" value="{{ now()->toDateString() }}" class="form-control" required>
|
|
</div>
|
|
<button class="btn btn-primary">@lang('messages.save')</button>
|
|
</form>
|
|
</div>
|
|
<div class="box box-warning">
|
|
<div class="box-header with-border"><h3 class="box-title">@lang('accounting::lang.fx_api_settings')</h3></div>
|
|
<form action="{{ route('accounting.saveExchangeRateSettings') }}" method="POST" class="box-body">
|
|
@csrf
|
|
<div class="form-group">
|
|
<label>
|
|
<input type="checkbox" name="fx_api_enabled" value="1" @if(!empty($accounting_settings['fx_api_enabled'])) checked @endif>
|
|
@lang('accounting::lang.fx_api_enabled')
|
|
</label>
|
|
<p class="help-block">@lang('accounting::lang.fx_api_enabled_help')</p>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>@lang('accounting::lang.fx_api_provider')</label>
|
|
<select name="fx_api_provider" class="form-control">
|
|
@foreach($fx_providers as $key => $label)
|
|
<option value="{{ $key }}" @if(($accounting_settings['fx_api_provider'] ?? 'open_er_api') === $key) selected @endif>{{ $label }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>@lang('accounting::lang.fx_api_key')</label>
|
|
<input type="text" name="fx_api_key" value="{{ $accounting_settings['fx_api_key'] ?? '' }}" class="form-control" placeholder="@lang('accounting::lang.fx_api_key_optional')">
|
|
</div>
|
|
<button class="btn btn-default">@lang('messages.save')</button>
|
|
</form>
|
|
</div>
|
|
<div class="box box-info">
|
|
<div class="box-body">
|
|
<p>@lang('accounting::lang.base_currency_code'): <strong>{{ $base_currency_code }}</strong></p>
|
|
<form action="{{ route('accounting.syncExchangeRates') }}" method="POST">
|
|
@csrf
|
|
<input type="hidden" name="rate_date" value="{{ now()->toDateString() }}">
|
|
<button class="btn btn-success btn-block">@lang('accounting::lang.sync_exchange_rates_now')</button>
|
|
</form>
|
|
<p class="help-block" style="margin-top:10px;">@lang('accounting::lang.sync_exchange_rates_help')</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-8">
|
|
<div class="box box-default">
|
|
<div class="box-header with-border"><h3 class="box-title">@lang('accounting::lang.exchange_rate_history')</h3></div>
|
|
<div class="box-body table-responsive">
|
|
<table class="table table-bordered table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>@lang('accounting::lang.rate_date')</th>
|
|
<th>@lang('accounting::lang.from_currency')</th>
|
|
<th>@lang('accounting::lang.to_currency')</th>
|
|
<th>@lang('accounting::lang.rate')</th>
|
|
<th>@lang('accounting::lang.rate_type')</th>
|
|
<th>@lang('lang_v1.source')</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($rates as $rate)
|
|
<tr>
|
|
<td>{{ optional($rate->rate_date)->format('Y-m-d') }}</td>
|
|
<td>{{ $rate->from_currency }}</td>
|
|
<td>{{ $rate->to_currency }}</td>
|
|
<td>{{ number_format($rate->rate, 6) }}</td>
|
|
<td>{{ $rate->rate_type ?? 'manual' }}</td>
|
|
<td>{{ $rate->source }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="6" class="text-center">@lang('lang_v1.no_data')</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
@endsection
|