first change

This commit is contained in:
2025-07-27 17:40:56 +05:45
commit f8b9a6725b
3152 changed files with 229528 additions and 0 deletions

18
.editorconfig Normal file
View File

@@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 4

64
.env.example Normal file
View File

@@ -0,0 +1,64 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

11
.gitattributes vendored Normal file
View File

@@ -0,0 +1,11 @@
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore

22
.gitignore vendored Normal file
View File

@@ -0,0 +1,22 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
/resources/views/raffels
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
/.zed

View File

@@ -0,0 +1,141 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Modules\Client\Repositories\ClientInterface;
use Modules\Content\Interfaces\ContentInterface;
use Modules\Content\Models\Content;
use Modules\Meeting\Models\Event;
use Modules\Meeting\Models\Meeting;
use Modules\Meeting\Repositories\EventInterface;
use Modules\Meeting\Repositories\MeetingInterface;
use Modules\Product\Interfaces\ProductInterface;
class CalendarController extends Controller
{
private $event;
private $content;
private $meeting;
private $employee;
private $client;
private $product;
public function __construct(
EventInterface $event,
MeetingInterface $meeting,
ContentInterface $content,
ProductInterface $product,
ClientInterface $client
) {
$this->event = $event;
$this->meeting = $meeting;
$this->content = $content;
$this->client = $client;
$this->product = $product;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Calendar';
$data['events'] = $this->event->findAll();
$data['meetings'] = $this->meeting->findAll();
$data['contents'] = $this->content->findAllUpcomingScheduledContent();
$data['productOptions'] = $this->product->pluck();
$data['clientList'] = $this->client->pluck();
return view('admin::calendar.index', $data);
}
public function calendarByAjax(Request $request)
{
$filters['start_date'] = $request->start;
$filters['end_date'] = $request->end;
$filters['product_id'] = $request->product_id;
$list = [];
$events = Event::when($filters, function ($query) use ($filters) {
if (isset($filters["start_date"])) {
$query->whereDate("start_date", ">=", $filters["start_date"]);
}
if (isset($filters["end_date"])) {
$query->whereDate("end_date", "<=", $filters["end_date"]);
$query->orWhereNull("end_date");
}
})->get();
foreach ($events as $event) {
$list[] = [
"id" => $event->id,
"title" => $event->title,
"type" => 'event',
"start" => $event->start_date,
"end" => $event->end_date,
"className" => "bg-primary",
"desc" => $event->description,
"location" => $event->location,
'allDay' => true,
];
}
$contents = Content::where('status', '!=', 11)
->when($filters, function ($query) use ($filters) {
if (isset($filters["start_date"])) {
$query->whereDate("release_date", ">=", $filters["start_date"]);
}
if (isset($filters["end_date"])) {
$query->where(function ($q) use ($filters) {
$q->whereDate("release_date", "<=", $filters["end_date"])
->orWhereNull("release_date");
});
}
if (isset($filters["product_id"])) {
$query->where("product_id", $filters["product_id"]);
}
})
->with(['product.client'])
->get();
foreach ($contents as $content) {
$list[] = [
"id" => $content->id,
"title" => $content->title,
"type" => 'content schedule',
"start" => Carbon::parse($content->getRawOriginal('release_date') . ' ' . $content->getRawOriginal('release_time')),
"end" => null,
"className" => "bg-success",
"location" => null,
"desc" => $content->product?->client?->name,
'allDay' => false,
];
}
$meetings = Meeting::when($filters, function ($query) use ($filters) {
if (isset($filters["start_date"])) {
$query->whereDate("date", ">=", $filters["start_date"]);
}
})->get();
foreach ($meetings as $meeting) {
$list[] = [
"id" => $meeting->id,
"title" => $meeting->title,
"type" => 'meeting',
"start" => Carbon::parse($meeting->getRawOriginal('date') . ' ' . $meeting->getRawOriginal('start_time')),
"location" => $meeting->location,
"desc" => $meeting->description,
"className" => "bg-warning",
'allDay' => false,
];
}
return $list;
}
}

View File

