diff --git a/.env.example b/.env.example deleted file mode 100644 index a9fa2b4..0000000 --- a/.env.example +++ /dev/null @@ -1,38 +0,0 @@ -IS_DEMO=false - -APP_NAME=Laravel -APP_ENV=local -APP_KEY= -APP_DEBUG=true -APP_URL=http://localhost - -LOG_CHANNEL=stack -LOG_LEVEL=debug - -DB_CONNECTION=mysql -DB_HOST=127.0.0.1 -DB_PORT=3306 -DB_DATABASE= -DB_USERNAME= -DB_PASSWORD= - -BROADCAST_DRIVER=log -CACHE_DRIVER=file -QUEUE_CONNECTION=sync -SESSION_DRIVER=file -SESSION_LIFETIME=120 - -MEMCACHED_HOST=127.0.0.1 - -REDIS_HOST=127.0.0.1 -REDIS_PASSWORD=null -REDIS_PORT=6379 - -MAIL_MAILER=smtp -MAIL_HOST=smtp.mailtrap.io -MAIL_PORT=2525 -MAIL_USERNAME= -MAIL_PASSWORD= -MAIL_ENCRYPTION=tls - -IS_DEMO=false diff --git a/README.md b/README.md index 9b55a66..e944e65 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ Also, you will need to install Composer: https://getcomposer.org/doc/00-intro.md ## Usage -Register a user or login using admin@volt.com and secret and start testing the Laravel app (make sure to run the migrations and seeders for these credentials to be available). +Register a user or login using admin@gmail.com and secret and start testing the Laravel app (make sure to run the migrations and seeders for these credentials to be available). Make sure to run the migrations and seeders for the above credentials to be available. Make sure to run the migrations and seeders for the above credentials to be available. diff --git a/app/Http/Controllers/AcademicController.php b/app/Http/Controllers/AcademicController.php new file mode 100644 index 0000000..7833fbc --- /dev/null +++ b/app/Http/Controllers/AcademicController.php @@ -0,0 +1,10 @@ + \Illuminate\Routing\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, + + 'admin' => \App\Http\Middleware\Admin::class, + 'student' => \App\Http\Middleware\Student::class, + 'academic' => \App\Http\Middleware\Academic::class, ]; } diff --git a/app/Http/Livewire/Auth/Login.php b/app/Http/Livewire/Auth/Login.php index 0c7f22d..8537ad0 100644 --- a/app/Http/Livewire/Auth/Login.php +++ b/app/Http/Livewire/Auth/Login.php @@ -4,38 +4,53 @@ use App\Models\User; use Livewire\Component; +use Auth; class Login extends Component { - public $email = ''; public $password = ''; public $remember_me = false; + public $redirectTo; // Change this line to public protected $rules = [ 'email' => 'required|email:rfc,dns', 'password' => 'required|min:6', ]; - //This mounts the default credentials for the admin. Remove this section if you want to make it public. public function mount() { if (auth()->user()) { return redirect()->intended('/dashboard'); } $this->fill([ - 'email' => 'admin@volt.com', + 'email' => 'admin@gmail.com', 'password' => 'secret', ]); } + public function redirectTo() + { + switch (Auth::user()->role) { + case 1: + $this->redirectTo = '/admin'; + return $this->redirectTo; + case 2: + $this->redirectTo = '/user'; + return $this->redirectTo; + default: + $this->redirectTo = '/dashboard'; //if user doesn't have any role + return $this->redirectTo; + } + } + public function login() { $credentials = $this->validate(); if (auth()->attempt(['email' => $this->email, 'password' => $this->password], $this->remember_me)) { $user = User::where(['email' => $this->email])->first(); auth()->login($user, $this->remember_me); - return redirect()->intended('/dashboard'); + return redirect()->intended($this->redirectTo()); // Update this line to use redirectTo method } else { return $this->addError('email', trans('auth.failed')); } diff --git a/app/Http/Livewire/Auth/Register.php b/app/Http/Livewire/Auth/Register.php index ce804f1..2edc541 100644 --- a/app/Http/Livewire/Auth/Register.php +++ b/app/Http/Livewire/Auth/Register.php @@ -9,10 +9,10 @@ class Register extends Component { - public $email = ''; public $password = ''; public $passwordConfirmation = ''; + public $role; public function mount() { @@ -23,25 +23,40 @@ public function mount() public function updatedEmail() { - $this->validate(['email'=>'required|email:rfc,dns|unique:users']); + $this->validate(['email' => 'required|email:rfc,dns|unique:users']); } - + public function register() { $this->validate([ - 'email' => 'required', + 'email' => 'required|email|unique:users', 'password' => 'required|same:passwordConfirmation|min:6', + 'role' => 'required|integer|in:1,2,3', ]); $user = User::create([ - 'email' =>$this->email, + 'email' => $this->email, 'password' => Hash::make($this->password), 'remember_token' => Str::random(10), + 'role' => $this->role, ]); auth()->login($user); - return redirect('/profile'); + // Redirect based on role + return $this->redirectBasedOnRole($user->role); + } + + protected function redirectBasedOnRole($role) + { + switch ($role) { + case 1: + return redirect('/admin'); // Redirect to admin dashboard + case 2: + return redirect('/user'); + default: + return redirect('/dashboard'); // Default fallback + } } public function render() diff --git a/app/Http/Livewire/Dashboard.php b/app/Http/Livewire/Dashboard.php index fcb518d..f5a96de 100644 --- a/app/Http/Livewire/Dashboard.php +++ b/app/Http/Livewire/Dashboard.php @@ -3,11 +3,44 @@ namespace App\Http\Livewire; use Livewire\Component; +use Livewire\WithPagination; +use App\Models\Report; +use Illuminate\Support\Facades\Auth; class Dashboard extends Component { + use WithPagination; // Add pagination trait for Livewire + + public $search = ''; // Initialize search as an empty string + public $confirmingDelete = false; + public $user; + public function render() { - return view('dashboard'); + // Get the authenticated user + $this->user = Auth::user(); + + // Query for reports, applying search filter if present + $query = Report::query(); + + // Apply search filter + if (!empty($this->search)) { + $query->where('item_name', 'like', '%' . $this->search . '%'); + } + + // Get paginated results + $reports = $query->paginate(10); + + // Return view with data + return view('livewire.dashboard', [ + 'user' => $this->user, + 'reports' => $reports + ]); + } + + public function updatingSearch() + { + // Reset pagination when the search term is updated + $this->resetPage(); } } diff --git a/app/Http/Livewire/EditReport.php b/app/Http/Livewire/EditReport.php new file mode 100644 index 0000000..77eb4bb --- /dev/null +++ b/app/Http/Livewire/EditReport.php @@ -0,0 +1,57 @@ +edit($id); // Load the report details for editing + } + } + + public function edit($id) + { + $report = Report::find($id); + + if ($report) { + $this->reportId = $report->id; + $this->item_name = $report->item_name; + $this->item_code = $report->item_code; + $this->generic_item_name = $report->generic_item_name; + $this->item_category = $report->item_category; + $this->department = $report->department; + $this->machine = $report->machine; + $this->test_code = $report->test_code; + $this->test_name = $report->test_name; + $this->supplier_name = $report->supplier_name; + $this->address = $report->address; + $this->manufacture = $report->manufacture; + $this->hsn_code = $report->hsn_code; + $this->unit_of_perchase = $report->unit_of_perchase; + $this->pack_size = $report->pack_size; + $this->test = $report->test; + $this->unit_price = $report->unit_price; + $this->cgst = $report->cgst; + $this->sgst = $report->sgst; + $this->price_gst = $report->price_gst; + return $this->render(); + } else { + // Handle case when the report is not found + session()->flash('error', 'Report not found.'); + } + } + + public function render() + { + return view('livewire.edit-report'); + } +} diff --git a/app/Http/Livewire/Reports.php b/app/Http/Livewire/Reports.php new file mode 100644 index 0000000..1fb8e21 --- /dev/null +++ b/app/Http/Livewire/Reports.php @@ -0,0 +1,155 @@ +edit($id); + } + } + + public function bulkImport() + { + $this->validate(['file' => 'required|mimes:xlsx,csv']); + Excel::import(new ReportsImport, $this->file); + session()->flash('success', 'Reports imported successfully.'); + $this->emit('fileUploaded'); + } + + public function submit() + { + // $this->validate($this->rules()); + Report::create( [ + 'item_category' => $this->item_category, + 'generic_item_name' => $this->generic_item_name, + 'item_name' => $this->item_name, + 'item_code' => $this->item_code, + 'department' => $this->department, + 'machine' => $this->machine, + 'test_code' => $this->test_code, + 'test_name' => $this->test_name, + 'supplier_name' => $this->supplier_name, + 'address' => $this->address, + 'manufacture' => $this->manufacture, + 'hsn_code' => $this->hsn_code, + 'unit_of_perchase' => $this->unit_of_perchase, + 'pack_size' => $this->pack_size, + 'test' => $this->test, + 'unit_price' => $this->unit_price, + 'cgst' => $this->cgst, + 'sgst' => $this->sgst, + 'price_gst' => $this->price_gst, + ]); + session()->flash('success', 'Report created successfully.'); + $this->resetInputFields(); + } + + public function updateReport() + { + $this->validate($this->rules()); + $report = Report::find($this->reportId); + $report->update($this->formData()); + session()->flash('success', 'Report updated successfully.'); + $this->isEditing = false; + $this->resetInputFields(); + } + + public function edit($id) + { + $this->isEditing = true; + $report = Report::find($id); + $this->reportId = $report->id; + $this->item_name = $report->item_name; + $this->item_code = $report->item_code; + $this->generic_item_name = $report->generic_item_name; + $this->item_category = $report->item_category; + $this->department = $report->department; + $this->machine = $report->machine; + $this->test_code = $report->test_code; + $this->test_name = $report->test_name; + $this->supplier_name = $report->supplier_name; + $this->address = $report->address; + $this->manufacture = $report->manufacture; + $this->hsn_code = $report->hsn_code; + $this->unit_of_perchase = $report->unit_of_perchase; + $this->pack_size = $report->pack_size; + $this->test = $report->test; + $this->unit_price = $report->unit_price; + $this->cgst = $report->cgst; + $this->sgst = $report->sgst; + $this->price_gst = $report->price_gst; + return view('livewire.reports',['isEditing' => $this->isEditing]); + } + public function download() + { + $filePath = public_path('assets/bulkimport.xlsx'); + + return Response::download($filePath); + } + public function resetInputFields() + { + $this->item_name = ''; + $this->item_code = ''; + $this->generic_item_name = ''; + $this->item_category = ''; + $this->department = ''; + $this->machine = ''; + $this->test_code = ''; + $this->test_name = ''; + $this->supplier_name = ''; + $this->address = ''; + $this->manufacture = ''; + $this->hsn_code = ''; + $this->unit_of_perchase = ''; + $this->pack_size = ''; + $this->test = ''; + $this->unit_price = ''; + $this->cgst = ''; + $this->sgst = ''; + $this->price_gst = ''; + } + + protected function rules() + { + return [ + 'item_name' => 'required|string', + 'item_code' => 'required|string', + 'generic_item_name' => 'nullable|string', + 'item_category' => 'nullable|string', + 'department' => 'nullable|string', + 'machine' => 'nullable|string', + 'test_code' => 'nullable|string', + 'test_name' => 'nullable|string', + 'supplier_name' => 'nullable|string', + 'address' => 'nullable|string', + 'manufacture' => 'nullable|string', + 'hsn_code' => 'nullable|string', + 'unit_of_perchase' => 'nullable|string', + 'pack_size' => 'nullable|string', + 'test' => 'nullable|string', + 'unit_price' => 'nullable|numeric', + 'cgst' => 'nullable|numeric', + 'sgst' => 'nullable|numeric', + 'price_gst' => 'nullable|numeric', + ]; + } + + public function render() + { + return view('livewire.reports'); + } +} diff --git a/app/Http/Livewire/SearchReports.php b/app/Http/Livewire/SearchReports.php new file mode 100644 index 0000000..15c8c08 --- /dev/null +++ b/app/Http/Livewire/SearchReports.php @@ -0,0 +1,55 @@ +reports = Report::all(); // Load all records initially + } + + public function updatedSearchTest() // Triggered when the searchTest changes + { + $this->searchFeedMessage(); // Call the search method when input changes + } + + public function searchFeedMessage() + { + if ($this->searchTest !== '') { + // Filter reports based on search input + $this->reports = Report::where('test', 'like', '%' . $this->searchTest . '%')->get(); + } else { + // Reset reports to show all records when the search input is empty + $this->reports = Report::all(); + } + } + + public function updatedSearchItem() // Triggered when the searchTest changes + { + $this->searchItemReports(); // Call the search method when input changes + } + + public function searchItemReports() + { + if ($this->searchItem !== '') { + // Filter reports based on search input + $this->reports = Report::where('item_name', 'like', '%' . $this->searchItem . '%')->get(); + } else { + // Reset reports to show all records when the search input is empty + $this->reports = Report::all(); + } + } + + public function render() + { + // Pass the current reports to the view + return view('livewire.search-reports', ['reports' => $this->reports]); + } +} diff --git a/app/Http/Middleware/Academic.php b/app/Http/Middleware/Academic.php new file mode 100644 index 0000000..9825fd9 --- /dev/null +++ b/app/Http/Middleware/Academic.php @@ -0,0 +1,20 @@ +route('login'); + } + + // Handle role-based redirection + switch (Auth::user()->role) { + case 1: + // Admin, allow access to the request + return $next($request); + + case 2: + // Redirect academic users to the academic dashboard + return redirect()->route('user'); + + default: + // Redirect back if role does not match (user is trying to access an unauthorized dashboard) + return back()->with('error', 'Unauthorized access.'); + } + } +} diff --git a/app/Http/Middleware/Student.php b/app/Http/Middleware/Student.php new file mode 100644 index 0000000..b872fa4 --- /dev/null +++ b/app/Http/Middleware/Student.php @@ -0,0 +1,39 @@ +route('login'); + } + + // Handle role-based redirection + switch (Auth::user()->role) { + case 1: + // Admin, allow access to the request + return $next($request); + + case 2: + // Redirect academic users to the academic dashboard + return redirect()->route('user'); + + default: + // Redirect back if role does not match (user is trying to access an unauthorized dashboard) + return back()->with('error', 'Unauthorized access.'); + } + } +} diff --git a/app/Imports/ReportsImport.php b/app/Imports/ReportsImport.php new file mode 100644 index 0000000..444a84e --- /dev/null +++ b/app/Imports/ReportsImport.php @@ -0,0 +1,43 @@ + $row[0], + 'item_code' => $row[1], + 'generic_item_name' => $row[2], + 'item_category' => $row[3], + 'department' => $row[4], + 'machine' => $row[5], + 'test_code' => $row[6], + 'test_name' => $row[7], + 'supplier_name' => $row[8], + 'address' => $row[9], + 'manufacture' => $row[10], + 'hsn_code' => $row[11], + 'unit_of_perchase' => $row[12], + 'pack_size' => $row[13], + 'test' => $row[14], + 'unit_price' => $row[15], + 'cgst' => $row[16], + 'sgst' => $row[17], + 'price_gst' => $row[18], + ]); + } +} + diff --git a/app/Models/Report.php b/app/Models/Report.php new file mode 100644 index 0000000..7269d50 --- /dev/null +++ b/app/Models/Report.php @@ -0,0 +1,32 @@ + 'datetime', ]; + + + public function role() + { + return $this->belongsTo(Role::class); + } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ee8ca5b..9242dee 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -3,6 +3,7 @@ namespace App\Providers; use Illuminate\Support\ServiceProvider; +use Illuminate\Support\Facades\Schema; class AppServiceProvider extends ServiceProvider { @@ -23,6 +24,6 @@ public function register() */ public function boot() { - // + Schema::defaultStringLength(191); } } diff --git a/composer.json b/composer.json index 695b29f..97da1d2 100644 --- a/composer.json +++ b/composer.json @@ -7,9 +7,11 @@ "require": { "php": "^8.1", "guzzlehttp/guzzle": "^7.4", + "jantinnerezo/livewire-alert": "^3.0", "laravel/framework": "^10.0", "laravel/tinker": "^2.6", - "livewire/livewire": "^2.8" + "livewire/livewire": "^2.8", + "maatwebsite/excel": "^3.1" }, "require-dev": { "spatie/laravel-ignition": "^2.0", diff --git a/composer.lock b/composer.lock index 051cec0..9eaba69 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "72f792372d436194aecd4128111c8639", + "content-hash": "a2f90bba9abb07161b1721a0d94d858a", "packages": [ { "name": "brick/math", @@ -61,6 +61,87 @@ ], "time": "2023-01-15T23:15:59+00:00" }, + { + "name": "composer/semver", + "version": "3.4.3", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-09-19T14:15:21+00:00" + }, { "name": "dflydev/dot-access-data", "version": "v3.0.2", @@ -432,6 +513,67 @@ ], "time": "2023-01-14T14:17:03+00:00" }, + { + "name": "ezyang/htmlpurifier", + "version": "v4.17.0", + "source": { + "type": "git", + "url": "https://github.com/ezyang/htmlpurifier.git", + "reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/bbc513d79acf6691fa9cf10f192c90dd2957f18c", + "reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c", + "shasum": "" + }, + "require": { + "php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0" + }, + "require-dev": { + "cerdic/css-tidy": "^1.7 || ^2.0", + "simpletest/simpletest": "dev-master" + }, + "suggest": { + "cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.", + "ext-bcmath": "Used for unit conversion and imagecrash protection", + "ext-iconv": "Converts text to and from non-UTF-8 encodings", + "ext-tidy": "Used for pretty-printing HTML" + }, + "type": "library", + "autoload": { + "files": [ + "library/HTMLPurifier.composer.php" + ], + "psr-0": { + "HTMLPurifier": "library/" + }, + "exclude-from-classmap": [ + "/library/HTMLPurifier/Language/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1-or-later" + ], + "authors": [ + { + "name": "Edward Z. Yang", + "email": "admin@htmlpurifier.org", + "homepage": "http://ezyang.com" + } + ], + "description": "Standards compliant HTML filter written in PHP", + "homepage": "http://htmlpurifier.org/", + "keywords": [ + "html" + ], + "support": { + "issues": "https://github.com/ezyang/htmlpurifier/issues", + "source": "https://github.com/ezyang/htmlpurifier/tree/v4.17.0" + }, + "time": "2023-11-17T15:01:25+00:00" + }, { "name": "fruitcake/php-cors", "version": "v1.2.0", @@ -980,6 +1122,68 @@ ], "time": "2021-10-07T12:57:01+00:00" }, + { + "name": "jantinnerezo/livewire-alert", + "version": "v3.0", + "source": { + "type": "git", + "url": "https://github.com/jantinnerezo/livewire-alert.git", + "reference": "53a4c04d413528a335864f5f6eb1f3ce3e42c963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jantinnerezo/livewire-alert/zipball/53a4c04d413528a335864f5f6eb1f3ce3e42c963", + "reference": "53a4c04d413528a335864f5f6eb1f3ce3e42c963", + "shasum": "" + }, + "require": { + "illuminate/support": "^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0", + "livewire/livewire": "^2.0", + "php": "^7.4|^8.0|^8.1|^8.2" + }, + "require-dev": { + "orchestra/testbench": "^6.15|^7.0|^8.0", + "phpunit/phpunit": "^9.5|^10.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Jantinnerezo\\LivewireAlert\\LivewireAlertServiceProvider" + ], + "aliases": { + "LivewireAlert": "Jantinnerezo\\LivewireAlert\\LivewireAlertFacade" + } + } + }, + "autoload": { + "psr-4": { + "Jantinnerezo\\LivewireAlert\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jantinn Erezo", + "email": "erezojantinn@gmail.com", + "role": "Developer" + } + ], + "description": "This package provides a simple alert utilities for your livewire components.", + "homepage": "https://github.com/jantinnerezo/livewire-alert", + "keywords": [ + "jantinnerezo", + "livewire-alert" + ], + "support": { + "issues": "https://github.com/jantinnerezo/livewire-alert/issues", + "source": "https://github.com/jantinnerezo/livewire-alert/tree/v3.0" + }, + "time": "2023-07-21T18:17:43+00:00" + }, { "name": "laravel/framework", "version": "v10.3.3", @@ -1716,6 +1920,275 @@ ], "time": "2023-03-03T20:12:38+00:00" }, + { + "name": "maatwebsite/excel", + "version": "3.1.58", + "source": { + "type": "git", + "url": "https://github.com/SpartnerNL/Laravel-Excel.git", + "reference": "18495a71b112f43af8ffab35111a58b4e4ba4a4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/SpartnerNL/Laravel-Excel/zipball/18495a71b112f43af8ffab35111a58b4e4ba4a4d", + "reference": "18495a71b112f43af8ffab35111a58b4e4ba4a4d", + "shasum": "" + }, + "require": { + "composer/semver": "^3.3", + "ext-json": "*", + "illuminate/support": "5.8.*||^6.0||^7.0||^8.0||^9.0||^10.0||^11.0", + "php": "^7.0||^8.0", + "phpoffice/phpspreadsheet": "^1.29.1", + "psr/simple-cache": "^1.0||^2.0||^3.0" + }, + "require-dev": { + "laravel/scout": "^7.0||^8.0||^9.0||^10.0", + "orchestra/testbench": "^6.0||^7.0||^8.0||^9.0", + "predis/predis": "^1.1" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Maatwebsite\\Excel\\ExcelServiceProvider" + ], + "aliases": { + "Excel": "Maatwebsite\\Excel\\Facades\\Excel" + } + } + }, + "autoload": { + "psr-4": { + "Maatwebsite\\Excel\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Patrick Brouwers", + "email": "patrick@spartner.nl" + } + ], + "description": "Supercharged Excel exports and imports in Laravel", + "keywords": [ + "PHPExcel", + "batch", + "csv", + "excel", + "export", + "import", + "laravel", + "php", + "phpspreadsheet" + ], + "support": { + "issues": "https://github.com/SpartnerNL/Laravel-Excel/issues", + "source": "https://github.com/SpartnerNL/Laravel-Excel/tree/3.1.58" + }, + "funding": [ + { + "url": "https://laravel-excel.com/commercial-support", + "type": "custom" + }, + { + "url": "https://github.com/patrickbrouwers", + "type": "github" + } + ], + "time": "2024-09-07T13:53:36+00:00" + }, + { + "name": "maennchen/zipstream-php", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/maennchen/ZipStream-PHP.git", + "reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b8174494eda667f7d13876b4a7bfef0f62a7c0d1", + "reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "ext-zlib": "*", + "php-64bit": "^8.1" + }, + "require-dev": { + "ext-zip": "*", + "friendsofphp/php-cs-fixer": "^3.16", + "guzzlehttp/guzzle": "^7.5", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.5", + "phpunit/phpunit": "^10.0", + "vimeo/psalm": "^5.0" + }, + "suggest": { + "guzzlehttp/psr7": "^2.4", + "psr/http-message": "^2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "ZipStream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paul Duncan", + "email": "pabs@pablotron.org" + }, + { + "name": "Jonatan Männchen", + "email": "jonatan@maennchen.ch" + }, + { + "name": "Jesse Donat", + "email": "donatj@gmail.com" + }, + { + "name": "András Kolesár", + "email": "kolesar@kolesar.hu" + } + ], + "description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.", + "keywords": [ + "stream", + "zip" + ], + "support": { + "issues": "https://github.com/maennchen/ZipStream-PHP/issues", + "source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.0" + }, + "funding": [ + { + "url": "https://github.com/maennchen", + "type": "github" + }, + { + "url": "https://opencollective.com/zipstream", + "type": "open_collective" + } + ], + "time": "2023-06-21T14:59:35+00:00" + }, + { + "name": "markbaker/complex", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPComplex.git", + "reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9", + "reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "^9.3", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Complex\\": "classes/src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with complex numbers", + "homepage": "https://github.com/MarkBaker/PHPComplex", + "keywords": [ + "complex", + "mathematics" + ], + "support": { + "issues": "https://github.com/MarkBaker/PHPComplex/issues", + "source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2" + }, + "time": "2022-12-06T16:21:08+00:00" + }, + { + "name": "markbaker/matrix", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPMatrix.git", + "reference": "728434227fe21be27ff6d86621a1b13107a2562c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c", + "reference": "728434227fe21be27ff6d86621a1b13107a2562c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-master", + "phpcompatibility/php-compatibility": "^9.3", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "^4.0", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "sebastian/phpcpd": "^4.0", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Matrix\\": "classes/src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@demon-angel.eu" + } + ], + "description": "PHP Class for working with matrices", + "homepage": "https://github.com/MarkBaker/PHPMatrix", + "keywords": [ + "mathematics", + "matrix", + "vector" + ], + "support": { + "issues": "https://github.com/MarkBaker/PHPMatrix/issues", + "source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1" + }, + "time": "2022-12-02T22:17:43+00:00" + }, { "name": "monolog/monolog", "version": "3.3.1", @@ -2210,6 +2683,111 @@ ], "time": "2023-02-08T01:06:31+00:00" }, + { + "name": "phpoffice/phpspreadsheet", + "version": "1.29.1", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", + "reference": "59ee38f7480904cd6487e5cbdea4d80ff2758719" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/59ee38f7480904cd6487e5cbdea4d80ff2758719", + "reference": "59ee38f7480904cd6487e5cbdea4d80ff2758719", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-dom": "*", + "ext-fileinfo": "*", + "ext-gd": "*", + "ext-iconv": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-xml": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "ext-zip": "*", + "ext-zlib": "*", + "ezyang/htmlpurifier": "^4.15", + "maennchen/zipstream-php": "^2.1 || ^3.0", + "markbaker/complex": "^3.0", + "markbaker/matrix": "^3.0", + "php": "^7.4 || ^8.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "dev-main", + "dompdf/dompdf": "^1.0 || ^2.0", + "friendsofphp/php-cs-fixer": "^3.2", + "mitoteam/jpgraph": "^10.3", + "mpdf/mpdf": "^8.1.1", + "phpcompatibility/php-compatibility": "^9.3", + "phpstan/phpstan": "^1.1", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^8.5 || ^9.0", + "squizlabs/php_codesniffer": "^3.7", + "tecnickcom/tcpdf": "^6.5" + }, + "suggest": { + "dompdf/dompdf": "Option for rendering PDF with PDF Writer", + "ext-intl": "PHP Internationalization Functions", + "mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", + "mpdf/mpdf": "Option for rendering PDF with PDF Writer", + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "https://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker", + "homepage": "https://markbakeruk.net" + }, + { + "name": "Franck Lefevre", + "homepage": "https://rootslabs.net" + }, + { + "name": "Erik Tilt" + }, + { + "name": "Adrien Crivelli" + } + ], + "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", + "keywords": [ + "OpenXML", + "excel", + "gnumeric", + "ods", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "support": { + "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.1" + }, + "time": "2024-09-03T00:55:32+00:00" + }, { "name": "phpoption/phpoption", "version": "1.9.1", @@ -7764,5 +8342,5 @@ "php": "^8.1" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/database/factories/RoleFactory.php b/database/factories/RoleFactory.php new file mode 100644 index 0000000..042e6a3 --- /dev/null +++ b/database/factories/RoleFactory.php @@ -0,0 +1,18 @@ + $this->faker->unique()->word, + ]; + } +} diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 7d2bb19..01a291a 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -2,7 +2,7 @@ namespace Database\Factories; -use App\Models\User; +use App\Models\{User , Role}; use Illuminate\Support\Arr; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; @@ -35,6 +35,7 @@ public function definition() 'ZIP' => $this->faker->randomNumber(6), 'number' => $this->faker->buildingNumber, 'remember_token' => Str::random(10), + 'role_id' => Role::factory(), ]; } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index fdb401f..e5ad22e 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -20,6 +20,7 @@ public function up() $table->string('gender')->nullable(); $table->string('email')->unique(); $table->string('password'); + $table->integer('role')->nullable(); $table->string('address')->nullable(); $table->string('number')->nullable(); $table->string('city')->nullable(); diff --git a/database/migrations/2024_09_23_071602_reports.php b/database/migrations/2024_09_23_071602_reports.php new file mode 100644 index 0000000..ea0a158 --- /dev/null +++ b/database/migrations/2024_09_23_071602_reports.php @@ -0,0 +1,47 @@ +increments('id')->unique(); + $table->string('item_name')->nullable(); + $table->string('item_code')->nullable(); + $table->string('generic_item_name')->nullable(); + $table->string('item_category')->nullable(); + $table->string('department')->nullable(); + $table->string('machine')->nullable(); + $table->string('test_code')->nullable(); + $table->string('test_name')->nullable(); + $table->string('supplier_name')->nullable(); + $table->string('address')->nullable(); + $table->string('manufacture')->nullable(); + $table->string('hsn_code')->nullable(); + $table->string('unit_of_perchase')->nullable(); + $table->string('pack_size')->nullable(); + $table->string('test')->nullable(); + $table->string('unit_price')->nullable(); + $table->string('cgst')->nullable(); + $table->string('sgst')->nullable(); + $table->string('price_gst')->nullable(); + $table->timestamps(); + }); + + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('reports'); + } +}; diff --git a/database/migrations/2024_09_24_103007_add_role_to_users_table.php b/database/migrations/2024_09_24_103007_add_role_to_users_table.php new file mode 100644 index 0000000..d39f123 --- /dev/null +++ b/database/migrations/2024_09_24_103007_add_role_to_users_table.php @@ -0,0 +1,26 @@ +tinyInteger('role')->default(1)->after('password'); // Adjust the position as needed + }); + } + + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('role'); + }); + } + +}; diff --git a/database/migrations/2024_09_24_103711_create_roles_table.php b/database/migrations/2024_09_24_103711_create_roles_table.php new file mode 100644 index 0000000..87bd721 --- /dev/null +++ b/database/migrations/2024_09_24_103711_create_roles_table.php @@ -0,0 +1,28 @@ +id(); + $table->string('name')->unique(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('roles'); + } +}; diff --git a/database/seeders/RoleSeeder.php b/database/seeders/RoleSeeder.php new file mode 100644 index 0000000..8fb6fc8 --- /dev/null +++ b/database/seeders/RoleSeeder.php @@ -0,0 +1,15 @@ + 'admin']); + Role::create(['name' => 'user']); + } +} diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index 0843834..d2e590a 100644 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -18,8 +18,9 @@ public function run() DB::table("users")->insert([ 'first_name' => 'Admin', 'last_name' => 'User', - 'email' => 'admin@volt.com', + 'email' => 'admin@gmail.com', 'password' => Hash::make('secret'), + 'role' => '1' ]); } } diff --git a/public/assets/bulkimport.xlsx b/public/assets/bulkimport.xlsx new file mode 100644 index 0000000..2ada455 Binary files /dev/null and b/public/assets/bulkimport.xlsx differ diff --git a/public/assets/img/SHLlogo.png.crdownload b/public/assets/img/SHLlogo.png.crdownload new file mode 100644 index 0000000..b4106c5 Binary files /dev/null and b/public/assets/img/SHLlogo.png.crdownload differ diff --git a/public/assets/img/circle.jpg b/public/assets/img/circle.jpg new file mode 100644 index 0000000..5b13587 Binary files /dev/null and b/public/assets/img/circle.jpg differ diff --git a/public/assets/img/icons/trustlogo.png b/public/assets/img/icons/trustlogo.png new file mode 100644 index 0000000..59a6a6a Binary files /dev/null and b/public/assets/img/icons/trustlogo.png differ diff --git a/public/assets/img/illustrations/add-circle-svgrepo-com.svg b/public/assets/img/illustrations/add-circle-svgrepo-com.svg new file mode 100644 index 0000000..b46319f --- /dev/null +++ b/public/assets/img/illustrations/add-circle-svgrepo-com.svg @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/public/assets/img/logo.png b/public/assets/img/logo.png new file mode 100644 index 0000000..b4106c5 Binary files /dev/null and b/public/assets/img/logo.png differ diff --git a/public/css/volt.css b/public/css/volt.css index 271d693..78482b9 100644 --- a/public/css/volt.css +++ b/public/css/volt.css @@ -811,7 +811,7 @@ --bs-white: #ffffff; --bs-gray: #4B5563; --bs-gray-dark: #1F2937; - --bs-primary: #1F2937; + --bs-primary: #1c55e6; --bs-secondary: #fb503b; --bs-tertiary: #31316A; --bs-success: #10B981; @@ -2575,7 +2575,7 @@ progress { .table-primary { --bs-table-bg: #d2d4d7; --bs-table-striped-bg: #c9cbcf; - --bs-table-striped-color: #1F2937; + --bs-table-striped-color: #1b6fe5; --bs-table-active-bg: #c0c3c7; --bs-table-active-color: #1F2937; --bs-table-hover-bg: #c5c7cb; @@ -3338,32 +3338,32 @@ textarea.form-control-lg { .btn-primary { color: #ffffff; - background-color: #1F2937; - border-color: #1F2937; - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(17, 24, 39, 0.075); } + background-color: #191970; + border-color: #eaf0f0; + box-shadow: inset 0 1px 0 rgba(39, 136, 3, 0.842), 0 0 0 0.18rem rgba(65, 73, 85, 0.5); } .btn-primary:hover { color: #ffffff; - background-color: #1a232f; - border-color: #19212c; } + background-color: #0c9207; + border-color: #0c9207; } .btn-check:focus + .btn-primary, .btn-primary:focus { color: #ffffff; - background-color: #1a232f; - border-color: #19212c; + background-color: #0c9207; + border-color: #0c9207; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(17, 24, 39, 0.075), 0 0 0 0.18rem rgba(65, 73, 85, 0.5); } .btn-check:checked + .btn-primary, .btn-check:active + .btn-primary, .btn-primary:active, .btn-primary.active, .show > .btn-primary.dropdown-toggle { color: #ffffff; - background-color: #19212c; - border-color: #171f29; } + background-color: #0c9207; + border-color: #0c9207; } .btn-check:checked + .btn-primary:focus, .btn-check:active + .btn-primary:focus, .btn-primary:active:focus, .btn-primary.active:focus, .show > .btn-primary.dropdown-toggle:focus { - box-shadow: inset 0 3px 5px rgba(17, 24, 39, 0.125), 0 0 0 0.18rem rgba(65, 73, 85, 0.5); } + box-shadow: inset 0 3px 5px rgba(39, 136, 3, 0.842), 0 0 0 0.18rem rgba(65, 73, 85, 0.5); } .btn-primary:disabled, .btn-primary.disabled { color: #ffffff; - background-color: #1F2937; - border-color: #1F2937; } + background-color: #0c9207; + border-color: #0c9207; } .btn-secondary { color: #ffffff; @@ -4856,7 +4856,7 @@ textarea.form-control-lg { .nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { color: #374151; - background-color: #9CA3AF; + background-color: #0c9207; border-color: #9CA3AF; } .nav-tabs .dropdown-menu { margin-top: -0.0625rem; @@ -14121,7 +14121,7 @@ textarea.form-control-lg { color: #ffffff; } .navbar-dark > .nav-item:hover > .nav-link { - color: #1F2937; } + color: #0c9207; } .navbar-light:not(.headroom--not-top) .btn-outline-soft { border-color: #1F2937; @@ -14514,7 +14514,7 @@ textarea.form-control-lg { margin-bottom: .2rem; } .sidebar .nav-item.active > .nav-link { color: #F2F4F6; - background-color: #374151; } + background-color: #0c9207; } .sidebar .nav-item .nav-link { color: #ffffff; cursor: pointer; } @@ -18790,7 +18790,8 @@ article .h1, article .h2, article .h3, article .h4, article .h5, article .h6 { right: 0; padding: 0; margin: 0; - -webkit-overflow-scrolling: touch; } + -webkit-overflow-scrolling: touch; + background: midnightblue;} .simplebar-content-wrapper { direction: inherit; diff --git a/public/documentation/getting-started/installation/index.html b/public/documentation/getting-started/installation/index.html index e5a1dca..9550d62 100644 --- a/public/documentation/getting-started/installation/index.html +++ b/public/documentation/getting-started/installation/index.html @@ -490,7 +490,7 @@
php artisan storage:link
to create the storage symlink (if you are using Vagrant with Homestead for development, remember to ssh into your virtual machine and run the command from there).Register a user or login using admin@volt.com and secret and start testing the Laravel app (make sure to run the migrations and seeders for these credentials to be available).
+Register a user or login using admin@gmail.com and secret and start testing the Laravel app (make sure to run the migrations and seeders for these credentials to be available).
Make sure to run the migrations and seeders for the above credentials to be available.
Besides the dashboard and the auth pages this application also has an edit profile page. All the necessary files (controllers, requests, views) are installed out of the box and all the needed routes are added to routes/web.php
. Keep in mind that all of the features can be viewed once you login using the credentials provided above or by registering your own user.
Page name | -Page Views | -Page Value | -Bounce rate | -
---|---|---|---|
- /demo/admin/index.html - | -- 3,225 - | -- $20 - | -
-
-
- 42,55%
-
- |
-
- /demo/admin/forms.html - | -- 2,987 - | -- 0 - | -
-
-
- 43,24%
-
- |
-
- /demo/admin/util.html - | -- 2,844 - | -- 294 - | -
-
-
- 32,35%
-
- |
-
- /demo/admin/validation.html - | -- 2,050 - | -- $147 - | -
-
-
- 50,87%
-
- |
-
- /demo/admin/modals.html - | -- 1,483 - | -- $19 - | -
-
-
- 26,12%
-
- |
-
Tells you where your visitors originated from, such as search engines, social networks or website referrals.
-