diff --git a/app/Http/Controllers/EController.php b/app/Http/Controllers/EController.php
new file mode 100644
index 0000000..85822fb
--- /dev/null
+++ b/app/Http/Controllers/EController.php
@@ -0,0 +1,29 @@
+items as $item) {
+ if (!isset($taxes[$item->tax])) {
+ $taxes[$item->tax] = ['tax' => 0, 'taxable' => 0];
+ }
+ $taxes[$item->tax]['tax'] += round($item->price * $item->amount * $item->tax / 100, 2, PHP_ROUND_HALF_UP);
+ $taxes[$item->tax]['taxable'] += $item->price * $item->amount;
+ }
+
+ return response()->streamDownload(function () use ($invoice, $taxes) {
+ echo view('xml.invoice', ['invoice' => $invoice, 'options' => Option::optionsAsObject(), 'taxes' => $taxes]);
+ }, 'test.xml', ['Content-Type' => 'application/xml']);
+
+ }
+}
diff --git a/app/Http/Controllers/PdfController.php b/app/Http/Controllers/PdfController.php
index 2daaa06..1bbea51 100644
--- a/app/Http/Controllers/PdfController.php
+++ b/app/Http/Controllers/PdfController.php
@@ -2,8 +2,8 @@
namespace App\Http\Controllers;
+use App\Http\Option;
use App\Models\Invoice;
-use App\Models\Option;
use Barryvdh\DomPDF\Facade\Pdf;
use Illuminate\Http\Response;
@@ -12,13 +12,7 @@ class PdfController extends Controller
public function downloadInvoice(int $invoice_id): Response
{
$invoice = Invoice::find($invoice_id);
- $all_options = Option::all(['name', 'value']);
- $options = new \stdClass();
- foreach ($all_options as $option) {
- $key = $option->name;
- $options->$key = $option->value;
- }
- return Pdf::loadView('pdfs.invoice', ['invoice' => $invoice->load(['address', 'delivery']), 'options' => $options])->stream();
+ return Pdf::loadView('pdfs.invoice', ['invoice' => $invoice->load(['address', 'delivery']), 'options' => Option::optionsAsObject()])->stream();
}
}
diff --git a/app/Http/Option.php b/app/Http/Option.php
new file mode 100644
index 0000000..fc0c0fa
--- /dev/null
+++ b/app/Http/Option.php
@@ -0,0 +1,17 @@
+name;
+ $options->$key = $option->value;
+ }
+ return $options;
+ }
+}
diff --git a/resources/views/components/e-icon.blade.php b/resources/views/components/e-icon.blade.php
new file mode 100644
index 0000000..1a50ece
--- /dev/null
+++ b/resources/views/components/e-icon.blade.php
@@ -0,0 +1,23 @@
+
diff --git a/resources/views/components/pdf-icon.blade.php b/resources/views/components/pdf-icon.blade.php
index 3fe1517..81a87fa 100644
--- a/resources/views/components/pdf-icon.blade.php
+++ b/resources/views/components/pdf-icon.blade.php
@@ -1,3 +1,3 @@
-