first commit

This commit is contained in:
Sampanna Rimal
2024-08-27 17:48:06 +05:45
commit 53c0140f58
10839 changed files with 1125847 additions and 0 deletions

View File

@ -0,0 +1,102 @@
<?php
namespace Modules\Asset\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Services\AdminService;
use Modules\Asset\Repositories\AssetCategoryInterface;
use Modules\Employee\Repositories\EmployeeRepository;
class AssetCategoryController extends Controller
{
private $assetCategoryRepository;
private $adminService;
private $employeeRepository;
public function __construct(AssetCategoryInterface $assetCategoryRepository, AdminService $adminService, EmployeeRepository $employeeRepository)
{
$this->assetCategoryRepository = $assetCategoryRepository;
$this->adminService = $adminService;
$this->employeeRepository = $employeeRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = "Asset Category Lists";
$data['assetCategoryLists'] = $this->assetCategoryRepository->findAll();
return view('asset::assetcategories.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = "Create AssetCategory";
$data['editable'] = false;
$data['assetCategoryLists'] = $this->assetCategoryRepository->pluck();
$data['departmentList'] = $this->adminService->pluckDepartments();
$data['employeeList'] = $this->employeeRepository->pluck();
return view('asset::assetCategories.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->assetCategoryRepository->create($request->all());
toastr()->success('AssetCategory Created Successfully.');
return redirect()->route('assetCategory.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('asset::assetcategories.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = "Edit AssetCategory";
$data['editable'] = true;
$data['assetCategory'] = $this->assetCategoryRepository->getAssetCategoryById($id);
return view('asset::assetcategories.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->assetCategoryRepository->update($id, $request->all());
toastr()->success('AssetCategory Updated Successfully.');
return redirect()->route('assetCategory.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,98 @@
<?php
namespace Modules\Asset\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Asset\Repositories\AssetCategoryInterface;
use Modules\Asset\Repositories\AssetCategoryRepository;
use Modules\Asset\Repositories\AssetInterface;
use Modules\Asset\Repositories\AssetRepository;
use Modules\Employee\Repositories\EmployeeRepository;
class AssetController extends Controller
{
private $assetRepository;
private $assetCategoryRepository;
private $employeeRepository;
public function __construct(AssetInterface $assetRepository, AssetCategoryInterface $assetCategoryRepository, EmployeeRepository $employeeRepository)
{
$this->assetRepository = $assetRepository;
$this->assetCategoryRepository = $assetCategoryRepository;
$this->employeeRepository = $employeeRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = "Asset Lists";
$data['assetLists'] = $this->assetRepository->findAll();
return view('asset::assets.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = "Create Asset";
$data['editable'] = false;
$data['assetCategoryLists'] = $this->assetCategoryRepository->pluck();
$data['employeeList'] = $this->employeeRepository->pluck();
return view('asset::assets.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->assetRepository->create($request->all());
toastr()->success('Asset Created Successfully.');
return redirect()->route('asset.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('asset::assets.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = "Edit Asset";
$data['editable'] = true;
$data['assetCategoryLists'] = $this->assetCategoryRepository->pluck();
$data['asset'] = $this->assetRepository->getAssetById($id);
return view('asset::assets.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->assetRepository->update($id, $request->all());
toastr()->success('Asset Updated Successfully.');
return redirect()->route('asset.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,91 @@
<?php
namespace Modules\asset\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Asset\Repositories\AssetDemandInterface;
use Modules\Asset\Repositories\AssetDemandRepository;
use Modules\Asset\Repositories\AssetInterface;
use Modules\Asset\Repositories\AssetRepository;
class AssetDemandController extends Controller
{
private $assetDemandRepository;
private $assetRepository;
public function __construct(AssetDemandInterface $assetDemandRepository, AssetInterface $assetRepository)
{
$this->assetDemandRepository = $assetDemandRepository;
$this->assetRepository = $assetRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = "AssetDemand Lists";
$data['assetDemandLists'] = $this->assetDemandRepository->findAll();
return view('asset::assetdemands.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = "Create assetDemand";
$data['editable'] = false;
$data['availableAssetLists'] = $this->assetRepository->pluckAvailable();
return view('asset::assetdemands.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->assetDemandRepository->create($request->all());
toastr()->success('assetDemand Created Successfully.');
return redirect()->route('assetDemand.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('asset::assetdemands.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = "Edit assetDemand";
$data['editable'] = true;
$data['assetDemand'] = $this->assetDemandRepository->getassetDemandById($id);
return view('asset::assetdemands.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->assetDemandRepository->update($id, $request->all());
toastr()->success('assetDemand Updated Successfully.');
return redirect()->route('assetDemand.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}