mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Remove code no longer used.
This commit is contained in:
parent
0dc188b083
commit
0dd7ecbfbe
@ -15,7 +15,6 @@ namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Support\Amount;
|
||||
use FireflyIII\Support\ExpandedForm;
|
||||
use FireflyIII\Support\ExpandedMultiForm;
|
||||
use FireflyIII\Support\FireflyConfig;
|
||||
use FireflyIII\Support\Navigation;
|
||||
use FireflyIII\Support\Preferences;
|
||||
@ -93,11 +92,6 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
return new ExpandedForm;
|
||||
}
|
||||
);
|
||||
$this->app->bind(
|
||||
'expandedmultiform', function () {
|
||||
return new ExpandedMultiForm;
|
||||
}
|
||||
);
|
||||
|
||||
$this->app->bind('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface', 'FireflyIII\Repositories\Currency\CurrencyRepository');
|
||||
$this->app->bind('FireflyIII\Support\Search\SearchInterface', 'FireflyIII\Support\Search\Search');
|
||||
|
@ -1,188 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ExpandedMultiForm.php
|
||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This software may be modified and distributed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Support;
|
||||
|
||||
use Amount as Amt;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Input;
|
||||
use RuntimeException;
|
||||
use Session;
|
||||
|
||||
/**
|
||||
* Class ExpandedMultiForm
|
||||
*
|
||||
* @package FireflyIII\Support
|
||||
*/
|
||||
class ExpandedMultiForm
|
||||
{
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int $index
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function amount(string $name, int $index, $value = null, array $options = []): string
|
||||
{
|
||||
$label = $this->label($name, $options);
|
||||
$options = $this->expandOptionArray($name, $index, $label, $options);
|
||||
$classes = $this->getHolderClasses($name, $index);
|
||||
$value = $this->fillFieldValue($name, $index, $value);
|
||||
$options['step'] = 'any';
|
||||
$options['min'] = '0.01';
|
||||
$defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency();
|
||||
$currencies = Amt::getAllCurrencies();
|
||||
$options['data-hiddenfield'] = 'amount_currency_id_' . $name . '_' . $index;
|
||||
unset($options['currency']);
|
||||
unset($options['placeholder']);
|
||||
$html = view('form.multi.amount', compact('defaultCurrency', 'index', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int $index
|
||||
* @param array $list
|
||||
* @param null $selected
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function select(string $name, int $index, array $list = [], $selected = null, array $options = []): string
|
||||
{
|
||||
$label = $this->label($name, $options);
|
||||
$options = $this->expandOptionArray($name, $index, $label, $options);
|
||||
$classes = $this->getHolderClasses($name, $index);
|
||||
$selected = $this->fillFieldValue($name, $index, $selected);
|
||||
unset($options['autocomplete']);
|
||||
unset($options['placeholder']);
|
||||
$html = view('form.multi.select', compact('classes', 'index', 'name', 'label', 'selected', 'options', 'list'))->render();
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int $index
|
||||
* @param null $value
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function text(string $name, int $index, $value = null, array $options = []): string
|
||||
{
|
||||
$label = $this->label($name, $options);
|
||||
$options = $this->expandOptionArray($name, $index, $label, $options);
|
||||
$classes = $this->getHolderClasses($name, $index);
|
||||
$value = $this->fillFieldValue($name, $index, $value);
|
||||
$html = view('form.multi.text', compact('classes', 'name', 'index', 'label', 'value', 'options'))->render();
|
||||
|
||||
return $html;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int $index
|
||||
* @param string $label
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function expandOptionArray(string $name, int $index, string $label, array $options): array
|
||||
{
|
||||
$options['class'] = 'form-control';
|
||||
$options['id'] = 'ffInput_' . $name . '_' . $index;
|
||||
$options['autocomplete'] = 'off';
|
||||
$options['placeholder'] = ucfirst($label);
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int $index
|
||||
* @param $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function fillFieldValue(string $name, int $index, $value)
|
||||
{
|
||||
if (Session::has('preFilled')) {
|
||||
$preFilled = session('preFilled');
|
||||
$value = isset($preFilled[$name][$index]) && is_null($value) ? $preFilled[$name][$index] : $value;
|
||||
}
|
||||
try {
|
||||
if (!is_null(Input::old($name)[$index])) {
|
||||
$value = Input::old($name)[$index];
|
||||
}
|
||||
} catch (RuntimeException $e) {
|
||||
// don't care about session errors.
|
||||
}
|
||||
if ($value instanceof Carbon) {
|
||||
$value = $value->format('Y-m-d');
|
||||
}
|
||||
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int $index
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getHolderClasses(string $name, int $index): string
|
||||
{
|
||||
/*
|
||||
* Get errors from session:
|
||||
*/
|
||||
/** @var MessageBag $errors */
|
||||
$errors = session('errors');
|
||||
$classes = 'form-group';
|
||||
$set = [];
|
||||
|
||||
if (!is_null($errors)) {
|
||||
$set = $errors->get($name . '.' . $index);
|
||||
}
|
||||
|
||||
if (!is_null($errors) && count($set) > 0) {
|
||||
$classes = 'form-group has-error has-feedback';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function label(string $name, array $options): string
|
||||
{
|
||||
if (isset($options['label'])) {
|
||||
return $options['label'];
|
||||
}
|
||||
|
||||
return strval(trans('form.' . $name));
|
||||
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* ExpandedMultiForm.php
|
||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This software may be modified and distributed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Support\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
* Class Amount
|
||||
*
|
||||
* @package FireflyIII\Support\Facades
|
||||
*/
|
||||
class ExpandedMultiForm extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor(): string
|
||||
{
|
||||
return 'expandedmultiform';
|
||||
}
|
||||
|
||||
}
|
@ -267,7 +267,6 @@ return [
|
||||
'Amount' => 'FireflyIII\Support\Facades\Amount',
|
||||
'Steam' => 'FireflyIII\Support\Facades\Steam',
|
||||
'ExpandedForm' => 'FireflyIII\Support\Facades\ExpandedForm',
|
||||
'ExpandedMultiForm' => 'FireflyIII\Support\Facades\ExpandedMultiForm',
|
||||
'Entrust' => 'Zizaco\Entrust\EntrustFacade',
|
||||
'Input' => 'Illuminate\Support\Facades\Input',
|
||||
'Google2FA' => 'PragmaRX\Google2FA\Vendor\Laravel\Facade',
|
||||
|
@ -162,11 +162,6 @@ return [
|
||||
'multiRadio', 'file', 'multiCheckbox', 'staticText', 'amountSmall',
|
||||
],
|
||||
],
|
||||
'ExpandedMultiForm' => [
|
||||
'is_safe' => [
|
||||
'text','select','amount'
|
||||
],
|
||||
],
|
||||
'Form' => [
|
||||
'is_safe' => [
|
||||
'input', 'select', 'checkbox', 'model', 'open', 'radio', 'textarea', 'file',
|
||||
|
@ -5,9 +5,6 @@ $(function () {
|
||||
// when you click on a currency, this happens:
|
||||
$('.currency-option').click(currencySelect);
|
||||
|
||||
// when you click on a multi currency, this happens:
|
||||
$('.multi-currency-option').click(multiCurrencySelect);
|
||||
|
||||
var ranges = {};
|
||||
ranges[dateRangeConfig.currentPeriod] = [moment(dateRangeConfig.ranges.current[0]), moment(dateRangeConfig.ranges.current[1])];
|
||||
ranges[dateRangeConfig.previousPeriod] = [moment(dateRangeConfig.ranges.previous[0]), moment(dateRangeConfig.ranges.previous[1])];
|
||||
@ -60,47 +57,6 @@ $(function () {
|
||||
|
||||
});
|
||||
|
||||
function multiCurrencySelect(e) {
|
||||
"use strict";
|
||||
// clicked on
|
||||
var target = $(e.target); // target is the <A> tag.
|
||||
|
||||
// name of the field in question:
|
||||
var name = target.data('name');
|
||||
|
||||
// index of the field in question:
|
||||
var index = target.data('index');
|
||||
console.log('name is ' + name + ':' + index);
|
||||
|
||||
// id of menu button (used later on):
|
||||
var menuID = 'currency_dropdown_' + name + '_' + index;
|
||||
|
||||
// the hidden input with the actual value of the selected currency:
|
||||
var hiddenInputName = 'amount_currency_id_' + name + '_' + index;
|
||||
console.log('Looking for hidden input: ' + hiddenInputName);
|
||||
|
||||
// span with the current selection (next to the caret):
|
||||
var spanId = 'currency_select_symbol_' + name + '_' + index;
|
||||
|
||||
// the selected currency symbol:
|
||||
var symbol = target.data('symbol');
|
||||
|
||||
// id of the selected currency.
|
||||
var id = target.data('id');
|
||||
|
||||
// update the hidden input:
|
||||
$('input[name="' + hiddenInputName + '"]').val(id);
|
||||
|
||||
// update the symbol:
|
||||
$('#' + spanId).text(symbol);
|
||||
|
||||
// close the menu (hack hack)
|
||||
$('#' + menuID).click();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function currencySelect(e) {
|
||||
"use strict";
|
||||
// clicked on
|
||||
|
@ -1,30 +0,0 @@
|
||||
<div class="{{ classes }}" id="{{ name }}_{{ index }}_holder">
|
||||
<label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<div class="input-group-btn">
|
||||
<button type="button"
|
||||
class="btn btn-default dropdown-toggle currency-dropdown" id="currency_dropdown_{{ name }}_{{ index }}" data-toggle="dropdown"
|
||||
aria-expanded="false">
|
||||
<span id="currency_select_symbol_{{ name }}_{{ index }}">{{ defaultCurrency.symbol|raw }}</span> <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu currency-dropdown-menu" role="menu">
|
||||
{% for currency in currencies %}
|
||||
<li>
|
||||
<a href="#"
|
||||
class="multi-currency-option"
|
||||
data-id="{{ currency.id }}"
|
||||
data-name="{{ name }}"
|
||||
data-index="{{ index }}"
|
||||
data-currency="{{ currency.code }}"
|
||||
data-symbol="{{ currency.symbol|raw }}">{{ currency.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{{ Form.input('number', name~'['~index~']', value, options) }}
|
||||
</div>
|
||||
{% include 'form.multi.feedback.twig' %}
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="amount_currency_id_{{ name }}_{{ index }}" value="{{ defaultCurrency.id }}"/>
|
||||
</div>
|
@ -1,4 +0,0 @@
|
||||
{% if errors.has(name~'.'~index) %}
|
||||
<span class="form-control-feedback"><i class="fa fa-fw fa-remove"></i></span>
|
||||
<p class="text-danger">{{ errors.first(name~'.'~index) }}</p>
|
||||
{% endif %}
|
@ -1,10 +0,0 @@
|
||||
<div class="{{ classes }}" id="{{ name }}_{{ index }}_holder">
|
||||
<label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
{{ Form.select(name~'['~index~']', list, selected , options ) }}
|
||||
{% include 'form.help.twig' %}
|
||||
{% include 'form.multi.feedback.twig' %}
|
||||
|
||||
</div>
|
||||
</div>
|
@ -1,9 +0,0 @@
|
||||
<div class="{{ classes }}" id="{{ name }}_{{ index }}_holder">
|
||||
<label for="{{ options.id }}" class="col-sm-4 control-label">{{ label }}</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
{{ Form.input('text', name~'['~index~']', value, options) }}
|
||||
{% include 'form/help.twig' %}
|
||||
{% include 'form.multi.feedback.twig' %}
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user