Merge pull request #3306 from CihanSenturk/add-payment-attachment
Add attachment feature to document payments
This commit is contained in:
commit
2beba59bb1
|
|
@ -38,13 +38,6 @@ class CreateBankingDocumentTransaction extends Job implements ShouldCreate
|
|||
\DB::transaction(function () {
|
||||
$this->transaction = $this->dispatch(new CreateTransaction($this->request));
|
||||
|
||||
// Upload attachment
|
||||
if ($this->request->file('attachment')) {
|
||||
$media = $this->getMedia($this->request->file('attachment'), 'transactions');
|
||||
|
||||
$this->transaction->attachMedia($media, 'attachment');
|
||||
}
|
||||
|
||||
$this->model->save();
|
||||
|
||||
$this->createHistory();
|
||||
|
|
|
|||
|
|
@ -945,15 +945,19 @@ export default {
|
|||
let data = this.form.data();
|
||||
|
||||
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
||||
for(var name in data) {
|
||||
for (var name in data) {
|
||||
if (name == "previewElement" || name == "previewTemplate") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wrapper) {
|
||||
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
||||
if ((typeof data[name] == 'object' || Array.isArray(data[name])) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
||||
this.appendRecursive(data[name], wrapper + '[' + name + ']');
|
||||
} else {
|
||||
this.append(wrapper + '[' + name + ']', data[name]);
|
||||
}
|
||||
} else {
|
||||
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
||||
if ((typeof data[name] == 'object' || Array.isArray(data[name])) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
|
||||
this.appendRecursive(data[name], name);
|
||||
} else {
|
||||
this.append(name, data[name]);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
@if ($attachment)
|
||||
@if ($attachment || $transaction_attachment->count())
|
||||
<x-show.accordion type="attachment" :open="($accordionActive == 'attachment')">
|
||||
<x-slot name="head">
|
||||
<x-show.accordion.head
|
||||
|
|
@ -11,9 +10,11 @@
|
|||
<x-slot name="body">
|
||||
@stack('timeline_attachment_body_start')
|
||||
|
||||
@foreach ($attachment as $file)
|
||||
<x-media.file :file="$file" />
|
||||
@endforeach
|
||||
@if ($attachment)
|
||||
@foreach ($attachment as $file)
|
||||
<x-media.file :file="$file" />
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@if ($transaction_attachment->count())
|
||||
<div class="relative mt-4">
|
||||
|
|
|
|||
|
|
@ -123,6 +123,8 @@
|
|||
|
||||
<x-form.group.text name="reference" label="{{ trans('general.reference') }}" not-required form-group-class="col-span-6" />
|
||||
|
||||
<x-form.group.attachment />
|
||||
|
||||
<x-form.input.hidden name="document_id" :value="$document->id" />
|
||||
<x-form.input.hidden name="category_id" :value="$document->category->id" />
|
||||
<x-form.input.hidden name="paid_amount" :value="$document->paid_amount" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue