add attachment feature to document payments

This commit is contained in:
Cihan Şentürk 2025-08-01 11:53:18 +03:00 committed by GitHub
parent bbf83478ea
commit c1f73ae6dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 15 deletions

View File

@ -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();

View File

@ -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]);

View File

@ -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">

View File

@ -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" />