close #2432 Fixed: Invoice form sent to button not working ( #2zftu0c )
This commit is contained in:
parent
d1f987c720
commit
c94ab51c52
@ -70,7 +70,13 @@ class Invoices extends Controller
|
|||||||
$response = $this->ajaxDispatch(new CreateDocument($request));
|
$response = $this->ajaxDispatch(new CreateDocument($request));
|
||||||
|
|
||||||
if ($response['success']) {
|
if ($response['success']) {
|
||||||
$response['redirect'] = route('invoices.show', $response['data']->id);
|
$paramaters = ['invoice' => $response['data']->id];
|
||||||
|
|
||||||
|
if ($request->has('senddocument')) {
|
||||||
|
$paramaters['senddocument'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$response['redirect'] = route('invoices.show', $paramaters);
|
||||||
|
|
||||||
$message = trans('messages.success.added', ['type' => trans_choice('general.invoices', 1)]);
|
$message = trans('messages.success.added', ['type' => trans_choice('general.invoices', 1)]);
|
||||||
|
|
||||||
|
23
resources/assets/js/views/common/documents.js
vendored
23
resources/assets/js/views/common/documents.js
vendored
@ -8,7 +8,7 @@ import Vue from 'vue';
|
|||||||
|
|
||||||
import DashboardPlugin from './../../plugins/dashboard-plugin';
|
import DashboardPlugin from './../../plugins/dashboard-plugin';
|
||||||
import { addDays, format } from 'date-fns';
|
import { addDays, format } from 'date-fns';
|
||||||
import { setPromiseTimeout } from './../../plugins/functions';
|
import { setPromiseTimeout, getQueryVariable } from './../../plugins/functions';
|
||||||
|
|
||||||
import Global from './../../mixins/global';
|
import Global from './../../mixins/global';
|
||||||
|
|
||||||
@ -939,6 +939,12 @@ const app = new Vue({
|
|||||||
|
|
||||||
this.form.due_at = due_at;
|
this.form.due_at = due_at;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onSubmitViaSendEmail() {
|
||||||
|
this.form['senddocument'] = true;
|
||||||
|
|
||||||
|
this.onSubmit();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
@ -1040,6 +1046,21 @@ const app = new Vue({
|
|||||||
this.dynamic_taxes = document_taxes;
|
this.dynamic_taxes = document_taxes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getQueryVariable('senddocument')) {
|
||||||
|
// clear query string
|
||||||
|
let uri = window.location.toString();
|
||||||
|
|
||||||
|
if (uri.indexOf("?") > 0) {
|
||||||
|
let clean_uri = uri.substring(0, uri.indexOf("?"));
|
||||||
|
|
||||||
|
window.history.replaceState({}, document.title, clean_uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
let email_route = document.getElementById('senddocument_route').value;
|
||||||
|
|
||||||
|
this.onEmail(email_route);
|
||||||
|
}
|
||||||
|
|
||||||
this.page_loaded = true;
|
this.page_loaded = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -8,8 +8,13 @@
|
|||||||
id="invoice-send-to"
|
id="invoice-send-to"
|
||||||
class="relative flex items-center justify-center bg-green hover:bg-green-700 text-white px-6 py-1.5 ltr:ml-2 rtl:mr-2 text-base rounded-lg disabled:bg-green-100"
|
class="relative flex items-center justify-center bg-green hover:bg-green-700 text-white px-6 py-1.5 ltr:ml-2 rtl:mr-2 text-base rounded-lg disabled:bg-green-100"
|
||||||
override="class"
|
override="class"
|
||||||
|
::disabled="form.loading"
|
||||||
|
@click="onSubmitViaSendEmail"
|
||||||
>
|
>
|
||||||
|
<i v-if="form.loading" class="animate-submit delay-[0.28s] absolute w-2 h-2 rounded-full left-0 right-0 -top-3.5 m-auto before:absolute before:w-2 before:h-2 before:-left-3.5 before:rounded-full before:animate-submit before:delay-[0.14s] after:absolute after:w-2 after:h-2 after:-right-3.5 after:rounded-full after:animate-submit after:delay-[0.42s]"></i>
|
||||||
|
<span :class="[{'opacity-0': form.loading}]">
|
||||||
{{ trans('general.send_to') }}
|
{{ trans('general.send_to') }}
|
||||||
|
</span>
|
||||||
</x-button>
|
</x-button>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@ -115,6 +115,7 @@
|
|||||||
@stack('document_end')
|
@stack('document_end')
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<x-form.input.hidden name="senddocument_route" id="senddocument_route" value="{{ route($emailRoute, $document->id) }}" />
|
||||||
<x-form.input.hidden name="document_id" :value="$document->id" />
|
<x-form.input.hidden name="document_id" :value="$document->id" />
|
||||||
<x-form.input.hidden name="{{ $type . '_id' }}" :value="$document->id" />
|
<x-form.input.hidden name="{{ $type . '_id' }}" :value="$document->id" />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user