first commit
This commit is contained in:
0
Modules/Employee/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Employee/app/Http/Controllers/.gitkeep
Normal file
221
Modules/Employee/app/Http/Controllers/EmployeeController.php
Normal file
221
Modules/Employee/app/Http/Controllers/EmployeeController.php
Normal file
@ -0,0 +1,221 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Employee\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use App\Notifications\SendNotification;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Modules\Admin\Repositories\FieldInterface;
|
||||
use Modules\Admin\Services\AdminService;
|
||||
use Modules\Employee\Repositories\EmployeeInterface;
|
||||
use Modules\User\Repositories\UserInterface;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class EmployeeController extends Controller
|
||||
{
|
||||
|
||||
private $employeeRepository;
|
||||
private $userRepository;
|
||||
private $adminService;
|
||||
private $fieldRepository;
|
||||
|
||||
public function __construct(
|
||||
FieldInterface $fieldRepository,
|
||||
EmployeeInterface $employeeRepository,
|
||||
UserInterface $userRepository,
|
||||
AdminService $adminService
|
||||
) {
|
||||
$this->employeeRepository = $employeeRepository;
|
||||
$this->userRepository = $userRepository;
|
||||
$this->adminService = $adminService;
|
||||
$this->fieldRepository = $fieldRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// Display an error toast with no title
|
||||
// toastr()->error('Oops! Something went wrong!');
|
||||
$data['employees'] = $this->employeeRepository->findAll();
|
||||
$data['roleLists'] = Role::pluck('name', 'id');
|
||||
return view('employee::index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = 'Create Employee';
|
||||
$data['departmentList'] = $this->adminService->pluckDepartments();
|
||||
$data['designationList'] = $this->adminService->pluckDesignations();
|
||||
$data['cityList'] = $this->adminService->pluckCities();
|
||||
$data['nationalityList'] = $this->fieldRepository->getDropdownByAlias('nationality');
|
||||
$data['genderList'] = $this->fieldRepository->getDropdownByAlias('gender');
|
||||
$data['casteList'] = $this->fieldRepository->getDropdownByAlias('caste');
|
||||
|
||||
return view('employee::create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$inputData = $request->all();
|
||||
try {
|
||||
|
||||
if ($request->hasFile('profile_picture')) {
|
||||
$inputData['profile_picture'] = uploadImage($request->profile_picture);
|
||||
}
|
||||
$this->employeeRepository->create($inputData);
|
||||
|
||||
toastr()->success('Employee Created Succesfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
echo $th->getMessage();
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('employee.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data['employee'] = $this->employeeRepository->getEmployeeById($id);
|
||||
return view('employee::show', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = 'Edit Employee';
|
||||
$data['employee'] = $this->employeeRepository->getEmployeeById($id);
|
||||
$data['departmentList'] = $this->adminService->pluckDepartments();
|
||||
$data['designationList'] = $this->adminService->pluckDesignations();
|
||||
$data['nationalityList'] = $this->fieldRepository->getDropdownByAlias('nationality');
|
||||
$data['genderList'] = $this->fieldRepository->getDropdownByAlias('gender');
|
||||
$data['casteList'] = $this->fieldRepository->getDropdownByAlias('caste');
|
||||
$data['cityList'] = $this->adminService->pluckCities();
|
||||
return view('employee::edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$inputData = $request->except(['_method', '_token']);
|
||||
|
||||
try {
|
||||
|
||||
if ($request->hasFile('profile_picture')) {
|
||||
$inputData['profile_picture'] = uploadImage($request->profile_picture);
|
||||
}
|
||||
|
||||
$this->employeeRepository->update($id, $inputData);
|
||||
|
||||
sendNotification(auth()->user(), [
|
||||
'msg' => 'Employee Updated',
|
||||
]);
|
||||
|
||||
toastr()->success('Employee Updated Succesfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('employee.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Request $request)
|
||||
{
|
||||
try {
|
||||
$employeeModel = $this->employeeRepository->getEmployeeById($request->id);
|
||||
// optional($employeeModel)->user?->roles()?->detach();
|
||||
// optional($employeeModel)->user?->delete();
|
||||
// optional($employeeModel)->delete();
|
||||
$employeeModel->status = 10;
|
||||
$employeeModel->save();
|
||||
|
||||
toastr()->success('Employee Delete Succesfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['status' => true, 'message' => 'Employee Delete Succesfully']);
|
||||
|
||||
}
|
||||
|
||||
public function assignRole(Request $request)
|
||||
{
|
||||
try {
|
||||
$checkUserModel = User::where('email', $request->email)->first();
|
||||
if ($checkUserModel) {
|
||||
$checkUserModel->roles()->detach();
|
||||
$checkUserModel->roles()->attach($request->role_id);
|
||||
} else {
|
||||
|
||||
$employeeModel = $this->employeeRepository->getEmployeeByEmail($request->email);
|
||||
|
||||
$inputData = [
|
||||
'name' => $employeeModel->full_name,
|
||||
'email' => $request->email,
|
||||
'password' => Hash::make('password'),
|
||||
'email_verified_at' => Carbon::now(),
|
||||
'employee_id' => $employeeModel->id,
|
||||
];
|
||||
|
||||
$userModel = $this->userRepository->create($inputData, [$request->role_id]);
|
||||
$employeeModel->users_id = $userModel->id;
|
||||
$employeeModel->save();
|
||||
}
|
||||
|
||||
toastr()->success('Role Assigned Succesfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('employee.index');
|
||||
}
|
||||
|
||||
public function changePassword(Request $request)
|
||||
{
|
||||
try {
|
||||
$employeemodel = $this->employeeRepository->getEmployeeById($request->employee_id);
|
||||
$inputData = [
|
||||
'password' => Hash::make($request->password),
|
||||
];
|
||||
$employeemodel->user->update($inputData);
|
||||
|
||||
sendNotification($employeemodel->user, [
|
||||
'msg' => 'Your Password has been changed'
|
||||
]);
|
||||
toastr()->success('Password changed Successfully');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('employee.index');
|
||||
}
|
||||
|
||||
public function getEmployeeById(Request $request)
|
||||
{
|
||||
return $this->employeeRepository->getEmployeeById($request->employeeId);
|
||||
}
|
||||
|
||||
}
|
0
Modules/Employee/app/Http/Requests/.gitkeep
Normal file
0
Modules/Employee/app/Http/Requests/.gitkeep
Normal file
0
Modules/Employee/app/Models/.gitkeep
Normal file
0
Modules/Employee/app/Models/.gitkeep
Normal file
44
Modules/Employee/app/Models/Employee.php
Normal file
44
Modules/Employee/app/Models/Employee.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Employee\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Modules\Admin\Models\Department;
|
||||
use Modules\Admin\Models\Designation;
|
||||
|
||||
class Employee extends Model
|
||||
{
|
||||
use Notifiable;
|
||||
protected $table = 'tbl_employees';
|
||||
protected $guarded = [];
|
||||
protected $appends = ['full_name', 'profile_pic'];
|
||||
|
||||
protected function getFullNameAttribute()
|
||||
{
|
||||
// return $this->first_name . ' ' . $this->middle_name . ' ' . $this->last_name;
|
||||
return $this->first_name . ' ' . $this->last_name;
|
||||
|
||||
}
|
||||
|
||||
protected function getProfilePicAttribute()
|
||||
{
|
||||
return $this->profile_picture ? asset('storage/' . $this->profile_picture) : asset('assets/images/task.png');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'users_id');
|
||||
}
|
||||
|
||||
public function department()
|
||||
{
|
||||
return $this->belongsTo(Department::class, 'department_id')->withDefault();
|
||||
}
|
||||
|
||||
public function designation()
|
||||
{
|
||||
return $this->HasOne(Designation::class, 'designation_id')->withDefault();
|
||||
}
|
||||
}
|
0
Modules/Employee/app/Providers/.gitkeep
Normal file
0
Modules/Employee/app/Providers/.gitkeep
Normal file
117
Modules/Employee/app/Providers/EmployeeServiceProvider.php
Normal file
117
Modules/Employee/app/Providers/EmployeeServiceProvider.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Employee\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Employee\Repositories\EmployeeInterface;
|
||||
use Modules\Employee\Repositories\EmployeeRepository;
|
||||
|
||||
class EmployeeServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Employee';
|
||||
|
||||
protected string $moduleNameLower = 'employee';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerCommandSchedules();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->bind(EmployeeInterface::class, EmployeeRepository::class);
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register commands in the format of Command::class
|
||||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
// $this->commands([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command Schedules.
|
||||
*/
|
||||
protected function registerCommandSchedules(): void
|
||||
{
|
||||
// $this->app->booted(function () {
|
||||
// $schedule = $this->app->make(Schedule::class);
|
||||
// $schedule->command('inspire')->hourly();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower . '.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace') . '\\' . $this->moduleName . '\\' . ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder', '')));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (config('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
49
Modules/Employee/app/Providers/RouteServiceProvider.php
Normal file
49
Modules/Employee/app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Employee\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*/
|
||||
public function map(): void
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*/
|
||||
protected function mapWebRoutes(): void
|
||||
{
|
||||
Route::middleware('web')->group(module_path('Employee', '/routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
Route::middleware('api')->prefix('api')->name('api.')->group(module_path('Employee', '/routes/api.php'));
|
||||
}
|
||||
}
|
0
Modules/Employee/app/Repositories/.gitkeep
Normal file
0
Modules/Employee/app/Repositories/.gitkeep
Normal file
16
Modules/Employee/app/Repositories/EmployeeInterface.php
Normal file
16
Modules/Employee/app/Repositories/EmployeeInterface.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Employee\Repositories;
|
||||
use Modules\Employee\Models\Employee;
|
||||
|
||||
interface EmployeeInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getEmployeeById($employeeId);
|
||||
public function getEmployeeByEmail($email);
|
||||
public function delete($employeeId);
|
||||
public function create($EmployeeDetails);
|
||||
public function update($employeeId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
56
Modules/Employee/app/Repositories/EmployeeRepository.php
Normal file
56
Modules/Employee/app/Repositories/EmployeeRepository.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Employee\Repositories;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Employee\Models\Employee;
|
||||
|
||||
class EmployeeRepository implements EmployeeInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Employee::when(true, function ($query) {
|
||||
if (auth()->user()->hasRole('employee')) {
|
||||
$user = \Auth::user();
|
||||
$query->where('id', $user->employee_id);
|
||||
}
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getEmployeeById($employeeId)
|
||||
{
|
||||
return Employee::findOrFail($employeeId);
|
||||
}
|
||||
|
||||
public function getUserByEmpId($employeeId)
|
||||
{
|
||||
$employee = Employee::findOrFail($employeeId);
|
||||
return $employee->user ?? null;
|
||||
}
|
||||
|
||||
public function getEmployeeByEmail($email)
|
||||
{
|
||||
return Employee::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($employeeId)
|
||||
{
|
||||
Employee::destroy($employeeId);
|
||||
}
|
||||
|
||||
public function create($employeeDetails)
|
||||
{
|
||||
return Employee::create($employeeDetails);
|
||||
}
|
||||
|
||||
public function update($employeeId, array $newDetails)
|
||||
{
|
||||
return Employee::whereId($employeeId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Employee::pluck(DB::raw('CONCAT(first_name, " ", COALESCE(middle_name, " "), " ", last_name) AS full_name'), 'id');
|
||||
}
|
||||
|
||||
}
|
30
Modules/Employee/composer.json
Normal file
30
Modules/Employee/composer.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "nwidart/employee",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Employee\\": "app/",
|
||||
"Modules\\Employee\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Employee\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Employee\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
Modules/Employee/config/.gitkeep
Normal file
0
Modules/Employee/config/.gitkeep
Normal file
5
Modules/Employee/config/config.php
Normal file
5
Modules/Employee/config/config.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Employee',
|
||||
];
|
0
Modules/Employee/database/factories/.gitkeep
Normal file
0
Modules/Employee/database/factories/.gitkeep
Normal file
0
Modules/Employee/database/migrations/.gitkeep
Normal file
0
Modules/Employee/database/migrations/.gitkeep
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tbl_employees', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('first_name')->nullable();
|
||||
$table->string('middle_name')->nullable();
|
||||
$table->string('last_name')->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->date('nepali_dob')->nullable();
|
||||
$table->date('dob')->nullable();
|
||||
$table->string('signature')->nullable();
|
||||
$table->string('father_name')->nullable();
|
||||
$table->string('contact')->nullable();
|
||||
$table->string('profile_picture')->nullable();
|
||||
$table->unsignedBigInteger('genders_id')->nullable();
|
||||
$table->unsignedBigInteger('nationalities_id')->nullable();
|
||||
$table->unsignedBigInteger('users_id')->nullable();
|
||||
$table->integer('is_user_assigned')->nullable()->default(10);
|
||||
$table->unsignedBigInteger('organization_id')->nullable();
|
||||
$table->unsignedBigInteger('department_id')->nullable();
|
||||
$table->unsignedBigInteger('designation_id')->nullable();
|
||||
$table->text('permanent_address')->nullable();
|
||||
$table->text('temporary_address')->nullable();
|
||||
$table->string('status')->nullable()->default(11);
|
||||
$table->string('remarks')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tbl_employees');
|
||||
}
|
||||
};
|
0
Modules/Employee/database/seeders/.gitkeep
Normal file
0
Modules/Employee/database/seeders/.gitkeep
Normal file
16
Modules/Employee/database/seeders/EmployeeDatabaseSeeder.php
Normal file
16
Modules/Employee/database/seeders/EmployeeDatabaseSeeder.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Employee\database\seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class EmployeeDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
}
|
||||
}
|
11
Modules/Employee/module.json
Normal file
11
Modules/Employee/module.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Employee",
|
||||
"alias": "employee",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Employee\\Providers\\EmployeeServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
Modules/Employee/package.json
Normal file
15
Modules/Employee/package.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^1.1.2",
|
||||
"laravel-vite-plugin": "^0.7.5",
|
||||
"sass": "^1.69.5",
|
||||
"postcss": "^8.3.7",
|
||||
"vite": "^4.0.0"
|
||||
}
|
||||
}
|
0
Modules/Employee/resources/assets/.gitkeep
Normal file
0
Modules/Employee/resources/assets/.gitkeep
Normal file
0
Modules/Employee/resources/assets/js/app.js
Normal file
0
Modules/Employee/resources/assets/js/app.js
Normal file
0
Modules/Employee/resources/assets/sass/app.scss
Normal file
0
Modules/Employee/resources/assets/sass/app.scss
Normal file
0
Modules/Employee/resources/views/.gitkeep
Normal file
0
Modules/Employee/resources/views/.gitkeep
Normal file
23
Modules/Employee/resources/views/create.blade.php
Normal file
23
Modules/Employee/resources/views/create.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
<!-- end page title -->
|
||||
|
||||
{{ html()->form('POST')->route('employee.store')->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
|
||||
@include('employee::partials.action')
|
||||
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
23
Modules/Employee/resources/views/edit.blade.php
Normal file
23
Modules/Employee/resources/views/edit.blade.php
Normal file
@ -0,0 +1,23 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => $title])
|
||||
<!-- end page title -->
|
||||
|
||||
{{ html()->modelForm($employee, 'PUT')->route('employee.update', $employee->id)->class(['needs-validation'])->attributes(['novalidate', 'enctype' => 'multipart/form-data'])->open() }}
|
||||
|
||||
@include('employee::partials.action')
|
||||
|
||||
{{ html()->closeModelForm() }}
|
||||
|
||||
</div>
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
247
Modules/Employee/resources/views/index.blade.php
Normal file
247
Modules/Employee/resources/views/index.blade.php
Normal file
@ -0,0 +1,247 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- start page title -->
|
||||
@include('layouts.partials.breadcrumb', ['title' => 'Employee'])
|
||||
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row g-2">
|
||||
<div class="col-sm-4">
|
||||
<div class="search-box">
|
||||
<input type="text" class="form-control" id="searchMemberList" placeholder="Search for name...">
|
||||
<i class="ri-search-line search-icon"></i>
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
<div class="col-sm-auto ms-auto">
|
||||
<div class="list-grid-nav hstack gap-1">
|
||||
|
||||
<a class="btn btn-success" href="{{ route('employee.create') }}"><i
|
||||
class="ri-add-fill me-1 align-bottom"></i> Create Employee</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div>
|
||||
|
||||
<div id="teamlist">
|
||||
<div class="team-list row grid-view-filter" id="team-member-list">
|
||||
@forelse ($employees as $employee)
|
||||
@if ($employee->status != 10)
|
||||
<div class="col my-2">
|
||||
<div class="card team-box ribbon-box mb-lg-0 material-shadow border shadow-none">
|
||||
<div class="team-cover">
|
||||
<img src="{{ asset('assets/images/small/img-9.jpg') }}" alt="" class="img-fluid">
|
||||
</div>
|
||||
<div class="card-body p-4">
|
||||
@if ($employee->user)
|
||||
<div class="ribbon-two ribbon-two-success">
|
||||
<span>{{ optional($employee->user)->getRoleNames()->first() }}</span>
|
||||
</div>
|
||||
@endif
|
||||
<div class="row align-items-center team-row">
|
||||
<div class="col team-settings">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
</div>
|
||||
<div class="col dropdown text-end"> <a href="javascript:void(0);"
|
||||
data-bs-toggle="dropdown" aria-expanded="false" class=""> <i
|
||||
class="ri-more-fill fs-17"></i> </a>
|
||||
<ul class="dropdown-menu dropdown-menu-end" style="">
|
||||
<li><a class="dropdown-item remove-item-btn" href="javascript:void(0);"
|
||||
data-link="{{ route('employee.destroy', $employee->id) }}"
|
||||
data-id="{{ $employee->id }}"><i
|
||||
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Delete</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4 col">
|
||||
<div class="team-profile-img">
|
||||
<div class="img-thumbnail rounded-circle flex-shrink-0">
|
||||
<img style="height: 90px; width:90px; object-fit:cover"
|
||||
src="{{ asset($employee->profile_pic) }}" alt=""
|
||||
class="img-fluid rounded-circle">
|
||||
</div>
|
||||
<div class="team-content"> <a class="member-name"
|
||||
href="{{ route('employee.show', $employee->id) }}">
|
||||
<h5 class="fs-16 mb-1">{{ $employee->full_name }}</h5>
|
||||
</a>
|
||||
<p class="text-muted member-designation mb-0">
|
||||
{{ optional($employee->department)->name }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- <div class="col-lg-4 col">
|
||||
<div class="row text-muted text-center">
|
||||
<div class="col-6 border-end border-end-dashed">
|
||||
<h5 class="projects-num mb-1">225</h5>
|
||||
<p class="text-muted mb-0">Projects</p>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<h5 class="tasks-num mb-1">197</h5>
|
||||
<p class="text-muted mb-0">Tasks</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
<div class="col-lg-2 col">
|
||||
<ul class="list-inline mb-0 text-center">
|
||||
<li class="list-inline-item avatar-xs">
|
||||
<a href="{{ route('employee.edit', $employee->id) }}"
|
||||
class="avatar-title bg-info-subtle text-info fs-15 rounded">
|
||||
<i class="ri-edit-line"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li class="list-inline-item avatar-xs">
|
||||
<a href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#assignRoleModal"
|
||||
data-email="{{ $employee->email }}"
|
||||
class="avatar-title bg-primary-subtle text-primary fs-15 rounded">
|
||||
<i class="ri-user-add-line"></i>
|
||||
</a>
|
||||
</li>
|
||||
@if ($employee->user)
|
||||
<li class="list-inline-item avatar-xs">
|
||||
<a href="javascript:void(0);" data-bs-toggle="modal"
|
||||
data-bs-target="#changePasswordModal"
|
||||
class="avatar-title bg-danger-subtle text-danger fs-15 rounded"
|
||||
data-id="{{ $employee->id }}">
|
||||
<i class="ri-lock-unlock-line"></i>
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
<div class="d-flex justify-content-end align-self-end">
|
||||
<div class="mt-2 p-2">
|
||||
{{ $employees->links() }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div><!-- container-fluid -->
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="assignRoleModal" tabindex="-1" aria-labelledby="assignRoleLabel" aria-modal="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header model-primary">
|
||||
<h5 class="modal-title" id="exampleModalgridLabel">Assign Role</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
{{ html()->form('POST')->route('employee.assignRole')->class(['needs-validation'])->attributes(['novalidate'])->open() }}
|
||||
<div class="row gy-2">
|
||||
<div class="col-lg-12">
|
||||
{{ html()->label('Email')->class('form-label') }}
|
||||
{{ html()->email('email')->class('form-control email-field')->placeholder('Enter Email')->isReadonly(true)->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
{{ html()->label('Role')->class('form-label') }}
|
||||
{{ html()->select('role_id', $roleLists)->class('form-select')->placeholder('Select Role')->required() }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 text-end">
|
||||
<button type="submit" class="btn btn-success w-sm">Save</button>
|
||||
</div>
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="changePasswordModal" tabindex="-1" aria-labelledby="changePasswordLabel"
|
||||
aria-modal="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header model-primary">
|
||||
<h5 class="modal-title" id="exampleModalgridLabel">Change Password</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{ route('employee.changePassword') }}" class="needs-validation" novalidate method="post">
|
||||
@csrf
|
||||
<div class="row gy-2">
|
||||
<input type="hidden" id="employee_id" name="employee_id" value="">
|
||||
<div class="col-lg-12">
|
||||
{{ html()->label('New Password')->class('form-label') }}
|
||||
{{ html()->password('password')->class('form-control')->placeholder('Enter New Password')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
{{ html()->label('Confirm New Password')->class('form-label') }}
|
||||
{{ html()->password('confirm_password')->class('form-control')->placeholder('Confirm New Password')->required() }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mt-4 text-end">
|
||||
<button type="submit" class="btn btn-success w-sm">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#assignRoleModal').on('shown.bs.modal', function(e) {
|
||||
// do something...
|
||||
var email = $(e.relatedTarget).data('email');
|
||||
$('.email-field').val(email)
|
||||
console.log(email);
|
||||
})
|
||||
|
||||
|
||||
$('#changePasswordModal').on('shown.bs.modal', function(e) {
|
||||
let emp_id = $(e.relatedTarget).data('id');
|
||||
$('#employee_id').val(emp_id);
|
||||
})
|
||||
|
||||
$('form').submit(function() {
|
||||
let password = $(this).find('input[name="password"]').val();
|
||||
let confirmPassword = $(this).find('input[name="confirm_password"]').val();
|
||||
|
||||
if (password !== confirmPassword) {
|
||||
alert('Passwords do not match');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
@endpush
|
29
Modules/Employee/resources/views/layouts/master.blade.php
Normal file
29
Modules/Employee/resources/views/layouts/master.blade.php
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<title>Employee Module - {{ config('app.name', 'Laravel') }}</title>
|
||||
|
||||
<meta name="description" content="{{ $description ?? '' }}">
|
||||
<meta name="keywords" content="{{ $keywords ?? '' }}">
|
||||
<meta name="author" content="{{ $author ?? '' }}">
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
|
||||
|
||||
{{-- Vite CSS --}}
|
||||
{{-- {{ module_vite('build-employee', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-employee', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
123
Modules/Employee/resources/views/partials/action.blade.php
Normal file
123
Modules/Employee/resources/views/partials/action.blade.php
Normal file
@ -0,0 +1,123 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
{{-- <div class="card-header card-primary">
|
||||
<h4 class="card-title mb-0">Personal Details</h4>
|
||||
</div> --}}
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row gy-2">
|
||||
<p class="text-primary">Personal Details</p>
|
||||
<hr>
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('First name')->class('form-label') }}
|
||||
{{ html()->text('first_name')->class('form-control')->placeholder('Enter First Name')->required() }}
|
||||
{{ html()->div('Please enter first name')->class('invalid-feedback') }}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Middle name')->class('form-label') }}
|
||||
{{ html()->text('middle_name')->class('form-control')->placeholder('Enter Middle Name') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Last name')->class('form-label') }}
|
||||
{{ html()->text('last_name')->class('form-control')->placeholder('Enter Last Name')->required() }}
|
||||
{{ html()->div('Please enter last name')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
{{ html()->label('Gender')->class('form-label') }}
|
||||
{{ html()->select('genders_id', $genderList)->class('form-select select2')->placeholder('Select Gender') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Date of Birth')->class('form-label') }}
|
||||
{{ html()->date('dob')->class('form-control')->placeholder('Choose Date of Birth')->required() }}
|
||||
{{ html()->div('Please choose dob')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Nationality')->class('form-label') }}
|
||||
{{ html()->select('nationalities_id', $nationalityList)->class('form-select select2')->placeholder('Select Nationality') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Email')->class('form-label') }}
|
||||
{{ html()->email('email')->class('form-control')->placeholder('Enter Email')->required() }}
|
||||
{{ html()->div('Please enter email')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Phone Number')->class('form-label') }}
|
||||
{{ html()->text('contact')->class('form-control')->placeholder('Enter Phone Number') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Upload Profile Picture')->class('form-label') }}
|
||||
{{ html()->file('profile_picture')->class('form-control') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row gy-1 mt-1">
|
||||
<p class="text-primary">Address Details</p>
|
||||
<hr>
|
||||
|
||||
{{-- <div class="col-md-4">
|
||||
{{ html()->label('Municipality')->class('form-label') }}
|
||||
{{ html()->select('municipality_id', [])->class('form-select')->placeholder('Select Municipality') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Ward')->class('form-label') }}
|
||||
{{ html()->text('ward')->class('form-control')->placeholder('Enter Ward no') }}
|
||||
</div> --}}
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Permanent Address')->class('form-label') }}
|
||||
{{ html()->text('permanent_address')->class('form-control')->placeholder('Enter Permanent Address') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Temporary Address')->class('form-label') }}
|
||||
{{ html()->text('temporary_address')->class('form-control')->placeholder('Enter Temporary Address') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row gy-1 mt-1">
|
||||
<p class="text-primary">Organization Details</p>
|
||||
<hr>
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Department')->class('form-label') }}
|
||||
{{ html()->select('department_id', $departmentList)->class('form-select select2')->placeholder('Select Department') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Designation')->class('form-label') }}
|
||||
{{ html()->select('designation_id', $designationList)->class('form-select select2')->placeholder('Select Designation') }}
|
||||
</div>
|
||||
|
||||
{{-- <div class="col-md-4">
|
||||
{{ html()->label('Join Date')->class('form-label') }}
|
||||
{{ html()->date('join_date')->class('form-control')->placeholder('Choose Join Date') }}
|
||||
</div> --}}
|
||||
|
||||
|
||||
<div class="col-md-8">
|
||||
{{ html()->label('Remarks')->class('form-label') }}
|
||||
{{ html()->textarea('remarks')->class('form-control')->placeholder('Enter Remarks') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<div class="mb-4 text-end">
|
||||
<button type="submit" class="btn btn-success w-sm">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
128
Modules/Employee/resources/views/partials/action.blade.php.bak
Normal file
128
Modules/Employee/resources/views/partials/action.blade.php.bak
Normal file
@ -0,0 +1,128 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header card-primary">
|
||||
<h4 class="card-title mb-0">Personal Details</h4>
|
||||
</div>
|
||||
|
||||
<div class="card-body row gy-4">
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('First name')->class('form-label') }}
|
||||
{{ html()->text('first_name')->class('form-control')->placeholder('Enter First Name')->required() }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Middle name')->class('form-label') }}
|
||||
{{ html()->text('middle_name')->class('form-control')->placeholder('Enter Middle Name') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Last name')->class('form-label') }}
|
||||
{{ html()->text('last_name')->class('form-control')->placeholder('Enter Last Name')->required() }}
|
||||
{{ html()->div('Please enter last name')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Gender')->class('form-label') }}
|
||||
{{ html()->select('gender', ['male', 'female'])->class('form-select')->placeholder('Select Gender') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Date of Birth')->class('form-label') }}
|
||||
{{ html()->date('dob')->class('form-control')->placeholder('Choose Date of Birth')->required() }}
|
||||
{{ html()->div('Please choose dob')->class('invalid-feedback') }}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Nationality')->class('form-label') }}
|
||||
{{ html()->select('nationality', ['Nepal', 'Other'])->class('form-control')->placeholder('Select Nationality') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Email')->class('form-label') }}
|
||||
{{ html()->email('email')->class('form-control')->placeholder('Enter Email')->required() }}
|
||||
{{ html()->div('Please enter email')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Phone Number')->class('form-label') }}
|
||||
{{ html()->text('phone')->class('form-control')->placeholder('Enter Phone Number') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Upload Profile Pic')->class('form-label') }}
|
||||
{{ html()->file('profile_pic')->class('form-control') }}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- end card body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header card-primary">
|
||||
<h5 class="card-title mb-0">Address Detail</h5>
|
||||
</div>
|
||||
<div class="card-body row gy-2">
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Municipality')->class('form-label') }}
|
||||
{{ html()->select('municipality_id', [])->class('form-select')->placeholder('Select Municipality') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Ward')->class('form-label') }}
|
||||
{{ html()->text('ward')->class('form-control')->placeholder('Enter Ward no') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Permanent Address')->class('form-label') }}
|
||||
{{ html()->text('perm_address')->class('form-control')->placeholder('Enter Permanent Address') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Temporary Address')->class('form-label') }}
|
||||
{{ html()->text('temp_address')->class('form-control')->placeholder('Enter Temporary Address') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header card-primary">
|
||||
<h5 class="card-title mb-0">Organization Detail</h5>
|
||||
</div>
|
||||
<div class="card-body row gy-2">
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Department')->class('form-label') }}
|
||||
{{ html()->select('department_id', ['Nepal'])->class('form-select')->placeholder('Select Department') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Designation')->class('form-label') }}
|
||||
{{ html()->select('designation_id', ['Nepal'])->class('form-select')->placeholder('Select Designation') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Join Date')->class('form-label') }}
|
||||
{{ html()->date('join_date')->class('form-control')->placeholder('Choose Join Date') }}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-8">
|
||||
{{ html()->label('Remarks')->class('form-label') }}
|
||||
{{ html()->textarea('remark')->class('form-control')->placeholder('Enter Remarks') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end card -->
|
||||
<div class="mb-4 text-end">
|
||||
<button type="submit" class="btn btn-success w-sm">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
2112
Modules/Employee/resources/views/show.blade.php
Normal file
2112
Modules/Employee/resources/views/show.blade.php
Normal file
File diff suppressed because it is too large
Load Diff
0
Modules/Employee/routes/.gitkeep
Normal file
0
Modules/Employee/routes/.gitkeep
Normal file
19
Modules/Employee/routes/api.php
Normal file
19
Modules/Employee/routes/api.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Employee\Http\Controllers\EmployeeController;
|
||||
|
||||
/*
|
||||
*--------------------------------------------------------------------------
|
||||
* API Routes
|
||||
*--------------------------------------------------------------------------
|
||||
*
|
||||
* Here is where you can register API routes for your application. These
|
||||
* routes are loaded by the RouteServiceProvider within a group which
|
||||
* is assigned the "api" middleware group. Enjoy building your API!
|
||||
*
|
||||
*/
|
||||
|
||||
Route::middleware(['auth:sanctum'])->prefix('v1')->group(function () {
|
||||
Route::apiResource('employee', EmployeeController::class)->names('employee');
|
||||
});
|
29
Modules/Employee/routes/web.php
Normal file
29
Modules/Employee/routes/web.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Employee\Http\Controllers\EmployeeController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register web routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| contains the "web" middleware group. Now create something great!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware('auth')->group(
|
||||
function () {
|
||||
|
||||
Route::prefix('employee')->as('employee.')->group(function () {
|
||||
Route::post('get-employee-by-id', [EmployeeController::class, 'getEmployeeById'])->name('getEmployeeById');
|
||||
Route::post('assignRole', [EmployeeController::class, 'assignRole'])->name('assignRole');
|
||||
Route::post('changePassword', [EmployeeController::class, 'changePassword'])->name('changePassword');
|
||||
});
|
||||
|
||||
Route::resource('employee', EmployeeController::class)->names('employee');
|
||||
|
||||
}
|
||||
);
|
26
Modules/Employee/vite.config.js
Normal file
26
Modules/Employee/vite.config.js
Normal file
@ -0,0 +1,26 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
outDir: '../../public/build-employee',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-employee',
|
||||
input: [
|
||||
__dirname + '/resources/assets/sass/app.scss',
|
||||
__dirname + '/resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
//export const paths = [
|
||||
// 'Modules/Employee/resources/assets/sass/app.scss',
|
||||
// 'Modules/Employee/resources/assets/js/app.js',
|
||||
//];
|
Reference in New Issue
Block a user