Skip to content

Firefly III: a personal finances manager

Expand some views.

James Cole133cb902253c
diff --git a/resources/assets/v1/src/components/webhooks/Create.vue b/resources/assets/v1/src/components/webhooks/Create.vue
index da997a05ad..e16417e98a 100644
--- a/resources/assets/v1/src/components/webhooks/Create.vue
+++ b/resources/assets/v1/src/components/webhooks/Create.vue
@@ -19,65 +19,7 @@
-->
<template>
- <form accept-charset="UTF-8" class="form-horizontal" enctype="multipart/form-data">
- <input name="_token" type="hidden" value="xxx">
- <div v-if="error_message !== ''" class="row">
- <div class="col-lg-12">
- <div class="alert alert-danger alert-dismissible" role="alert">
- <button class="close" data-dismiss="alert" type="button" v-bind:aria-label="$t('firefly.close')"><span
- aria-hidden="true">&times;</span></button>
- <strong>{{ $t("firefly.flash_error") }}</strong> {{ error_message }}
- </div>
- </div>
- </div>
-
- <div v-if="success_message !== ''" class="row">
- <div class="col-lg-12">
- <div class="alert alert-success alert-dismissible" role="alert">
- <button class="close" data-dismiss="alert" type="button" v-bind:aria-label="$t('firefly.close')"><span
- aria-hidden="true">&times;</span></button>
- <strong>{{ $t("firefly.flash_success") }}</strong> <span v-html="success_message"></span>
- </div>
- </div>
- </div>
-
- <div class="row">
- <div class="col-lg-6 col-md-12 col-sm-12">
- <div class="box box-primary">
- <div class="box-header with-border">
- <h3 class="box-title">
- {{ $t('firefly.create_new_webhook') }}
- </h3>
- </div>
- <div class="box-body">
- <div class="row">
- <div class="col-lg-12">
- <Title :value=this.title :error="errors.title" v-on:input="title = $event"></Title>
- <WebhookTrigger :value=this.triggers :error="errors.trigger"
- v-on:input="triggers = $event"></WebhookTrigger>
- <WebhookResponse :value=this.responses :error="errors.response"
- v-on:input="responses = $event"></WebhookResponse>
- <WebhookDelivery :value=this.deliveries :error="errors.delivery"
- v-on:input="deliveries = $event"></WebhookDelivery>
- <URL :value=this.url :error="errors.url" v-on:input="url = $event"></URL>
- <Checkbox :value=this.active :error="errors.active" help="ACTIVE HELP TODO" :title="$t('form.active')" v-on:input="active = $event"></Checkbox>
- </div>
- </div>
- </div>
- <div class="box-footer">
- <div class="btn-group">
- <button id="submitButton" ref="submitButton" class="btn btn-success" @click="submit">
- {{ $t('firefly.submit') }}
- </button>
- </div>
- <p class="text-success" v-html="success_message"></p>
- <p class="text-danger" v-html="error_message"></p>
- </div>
- </div>
- </div>
- </div>
- </form>
</template>
<script>
@@ -112,55 +54,7 @@ export default {
};
},
methods: {
- submit: function (e) {
- // reset messages
- this.error_message = '';
- this.success_message = '';
- this.errors = {
- title: [],
- triggers: [],
- responses: [],
- deliveries: [],
- url: [],
- active: [],
- };
-
- // disable button
- $('#submitButton').prop("disabled", true);
-
- // collect data
- let data = {
- title: this.title,
- triggers: this.triggers,
- responses: [this.responses],
- deliveries: [this.deliveries],
- url: this.url,
- active: this.active,
- };
- // post!
- axios.post('./api/v1/webhooks', data).then((response) => {
- //this.success_message = $.text(response.data.message);
- // console.log('Will now go to redirectUser()');
- let webhookId = response.data.data.id;
- window.location.href = window.previousUrl + '?webhook_id=' + webhookId + '&message=created';
- }).catch((error) => {
- //console.log(error.response.data);
- this.error_message = error.response.data.message;
- this.errors.title = error.response.data.errors.title;
- this.errors.triggers = error.response.data.errors.triggers;
- this.errors.responses = error.response.data.errors.responses;
- this.errors.deliveries = error.response.data.errors.deliveries;
- this.errors.url = error.response.data.errors.url;
-
- // enable button again
- $('#submitButton').prop("disabled", false);
-
- });
- if (e) {
- e.preventDefault();
- }
- }
},
}
</script>
diff --git a/resources/assets/v3/js/pages/administrations/edit.js b/resources/assets/v3/js/pages/administrations/edit.js
index fbe8fc68cb..dba0f7e1b2 100644
--- a/resources/assets/v3/js/pages/administrations/edit.js
+++ b/resources/assets/v3/js/pages/administrations/edit.js
@@ -94,8 +94,8 @@ let edit = function () {
e.preventDefault();
}
},
- hasError: function () {
- return this.errors.title.length > 0;
+ hasError: function (field) {
+ return this.errors[field].length > 0;
},
clearTitle: function () {
this.administration.title = '';
diff --git a/resources/assets/v3/js/pages/webhooks/create.js b/resources/assets/v3/js/pages/webhooks/create.js
new file mode 100644
index 0000000000..acd1ceac44
--- /dev/null
+++ b/resources/assets/v3/js/pages/webhooks/create.js
@@ -0,0 +1,133 @@
+/*
+ * dashboard.js
+ * Copyright (c) 2026 [email protected]
+ *
+ * This file is part of Firefly III (https://github.com/firefly-iii).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+import '../../boot/bootstrap.js';
+import sidebar from '../../pages/shared/sidebar.js';
+import dates from '../shared/dates.js';
+
+let create = function () {
+ return {
+ error_message: '',
+ success_message: '',
+ title: '',
+ triggers: ["STORE_TRANSACTION"],
+ responses: "RELEVANT",
+ deliveries: "JSON",
+ active: true,
+ url: '',
+ errors: {
+ title: [],
+ triggers: [],
+ responses: [],
+ deliveries: [],
+ url: [],
+ active: []
+ },
+ hasError: function (field) {
+ return this.errors[field].length > 0;
+ },
+ clearTitle: function () {
+ this.title = '';
+ },
+ handleInput() {
+ // this.$emit('input', this.administration.title);
+ },
+ init() {
+ console.log('Create webhook page.');
+ },
+ submit: function (e) {
+ // reset messages
+ this.error_message = '';
+ this.success_message = '';
+ this.errors = {
+ title: [],
+ triggers: [],
+ responses: [],
+ deliveries: [],
+ url: [],
+ active: [],
+ };
+
+ // disable button
+ document.getElementById('submitButton').disabled = true;
+
+ // collect data
+ let data = {
+ title: this.title,
+ triggers: this.triggers,
+ responses: [this.responses],
+ deliveries: [this.deliveries],
+ url: this.url,
+ active: this.active,
+ };
+
+ // post!
+ axios.post('./api/v1/webhooks', data).then((response) => {
+ //this.success_message = $.text(response.data.message);
+ // console.log('Will now go to redirectUser()');
+ let webhookId = response.data.data.id;
+ window.location.href = window.previousUrl + '?webhook_id=' + webhookId + '&message=created';
+ }).catch((error) => {
+ //console.log(error.response.data);
+ this.error_message = error.response.data.message;
+ this.errors.title = error.response.data.errors.title;
+ this.errors.triggers = error.response.data.errors.triggers;
+ this.errors.responses = error.response.data.errors.responses;
+ this.errors.deliveries = error.response.data.errors.deliveries;
+ this.errors.url = error.response.data.errors.url;
+
+ // enable button again
+ document.getElementById('submitButton').disabled = false;
+
+ });
+ if (e) {
+ e.preventDefault();
+ }
+ }
+ }
+};
+
+
+const comps = {
+ create,
+ sidebar,
+ dates
+};
+
+function loadPage(comps) {
+ console.log('loadPage');
+ Object.keys(comps).forEach(comp => {
+ let data = comps[comp]();
+ Alpine.data(comp, () => data);
+ console.log(comp);
+ });
+ Alpine.start();
+}
+
+// wait for load until bootstrapped event is received.
+document.addEventListener('firefly-iii-bootstrapped', () => {
+ console.log('Loaded through event listener.');
+ loadPage(comps);
+});
+// or is bootstrapped before event is triggered.
+if (window.bootstrapped) {
+ console.log('Loaded through window variable.');
+ loadPage(comps);
+}
diff --git a/resources/assets/v3/vite.config.js b/resources/assets/v3/vite.config.js
index efd1111bc0..aeb19df12c 100644
--- a/resources/assets/v3/vite.config.js
+++ b/resources/assets/v3/vite.config.js
@@ -83,6 +83,7 @@ export default defineConfig(({command, mode, isSsrBuild, isPreview}) => {
// tags
// webhooks
+ 'js/pages/webhooks/create.js',
'js/pages/webhooks/index.js',
// piggy banks
diff --git a/resources/views/components/form/alpine/title.blade.php b/resources/views/components/form/alpine/title.blade.php
index 898ed927f7..96a9b3677b 100644
--- a/resources/views/components/form/alpine/title.blade.php
+++ b/resources/views/components/form/alpine/title.blade.php
@@ -1,4 +1,4 @@
-<div class="form-group" x-bind:class="{ 'has-error': hasError()}">
+<div class="form-group" x-bind:class="{ 'has-error': hasError('title')}">
<label class="col-sm-4 control-label">
{{ __('form.title') }}
</label>
diff --git a/resources/views/transactions/convert.blade.php b/resources/views/transactions/convert.blade.php
index 1540263b7c..92c19f470a 100644
--- a/resources/views/transactions/convert.blade.php
+++ b/resources/views/transactions/convert.blade.php
@@ -1,11 +1,9 @@
@extends('layout.v3.session')
-
-
- {{ Breadcrumbs.render(Route.getCurrentRoute.getName, group, groupTitle) }}
+@section('breadcrumbs')
+ {{ Breadcrumbs::render(Route::getCurrentRoute()->getName(), $group, $groupTitle) }}
@endsection
-
@section('content')
- <form method="POST" action="{{ route('transactions.convert.index.post', [destinationType.type|lower, group.id]) }}"
+ <form method="POST" action="{{ route('transactions.convert.index.post', [strtolower($destinationType->type), $group->id]) }}"
accept-charset="UTF-8"
class="form-horizontal"
enctype="multipart/form-data">
@@ -14,44 +12,44 @@
<div class="col-lg-8 offset-lg-2 col-md-12 col-sm-12">
<div class="card mb-2">
<div class="card-header">
- <h3 class="card-title">{{ ('convert_options_'~sourceType.type~destinationType.type)|_ }}</h3>
+ <h3 class="card-title">{{ __('firefly.convert_options_'. $sourceType->type . $destinationType->type) }}</h3>
</div>
<div class="card-body">
<p>
{{-- ONE: WITHDRAWAL TO DEPOSIT --}}
- {% if sourceType.type == 'Withdrawal' and destinationType.type == 'Deposit' %}
- {{ trans_choice('firefly.convert_expl_w_d', groupArray.transactions|length) }}
- {{ trans_choice('firefly.convert_select_sources', groupArray.transactions|length) }}
+ @if($sourceType->type == 'Withdrawal' and $destinationType->type == 'Deposit')
+ {{ trans_choice('firefly.convert_expl_w_d', count($groupArray['transactions'])) }}
+ {{ trans_choice('firefly.convert_select_sources', count($groupArray['transactions'])) }}
@endif
{{-- TWO: WITHDRAWAL TO TRANSFER --}}
- {% if sourceType.type == 'Withdrawal' and destinationType.type == 'Transfer' %}
- {{ trans_choice('firefly.convert_expl_w_t', groupArray.transactions|length) }}
- {{ trans_choice('firefly.convert_select_destinations', groupArray.transactions|length) }}
+ @if($sourceType->type == 'Withdrawal' and $destinationType->type == 'Transfer')
+ {{ trans_choice('firefly.convert_expl_w_t', count($groupArray['transactions'])) }}
+ {{ trans_choice('firefly.convert_select_destinations', count($groupArray['transactions'])) }}
@endif
{{-- THREE: DEPOSIT TO WITHDRAWAL --}}
- {% if sourceType.type == 'Deposit' and destinationType.type == 'Withdrawal' %}
- {{ trans_choice('firefly.convert_expl_d_w', groupArray.transactions|length) }}
- {{ trans_choice('firefly.convert_select_destinations', groupArray.transactions|length) }}
+ @if($sourceType->type == 'Deposit' and $destinationType->type == 'Withdrawal')
+ {{ trans_choice('firefly.convert_expl_d_w', count($groupArray['transactions'])) }}
+ {{ trans_choice('firefly.convert_select_destinations', count($groupArray['transactions'])) }}
@endif
{{-- FOUR: DEPOSIT TO TRANSFER --}}
- {% if sourceType.type == 'Deposit' and destinationType.type == 'Transfer' %}
- {{ trans_choice('firefly.convert_expl_d_t', groupArray.transactions|length) }}
- {{ trans_choice('firefly.convert_select_sources', groupArray.transactions|length) }}
+ @if($sourceType->type == 'Deposit' and $destinationType->type == 'Transfer')
+ {{ trans_choice('firefly.convert_expl_d_t', count($groupArray['transactions'])) }}
+ {{ trans_choice('firefly.convert_select_sources', count($groupArray['transactions'])) }}
@endif
{{-- FIVE: TRANSFER TO WITHDRAWAL --}}
- {% if sourceType.type == 'Transfer' and destinationType.type == 'Withdrawal' %}
- {{ trans_choice('firefly.convert_expl_t_w', groupArray.transactions|length) }}
- {{ trans_choice('firefly.convert_select_destinations', groupArray.transactions|length) }}
+ @if($sourceType->type == 'Transfer' and $destinationType->type == 'Withdrawal')
+ {{ trans_choice('firefly.convert_expl_t_w', count($groupArray['transactions'])) }}
+ {{ trans_choice('firefly.convert_select_destinations', count($groupArray['transactions'])) }}
@endif
{{-- SIX: TRANSFER TO DEPOSIT --}}
- {% if sourceType.type == 'Transfer' and destinationType.type == 'Deposit' %}
- {{ trans_choice('firefly.convert_expl_t_d', groupArray.transactions|length) }}
- {{ trans_choice('firefly.convert_select_sources', groupArray.transactions|length) }}
+ @if($sourceType->type == 'Transfer' and $destinationType->type == 'Deposit')
+ {{ trans_choice('firefly.convert_expl_t_d', count($groupArray['transactions'])) }}
+ {{ trans_choice('firefly.convert_select_sources', count($groupArray['transactions'])) }}
@endif
</p>
@@ -63,66 +61,66 @@
<th class="quarter">Destination account</th>
<th class="fifteen">Amount</th>
</tr>
- {% for transaction in groupArray.transactions %}
+ @foreach($groupArray['transactions'] as $transaction)
<tr>
- <td>#{{ transaction.transaction_journal_id }}</td>
- <td>{{ transaction.description }}</td>
+ <td>#{{ $transaction['transaction_journal_id'] }}</td>
+ <td>{{ $transaction['description'] }}</td>
<td>
{{-- ONE: WITHDRAWAL TO DEPOSIT --}}
- {% if sourceType.type == 'Withdrawal' and destinationType.type == 'Deposit' %}
+ @if($sourceType->type == 'Withdrawal' and $destinationType->type == 'Deposit')
{{-- NEW DESTINATION = Asset, SOURCE MUST BE [Revenue, Cash, Loan, Debt, Mortgage] --}}
- {% if transaction.source_type == 'Asset account' %}
- {{ Html::select('source_id['~transaction.transaction_journal_id~']', validDepositSources).class('form-control') }}
+ @if($transaction['source_type'] == 'Asset account')
+ {!! Html::select('source_id['.$transaction['transaction_journal_id'].']', $validDepositSources)->class('form-control') !!}
@endif
{{-- NEW DESTINATION = [Loan, Debt, Mortgage], SOURCE MUST BE [Revenue] --}}
- {% if
- transaction.source_type == 'Loan' or
- transaction.source_type == 'Debt' or
- transaction.source_type == 'Mortgage' %}
+ @if(
+ $transaction['source_type'] == 'Loan' or
+ $transaction['source_type'] == 'Debt' or
+ $transaction['source_type'] == 'Mortgage')
<input
autocomplete="off"
placeholder="Source account"
- name="source_name[{{ transaction.transaction_journal_id }}]"
+ name="source_name[{{ $transaction['transaction_journal_id'] }}]"
type="text"
- value="{% if transaction.destination_type != "Cash account" %}{{ preFilled.source_name[transaction.transaction_journal_id]|default(transaction.destination_name) }}@endif"
+ value="@if($transaction['destination_type'] != "Cash account"){{ $preFilled['source_name'][$transaction['transaction_journal_id']] ?? $transaction['destination_name'] }}@endif"
class="form-control tt-input input-revenue"
spellcheck="false" dir="auto">
@endif
@endif
{{-- TWO: WITHDRAWAL TO TRANSFER --}}
- {% if sourceType.type == 'Withdrawal' and destinationType.type == 'Transfer' %}
+ @if($sourceType->type == 'Withdrawal' and $destinationType->type == 'Transfer')
- <a href="{{ route('accounts.show', [transaction.source_id]) }}"
- title="{{ transaction.source_iban|default(transaction.source_name) }}">{{ transaction.source_name }}</a>
+ <a href="{{ route('accounts.show', [$transaction['source_id']]) }}"
+ title="{{ $transaction['source_iban'] ?? $transaction['source_name'] }}">{{ $transaction['source_name'] }}</a>
{{-- hide source in hidden input --}}
<input type="hidden"
- name="source_id[{{ transaction.transaction_journal_id }}]"
- value="{{ transaction.source_id }}">
+ name="source_id[{{ $transaction['transaction_journal_id'] }}]"
+ value="{{ $transaction['source_id'] }}">
@endif
{{-- THREE: DEPOSIT TO WITHDRAWAL --}}
- {% if sourceType.type == 'Deposit' and destinationType.type == 'Withdrawal' %}
- <a href="{{ route('accounts.show', [transaction.destination_id]) }}"
- title="{{ transaction.destination_iban|default(transaction.destination_name) }}">{{ transaction.destination_name }}</a>
+ @if($sourceType->type == 'Deposit' and $destinationType->type == 'Withdrawal')
+ <a href="{{ route('accounts.show', [$transaction['destination_id']]) }}"
+ title="{{ $transaction['destination_iban'] ?? $transaction['destination_name'] }}">{{ $transaction['destination_name'] }}</a>
{{-- hide new source in hidden input --}}
<input type="hidden"
- name="source_id[{{ transaction.transaction_journal_id }}]"
- value="{{ transaction.destination_id }}">
+ name="source_id[{{ $transaction['transaction_journal_id'] }}]"
+ value="{{ $transaction['destination_id'] }}">
@endif
{{-- FOUR: DEPOSIT TO TRANSFER --}}
- {% if sourceType.type == 'Deposit' and destinationType.type == 'Transfer' %}
+ @if($sourceType->type == 'Deposit' and $destinationType->type == 'Transfer')
{{-- if new destination is asset, then asset --}}
- {% if transaction.destination_type == 'Asset account' %}
- {{ Html::select('source_id['~transaction.transaction_journal_id~']', assets).class('form-control') }}
+ @if($transaction['destination_type'] == 'Asset account')
+ {{ Html::select('source_id['.$transaction['transaction_journal_id'].']', $assets)->class('form-control') }}
@endif
- {% if transaction.destination_type == 'Loan' or
- transaction.destination_type == 'Debt' or
- transaction.destination_type == 'Mortgage' %}
- {{ Html::select('source_id['~transaction.transaction_journal_id~']', liabilities).class('form-control') }}
+ @if($transaction['destination_type'] == 'Loan' or
+ $transaction['destination_type'] == 'Debt' or
+ $transaction['destination_type'] == 'Mortgage')
+ {{ Html::select('source_id['.$transaction['transaction_journal_id'].']', $liabilities)->class('form-control') }}
@endif
{{-- if new destination liability, then liability. --}}
@@ -130,34 +128,34 @@
@endif
{{-- FIVE: TRANSFER TO WITHDRAWAL --}}
- {% if sourceType.type == 'Transfer' and destinationType.type == 'Withdrawal' %}
- <a href="{{ route('accounts.show', [transaction.source_id]) }}"
- title="{{ transaction.source_iban|default(transaction.source_name) }}">{{ transaction.source_name }}</a>
+ @if($sourceType->type == 'Transfer' and $destinationType->type == 'Withdrawal')
+ <a href="{{ route('accounts.show', [$transaction['source_id']]) }}"
+ title="{{ $transaction['source_iban'] ?? $transaction['source_name'] }}">{{ $transaction['source_name'] }}</a>
{{-- hide source in hidden input --}}
<input type="hidden"
- name="source_id[{{ transaction.transaction_journal_id }}]"
- value="{{ transaction.source_id }}">
+ name="source_id[{{ $transaction['transaction_journal_id'] }}]"
+ value="{{ $transaction['source_id'] }}">
@endif
{{-- SIX: TRANSFER TO DEPOSIT --}}
- {% if sourceType.type == 'Transfer' and destinationType.type == 'Deposit' %}
+ @if($sourceType->type == 'Transfer' and $destinationType->type == 'Deposit')
{{-- NEW DESTINATION = Asset, SOURCE MUST BE [Revenue, Cash, Loan, Debt, Mortgage] --}}
- {% if
- transaction.source_type == 'Asset account' %}
- {{ Html::select('source_id['~transaction.transaction_journal_id~']', validDepositSources).class('form-control') }}
+ @if(
+ $transaction['source_type'] == 'Asset account')
+ {{ Html::select('source_id['.$transaction['transaction_journal_id'].']', $validDepositSources)->class('form-control') }}
@endif
{{-- NEW DESTINATION = [Debt, Mortgage, Load], SOURCE MUST BE [Revenue] --}}
- {% if
- transaction.source_type == 'Loan' or
- transaction.source_type == 'Debt' or
- transaction.source_type == 'Mortgage' %}
+ @if(
+ $transaction['source_type'] == 'Loan' or
+ $transaction['source_type'] == 'Debt' or
+ $transaction['source_type'] == 'Mortgage')
<input
autocomplete="off"
placeholder="Source account"
- name="source_name[{{ transaction.transaction_journal_id }}]"
+ name="source_name[{{ $transaction['transaction_journal_id'] }}]"
type="text"
- value="{% if transaction.destination_type != "Cash account" %}{{ transaction.source_name }}@endif"
+ value="@if($transaction['destination_type'] != "Cash account"){{ $transaction['source_name'] }}@endif"
class="form-control tt-input"
spellcheck="false" dir="auto">
@endif
@@ -167,112 +165,112 @@
</td>
<td>
{{-- ONE: WITHDRAWAL TO DEPOSIT --}}
- {% if sourceType.type == 'Withdrawal' and destinationType.type == 'Deposit' %}
- <a href="{{ route('accounts.show', [transaction.source_id]) }}"
- title="{{ transaction.source_iban|default(transaction.source_name) }}">{{ transaction.source_name }}</a>
+ @if($sourceType->type == 'Withdrawal' and $destinationType->type == 'Deposit')
+ <a href="{{ route('accounts.show', [$transaction['source_id']]) }}"
+ title="{{ $transaction['source_iban'] ?? $transaction['source_name'] }}">{{ $transaction['source_name'] }}</a>
{{-- hide destination in hidden input --}}
<input type="hidden"
- name="destination_id[{{ transaction.transaction_journal_id }}]"
- value="{{ transaction.source_id }}">
+ name="destination_id[{{ $transaction['transaction_journal_id'] }}]"
+ value="{{ $transaction['source_id'] }}">
@endif
{{-- TWO: WITHDRAWAL TO TRANSFER --}}
- {% if sourceType.type == 'Withdrawal' and destinationType.type == 'Transfer' %}
+ @if($sourceType->type == 'Withdrawal' and $destinationType->type == 'Transfer')
{{-- if the source is a liability, destination must also be a liability. --}}
- {% if
- transaction.source_type == 'Loan' or
- transaction.source_type == 'Debt' or
- transaction.source_type == 'Mortgage' %}
- {{ Html::select('destination_id['~transaction.transaction_journal_id~']', liabilities).class('form-control') }}
+ @if(
+ $transaction['source_type'] == 'Loan' or
+ $transaction['source_type'] == 'Debt' or
+ $transaction['source_type'] == 'Mortgage')
+ {{ Html::select('destination_id['.$transaction['transaction_journal_id'].']', $liabilities)->class('form-control') }}
@endif
{{-- if the source is an asset, destination can only be an asset. --}}
- {% if transaction.source_type == 'Asset account' %}
- {{ Html::select('destination_id['~transaction.transaction_journal_id~']', assets).class('form-control') }}
+ @if($transaction['source_type'] == 'Asset account')
+ {{ Html::select('destination_id['.$transaction['transaction_journal_id'].']', $assets)->class('form-control') }}
@endif
@endif
{{-- THREE: DEPOSIT TO WITHDRAWAL --}}
- {% if sourceType.type == 'Deposit' and destinationType.type == 'Withdrawal' %}
+ @if($sourceType->type == 'Deposit' and $destinationType->type == 'Withdrawal')
{{-- if new source is Asset, destination must be [Expense, Loan, Debt or Mortgage] --}}
- {% if transaction.destination_type == 'Asset account' %}
- {{ Html::select('destination_id['~transaction.transaction_journal_id~']', validWithdrawalDests).class('form-control') }}
+ @if($transaction['destination_type'] == 'Asset account')
+ {{ Html::select('destination_id['.$transaction['transaction_journal_id'].']', $validWithdrawalDests)->class('form-control') }}
@endif
- {% if transaction.destination_type == 'Loan' or
- transaction.destination_type == 'Debt' or
- transaction.destination_type == 'Mortgage' %}
+ @if($transaction['destination_type'] == 'Loan' or
+ $transaction['destination_type'] == 'Debt' or
+ $transaction['destination_type'] == 'Mortgage')
{{-- if new source is Liability, destination must be expense account. --}}
<input
autocomplete="off"
placeholder="Destination account"
- name="destination_name[{{ transaction.transaction_journal_id }}]"
+ name="destination_name[{{ $transaction['transaction_journal_id'] }}]"
type="text"
- value="{% if transaction.source_type != "Cash account" %}{{ transaction.source_name }}@endif"
+ value="@if($transaction['source_type'] != "Cash account"){{ $transaction['source_name'] }}@endif"
class="form-control tt-input"
spellcheck="false" dir="auto">
@endif
@endif
{{-- FOUR: DEPOSIT TO TRANSFER --}}
- {% if sourceType.type == 'Deposit' and destinationType.type == 'Transfer' %}
- <a href="{{ route('accounts.show', [transaction.destination_id]) }}"
- title="{{ transaction.destination_iban|default(transaction.destination_name) }}">{{ transaction.destination_name }}</a>
+ @if($sourceType->type == 'Deposit' and $destinationType->type == 'Transfer')
+ <a href="{{ route('accounts.show', [$transaction['destination_id']]) }}"
+ title="{{ $transaction['destination_iban'] ?? $transaction['destination_name'] }}">{{ $transaction['destination_name'] }}</a>
{{-- hide destination in hidden input --}}
<input type="hidden"
- name="destination_id[{{ transaction.transaction_journal_id }}]"
- value="{{ transaction.destination_id }}">
+ name="destination_id[{{ $transaction['transaction_journal_id'] }}]"
+ value="{{ $transaction['destination_id'] }}">
@endif
{{-- FIVE: TRANSFER TO WITHDRAWAL --}}
- {% if sourceType.type == 'Transfer' and destinationType.type == 'Withdrawal' %}
+ @if($sourceType->type == 'Transfer' and $destinationType->type == 'Withdrawal')
- {% if transaction.source_type == 'Asset account' %}
- {{ Html::select('destination_id['~transaction.transaction_journal_id~']', validWithdrawalDests).class('form-control') }}
+ @if($transaction['source_type'] == 'Asset account')
+ {{ Html::select('destination_id['.$transaction['transaction_journal_id'].']', $validWithdrawalDests)->class('form-control') }}
@endif
- {% if transaction.source_type == 'Loan' or
- transaction.source_type == 'Debt' or
- transaction.source_type == 'Mortgage' %}
+ @if($transaction['source_type'] == 'Loan' or
+ $transaction['source_type'] == 'Debt' or
+ $transaction['source_type'] == 'Mortgage')
<input
autocomplete="off"
placeholder="Destination account"
- name="destination_name[{{ transaction.transaction_journal_id }}]"
+ name="destination_name[{{ $transaction['transaction_journal_id'] }}]"
type="text"
- value="{% if transaction.source_type != "Cash account" %}{{ transaction.destination_name }}@endif"
+ value="@if($transaction['source_type'] != "Cash account"){{ $transaction['destination_name'] }}@endif"
class="form-control tt-input"
spellcheck="false" dir="auto">
@endif
@endif
{{-- SIX: TRANSFER TO DEPOSIT --}}
- {% if sourceType.type == 'Transfer' and destinationType.type == 'Deposit' %}
- <a href="{{ route('accounts.show', [transaction.destination_id]) }}"
- title="{{ transaction.destination_iban|default(transaction.destination_name) }}">{{ transaction.destination_name }}</a>
+ @if($sourceType->type == 'Transfer' and $destinationType->type == 'Deposit')
+ <a href="{{ route('accounts.show', [$transaction['destination_id']]) }}"
+ title="{{ $transaction['destination_iban'] ?? $transaction['destination_name'] }}">{{ $transaction['destination_name'] }}</a>
{{-- hide destination in hidden input --}}
<input type="hidden"
- name="destination_id[{{ transaction.transaction_journal_id }}]"
- value="{{ transaction.destination_id }}">
+ name="destination_id[{{ $transaction['transaction_journal_id'] }}]"
+ value="{{ $transaction['destination_id'] }}">
@endif
</td>
<td>
- {% if transaction.transaction_type_type == 'Deposit' %}
- {!! format_amount_by_symbol(transaction.amount*-1, transaction.currency_symbol, transaction.currency_decimal_places) }}
- {% if null != transaction.foreign_amount %}
- ({!! format_amount_by_symbol(transaction.foreign_amount*-1, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }})
+ @if($transaction['type'] == 'Deposit')
+ {!! format_amount_by_symbol($transaction['amount']*-1, $transaction['currency_symbol'], $transaction['currency_decimal_places']) !!}
+ @if(null != $transaction['foreign_amount'])
+ ({!! format_amount_by_symbol($transaction['foreign_amount']*-1, $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places']) !!})
@endif
- {% elseif transaction.transaction_type_type == 'Transfer' %}
- <span class="text-info money-transfer">{!! format_amount_by_symbol(transaction.amount*-1, transaction.currency_symbol, transaction.currency_decimal_places, false) }}
- {% if null != transaction.foreign_amount %}
- ({!! format_amount_by_symbol(transaction.foreign_amount*-1, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places, false) }})
+ @elseif($transaction['type'] == 'Transfer')
+ <span class="text-info money-transfer">{!! format_amount_by_symbol($transaction['amount']*-1, $transaction['currency_symbol'], $transaction['currency_decimal_places'], false) !!}
+ @if(null != $transaction['foreign_amount'])
+ ({!! format_amount_by_symbol($transaction['foreign_amount']*-1, $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places'], false) !!})
@endif</span>
@else
- {!! format_amount_by_symbol(transaction.amount, transaction.currency_symbol, transaction.currency_decimal_places) }}
- {% if null != transaction.foreign_amount %}
- ({!! format_amount_by_symbol(transaction.foreign_amount, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }})
+ {!! format_amount_by_symbol($transaction['amount'], $transaction['currency_symbol'], $transaction['currency_decimal_places']) !!}
+ @if(null != $transaction['foreign_amount'])
+ ({!! format_amount_by_symbol($transaction['foreign_amount'], $transaction['foreign_currency_symbol'], $transaction['foreign_currency_decimal_places']) !!})
@endif
@endif
</td>
@@ -281,9 +279,9 @@
</table>
</div>
<div class="card-footer text-end">
- <a href="{{ route('transactions.show', group.id) }}" class="btn btn-danger">{{ 'cancel'|_ }}</a>
+ <a href="{{ route('transactions.show', $group->id) }}" class="btn btn-danger">{{ __('firefly.cancel') }}</a>
<button type="submit" id="transaction-btn" class="btn btn-success ">
- {{ trans('form.convert_'~sourceType.type) }}
+ {{ trans('form.convert_'.$sourceType->type) }}
</button>
</div>
</div>
@@ -293,6 +291,7 @@
@endsection
@section('scripts')
+@vite(['js/pages/generic.js'])
<script type="text/javascript" src="v1/js/lib/typeahead/typeahead.bundle.min.js?v={{ $FF_BUILD_TIME }}"
nonce="{{ $JS_NONCE }}"></script>
<script type="text/javascript" src="v1/js/ff/transactions/convert.js?v={{ $FF_BUILD_TIME }}"
diff --git a/resources/views/webhooks/create.blade.php b/resources/views/webhooks/create.blade.php
index c18cf313e8..c6b494d77c 100644
--- a/resources/views/webhooks/create.blade.php
+++ b/resources/views/webhooks/create.blade.php
@@ -1,14 +1,93 @@
-{% set VUE_SCRIPT_NAME = 'webhooks/create' %}
@extends('layout.v3.session')
+@section('content')
+ <div x-data="create">
+ <form accept-charset="UTF-8" class="form-horizontal" enctype="multipart/form-data">
+ <input name="_token" type="hidden" value="xxx">
- {{ Breadcrumbs.render(Route.getCurrentRoute.getName) }}
-@endsection
+ <template x-if="error_message !== ''">
+ <div class="row">
+ <div class="col-lg-12">
+ <div class="alert alert-danger alert-dismissible" role="alert">
+ <button class="close" data-dismiss="alert" type="button" aria-label="{{ __('firefly.close') }}"><span
+ aria-hidden="true">&times;</span></button>
+ <strong>{{ __("firefly.flash_error") }}</strong> <span x-text="error_message"></span>
+ </div>
+ </div>
+ </div>
+ </template>
-@section('content')
- <div id="webhooks_create"></div>
+ <template x-if="success_message !== ''">
+ <div class="row">
+ <div class="col-lg-12">
+ <div class="alert alert-success alert-dismissible" role="alert">
+ <button class="close" data-dismiss="alert" type="button" aria-label="{{ __('firefly.close') }}"><span
+ aria-hidden="true">&times;</span></button>
+ <strong>{{ __("firefly.flash_success") }}</strong> <span x-html="success_message"></span>
+ </div>
+ </div>
+ </div>
+ </template>
+
+ <div class="row">
+ <div class="col-lg-6 col-md-12 col-sm-12">
+ <div class="card">
+ <div class="card-header">
+ <h3 class="card-title">
+ {{ __('firefly.create_new_webhook') }}
+ </h3>
+ </div>
+ <div class="card-body">
+ <div class="row">
+ <div class="col-lg-12">
+ <x-form.alpine.title value="this.title" />
+ TITLE
+
+ TRIGGER
+
+ RESPONSE
+
+ DELIVERY
+
+ URL
+
+ CHECKBOX
+
+ {{--
+ <Title :value=this.title :error="errors.title" v-on:input="title = $event"></Title>
+ <WebhookTrigger :value=this.triggers :error="errors.trigger"
+ v-on:input="triggers = $event"></WebhookTrigger>
+ <WebhookResponse :value=this.responses :error="errors.response"
+ v-on:input="responses = $event"></WebhookResponse>
+ <WebhookDelivery :value=this.deliveries :error="errors.delivery"
+ v-on:input="deliveries = $event"></WebhookDelivery>
+ <URL :value=this.url :error="errors.url" v-on:input="url = $event"></URL>
+ <Checkbox :value=this.active :error="errors.active" help="ACTIVE HELP TODO" :title="__('form.active')" v-on:input="active = $event"></Checkbox>
+ --}}
+ </div>
+ </div>
+ </div>
+ <div class="card-footer">
+ <div class="btn-group">
+ <button id="submitButton" ref="submitButton" class="btn btn-success" @click="submit">
+ {{ __('firefly.submit') }}
+ </button>
+ </div>
+ <template x-if="'' !== success_message">
+ <p class="text-success" x-text="success_message"></p>
+ </template>
+ <template x-if="'' !== error_message">
+ <p class="text-danger" x-html="error_message"></p>
+ </template>
+ </div>
+ </div>
+ </div>
+ </div>
+ </form>
+ </div>
@endsection
@section('scripts')
<script type="text/javascript" nonce="{{ $JS_NONCE }}">
- var previousUrl = '{{ previousUrl }}';
+ var previousUrl = '{{ $previousUrl }}';
</script>
+ @vite(['js/pages/webhooks/create.js'])
@endsection