From b2f12560df62c58f62f92d376e26845330431b76 Mon Sep 17 00:00:00 2001 From: ShoyebWritesCode Date: Wed, 7 Aug 2024 10:44:57 +0600 Subject: [PATCH 01/45] Add Reports Page --- app/Http/Controllers/ProductsController.php | 57 +++++++++++++++++++++ app/Http/Controllers/ReportsController.php | 26 +++++++++- resources/js/Components/Card.vue | 41 +++++++++++++++ resources/js/Pages/Reports/Index.vue | 29 ++++++++++- resources/js/Shared/Card.vue | 46 +++++++++++++++++ resources/js/Shared/Icon.vue | 2 + resources/js/Shared/MainMenu.vue | 6 +++ routes/web.php | 15 ++++++ 8 files changed, 220 insertions(+), 2 deletions(-) create mode 100644 app/Http/Controllers/ProductsController.php create mode 100644 resources/js/Components/Card.vue create mode 100644 resources/js/Shared/Card.vue diff --git a/app/Http/Controllers/ProductsController.php b/app/Http/Controllers/ProductsController.php new file mode 100644 index 000000000..6774fe85d --- /dev/null +++ b/app/Http/Controllers/ProductsController.php @@ -0,0 +1,57 @@ + Request::all('search', 'trashed'), + 'organizations' => Auth::user()->account->organizations() + ->orderBy('name') + ->filter(Request::only('search', 'trashed')) + ->paginate(10) + ->withQueryString() + ->through(fn ($organization) => [ + 'id' => $organization->id, + 'name' => $organization->name, + 'phone' => $organization->phone, + 'city' => $organization->city, + 'deleted_at' => $organization->deleted_at, + ]), + ]); + } + + public function create(): Response + { + return Inertia::render('Organizations/Create'); + } + + public function store(): RedirectResponse + { + Auth::user()->account->organizations()->create( + Request::validate([ + 'name' => ['required', 'max:100'], + 'email' => ['nullable', 'max:50', 'email'], + 'phone' => ['nullable', 'max:50'], + 'address' => ['nullable', 'max:150'], + 'city' => ['nullable', 'max:50'], + 'region' => ['nullable', 'max:50'], + 'country' => ['nullable', 'max:2'], + 'postal_code' => ['nullable', 'max:25'], + ]) + ); + + return Redirect::route('organizations')->with('success', 'Organization created.'); + } +} diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 57a978a47..32148da51 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -4,11 +4,35 @@ use Inertia\Inertia; use Inertia\Response; +use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Request; class ReportsController extends Controller { public function index(): Response { - return Inertia::render('Reports/Index'); + $organizations = Auth::user()->account->organizations() + ->orderBy('name') + ->paginate(9) + ->withQueryString() + ->through(function ($organization) { + $contact = $organization->contacts()->first(); + $ownerName = $contact + ? ($contact->first_name . ' ' . $contact->last_name) + : "N/A"; + + return [ + 'id' => $organization->id, + 'name' => implode(' ', array_slice(explode(' ', $organization->name), 0, 2)), + 'phone' => $organization->phone, + 'city' => $organization->city, + 'deleted_at' => $organization->deleted_at, + 'owner' => $ownerName, + ]; + }); + + return Inertia::render('Reports/Index', [ + 'organizations' => $organizations, + ]); } } diff --git a/resources/js/Components/Card.vue b/resources/js/Components/Card.vue new file mode 100644 index 000000000..4818f1ab3 --- /dev/null +++ b/resources/js/Components/Card.vue @@ -0,0 +1,41 @@ + + + diff --git a/resources/js/Pages/Reports/Index.vue b/resources/js/Pages/Reports/Index.vue index e464089cb..b7ee67123 100644 --- a/resources/js/Pages/Reports/Index.vue +++ b/resources/js/Pages/Reports/Index.vue @@ -2,16 +2,43 @@

Reports

+
+ +
+
+

No organizations found.