@@ -0,0 +1,83 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Repositories\CityRepository;
class CityController extends Controller
{
private $cityRepository;
public function __construct(CityRepository $cityRepository)
{
$this->cityRepository = $cityRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'City List';
$data['cityLists'] = $this->cityRepository->findAll();
return view('admin::cities.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create City';
$data['editable'] = false;
return view('admin::cities.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->cityRepository->create($request->all());
return redirect()->route('city.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::cities.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit City';
$data['editable'] = true;
$data['city'] = $this->cityRepository->getCityById($id);
return view('admin::cities.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->cityRepository->update($id, $request->all());
return redirect()->route('city.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@@ -0,0 +1,102 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Models\Country;
use Modules\Admin\Repositories\CountryInterface;
use Yajra\DataTables\Facades\DataTables;
class CountryController extends Controller
{
private $country;
public function __construct(CountryInterface $country)
{
$this->country = $country;
}
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$data['title'] = 'Country List';
$data['countries'] = $this->country->findAll();
if ($request->ajax()) {
$model = Country::query();
return DataTables::eloquent($model)
->setRowId('{{$id}}')
->setRowClass('{{"text-center align-middle"}}')
->addColumn('action', 'admin::countries.datatables.action-btn')
->rawColumns(['action'])
->toJson();
}
return view('admin::countries.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Country';
$data['editable'] = false;
return view('admin::countries.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->country->create($request->all());
return redirect()->route('country.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::countries.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Country';
$data['editable'] = true;
$data['country'] = $this->country->getCountryById($id);
return view('admin::countries.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->country->update($id, $request->except(['_method', '_token']));
return redirect()->route('country.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->country->delete($id);
return response()->json(['status' => 200, 'message' => 'Country has been deleted!'], 200);
} catch (\Throwable $th) {
return response()->json(['status' => 500, 'message' => 'Country to delete!', 'error' => $th->getMessage()], 500);
}
}
}

View File

@@ -0,0 +1,112 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Admin\Models\Department;
use Modules\Admin\Repositories\DepartmentRepository;
use Modules\Employee\Repositories\EmployeeRepository;
class DepartmentController extends Controller
{
private $departmentRepository;
private $employeeRepository;
public function __construct(DepartmentRepository $departmentRepository,
EmployeeRepository $employeeRepository) {
$this->departmentRepository = $departmentRepository;
$this->employeeRepository = $employeeRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
// toastr()
// ->info('Welcome back')
// ->success('Data has been saved successfully!')
// ->warning('Are you sure you want to proceed ?');
$data['title'] = 'Department List';
$data['departmentLists'] = $this->departmentRepository->findAll();
return view('admin::departments.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
// toastr('Department has been created!', 'success');
$data['title'] = 'Create Department';
$data['editable'] = false;
$data['employeeLists'] = $this->employeeRepository->pluck();
return view('admin::departments.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
// try {
$this->departmentRepository->create($request->all());
// toastr()->success('Department has been created!');
// } catch (\Throwable $th) {
// toastr()->error($th->getMessage());
// }
// toastr('Department has been created!', 'success');
// return back();
return redirect()->route('department.index')->with('sucess', 'adw');
}
/**
* Show the specified resource.
*/
public function show(Department $department)
{
$data['department'] = $department;
return view('admin::departments.show', $data);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Department';
$data['editable'] = true;
$data['employeeLists'] = $this->employeeRepository->pluck();
$data['department'] = $this->departmentRepository->getDepartmentById($id);
return view('admin::departments.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request,Department $department): RedirectResponse
{
// dd($request->all())
try {
$department->update($request->except(['_token', '_method']));
// $this->departmentRepository->update($id, $request->except(['_token', '_method']));
toastr()->success('Department has been updated!');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('department.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
$this->departmentRepository->delete($id);
toastr()->success('Department Deleted Succesfully');
return response()->json(['status' => true, 'message' => 'Department Delete Succesfully']);
}
}

View File

@@ -0,0 +1,100 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Admin\Repositories\DesignationRepository;
use Modules\Admin\Services\AdminService;
class DesignationController extends Controller
{
private $designationRepository;
private $adminService;
public function __construct(DesignationRepository $designationRepository, AdminService $adminService)
{
$this->designationRepository = $designationRepository;
$this->adminService = $adminService;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Designation List';
$data['designationLists'] = $this->designationRepository->findAll();
return view('admin::designations.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Designation';
$data['editable'] = false;
$data['departmentList'] = $this->adminService->pluckDepartments();
return view('admin::designations.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$data = $request->except(['_method', '_token']);
$this->designationRepository->create($data);
flash()->addSuccess('Department Data Created!');
return redirect()->route('designation.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::designations.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Designation';
$data['editable'] = true;
$data['designation'] = $this->designationRepository->getDesignationById($id);
$data['departmentList'] = $this->adminService->pluckDepartments();
return view('admin::designations.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$data = $request->except(['_method', '_token']);
$desgination = $this->designationRepository->getDesignationById($id);
$desgination->update($data);
flash()->addSuccess('Department Data Updated!');
return redirect()->route('designation.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
$this->designationRepository->delete($id);
flash()->addSuccess('Designation Deleted Succesfully');
return response()->json(['status' => true, 'message' => 'Designation Delete Succesfully']);
}
}

View File

@@ -0,0 +1,120 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Models\District;
use Modules\Admin\Repositories\ProvinceInterface;
use Modules\Admin\Repositories\DistrictInterface;
use Yajra\DataTables\Facades\DataTables;
class DistrictController extends Controller
{
private $district;
private $province;
public function __construct(DistrictInterface $district, ProvinceInterface $province)
{
$this->district = $district;
$this->province = $province;
}
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$data['title'] = 'District List';
if ($request->ajax()) {
$model = District::query();
return DataTables::eloquent($model)
->setRowId('{{$id}}')
->setRowClass('{{"text-center align-middle"}}')
->addColumn('province', function(District $district){
return $district->province?->name;
})
->addColumn('action', 'admin::districts.datatables.action-btn')
->rawColumns(['province','action'])
->toJson();
}
return view('admin::districts.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create District';
$data['editable'] = false;
$data['provinceLists'] = $this->province->pluck();
return view('admin::districts.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->district->create($request->all());
return redirect()->route('district.index')->with('sucess', 'District has been created!');
} catch (\Throwable $th) {
return redirect()->back()->withError($th->getMessage());
}
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::districts.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit District';
$data['editable'] = true;
$data['district'] = $this->district->getDistrictById($id);
$data['provinceLists'] = $this->province->pluck();
return view('admin::districts.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
try {
$this->district->update($id, $request->except(['_method', '_token']) );
return redirect()->route('district.index')->with('success','District has been updated!');
} catch (\Throwable $th) {
return redirect()->back()->withError($th->getMessage());
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->district->delete($id);
return response()->json(['status' => 200, 'message' => 'District has been deleted!'], 200);
} catch (\Throwable $th) {
return response()->json(['status' => 500, 'message' => 'District to delete!', 'error' => $th->getMessage()], 500);
}
}
}

View File

@@ -0,0 +1,113 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Admin\Repositories\DropdownInterface;
use Modules\Admin\Repositories\FieldInterface;
class DropdownController extends Controller
{
private $fieldRepository;
private $dropdownRepository;
public function __construct(FieldInterface $fieldRepository,
DropdownInterface $dropdownRepository) {
$this->fieldRepository = $fieldRepository;
$this->dropdownRepository = $dropdownRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['editable'] = false;
$data['title'] = 'Dropdown List';
$data['fields'] = $this->fieldRepository->findAll();
$data['fieldLists'] = $data['fields']->pluck('title', 'id');
return view('admin::dropdown.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('admin::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$inputData = $request->all();
try {
// $inputData['status'] = $request->status ?? 10;
$this->dropdownRepository->create($inputData);
toastr()->success('Dropdown Created Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('dropdown.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$editable = true;
$dropdownModel = $this->dropdownRepository->getDropdownById($id);
$fieldLists = $this->fieldRepository->getList();
return response()->json([
'view' => view('admin::dropdown.edit', compact('dropdownModel', 'fieldLists', 'editable'))->render(),
'status' => true,
]);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$inputData = $request->except(['_method', '_token']);
try {
$inputData['status'] = $request->status ?? 10;
$this->dropdownRepository->update($id, $inputData);
toastr()->success('Dropdown Update Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('dropdown.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->dropdownRepository->delete($id);
toastr()->success('Dropdown Deleted Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return response()->json([
'status' => true,
]);
}
}

View File

@@ -0,0 +1,83 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Admin\Repositories\DropdownInterface;
use Modules\Admin\Repositories\FieldInterface;
class FieldController extends Controller
{
private $fieldRepository;
private $dropdownRepository;
public function __construct(FieldInterface $fieldRepository,
DropdownInterface $dropdownRepository) {
$this->fieldRepository = $fieldRepository;
$this->dropdownRepository = $dropdownRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
return view('admin::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('admin::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$inputData = $request->all();
try {
$this->fieldRepository->create($inputData);
toastr()->success('Field Created Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('dropdown.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('admin::edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class FileController extends Controller
{
/**
* Display a listing of the resource.
*/
public function upload()
{
if (request()->hasFile('upload')) {
$file = request()->file('upload');
$path = 'uploads/ckeditor';
$imagePath = uploadImage($file, $path);
$CKEditorFuncNum = request()->input('CKEditorFuncNum');
$url = asset('storage/' . $imagePath);
$response = "<script>window.parent.CKEDITOR.tools.callFunction($CKEditorFuncNum, '$url')</script>";
echo $response;
}
}
}

View File

@@ -0,0 +1,119 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Models\Municipality;
use Modules\Admin\Repositories\DistrictInterface;
use Modules\Admin\Repositories\MunicipalityInterface;
use Yajra\DataTables\Facades\DataTables;
class MunicipalityController extends Controller
{
private $municipality;
private $district;
public function __construct(MunicipalityInterface $municipality, DistrictInterface $district)
{
$this->municipality = $municipality;
$this->district = $district;
}
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$data['title'] = 'Municipality List';
if ($request->ajax()) {
$model = Municipality::query();
return DataTables::eloquent($model)
->setRowId('{{$id}}')
->setRowClass('{{"text-center align-middle"}}')
->addColumn('district', function (Municipality $municipality) {
return $municipality->district?->name;
})
->addColumn('action', 'admin::municipalities.datatables.action-btn')
->rawColumns(['district', 'action'])
->toJson();
}
return view('admin::municipalities.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Municipality';
$data['editable'] = false;
$data['districtLists'] = $this->district->pluck();
return view('admin::municipalities.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->municipality->create($request->all());
return redirect()->route('municipality.index')->with('sucess', 'Municipality has been created!');
} catch (\Throwable $th) {
return redirect()->back()->withError($th->getMessage());
}
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::municipalities.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Municipality';
$data['editable'] = true;
$data['municipality'] = $this->municipality->getMunicipalityById($id);
$data['districtLists'] = $this->district->pluck();
return view('admin::municipalities.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->municipality->update($id, $request->except(['_method', '_token']));
return redirect()->route('municipality.index')->with('success', 'Municipality has been updated!');
} catch (\Throwable $th) {
return redirect()->back()->withError($th->getMessage());
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->municipality->delete($id);
return response()->json(['status' => 200, 'message' => 'Municipality has been deleted!'], 200);
} catch (\Throwable $th) {
return response()->json(['status' => 500, 'message' => 'Municipality to delete!', 'error' => $th->getMessage()], 500);
}
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class NotificationController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$data['notifications'] = auth()->user()->notifications;
return view('notification.index', $data);
}
public function markAsRead(Request $request)
{
$filterData = $request->all();
try {
$notification = auth()->user()->notifications()->where('id', $filterData['id'])->first();
if ($notification) {
$notification->markAsRead();
}
return redirect()->back()->withSuccess('Mark As Read');
} catch (\Throwable $th) {
return redirect()->back()->withError('Something Went Wrong!');
}
}
public function markAllAsRead(Request $request)
{
try {
foreach (auth()->user()->unreadNotifications as $notification) {
$notification->markAsRead();
}
return redirect()->back()->withSuccess('Mark All As Read');
} catch (\Throwable $th) {
//throw $th;
return redirect()->back()->withError('Something Went Wrong!');
}
}
}

View File

@@ -0,0 +1,120 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Models\Province;
use Modules\Admin\Repositories\CountryInterface;
use Modules\Admin\Repositories\ProvinceInterface;
use Yajra\DataTables\Facades\DataTables;
class ProvinceController extends Controller
{
private $province;
private $country;
public function __construct(ProvinceInterface $province, CountryInterface $country)
{
$this->province = $province;
$this->country = $country;
}
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$data['title'] = 'Province List';
if ($request->ajax()) {
$model = Province::query();
return DataTables::eloquent($model)
->setRowId('{{$id}}')
->setRowClass('{{"text-center align-middle"}}')
->addColumn('country', function(Province $province){
return $province?->country?->name;
})
->addColumn('action', 'admin::provinces.datatables.action-btn')
->rawColumns(['country','action'])
->toJson();
}
return view('admin::provinces.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Province';
$data['editable'] = false;
$data['countryLists'] = $this->country->pluck();
return view('admin::provinces.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->province->create($request->all());
return redirect()->route('province.index')->with('sucess', 'Province has been created!');
} catch (\Throwable $th) {
return redirect()->back()->withError($th->getMessage());
}
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::provinces.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Province';
$data['editable'] = true;
$data['province'] = $this->province->getProvinceById($id);
$data['countryLists'] = $this->country->pluck();
return view('admin::provinces.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->province->update($id, $request->except(['_method', '_token']) );
return redirect()->route('province.index')->with('success','Province has been updated!');
} catch (\Throwable $th) {
return redirect()->back()->withError($th->getMessage());
}
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->province->delete($id);
return response()->json(['status' => 200, 'message' => 'Province has been deleted!'], 200);
} catch (\Throwable $th) {
return response()->json(['status' => 500, 'message' => 'Province to delete!', 'error' => $th->getMessage()], 500);
}
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace Modules\Admin\Http\Controllers;
use Cache;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Models\Setting;
use Modules\Admin\Repositories\SettingInterface;
class SettingController extends Controller
{
private $setting;
/**
* Display a listing of the resource.
*/
public function __construct(SettingInterface $setting)
{
$this->setting = $setting;
}
public function index()
{
$data['title'] = "Edit Setting";
$data['editable'] = true;
$data['setting'] = $this->setting->findAll();
return view('admin::settings.edit', $data);
}
public function store(Request $request): RedirectResponse
{
try {
$input = $request->except([
'_method',
'_token',
]);
if ($request->hasFile('logo_pic')) {
$input['logo_pic'] = uploadImage($request->logo_pic);
}
foreach ($input as $key => $item) {
$finalInput = [
'key' => $key,
'value' => $item,
];
Setting::updateOrInsert(['key' => $key], $finalInput);
}
Cache::has('setting') ? Cache::forget('setting') : '';
return redirect()->route('setting.index')->with('success', 'Setting Updated');
} catch (\Throwable $th) {
return redirect()->back()->withError($th->getMessage());
}
}
public function destroy($id)
{
$this->setting->delete($id);
return response()->json(['status' => true]);
}
}

View File

View File

View File

@@ -0,0 +1,25 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\CityFactory;
class City extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'district_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
}

View File

@@ -0,0 +1,31 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class District extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'province_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected function province()
{
return $this->belongsTo(Province::class, 'province_id');
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Str;
class Dropdown extends Model
{
use StatusTrait;
protected $fillable = ['fid', 'title', 'alias', 'status'];
protected $appends = ['status_name'];
protected static function booted()
{
static::creating(function ($field) {
$field->alias = Str::slug($field->title);
});
static::updating(function ($field) {
$field->alias = Str::slug($field->title);
});
}
public function field()
{
return $this->belongsTo(Field::class, 'fid');
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Str;
class Field extends Model
{
protected $fillable = ['title', 'alias', 'status'];
protected static function booted()
{
static::creating(function ($field) {
$field->alias = Str::slug($field->title);
});
static::updating(function ($field) {
$field->alias = Str::slug($field->title);
});
}
public function dropdown()
{
return $this->hasMany(Dropdown::class, 'fid');
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\CreatedUpdatedBy;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
class Holiday extends Model
{
use CreatedUpdatedBy, StatusTrait;
protected $table = 'holidays';
protected $primaryKey = "holiday_id";
protected $fillable = [
'title',
'start_date',
'end_date',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected $casts = [
'start_date' => 'datetime',
'end_date' => 'datetime',
];
public $appends = ['status_name'];
}

View File

@@ -0,0 +1,31 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\MunicipalityFactory;
class Municipality extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'distict_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected function district()
{
return $this->belongsTo(District::class, 'district_id');
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Modules\Admin\Database\factories\ProvinceFactory;
class Province extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'country_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected function country()
{
return $this->belongsTo(Country::class, 'country_id');
}
}

View File

View File

@@ -0,0 +1,143 @@
<?php
namespace Modules\Admin\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Modules\Admin\Repositories\CalendarRepository;
use Modules\Admin\Repositories\CountryInterface;
use Modules\Admin\Repositories\CountryRepository;
use Modules\Admin\Repositories\DepartmentInterface;
use Modules\Admin\Repositories\DepartmentRepository;
use Modules\Admin\Repositories\DesignationInterface;
use Modules\Admin\Repositories\DesignationRepository;
use Modules\Admin\Repositories\DistrictInterface;
use Modules\Admin\Repositories\DistrictRepository;
use Modules\Admin\Repositories\DropdownInterface;
use Modules\Admin\Repositories\DropdownRepository;
use Modules\Admin\Repositories\FieldInterface;
use Modules\Admin\Repositories\FieldRepository;
use Modules\Admin\Repositories\MunicipalityInterface;
use Modules\Admin\Repositories\MunicipalityRepository;
use Modules\Admin\Repositories\ProvinceInterface;
use Modules\Admin\Repositories\ProvinceRepository;
use Modules\Admin\Repositories\SettingInterface;
use Modules\Admin\Repositories\SettingRepository;
class AdminServiceProvider extends ServiceProvider
{
protected string $moduleName = 'Admin';
protected string $moduleNameLower = 'admin';
/**
* 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(SettingInterface::class, SettingRepository::class);
$this->app->bind(FieldInterface::class, FieldRepository::class);
$this->app->bind(DropdownInterface::class, DropdownRepository::class);
$this->app->bind(CountryInterface::class, CountryRepository::class);
$this->app->bind(ProvinceInterface::class, ProvinceRepository::class);
$this->app->bind(DistrictInterface::class, DistrictRepository::class);
$this->app->bind(MunicipalityInterface::class, MunicipalityRepository::class);
$this->app->bind(DepartmentInterface::class, DepartmentRepository::class);
$this->app->bind(DesignationInterface::class, DesignationRepository::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;
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace Modules\Admin\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('Admin', '/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('Admin', '/routes/api.php'));
}
}

View File

View File

@@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Calendar;
class CalendarRepository implements CalendarInterface
{
public function findAll()
{
return Calendar::get();
}
public function getCalendarById($CalendarId)
{
return Calendar::findOrFail($CalendarId);
}
public function delete($CalendarId)
{
Calendar::destroy($CalendarId);
}
public function create(array $CalendarDetails)
{
return Calendar::create($CalendarDetails);
}
public function update($CalendarId, array $newDetails)
{
return Calendar::where('id', $CalendarId)->update($newDetails);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface CityInterface
{
public function findAll();
public function getCityById($cityId);
public function delete($cityId);
public function create(array $cityDetails);
public function update($cityId, array $newDetails);
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\City;
class CityRepository implements CityInterface
{
public function findAll()
{
return City::get();
}
public function getCityById($cityId)
{
return City::findOrFail($cityId);
}
public function delete($cityId)
{
City::destroy($cityId);
}
public function create(array $cityDetails)
{
return City::create($cityDetails);
}
public function update($cityId, array $newDetails)
{
return City::where('id', $cityId)->update($newDetails);
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Modules\Admin\Repositories;
interface CountryInterface
{
public function findAll();
public function getCountryById($countryId);
public function delete($countryId);
public function create(array $countryDetails);
public function update($countryId, array $newDetails);
public function pluck();
}

View File

@@ -0,0 +1,39 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Country;
class CountryRepository implements CountryInterface
{
public function findAll()
{
return Country::get();
}
public function getCountryById($countryId)
{
return Country::findOrFail($countryId);
}
public function delete($countryId)
{
Country::destroy($countryId);
}
public function create(array $countryDetails)
{
return Country::create($countryDetails);
}
public function update($countryId, array $newDetails)
{
return Country::where('id', $countryId)->update($newDetails);
}
public function pluck(){
return Country::pluck('name','id');
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Modules\Admin\Repositories;
interface DepartmentInterface
{
public function pluck();
public function findAll();
public function getDepartmentById($departmentId);
public function delete($departmentId);
public function create(array $departmentDetails);
public function update($departmentId, array $newDetails);
}

View File

@@ -0,0 +1,46 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Department;
class DepartmentRepository implements DepartmentInterface
{
protected $model;
public function __construct(Department $model)
{
$this->model = $model;
}
public function findAll()
{
return Department::get();
}
public function getDepartmentById($departmentId)
{
return Department::findOrFail($departmentId);
}
public function delete($departmentId)
{
Department::destroy($departmentId);
}
public function create(array $departmentDetails)
{
return Department::create($departmentDetails);
}
public function update($departmentId, array $newDetails)
{
return Department::where('department_id', $departmentId)->update($newDetails);
}
public function pluck(){
return Department::pluck('name','id');
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Modules\Admin\Repositories;
interface DesignationInterface
{
public function findAll();
public function getDesignationById($designationId);
public function delete($designationId);
public function create(array $designationDetails);
public function update($designationId, array $newDetails);
public function pluck();
}

View File

@@ -0,0 +1,39 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Designation;
class DesignationRepository implements DesignationInterface
{
public function findAll()
{
return Designation::get();
}
public function getDesignationById($designationId)
{
return Designation::findOrFail($designationId);
}
public function delete($designationId)
{
Designation::destroy($designationId);
}
public function create(array $designationDetails)
{
return Designation::create($designationDetails);
}
public function update($designationId, array $newDetails)
{
return Designation::where('designation_id', $designationId)->update($newDetails);
}
public function pluck(){
return Designation::pluck('name','id');
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Modules\Admin\Repositories;
interface DistrictInterface
{
public function findAll();
public function getDistrictById($districtId);
public function delete($districtId);
public function create(array $districtDetails);
public function update($districtId, array $newDetails);
public function pluck();
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\District;
class DistrictRepository implements DistrictInterface
{
public function findAll()
{
return District::get();
}
public function getDistrictById($districtId)
{
return District::findOrFail($districtId);
}
public function delete($districtId)
{
District::destroy($districtId);
}
public function create(array $districtDetails)
{
return District::create($districtDetails);
}
public function update($districtId, array $newDetails)
{
return District::where('id', $districtId)->update($newDetails);
}
public function pluck(){
return District::pluck('name');
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface DropdownInterface
{
public function findAll();
public function getDropdownById($DropdownId);
public function delete($DropdownId);
public function create(array $DropdownDetails);
public function update($DropdownId, array $newDetails);
}

View File

@@ -0,0 +1,34 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Dropdown;
class DropdownRepository implements DropdownInterface
{
public function findAll()
{
return Dropdown::get();
}
public function getDropdownById($DropdownId)
{
return Dropdown::findOrFail($DropdownId);
}
public function delete($DropdownId)
{
Dropdown::destroy($DropdownId);
}
public function create(array $DropdownDetails)
{
return Dropdown::create($DropdownDetails);
}
public function update($DropdownId, array $newDetails)
{
return Dropdown::where('id', $DropdownId)->update($newDetails);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface EventInterface
{
public function findAll();
public function getEventById($eventId);
public function delete($eventId);
public function create(array $eventDetails);
public function update($eventId, array $newDetails);
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Event;
class EventRepository implements EventInterface
{
public function findAll()
{
return Event::get();
}
public function getEventById($EventId)
{
return Event::findOrFail($EventId);
}
public function delete($EventId)
{
Event::destroy($EventId);
}
public function create(array $EventDetails)
{
return Event::create($EventDetails);
}
public function update($EventId, array $newDetails)
{
return Event::where('id', $EventId)->update($newDetails);
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Modules\Admin\Repositories;
interface FieldInterface
{
public function findAll();
public function getFieldById($FieldId);
public function getList();
public function getDropdownByAlias($alias);
public function delete($FieldId);
public function create(array $FieldDetails);
public function update($FieldId, array $newDetails);
}

View File

@@ -0,0 +1,48 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Field;
class FieldRepository implements FieldInterface
{
public function findAll()
{
return Field::get();
}
public function getFieldById($FieldId)
{
return Field::findOrFail($FieldId);
}
public function getList()
{
return Field::pluck('title', 'id');
}
public function getDropdownByAlias($alias)
{
$fieldModel = Field::where("alias", $alias)->first();
if ($fieldModel) {
return $fieldModel->dropdown()->pluck('title', 'id');
}
}
public function delete($FieldId)
{
Field::destroy($FieldId);
}
public function create(array $FieldDetails)
{
return Field::create($FieldDetails);
}
public function update($FieldId, array $newDetails)
{
return Field::where('id', $FieldId)->update($newDetails);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface MunicipalityInterface
{
public function findAll();
public function getMunicipalityById($municipalityId);
public function delete($municipalityId);
public function create(array $municipalityDetails);
public function update($municipalityId, array $newDetails);
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Municipality;
class MunicipalityRepository implements MunicipalityInterface
{
public function findAll()
{
return Municipality::get();
}
public function getMunicipalityById($municipalityId)
{
return Municipality::findOrFail($municipalityId);
}
public function delete($municipalityId)
{
Municipality::destroy($municipalityId);
}
public function create(array $municipalityDetails)
{
return Municipality::create($municipalityDetails);
}
public function update($municipalityId, array $newDetails)
{
return Municipality::where('id', $municipalityId)->update($newDetails);
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Modules\Admin\Repositories;
interface ProvinceInterface
{
public function findAll();
public function getProvinceById($provinceId);
public function delete($provinceId);
public function create(array $provinceDetails);
public function update($provinceId, array $newDetails);
public function pluck();
}

View File

@@ -0,0 +1,39 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Province;
class ProvinceRepository implements ProvinceInterface
{
public function findAll()
{
return Province::get();
}
public function getProvinceById($provinceId)
{
return Province::findOrFail($provinceId);
}
public function delete($provinceId)
{
Province::destroy($provinceId);
}
public function create(array $provinceDetails)
{
return Province::create($provinceDetails);
}
public function update($provinceId, array $newDetails)
{
return Province::where('id', $provinceId)->update($newDetails);
}
public function pluck(){
return Province::pluck('name', 'id');
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace Modules\Admin\Repositories;
use Illuminate\Http\Request;
interface SettingInterface
{
public function findAll();
public function getSettingById($SettingId);
public function getList();
public function delete($SettingId);
public function create(array $SettingDetails, Request $request);
public function update($SettingId, array $newDetails);
}

View File

@@ -0,0 +1,53 @@
<?php
namespace Modules\Admin\Repositories;
use Illuminate\Http\Request;
use Modules\Admin\Models\Setting;
class SettingRepository implements SettingInterface
{
public function findAll()
{
return Setting::get()->mapWithKeys(function ($setting) {
return [$setting->key => $setting->value];
});
}
public function getSettingById($SettingId)
{
return Setting::findOrFail($SettingId);
}
public function getList()
{
return Setting::pluck('title', 'id');
}
public function delete($SettingId)
{
Setting::destroy($SettingId);
}
public function create(array $settingDetails, Request $request)
{
$thumbName = time() . '.' . $request->file('thumb')->extension();
$logoName = uniqid() . '.' . $request->file('logo')->extension();
$request->thumb->move(public_path('images/setting'), $thumbName);
$request->logo->move(public_path('images/setting'), $logoName);
$path = 'images/setting/';
$settingDetails['logo'] = $path . $logoName;
$settingDetails['thumb'] = $path . $thumbName;
// dd($settingDetails);
return Setting::create($settingDetails);
}
public function update($SettingId, $newDetails)
{
$setting = Setting::where('id', $SettingId);
$setting->update($newDetails);
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Modules\Admin\View\Components;
use Illuminate\View\Component;
use Illuminate\View\View;
class MenuComponent extends Component
{
private $menu;
/**
* Create a new component instance.
*/
public function __construct()
{
$this->menu = config('menu');
}
/**
* Get the view/contents that represent the component.
*/
public function render(): View | string
{
return view('admin::components.menucomponent');
}
}

View File

@@ -0,0 +1,30 @@
{
"name": "nwidart/admin",
"description": "",
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart@gmail.com"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\Admin\\": "app/",
"Modules\\Admin\\Database\\Factories\\": "database/factories/",
"Modules\\Admin\\Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Modules\\Admin\\Tests\\": "tests/"
}
}
}

View File

View File

@@ -0,0 +1,5 @@
<?php
return [
'name' => 'Admin',
];

View File

@@ -0,0 +1,34 @@
<?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('holidays', function (Blueprint $table) {
$table->unsignedTinyInteger('holiday_id')->autoIncrement();
$table->string('title')->nullable();
$table->date('start_date')->nullable();
$table->date('end_date')->nullable();
$table->integer('status')->default(11);
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('holidays');
}
};

View File

@@ -0,0 +1,34 @@
<?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('provinces', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('country_id')->nullable();
$table->string('name')->nullable();
$table->integer('status')->default(11);
$table->text('description')->nullable();
$table->text('remarks')->nullable();
$table->unsignedInteger('createdby')->nullable();
$table->unsignedInteger('updatedby')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('provinces');
}
};

View File

@@ -0,0 +1,34 @@
<?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('cities', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('district_id')->nullable();
$table->string('name')->nullable();
$table->integer('status')->default(11);
$table->text('description')->nullable();
$table->text('remarks')->nullable();
$table->unsignedBigInteger('createdby')->nullable();
$table->unsignedBigInteger('updatedby')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cities');
}
};

View File

@@ -0,0 +1,34 @@
<?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('districts', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('province_id')->nullable();
$table->string('name')->nullable();
$table->integer('status')->default(11);
$table->text('description')->nullable();
$table->text('remarks')->nullable();
$table->unsignedBigInteger('createdby')->nullable();
$table->unsignedBigInteger('updatedby')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('districts');
}
};

View File

@@ -0,0 +1,34 @@
<?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('municipalities', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('district_id')->nullable();
$table->string('name')->nullable();
$table->integer('status')->default(11);
$table->text('description')->nullable();
$table->text('remarks')->nullable();
$table->unsignedBigInteger('createdby')->nullable();
$table->unsignedBigInteger('updatedby')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('municipalities');
}
};

View File

@@ -0,0 +1,30 @@
<?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('fields', function (Blueprint $table) {
$table->id();
$table->string('title')->nullable();
$table->string('alias')->nullable();
$table->integer('status')->default(11);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('fields');
}
};

View File

@@ -0,0 +1,31 @@
<?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('dropdowns', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('fid')->nullable();
$table->string('title')->nullable();
$table->string('alias')->nullable();
$table->integer('status')->default(11);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('dropdowns');
}
};

View File

View File

@@ -0,0 +1,22 @@
<?php
namespace Modules\Admin\Database\Seeders;
use Illuminate\Database\Seeder;
class AdminDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$this->call([
CountryDatabaseSeeder::class,
ProvinceDatabaseSeeder::class,
DistrictDatabaseSeeder::class,
MunicipalityDatabaseSeeder::class,
DropdownSeeder::class,
]);
}
}

View File

@@ -0,0 +1,265 @@
<?php
namespace Modules\Admin\Database\Seeders;
use Illuminate\Database\Seeder;
use Modules\CCMS\Models\Country;
class CountryDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$countries = [
['code' => 'US', 'title' => 'United States'],
['code' => 'CA', 'title' => 'Canada'],
['code' => 'AF', 'title' => 'Afghanistan'],
['code' => 'AL', 'title' => 'Albania'],
['code' => 'DZ', 'title' => 'Algeria'],
['code' => 'AS', 'title' => 'American Samoa'],
['code' => 'AD', 'title' => 'Andorra'],
['code' => 'AO', 'title' => 'Angola'],
['code' => 'AI', 'title' => 'Anguilla'],
['code' => 'AQ', 'title' => 'Antarctica'],
['code' => 'AG', 'title' => 'Antigua and/or Barbuda'],
['code' => 'AR', 'title' => 'Argentina'],
['code' => 'AM', 'title' => 'Armenia'],
['code' => 'AW', 'title' => 'Aruba'],
['code' => 'AU', 'title' => 'Australia'],
['code' => 'AT', 'title' => 'Austria'],
['code' => 'AZ', 'title' => 'Azerbaijan'],
['code' => 'BS', 'title' => 'Bahamas'],
['code' => 'BH', 'title' => 'Bahrain'],
['code' => 'BD', 'title' => 'Bangladesh'],
['code' => 'BB', 'title' => 'Barbados'],
['code' => 'BY', 'title' => 'Belarus'],
['code' => 'BE', 'title' => 'Belgium'],
['code' => 'BZ', 'title' => 'Belize'],
['code' => 'BJ', 'title' => 'Benin'],
['code' => 'BM', 'title' => 'Bermuda'],
['code' => 'BT', 'title' => 'Bhutan'],
['code' => 'BO', 'title' => 'Bolivia'],
['code' => 'BA', 'title' => 'Bosnia and Herzegovina'],
['code' => 'BW', 'title' => 'Botswana'],
['code' => 'BV', 'title' => 'Bouvet Island'],
['code' => 'BR', 'title' => 'Brazil'],
['code' => 'IO', 'title' => 'British lndian Ocean Territory'],
['code' => 'BN', 'title' => 'Brunei Darussalam'],
['code' => 'BG', 'title' => 'Bulgaria'],
['code' => 'BF', 'title' => 'Burkina Faso'],
['code' => 'BI', 'title' => 'Burundi'],
['code' => 'KH', 'title' => 'Cambodia'],
['code' => 'CM', 'title' => 'Cameroon'],
['code' => 'CV', 'title' => 'Cape Verde'],
['code' => 'KY', 'title' => 'Cayman Islands'],
['code' => 'CF', 'title' => 'Central African Republic'],
['code' => 'TD', 'title' => 'Chad'],
['code' => 'CL', 'title' => 'Chile'],
['code' => 'CN', 'title' => 'China'],
['code' => 'CX', 'title' => 'Christmas Island'],
['code' => 'CC', 'title' => 'Cocos (Keeling) Islands'],
['code' => 'CO', 'title' => 'Colombia'],
['code' => 'KM', 'title' => 'Comoros'],
['code' => 'CG', 'title' => 'Congo'],
['code' => 'CK', 'title' => 'Cook Islands'],
['code' => 'CR', 'title' => 'Costa Rica'],
['code' => 'HR', 'title' => 'Croatia (Hrvatska)'],
['code' => 'CU', 'title' => 'Cuba'],
['code' => 'CY', 'title' => 'Cyprus'],
['code' => 'CZ', 'title' => 'Czech Republic'],
['code' => 'CD', 'title' => 'Democratic Republic of Congo'],
['code' => 'DK', 'title' => 'Denmark'],
['code' => 'DJ', 'title' => 'Djibouti'],
['code' => 'DM', 'title' => 'Dominica'],
['code' => 'DO', 'title' => 'Dominican Republic'],
['code' => 'TP', 'title' => 'East Timor'],
['code' => 'EC', 'title' => 'Ecudaor'],
['code' => 'EG', 'title' => 'Egypt'],
['code' => 'SV', 'title' => 'El Salvador'],
['code' => 'GQ', 'title' => 'Equatorial Guinea'],
['code' => 'ER', 'title' => 'Eritrea'],
['code' => 'EE', 'title' => 'Estonia'],
['code' => 'ET', 'title' => 'Ethiopia'],
['code' => 'FK', 'title' => 'Falkland Islands (Malvinas)'],
['code' => 'FO', 'title' => 'Faroe Islands'],
['code' => 'FJ', 'title' => 'Fiji'],
['code' => 'FI', 'title' => 'Finland'],
['code' => 'FR', 'title' => 'France'],
['code' => 'FX', 'title' => 'France, Metropolitan'],
['code' => 'GF', 'title' => 'French Guiana'],
['code' => 'PF', 'title' => 'French Polynesia'],
['code' => 'TF', 'title' => 'French Southern Territories'],
['code' => 'GA', 'title' => 'Gabon'],
['code' => 'GM', 'title' => 'Gambia'],
['code' => 'GE', 'title' => 'Georgia'],
['code' => 'DE', 'title' => 'Germany'],
['code' => 'GH', 'title' => 'Ghana'],
['code' => 'GI', 'title' => 'Gibraltar'],
['code' => 'GR', 'title' => 'Greece'],
['code' => 'GL', 'title' => 'Greenland'],
['code' => 'GD', 'title' => 'Grenada'],
['code' => 'GP', 'title' => 'Guadeloupe'],
['code' => 'GU', 'title' => 'Guam'],
['code' => 'GT', 'title' => 'Guatemala'],
['code' => 'GN', 'title' => 'Guinea'],
['code' => 'GW', 'title' => 'Guinea-Bissau'],
['code' => 'GY', 'title' => 'Guyana'],
['code' => 'HT', 'title' => 'Haiti'],
['code' => 'HM', 'title' => 'Heard and Mc Donald Islands'],
['code' => 'HN', 'title' => 'Honduras'],
['code' => 'HK', 'title' => 'Hong Kong'],
['code' => 'HU', 'title' => 'Hungary'],
['code' => 'IS', 'title' => 'Iceland'],
['code' => 'IN', 'title' => 'India'],
['code' => 'ID', 'title' => 'Indonesia'],
['code' => 'IR', 'title' => 'Iran (Islamic Republic of)'],
['code' => 'IQ', 'title' => 'Iraq'],
['code' => 'IE', 'title' => 'Ireland'],
['code' => 'IL', 'title' => 'Israel'],
['code' => 'IT', 'title' => 'Italy'],
['code' => 'CI', 'title' => 'Ivory Coast'],
['code' => 'JM', 'title' => 'Jamaica'],
['code' => 'JP', 'title' => 'Japan'],
['code' => 'JO', 'title' => 'Jordan'],
['code' => 'KZ', 'title' => 'Kazakhstan'],
['code' => 'KE', 'title' => 'Kenya'],
['code' => 'KI', 'title' => 'Kiribati'],
['code' => 'KP', 'title' => 'Korea, Democratic People\'s Republic of'],
['code' => 'KR', 'title' => 'Korea, Republic of'],
['code' => 'KW', 'title' => 'Kuwait'],
['code' => 'KG', 'title' => 'Kyrgyzstan'],
['code' => 'LA', 'title' => 'Lao People\'s Democratic Republic'],
['code' => 'LV', 'title' => 'Latvia'],
['code' => 'LB', 'title' => 'Lebanon'],
['code' => 'LS', 'title' => 'Lesotho'],
['code' => 'LR', 'title' => 'Liberia'],
['code' => 'LY', 'title' => 'Libyan Arab Jamahiriya'],
['code' => 'LI', 'title' => 'Liechtenstein'],
['code' => 'LT', 'title' => 'Lithuania'],
['code' => 'LU', 'title' => 'Luxembourg'],
['code' => 'MO', 'title' => 'Macau'],
['code' => 'MK', 'title' => 'Macedonia'],
['code' => 'MG', 'title' => 'Madagascar'],
['code' => 'MW', 'title' => 'Malawi'],
['code' => 'MY', 'title' => 'Malaysia'],
['code' => 'MV', 'title' => 'Maldives'],
['code' => 'ML', 'title' => 'Mali'],
['code' => 'MT', 'title' => 'Malta'],
['code' => 'MH', 'title' => 'Marshall Islands'],
['code' => 'MQ', 'title' => 'Martinique'],
['code' => 'MR', 'title' => 'Mauritania'],
['code' => 'MU', 'title' => 'Mauritius'],
['code' => 'TY', 'title' => 'Mayotte'],
['code' => 'MX', 'title' => 'Mexico'],
['code' => 'FM', 'title' => 'Micronesia, Federated States of'],
['code' => 'MD', 'title' => 'Moldova, Republic of'],
['code' => 'MC', 'title' => 'Monaco'],
['code' => 'MN', 'title' => 'Mongolia'],
['code' => 'MS', 'title' => 'Montserrat'],
['code' => 'MA', 'title' => 'Morocco'],
['code' => 'MZ', 'title' => 'Mozambique'],
['code' => 'MM', 'title' => 'Myanmar'],
['code' => 'NA', 'title' => 'Namibia'],
['code' => 'NR', 'title' => 'Nauru'],
['code' => 'NP', 'title' => 'Nepal'],
['code' => 'NL', 'title' => 'Netherlands'],
['code' => 'AN', 'title' => 'Netherlands Antilles'],
['code' => 'NC', 'title' => 'New Caledonia'],
['code' => 'NZ', 'title' => 'New Zealand'],
['code' => 'NI', 'title' => 'Nicaragua'],
['code' => 'NE', 'title' => 'Niger'],
['code' => 'NG', 'title' => 'Nigeria'],
['code' => 'NU', 'title' => 'Niue'],
['code' => 'NF', 'title' => 'Norfork Island'],
['code' => 'MP', 'title' => 'Northern Mariana Islands'],
['code' => 'NO', 'title' => 'Norway'],
['code' => 'OM', 'title' => 'Oman'],
['code' => 'PK', 'title' => 'Pakistan'],
['code' => 'PW', 'title' => 'Palau'],
['code' => 'PA', 'title' => 'Panama'],
['code' => 'PG', 'title' => 'Papua New Guinea'],
['code' => 'PY', 'title' => 'Paraguay'],
['code' => 'PE', 'title' => 'Peru'],
['code' => 'PH', 'title' => 'Philippines'],
['code' => 'PN', 'title' => 'Pitcairn'],
['code' => 'PL', 'title' => 'Poland'],
['code' => 'PT', 'title' => 'Portugal'],
['code' => 'PR', 'title' => 'Puerto Rico'],
['code' => 'QA', 'title' => 'Qatar'],
['code' => 'SS', 'title' => 'Republic of South Sudan'],
['code' => 'RE', 'title' => 'Reunion'],
['code' => 'RO', 'title' => 'Romania'],
['code' => 'RU', 'title' => 'Russian Federation'],
['code' => 'RW', 'title' => 'Rwanda'],
['code' => 'KN', 'title' => 'Saint Kitts and Nevis'],
['code' => 'LC', 'title' => 'Saint Lucia'],
['code' => 'VC', 'title' => 'Saint Vincent and the Grenadines'],
['code' => 'WS', 'title' => 'Samoa'],
['code' => 'SM', 'title' => 'San Marino'],
['code' => 'ST', 'title' => 'Sao Tome and Principe'],
['code' => 'SA', 'title' => 'Saudi Arabia'],
['code' => 'SN', 'title' => 'Senegal'],
['code' => 'RS', 'title' => 'Serbia'],
['code' => 'SC', 'title' => 'Seychelles'],
['code' => 'SL', 'title' => 'Sierra Leone'],
['code' => 'SG', 'title' => 'Singapore'],
['code' => 'SK', 'title' => 'Slovakia'],
['code' => 'SI', 'title' => 'Slovenia'],
['code' => 'SB', 'title' => 'Solomon Islands'],
['code' => 'SO', 'title' => 'Somalia'],
['code' => 'ZA', 'title' => 'South Africa'],
['code' => 'GS', 'title' => 'South Georgia South Sandwich Islands'],
['code' => 'ES', 'title' => 'Spain'],
['code' => 'LK', 'title' => 'Sri Lanka'],
['code' => 'SH', 'title' => 'St. Helena'],
['code' => 'PM', 'title' => 'St. Pierre and Miquelon'],
['code' => 'SD', 'title' => 'Sudan'],
['code' => 'SR', 'title' => 'Surititle'],
['code' => 'SJ', 'title' => 'Svalbarn and Jan Mayen Islands'],
['code' => 'SZ', 'title' => 'Swaziland'],
['code' => 'SE', 'title' => 'Sweden'],
['code' => 'CH', 'title' => 'Switzerland'],
['code' => 'SY', 'title' => 'Syrian Arab Republic'],
['code' => 'TW', 'title' => 'Taiwan'],
['code' => 'TJ', 'title' => 'Tajikistan'],
['code' => 'TZ', 'title' => 'Tanzania, United Republic of'],
['code' => 'TH', 'title' => 'Thailand'],
['code' => 'TG', 'title' => 'Togo'],
['code' => 'TK', 'title' => 'Tokelau'],
['code' => 'TO', 'title' => 'Tonga'],
['code' => 'TT', 'title' => 'Trinidad and Tobago'],
['code' => 'TN', 'title' => 'Tunisia'],
['code' => 'TR', 'title' => 'Turkey'],
['code' => 'TM', 'title' => 'Turkmenistan'],
['code' => 'TC', 'title' => 'Turks and Caicos Islands'],
['code' => 'TV', 'title' => 'Tuvalu'],
['code' => 'UG', 'title' => 'Uganda'],
['code' => 'UA', 'title' => 'Ukraine'],
['code' => 'AE', 'title' => 'United Arab Emirates'],
['code' => 'GB', 'title' => 'United Kingdom'],
['code' => 'UM', 'title' => 'United States minor outlying islands'],
['code' => 'UY', 'title' => 'Uruguay'],
['code' => 'UZ', 'title' => 'Uzbekistan'],
['code' => 'VU', 'title' => 'Vanuatu'],
['code' => 'VA', 'title' => 'Vatican City State'],
['code' => 'VE', 'title' => 'Venezuela'],
['code' => 'VN', 'title' => 'Vietnam'],
['code' => 'VG', 'title' => 'Virgin Islands (British)'],
['code' => 'VI', 'title' => 'Virgin Islands (U.S.)'],
['code' => 'WF', 'title' => 'Wallis and Futuna Islands'],
['code' => 'EH', 'title' => 'Western Sahara'],
['code' => 'YE', 'title' => 'Yemen'],
['code' => 'YU', 'title' => 'Yugoslavia'],
['code' => 'ZR', 'title' => 'Zaire'],
['code' => 'ZM', 'title' => 'Zambia'],
['code' => 'ZW', 'title' => 'Zimbabwe'],
];
Country::updateOrCreate(
['title' => $countries['title']],
$countries
);
}
}

View File

@@ -0,0 +1,98 @@
<?php
namespace Modules\Admin\Database\Seeders;
use Illuminate\Database\Seeder;
use Modules\Admin\Models\District;
class DistrictDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$districts = [
['name' => 'Bhojpur', 'province_id' => 1],
['name' => 'Dhankuta', 'province_id' => 1],
['name' => 'Ilam', 'province_id' => 1],
['name' => 'Jhapa', 'province_id' => 1],
['name' => 'Khotang', 'province_id' => 1],
['name' => 'Morang', 'province_id' => 1],
['name' => 'Okhaldhunga', 'province_id' => 1],
['name' => 'Panchthar', 'province_id' => 1],
['name' => 'Sankhuwasabha', 'province_id' => 1],
['name' => 'Solukhumbu', 'province_id' => 1],
['name' => 'Sunsari', 'province_id' => 1],
['name' => 'Taplejung', 'province_id' => 1],
['name' => 'Terhathum', 'province_id' => 1],
['name' => 'Udayapur', 'province_id' => 1],
['name' => 'Saptari', 'province_id' => 2],
['name' => 'Siraha', 'province_id' => 2],
['name' => 'Dhanusha', 'province_id' => 2],
['name' => 'Mahottari', 'province_id' => 2],
['name' => 'Sarlahi', 'province_id' => 2],
['name' => 'Bara', 'province_id' => 2],
['name' => 'Parsa', 'province_id' => 2],
['name' => 'Rautahat', 'province_id' => 2],
['name' => 'Sindhuli', 'province_id' => 3],
['name' => 'Ramechhap', 'province_id' => 3],
['name' => 'Dolakha', 'province_id' => 3],
['name' => 'Bhaktapur', 'province_id' => 3],
['name' => 'Dhading', 'province_id' => 3],
['name' => 'Kathmandu', 'province_id' => 3],
['name' => 'Kavrepalanchowk', 'province_id' => 3],
['name' => 'Lalitpur', 'province_id' => 3],
['name' => 'Nuwakot', 'province_id' => 3],
['name' => 'Rasuwa', 'province_id' => 3],
['name' => 'Sindhupalchok', 'province_id' => 3],
['name' => 'Chitwan', 'province_id' => 3],
['name' => 'Makwanpur', 'province_id' => 3],
['name' => 'Baglung', 'province_id' => 4],
['name' => 'Gorkha', 'province_id' => 4],
['name' => 'Kaski', 'province_id' => 4],
['name' => 'Lamjung', 'province_id' => 4],
['name' => 'Manang', 'province_id' => 4],
['name' => 'Mustang', 'province_id' => 4],
['name' => 'Myagdi', 'province_id' => 4],
['name' => 'Nawalpur', 'province_id' => 4],
['name' => 'Parbat', 'province_id' => 4],
['name' => 'Syangja', 'province_id' => 4],
['name' => 'Tanahun', 'province_id' => 4],
['name' => 'Kapilvastu', 'province_id' => 5],
['name' => 'Parasi', 'province_id' => 5],
['name' => 'Rupandehi', 'province_id' => 5],
['name' => 'Arghakhanchi', 'province_id' => 5],
['name' => 'Gulmi', 'province_id' => 5],
['name' => 'Palpa', 'province_id' => 5],
['name' => 'Dang', 'province_id' => 5],
['name' => 'Pyuthan', 'province_id' => 5],
['name' => 'Rolpa', 'province_id' => 5],
['name' => 'Rukum', 'province_id' => 5],
['name' => 'Banke', 'province_id' => 5],
['name' => 'Bardiya', 'province_id' => 5],
['name' => 'Rukum', 'province_id' => 6],
['name' => 'Salyan', 'province_id' => 6],
['name' => 'Dolpa', 'province_id' => 6],
['name' => 'Humla', 'province_id' => 6],
['name' => 'Jumla', 'province_id' => 6],
['name' => 'Kalikot', 'province_id' => 6],
['name' => 'Mugu', 'province_id' => 6],
['name' => 'Surkhet', 'province_id' => 6],
['name' => 'Dailekh', 'province_id' => 6],
['name' => 'Jajarkot', 'province_id' => 6],
['name' => 'Kailali', 'province_id' => 7],
['name' => 'Achham', 'province_id' => 7],
['name' => 'Doti', 'province_id' => 7],
['name' => 'Bajhang', 'province_id' => 7],
['name' => 'Bajura', 'province_id' => 7],
['name' => 'Kanchanpur', 'province_id' => 7],
['name' => 'Dadeldhura', 'province_id' => 7],
['name' => 'Baitadi', 'province_id' => 7],
['name' => 'Darchula', 'province_id' => 7],
];
District::insert($districts);
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Modules\Admin\Database\Seeders;
use Illuminate\Database\Seeder;
use Modules\Admin\Models\Dropdown;
use Modules\Admin\Models\Field;
class DropdownSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $inputArr = [
// 'Nationality' => ['Nepali', 'Others'],
// ];
// foreach ($inputArr as $key => $value) {
// $fieldModel = Field::updateOrCreate(['title' => $key], [
// 'title' => $key,
// ]);
// if ($fieldModel) {
// foreach ($value as $k => $v) {
// Dropdown::updateOrCreate(['title' => $v,
// 'fid' => $fieldModel->id], [
// 'title' => $v,
// 'fid' => $fieldModel->id,
// ]);
// }
// }
// }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
<?php
namespace Modules\Admin\Database\Seeders;
use Illuminate\Database\Seeder;
use Modules\Admin\Models\Province;
class ProvinceDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$provinces = [
['name' => 'Koshi', 'country_id' => 151],
['name' => 'Madesh', 'country_id' => 151],
['name' => 'Bagmati', 'country_id' => 151],
['name' => 'Gandaki', 'country_id' => 151],
['name' => 'Lumbini', 'country_id' => 151],
['name' => 'Karnali', 'country_id' => 151],
['name' => 'Sudurpaschim', 'country_id' => 151],
];
Province::insert($provinces);
}
}

11
Modules/Admin/module.json Normal file
View File

@@ -0,0 +1,11 @@
{
"name": "Admin",
"alias": "admin",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Admin\\Providers\\AdminServiceProvider"
],
"files": []
}

View 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"
}
}

View File

View File

View File

View File

@@ -0,0 +1,569 @@
@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 -->
<div class="row">
<div class="col-12">
<div class="row">
<div class="col-xl-3">
<div class="card" style="height: 30%">
<div class="card-header align-items-center d-flex">
<h4 class="card-title flex-grow-1 mb-0">Content Schedule</h4>
</div><!-- end card header -->
<div class="card-body p-0">
<div data-simplebar="init" style="max-height: 200px;" class="simplebar-scrollable-y">
<div class="simplebar-wrapper" style="margin: 0px;">
<div class="simplebar-height-auto-observer-wrapper">
<div class="simplebar-height-auto-observer"></div>
</div>
<div class="simplebar-mask">
<div class="simplebar-offset" style="right: 0px; bottom: 0px;">
<div class="simplebar-content-wrapper" tabindex="0" role="region"
aria-label="scrollable content"
style="height: auto; overflow: hidden scroll;">
<div class="simplebar-content" style="padding: 0px;">
<ul class="list-group list-group-flush border-dashed px-3">
@forelse ($contents as $content)
<li class="list-group-item ps-0">
<a href="javascript:void(0)"
class="content-edit-btn"
data-link="{{ route('content.partials.edit', $content->id) }}"
data-bs-toggle="modal"
data-bs-target="#contentModal">
<div class="d-flex mb-3">
<div class="flex-grow-1"><i
class="mdi mdi-checkbox-blank-circle text-success me-2"></i><span
class="fw-medium">{{ $content->release_date?->format('d M, Y') }}</span>
</div>
<div class="flex-shrink-0"><small
class="badge bg-primary-subtle text-primary ms-auto">{{ $content->release_time?->format('h:i A') }}</small>
</div>
</div>
<h6 class="card-title fs-12">
{{ $content->title }}
</h6>
</a>
</li>
@empty
<h6 class="text-dark my-5 text-center">No upcoming
schedule</h6>
@endforelse
</ul>
</div>
</div>
</div>
</div>
<div class="simplebar-placeholder" style="width: 655px; height: 268px;"></div>
</div>
<div class="simplebar-track simplebar-horizontal" style="visibility: hidden;">
<div class="simplebar-scrollbar" style="width: 0px; display: none;"></div>
</div>
<div class="simplebar-track simplebar-vertical" style="visibility: visible;">
<div class="simplebar-scrollbar"
style="height: 178px; transform: translate3d(0px, 41px, 0px); display: block;">
</div>
</div>
</div>
</div>
<!-- end card body -->
</div>
<div class="card" style="height: 30%">
<div class="card-header align-items-center d-flex">
<h4 class="card-title flex-grow-1 mb-0">Events</h4>
<div class="flex-shrink-0">
<button type="button" class="btn btn-sm btn-primary" data-bs-toggle="modal"
data-bs-target="#eventModal">
<i class="ri-add-line me-1 align-middle"></i>
Add Event</button>
</div>
</div><!-- end card header -->
<div class="card-body p-0">
<div data-simplebar="init" style="max-height: 200px;" class="simplebar-scrollable-y">
<div class="simplebar-wrapper" style="margin: 0px;">
<div class="simplebar-height-auto-observer-wrapper">
<div class="simplebar-height-auto-observer"></div>
</div>
<div class="simplebar-mask">
<div class="simplebar-offset" style="right: 0px; bottom: 0px;">
<div class="simplebar-content-wrapper" tabindex="0" role="region"
aria-label="scrollable content"
style="height: auto; overflow: hidden scroll;">
<div class="simplebar-content" style="padding: 0px;">
<ul class="list-group list-group-flush border-dashed px-3">
@foreach ($events as $event)
<li class="list-group-item ps-0">
<div class="d-flex mb-3">
<div class="flex-grow-1"><i
class="mdi mdi-checkbox-blank-circle text-primary me-2"></i><span
class="fw-medium">{{ $event->start_date?->format('d M, Y') }}
@if ($event->end_date)
<span>to
{{ $event->end_date?->format('d M, Y') }}</span>
@endif
</span>
</div>
<div class="flex-shrink-0"><small
class="badge bg-primary-subtle text-primary ms-auto">{{ $event->start_time?->format('h:i A') }}</small>
</div>
</div>
<h6 class="card-title fs-12">{{ $event->title }}
</h6>
</li>
@endforeach
</ul>
</div>
</div>
</div>
</div>
<div class="simplebar-placeholder" style="width: 655px; height: 350px;"></div>
</div>
<div class="simplebar-track simplebar-horizontal" style="visibility: hidden;">
<div class="simplebar-scrollbar" style="width: 0px; display: none;"></div>
</div>
<div class="simplebar-track simplebar-vertical" style="visibility: visible;">
<div class="simplebar-scrollbar"
style="height: 178px; transform: translate3d(0px, 41px, 0px); display: block;">
</div>
</div>
</div>
</div><!-- end card body -->
</div>
<div class="card" style="height: 30%">
<div class="card-header align-items-center d-flex">
<h4 class="card-title flex-grow-1 mb-0">Meetings</h4>
<div class="flex-shrink-0">
<button type="button" class="btn btn-sm btn-warning" data-bs-toggle="modal"
data-bs-target="#meetingModal"><i class="ri-add-line me-1 align-middle"></i>
Add Meeting</button>
</div>
</div><!-- end card header -->
<div class="card-body p-0">
<div data-simplebar="init" style="max-height: 200px;" class="simplebar-scrollable-y">
<div class="simplebar-wrapper" style="margin: 0px;">
<div class="simplebar-height-auto-observer-wrapper">
<div class="simplebar-height-auto-observer"></div>
</div>
<div class="simplebar-mask">
<div class="simplebar-offset" style="right: 0px; bottom: 0px;">
<div class="simplebar-content-wrapper" tabindex="0" role="region"
aria-label="scrollable content"
style="height: auto; overflow: hidden scroll;">
<div class="simplebar-content" style="padding: 0px;">
<ul class="list-group list-group-flush border-dashed px-3">
@foreach ($meetings as $meeting)
<li class="list-group-item ps-0">
<div class="d-flex mb-3">
<div class="flex-grow-1"><i
class="mdi mdi-checkbox-blank-circle text-warning me-2"></i><span
class="fw-medium">{{ $meeting->date?->format('d M, Y') }}</span>
</div>
<div class="flex-shrink-0"><small
class="badge bg-primary-subtle text-primary ms-auto">{{ $meeting->start_time?->format('h:i A') }}</small>
</div>
</div>
<h6 class="card-title fs-12">{{ $meeting->title }}
</h6>
</li>
@endforeach
</ul>
</div>
</div>
</div>
</div>
<div class="simplebar-placeholder" style="width: 655px; height: 268px;"></div>
</div>
<div class="simplebar-track simplebar-horizontal" style="visibility: hidden;">
<div class="simplebar-scrollbar" style="width: 0px; display: none;"></div>
</div>
<div class="simplebar-track simplebar-vertical" style="visibility: visible;">
<div class="simplebar-scrollbar"
style="height: 178px; transform: translate3d(0px, 41px, 0px); display: block;">
</div>
</div>
</div>
</div>
<!-- end card body -->
</div>
</div>
<!-- end col-->
<div class="col-xl-9">
<div class="card">
<div class="card-header border-bottom-dashed">
<div class="d-flex align-items-center">
<div class="flex-grow-1">
<h6 class="card-title mb-0">Filter</h6>
</div>
<div class="flex-shrink-0">
<ul class="list-inline card-toolbar-menu d-flex align-items-center mb-0">
<li class="list-inline-item">
<a class="minimize-card align-middle" data-bs-toggle="collapse"
href="#collapseExample2" role="button" aria-expanded="false"
aria-controls="collapseExample2">
<i class="mdi mdi-plus plus align-middle"></i>
<i class="mdi mdi-minus minus align-middle"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
<div @class(['card-body collapse', 'show' => request()->has('product_id')]) id="collapseExample2">
{{ html()->form('GET')->id('filter-form')->open() }}
<div class="row justify-content-between align-items-center">
<div class="col-md-4">
{{ html()->select('product_id', $productOptions, request('product_id'))->placeholder('By Product')->value(request('product_id'))->class('form-control select2') }}
</div>
<div class="col-md-4">
<div class="d-flex list-grid-nav hstack mt-2 gap-1">
<button type="submit" class="btn btn-sm btn-success">Filter</button>
<a href="{{ route(Route::currentRouteName()) }}"
class="btn btn-danger btn-sm reset-filter">Reset</a>
</div>
</div>
</div>
{{ html()->form()->close() }}
</div>
</div>
<div class="card card-h-100">
<div class="card-body">
<div id="calendar"></div>
</div>
</div>
</div><!-- end col -->
</div>
<!--end row-->
</div>
</div> <!-- end row-->
</div>
</div>
<div id="viewModal" class="modal fade" tabindex="-1" aria-labelledby="viewModalLabel" aria-hidden="true"
style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<p class="modal-title" id="viewModalLabel">Detail</p>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="eventModal" class="modal fade" tabindex="-1" aria-labelledby="eventModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<p class="modal-title" id="viewModalLabel">Event Form</p>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"> </button>
</div>
<div class="modal-body">
{{ html()->form('POST')->route('event.store')->class(['needs-validation eventForm'])->attributes(['novalidate'])->open() }}
@include('admin::calendar.partials.event-form')
{{ html()->form()->close() }}
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="contentModal" class="modal fade" tabindex="-1" aria-labelledby="contentModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<p class="modal-title" id="viewModalLabel">Schedule Update Form</p>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="js-content-partial-target">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div id="meetingModal" class="modal fade" tabindex="-1" aria-labelledby="meetingModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="viewModalLabel">Meeting Form</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"> </button>
</div>
<div class="modal-body">
{{ html()->form('POST')->route('meeting.store')->class(['needs-validation meetingForm'])->attributes(['novalidate'])->open() }}
@include('admin::calendar.partials.meeting-form')
{{ html()->form()->close() }}
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.11/index.global.min.js'></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
var currentDate = new Date().toISOString().split('T')[0];
var calendar = new FullCalendar.Calendar(calendarEl, {
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth'
},
initialDate: currentDate,
navLinks: true, // can click day/week names to navigate views
businessHours: true, // display business hours
editable: false,
selectable: false,
dayMaxEvents: true,
events: {
url: `${base_url}/admin/calendarByAjax`,
method: 'GET',
extraParams: function() {
return {
product_id: $('#filter-form #product_id').val()
};
}
},
selectMirror: true,
select: function(arg) {
var title = prompt('Event Title:');
if (title) {
calendar.addEvent({
title: title,
start: arg.start,
end: arg.end,
allDay: arg.allDay
})
}
calendar.unselect()
},
eventClick: function(arg) {
if (arg.event.extendedProps.type == 'content schedule') {
$('#contentModal').modal('show');
const url = "{{ route('content.partials.edit', ':id') }}".replace(':id', arg.event.id);
let target = document.querySelector('#js-content-partial-target');
target.innerHTML = "<h5 class='text-center my-5'>Loading...</h5>";
fetch(url)
.then(response => response.text())
.then(html => {
target.innerHTML = html;
});
} else {
let html = `<tr class="mb-1">`;
html += `<td class="text-bold">Title: </td>`;
html += `<td>${arg.event.title}</td>`;
html += `</tr>`;
html += `<tr class="mb-1">`;
html += `<td class="text-bold">Type: </td>`;
html += `<td>${arg.event.extendedProps.type}</td>`;
html += `</tr>`;
html += `<tr class="mb-1">`;
html += `<td class="text-bold">Start: </td>`;
html += `<td>${new Date(arg.event.start).toLocaleString()}</td>`;
html += `</tr>`;
if (arg.event.end) {
html += `<tr class="mb-1">`;
html += `<td class="text-bold">End: </td>`;
html += `<td>${new Date(arg.event.end).toLocaleString()}</td>`;
html += `</tr>`;
}
html += `<tr>`;
html += `<td class="text-bold">Location: </td>`;
html += `<td>${arg.event.extendedProps.location ?? 'No Location'}</td>`;
html += `</tr>`;
html += `<tr class="mb-1">`;
html += `<td class="text-bold">Description: </td>`;
html += `<td>${arg.event.extendedProps.desc ?? 'No Description'}</td>`;
html += `</tr>`;
const modal = $('#viewModal');
modal.find('.modal-body').html(html);
$('#viewModal').modal('show');
}
},
});
calendar.render();
$('#filter-form').on('submit', function(e) {
calendar.refetchEvents();
})
$("body").on('submit', '.eventForm', function(e) {
e.preventDefault();
let form = $('.eventForm')[0];
let formData = new FormData(form);
param = {
url: '{{ route('event.store') }}',
type: 'event'
}
formSubmit(param, formData)
window.location.href = "{{ route('calendar.index') }}";
})
$("body").on('submit', '#contentForm', function(e) {
e.preventDefault();
let form = $('#contentForm')[0];
let formData = new FormData(form);
const url = $(this).attr('action');
const button = $('#contentForm #submit');
button.text('Scheduling...');
button.prop('disabled', true);
$.ajax({
url: url,
type: 'POST',
processData: false,
contentType: false,
data: formData,
success: function(response) {
$(`#contentModal`).modal('hide');
flasher.success(response.msg);
window.location.reload();
},
error: function(xhr) {
if (xhr.responseJSON) {
var errors = xhr.responseJSON;
for (var key in errors) {
if (errors.hasOwnProperty(key)) {
var errorMessages = errors[key];
for (var i = 0; i < errorMessages.length; i++) {
flasher.error(errorMessages[i]);
}
}
}
} else {
flasher.error("An error occurred while processing your request.");
}
},
complete: function() {
button.text('Schedule');
button.prop('disabled', false);
}
})
})
$("body").on('click', '.content-edit-btn', function(e) {
e.preventDefault();
const url = $(this).attr('data-link');
let target = document.querySelector('#js-content-partial-target');
target.innerHTML = "<h5 class='text-center my-5'>Loading...</h5>";
fetch(url)
.then(response => response.text())
.then(html => {
target.innerHTML = html;
})
})
$("body").on('submit', '.meetingForm', function(e) {
e.preventDefault();
let form = $('.meetingForm')[0];
let formData = new FormData(form);
param = {
url: '{{ route('meeting.store') }}',
type: 'meeting'
}
formSubmit(param, formData)
window.location.href = "{{ route('calendar.index') }}";
})
const formSubmit = (param, formData) => {
let type = param.type
$.ajax({
url: param.url,
type: 'POST',
processData: false,
contentType: false,
data: formData,
success: function(response) {
if (response.status == true) {
eventData = response.data
addEvent(eventData, type);
}
$(`#${param.type}Modal`).modal('hide');
flasher.success(response.msg);
$(`.${param.type}Form`)[0].reset()
},
error: function(xhr) {
if (xhr.responseJSON) {
var errors = xhr.responseJSON;
for (var key in errors) {
if (errors.hasOwnProperty(key)) {
var errorMessages = errors[key];
for (var i = 0; i < errorMessages.length; i++) {
flasher.error(errorMessages[i]);
}
}
}
} else {
flasher.error("An error occurred while processing your request.");
}
},
})
}
const addEvent = (data, type) => {
className = '';
console.log(data, type);
if (type == 'event') {
className = 'bg-primary-subtle'
} else if (type == 'meeting') {
className = 'bg-warning-subtle'
} else if (type == 'meeting') {
className = 'bg-success-subtle'
}
calendar.addEvent({
title: data.title,
start: data.start_date,
end: data.end_date,
desc: data.description,
location: data.location,
className: className,
allDay: true
});
}
});
</script>
@endpush

View File

@@ -0,0 +1,54 @@
<div class="row gy-3">
<div class="col-md-12">
{{ html()->label('Title')->class('form-label') }}
{{ html()->text('title')->class('form-control')->placeholder('Event Title')->required() }}
{{ html()->div('Please Enter Event Title')->class('invalid-feedback') }}
</div>
<div class="col-md-6">
{{ html()->label('Event Type')->class('form-label') }}
{{ html()->select('type', config('constants.event_type_options'))->class('form-select select2')->placeholder('-Select-')->required() }}
{{ html()->div('Please Choose Type')->class('invalid-feedback') }}
</div>
<div class="col-md-6">
{{ html()->label('Location')->class('form-label') }}
{{ html()->text('location')->class('form-control')->placeholder('Event Location') }}
</div>
<div class="col-md-6">
{{ html()->label('Start Date')->class('form-label') }}
<div class="input-group">
{{ html()->text('start_date')->class('form-control flatpickr-input')->id('event-start-date')->placeholder('Event Start Date')->value(date('Y-m-d h:i:s'))->attributes([
'data-provider' => 'flatpickr',
'data-date-format' => 'Y-m-d',
'data-enable-time' => '',
])->required() }}
<span class="input-group-text"><i class="ri-calendar-event-line"></i></span>
{{ html()->div('Please Choose Start Date')->class('invalid-feedback') }}
</div>
</div>
<div class="col-md-6">
{{ html()->label('End Date')->class('form-label') }}
<div class="input-group">
{{ html()->text('end_date')->class('form-control flatpickr-input')->id('event-end-date')->placeholder('Event End Date')->attributes([
'data-provider' => 'flatpickr',
'data-date-format' => 'Y-m-d',
'data-enable-time' => '',
]) }}
<span class="input-group-text"><i class="ri-calendar-event-line"></i></span>
</div>
</div>
<div class="col-lg-12 col-md-12">
{{ html()->label('Description')->class('form-label') }}
{{ html()->textarea('description')->class('form-control ckeditor-classic') }}
</div>
<div class="text-end">
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-success">Save</button>
</div>
</div>

View File

@@ -0,0 +1,86 @@
<div class="row gy-3">
<div class="col-lg-6 col-md-6">
{{ html()->label('Title')->class('form-label') }}
{{ html()->text('title')->class('form-control')->placeholder('Meeting Title')->required() }}
{{ html()->div('Please enter title')->class('invalid-feedback') }}
</div>
<div class="col-lg-6 col-md-6">
{{ html()->label('Location')->class('form-label') }}
{{ html()->text('location')->class('form-control')->placeholder('Meeting Location') }}
</div>
<div class="col-lg-4 col-md-4">
{{ html()->label('Date')->class('form-label') }}
<div class="input-group">
{{ html()->text('date')->class('form-control flatpickr-date')->placeholder('Start Date')->required() }}
<span class="input-group-text"><i class="ri-calendar-line"></i></span>
</div>
{{ html()->div('Choose Start Date')->class('invalid-feedback') }}
</div>
<div class="col-lg-4 col-md-4">
{{ html()->label('Start Time')->class('form-label') }}
{{ html()->time('start_time')->class('form-control')->placeholder('Event Start Time') }}
</div>
<div class="col-lg-4 col-md-4">
{{ html()->label('End Time')->class('form-label') }}
{{ html()->time('end_time')->class('form-control')->placeholder('Event End Time') }}
</div>
<div class="col-lg-3 col-md-3">
{{ html()->label('Meeting with: ')->class('form-label') }}
<div class="form-check form-radio-success">
{{ html()->radio('meeting_with', false, 'client')->class('form-check-input meeting-with') }}
{{ html()->label('Client')->class('form-check-label me-1')->for('meeting_with_client') }}
</div>
<div class="form-check form-radio-success">
{{ html()->radio('meeting_with', false, 'member')->class('form-check-input meeting-with') }}
{{ html()->label('Office Members')->class('form-check-label me-1')->for('meeting_with_member') }}
</div>
</div>
<div class="col-lg-9 col-md-9 client-dropdown d-none">
{{ html()->label('Client')->class('form-label') }}
{{ html()->select('client_id', $clientList)->class('form-select select2') }}
</div>
<div class="col-lg-9 col-md-9 member-dropdown d-none">
{{ html()->label('Members')->class('form-label') }}
{{ html()->multiselect('members[]', [])->class('form-control select2')->attributes(['multiple', 'id' => 'members']) }}
</div>
<div class="col-lg-12 col-md-12">
{{ html()->label('Description')->class('form-label') }}
{{ html()->textarea('description')->class('form-control ckeditor-classic') }}
</div>
<div class="text-end">
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-success">Save</button>
</div>
</div>
@push('js')
<script type="text/javascript">
$(document).ready(function() {
$('.meeting-with').change(function() {
let value = $(this).val();
if (value == 'member') {
$('.member-dropdown').removeClass('d-none');
$('.client-dropdown').addClass('d-none');
} else {
$('.member-dropdown').addClass('d-none');
$('.client-dropdown').removeClass('d-none');
}
});
});
</script>
@endpush

View File

@@ -0,0 +1,47 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
@include('layouts.partials.breadcrumb', ['title' => 'City'])
<!-- end page title -->
<div class='card'>
<div class='card-body'>
<form action="{{ $editable ? route('cities.update', [$data->city_id]) : route('cities.store') }}"
id="updateCustomForm" method="POST">
@csrf
<input type=hidden name='city_id' value='{{ $editable ? $data->city_id : '' }}' />
<div class="row">
<div class="col-lg-6">
{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
</div>
<div class="col-lg-6">
{{ createCustomSelect('tbl_districts', 'title', 'district_id', $editable ? $data->districts_id : '', 'District', 'districts_id', 'form-control select2', 'status<>-1') }}
</div>
{{-- <div class="col-lg-12 pb-2">
{{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }}
</div> --}}
<div class="col-lg-12 pb-2">
{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
</div>
<div class="col-md-12 mt-2">
<?php createButton('btn-primary btn-update', '', 'Submit'); ?>
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('cities.index')); ?>
</div>
</form>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,270 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
@include('layouts.partials.breadcrumb', ['title' => 'City'])
<!-- end page title -->
<div class="card">
<div class="card-header align-items-center d-flex">
<h5 class="card-title flex-grow-1 mb-0">City Lists</h5>
<div class="flex-shrink-0">
<a href="{{ route('cities.create') }}" class="btn btn-success waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Create City</a>
</div>
</div>
<div class="card-body">
<table class="dataTable table" id="tbl_cities" data-url="{{ route('cities.sort') }}">
<thead class="table-dark">
<tr>
<th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('District') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('title') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('alias') }}</span></th>
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
</th>
</tr>
</thead>
<tbody>
@foreach ($data as $item)
<tr data-id="{{ $item->city_id }}" data-display_order="{{ $item->display_order }}"
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
<td class="tb-col">{{ $index + 1 }}</td>
<td class="tb-col">
{!! getFieldData('tbl_districts', 'title', 'district_id', $item->districts_id) !!}
</td>
<td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{ $item->city_id }}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
id="alias_{{ $item->city_id }}" />
</div>
<span class="badge badge-soft-primary change-alias-badge">change alias</span>
</td>
<td class="tb-col">
<div class="dropdown d-inline-block">
<button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown"
aria-expanded="false">
<i class="ri-more-fill align-middle"></i>
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><a href="{{ route('cities.show', [$item->city_id]) }}" class="dropdown-item"><i
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
<li><a href="{{ route('cities.edit', [$item->city_id]) }}" class="dropdown-item edit-item-btn"><i
class="ri-pencil-fill text-muted me-2 align-bottom"></i> {{ label('Edit') }}</a></li>
<li>
<a href="{{ route('cities.toggle', [$item->city_id]) }}" class="dropdown-item toggle-item-btn"
onclick="confirmToggle(this.href)">
<i class="ri-article-fill text-muted me-2 align-bottom"></i>
{{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
</a>
</li>
<li>
<a href="{{ route('cities.clone', [$item->city_id]) }}" class="dropdown-item toggle-item-btn"
onclick="confirmClone(this.href)">
<i class="ri-file-copy-line text-muted me-2 align-bottom"></i> {{ label('Clone') }}
</a>
</li>
<li>
<a href="{{ route('cities.destroy', [$item->city_id]) }}" class="dropdown-item remove-item-btn"
onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill text-muted me-2 align-bottom"></i> {{ label('Delete') }}
</a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@push('js')
<script>
$(document).ready(function(e) {
$('.change-alias-badge').on('click', function() {
var aliasWrapper = $(this).prev('.alias-wrapper');
var aliasSpan = aliasWrapper.find('.alias');
var aliasInput = aliasWrapper.find('.alias-input');
var isEditing = $(this).hasClass('editing');
aliasInput.toggleClass("d-none");
if (isEditing) {
// Update alias text and switch to non-editing state
var newAlias = aliasInput.val();
aliasSpan.text(newAlias);
aliasSpan.show();
aliasInput.hide();
$(this).removeClass('editing').text('Change Alias');
var articleId = $(aliasWrapper).data('id');
var ajaxUrl = "{{ route('cities.updatealias') }}";
var data = {
articleId: articleId,
newAlias: newAlias
};
$.ajax({
url: ajaxUrl,
type: 'POST',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: data,
success: function(response) {
console.log(response);
},
error: function(xhr, status, error) {
console.error(error);
}
});
} else {
// Switch to editing state
aliasSpan.hide();
aliasInput.show().focus();
$(this).addClass('editing').text('Save Alias');
}
});
var mytable = $(".dataTable").DataTable({
ordering: true,
rowReorder: {
//selector: 'tr'
},
});
var isRowReorderComplete = false;
mytable.on('row-reorder', function(e, diff, edit) {
isRowReorderComplete = true;
});
mytable.on('draw', function() {
if (isRowReorderComplete) {
var url = mytable.table().node().getAttribute('data-url');
var ids = mytable.rows().nodes().map(function(node) {
return $(node).data('id');
}).toArray();
console.log(ids);
$.ajax({
url: url,
type: "POST",
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
},
data: {
id_order: ids
},
success: function(response) {
console.log(response);
},
error: function(xhr, status, error) {
console.error(error);
}
});
isRowReorderComplete = false;
}
});
});
function confirmDelete(url) {
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: 'You will not be able to recover this item!',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Delete',
cancelButtonText: 'Cancel',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: url,
type: 'DELETE',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(response) {
Swal.fire('Deleted!', 'The item has been deleted.', 'success');
location.reload();
},
error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
}
});
}
});
}
function confirmToggle(url) {
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: url,
type: 'GET',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(response) {
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
location.reload();
},
error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error');
}
});
}
});
}
function confirmClone(url) {
event.preventDefault();
Swal.fire({
title: 'Are you sure?',
text: 'Clonning will create replica of current row. No any linked data will be updated!',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel',
reverseButtons: true
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: url,
type: 'GET',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success: function(response) {
Swal.fire('Updated!', 'Clonning Completed', 'success');
location.reload();
},
error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error');
}
});
}
});
}
</script>
@endpush

View File

@@ -0,0 +1,37 @@
@extends('layouts.app')
@section('content')
<div class='card'>
<div class="card-header align-items-center d-flex">
<h5 class="card-title flex-grow-1 mb-0">View Detail</h5>
<div class="flex-shrink-0">
<a href="{{ route('cities.index') }}" class="btn btn-success waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Back to List</a>
</div>
</div>
<div class='card-body'>
<p><b>Districts Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->districts_id }}</span></p>
<p><b>Title :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->title }}</span></p>
<p><b>Alias :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->alias }}</span></p>
<p><b>Description :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->description }}</span></p>
<p><b>Display Order :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->display_order }}</span></p>
<p><b>Status :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
</p>
<p><b>Remarks :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->remarks }}</span></p>
<p><b>Createdby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->createdby }}</span></p>
<p><b>Updatedby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->updatedby }}</span></p>
<div class="d-flex justify-content-between">
<div>
<p><b>Created On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->created_at }}</span></p>
<p><b>Created By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->createdBy }}</span></p>
</div>
<div>
<p><b>Updated On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updated_at }}</span></p>
<p><b>Updated By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updatedBy }}</span></p>
</div>
</div>
</div>
</div>
@endSection

