close #1551 Fixed: Reconciliation form checkbox missing values
This commit is contained in:
parent
115b55f688
commit
48a37246c5
@ -42,7 +42,7 @@ class CreateReconciliation extends Job
|
||||
'reconciled' => $reconcile ? 1 : 0,
|
||||
]);
|
||||
|
||||
if ($transactions) {
|
||||
if ($reconcile && $transactions) {
|
||||
foreach ($transactions as $key => $value) {
|
||||
if (empty($value)) {
|
||||
continue;
|
||||
|
@ -47,7 +47,7 @@ class UpdateReconciliation extends Job
|
||||
$t = explode('_', $key);
|
||||
|
||||
$transaction = Transaction::find($t[1]);
|
||||
$transaction->reconciled = 1;
|
||||
$transaction->reconciled = $reconcile ? 1 : 0;
|
||||
$transaction->save();
|
||||
}
|
||||
}
|
||||
|
26
resources/assets/js/plugins/form.js
vendored
26
resources/assets/js/plugins/form.js
vendored
@ -48,9 +48,35 @@ export default class Form {
|
||||
this[form_element.getAttribute('data-field')] = field;
|
||||
}
|
||||
|
||||
/*
|
||||
if (!this[form_element.getAttribute('data-field')][name]) {
|
||||
this[form_element.getAttribute('data-field')][name] = '';
|
||||
}
|
||||
*/
|
||||
|
||||
if (type == 'radio') {
|
||||
if (!this[form_element.getAttribute('data-field')][name]) {
|
||||
this[form_element.getAttribute('data-field')][name] = (form_element.getAttribute('value') ? 1 : 0) || 0;
|
||||
}
|
||||
} else if (type == 'checkbox') {
|
||||
if (this[form_element.getAttribute('data-field')][name]) {
|
||||
if (!this[form_element.getAttribute('data-field')][name].push) {
|
||||
this[form_element.getAttribute('data-field')][name] = [this[form_element.getAttribute('data-field')][name]];
|
||||
}
|
||||
|
||||
if (form_element.checked) {
|
||||
this[form_element.getAttribute('data-field')][name].push(form_element.value);
|
||||
}
|
||||
} else {
|
||||
if (form_element.checked) {
|
||||
this[form_element.getAttribute('data-field')][name] = form_element.value;
|
||||
} else {
|
||||
this[form_element.getAttribute('data-field')][name] = [];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this[form_element.getAttribute('data-field')][name] = form_element.getAttribute('value') || '';
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -43,6 +43,10 @@ const app = new Vue({
|
||||
if (document.getElementById('closing_balance') != null) {
|
||||
this.totals.closing_balance = parseFloat(document.getElementById('closing_balance').value);
|
||||
}
|
||||
|
||||
if (this.form._method == 'PATCH') {
|
||||
this.onCalculate();
|
||||
}
|
||||
},
|
||||
|
||||
methods:{
|
||||
|
@ -55,7 +55,7 @@
|
||||
@endif
|
||||
<td class="col-md-1 text-right d-none d-md-block">
|
||||
<div class="custom-control custom-checkbox">
|
||||
{{ Form::checkbox($item->type . '_' . $item->id, $item->price, $item->reconciled, [
|
||||
{{ Form::checkbox($item->type . '_' . $item->id, $item->amount_for_account, $item->reconciled, [
|
||||
'data-field' => 'transactions',
|
||||
'v-model' => 'form.transactions.' . $item->type . '_' . $item->id,
|
||||
'id' => 'transaction-' . $item->id . '-'. $item->type,
|
||||
|
Loading…
x
Reference in New Issue
Block a user