+
+
+ diff --git a/resources/js/Shared/Icon.vue b/resources/js/Shared/Icon.vue index 35db91a36..c38e54618 100644 --- a/resources/js/Shared/Icon.vue +++ b/resources/js/Shared/Icon.vue @@ -6,8 +6,10 @@ + + diff --git a/resources/js/Pages/Products/Create.vue b/resources/js/Pages/Products/Create.vue new file mode 100644 index 000000000..690ba368c --- /dev/null +++ b/resources/js/Pages/Products/Create.vue @@ -0,0 +1,57 @@ + + + diff --git a/resources/js/Pages/Products/Index.vue b/resources/js/Pages/Products/Index.vue new file mode 100644 index 000000000..c7f6fa5f9 --- /dev/null +++ b/resources/js/Pages/Products/Index.vue @@ -0,0 +1,63 @@ + + + diff --git a/resources/js/Shared/Pagination.vue b/resources/js/Shared/Pagination.vue index 7eb3e644b..72c566819 100644 --- a/resources/js/Shared/Pagination.vue +++ b/resources/js/Shared/Pagination.vue @@ -1,5 +1,5 @@ diff --git a/routes/web.php b/routes/web.php index 8e474a114..c99b1f513 100644 --- a/routes/web.php +++ b/routes/web.php @@ -8,6 +8,7 @@ use App\Http\Controllers\ReportsController; use App\Http\Controllers\UsersController; use App\Http\Controllers\ProductsController; +use App\Http\Controllers\InvoicesController; use Illuminate\Support\Facades\Route; /* @@ -162,3 +163,18 @@ Route::put('products/{product}', [ProductsController::class, 'update']) ->name('products.update') ->middleware('auth'); + + +// Invoices +Route::get('invoices', [InvoicesController::class, 'index']) + ->name('invoices') + ->middleware('auth'); +Route::get('invoices/create', [InvoicesController::class, 'create']) + ->name('invoices.create') + ->middleware('auth'); +Route::post('invoices', [InvoicesController::class, 'store']) + ->name('invoices.store') + ->middleware('auth'); +Route::get('organizations/{organizationId}/contacts', [InvoicesController::class, 'getContacts']) + ->name('organizations.contacts') + ->middleware('auth'); From c845b957b08ab0d44765820be4a312be66c21ea9 Mon Sep 17 00:00:00 2001 From: ShoyebWritesCode Date: Wed, 7 Aug 2024 17:36:40 +0600 Subject: [PATCH 07/45] Add Save Invoice with Pdf --- app/Http/Controllers/InvoicesController.php | 26 ++- app/Models/Invoice.php | 5 - ...nization_and_contact_to_invoices_table.php | 30 +++ package-lock.json | 212 +++++++++++++++++- package.json | 3 +- resources/js/Pages/Invoices/Create.vue | 95 +++++--- resources/js/Pages/Invoices/Index.vue | 14 +- 7 files changed, 332 insertions(+), 53 deletions(-) create mode 100644 database/migrations/2024_08_07_102758_add_ogranization_and_contact_to_invoices_table.php diff --git a/app/Http/Controllers/InvoicesController.php b/app/Http/Controllers/InvoicesController.php index 170797e1f..bfc66403a 100644 --- a/app/Http/Controllers/InvoicesController.php +++ b/app/Http/Controllers/InvoicesController.php @@ -5,6 +5,7 @@ use Illuminate\Http\Request; use App\Models\Invoice; use App\Models\Contact; +use App\Models\Organization; use App\Models\Product; use Inertia\Inertia; use Inertia\Response; @@ -37,7 +38,7 @@ public function create(): Response ->get() ->map ->only('id', 'name'), - 'products' => Product::all(['id', 'name', 'price']), + 'products' => Product::all(['id', 'name', 'price', 'quantity']), ]); } @@ -50,13 +51,34 @@ public function getContacts($organizationId) public function store(Request $request) { + $request->validate([ + 'number' => 'required', + 'amount' => 'required', + 'organization_id' => 'required|exists:organizations,id', + 'contact_id' => 'required|exists:contacts,id', + 'added_products' => 'required|array', + 'added_products.*.id' => 'required|exists:products,id', + 'added_products.*.quantity' => 'required|integer|min:1', + ]); + + $organization = Organization::findOrFail($request->organization_id); + $contact = Contact::findOrFail($request->contact_id); + $invoice = Invoice::create([ 'number' => $request->number, 'amount' => $request->amount, 'organization_id' => $request->organization_id, 'contact_id' => $request->contact_id, + 'organization_name' => $organization->name, + 'contact_first_name' => $contact->first_name, + 'contact_last_name' => $contact->last_name, ]); - return redirect()->route('invoices')->with('success', 'Invoice created.'); + foreach ($request->added_products as $productData) { + $product = Product::findOrFail($productData['id']); + $product->decrement('quantity', $productData['quantity0']); + } + + return redirect()->route('invoices')->with('success', 'Invoice created successfully.'); } } diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 1f2c03781..dc95336ee 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -10,9 +10,4 @@ class Invoice extends Model use HasFactory; protected $table = 'invoices'; protected $fillable = ['number', 'amount', 'organization_id', 'contact_id']; - - public function resolveRouteBinding($value, $field = null) - { - return $this->where($field ?? 'id', $value)->firstOrFail(); - } } diff --git a/database/migrations/2024_08_07_102758_add_ogranization_and_contact_to_invoices_table.php b/database/migrations/2024_08_07_102758_add_ogranization_and_contact_to_invoices_table.php new file mode 100644 index 000000000..bbd9888cd --- /dev/null +++ b/database/migrations/2024_08_07_102758_add_ogranization_and_contact_to_invoices_table.php @@ -0,0 +1,30 @@ +string('organization_name')->after('amount'); + $table->string('contact_first_name')->after('organization_name'); + $table->string('contact_last_name')->after('contact_first_name'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('invoices', function (Blueprint $table) { + // + }); + } +}; diff --git a/package-lock.json b/package-lock.json index 20ce51495..70e316c00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,8 @@ "packages": { "": { "dependencies": { - "axios": "^1.7.3" + "axios": "^1.7.3", + "html2pdf.js": "^0.10.2" }, "devDependencies": { "@inertiajs/vue3": "^1.0.15", @@ -60,6 +61,17 @@ "node": ">=6.0.0" } }, + "node_modules/@babel/runtime": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.0.tgz", + "integrity": "sha512-7dRy4DwXwtzBrPbZflqxnvfxLF8kdZXPkhymtDeFoFqE6ldzjQFgYTtYIFARcLEYDrqfBfYcZt1WqFxRoyC9Rw==", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", @@ -891,6 +903,12 @@ "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, + "node_modules/@types/raf": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@types/raf/-/raf-3.4.3.tgz", + "integrity": "sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==", + "optional": true + }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", @@ -1106,6 +1124,17 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, + "node_modules/atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "bin": { + "atob": "bin/atob.js" + }, + "engines": { + "node": ">= 4.5.0" + } + }, "node_modules/autoprefixer": { "version": "10.4.19", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.19.tgz", @@ -1159,6 +1188,14 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/binary-extensions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", @@ -1232,6 +1269,17 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/btoa": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz", + "integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==", + "bin": { + "btoa": "bin/btoa.js" + }, + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/call-bind": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", @@ -1289,6 +1337,31 @@ } ] }, + "node_modules/canvg": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.10.tgz", + "integrity": "sha512-qwR2FRNO9NlzTeKIPIKpnTY6fqwuYSequ8Ru8c0YkYU7U0oW+hLUvWadLvAu1Rl72OMNiFhoLu4f8eUjQ7l/+Q==", + "optional": true, + "dependencies": { + "@babel/runtime": "^7.12.5", + "@types/raf": "^3.4.0", + "core-js": "^3.8.3", + "raf": "^3.4.1", + "regenerator-runtime": "^0.13.7", + "rgbcolor": "^1.0.1", + "stackblur-canvas": "^2.0.0", + "svg-pathdata": "^6.0.3" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/canvg/node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", + "optional": true + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -1385,6 +1458,17 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/core-js": { + "version": "3.38.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.38.0.tgz", + "integrity": "sha512-XPpwqEodRljce9KswjZShh95qJ1URisBeKCjUdq27YdenkslVe7OO0ZJhlYXAChW7OhXaRLl8AAba7IBfoIHug==", + "hasInstallScript": true, + "optional": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -1399,6 +1483,14 @@ "node": ">= 8" } }, + "node_modules/css-line-break": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", + "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", + "dependencies": { + "utrie": "^1.0.2" + } + }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -1498,6 +1590,12 @@ "node": ">=6.0.0" } }, + "node_modules/dompurify": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.5.6.tgz", + "integrity": "sha512-zUTaUBO8pY4+iJMPE1B9XlO2tXVYIcEA4SNGtvDELzTSCQO7RzH+j7S180BmhmJId78lqGU2z19vgVx2Sxs/PQ==", + "optional": true + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -1549,6 +1647,11 @@ "node": ">= 0.4" } }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, "node_modules/esbuild": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz", @@ -1858,6 +1961,11 @@ "reusify": "^1.0.4" } }, + "node_modules/fflate": { + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz", + "integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==" + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -2150,6 +2258,28 @@ "node": ">= 0.4" } }, + "node_modules/html2canvas": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", + "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", + "dependencies": { + "css-line-break": "^2.1.0", + "text-segmentation": "^1.0.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/html2pdf.js": { + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/html2pdf.js/-/html2pdf.js-0.10.2.tgz", + "integrity": "sha512-WyHVeMb18Bp7vYTmBv1GVsThH//K7SRfHdSdhHPkl4JvyQarNQXnailkYn0QUbRRmnN5rdbbmSIGEsPZtzPy2Q==", + "dependencies": { + "es6-promise": "^4.2.5", + "html2canvas": "^1.0.0", + "jspdf": "^2.3.1" + } + }, "node_modules/ignore": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", @@ -2336,6 +2466,23 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, + "node_modules/jspdf": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/jspdf/-/jspdf-2.5.1.tgz", + "integrity": "sha512-hXObxz7ZqoyhxET78+XR34Xu2qFGrJJ2I2bE5w4SM8eFaFEkW2xcGRVUss360fYelwRSid/jT078kbNvmoW0QA==", + "dependencies": { + "@babel/runtime": "^7.14.0", + "atob": "^2.1.2", + "btoa": "^1.2.1", + "fflate": "^0.4.8" + }, + "optionalDependencies": { + "canvg": "^3.0.6", + "core-js": "^3.6.0", + "dompurify": "^2.2.0", + "html2canvas": "^1.0.0-rc.5" + } + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -2753,6 +2900,12 @@ "node": "14 || >=16.14" } }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", + "optional": true + }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -3024,6 +3177,15 @@ } ] }, + "node_modules/raf": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", + "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", + "optional": true, + "dependencies": { + "performance-now": "^2.1.0" + } + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -3045,6 +3207,11 @@ "node": ">=8.10.0" } }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", @@ -3081,6 +3248,15 @@ "node": ">=0.10.0" } }, + "node_modules/rgbcolor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/rgbcolor/-/rgbcolor-1.0.1.tgz", + "integrity": "sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==", + "optional": true, + "engines": { + "node": ">= 0.8.15" + } + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -3245,6 +3421,15 @@ "node": ">=0.10.0" } }, + "node_modules/stackblur-canvas": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/stackblur-canvas/-/stackblur-canvas-2.7.0.tgz", + "integrity": "sha512-yf7OENo23AGJhBriGx0QivY5JP6Y1HbrrDI6WLt6C5auYZXlQrheoY8hD4ibekFKz1HOfE48Ww8kMWMnJD/zcQ==", + "optional": true, + "engines": { + "node": ">=0.1.14" + } + }, "node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", @@ -3439,6 +3624,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/svg-pathdata": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/svg-pathdata/-/svg-pathdata-6.0.3.tgz", + "integrity": "sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==", + "optional": true, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/tailwind-classes-sorter": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/tailwind-classes-sorter/-/tailwind-classes-sorter-0.2.5.tgz", @@ -3502,6 +3696,14 @@ "postcss": "^8.0.0" } }, + "node_modules/text-segmentation": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", + "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", + "dependencies": { + "utrie": "^1.0.2" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -3617,6 +3819,14 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, + "node_modules/utrie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", + "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", + "dependencies": { + "base64-arraybuffer": "^1.0.2" + } + }, "node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", diff --git a/package.json b/package.json index b673158eb..4cbd84aef 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "vue": "^3.2.27" }, "dependencies": { - "axios": "^1.7.3" + "axios": "^1.7.3", + "html2pdf.js": "^0.10.2" } } diff --git a/resources/js/Pages/Invoices/Create.vue b/resources/js/Pages/Invoices/Create.vue index 924366f27..858b1aa38 100644 --- a/resources/js/Pages/Invoices/Create.vue +++ b/resources/js/Pages/Invoices/Create.vue @@ -1,38 +1,47 @@