first commit
This commit is contained in:
0
Modules/Office/app/Http/Controllers/.gitkeep
Normal file
0
Modules/Office/app/Http/Controllers/.gitkeep
Normal file
107
Modules/Office/app/Http/Controllers/ContractController.php
Normal file
107
Modules/Office/app/Http/Controllers/ContractController.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Office\Repositories\ContractInterface;
|
||||
use Modules\Office\Repositories\ContractRepository;
|
||||
|
||||
class ContractController extends Controller
|
||||
{
|
||||
private $contractRepository;
|
||||
|
||||
public function __construct(ContractInterface $contractRepository)
|
||||
{
|
||||
$this->contractRepository = $contractRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = "Contract Lists";
|
||||
$data['contractLists'] = $this->contractRepository->findAll();
|
||||
return view('office::contracts.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = "Create Contract";
|
||||
$data['editable'] = false;
|
||||
return view('office::contracts.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->contractRepository->create($request->all());
|
||||
toastr()->success('Contract Created Successfully.');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('contract.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('office::contracts.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = "Edit Contract";
|
||||
$data['editable'] = true;
|
||||
$data['contract'] = $this->contractRepository->getContractById($id);
|
||||
return view('office::contracts.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->contractRepository->update($id, $request->except(['_token', '_method']));
|
||||
toastr()->success('Contract Updated Successfully.');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
|
||||
}
|
||||
|
||||
return redirect()->route('contract.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->contractRepository->delete($id);
|
||||
toastr()->success('Contract deleted successfully.');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->route('contract.index');
|
||||
}
|
||||
}
|
107
Modules/Office/app/Http/Controllers/DepositController.php
Normal file
107
Modules/Office/app/Http/Controllers/DepositController.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Office\Repositories\DepositInterface;
|
||||
use Modules\Office\Repositories\DepositRepository;
|
||||
|
||||
class DepositController extends Controller
|
||||
{
|
||||
private $depositRepository;
|
||||
|
||||
public function __construct(DepositInterface $depositRepository)
|
||||
{
|
||||
$this->depositRepository = $depositRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = "Deposit Lists";
|
||||
$data['depositLists'] = $this->depositRepository->findAll();
|
||||
return view('office::deposits.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = "Create Deposit";
|
||||
$data['editable'] = false;
|
||||
return view('office::deposits.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->depositRepository->create($request->all());
|
||||
toastr()->success('Deposit Created Successfully.');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('deposit.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('office::deposits.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = "Edit Deposit";
|
||||
$data['editable'] = true;
|
||||
$data['deposit'] = $this->depositRepository->getDepositById($id);
|
||||
return view('office::deposits.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->depositRepository->update($id, $request->except(['_token', '_method']));
|
||||
toastr()->success('Deposit Updated Successfully.');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
|
||||
}
|
||||
|
||||
// return redirect()->route('deposit.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->depositRepository->delete($id);
|
||||
toastr()->success('Deposit deleted successfully.');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->route('deposit.index');
|
||||
}
|
||||
}
|
107
Modules/Office/app/Http/Controllers/GeneratorController.php
Normal file
107
Modules/Office/app/Http/Controllers/GeneratorController.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Office\Repositories\GeneratorInterface;
|
||||
use Modules\Office\Repositories\GeneratorRepository;
|
||||
|
||||
class GeneratorController extends Controller
|
||||
{
|
||||
private $generatorRepository;
|
||||
|
||||
public function __construct(GeneratorInterface $generatorRepository)
|
||||
{
|
||||
$this->generatorRepository = $generatorRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = "Generator Lists";
|
||||
$data['generatorLists'] = $this->generatorRepository->findAll();
|
||||
return view('office::generators.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = "Create Generator";
|
||||
$data['editable'] = false;
|
||||
return view('office::generators.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->generatorRepository->create($request->all());
|
||||
toastr()->success('Generator Created Successfully.');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('generator.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('office::generators.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = "Edit Generator";
|
||||
$data['editable'] = true;
|
||||
$data['generator'] = $this->generatorRepository->getGeneratorById($id);
|
||||
return view('office::generators.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->generatorRepository->update($id, $request->all());
|
||||
toastr()->success('Generator Updated Successfully.');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
|
||||
}
|
||||
|
||||
return redirect()->route('generator.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->generatorRepository->delete($id);
|
||||
toastr()->success('Generator deleted successfully.');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->route('generator.index');
|
||||
}
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Office\Repositories\GeneratorLogBookInterface;
|
||||
use Modules\Office\Repositories\GeneratorLogBookRepository;
|
||||
use Modules\Office\Repositories\GeneratorRepository;
|
||||
|
||||
class GeneratorLogBookController extends Controller
|
||||
{
|
||||
private $generatorLogBookRepository;
|
||||
private $generatorRepository;
|
||||
|
||||
public function __construct(GeneratorLogBookInterface $generatorLogBookRepository,GeneratorLogBookInterface $generatorRepository)
|
||||
{
|
||||
$this->generatorLogBookRepository = $generatorLogBookRepository;
|
||||
$this->generatorRepository = $generatorRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = "GeneratorLogBook Lists";
|
||||
$data['generatorLogBookLists'] = $this->generatorLogBookRepository->findAll();
|
||||
return view('office::generatorlogbooks.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = "Create GeneratorLogBook";
|
||||
$data['editable'] = false;
|
||||
$data['generatorLists'] = $this->generatorRepository->pluck();
|
||||
return view('office::generatorlogbooks.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->generatorLogBookRepository->create($request->all());
|
||||
toastr()->success('GeneratorLogBook Created Successfully.');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('generatorLogBook.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('office::generatorlogbooks.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = "Edit GeneratorLogBook";
|
||||
$data['editable'] = true;
|
||||
$data['generatorLogBook'] = $this->generatorLogBookRepository->getGeneratorLogBookById($id);
|
||||
$data['generatorLists'] = $this->generatorRepository->pluck();
|
||||
return view('office::generatorlogbooks.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->generatorLogBookRepository->update($id, $request->all());
|
||||
toastr()->success('GeneratorLogBook Updated Successfully.');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
|
||||
}
|
||||
|
||||
return redirect()->route('generatorLogBook.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->generatorLogBookRepository->delete($id);
|
||||
toastr()->success('GeneratorLogBook deleted successfully.');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->route('generatorLogBook.index');
|
||||
}
|
||||
}
|
67
Modules/Office/app/Http/Controllers/OfficeController.php
Normal file
67
Modules/Office/app/Http/Controllers/OfficeController.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class OfficeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('office::index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('office::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('office::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('office::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Office\Repositories\PurchaseServiceInterface;
|
||||
use Modules\Office\Repositories\PurchaseServiceRepository;
|
||||
|
||||
class PurchaseServiceController extends Controller
|
||||
{
|
||||
private $purchaseServiceRepository;
|
||||
|
||||
public function __construct(PurchaseServiceInterface $purchaseServiceRepository)
|
||||
{
|
||||
$this->purchaseServiceRepository = $purchaseServiceRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data['title'] = "PurchaseService Lists";
|
||||
$data['purchaseServiceLists'] = $this->purchaseServiceRepository->findAll();
|
||||
return view('office::purchaseservices.index', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data['title'] = "Create PurchaseService";
|
||||
$data['editable'] = false;
|
||||
return view('office::purchaseservices.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->purchaseServiceRepository->create($request->all());
|
||||
toastr()->success('PurchaseService Created Successfully.');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('purchaseService.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('office::purchaseservices.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data['title'] = "Edit PurchaseService";
|
||||
$data['editable'] = true;
|
||||
$data['purchaseService'] = $this->purchaseServiceRepository->getPurchaseServiceById($id);
|
||||
return view('office::purchaseservices.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->purchaseServiceRepository->update($id, $request->except(['_token', '_method']));
|
||||
toastr()->success('PurchaseService Updated Successfully.');
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
|
||||
}
|
||||
|
||||
// return redirect()->route('purchaseService.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$this->purchaseServiceRepository->delete($id);
|
||||
toastr()->success('PurchaseService deleted successfully.');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->route('purchaseService.index');
|
||||
}
|
||||
}
|
0
Modules/Office/app/Http/Requests/.gitkeep
Normal file
0
Modules/Office/app/Http/Requests/.gitkeep
Normal file
0
Modules/Office/app/Models/.gitkeep
Normal file
0
Modules/Office/app/Models/.gitkeep
Normal file
31
Modules/Office/app/Models/Contract.php
Normal file
31
Modules/Office/app/Models/Contract.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Office\Database\factories\ContractFactory;
|
||||
|
||||
class Contract extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_contracts';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'party',
|
||||
'contract_date',
|
||||
'expiry_date',
|
||||
'document',
|
||||
'status',
|
||||
'description',
|
||||
'remarks',
|
||||
'createdBy',
|
||||
'updatedBy',
|
||||
];
|
||||
}
|
43
Modules/Office/app/Models/Deposit.php
Normal file
43
Modules/Office/app/Models/Deposit.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Office\Database\factories\DepositFactory;
|
||||
|
||||
class Deposit extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = "tbl_deposits";
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'party',
|
||||
'total_amount',
|
||||
'amount_in_words',
|
||||
'thousand',
|
||||
'five_hundred',
|
||||
'hundred',
|
||||
'fifty',
|
||||
'twenty',
|
||||
'ten',
|
||||
'five',
|
||||
'two',
|
||||
'one',
|
||||
'deposited_date',
|
||||
'account_no',
|
||||
'received_by',
|
||||
'deposited_by',
|
||||
'status',
|
||||
'description',
|
||||
'remarks',
|
||||
'createdBy',
|
||||
'updatedBy',
|
||||
];
|
||||
|
||||
}
|
42
Modules/Office/app/Models/Generator.php
Normal file
42
Modules/Office/app/Models/Generator.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Office\Database\factories\GeneratorFactory;
|
||||
|
||||
class Generator extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tbl_generators';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'model',
|
||||
'manufacturer',
|
||||
'serial_number',
|
||||
'fuel_type',
|
||||
'fuel_tank_capacity',
|
||||
'capacity',
|
||||
'warranty_expiry_date',
|
||||
'location',
|
||||
'installation_date',
|
||||
'last_maintenance_date',
|
||||
'next_maintenance_due',
|
||||
'status',
|
||||
'description',
|
||||
'remarks',
|
||||
'createdBy',
|
||||
'updatedBy',
|
||||
];
|
||||
|
||||
const FUEL_TYPE = [
|
||||
'petrol' => 'Petrol',
|
||||
'diesel' => 'Diesel',
|
||||
];
|
||||
}
|
41
Modules/Office/app/Models/GeneratorLogBook.php
Normal file
41
Modules/Office/app/Models/GeneratorLogBook.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Office\Database\factories\GeneratorLogBookFactory;
|
||||
|
||||
class GeneratorLogBook extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = "tbl_generator_log_books";
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'generator_id',
|
||||
'log_type',
|
||||
'from',
|
||||
'to',
|
||||
'servicing_date',
|
||||
'fee',
|
||||
'by',
|
||||
'diesel_consumed',
|
||||
'mobile_consumed',
|
||||
'status',
|
||||
'description',
|
||||
'remarks',
|
||||
'createdBy',
|
||||
'updatedBy',
|
||||
];
|
||||
|
||||
const LOG_TYPE = [
|
||||
'usage' => 'Usage',
|
||||
'service' => 'Service',
|
||||
'other' => 'Other'
|
||||
];
|
||||
|
||||
}
|
37
Modules/Office/app/Models/PurchaseService.php
Normal file
37
Modules/Office/app/Models/PurchaseService.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Office\Database\factories\PurchaseServiceFactory;
|
||||
|
||||
class PurchaseService extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = "tbl_purchase_services";
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'purchase_name',
|
||||
'party',
|
||||
'contract_name',
|
||||
'contract_validity',
|
||||
'purchased_date',
|
||||
'reference_no',
|
||||
'vat_no',
|
||||
'contact_no',
|
||||
'address',
|
||||
'quantity',
|
||||
'rate',
|
||||
'total_amount',
|
||||
'description',
|
||||
'remarks',
|
||||
'status',
|
||||
'createdBy',
|
||||
'updatedBy',
|
||||
];
|
||||
}
|
0
Modules/Office/app/Observers/.gitkeep
Normal file
0
Modules/Office/app/Observers/.gitkeep
Normal file
0
Modules/Office/app/Providers/.gitkeep
Normal file
0
Modules/Office/app/Providers/.gitkeep
Normal file
131
Modules/Office/app/Providers/OfficeServiceProvider.php
Normal file
131
Modules/Office/app/Providers/OfficeServiceProvider.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Office\Models\Deposit;
|
||||
use Modules\Office\Repositories\ContractInterface;
|
||||
use Modules\Office\Repositories\ContractRepository;
|
||||
use Modules\Office\Repositories\DepositInterface;
|
||||
use Modules\Office\Repositories\DepositRepository;
|
||||
use Modules\Office\Repositories\GeneratorInterface;
|
||||
use Modules\Office\Repositories\GeneratorLogBookInterface;
|
||||
use Modules\Office\Repositories\GeneratorLogBookRepository;
|
||||
use Modules\Office\Repositories\GeneratorRepository;
|
||||
use Modules\Office\Repositories\PurchaseServiceInterface;
|
||||
use Modules\Office\Repositories\PurchaseServiceRepository;
|
||||
|
||||
class OfficeServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Office';
|
||||
|
||||
protected string $moduleNameLower = 'office';
|
||||
|
||||
/**
|
||||
* 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->register(RouteServiceProvider::class);
|
||||
$this->app->bind(ContractInterface::class, ContractRepository::class);
|
||||
$this->app->bind(DepositInterface::class, DepositRepository::class);
|
||||
$this->app->bind(GeneratorInterface::class, GeneratorRepository::class);
|
||||
$this->app->bind(PurchaseServiceInterface::class, PurchaseServiceRepository::class);
|
||||
$this->app->bind(GeneratorLogBookInterface::class, GeneratorLogBookRepository::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/Office/app/Providers/RouteServiceProvider.php
Normal file
49
Modules/Office/app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\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('Office', '/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('Office', '/routes/api.php'));
|
||||
}
|
||||
}
|
0
Modules/Office/app/Repositories/.gitkeep
Normal file
0
Modules/Office/app/Repositories/.gitkeep
Normal file
13
Modules/Office/app/Repositories/ContractInterface.php
Normal file
13
Modules/Office/app/Repositories/ContractInterface.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Repositories;
|
||||
|
||||
interface ContractInterface
|
||||
{
|
||||
public function pluck();
|
||||
public function findAll();
|
||||
public function getContractById($contractId);
|
||||
public function delete($contractId);
|
||||
public function create(array $contractDetails);
|
||||
public function update($contractId, array $newDetails);
|
||||
}
|
38
Modules/Office/app/Repositories/ContractRepository.php
Normal file
38
Modules/Office/app/Repositories/ContractRepository.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Repositories;
|
||||
|
||||
use Modules\Office\Models\Contract;
|
||||
|
||||
|
||||
class ContractRepository implements ContractInterface
|
||||
{
|
||||
public function pluck(){
|
||||
return Contract::pluck('name','id');
|
||||
}
|
||||
public function findAll()
|
||||
{
|
||||
return Contract::get();
|
||||
}
|
||||
|
||||
public function getContractById($contractId)
|
||||
{
|
||||
return Contract::findOrFail($contractId);
|
||||
}
|
||||
|
||||
public function delete($contractId)
|
||||
{
|
||||
Contract::destroy($contractId);
|
||||
}
|
||||
|
||||
public function create(array $contractDetails)
|
||||
{
|
||||
return Contract::create($contractDetails);
|
||||
}
|
||||
|
||||
public function update($contractId, array $newDetails)
|
||||
{
|
||||
return Contract::where('id', $contractId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Office/app/Repositories/DepositInterface.php
Normal file
12
Modules/Office/app/Repositories/DepositInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Repositories;
|
||||
|
||||
interface DepositInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getDepositById($depositId);
|
||||
public function delete($depositId);
|
||||
public function create(array $depositDetails);
|
||||
public function update($depositId, array $newDetails);
|
||||
}
|
35
Modules/Office/app/Repositories/DepositRepository.php
Normal file
35
Modules/Office/app/Repositories/DepositRepository.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Repositories;
|
||||
|
||||
use Modules\Office\Models\Deposit;
|
||||
|
||||
|
||||
class DepositRepository implements DepositInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Deposit::get();
|
||||
}
|
||||
|
||||
public function getDepositById($depositId)
|
||||
{
|
||||
return Deposit::findOrFail($depositId);
|
||||
}
|
||||
|
||||
public function delete($depositId)
|
||||
{
|
||||
Deposit::destroy($depositId);
|
||||
}
|
||||
|
||||
public function create(array $depositDetails)
|
||||
{
|
||||
return Deposit::create($depositDetails);
|
||||
}
|
||||
|
||||
public function update($depositId, array $newDetails)
|
||||
{
|
||||
return Deposit::where('id', $depositId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
13
Modules/Office/app/Repositories/GeneratorInterface.php
Normal file
13
Modules/Office/app/Repositories/GeneratorInterface.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Repositories;
|
||||
|
||||
interface GeneratorInterface
|
||||
{
|
||||
public function pluck();
|
||||
public function findAll();
|
||||
public function getGeneratorById($generatorId);
|
||||
public function delete($generatorId);
|
||||
public function create(array $generatorDetails);
|
||||
public function update($generatorId, array $newDetails);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Repositories;
|
||||
|
||||
interface GeneratorLogBookInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getGeneratorLogBookById($generatorLogBookId);
|
||||
public function delete($generatorLogBookId);
|
||||
public function create(array $generatorLogBookDetails);
|
||||
public function update($generatorLogBookId, array $newDetails);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Repositories;
|
||||
|
||||
use Modules\Office\Models\GeneratorLogBook;
|
||||
|
||||
|
||||
class GeneratorLogBookRepository implements GeneratorLogBookInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return GeneratorLogBook::get();
|
||||
}
|
||||
|
||||
public function getGeneratorLogBookById($generatorLogBookId)
|
||||
{
|
||||
return GeneratorLogBook::findOrFail($generatorLogBookId);
|
||||
}
|
||||
|
||||
public function delete($generatorLogBookId)
|
||||
{
|
||||
GeneratorLogBook::destroy($generatorLogBookId);
|
||||
}
|
||||
|
||||
public function create(array $generatorLogBookDetails)
|
||||
{
|
||||
return GeneratorLogBook::create($generatorLogBookDetails);
|
||||
}
|
||||
|
||||
public function update($generatorLogBookId, array $newDetails)
|
||||
{
|
||||
return GeneratorLogBook::where('id', $generatorLogBookId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
38
Modules/Office/app/Repositories/GeneratorRepository.php
Normal file
38
Modules/Office/app/Repositories/GeneratorRepository.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Repositories;
|
||||
|
||||
use Modules\Office\Models\Generator;
|
||||
|
||||
|
||||
class GeneratorRepository implements GeneratorInterface
|
||||
{
|
||||
public function pluck(){
|
||||
return Generator::pluck('name','id');
|
||||
}
|
||||
public function findAll()
|
||||
{
|
||||
return Generator::get();
|
||||
}
|
||||
|
||||
public function getGeneratorById($generatorId)
|
||||
{
|
||||
return Generator::findOrFail($generatorId);
|
||||
}
|
||||
|
||||
public function delete($generatorId)
|
||||
{
|
||||
Generator::destroy($generatorId);
|
||||
}
|
||||
|
||||
public function create(array $generatorDetails)
|
||||
{
|
||||
return Generator::create($generatorDetails);
|
||||
}
|
||||
|
||||
public function update($generatorId, array $newDetails)
|
||||
{
|
||||
return Generator::where('id', $generatorId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Office/app/Repositories/PurchaseServiceInterface.php
Normal file
12
Modules/Office/app/Repositories/PurchaseServiceInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Repositories;
|
||||
|
||||
interface PurchaseServiceInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getPurchaseServiceById($purchaseServiceId);
|
||||
public function delete($purchaseServiceId);
|
||||
public function create(array $purchaseServiceDetails);
|
||||
public function update($purchaseServiceId, array $newDetails);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Office\Repositories;
|
||||
|
||||
use Modules\Office\Models\PurchaseService;
|
||||
|
||||
|
||||
class PurchaseServiceRepository implements PurchaseServiceInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return PurchaseService::get();
|
||||
}
|
||||
|
||||
public function getPurchaseServiceById($purchaseServiceId)
|
||||
{
|
||||
return PurchaseService::findOrFail($purchaseServiceId);
|
||||
}
|
||||
|
||||
public function delete($purchaseServiceId)
|
||||
{
|
||||
PurchaseService::destroy($purchaseServiceId);
|
||||
}
|
||||
|
||||
public function create(array $purchaseServiceDetails)
|
||||
{
|
||||
return PurchaseService::create($purchaseServiceDetails);
|
||||
}
|
||||
|
||||
public function update($purchaseServiceId, array $newDetails)
|
||||
{
|
||||
return PurchaseService::where('id', $purchaseServiceId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user