From 442822e472d2804ac1be82543fdb5c27ca23993f Mon Sep 17 00:00:00 2001 From: Ranjan Date: Tue, 16 Apr 2024 10:54:23 +0545 Subject: [PATCH] taxation module --- Modules/Employee/app/Models/Employee.php | 2 +- .../app/Repositories/EmployeeRepository.php | 3 +- .../Http/Controllers/LeaveTypeController.php | 1 - .../Http/Controllers/InvoiceController.php | 91 ++++++++ .../views/invoice/clone-product.blade.php | 39 ++++ .../{leave-type => invoice}/create.blade.php | 19 +- .../{leave-type => invoice}/edit.blade.php | 0 .../{leave-type => invoice}/index.blade.php | 8 +- .../views/invoice/partials/action.blade.php | 207 ++++++++++++++++++ .../partials/view.blade.php | 0 .../{leave-type => invoice}/show.blade.php | 0 .../leave-type/partials/action.blade.php | 25 --- Modules/Taxation/routes/web.php | 6 +- public/assets/js/pages/form-masks.init.js | 75 ++++++- .../views/layouts/partials/sidebar.blade.php | 2 +- routes/web.php | 2 +- 16 files changed, 433 insertions(+), 47 deletions(-) create mode 100644 Modules/Taxation/app/Http/Controllers/InvoiceController.php create mode 100644 Modules/Taxation/resources/views/invoice/clone-product.blade.php rename Modules/Taxation/resources/views/{leave-type => invoice}/create.blade.php (52%) rename Modules/Taxation/resources/views/{leave-type => invoice}/edit.blade.php (100%) rename Modules/Taxation/resources/views/{leave-type => invoice}/index.blade.php (89%) create mode 100644 Modules/Taxation/resources/views/invoice/partials/action.blade.php rename Modules/Taxation/resources/views/{leave-type => invoice}/partials/view.blade.php (100%) rename Modules/Taxation/resources/views/{leave-type => invoice}/show.blade.php (100%) delete mode 100644 Modules/Taxation/resources/views/leave-type/partials/action.blade.php diff --git a/Modules/Employee/app/Models/Employee.php b/Modules/Employee/app/Models/Employee.php index 076c097..ac88f22 100644 --- a/Modules/Employee/app/Models/Employee.php +++ b/Modules/Employee/app/Models/Employee.php @@ -10,7 +10,7 @@ class Employee extends Model protected $table = 'tbl_employees'; protected $primaryKey = 'id'; protected $guarded = []; - protected $appends = (['full_name']); + protected $appends = ['full_name']; protected function getFullNameAttribute() { diff --git a/Modules/Employee/app/Repositories/EmployeeRepository.php b/Modules/Employee/app/Repositories/EmployeeRepository.php index d244e2d..8f5c1cd 100644 --- a/Modules/Employee/app/Repositories/EmployeeRepository.php +++ b/Modules/Employee/app/Repositories/EmployeeRepository.php @@ -2,6 +2,7 @@ namespace Modules\Employee\Repositories; +use Illuminate\Support\Facades\DB; use Modules\Employee\Models\Employee; class EmployeeRepository implements EmployeeInterface @@ -38,7 +39,7 @@ class EmployeeRepository implements EmployeeInterface public function pluck() { - return Employee::pluck('first_name', 'id'); + return Employee::pluck(DB::raw('CONCAT(first_name," ", middle_name , " ",last_name) AS full_name'), 'id'); } // public function uploadImage($file) diff --git a/Modules/Leave/app/Http/Controllers/LeaveTypeController.php b/Modules/Leave/app/Http/Controllers/LeaveTypeController.php index f07bace..a7ba13c 100644 --- a/Modules/Leave/app/Http/Controllers/LeaveTypeController.php +++ b/Modules/Leave/app/Http/Controllers/LeaveTypeController.php @@ -34,7 +34,6 @@ class LeaveTypeController extends Controller public function create() { $data['title'] = 'Create Leave Type'; - return view('leave::leave-type.create', $data); } diff --git a/Modules/Taxation/app/Http/Controllers/InvoiceController.php b/Modules/Taxation/app/Http/Controllers/InvoiceController.php new file mode 100644 index 0000000..03f2da6 --- /dev/null +++ b/Modules/Taxation/app/Http/Controllers/InvoiceController.php @@ -0,0 +1,91 @@ +employeeRepository = $employeeRepository; + } + /** + * Display a listing of the resource. + */ + public function index() + { + $data['title'] = 'Invoice List'; + $data['invoices'] = []; + return view('taxation::invoice.index', $data); + } + + /** + * Show the form for creating a new resource. + */ + public function create() + { + $data['title'] = 'Create Invoice'; + $data['companyList'] = Companies::pluck('title', 'company_id'); + $data['employeeList'] = $this->employeeRepository->pluck(); + + return view('taxation::invoice.create', $data); + } + + /** + * Store a newly created resource in storage. + */ + public function store(Request $request): RedirectResponse + { + // + } + + /** + * Show the specified resource. + */ + public function show($id) + { + return view('taxation::invoice.show'); + } + + /** + * Show the form for editing the specified resource. + */ + public function edit($id) + { + return view('taxation::invoice.edit'); + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, $id): RedirectResponse + { + // + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + // + } + + public function cloneProduct(Request $request) + { + $data = []; + $numInc = $request->numberInc; + $script = true; + return response()->json([ + 'view' => view('taxation::invoice.clone-product', compact('data', 'numInc', 'script'))->render(), + ]); + } +} diff --git a/Modules/Taxation/resources/views/invoice/clone-product.blade.php b/Modules/Taxation/resources/views/invoice/clone-product.blade.php new file mode 100644 index 0000000..63c7787 --- /dev/null +++ b/Modules/Taxation/resources/views/invoice/clone-product.blade.php @@ -0,0 +1,39 @@ +
+
+
+ {{ html()->label('Product')->class('form-label') }} + {{ html()->text('product_id')->class('form-control')->placeholder('Enter Product Name')->required() }} +
+ +
+ {{ html()->label('Unit')->class('form-label') }} + {{ html()->text('unit')->class('form-control')->placeholder('Enter Unit')->required() }} +
+ +
+ {{ html()->label('Rate')->class('form-label') }} + {{ html()->text('rate')->class('form-control product-price cleave-numeral')->placeholder('Enter Rate')->attributes(['id' => 'cleave-numeral']) }} +
+ +
+ {{ html()->label('Quantity')->class('form-label') }} + {{ html()->text('qty')->class('form-control product-quantity cleave-numeral')->placeholder('Enter QTY')->attributes(['id' => 'cleave-numeral']) }} +
+ +
+ {{ html()->label('Amount')->class('form-label') }} + {{ html()->text('amt')->class('form-control product-line-price bg-light')->placeholder('Enter Amount')->isReadOnly() }} +
+ +
+ {{ html()->label('Description')->class('form-label') }} + {{ html()->text('desc')->class('form-control')->placeholder('Enter Description') }} +
+ +
+ +
+ +
+
diff --git a/Modules/Taxation/resources/views/leave-type/create.blade.php b/Modules/Taxation/resources/views/invoice/create.blade.php similarity index 52% rename from Modules/Taxation/resources/views/leave-type/create.blade.php rename to Modules/Taxation/resources/views/invoice/create.blade.php index 8fab614..bb88da0 100644 --- a/Modules/Taxation/resources/views/leave-type/create.blade.php +++ b/Modules/Taxation/resources/views/invoice/create.blade.php @@ -6,19 +6,16 @@ @include('layouts.partials.breadcrumb', ['title' => $title]) -
-
-
-
-
- @csrf - @include('leave::leave.partials.action') -
-
-
+ +
+
+
+ @csrf + @include('taxation::invoice.partials.action') +
- +
diff --git a/Modules/Taxation/resources/views/leave-type/edit.blade.php b/Modules/Taxation/resources/views/invoice/edit.blade.php similarity index 100% rename from Modules/Taxation/resources/views/leave-type/edit.blade.php rename to Modules/Taxation/resources/views/invoice/edit.blade.php diff --git a/Modules/Taxation/resources/views/leave-type/index.blade.php b/Modules/Taxation/resources/views/invoice/index.blade.php similarity index 89% rename from Modules/Taxation/resources/views/leave-type/index.blade.php rename to Modules/Taxation/resources/views/invoice/index.blade.php index ff62f20..0def1dc 100644 --- a/Modules/Taxation/resources/views/leave-type/index.blade.php +++ b/Modules/Taxation/resources/views/invoice/index.blade.php @@ -9,9 +9,9 @@
-
Leave Lists
+
{{ $title }}
- Add
@@ -22,14 +22,14 @@ S.N - Leave Type + Id Created By Status Action - @forelse ($leaveTypes as $key => $leaveType) + @forelse ($invoices as $key => $leaveType) {{ $key + 1 }} {{ $leaveType->employee_id }} diff --git a/Modules/Taxation/resources/views/invoice/partials/action.blade.php b/Modules/Taxation/resources/views/invoice/partials/action.blade.php new file mode 100644 index 0000000..323e288 --- /dev/null +++ b/Modules/Taxation/resources/views/invoice/partials/action.blade.php @@ -0,0 +1,207 @@ +
+
Invoice Details
+
+
+ {{ html()->label('Company')->class('form-label') }} + {{ html()->select('company_id', $companyList)->class('form-control')->placeholder('Select Company')->required() }} + {{ html()->div('Please select company')->class('invalid-feedback') }} +
+ +
+ {{ html()->label('Invoice No.')->class('form-label') }} + {{ html()->text('invoice_no')->class('form-control')->placeholder('Enter Invoice No')->attributes(['id' => 'cleave-prefix']) }} +
+ +
+ {{ html()->label('VAT No.')->class('form-label') }} + {{ html()->text('vat_no')->class('form-control')->placeholder('Enter VAT No') }} +
+ +
+ {{ html()->label('Sales Date')->class('form-label') }} + {{ html()->date('sale_date')->class('form-control')->placeholder('Choose Sales Date')->required() }} + {{ html()->div('Please choose invoice date')->class('invalid-feedback') }} +
+ +
+ {{ html()->label('Bill Issue Date')->class('form-label') }} + {{ html()->date('isse_date')->class('form-control')->placeholder('Choose Bill Issue Date')->required() }} + {{ html()->div('Please choose invoice date')->class('invalid-feedback') }} +
+ +
+ + +
+
Buyer Details
+
+ +
+ {{ html()->label('Buyer')->class('form-label') }} + {{ html()->select('buyer_id', $employeeList)->class('form-control')->placeholder('Select Buyer') }} +
+ +
+ {{ html()->label('Address No.')->class('form-label') }} + {{ html()->text('buyer_address')->class('form-control')->placeholder('Enter Address') }} +
+ +
+ {{ html()->label('VAT No.')->class('form-label') }} + {{ html()->text('vat_no')->class('form-control')->placeholder('Enter Buyer VAT No') }} +
+ +
+ {{ html()->label('Contact No')->class('form-label') }} + {{ html()->date('sale_date')->class('form-control')->placeholder('Enter Contact No') }} +
+ +
+ {{ html()->label('Mode of Payment')->class('form-label') }} + {{ html()->select('buyer_id', [1 => 'Cash', 2 => 'Bank', 3 => 'Credit'])->class('form-control')->placeholder('Select Payment Mode') }} +
+ +
+ +{{--
+

Shipping Details

+
+
+ {{ html()->label('Address')->class('form-label') }} + {{ html()->text('address')->class('form-control')->placeholder('Enter Address') }} +
+ +
+ {{ html()->label('Shipping Date')->class('form-label') }} + {{ html()->date('shiiping_date')->class('form-control')->placeholder('Enter Temporary Address') }} +
+
--}} + +
+
+ +
+ @include('taxation::invoice.clone-product') +
+
+ +
+ + + + + + + + + + + + + + + + + + + +
Sub Total + +
Estimated Tax (11%) + +
Discount + +
Total Amount + +
+ +
+ +
+ +
+ + +@push('js') + + + + +@endpush diff --git a/Modules/Taxation/resources/views/leave-type/partials/view.blade.php b/Modules/Taxation/resources/views/invoice/partials/view.blade.php similarity index 100% rename from Modules/Taxation/resources/views/leave-type/partials/view.blade.php rename to Modules/Taxation/resources/views/invoice/partials/view.blade.php diff --git a/Modules/Taxation/resources/views/leave-type/show.blade.php b/Modules/Taxation/resources/views/invoice/show.blade.php similarity index 100% rename from Modules/Taxation/resources/views/leave-type/show.blade.php rename to Modules/Taxation/resources/views/invoice/show.blade.php diff --git a/Modules/Taxation/resources/views/leave-type/partials/action.blade.php b/Modules/Taxation/resources/views/leave-type/partials/action.blade.php deleted file mode 100644 index 50e04e8..0000000 --- a/Modules/Taxation/resources/views/leave-type/partials/action.blade.php +++ /dev/null @@ -1,25 +0,0 @@ -
- - - {{ html()->select('employee_id', $employeeList)->class('form-select')->placeholder('Select Employee') }} -
- -
- - -
- -
- - -
- -
- -
- -@push('js') - -@endpush diff --git a/Modules/Taxation/routes/web.php b/Modules/Taxation/routes/web.php index 21b2fac..d1a6312 100644 --- a/Modules/Taxation/routes/web.php +++ b/Modules/Taxation/routes/web.php @@ -1,6 +1,7 @@ names('taxation'); + Route::resource('invoice', InvoiceController::class)->names('invoice'); + Route::get('clone-product', [InvoiceController::class, 'cloneProduct'])->name('cloneProduct'); + }); diff --git a/public/assets/js/pages/form-masks.init.js b/public/assets/js/pages/form-masks.init.js index 52b9dc7..dce4799 100644 --- a/public/assets/js/pages/form-masks.init.js +++ b/public/assets/js/pages/form-masks.init.js @@ -1 +1,74 @@ -var cleaveDate,cleaveDateFormat,cleaveTime,cleaveTimeFormat,cleaveNumeral,cleaveDelimiter,cleaveDelimiters,cleavePrefix,cleaveBlocks;document.querySelector("#cleave-date")&&(cleaveDate=new Cleave("#cleave-date",{date:!0,delimiter:"-",datePattern:["d","m","Y"]})),document.querySelector("#cleave-date-format")&&(cleaveDateFormat=new Cleave("#cleave-date-format",{date:!0,datePattern:["m","y"]})),document.querySelector("#cleave-time")&&(cleaveTime=new Cleave("#cleave-time",{time:!0,timePattern:["h","m","s"]})),document.querySelector("#cleave-time-format")&&(cleaveTimeFormat=new Cleave("#cleave-time-format",{time:!0,timePattern:["h","m"]})),document.querySelector("#cleave-numeral")&&(cleaveNumeral=new Cleave("#cleave-numeral",{numeral:!0,numeralThousandsGroupStyle:"thousand"})),document.querySelector("#cleave-ccard")&&(cleaveBlocks=new Cleave("#cleave-ccard",{blocks:[4,4,4,4],uppercase:!0})),document.querySelector("#cleave-delimiter")&&(cleaveDelimiter=new Cleave("#cleave-delimiter",{delimiter:"·",blocks:[3,3,3],uppercase:!0})),document.querySelector("#cleave-delimiters")&&(cleaveDelimiters=new Cleave("#cleave-delimiters",{delimiters:[".",".","-"],blocks:[3,3,3,2],uppercase:!0})),document.querySelector("#cleave-prefix")&&(cleavePrefix=new Cleave("#cleave-prefix",{prefix:"PREFIX",delimiter:"-",blocks:[6,4,4,4],uppercase:!0})),document.querySelector("#cleave-phone")&&(cleaveBlocks=new Cleave("#cleave-phone",{delimiters:["(",")","-"],blocks:[0,3,3,4]})); \ No newline at end of file +var cleaveDate, + cleaveDateFormat, + cleaveTime, + cleaveTimeFormat, + cleaveNumeral, + cleaveDelimiter, + cleaveDelimiters, + cleavePrefix, + cleaveBlocks; +document.querySelector("#cleave-date") && + (cleaveDate = new Cleave("#cleave-date", { + date: !0, + delimiter: "-", + datePattern: ["d", "m", "Y"], + })), + document.querySelector("#cleave-date-format") && + (cleaveDateFormat = new Cleave("#cleave-date-format", { + date: !0, + datePattern: ["m", "y"], + })), + document.querySelector("#cleave-time") && + (cleaveTime = new Cleave("#cleave-time", { + time: !0, + timePattern: ["h", "m", "s"], + })), + + + document.querySelector("#cleave-time-format") && + (cleaveTimeFormat = new Cleave("#cleave-time-format", { + time: !0, + timePattern: ["h", "m"], + })), + + document.querySelectorAll(".cleave-numeral").forEach(function (element) { + new Cleave(element, { + numeral: !0, + numeralThousandsGroupStyle: "thousand", + }); + }); + +// document.querySelector("cleave-numeral") && +// (cleaveNumeral = new Cleave(".cleave-numeral", { +// numeral: !0, +// numeralThousandsGroupStyle: "thousand", +// })), +document.querySelector("#cleave-ccard") && + (cleaveBlocks = new Cleave("#cleave-ccard", { + blocks: [4, 4, 4, 4], + uppercase: !0, + })), + document.querySelector("#cleave-delimiter") && + (cleaveDelimiter = new Cleave("#cleave-delimiter", { + delimiter: "·", + blocks: [3, 3, 3], + uppercase: !0, + })), + document.querySelector("#cleave-delimiters") && + (cleaveDelimiters = new Cleave("#cleave-delimiters", { + delimiters: [".", ".", "-"], + blocks: [3, 3, 3, 2], + uppercase: !0, + })), + document.querySelector("#cleave-prefix") && + (cleavePrefix = new Cleave("#cleave-prefix", { + prefix: "INV", + delimiter: "-", + blocks: [3, 4, 4, 4], + uppercase: !0, + })), + document.querySelector("#cleave-phone") && + (cleaveBlocks = new Cleave("#cleave-phone", { + delimiters: ["(", ")", "-"], + blocks: [0, 3, 3, 4], + })); \ No newline at end of file diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index a9cdf1a..a75622b 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -116,7 +116,7 @@
diff --git a/routes/web.php b/routes/web.php index 2aac4dc..eac1459 100644 --- a/routes/web.php +++ b/routes/web.php @@ -19,7 +19,7 @@ Route::get('/', function () { return view('welcome'); }); -Route::get('/invoice', function () { +Route::get('/invoice-test', function () { return view('invoice'); });