View File

@@ -0,0 +1,51 @@
@php
$newMenuList = [];
@endphp
@foreach (config('menu') as $menuKey => $menu)
<li class="nav-item">
@if (array_key_exists('submenu', $menu))
@php
$menuList = array_column($menu['submenu'], 'url');
$menuCanArr = array_map('current', array_column($menu['submenu'], 'can'));
$permissionFlag = false;
if (auth()->user()->hasAnyPermission($menuCanArr)) {
$permissionFlag = true;
}
@endphp
@if ($permissionFlag)
<a class="nav-link menu-link @if (in_array(\Request::path(), $menuList)) collapsed active @endif" data-bs-toggle="collapse"
role="button" aria-expanded="false" aria-controls="{{ Str::slug($menu['text']) }}"
href="#{{ Str::slug($menu['text']) }}">
<i class="{{ $menu['icon'] }}"></i><span data-key="t-customers">{{ $menu['text'] }}</span></a>
<div class="menu-dropdown @if (in_array(\Request::path(), $menuList)) collapsed show @endif collapse"
id="{{ Str::slug($menu['text']) }}">
<ul class="nav nav-sm flex-column">
@foreach ($menu['submenu'] as $subMenu)
@can($subMenu['can'])
<li class="nav-item">
<a href="{{ url($subMenu['url']) }}"
class="nav-link @if (\Request::is($subMenu['url']) || \Request::is($subMenu['url'] . '/*')) active @endif">{{ $subMenu['text'] }}
</a>
</li>
@endcan
@endforeach
</ul>
</div>
@endif
@else
@if (array_key_exists('can', $menu))
@can($menu['can'])
<a href="{{ url($menu['url']) ?? '#' }}" class="nav-link @if (\Request::is($menu['url']) || \Request::is($menu['url'] . '/*')) active @endif">
<i class="{{ $menu['icon'] }}"></i><span data-key="t-customers">{{ $menu['text'] }}</span>
</a>
@endcan
@else
<a href="{{ url($menu['url']) ?? '#' }}" class="nav-link @if (\Request::is($menu['url']) || \Request::is($menu['url'] . '/*')) active @endif">
<i class="{{ $menu['icon'] }}"></i><span data-key="t-customers">{{ $menu['text'] }}</span>
</a>
@endif
@endif
</li>
@endforeach

View 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 -->
<div class='card'>
<div class='card-body'>
{{ html()->form('POST')->route('country.store')->class(['needs-validation'])->attributes(['novalidate'])->open() }}
@include('admin::countries.partials.action')
{{ html()->form()->close() }}
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,9 @@
<div class="hstack flex-wrap gap-3">
<a href="javascript:void(0);" class="link-info fs-15 view-item-btn" data-bs-toggle="modal" data-bs-target="#viewModal">
<i class="ri-eye-fill"></i>
</a>
<a href="{{ route('country.edit', $id) }}" class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-fill"></i></a>
<a href="javascript:void(0);" data-link="{{ route('country.destroy', $id) }}" data-id="{{ $id }}"
class="link-danger fs-15 remove-item"><i class="ri-delete-bin-fill"></i></a>
</div>

View 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 -->
<div class='card'>
<div class='card-body'>
{{ html()->modelForm($country, 'PUT')->route('country.update', $country->id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
@include('admin::countries.partials.action')
{{ html()->form()->close() }}
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,40 @@
@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 -->
<div class="card">
<div class="card-header align-items-center d-flex">
<h5 class="card-title flex-grow-1 mb-0">{{ $title }}</h5>
<div class="flex-shrink-0">
<a href="{{ route('country.create') }}" class="btn btn-success waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Create</a>
</div>
</div>
<div class="card-body">
@php
$columns = [
['title' => 'ID', 'data' => 'id', 'name' => 'id'],
['title' => 'Name', 'data' => 'name', 'name' => 'name'],
['title' => 'Action', 'data' => 'action', 'orderable' => false, 'searchable' => false],
];
@endphp
<x-data-table-script :route="route('country.index')" :columns="$columns" />
</div>
</div>
</div>
</div>
@foreach($countries as $country)
{{-- @dd($country) --}}
@include('admin::countries.partials.view')
@endforeach
@endsection

View File

@@ -0,0 +1,16 @@
<div class="row gy-3">
<div class="col-lg-4 col-md-6">
{{ html()->label('Name')->class('form-label') }}
{{ html()->text('name')->class('form-control')->placeholder('Country Name') }}
</div>
<div class="col-lg-4 col-md-6">
{{ html()->label('Code')->class('form-label') }}
{{ html()->text('code')->class('form-control')->placeholder('Country code') }}
</div>
<x-form-buttons :editable="$editable" :href="route('country.index')" />
</div>

View File

@@ -0,0 +1,13 @@
<div class="modal fade" id="viewModal" tabindex="-1" aria-labelledby="viewModalLabel" aria-modal="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalgridLabel">View Country</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
@include('admin::countries.show')
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,9 @@
<ul class="list-inline d-flex flex-column flex-wrap gap-2">
<li class="list-inline-item">
Country Name: <span class="fw-medium">{{ $country->name }} </span>
</li>
<li class="list-inline-item">
Country Code: <span class="fw-medium">{{ $country->code }} </span>
</li>
</ul>

View 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 -->
<div class='card'>
<div class='card-body'>
{{ html()->form('POST')->route('designation.store')->class(['needs-validation'])->attributes(['novalidate'])->open() }}
@include('admin::partials.designations.action')
{{ html()->form()->close() }}
</div>
</div>
</div>
@endsection

View 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 -->
<div class='card'>
<div class='card-body'>
{{ html()->modelForm($designation, 'PUT')->route('designation.update', $designation->designation_id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
@include('admin::partials.designations.action')
{{ html()->form()->close() }}
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,61 @@
@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 -->
<div class="card">
<div class="card-header align-items-center d-flex">
<h5 class="card-title flex-grow-1 mb-0">{{ $title }}</h5>
<div class="flex-shrink-0">
<a href="{{ route('designation.create') }}" class="btn btn-success waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Create</a>
</div>
</div>
<div class="card-body">
<table id="buttons-datatables" class="display table-sm table-bordered table">
<thead class="table-light">
<tr>
<th class="tb-col"><span class="overline-title">S.N</span></th>
{{-- <th class="tb-col"><span class="overline-title">Department</span></th> --}}
<th class="tb-col"><span class="overline-title">Name</span></th>
<th class="tb-col"><span class="overline-title">Status</span></th>
<th class="tb-col" data-sortable="false"><span class="overline-title">Action</span>
</th>
</tr>
</thead>
<tbody>
@foreach ($designationLists as $index => $item)
<tr>
<td class="tb-col">{{ $index + 1 }}</td>
{{-- <td class="tb-col">{{ $item->department?->name }}</td> --}}
<td class="tb-col">{{ $item->name }}</td>
<td class="tb-col">{!! $item->status_name !!}</td>
<td class="tb-col">
<div class="hstack flex-wrap gap-3">
<a href="javascript:void(0);" class="link-info fs-15 view-item-btn" data-bs-toggle="modal"
data-bs-target="#viewModal">
<i class="ri-eye-fill"></i>
</a>
<a href="{{ route('designation.edit', $item) }}" class="link-success fs-15 edit-item-btn"><i
class="ri-edit-2-fill"></i></a>
<a href="javascript:void(0);" data-link="{{ route('designation.destroy', $item) }}"
data-id="{{ $item->designation_id }}" class="link-danger fs-15 remove-item-btn"><i
class="ri-delete-bin-fill"></i></a>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,48 @@
@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 -->
<div class='card'>
<div class="card-header align-items-center d-flex">
<h5 class="card-title flex-grow-1 mb-0">View Detail</h5>
<div class="flex-shrink-0">
<a href="{{ route('designations.index') }}" class="btn btn-success waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Back to List</a>
</div>
</div>
<div class='card-body'>
<p><b>Title :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->title }}</span></p>
<p><b>Alias :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->alias }}</span></p>
<p><b>Status :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span
class="{{ $data->status == 1 ? 'text-success' : 'text-danger' }}">{{ $data->status == 1 ? 'Active' : 'Inactive' }}</span>
</p>
<p><b>Remarks :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->remarks }}</span></p>
<p><b>Display Order :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->display_order }}</span></p>
<p><b>Createdby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->createdby }}</span></p>
<p><b>Updatedby :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->updatedby }}</span></p>
<p><b>Job Description :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->job_description }}</span></p>
<p><b>Departments Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->departments_id }}</span></p>
<div class="d-flex justify-content-between">
<div>
<p><b>Created On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->created_at }}</span></p>
<p><b>Created By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->createdBy }}</span></p>
</div>
<div>
<p><b>Updated On :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updated_at }}</span></p>
<p><b>Updated By :</b>&nbsp;&nbsp;&nbsp;<span>{{ $data->updatedBy }}</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
@endSection

View 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 -->
<div class='card'>
<div class='card-body'>
{{ html()->form('POST')->route('district.store')->class(['needs-validation'])->attributes(['novalidate'])->open() }}
@include('admin::districts.partials.action')
{{ html()->form()->close() }}
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,6 @@
<div class="hstack flex-wrap gap-3">
<a href="{{ route('district.edit', $id) }}" class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-fill"></i></a>
<a href="javascript:void(0);" data-link="{{ route('district.destroy', $id) }}" data-id="{{ $id }}"
class="link-danger fs-15 remove-item"><i class="ri-delete-bin-fill"></i></a>
</div>

Some files were not shown because too many files have changed in this diff Show More