leave user employee module setup

This commit is contained in:
Ranjan 2024-04-07 13:13:58 +05:45
parent da9f493572
commit cfd2147536
174 changed files with 9312 additions and 9540 deletions

18
.htaccess Normal file
View File

@ -0,0 +1,18 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
</IfModule>

View File

@ -0,0 +1,67 @@
<?php
namespace Modules\Attendance\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class AttendanceController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('attendance::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('attendance::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
//
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('attendance::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('attendance::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

View File

@ -0,0 +1,114 @@
<?php
namespace Modules\Attendance\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class AttendanceServiceProvider extends ServiceProvider
{
protected string $moduleName = 'Attendance';
protected string $moduleNameLower = 'attendance';
/**
* Boot the application events.
*/
public function boot(): void
{
$this->registerCommands();
$this->registerCommandSchedules();
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
}
/**
* Register the service provider.
*/
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
}
/**
* 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\Attendance\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('Attendance', '/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('Attendance', '/routes/api.php'));
}
}

View File

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

View File

View File

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

View File

@ -0,0 +1,16 @@
<?php
namespace Modules\Attendance\database\seeders;
use Illuminate\Database\Seeder;
class AttendanceDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
}
}

View File

@ -0,0 +1,11 @@
{
"name": "Attendance",
"alias": "attendance",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Attendance\\Providers\\AttendanceServiceProvider"
],
"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

@ -0,0 +1,7 @@
@extends('attendance::layouts.master')
@section('content')
<h1>Hello World</h1>
<p>Module: {!! config('attendance.name') !!}</p>
@endsection

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Attendance Module - {{ config('app.name', 'Laravel') }}</title>
<meta name="description" content="{{ $description ?? '' }}">
<meta name="keywords" content="{{ $keywords ?? '' }}">
<meta name="author" content="{{ $author ?? '' }}">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
{{-- Vite CSS --}}
{{-- {{ module_vite('build-attendance', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
@yield('content')
{{-- Vite JS --}}
{{-- {{ module_vite('build-attendance', 'resources/assets/js/app.js') }} --}}
</body>

View File

View File

@ -0,0 +1,19 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Attendance\Http\Controllers\AttendanceController;
/*
*--------------------------------------------------------------------------
* API Routes
*--------------------------------------------------------------------------
*
* Here is where you can register API routes for your application. These
* routes are loaded by the RouteServiceProvider within a group which
* is assigned the "api" middleware group. Enjoy building your API!
*
*/
Route::middleware(['auth:sanctum'])->prefix('v1')->group(function () {
Route::apiResource('attendance', AttendanceController::class)->names('attendance');
});

View File

@ -0,0 +1,19 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Attendance\Http\Controllers\AttendanceController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::group([], function () {
Route::resource('attendance', AttendanceController::class)->names('attendance');
});

View File

@ -0,0 +1,26 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
build: {
outDir: '../../public/build-attendance',
emptyOutDir: true,
manifest: true,
},
plugins: [
laravel({
publicDirectory: '../../public',
buildDirectory: 'build-attendance',
input: [
__dirname + '/resources/assets/sass/app.scss',
__dirname + '/resources/assets/js/app.js'
],
refresh: true,
}),
],
});
//export const paths = [
// 'Modules/Attendance/resources/assets/sass/app.scss',
// 'Modules/Attendance/resources/assets/js/app.js',
//];

View File

@ -1,13 +0,0 @@
<?php
namespace Modules\Employee\Models;
use Illuminate\Database\Eloquent\Model;
class Employee extends Model
{
protected $table = 'employees';
protected $primaryKey = 'employee_id';
protected $guarded = [];
}

View File

@ -4,8 +4,6 @@ namespace Modules\Employee\Providers;
use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Modules\Employee\Repositories\EmployeeInterface;
use Modules\Employee\Repositories\EmployeeRepository;
class EmployeeServiceProvider extends ServiceProvider class EmployeeServiceProvider extends ServiceProvider
{ {
@ -31,7 +29,6 @@ class EmployeeServiceProvider extends ServiceProvider
*/ */
public function register(): void public function register(): void
{ {
$this->app->bind(EmployeeInterface::class, EmployeeRepository::class);
$this->app->register(RouteServiceProvider::class); $this->app->register(RouteServiceProvider::class);
} }

View File

@ -1,12 +0,0 @@
<?php
namespace Modules\Employee\Repositories;
interface EmployeeInterface
{
public function findAll();
public function getEmployeeById($employeeId);
public function delete($employeeId);
public function create(array $EmployeeDetails);
public function update($employeeId, array $newDetails);
}

View File

@ -1,34 +0,0 @@
<?php
namespace Modules\Employee\Repositories;
use Modules\Employee\Models\Employee;
class EmployeeRepository implements EmployeeInterface
{
public function findAll()
{
return Employee::get();
}
public function getEmployeeById($employeeId)
{
return Employee::findOrFail($employeeId);
}
public function delete($employeeId)
{
Employee::destroy($employeeId);
}
public function create(array $employeeDetails)
{
return Employee::create($employeeDetails);
}
public function update($employeeId, array $newDetails)
{
return Employee::whereId($employeeId)->update($newDetails);
}
}

View File

@ -5,21 +5,8 @@
<div class="container-fluid"> <div class="container-fluid">
<!-- start page title --> <!-- start page title -->
<div class="row"> @include('layouts.partials.breadcrumb', ['title' => 'Employee'])
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">Team</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Pages</a></li>
<li class="breadcrumb-item active">Team</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title --> <!-- end page title -->
<div class="card"> <div class="card">
@ -37,7 +24,7 @@
<div class="list-grid-nav hstack gap-1"> <div class="list-grid-nav hstack gap-1">
<button class="btn btn-success addMembers-modal" data-bs-toggle="modal" <button class="btn btn-success addMembers-modal" data-bs-toggle="modal"
data-bs-target="#addmemberModal"><i class="ri-add-fill me-1 align-bottom"></i> Add Members</button> data-bs-target="#addmemberModal"><i class="ri-add-fill me-1 align-bottom"></i> Create Employee</button>
</div> </div>
</div> </div>
@ -53,6 +40,7 @@
<div id="teamlist"> <div id="teamlist">
<div class="team-list row grid-view-filter" id="team-member-list"> <div class="team-list row grid-view-filter" id="team-member-list">
<div class="col"> <div class="col">
<div class="card team-box"> <div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-9.jpg" alt="" class="img-fluid"> <div class="team-cover"> <img src="assets/images/small/img-9.jpg" alt="" class="img-fluid">
@ -112,6 +100,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col"> <div class="col">
<div class="card team-box"> <div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-12.jpg" alt="" class="img-fluid"> <div class="team-cover"> <img src="assets/images/small/img-12.jpg" alt="" class="img-fluid">
@ -172,6 +161,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col"> <div class="col">
<div class="card team-box"> <div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-11.jpg" alt="" <div class="team-cover"> <img src="assets/images/small/img-11.jpg" alt=""
@ -231,809 +221,13 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col">
<div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-1.jpg" alt=""
class="img-fluid"> </div>
<div class="card-body p-4">
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
<div class="me-2 flex-shrink-0"> <button type="button"
class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn active"> <i
class="ri-star-fill fs-14"></i> </button> </div>
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false"> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item edit-list" href="#addmemberModal" data-bs-toggle="modal"
data-edit-id="9"><i class="ri-pencil-line text-muted me-2 align-bottom"></i>Edit</a>
</li>
<li><a class="dropdown-item remove-list" href="#removeMemberModal"
data-bs-toggle="modal" data-remove-id="9"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Remove</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0"><img
src="assets/images/users/avatar-8.jpg" alt=""
class="member-img img-fluid d-block rounded-circle"></div>
<div class="team-content"> <a class="member-name" data-bs-toggle="offcanvas"
href="#member-overview" aria-controls="member-overview">
<h5 class="fs-16 mb-1">Jennifer Carter</h5>
</a>
<p class="text-muted member-designation mb-0">UI/UX Designer</p>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="row text-muted text-center">
<div class="col-6 border-end border-end-dashed">
<h5 class="projects-num mb-1">241</h5>
<p class="text-muted mb-0">Projects</p>
</div>
<div class="col-6">
<h5 class="tasks-num mb-1">204</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
</div>
<div class="col-lg-2 col">
<div class="text-end"> <a href="pages-profile.html" class="btn btn-light view-btn">View
Profile</a> </div>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-10.jpg" alt=""
class="img-fluid"> </div>
<div class="card-body p-4">
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
<div class="me-2 flex-shrink-0"> <button type="button"
class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn"> <i
class="ri-star-fill fs-14"></i> </button> </div>
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false"> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item edit-list" href="#addmemberModal" data-bs-toggle="modal"
data-edit-id="8"><i class="ri-pencil-line text-muted me-2 align-bottom"></i>Edit</a>
</li>
<li><a class="dropdown-item remove-list" href="#removeMemberModal"
data-bs-toggle="modal" data-remove-id="8"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Remove</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0">
<div class="avatar-title bg-light text-primary rounded-circle text-uppercase border">ME
</div>
</div>
<div class="team-content"> <a class="member-name" data-bs-toggle="offcanvas"
href="#member-overview" aria-controls="member-overview">
<h5 class="fs-16 mb-1">Megan Elmore</h5>
</a>
<p class="text-muted member-designation mb-0">Team Leader &amp; Web Developer</p>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="row text-muted text-center">
<div class="col-6 border-end border-end-dashed">
<h5 class="projects-num mb-1">201</h5>
<p class="text-muted mb-0">Projects</p>
</div>
<div class="col-6">
<h5 class="tasks-num mb-1">263</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
</div>
<div class="col-lg-2 col">
<div class="text-end"> <a href="pages-profile.html" class="btn btn-light view-btn">View
Profile</a> </div>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-2.jpg" alt=""
class="img-fluid"> </div>
<div class="card-body p-4">
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
<div class="me-2 flex-shrink-0"> <button type="button"
class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn"> <i
class="ri-star-fill fs-14"></i> </button> </div>
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false"> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item edit-list" href="#addmemberModal" data-bs-toggle="modal"
data-edit-id="7"><i class="ri-pencil-line text-muted me-2 align-bottom"></i>Edit</a>
</li>
<li><a class="dropdown-item remove-list" href="#removeMemberModal"
data-bs-toggle="modal" data-remove-id="7"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Remove</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0"><img
src="assets/images/users/avatar-4.jpg" alt=""
class="member-img img-fluid d-block rounded-circle"></div>
<div class="team-content"> <a class="member-name" data-bs-toggle="offcanvas"
href="#member-overview" aria-controls="member-overview">
<h5 class="fs-16 mb-1">Alexis Clarke</h5>
</a>
<p class="text-muted member-designation mb-0">Backend Developer</p>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="row text-muted text-center">
<div class="col-6 border-end border-end-dashed">
<h5 class="projects-num mb-1">132</h5>
<p class="text-muted mb-0">Projects</p>
</div>
<div class="col-6">
<h5 class="tasks-num mb-1">147</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
</div>
<div class="col-lg-2 col">
<div class="text-end"> <a href="pages-profile.html" class="btn btn-light view-btn">View
Profile</a> </div>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-4.jpg" alt=""
class="img-fluid"> </div>
<div class="card-body p-4">
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
<div class="me-2 flex-shrink-0"> <button type="button"
class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn active"> <i
class="ri-star-fill fs-14"></i> </button> </div>
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false"> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item edit-list" href="#addmemberModal" data-bs-toggle="modal"
data-edit-id="6"><i class="ri-pencil-line text-muted me-2 align-bottom"></i>Edit</a>
</li>
<li><a class="dropdown-item remove-list" href="#removeMemberModal"
data-bs-toggle="modal" data-remove-id="6"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Remove</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0">
<div class="avatar-title bg-light text-primary rounded-circle text-uppercase border">NC
</div>
</div>
<div class="team-content"> <a class="member-name" data-bs-toggle="offcanvas"
href="#member-overview" aria-controls="member-overview">
<h5 class="fs-16 mb-1">Nathan Cole</h5>
</a>
<p class="text-muted member-designation mb-0">Front-End Developer</p>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="row text-muted text-center">
<div class="col-6 border-end border-end-dashed">
<h5 class="projects-num mb-1">352</h5>
<p class="text-muted mb-0">Projects</p>
</div>
<div class="col-6">
<h5 class="tasks-num mb-1">376</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
</div>
<div class="col-lg-2 col">
<div class="text-end"> <a href="pages-profile.html" class="btn btn-light view-btn">View
Profile</a> </div>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-7.jpg" alt=""
class="img-fluid"> </div>
<div class="card-body p-4">
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
<div class="me-2 flex-shrink-0"> <button type="button"
class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn active"> <i
class="ri-star-fill fs-14"></i> </button> </div>
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false"> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item edit-list" href="#addmemberModal" data-bs-toggle="modal"
data-edit-id="5"><i class="ri-pencil-line text-muted me-2 align-bottom"></i>Edit</a>
</li>
<li><a class="dropdown-item remove-list" href="#removeMemberModal"
data-bs-toggle="modal" data-remove-id="5"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Remove</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0"><img
src="assets/images/users/avatar-6.jpg" alt=""
class="member-img img-fluid d-block rounded-circle"></div>
<div class="team-content"> <a class="member-name" data-bs-toggle="offcanvas"
href="#member-overview" aria-controls="member-overview">
<h5 class="fs-16 mb-1">Joseph Parker</h5>
</a>
<p class="text-muted member-designation mb-0">Full Stack Developer</p>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="row text-muted text-center">
<div class="col-6 border-end border-end-dashed">
<h5 class="projects-num mb-1">64</h5>
<p class="text-muted mb-0">Projects</p>
</div>
<div class="col-6">
<h5 class="tasks-num mb-1">93</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
</div>
<div class="col-lg-2 col">
<div class="text-end"> <a href="pages-profile.html" class="btn btn-light view-btn">View
Profile</a> </div>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-3.jpg" alt=""
class="img-fluid"> </div>
<div class="card-body p-4">
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
<div class="me-2 flex-shrink-0"> <button type="button"
class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn"> <i
class="ri-star-fill fs-14"></i> </button> </div>
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false"> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item edit-list" href="#addmemberModal" data-bs-toggle="modal"
data-edit-id="4"><i class="ri-pencil-line text-muted me-2 align-bottom"></i>Edit</a>
</li>
<li><a class="dropdown-item remove-list" href="#removeMemberModal"
data-bs-toggle="modal" data-remove-id="4"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Remove</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0"><img
src="assets/images/users/avatar-5.jpg" alt=""
class="member-img img-fluid d-block rounded-circle"></div>
<div class="team-content"> <a class="member-name" data-bs-toggle="offcanvas"
href="#member-overview" aria-controls="member-overview">
<h5 class="fs-16 mb-1">Erica Kernan</h5>
</a>
<p class="text-muted member-designation mb-0">Web Designer</p>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="row text-muted text-center">
<div class="col-6 border-end border-end-dashed">
<h5 class="projects-num mb-1">345</h5>
<p class="text-muted mb-0">Projects</p>
</div>
<div class="col-6">
<h5 class="tasks-num mb-1">298</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
</div>
<div class="col-lg-2 col">
<div class="text-end"> <a href="pages-profile.html" class="btn btn-light view-btn">View
Profile</a> </div>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-5.jpg" alt=""
class="img-fluid"> </div>
<div class="card-body p-4">
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
<div class="me-2 flex-shrink-0"> <button type="button"
class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn active"> <i
class="ri-star-fill fs-14"></i> </button> </div>
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false"> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item edit-list" href="#addmemberModal" data-bs-toggle="modal"
data-edit-id="3"><i class="ri-pencil-line text-muted me-2 align-bottom"></i>Edit</a>
</li>
<li><a class="dropdown-item remove-list" href="#removeMemberModal"
data-bs-toggle="modal" data-remove-id="3"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Remove</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0">
<div class="avatar-title bg-light text-primary rounded-circle text-uppercase border">DP
</div>
</div>
<div class="team-content"> <a class="member-name" data-bs-toggle="offcanvas"
href="#member-overview" aria-controls="member-overview">
<h5 class="fs-16 mb-1">Donald Palmer</h5>
</a>
<p class="text-muted member-designation mb-0">Wed Developer</p>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="row text-muted text-center">
<div class="col-6 border-end border-end-dashed">
<h5 class="projects-num mb-1">97</h5>
<p class="text-muted mb-0">Projects</p>
</div>
<div class="col-6">
<h5 class="tasks-num mb-1">135</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
</div>
<div class="col-lg-2 col">
<div class="text-end"> <a href="pages-profile.html" class="btn btn-light view-btn">View
Profile</a> </div>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-8.jpg" alt=""
class="img-fluid"> </div>
<div class="card-body p-4">
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
<div class="me-2 flex-shrink-0"> <button type="button"
class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn"> <i
class="ri-star-fill fs-14"></i> </button> </div>
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false"> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item edit-list" href="#addmemberModal" data-bs-toggle="modal"
data-edit-id="2"><i class="ri-pencil-line text-muted me-2 align-bottom"></i>Edit</a>
</li>
<li><a class="dropdown-item remove-list" href="#removeMemberModal"
data-bs-toggle="modal" data-remove-id="2"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Remove</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0"><img
src="assets/images/users/avatar-7.jpg" alt=""
class="member-img img-fluid d-block rounded-circle"></div>
<div class="team-content"> <a class="member-name" data-bs-toggle="offcanvas"
href="#member-overview" aria-controls="member-overview">
<h5 class="fs-16 mb-1">Jack Gough</h5>
</a>
<p class="text-muted member-designation mb-0">React Js Developer</p>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="row text-muted text-center">
<div class="col-6 border-end border-end-dashed">
<h5 class="projects-num mb-1">87</h5>
<p class="text-muted mb-0">Projects</p>
</div>
<div class="col-6">
<h5 class="tasks-num mb-1">121</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
</div>
<div class="col-lg-2 col">
<div class="text-end"> <a href="{{ route('employee.show', 1) }}"
class="btn btn-light view-btn">View Profile</a> </div>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card team-box">
<div class="team-cover"> <img src="assets/images/small/img-6.jpg" alt=""
class="img-fluid"> </div>
<div class="card-body p-4">
<div class="row align-items-center team-row">
<div class="col team-settings">
<div class="row">
<div class="col">
<div class="me-2 flex-shrink-0"> <button type="button"
class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn"> <i
class="ri-star-fill fs-14"></i> </button> </div>
</div>
<div class="col dropdown text-end"> <a href="javascript:void(0);" data-bs-toggle="dropdown"
aria-expanded="false"> <i class="ri-more-fill fs-17"></i> </a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item edit-list" href="#addmemberModal" data-bs-toggle="modal"
data-edit-id="1"><i class="ri-pencil-line text-muted me-2 align-bottom"></i>Edit</a>
</li>
<li><a class="dropdown-item remove-list" href="#removeMemberModal"
data-bs-toggle="modal" data-remove-id="1"><i
class="ri-delete-bin-5-line text-muted me-2 align-bottom"></i>Remove</a></li>
</ul>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="team-profile-img">
<div class="avatar-lg img-thumbnail rounded-circle flex-shrink-0">
<div class="avatar-title bg-light text-primary rounded-circle text-uppercase border">MW
</div>
</div>
<div class="team-content"> <a class="member-name" data-bs-toggle="offcanvas"
href="#member-overview" aria-controls="member-overview">
<h5 class="fs-16 mb-1">Marie Ward</h5>
</a>
<p class="text-muted member-designation mb-0">Backend Developer</p>
</div>
</div>
</div>
<div class="col-lg-4 col">
<div class="row text-muted text-center">
<div class="col-6 border-end border-end-dashed">
<h5 class="projects-num mb-1">145</h5>
<p class="text-muted mb-0">Projects</p>
</div>
<div class="col-6">
<h5 class="tasks-num mb-1">210</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
</div>
<div class="col-lg-2 col">
<div class="text-end"> <a href="pages-profile.html" class="btn btn-light view-btn">View
Profile</a> </div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="mb-3 text-center">
<a href="javascript:void(0);" class="text-success"><i
class="mdi mdi-loading mdi-spin fs-20 me-2 align-middle"></i> Load More </a>
</div> </div>
</div> </div>
<div class="mt-4 py-4 text-center" id="noresult" style="display: none;">
<lord-icon src="https://cdn.lordicon.com/msoeawqm.json" trigger="loop"
colors="primary:#405189,secondary:#0ab39c" style="width:72px;height:72px"></lord-icon>
<h5 class="mt-4">Sorry! No Result Found</h5>
</div>
<!-- Modal -->
<div class="modal fade" id="addmemberModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content border-0">
<div class="modal-body">
<form autocomplete="off" id="memberlist-form" class="needs-validation" novalidate="">
<div class="row">
<div class="col-lg-12">
<input type="hidden" id="memberid-input" class="form-control" value="">
<div class="px-1 pt-1">
<div class="modal-team-cover position-relative mt-n4 mx-n4 rounded-top mb-0 overflow-hidden">
<img src="assets/images/small/img-9.jpg" alt="" id="cover-img"
class="img-fluid">
<div class="d-flex position-absolute end-0 start-0 top-0 p-3">
<div class="flex-grow-1">
<h5 class="modal-title text-white" id="createMemberLabel">Add New Members</h5>
</div>
<div class="flex-shrink-0">
<div class="d-flex align-items-center gap-3">
<div>
<label for="cover-image-input" class="mb-0" data-bs-toggle="tooltip"
data-bs-placement="top" aria-label="Select Cover Image"
data-bs-original-title="Select Cover Image">
<div class="avatar-xs">
<div
class="avatar-title bg-light rounded-circle text-muted cursor-pointer border">
<i class="ri-image-fill"></i>
</div>
</div>
</label>
<input class="form-control d-none" value="" id="cover-image-input"
type="file" accept="image/png, image/gif, image/jpeg">
</div>
<button type="button" class="btn-close btn-close-white" id="createMemberBtn-close"
data-bs-dismiss="modal" aria-label="Close"></button>
</div>
</div>
</div>
</div>
</div>
<div class="mt-n5 mb-4 pt-2 text-center">
<div class="position-relative d-inline-block">
<div class="position-absolute bottom-0 end-0">
<label for="member-image-input" class="mb-0" data-bs-toggle="tooltip"
data-bs-placement="right" aria-label="Select Member Image"
data-bs-original-title="Select Member Image">
<div class="avatar-xs">
<div class="avatar-title bg-light rounded-circle text-muted cursor-pointer border">
<i class="ri-image-fill"></i>
</div>
</div>
</label>
<input class="form-control d-none" value="" id="member-image-input"
type="file" accept="image/png, image/gif, image/jpeg">
</div>
<div class="avatar-lg">
<div class="avatar-title bg-light rounded-circle">
<img src="assets/images/users/user-dummy-img.jpg" id="member-img"
class="avatar-md rounded-circle h-auto">
</div>
</div>
</div>
</div>
<div class="mb-3">
<label for="teammembersName" class="form-label">Name</label>
<input type="text" class="form-control" id="teammembersName" placeholder="Enter name"
required="">
<div class="invalid-feedback">Please Enter a member name.</div>
</div>
<div class="mb-4">
<label for="designation" class="form-label">Designation</label>
<input type="text" class="form-control" id="designation"
placeholder="Enter designation" required="">
<div class="invalid-feedback">Please Enter a designation.</div>
</div>
<input type="hidden" id="project-input" class="form-control" value="">
<input type="hidden" id="task-input" class="form-control" value="">
<div class="hstack justify-content-end gap-2">
<button type="button" class="btn btn-light" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-success" id="addNewMember">Add Member</button>
</div>
</div>
</div>
</form>
</div>
</div>
<!--end modal-content-->
</div>
<!--end modal-dialog-->
</div>
<!--end modal-->
<div class="offcanvas offcanvas-end border-0" tabindex="-1" id="member-overview">
<!--end offcanvas-header-->
<div class="offcanvas-body profile-offcanvas p-0">
<div class="team-cover">
<img src="assets/images/small/img-9.jpg" alt="" class="img-fluid">
</div>
<div class="p-3">
<div class="team-settings">
<div class="row">
<div class="col">
<button type="button" class="btn btn-light btn-icon rounded-circle btn-sm favourite-btn"> <i
class="ri-star-fill fs-14"></i> </button>
</div>
<div class="col dropdown text-end">
<a href="javascript:void(0);" id="dropdownMenuLink14" data-bs-toggle="dropdown"
aria-expanded="false">
<i class="ri-more-fill fs-17"></i>
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenuLink14">
<li><a class="dropdown-item" href="javascript:void(0);"><i
class="ri-star-line me-2 align-middle"></i>Favorites</a></li>
<li><a class="dropdown-item" href="javascript:void(0);"><i
class="ri-delete-bin-5-line me-2 align-middle"></i>Delete</a></li>
</ul>
</div>
</div>
</div>
<!--end col-->
</div>
<div class="p-3 text-center">
<img src="assets/images/users/avatar-2.jpg" alt=""
class="avatar-lg img-thumbnail rounded-circle profile-img mx-auto">
<div class="mt-3">
<h5 class="fs-15 profile-name">Nancy Martino</h5>
<p class="text-muted profile-designation">Team Leader &amp; HR</p>
</div>
<div class="hstack justify-content-center mt-4 gap-2">
<div class="avatar-xs">
<a href="javascript:void(0);"
class="avatar-title bg-secondary-subtle text-secondary fs-16 rounded">
<i class="ri-facebook-fill"></i>
</a>
</div>
<div class="avatar-xs">
<a href="javascript:void(0);" class="avatar-title bg-success-subtle text-success fs-16 rounded">
<i class="ri-slack-fill"></i>
</a>
</div>
<div class="avatar-xs">
<a href="javascript:void(0);" class="avatar-title bg-info-subtle text-info fs-16 rounded">
<i class="ri-linkedin-fill"></i>
</a>
</div>
<div class="avatar-xs">
<a href="javascript:void(0);" class="avatar-title bg-danger-subtle text-danger fs-16 rounded">
<i class="ri-dribbble-fill"></i>
</a>
</div>
</div>
</div>
<div class="row g-0 text-center">
<div class="col-6">
<div class="border-start-0 border border-dashed p-3">
<h5 class="profile-project mb-1">124</h5>
<p class="text-muted mb-0">Projects</p>
</div>
</div>
<!--end col-->
<div class="col-6">
<div class="border-start-0 border border-dashed p-3">
<h5 class="profile-task mb-1">81</h5>
<p class="text-muted mb-0">Tasks</p>
</div>
</div>
<!--end col-->
</div>
<!--end row-->
<div class="p-3">
<h5 class="fs-15 mb-3">Personal Details</h5>
<div class="mb-3">
<p class="text-muted text-uppercase fw-semibold fs-12 mb-2">Number</p>
<h6>+(256) 2451 8974</h6>
</div>
<div class="mb-3">
<p class="text-muted text-uppercase fw-semibold fs-12 mb-2">Email</p>
<h6>nancymartino@email.com</h6>
</div>
<div>
<p class="text-muted text-uppercase fw-semibold fs-12 mb-2">Location</p>
<h6 class="mb-0">Carson City - USA</h6>
</div>
</div>
<div class="border-top p-3">
<h5 class="fs-15 mb-4">File Manager</h5>
<div class="d-flex mb-3">
<div class="avatar-xs flex-shrink-0">
<div class="avatar-title bg-danger-subtle text-danger fs-16 rounded">
<i class="ri-image-2-line"></i>
</div>
</div>
<div class="flex-grow-1 ms-3">
<h6 class="mb-1"><a href="javascript:void(0);">Images</a></h6>
<p class="text-muted mb-0">4469 Files</p>
</div>
<div class="text-muted">
12 GB
</div>
</div>
<div class="d-flex mb-3">
<div class="avatar-xs flex-shrink-0">
<div class="avatar-title bg-secondary-subtle text-secondary fs-16 rounded">
<i class="ri-file-zip-line"></i>
</div>
</div>
<div class="flex-grow-1 ms-3">
<h6 class="mb-1"><a href="javascript:void(0);">Documents</a></h6>
<p class="text-muted mb-0">46 Files</p>
</div>
<div class="text-muted">
3.46 GB
</div>
</div>
<div class="d-flex mb-3">
<div class="avatar-xs flex-shrink-0">
<div class="avatar-title bg-success-subtle text-success fs-16 rounded">
<i class="ri-live-line"></i>
</div>
</div>
<div class="flex-grow-1 ms-3">
<h6 class="mb-1"><a href="javascript:void(0);">Media</a></h6>
<p class="text-muted mb-0">124 Files</p>
</div>
<div class="text-muted">
4.3 GB
</div>
</div>
<div class="d-flex">
<div class="avatar-xs flex-shrink-0">
<div class="avatar-title bg-primary-subtle text-primary fs-16 rounded">
<i class="ri-error-warning-line"></i>
</div>
</div>
<div class="flex-grow-1 ms-3">
<h6 class="mb-1"><a href="javascript:void(0);">Others</a></h6>
<p class="text-muted mb-0">18 Files</p>
</div>
<div class="text-muted">
846 MB
</div>
</div>
</div>
</div>
<!--end offcanvas-body-->
<div class="offcanvas-foorter hstack position-relative gap-3 border p-3 text-center">
<button class="btn btn-light w-100"><i class="ri-question-answer-fill ms-1 align-bottom"></i> Send
Message</button>
<a href="pages-profile.html" class="btn btn-primary w-100"><i
class="ri-user-3-fill ms-1 align-bottom"></i> View Profile</a>
</div>
</div>
<!--end offcanvas-->
</div> </div>
</div><!-- end col --> </div><!-- end col -->
</div> </div>

View File

@ -4,21 +4,7 @@
<div class="page-content"> <div class="page-content">
<div class="container-fluid"> <div class="container-fluid">
<!-- start page title --> <!-- start page title -->
<div class="row"> @include('layouts.partials.breadcrumb', ['title' => $title])
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">{{ $title }}</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">{{ $title }}</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title --> <!-- end page title -->
<div class="row"> <div class="row">
<div class="col-lg-8"> <div class="col-lg-8">

View File

@ -84,8 +84,9 @@
<a href="{{ route('leave.edit', $leave->leave_id) }}" <a href="{{ route('leave.edit', $leave->leave_id) }}"
class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a> class="link-success fs-15 edit-item-btn"><i class="ri-edit-2-line"></i></a>
<a href="{{ route('leave.destroy', $leave->leave_id) }}" data-id="{{ $leave->leave_id }}" <a href="javascript:void(0);" data-link="{{ route('leave.destroy', $leave->leave_id) }}"
class="link-danger fs-15 remove-item-btn"><i class="ri-delete-bin-line"></i></a> data-id="{{ $leave->leave_id }}" class="link-danger fs-15 remove-item-btn"><i
class="ri-delete-bin-line"></i></a>
</div> </div>
</td> </td>
@ -98,48 +99,10 @@
</div> </div>
</div> </div>
</div> </div>
</div><!--end row--> </div>
<!--end row-->
</div> </div>
<!-- container-fluid -->
</div> </div>
<!-- container-fluid -->
@include('leave::partials.view') @include('leave::partials.view')
@endsection @endsection
@push('js')
<script>
$('.remove-item-btn').on('click', function(e) {
e.preventDefault();
let url = $(this).attr('href');
let id = $(this).data('id');
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: url,
type: 'DELETE',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: {
id: id
},
success: function(response) {
location.reload();
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
}
});
}
});
});
</script>
@endpush

View File

@ -0,0 +1,72 @@
<?php
namespace Modules\User\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$data = User::latest()->get();
$editable = false;
return view('user::index', compact('data', 'editable'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = "Create User";
return view('user::create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
//
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('user::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = "Edit User";
$data['user'] = User::findOrFail($id);
return view('user::edit', $data);
}
/**
* 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

View File

View File

View File

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

View File

@ -0,0 +1,114 @@
<?php
namespace Modules\User\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
class UserServiceProvider extends ServiceProvider
{
protected string $moduleName = 'User';
protected string $moduleNameLower = 'user';
/**
* Boot the application events.
*/
public function boot(): void
{
$this->registerCommands();
$this->registerCommandSchedules();
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
}
/**
* Register the service provider.
*/
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
}
/**
* 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

View File

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

View File

View File

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

View File

View File

View File

@ -0,0 +1,16 @@
<?php
namespace Modules\User\database\seeders;
use Illuminate\Database\Seeder;
class UserDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
}
}

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

@ -0,0 +1,11 @@
{
"name": "User",
"alias": "user",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\User\\Providers\\UserServiceProvider"
],
"files": []
}

15
Modules/User/package.json Normal file
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,44 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">{{ $title }}</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">{{ $title }}</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<form action="{{ route('user.store') }}" class="needs-validation" novalidate method="post">
@csrf
@include('user::partials.action', ['btnType' => 'Save'])
</form>
</div>
</div>
</div>
</div>
<!--end row-->
</div>
<!-- container-fluid -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,44 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">{{ $title }}</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">{{ $title }}</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<form action="{{ route('user.store') }}" class="needs-validation" novalidate method="post">
@csrf
@include('user::partials.action', ['btnType' => 'Save'])
</form>
</div>
</div>
</div>
</div>
<!--end row-->
</div>
<!-- container-fluid -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,73 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h4>{{ label('Users List') }}</h4>
<a href="{{ route('user.create') }}" class="btn btn-info"><span>{{ label('Create New') }}</span></a>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="buttons-datatables" class="display table-sm table-bordered table" style="width:100%">
<thead class="">
<tr>
<th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Name') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Email') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('User Name') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Role') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Branch') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Employee') }}</span></th>
<th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
</th>
</tr>
</thead>
<tbody>
@php
$i = 1;
@endphp
@foreach ($data as $item)
<tr data-id="{{ $item->id }}" data-display_order="{{ $item->display_order }}"
class="draggable-row">
<td class="tb-col">{{ $i++ }}</td>
<td class="tb-col">{{ $item->name }}</td>
<td class="tb-col">{{ $item->email }}</td>
<td class="tb-col">{{ $item->username }}</td>
<td class="tb-col">{!! getFieldData('tbl_roles', 'title', 'role_id', $item->roles_id) !!}
<td class="tb-col">{!! getFieldData('tbl_branches', 'title', 'branch_id', $item->branches_id) !!}
<td class="tb-col">{!! getFieldData('tbl_employees', 'title', 'employee_id', $item->employees_id) !!}
</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-line"></i>
</a>
<a href="{{ route('user.edit', $item->id) }}" class="link-success fs-15 edit-item-btn"><i
class="ri-edit-2-line"></i></a>
<a href="javascript:void(0);" data-link="{{ route('user.destroy', $item->id) }}"
data-id="{{ $item->id }}" class="link-danger fs-15 remove-item-btn"><i
class="ri-delete-bin-line"></i></a>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@include('user::partials.view')
@endsection

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>User Module - {{ config('app.name', 'Laravel') }}</title>
<meta name="description" content="{{ $description ?? '' }}">
<meta name="keywords" content="{{ $keywords ?? '' }}">
<meta name="author" content="{{ $author ?? '' }}">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
{{-- Vite CSS --}}
{{-- {{ module_vite('build-user', 'resources/assets/sass/app.scss') }} --}}
</head>
<body>
@yield('content')
{{-- Vite JS --}}
{{-- {{ module_vite('build-user', 'resources/assets/js/app.js') }} --}}
</body>

View File

@ -0,0 +1,23 @@
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" id="name" placeholder="Enter name" name="name"
value="{{ old('end_date', $leave->name ?? '') }}" required>
<div class="invalid-feedback">
Please enter employee name.
</div>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="text" class="form-control" id="email" name="email"
value="{{ old('email', $leave->email ?? '') }}">
</div>
<div class="text-end">
<button type="submit" class="btn btn-primary">{{ $btnType }}</button>
</div>
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,16 @@
<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 User</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form action="{{ route('user.store') }}" class="needs-validation" novalidate method="post">
@csrf
@include('user::partials.action', ['btnType' => 'View'])
</form>
</div>
</div>
</div>
</div>

View File

View File

@ -0,0 +1,19 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\User\Http\Controllers\UserController;
/*
*--------------------------------------------------------------------------
* API Routes
*--------------------------------------------------------------------------
*
* Here is where you can register API routes for your application. These
* routes are loaded by the RouteServiceProvider within a group which
* is assigned the "api" middleware group. Enjoy building your API!
*
*/
Route::middleware(['auth:sanctum'])->prefix('v1')->group(function () {
Route::apiResource('user', UserController::class)->names('user');
});

View File

@ -0,0 +1,19 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\User\Http\Controllers\UserController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::group([], function () {
Route::resource('user', UserController::class)->names('user');
});

View File

@ -0,0 +1,26 @@
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
build: {
outDir: '../../public/build-user',
emptyOutDir: true,
manifest: true,
},
plugins: [
laravel({
publicDirectory: '../../public',
buildDirectory: 'build-user',
input: [
__dirname + '/resources/assets/sass/app.scss',
__dirname + '/resources/assets/js/app.js'
],
refresh: true,
}),
],
});
//export const paths = [
// 'Modules/User/resources/assets/sass/app.scss',
// 'Modules/User/resources/assets/js/app.js',
//];

View File

@ -1,218 +1,211 @@
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Countries;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use App\Service\CommonModelService;
use Log;
use Exception;
class CountriesController extends Controller use App\Http\Controllers\Controller;
{ use App\Models\Country\Country;
protected $modelService; use App\Service\CommonModelService;
public function __construct(Countries $model) use Exception;
{ use Illuminate\Http\Request;
$this->modelService = new CommonModelService($model); use Illuminate\Support\Facades\DB;
} use Illuminate\Support\Facades\Validator;
public function index(Request $request) use Log;
{
createActivityLog(CountriesController::class, 'index', ' Countries index');
$data = Countries::where('status','<>',-1)->orderBy('display_order')->get();
return view("crud.generated.countries.index", compact('data'));
}
public function create(Request $request) class CountriesController extends Controller
{ {
createActivityLog(CountriesController::class, 'create', ' Countries create'); protected $modelService;
$TableData = Countries::where('status','<>',-1)->orderBy('display_order')->get(); public function __construct(Country $model)
$editable=false; {
return view("crud.generated.countries.edit",compact('TableData','editable')); $this->modelService = new CommonModelService($model);
} }
public function index(Request $request)
{
// createActivityLog(CountriesController::class, 'index', ' Country index');
$data = Country::where('status', '<>', -1)->orderBy('display_order')->get();
public function store(Request $request) return view("crud.generated.countries.index", compact('data'));
{ }
createActivityLog(CountriesController::class, 'store', ' Countries store');
$validator = Validator::make($request->all(), [
//ADD REQUIRED FIELDS FOR VALIDATION
]);
if ($validator->fails()) { public function create(Request $request)
return response()->json([ {
'error' => $validator->errors(), // createActivityLog(CountriesController::class, 'create', ' Country create');
],500); $TableData = Country::where('status', '<>', -1)->orderBy('display_order')->get();
} $editable = false;
$request->request->add(['alias' => slugify($request->title)]); return view("crud.generated.countries.edit", compact('TableData', 'editable'));
$request->request->add(['display_order' => getDisplayOrder('tbl_countries')]); }
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
$requestData=$request->all();
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL').'/', '', $value);
});
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL'), '', $value);
});
DB::beginTransaction();
try {
$operationNumber = getOperationNumber();
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
} catch (\Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'store', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
if ($request->ajax()) {
return response()->json(['status' => true, 'message' => 'The Countries Created Successfully.'], 200);
}
return redirect()->route('countries.index')->with('success','The Countries created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Countries::find($id);
$companyArticle->display_order = $index + 1;
$companyArticle->save();
}
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
}
public function updatealias(Request $request)
{
$articleId = $request->input('articleId');
$newAlias = $request->input('newAlias');
$companyArticle = Countries::find($articleId);
if (!$companyArticle) {
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
}
$companyArticle->alias = $newAlias;
$companyArticle->save();
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
}
public function show(Request $request, $id) public function store(Request $request)
{ {
createActivityLog(CountriesController::class, 'show', ' Countries show'); // createActivityLog(CountriesController::class, 'store', ' Country store');
$data = Countries::findOrFail($id); $validator = Validator::make($request->all(), [
//ADD REQUIRED FIELDS FOR VALIDATION
return view("crud.generated.countries.show", compact('data')); ]);
}
if ($validator->fails()) {
public function edit(Request $request, $id) return response()->json([
{ 'error' => $validator->errors(),
createActivityLog(CountriesController::class, 'edit', ' Countries edit'); ], 500);
$TableData = Countries::where('status','<>',-1)->orderBy('display_order')->get();
$data = Countries::findOrFail($id);
$editable=true;
return view("crud.generated.countries.edit", compact('data','TableData','editable'));
}
public function update(Request $request, $id)
{
createActivityLog(CountriesController::class, 'update', ' Countries update');
$validator = Validator::make($request->all(), [
//ADD VALIDATION FOR REQIRED FIELDS
]);
if ($validator->fails()) {
return response()->json([
'error' => $validator->errors(),
],500);
}
$requestData=$request->all();
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL').'/', '', $value);
});
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL'), '', $value);
});
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('country_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'update', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
if ($request->ajax()) {
return response()->json(['status' => true, 'message' => 'The Countries updated Successfully.'], 200);
}
// return redirect()->route('countries.index')->with('success','The Countries updated Successfully.');
return redirect()->back()->with('success', 'The Countries updated successfully.');
}
public function destroy(Request $request,$id)
{
createActivityLog(CountriesController::class, 'destroy', ' Countries destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Countries Deleted Successfully.'],200);
}
public function toggle(Request $request,$id)
{
createActivityLog(CountriesController::class, 'destroy', ' Countries destroy');
$data = Countries::findOrFail($id);
$requestData=['status'=>($data->status==1)?0:1];
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Countries Deleted Successfully.'],200);
}
public function clone(Request $request,$id)
{
createActivityLog(CountriesController::class, 'clone', ' Countries clone');
$data = Countries::findOrFail($id);
unset($data['updatedby']);
unset($data['createdby']);
$requestData=$data->toArray();
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->create($OperationNumber, $OperationNumber, null, $requestData);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status'=>true,'message'=>'The Countries Clonned Successfully.'],200);
}
} }
$request->request->add(['alias' => slugify($request->title)]);
$request->request->add(['display_order' => getDisplayOrder('tbl_countries')]);
$request->request->add(['created_at' => date("Y-m-d h:i:s")]);
$request->request->add(['updated_at' => date("Y-m-d h:i:s")]);
$requestData = $request->all();
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL') . '/', '', $value);
});
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL'), '', $value);
});
DB::beginTransaction();
try {
$operationNumber = getOperationNumber();
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
} catch (\Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'store', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
if ($request->ajax()) {
return response()->json(['status' => true, 'message' => 'The Country Created Successfully.'], 200);
}
return redirect()->route('countries.index')->with('success', 'The Country created Successfully.');
}
public function sort(Request $request)
{
$idOrder = $request->input('id_order');
foreach ($idOrder as $index => $id) {
$companyArticle = Country::find($id);
$companyArticle->display_order = $index + 1;
$companyArticle->save();
}
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
}
public function updatealias(Request $request)
{
$articleId = $request->input('articleId');
$newAlias = $request->input('newAlias');
$companyArticle = Country::find($articleId);
if (!$companyArticle) {
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
}
$companyArticle->alias = $newAlias;
$companyArticle->save();
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
}
public function show(Request $request, $id)
{
// createActivityLog(CountriesController::class, 'show', ' Country show');
$data = Country::findOrFail($id);
return view("crud.generated.countries.show", compact('data'));
}
public function edit(Request $request, $id)
{
// createActivityLog(CountriesController::class, 'edit', ' Country edit');
$TableData = Country::where('status', '<>', -1)->orderBy('display_order')->get();
$data = Country::findOrFail($id);
$editable = true;
return view("crud.generated.countries.edit", compact('data', 'TableData', 'editable'));
}
public function update(Request $request, $id)
{
// createActivityLog(CountriesController::class, 'update', ' Country update');
$validator = Validator::make($request->all(), [
//ADD VALIDATION FOR REQIRED FIELDS
]);
if ($validator->fails()) {
return response()->json([
'error' => $validator->errors(),
], 500);
}
$requestData = $request->all();
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL') . '/', '', $value);
});
array_walk_recursive($requestData, function (&$value) {
$value = str_replace(env('APP_URL'), '', $value);
});
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('country_id'));
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'update', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
if ($request->ajax()) {
return response()->json(['status' => true, 'message' => 'The Country updated Successfully.'], 200);
}
// return redirect()->route('countries.index')->with('success','The Country updated Successfully.');
return redirect()->back()->with('success', 'The Country updated successfully.');
}
public function destroy(Request $request, $id)
{
// createActivityLog(CountriesController::class, 'destroy', ' Country destroy');
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Country Deleted Successfully.'], 200);
}
public function toggle(Request $request, $id)
{
// createActivityLog(CountriesController::class, 'destroy', ' Country destroy');
$data = Country::findOrFail($id);
$requestData = ['status' => ($data->status == 1) ? 0 : 1];
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'destroy', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Country Deleted Successfully.'], 200);
}
public function clone (Request $request, $id)
{
// createActivityLog(CountriesController::class, 'clone', ' Country clone');
$data = Country::findOrFail($id);
unset($data['updatedby']);
unset($data['createdby']);
$requestData = $data->toArray();
DB::beginTransaction();
try {
$OperationNumber = getOperationNumber();
$this->modelService->create($OperationNumber, $OperationNumber, null, $requestData);
} catch (Exception $e) {
DB::rollBack();
Log::info($e->getMessage());
createErrorLog(CountriesController::class, 'clone', $e->getMessage());
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
}
DB::commit();
return response()->json(['status' => true, 'message' => 'The Country Clonned Successfully.'], 200);
}
}

View File

@ -2,7 +2,6 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Helpers\BibClass;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Exception; use Exception;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -41,7 +40,7 @@ class GeneralFormController extends Controller
'icon', 'icon',
'favicon', 'favicon',
'og_image', 'og_image',
'no_image' 'no_image',
); );
self::$textEditorFields = array('details', 'description', 'text', 'qualification', 'experience', 'required_documents', 'biodata', 'privacy_policy', 'content1', 'content2', 'content3'); self::$textEditorFields = array('details', 'description', 'text', 'qualification', 'experience', 'required_documents', 'biodata', 'privacy_policy', 'content1', 'content2', 'content3');
self::$textAreaFields = array('copyright', 'remarks', 'seo_keywords', 'seo_description', 'seo_descriptions', 'intro', 'meta_tags', 'google_map', 'og_tags'); self::$textAreaFields = array('copyright', 'remarks', 'seo_keywords', 'seo_description', 'seo_descriptions', 'intro', 'meta_tags', 'google_map', 'og_tags');
@ -67,10 +66,10 @@ class GeneralFormController extends Controller
$databasdeName = DB::connection()->getDatabaseName(); $databasdeName = DB::connection()->getDatabaseName();
$allTables = []; $allTables = [];
foreach ($tables as $table) { foreach ($tables as $table) {
$table_field = "Tables_in_$databasdeName"; $table_field = "Tables_in_$databasdeName";
// dd($table->$table_field); // dd($table->$table_field);
if(strpos($table->$table_field,"_logs")){continue;} if (strpos($table->$table_field, "_logs")) {continue;}
$allTables[$table->$table_field] = $table->$table_field; $allTables[$table->$table_field] = $table->$table_field;
} }
return view('crud.form.create', compact('allTables')); return view('crud.form.create', compact('allTables'));
@ -79,7 +78,6 @@ class GeneralFormController extends Controller
} }
} }
public function store(Request $request) public function store(Request $request)
{ {
// dd($request->all()); // dd($request->all());
@ -111,8 +109,6 @@ class GeneralFormController extends Controller
$data['TableRows'] = DB::select("select * from " . $data['TableName']); $data['TableRows'] = DB::select("select * from " . $data['TableName']);
return view("crud.settings.dictonary", $data); return view("crud.settings.dictonary", $data);
case 'curd': case 'curd':
$data['tableName'] = $tableName; $data['tableName'] = $tableName;
$data['directoryName'] = $directoryName; $data['directoryName'] = $directoryName;
@ -162,7 +158,7 @@ class GeneralFormController extends Controller
$string = '_id'; $string = '_id';
$foreign = []; $foreign = [];
foreach ($all_columns as $key => $column) { foreach ($all_columns as $key => $column) {
if (str_contains($column, $string) !== FALSE) { // Yoshi version if (str_contains($column, $string) !== false) { // Yoshi version
$foreign[] = $column; $foreign[] = $column;
} }
} }
@ -188,8 +184,6 @@ class GeneralFormController extends Controller
return array_column(DB::select("SHOW COLUMNS FROM $TableName"), 'Field'); return array_column(DB::select("SHOW COLUMNS FROM $TableName"), 'Field');
} }
public static function ajaxShowContent($TableName, $directoryName) public static function ajaxShowContent($TableName, $directoryName)
{ {
$TableName = strtolower($TableName); $TableName = strtolower($TableName);
@ -206,20 +200,23 @@ class GeneralFormController extends Controller
$Table_pk = str_replace("tbl_", "", $TableName) . "_id"; $Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName)); $title = ucwords(str_replace("tbl_", "", $TableName));
$showContent = " $showContent = "
"; ";
foreach ($TableCols as $key => $TableCol): foreach ($TableCols as $key => $TableCol):
$TableCol = $TableCol->Field; $TableCol = $TableCol->Field;
if ($key == 0 || $TableCol == 'createdOn' || $TableCol == 'createdBy' || $TableCol == 'updatedBy' || $TableCol == 'created_at' || $TableCol == 'updated_at') if ($key == 0 || $TableCol == 'createdOn' || $TableCol == 'createdBy' || $TableCol == 'updatedBy' || $TableCol == 'created_at' || $TableCol == 'updated_at') {
continue; continue;
}
$TableColLabel = ucwords(str_replace("_", " ", $TableCol)); $TableColLabel = ucwords(str_replace("_", " ", $TableCol));
if ($TableCol == 'status') if ($TableCol == 'status') {
$showContent .= "<p><b>Status :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span $showContent .= "<p><b>Status :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span
class=\"{{\$data->$TableCol == 1 ? 'text-success' : 'text-danger'}}\">{{\$data->$TableCol == 1 ? 'Active' : 'Inactive'}}</span></p>"; class=\"{{\$data->$TableCol == 1 ? 'text-success' : 'text-danger'}}\">{{\$data->$TableCol == 1 ? 'Active' : 'Inactive'}}</span></p>";
else } else {
$showContent .= '<p><b>' . $TableColLabel . " :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{\$data->$TableCol}}</span></p>"; $showContent .= '<p><b>' . $TableColLabel . " :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{\$data->$TableCol}}</span></p>";
}
endforeach; endforeach;
$showContent .= "<div class=\"d-flex justify-content-between\"> $showContent .= "<div class=\"d-flex justify-content-between\">
@ -257,12 +254,12 @@ class GeneralFormController extends Controller
$Table_pk = $all_columns[0]; $Table_pk = $all_columns[0];
$all_foreign_table = self::getForeignTable($all_columns); $all_foreign_table = self::getForeignTable($all_columns);
$all_foreignKey = []; $all_foreignKey = [];
if ($all_foreign_table) if ($all_foreign_table) {
foreach ($all_foreign_table as $key => $tablename) { foreach ($all_foreign_table as $key => $tablename) {
$all_foreignKey[$tablename] = self::getTableColumns($tablename); $all_foreignKey[$tablename] = self::getTableColumns($tablename);
$all_foreignKey[$tablename] = $all_foreignKey[$tablename][0] ?? null; $all_foreignKey[$tablename] = $all_foreignKey[$tablename][0] ?? null;
} }
}
$editContent = " $editContent = "
<form action=\"{{\$editable?route('$routeName.update',[\$data->$Table_pk]):route('$routeName.store')}}\" id=\"updateCustomForm\" method=\"POST\" >\n @csrf "; <form action=\"{{\$editable?route('$routeName.update',[\$data->$Table_pk]):route('$routeName.store')}}\" id=\"updateCustomForm\" method=\"POST\" >\n @csrf ";
@ -283,7 +280,7 @@ class GeneralFormController extends Controller
$editContent .= "{{createCustomSelect('$TableName', 'title', '" . $TableCols[0]->Field . "', \$editable?\$data->$TableCol:'', '" . $TableColLabel . "','$TableCol', 'form-control select2','status<>-1')}}"; $editContent .= "{{createCustomSelect('$TableName', 'title', '" . $TableCols[0]->Field . "', \$editable?\$data->$TableCol:'', '" . $TableColLabel . "','$TableCol', 'form-control select2','status<>-1')}}";
$editContent .= "</div>"; $editContent .= "</div>";
break; break;
case (strpos($TableCol, "s_id") !== false): //CASE TO HANDLE FOREIGN TABLE case (strpos($TableCol, "s_id") !== false): //CASE TO HANDLE FOREIGN TABLE
$FTNameRaw = str_replace("s_id", "s", $TableCol); $FTNameRaw = str_replace("s_id", "s", $TableCol);
$FTName = "tbl_" . str_replace("s_id", "s", $TableCol); $FTName = "tbl_" . str_replace("s_id", "s", $TableCol);
$FTCols = DB::select("describe " . $FTName); $FTCols = DB::select("describe " . $FTName);
@ -325,7 +322,6 @@ class GeneralFormController extends Controller
} }
} }
endforeach; endforeach;
$editContent .= ' <div class="col-md-12">'; $editContent .= ' <div class="col-md-12">';
$editContent .= "<?php createButton(\"btn-primary btn-update\",\"\",\"Submit\"); ?>\n"; $editContent .= "<?php createButton(\"btn-primary btn-update\",\"\",\"Submit\"); ?>\n";
@ -333,8 +329,6 @@ class GeneralFormController extends Controller
$editContent .= "</div>"; $editContent .= "</div>";
$editContent .= " </form>"; $editContent .= " </form>";
return $editContent; return $editContent;
} //end of ajaxEditContent method } //end of ajaxEditContent method
public static function editContent($TableName, $directoryName) public static function editContent($TableName, $directoryName)
@ -352,7 +346,7 @@ class GeneralFormController extends Controller
$folder .= str_replace("tbl_", "", $TableName); $folder .= str_replace("tbl_", "", $TableName);
$Table_pk = str_replace("tbl_", "", $TableName) . "_id"; $Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName)); $title = ucwords(str_replace("tbl_", "", $TableName));
$editContent = "@extends('backend.template') $editContent = "@extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
@ -392,7 +386,7 @@ class GeneralFormController extends Controller
$Table_pk = str_replace("tbl_", "", $TableName) . "_id"; $Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName)); $title = ucwords(str_replace("tbl_", "", $TableName));
$addContent = "@extends('backend.template') $addContent = "@extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
@ -418,96 +412,95 @@ class GeneralFormController extends Controller
/* /*
public static function ajaxAddContent($TableName, $directoryName) public static function ajaxAddContent($TableName, $directoryName)
{ {
$TableName = strtolower($TableName); $TableName = strtolower($TableName);
$TableCols = DB::select("describe " . $TableName); $TableCols = DB::select("describe " . $TableName);
$TableRows = DB::select("select * from " . $TableName); $TableRows = DB::select("select * from " . $TableName);
$folder = ''; $folder = '';
$routeName = ''; $routeName = '';
if (!empty($directoryName)) { if (!empty($directoryName)) {
$folder .= strtolower($directoryName) . '/'; $folder .= strtolower($directoryName) . '/';
$routeName .= strtolower($directoryName) . '.'; $routeName .= strtolower($directoryName) . '.';
} }
$routeName .= strtolower(str_replace("tbl_", "", $TableName)); $routeName .= strtolower(str_replace("tbl_", "", $TableName));
$folder .= str_replace("tbl_", "", $TableName); $folder .= str_replace("tbl_", "", $TableName);
$Table_pk = str_replace("tbl_", "", $TableName) . "_id"; $Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName)); $title = ucwords(str_replace("tbl_", "", $TableName));
$all_columns = self::getTableColumns($TableName); $all_columns = self::getTableColumns($TableName);
$all_foreign_table = self::getForeignTable($all_columns); $all_foreign_table = self::getForeignTable($all_columns);
$all_foreignKey = []; $all_foreignKey = [];
if ($all_foreign_table) if ($all_foreign_table)
foreach ($all_foreign_table as $key => $tablename) { foreach ($all_foreign_table as $key => $tablename) {
$all_foreignKey[$tablename] = self::getTableColumns($tablename); $all_foreignKey[$tablename] = self::getTableColumns($tablename);
$all_foreignKey[$tablename] = $all_foreignKey[$tablename][0] ?? null; $all_foreignKey[$tablename] = $all_foreignKey[$tablename][0] ?? null;
} }
$addContent = " $addContent = "
<form action=\"{{\$editable?route('$routeName.update',[\$data->$Table_pk]):route('$routeName.store')}}\" id=\"storeCustomForm\" method=\"POST\">\n @csrf \n"; <form action=\"{{\$editable?route('$routeName.update',[\$data->$Table_pk]):route('$routeName.store')}}\" id=\"storeCustomForm\" method=\"POST\">\n @csrf \n";
$addContent .= '<div class="row">'; $addContent .= '<div class="row">';
foreach ($TableCols as $key => $TableCol): foreach ($TableCols as $key => $TableCol):
$TableCol = $TableCol->Field; $TableCol = $TableCol->Field;
if (!in_array($TableCol, self::$HiddenCols)) { if (!in_array($TableCol, self::$HiddenCols)) {
$TableColLabel = ucwords(str_replace("_", " ", $TableCol)); $TableColLabel = ucwords(str_replace("_", " ", $TableCol));
switch ($TableCol) { switch ($TableCol) {
case $TableCols[0]->Field: case $TableCols[0]->Field:
break; break;
case (strpos($TableCol, "parent_") !== false): case (strpos($TableCol, "parent_") !== false):
$addContent .= '<div class="col-lg-6">'; $addContent .= '<div class="col-lg-6">';
$addContent .= "{{createCustomSelect('$TableName', 'title', '" . $TableCols[0]->Field . "', '', '" . $TableColLabel . "','$TableCol', 'form-control select2','status<>-1')}}"; $addContent .= "{{createCustomSelect('$TableName', 'title', '" . $TableCols[0]->Field . "', '', '" . $TableColLabel . "','$TableCol', 'form-control select2','status<>-1')}}";
$addContent .= "</div>"; $addContent .= "</div>";
break; break;
case (strpos($TableCol, "s_id") !== false): //CASE TO HANDLE FOREIGN TABLE case (strpos($TableCol, "s_id") !== false): //CASE TO HANDLE FOREIGN TABLE
$FTNameRaw = str_replace("s_id", "s", $TableCol); $FTNameRaw = str_replace("s_id", "s", $TableCol);
$FTName = "tbl_" . str_replace("s_id", "s", $TableCol); $FTName = "tbl_" . str_replace("s_id", "s", $TableCol);
$FTCols = DB::select("describe " . $FTName); $FTCols = DB::select("describe " . $FTName);
$addContent .= '<div class="col-lg-6">'; $addContent .= '<div class="col-lg-6">';
//createCustomSelect($tableName, $fieldNameToDisplay, $fieldNameForValue, $defaultValueSelected, $displayTextForLabel, $HTMLElementName, $additionalClass = "form-control", $defaultCondition = null) //createCustomSelect($tableName, $fieldNameToDisplay, $fieldNameForValue, $defaultValueSelected, $displayTextForLabel, $HTMLElementName, $additionalClass = "form-control", $defaultCondition = null)
$addContent .= "{{createCustomSelect('$FTName', 'title', '" . $FTCols[0]->Field . "', '', '" . $TableColLabel . "','$TableCol', 'form-control select2','status<>-1')}}"; $addContent .= "{{createCustomSelect('$FTName', 'title', '" . $FTCols[0]->Field . "', '', '" . $TableColLabel . "','$TableCol', 'form-control select2','status<>-1')}}";
$addContent .= "</div>"; $addContent .= "</div>";
break; break;
case (in_array($TableCol, self::$textEditorFields)): case (in_array($TableCol, self::$textEditorFields)):
$addContent .= '<div class="col-lg-12 pb-2">'; $addContent .= '<div class="col-lg-12 pb-2">';
$addContent .= "{{createTextarea(\"$TableCol\",\"$TableCol ckeditor-classic\",\"$TableColLabel\")}}\n"; $addContent .= "{{createTextarea(\"$TableCol\",\"$TableCol ckeditor-classic\",\"$TableColLabel\")}}\n";
$addContent .= "</div>"; $addContent .= "</div>";
break; break;
case (in_array($TableCol, self::$textAreaFields)): case (in_array($TableCol, self::$textAreaFields)):
$addContent .= '<div class="col-lg-12 pb-2">'; $addContent .= '<div class="col-lg-12 pb-2">';
$addContent .= "{{createPlainTextArea(\"$TableCol\",\"$TableCol \",\"$TableColLabel\")}}\n"; $addContent .= "{{createPlainTextArea(\"$TableCol\",\"$TableCol \",\"$TableColLabel\")}}\n";
$addContent .= "</div>"; $addContent .= "</div>";
break; break;
case (in_array($TableCol, self::$imageFields)): case (in_array($TableCol, self::$imageFields)):
$addContent .= '<div class="col-lg-12 pb-2">'; $addContent .= '<div class="col-lg-12 pb-2">';
$addContent .= "{{createImageInput(\"$TableCol\",\"$TableColLabel\")}}\n"; $addContent .= "{{createImageInput(\"$TableCol\",\"$TableColLabel\")}}\n";
$addContent .= "</div>"; $addContent .= "</div>";
break; break;
case (in_array($TableCol, self::$dateFields)): case (in_array($TableCol, self::$dateFields)):
$addContent .= '<div class="col-lg-6 pb-2">'; $addContent .= '<div class="col-lg-6 pb-2">';
$addContent .= "{{createDate(\"$TableCol\",\"$TableColLabel\",'',date('Y-m-d'))}}\n"; //createDate($name, $display = "",$class = "datepicker", $default = "") $addContent .= "{{createDate(\"$TableCol\",\"$TableColLabel\",'',date('Y-m-d'))}}\n"; //createDate($name, $display = "",$class = "datepicker", $default = "")
$addContent .= "</div>"; $addContent .= "</div>";
break; break;
case (in_array($TableCol, self::$passwordFields)): case (in_array($TableCol, self::$passwordFields)):
$addContent .= '<div class="col-lg-6 pb-2">'; $addContent .= '<div class="col-lg-6 pb-2">';
$addContent .= "{{createPassword(\"$TableCol\",\"$TableColLabel\",'')}}\n"; //createDate($name, $display = "",$class = "datepicker", $default = "") $addContent .= "{{createPassword(\"$TableCol\",\"$TableColLabel\",'')}}\n"; //createDate($name, $display = "",$class = "datepicker", $default = "")
$addContent .= "</div>"; $addContent .= "</div>";
break; break;
default: default:
$addContent .= '<div class="col-lg-6">'; $addContent .= '<div class="col-lg-6">';
$addContent .= "{{createText(\"$TableCol\",\"$TableCol\",\"$TableColLabel\")}}\n"; $addContent .= "{{createText(\"$TableCol\",\"$TableCol\",\"$TableColLabel\")}}\n";
$addContent .= "</div>"; $addContent .= "</div>";
} }
} }
endforeach; endforeach;
$addContent .= ' <br> <div class="col-md-12">'; $addContent .= ' <br> <div class="col-md-12">';
$addContent .= "<?php createButton(\"btn-primary btn-store\",\"\",\"Submit\"); ?>\n"; $addContent .= "<?php createButton(\"btn-primary btn-store\",\"\",\"Submit\"); ?>\n";
$addContent .= "<?php createButton(\"btn-primary btn-cancel\",\"\",\"Cancel\",route('$routeName.index')); ?>\n"; $addContent .= "<?php createButton(\"btn-primary btn-cancel\",\"\",\"Cancel\",route('$routeName.index')); ?>\n";
$addContent .= "</div>"; $addContent .= "</div>";
$addContent .= " </form>"; $addContent .= " </form>";
return $addContent;
return $addContent;
} //End of ajax addContent } //End of ajax addContent
*/ */
public static function showContent($TableName, $directoryName) public static function showContent($TableName, $directoryName)
{ {
$TableName = strtolower($TableName); $TableName = strtolower($TableName);
@ -524,7 +517,7 @@ class GeneralFormController extends Controller
$Table_pk = str_replace("tbl_", "", $TableName) . "_id"; $Table_pk = str_replace("tbl_", "", $TableName) . "_id";
$title = ucwords(str_replace("tbl_", "", $TableName)); $title = ucwords(str_replace("tbl_", "", $TableName));
$showContent = "@extends('backend.template') $showContent = "@extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
@ -537,7 +530,7 @@ class GeneralFormController extends Controller
$showContent .= " $showContent .= "
</div> </div>
</div> </div>
@endSection"; @endSection";
$path = base_path() . "/resources/views/crud/generated/$folder/"; $path = base_path() . "/resources/views/crud/generated/$folder/";
@ -553,7 +546,6 @@ class GeneralFormController extends Controller
return $showContent; return $showContent;
} }
public static function migrationContent($tableName) public static function migrationContent($tableName)
{ {
$tableName = strtolower($tableName); $tableName = strtolower($tableName);
@ -607,7 +599,7 @@ class GeneralFormController extends Controller
$file = fopen(base_path() . "/database/migrations/" . date('Y_m_d_his') . "_create_" . $tableName . "_table.php", 'w'); $file = fopen(base_path() . "/database/migrations/" . date('Y_m_d_his') . "_create_" . $tableName . "_table.php", 'w');
fwrite($file, $contentString); fwrite($file, $contentString);
fclose($file); fclose($file);
*/ */
return $contentString; return $contentString;
} }
@ -653,9 +645,6 @@ class GeneralFormController extends Controller
fclose($file); fclose($file);
} }
return $RouteContent; return $RouteContent;
} }
@ -679,7 +668,7 @@ class GeneralFormController extends Controller
$tableFields = DB::select("describe $TableName"); $tableFields = DB::select("describe $TableName");
$translated = label('' . $title); $translated = label('' . $title);
$HiddenColumns = array($primaryKey, "remarks", "createdon", "createdby", "updatedby", "seo_title", "seo_descriptions", "seo_keywords", "google_map", "seo_description", "og_tags", "created_at", "updated_at", "description", "details", "text", "display_order", "status"); $HiddenColumns = array($primaryKey, "remarks", "createdon", "createdby", "updatedby", "seo_title", "seo_descriptions", "seo_keywords", "google_map", "seo_description", "og_tags", "created_at", "updated_at", "description", "details", "text", "display_order", "status");
$listContent = '@extends(\'backend.template\') $listContent = '@extends(\'layouts.app\')
@section(\'content\') @section(\'content\')
<div class="card"> <div class="card">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="card-header d-flex justify-content-between align-items-center">
@ -694,7 +683,7 @@ class GeneralFormController extends Controller
foreach ($columns as $key => $column) { foreach ($columns as $key => $column) {
if (!in_array($column, $HiddenColumns)) if (!in_array($column, $HiddenColumns)) {
switch ($column) { switch ($column) {
case (strpos($column, "parent_") !== false): case (strpos($column, "parent_") !== false):
$listContent .= '<th class="tb-col"><span class="overline-title">{{ label("Parent") }}</span></th>' . PHP_EOL; $listContent .= '<th class="tb-col"><span class="overline-title">{{ label("Parent") }}</span></th>' . PHP_EOL;
@ -706,6 +695,7 @@ class GeneralFormController extends Controller
default: default:
$listContent .= '<th class="tb-col"><span class="overline-title">{{ label("' . $column . '") }}</span></th>' . PHP_EOL; $listContent .= '<th class="tb-col"><span class="overline-title">{{ label("' . $column . '") }}</span></th>' . PHP_EOL;
} }
}
} }
$listContent .= '<th class="tb-col" data-sortable="false"><span $listContent .= '<th class="tb-col" data-sortable="false"><span
@ -718,7 +708,7 @@ class GeneralFormController extends Controller
$i = 1; $i = 1;
@endphp @endphp
@foreach ($data as $item) @foreach ($data as $item)
<tr data-id="{{$item->' . $columns[0] . '}}" data-display_order="{{$item->display_order}}" class="draggable-row <?php echo ($item->status==0)?"bg-light bg-danger":""; ?>"> <tr data-id="{{$item->' . $columns[0] . '}}" data-display_order="{{$item->display_order}}" class="draggable-row <?php echo ($item->status==0)?"bg-light bg-danger":""; ?>">
<td class="tb-col">{{ $i++ }}</td>'; <td class="tb-col">{{ $i++ }}</td>';
foreach ($columns as $key => $column) { foreach ($columns as $key => $column) {
@ -730,7 +720,7 @@ class GeneralFormController extends Controller
$listContent .= '{!! getFieldData("' . $TableName . '", "title", "' . $columns[0] . '", $item->' . $column . ') !!}' . PHP_EOL; $listContent .= '{!! getFieldData("' . $TableName . '", "title", "' . $columns[0] . '", $item->' . $column . ') !!}' . PHP_EOL;
$listContent .= '</td>' . PHP_EOL; $listContent .= '</td>' . PHP_EOL;
break; break;
case (strpos($column, "s_id") !== false): //CASE TO HANDLE FOREIGN TABLE case (strpos($column, "s_id") !== false): //CASE TO HANDLE FOREIGN TABLE
$FTNameRaw = str_replace("s_id", "s", $column); $FTNameRaw = str_replace("s_id", "s", $column);
$FTName = "tbl_" . str_replace("s_id", "s", $column); $FTName = "tbl_" . str_replace("s_id", "s", $column);
$FTCols = DB::select("describe " . $FTName); $FTCols = DB::select("describe " . $FTName);
@ -774,24 +764,24 @@ class GeneralFormController extends Controller
<a href="{{route(' . "'" . $routeName . 'toggle' . "'" . ',[$item->' . $primaryKey . '])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)"> <a href="{{route(' . "'" . $routeName . 'toggle' . "'" . ',[$item->' . $primaryKey . '])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label(\'Unpublish\'):label(\'Publish\') }} <i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label(\'Unpublish\'):label(\'Publish\') }}
</a> </a>
</li> </li>
<li> <li>
<a href="{{route(' . "'" . $routeName . 'clone' . "'" . ',[$item->' . $primaryKey . '])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)"> <a href="{{route(' . "'" . $routeName . 'clone' . "'" . ',[$item->' . $primaryKey . '])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label(\'Clone\') }} <i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label(\'Clone\') }}
</a> </a>
</li> </li>
<li> <li>
<a href="{{route(' . "'" . $routeName . 'destroy' . "'" . ',[$item->' . $primaryKey . '])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)"> <a href="{{route(' . "'" . $routeName . 'destroy' . "'" . ',[$item->' . $primaryKey . '])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i> {{ label(\'Delete\') }} <i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i> {{ label(\'Delete\') }}
</a> </a>
</li> </li>
</ul> </ul>
</div> </div>
</td> </td>
</tr> </tr>
@ -800,12 +790,12 @@ class GeneralFormController extends Controller
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
@endsection @endsection
@push("css") @push("css")
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
@ -841,7 +831,7 @@ $(document).ready(function(e) {
articleId: articleId, articleId: articleId,
newAlias: newAlias newAlias: newAlias
}; };
$.ajax({ $.ajax({
url: ajaxUrl, url: ajaxUrl,
type: \'POST\', type: \'POST\',
@ -1014,7 +1004,6 @@ function confirmClone(url) {
//ajax complete List //ajax complete List
public static function modelContent($tableName, $directoryName) public static function modelContent($tableName, $directoryName)
{ {
$tableName = strtolower($tableName); $tableName = strtolower($tableName);
@ -1025,7 +1014,6 @@ function confirmClone(url) {
$modelClass = ucfirst(str_replace("tbl_", "", $tableName)); $modelClass = ucfirst(str_replace("tbl_", "", $tableName));
$tableFields = DB::select("describe $tableName"); $tableFields = DB::select("describe $tableName");
$pkField = $tableFields[0]->Field; $pkField = $tableFields[0]->Field;
@ -1052,7 +1040,7 @@ function confirmClone(url) {
class $modelClass extends Model class $modelClass extends Model
{ {
use HasFactory, CreatedUpdatedBy; use HasFactory, CreatedUpdatedBy;
protected \$primaryKey = '$pkField'; protected \$primaryKey = '$pkField';
public \$timestamps = true; public \$timestamps = true;
protected \$fillable =[ protected \$fillable =[
@ -1098,7 +1086,6 @@ function confirmClone(url) {
return $contentString; return $contentString;
} }
public static function controllerContent($tableName, $directoryName) public static function controllerContent($tableName, $directoryName)
{ {
$tableName = strtolower($tableName); $tableName = strtolower($tableName);
@ -1140,7 +1127,7 @@ function confirmClone(url) {
{ {
createActivityLog($controllerName::class, 'index', '$directoryName $modelClass index'); createActivityLog($controllerName::class, 'index', '$directoryName $modelClass index');
\$data = $modelClass::where('status','<>',-1)->orderBy('display_order')->get(); \$data = $modelClass::where('status','<>',-1)->orderBy('display_order')->get();
return view(\"crud.generated.$viewName.index\", compact('data')); return view(\"crud.generated.$viewName.index\", compact('data'));
} }
@ -1174,7 +1161,7 @@ function confirmClone(url) {
}); });
array_walk_recursive(\$requestData, function (&\$value) { array_walk_recursive(\$requestData, function (&\$value) {
\$value = str_replace(env('APP_URL'), '', \$value); \$value = str_replace(env('APP_URL'), '', \$value);
}); });
DB::beginTransaction(); DB::beginTransaction();
try { try {
\$operationNumber = getOperationNumber(); \$operationNumber = getOperationNumber();
@ -1191,22 +1178,22 @@ function confirmClone(url) {
} }
return redirect()->route('$viewName.index')->with('success','The $modelClass created Successfully.'); return redirect()->route('$viewName.index')->with('success','The $modelClass created Successfully.');
} }
public function sort(Request \$request) public function sort(Request \$request)
{ {
\$idOrder = \$request->input('id_order'); \$idOrder = \$request->input('id_order');
foreach (\$idOrder as \$index => \$id) { foreach (\$idOrder as \$index => \$id) {
\$companyArticle = $modelClass::find(\$id); \$companyArticle = $modelClass::find(\$id);
\$companyArticle->display_order = \$index + 1; \$companyArticle->display_order = \$index + 1;
\$companyArticle->save(); \$companyArticle->save();
} }
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200); return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
} }
public function updatealias(Request \$request) public function updatealias(Request \$request)
{ {
\$articleId = \$request->input('articleId'); \$articleId = \$request->input('articleId');
\$newAlias = \$request->input('newAlias'); \$newAlias = \$request->input('newAlias');
\$companyArticle = $modelClass::find(\$articleId); \$companyArticle = $modelClass::find(\$articleId);
@ -1217,15 +1204,15 @@ function confirmClone(url) {
\$companyArticle->save(); \$companyArticle->save();
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200); return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
} }
public function show(Request \$request, \$id) public function show(Request \$request, \$id)
{ {
createActivityLog($controllerName::class, 'show', '$directoryName $modelClass show'); createActivityLog($controllerName::class, 'show', '$directoryName $modelClass show');
\$data = $modelClass::findOrFail(\$id); \$data = $modelClass::findOrFail(\$id);
return view(\"crud.generated.$viewName.show\", compact('data')); return view(\"crud.generated.$viewName.show\", compact('data'));
} }
@ -1331,9 +1318,9 @@ function confirmClone(url) {
DB::commit(); DB::commit();
return response()->json(['status'=>true,'message'=>'The $modelClass Clonned Successfully.'],200); return response()->json(['status'=>true,'message'=>'The $modelClass Clonned Successfully.'],200);
} }
} }
"; ";
// $filename = ($controllerPath != "") ? $controllerPath . "/" : ""; // $filename = ($controllerPath != "") ? $controllerPath . "/" : "";

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Modules\Models\Country; namespace App\Models\Country;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -8,12 +8,12 @@ use Illuminate\Database\Eloquent\Model;
class Country extends Model class Country extends Model
{ {
use HasFactory; use HasFactory;
protected $table = 'tbl_countries';
protected $fillable = [ protected $fillable = [
'country_name', 'country_name',
'phone_code', 'phone_code',
'country_code', 'country_code',
'status' 'status',
]; ];
public function provinces() public function provinces()
@ -23,6 +23,6 @@ class Country extends Model
public static function getCountries() public static function getCountries()
{ {
return self::select('id','country_name')->where('status','Active')->get(); return self::select('id', 'country_name')->where('status', 'Active')->get();
} }
} }

View File

@ -0,0 +1,217 @@
<?php
namespace App\Service;
use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Yajra\DataTables\Facades\DataTables;
use Exception;
class CommonModelService
{
protected $model;
public function __construct($model)
{
$this->model = $model;
}
/**
* Create operation
* $operationStartNumber -> It is required first time if it contain multiple tables operation
* $operationEndNumber -> It is required Every time on any operation because on showing block it is required.
* $oldValues -> On store/insert old values will be null
* $newValues => On store/insert operation $new values will be model created object values and stoe in json format.
*/
public function create($operationStartNumber, $operationEndNumber, $oldValues, $newValues)
{
$baseClass = get_class($this->model);
$modelData = $this->model->create($newValues);
$prmimayKeyFieldName = $modelData->getKeyName();
$ModelID = $modelData->$prmimayKeyFieldName;
createOperationLog($operationStartNumber, $operationEndNumber, $baseClass, $ModelID, 'create', $oldValues, $modelData);
return $modelData;
}
/**
* update operation
* $operationStartNumber -> It is required first time if it contain multiple tables operation
* $operationEndNumber -> It is required Every time on any operation because on showing block it is required.
* $oldValues -> On store/insert old values case, is required only if it is updated on direct table on like users_roles table case other wise We get here
* null but find from model Id. It will be also stored in json format.
* $newValues => On store/insert operation $new values will be model created object values and stoe in json format.
*/
public function update($operationStartNumber, $operationEndNumber, $oldValues, $newValues, $ModelID)
{
$baseClass = get_class($this->model);
$this->model = $this->model->find($ModelID);
$oldValues = !empty($oldValues) ? $oldValues : $this->model->toArray();
$this->model->update($newValues);
createOperationLog($operationStartNumber, $operationEndNumber, $baseClass, $ModelID, 'update', $oldValues, $this->model->getChanges());
return $this->model;
}
/**
* Create operation
* $operationStartNumber -> It is required first time if it contain multiple tables operation
* $operationEndNumber -> It is required Every time on any operation because on showing block it is required.
* $oldValues -> On store/insert old values will be null
* $newValues => On store/insert operation $new values will be model created object values and stoe in json format.
*/
public function destroy($operationStartNumber, $operationEndNumber, $ModelID)
{
$baseClass = get_class($this->model);
$this->model = $this->model->find($ModelID);
$oldValues = ['status' => $this->model->status];
$this->model->update(['status' => -1]);
createOperationLog($operationStartNumber, $operationEndNumber, $baseClass, $ModelID, 'delete', $oldValues, ['status' => -1]);
return $this->model;
}
/**
* Paginate all User
*
* @param array $filter
* @return Collection
*/
public function paginate(array $filter = [])
{
$filter['limit'] = 25;
return $this->model->orderBy('id', 'DESC')->whereIsDeleted('no')->paginate($filter['limit']);
}
/**
* Get all User
*
* @return Collection
*/
public function all()
{
return $this->model->whereIsDeleted('no')->all();
}
/**
* Get all users with supervisor type
*
* @return Collection
*/
public function find($userId)
{
try {
return $this->model->whereIsDeleted('no')->find($userId);
} catch (Exception $e) {
return null;
}
}
// public function update($userId, array $data)
// {
// try {
// $data['visibility'] = (isset($data['visibility']) ? $data['visibility'] : '') == 'on' ? 'visible' : 'invisible';
// $data['status'] = (isset($data['status']) ? $data['status'] : '') == 'on' ? 'active' : 'in_active';
// $data['availability'] = (isset($data['availability']) ? $data['availability'] : '') == 'on' ? 'available' : 'not_available';
// $data['has_subuser'] = (isset($data['has_subuser']) ? $data['has_subuser'] : '') == 'on' ? 'yes' : 'no';
// $data['last_updated_by'] = Auth::user()->id;
// $user = $this->model->find($userId);
// $user = $user->update($data);
// $this->logger->info(' created successfully', $data);
// return $user;
// } catch (Exception $e) {
// $this->logger->error($e->getMessage());
// return false;
// }
// }
/**
* Delete a User
*
* @param Id
* @return bool
*/
public function delete($userId)
{
try {
$data['last_deleted_by'] = Auth::user()->id;
$data['deleted_at'] = Carbon::now();
$user = $this->model->find($userId);
$data['is_deleted'] = 'yes';
return $user = $user->update($data);
dd($user);
} catch (Exception $e) {
return false;
}
}
public function getUserRoles($id)
{
try {
$user = User::with('roles')->find($id);
$roles = $user->roles;
return $roles;
} catch (Exception $e) {
return false;
}
}
/**
* write brief description
* @param $name
* @return mixed
*/
public function getByName($name)
{
return $this->model->whereIsDeleted('no')->whereName($name);
}
public function getBySlug($id)
{
return $this->model->whereIsDeleted('no')->whereId($id)->first();
}
function uploadFile($file)
{
if (!empty($file)) {
$this->uploadPath = 'uploads/user';
return $fileName = $this->uploadFromAjax($file);
}
}
public function __deleteImages($subCat)
{
try {
if (is_file($subCat->image_path))
unlink($subCat->image_path);
if (is_file($subCat->thumbnail_path))
unlink($subCat->thumbnail_path);
} catch (\Exception $e) {
}
}
public function updateImage($userId, array $data)
{
try {
$user = $this->model->find($userId);
$user = $user->update($data);
return $user;
} catch (Exception $e) {
//$this->logger->error($e->getMessage());
return false;
}
}
}

4
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "18585a0d9833f75d740f42dfc2e2db87", "content-hash": "8382101c555e42e8fbbf188fa8b7b1c6",
"packages": [ "packages": [
{ {
"name": "barryvdh/laravel-debugbar", "name": "barryvdh/laravel-debugbar",
@ -8865,5 +8865,5 @@
"php": "^8.1" "php": "^8.1"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.3.0" "plugin-api-version": "2.6.0"
} }

View File

@ -1,5 +1,6 @@
{ {
"Leave": true, "Leave": true,
"Employee": true,
"Attendance": true, "Attendance": true,
"Employee": true "User": true
} }

View File

@ -1,78 +1,114 @@
$('body').on('click', '.remove-item-btn', function (e) {
e.preventDefault();
let url = $(this).data('href');
let id = $(this).data('id');
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: url,
type: 'DELETE',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: {
id: id
},
success: function (response) {
location.reload();
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
}
});
}
});
});
//initialize ckeditor //initialize ckeditor
document.querySelectorAll('.ckeditor-classic').forEach(editor => { document.querySelectorAll('.ckeditor-classic').forEach(editor => {
console.log(editor); console.log(editor);
ClassicEditor ClassicEditor
.create(editor) .create(editor)
.catch(error => { .catch(error => {
console.error(error); console.error(error);
}); });
}); });
$('.date-picker').nepaliDatePicker({ $('.date-picker').nepaliDatePicker({
// dateFormat: '%D, %M %d, %y', // dateFormat: '%D, %M %d, %y',
dateFormat: '%y-%m-%d', dateFormat: '%y-%m-%d',
closeOnDateSelect: true, closeOnDateSelect: true,
}); });
// initialize filepond // initialize filepond
const inputElement = document.querySelector('.filepond'); const inputElement = document.querySelector('.filepond');
console.log(inputElement); console.log(inputElement);
FilePond.registerPlugin(FilePondPluginImagePreview); FilePond.registerPlugin(FilePondPluginImagePreview);
const pond = FilePond.create(inputElement); const pond = FilePond.create(inputElement);
FilePond.setOptions({ FilePond.setOptions({
server:{ server: {
process:"/filepond/upload", process: "/filepond/upload",
revert: '/delete', revert: '/delete',
headers:{ headers: {
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'), 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
}, },
} }
}); });
//ajax form submit //ajax form submit
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
let form = document.getElementById('storeUpdateForm'); let form = document.getElementById('storeUpdateForm');
let action = form.getAttribute('action'); let action = form.getAttribute('action');
let method = form.getAttribute('method'); let method = form.getAttribute('method');
toastr.options = { toastr.options = {
'closeButton': true, 'closeButton': true,
'debug': false, 'debug': false,
'newestOnTop': true, 'newestOnTop': true,
'progressBar': true, 'progressBar': true,
'positionClass': 'toast-top-right', 'positionClass': 'toast-top-right',
'preventDuplicates': true, 'preventDuplicates': true,
'showDuration': '1000', 'showDuration': '1000',
'hideDuration': '1000', 'hideDuration': '1000',
'timeOut': '5000', 'timeOut': '5000',
'extendedTimeOut': '1000', 'extendedTimeOut': '1000',
'showEasing': 'swing', 'showEasing': 'swing',
'hideEasing': 'linear', 'hideEasing': 'linear',
'showMethod': 'fadeIn', 'showMethod': 'fadeIn',
'hideMethod': 'fadeOut', 'hideMethod': 'fadeOut',
} }
form.addEventListener('submit', function (e) { form.addEventListener('submit', function (e) {
e.preventDefault(); e.preventDefault();
let formData = new FormData(form); let formData = new FormData(form);
fetch(action, { fetch(action, {
method: method, method: method,
body: formData, body: formData,
headers: { headers: {
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content') 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
} }
}) })
.then(response => { .then(response => {
if (response.ok) { if (response.ok) {
response.json().then(data=>{ response.json().then(data => {
toastr['success'](data.message); toastr['success'](data.message);
}) })
} else { } else {
response.json().then(data => { response.json().then(data => {
if (data.errors) { if (data.errors) {
@ -83,15 +119,16 @@ document.addEventListener('DOMContentLoaded', function () {
} }
} }
}) })
.catch(error => { .catch(error => {
console.error('Error parsing JSON:', error); console.error('Error parsing JSON:', error);
}); });
} }
}) })
.catch(error => { .catch(error => {
console.error('Error during fetch:', error); console.error('Error during fetch:', error);
}); });
}); });
}); });

View File

@ -1 +1 @@
function initializeTables(){new DataTable("#example"),new DataTable("#scroll-vertical",{scrollY:"210px",scrollCollapse:!0,paging:!1}),new DataTable("#scroll-horizontal",{scrollX:!0}),new DataTable("#alternative-pagination",{pagingType:"full_numbers"}),new DataTable("#fixed-header",{fixedHeader:!0}),new DataTable("#model-datatables",{responsive:{details:{display:$.fn.dataTable.Responsive.display.modal({header:function(a){a=a.data();return"Details for "+a[0]+" "+a[1]}}),renderer:$.fn.dataTable.Responsive.renderer.tableAll({tableClass:"table"})}}}),new DataTable("#buttons-datatables",{dom:"Bfrtip",buttons:["copy","csv","excel","print","pdf"]}),new DataTable("#ajax-datatables",{ajax:"assets/json/datatable.json"});var a=$("#add-rows").DataTable(),e=1;$("#addRow").on("click",function(){a.row.add([e+".1",e+".2",e+".3",e+".4",e+".5",e+".6",e+".7",e+".8",e+".9",e+".10",e+".11",e+".12"]).draw(!1),e++}),$("#addRow").trigger("click")}document.addEventListener("DOMContentLoaded",function(){initializeTables()}); function initializeTables() { new DataTable("#example"), new DataTable("#scroll-vertical", { scrollY: "210px", scrollCollapse: !0, paging: !1 }), new DataTable("#scroll-horizontal", { scrollX: !0 }), new DataTable("#alternative-pagination", { pagingType: "full_numbers" }), new DataTable("#fixed-header", { fixedHeader: !0 }), new DataTable("#model-datatables", { responsive: { details: { display: $.fn.dataTable.Responsive.display.modal({ header: function (a) { a = a.data(); return "Details for " + a[0] + " " + a[1] } }), renderer: $.fn.dataTable.Responsive.renderer.tableAll({ tableClass: "table" }) } } }), new DataTable("#buttons-datatables", { dom: "Bfrtip", buttons: ["copy", "csv", "excel", "print", "pdf"] }), new DataTable("#ajax-datatables", { ajax: "assets/json/datatable.json" }); var a = $("#add-rows").DataTable(), e = 1; $("#addRow").on("click", function () { a.row.add([e + ".1", e + ".2", e + ".3", e + ".4", e + ".5", e + ".6", e + ".7", e + ".8", e + ".9", e + ".10", e + ".11", e + ".12"]).draw(!1), e++ }), $("#addRow").trigger("click") } document.addEventListener("DOMContentLoaded", function () { initializeTables() });

View File

@ -1,39 +1,39 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class="nk-content"> <div class="nk-content">
<div class="container-fluid"> <div class="container-fluid">
@if ($errors->any()) @if ($errors->any())
<div class="alert alert-danger"> <div class="alert alert-danger">
<ul> <ul>
@foreach ($errors->all() as $error) @foreach ($errors->all() as $error)
<li>{{ $error }}</li> <li>{{ $error }}</li>
@endforeach @endforeach
</ul> </ul>
</div>
@endif
<div class="nk-content-inner">
<form method="get" action="{{ route('form.store') }}" enctype="multipart/form-data">
{{Label('Operation')}}
{{ customCreateSelect('type', 'type', '', '', ['ajax-curd' => 'Ajax CURD']) }}
{{Label('Table Name')}}
{{ customCreateSelect('tableName', 'tableName', 'form-control custom-select2', '', $allTables) }}
{{Label('Write To')}}
{{ createText('directoryName', 'directoryName', 'Directory Name') }}
<?php createButton('mt-3 btn-primary', '', 'Submit'); ?>
</form>
</div>
</div> </div>
@endif
<div class="nk-content-inner">
<form method="get" action="{{ route('form.store') }}" enctype="multipart/form-data">
{{ Label('Operation') }}
{{ customCreateSelect('type', 'type', '', '', ['ajax-curd' => 'Ajax CURD']) }}
{{ Label('Table Name') }}
{{ customCreateSelect('tableName', 'tableName', 'form-control custom-select2', '', $allTables) }}
{{ Label('Write To') }}
{{ createText('directoryName', 'directoryName', 'Directory Name') }}
<?php createButton('mt-3 btn-primary', '', 'Submit'); ?>
</form>
</div>
</div> </div>
</div>
@endsection @endsection
@push('js') @push('js')
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('.custom-select2').select2(); $('.custom-select2').select2();
}); });
</script> </script>
@endpush @endpush

View File

@ -1,65 +1,67 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class="nk-content"> <div class="nk-content">
<div class="container"> <div class="container">
<div class="nk-content-inner"> <div class="nk-content-inner">
<div class="nk-content-body"> <div class="nk-content-body">
<div class="nk-block-head"> <div class="nk-block-head">
<div class="nk-block-head-between flex-wrap gap g-2"> <div class="nk-block-head-between gap g-2 flex-wrap">
<div class="nk-block-head-content"> <div class="nk-block-head-content">
<h2 class="nk-block-title">Tables in Database</h1> <h2 class="nk-block-title">Tables in Database</h1>
</div> </div>
</div>
</div>
<div class="nk-block">
<div class="card">
<div class="accordion" id="accordionTables">
<?php $a = 0; ?>
@foreach ($allTables as $Table)
<?php $a++; ?>
<div class="accordion-item">
<h2 class="accordion-header"> <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapse{{$a}}"> {{$a}}: {{$Table->tablename}} </button> </h2>
<div id="collapse{{$a}}" class="accordion-collapse collapse" data-bs-parent="#accordionTables">
<div class="accordion-body">
<table class="datatable-init table" data-nk-container="table-responsive">
<thead class="table-dark">
<tr>
<th class="tb-col"><span class="overline-title">S.N.</span></th>
<th class="tb-col"><span class="overline-title">{{__('lang.Column')}}</span></th>
<th class="tb-col"><span class="overline-title">{{label("Datatype")}}</span></th>
</tr>
</thead>
<tbody>
<?php $sn = 0; ?>
@foreach($Table->tablecolumns as $column)
<tr>
<?php $sn++; ?>
<td class="tb-col"><span >{{$sn}}</span></td>
<td class="tb-col"><span > {{$column->COLUMN_NAME}}</span></td>
<td class="tb-col"><span > {{$column->COLUMN_TYPE}}</span></td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> <div class="nk-block">
</div> <div class="card">
<div class="accordion" id="accordionTables">
<?php $a = 0; ?>
@foreach ($allTables as $Table)
<?php $a++; ?>
<div class="accordion-item">
<h2 class="accordion-header"> <button class="accordion-button" type="button"
data-bs-toggle="collapse" data-bs-target="#collapse{{ $a }}"> {{ $a }}:
{{ $Table->tablename }} </button> </h2>
<div id="collapse{{ $a }}" class="accordion-collapse collapse"
data-bs-parent="#accordionTables">
<div class="accordion-body">
<table class="datatable-init table" data-nk-container="table-responsive">
<thead class="table-dark">
<tr>
<th class="tb-col"><span class="overline-title">S.N.</span></th>
<th class="tb-col"><span class="overline-title">{{ __('lang.Column') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label('Datatype') }}</span></th>
</tr>
</thead>
<tbody>
<?php $sn = 0; ?>
@foreach ($Table->tablecolumns as $column)
<tr>
<?php $sn++; ?>
<td class="tb-col"><span>{{ $sn }}</span></td>
<td class="tb-col"><span> {{ $column->COLUMN_NAME }}</span></td>
<td class="tb-col"><span> {{ $column->COLUMN_TYPE }}</span></td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection @endsection
@push('js') @push('js')
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('.custom-select2').select2(); $('.custom-select2').select2();
}); });
</script> </script>
@endpush @endpush

View File

@ -1,26 +1,48 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Branche') }}</h2> <h2 class="">{{ label('Add Branche') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('branches.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Cancel', route('branches.index')); ?>
</div> </div>
<div class='card-body'> <div class='card-body'>
<form action="{{$editable?route('branches.update',[$data->branch_id]):route('branches.store')}}" id="updateCustomForm" method="POST" > <form action="{{ $editable ? route('branches.update', [$data->branch_id]) : route('branches.store') }}"
@csrf <input type=hidden name='branch_id' value='{{$editable?$data->branch_id:''}}'/> id="updateCustomForm" method="POST">
<div class="row"><div class="col-lg-6">{{createCustomSelect('tbl_companies', 'title', 'company_id', $editable?$data->companies_id:'', 'Companies Id','companies_id', 'form-control select2','status<>-1')}}</div><div class="col-lg-6">{{createText("title","title","Title",'',$editable?$data->title:'')}} @csrf <input type=hidden name='branch_id' value='{{ $editable ? $data->branch_id : '' }}' />
</div><div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description",$editable?$data->description:'')}} <div class="row">
</div><div class="col-lg-6">{{createText("email","email","Email",'',$editable?$data->email:'')}} <div class="col-lg-6">
</div><div class="col-lg-6">{{createText("telephone","telephone","Telephone",'',$editable?$data->telephone:'')}} {{ createCustomSelect('tbl_companies', 'title', 'company_id', $editable ? $data->companies_id : '', 'Companies Id', 'companies_id', 'form-control select2', 'status<>-1') }}
</div><div class="col-lg-6">{{createText("phone1","phone1","Phone1",'',$editable?$data->phone1:'')}} </div>
</div><div class="col-lg-6">{{createText("phone2","phone2","Phone2",'',$editable?$data->phone2:'')}} <div class="col-lg-6">{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
</div><div class="col-lg-6">{{createText("address","address","Address",'',$editable?$data->address:'')}} </div>
</div><div class="col-lg-6">{{createText("company_reg","company_reg","Company Reg",'',$editable?$data->company_reg:'')}} <div class="col-lg-12 pb-2">
</div><div class="col-lg-6">{{createText("company_pan","company_pan","Company Pan",'',$editable?$data->company_pan:'')}} {{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }}
</div><div class="col-lg-12 pb-2">{{createImageInput("logo","Logo",'',$editable?$data->logo:'')}} </div>
</div><div class="col-lg-12 pb-2">{{createPlainTextArea("remarks",'',"Remarks",$editable?$data->remarks:'')}} <div class="col-lg-6">{{ createText('email', 'email', 'Email', '', $editable ? $data->email : '') }}
</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?> </div>
<?php createButton("btn-primary btn-cancel","","Cancel",route('branches.index')); ?> <div class="col-lg-6">{{ createText('telephone', 'telephone', 'Telephone', '', $editable ? $data->telephone : '') }}
</div> </form></div></div> </div>
@endsection <div class="col-lg-6">{{ createText('phone1', 'phone1', 'Phone1', '', $editable ? $data->phone1 : '') }}
</div>
<div class="col-lg-6">{{ createText('phone2', 'phone2', 'Phone2', '', $editable ? $data->phone2 : '') }}
</div>
<div class="col-lg-6">{{ createText('address', 'address', 'Address', '', $editable ? $data->address : '') }}
</div>
<div class="col-lg-6">
{{ createText('company_reg', 'company_reg', 'Company Reg', '', $editable ? $data->company_reg : '') }}
</div>
<div class="col-lg-6">
{{ createText('company_pan', 'company_pan', 'Company Pan', '', $editable ? $data->company_pan : '') }}
</div>
<div class="col-lg-12 pb-2">{{ createImageInput('logo', 'Logo', '', $editable ? $data->logo : '') }}
</div>
<div class="col-lg-12 pb-2">{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
</div>
<div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('branches.index')); ?>
</div>
</form>
</div>
</div>
@endsection

View File

@ -1,26 +1,48 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Edit Branches') }}</h2> <h2 class="">{{ label('Edit Branches') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('branches.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Cancel', route('branches.index')); ?>
</div> </div>
<div class='card-body'> <div class='card-body'>
<form action="{{$editable?route('branches.update',[$data->branch_id]):route('branches.store')}}" id="updateCustomForm" method="POST" > <form action="{{ $editable ? route('branches.update', [$data->branch_id]) : route('branches.store') }}"
@csrf <input type=hidden name='branch_id' value='{{$editable?$data->branch_id:''}}'/> id="updateCustomForm" method="POST">
<div class="row"><div class="col-lg-6">{{createCustomSelect('tbl_companies', 'title', 'company_id', $editable?$data->companies_id:'', 'Companies Id','companies_id', 'form-control select2','status<>-1')}}</div><div class="col-lg-6">{{createText("title","title","Title",'',$editable?$data->title:'')}} @csrf <input type=hidden name='branch_id' value='{{ $editable ? $data->branch_id : '' }}' />
</div><div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description",$editable?$data->description:'')}} <div class="row">
</div><div class="col-lg-6">{{createText("email","email","Email",'',$editable?$data->email:'')}} <div class="col-lg-6">
</div><div class="col-lg-6">{{createText("telephone","telephone","Telephone",'',$editable?$data->telephone:'')}} {{ createCustomSelect('tbl_companies', 'title', 'company_id', $editable ? $data->companies_id : '', 'Companies Id', 'companies_id', 'form-control select2', 'status<>-1') }}
</div><div class="col-lg-6">{{createText("phone1","phone1","Phone1",'',$editable?$data->phone1:'')}} </div>
</div><div class="col-lg-6">{{createText("phone2","phone2","Phone2",'',$editable?$data->phone2:'')}} <div class="col-lg-6">{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
</div><div class="col-lg-6">{{createText("address","address","Address",'',$editable?$data->address:'')}} </div>
</div><div class="col-lg-6">{{createText("company_reg","company_reg","Company Reg",'',$editable?$data->company_reg:'')}} <div class="col-lg-12 pb-2">
</div><div class="col-lg-6">{{createText("company_pan","company_pan","Company Pan",'',$editable?$data->company_pan:'')}} {{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }}
</div><div class="col-lg-12 pb-2">{{createImageInput("logo","Logo",'',$editable?$data->logo:'')}} </div>
</div><div class="col-lg-12 pb-2">{{createPlainTextArea("remarks",'',"Remarks",$editable?$data->remarks:'')}} <div class="col-lg-6">{{ createText('email', 'email', 'Email', '', $editable ? $data->email : '') }}
</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?> </div>
<?php createButton("btn-primary btn-cancel","","Cancel",route('branches.index')); ?> <div class="col-lg-6">{{ createText('telephone', 'telephone', 'Telephone', '', $editable ? $data->telephone : '') }}
</div> </form></div></div> </div>
@endsection <div class="col-lg-6">{{ createText('phone1', 'phone1', 'Phone1', '', $editable ? $data->phone1 : '') }}
</div>
<div class="col-lg-6">{{ createText('phone2', 'phone2', 'Phone2', '', $editable ? $data->phone2 : '') }}
</div>
<div class="col-lg-6">{{ createText('address', 'address', 'Address', '', $editable ? $data->address : '') }}
</div>
<div class="col-lg-6">
{{ createText('company_reg', 'company_reg', 'Company Reg', '', $editable ? $data->company_reg : '') }}
</div>
<div class="col-lg-6">
{{ createText('company_pan', 'company_pan', 'Company Pan', '', $editable ? $data->company_pan : '') }}
</div>
<div class="col-lg-12 pb-2">{{ createImageInput('logo', 'Logo', '', $editable ? $data->logo : '') }}
</div>
<div class="col-lg-12 pb-2">{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
</div>
<div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('branches.index')); ?>
</div>
</form>
</div>
</div>
@endsection

View File

@ -1,203 +1,211 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class="card"> <div class="card">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Branches List") }}</h2> <h2>{{ label('Branches List') }}</h2>
<a href="{{ route('branches.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a> <a href="{{ route('branches.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
</div> </div>
<div class="card-body"> <div class="card-body">
<table class="table dataTable" id="tbl_branches" data-url="{{ route('branches.sort') }}"> <table class="dataTable table" id="tbl_branches" data-url="{{ route('branches.sort') }}">
<thead class="table-light"> <thead class="table-light">
<tr> <tr>
<th class="tb-col"><span class="overline-title">{{label("Sn.")}}</span></th> <th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("companies") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('companies') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("title") }}</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"><span class="overline-title">{{ label('alias') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("email") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('email') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("telephone") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('telephone') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("phone1") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('phone1') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("phone2") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('phone2') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("address") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('address') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("company_reg") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('company_reg') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("company_pan") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('company_pan') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("logo") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('logo') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("is_main") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('is_main') }}</span></th>
<th class="tb-col" data-sortable="false"><span <th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
class="overline-title">{{ label("Action") }}</span> </th>
</th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> @php
@php $i = 1;
$i = 1; @endphp
@endphp @foreach ($data as $item)
@foreach ($data as $item) <tr data-id="{{ $item->branch_id }}" data-display_order="{{ $item->display_order }}"
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
<tr data-id="{{$item->branch_id}}" data-display_order="{{$item->display_order}}" class="draggable-row <?php echo ($item->status==0)?"bg-light bg-danger":""; ?>"> <td class="tb-col">{{ $i++ }}</td>
<td class="tb-col">{{ $i++ }}</td><td class="tb-col"> <td class="tb-col">
{!! getFieldData("tbl_companies", "title", "company_id", $item->companies_id) !!} {!! getFieldData('tbl_companies', 'title', 'company_id', $item->companies_id) !!}
</td><td class="tb-col">{{ $item->title }}</td> </td>
<td class="tb-col"> <td class="tb-col">{{ $item->title }}</td>
<div class="alias-wrapper" data-id="{{$item->branch_id}}"> <td class="tb-col">
<span class="alias">{{ $item->alias }}</span> <div class="alias-wrapper" data-id="{{ $item->branch_id }}">
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->branch_id}}" /> <span class="alias">{{ $item->alias }}</span>
</div> <input type="text" class="alias-input d-none" value="{{ $item->alias }}"
<span class="badge badge-soft-primary change-alias-badge">change alias</span> id="alias_{{ $item->branch_id }}" />
</td> </div>
<td class="tb-col">{{ $item->email }}</td> <span class="badge badge-soft-primary change-alias-badge">change alias</span>
<td class="tb-col">{{ $item->telephone }}</td> </td>
<td class="tb-col">{{ $item->phone1 }}</td> <td class="tb-col">{{ $item->email }}</td>
<td class="tb-col">{{ $item->phone2 }}</td> <td class="tb-col">{{ $item->telephone }}</td>
<td class="tb-col">{{ $item->address }}</td> <td class="tb-col">{{ $item->phone1 }}</td>
<td class="tb-col">{{ $item->company_reg }}</td> <td class="tb-col">{{ $item->phone2 }}</td>
<td class="tb-col">{{ $item->company_pan }}</td> <td class="tb-col">{{ $item->address }}</td>
<td class="tb-col">{{ showImageThumb($item->logo) }}</td> <td class="tb-col">{{ $item->company_reg }}</td>
<td class="tb-col">{{ $item->is_main }}</td> <td class="tb-col">{{ $item->company_pan }}</td>
<td class="tb-col"> <td class="tb-col">{{ showImageThumb($item->logo) }}</td>
<div class="dropdown d-inline-block"> <td class="tb-col">{{ $item->is_main }}</td>
<button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false"> <td class="tb-col">
<i class="ri-more-fill align-middle"></i> <div class="dropdown d-inline-block">
</button> <button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown"
<ul class="dropdown-menu dropdown-menu-end"> aria-expanded="false">
<li><a href="{{route('branches.show',[$item->branch_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li> <i class="ri-more-fill align-middle"></i>
<li><a href="{{route('branches.edit',[$item->branch_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li> </button>
<li> <ul class="dropdown-menu dropdown-menu-end">
<a href="{{route('branches.toggle',[$item->branch_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)"> <li><a href="{{ route('branches.show', [$item->branch_id]) }}" class="dropdown-item"><i
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }} class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
</a> <li><a href="{{ route('branches.edit', [$item->branch_id]) }}" class="dropdown-item edit-item-btn"><i
class="ri-pencil-fill text-muted me-2 align-bottom"></i> {{ label('Edit') }}</a></li>
</li> <li>
<li> <a href="{{ route('branches.toggle', [$item->branch_id]) }}" class="dropdown-item toggle-item-btn"
<a href="{{route('branches.clone',[$item->branch_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)"> onclick="confirmToggle(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }} <i class="ri-article-fill text-muted me-2 align-bottom"></i>
</a> {{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
</a>
</li>
<li>
<a href="{{route('branches.destroy',[$item->branch_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i> {{ label('Delete') }}
</a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach </li>
<li>
<a href="{{ route('branches.clone', [$item->branch_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>
</tbody> </li>
</table> <li>
<a href="{{ route('branches.destroy', [$item->branch_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>
</div> </ul>
</div> </div>
@endsection
</td>
@push("css") </tr>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css"> @endforeach
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
</tbody>
</table>
</div>
</div>
@endsection
@push('css')
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
@endpush @endpush
@push("js") @push('js')
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script> <script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script> <script>
$(document).ready(function(e) { $(document).ready(function(e) {
$('.change-alias-badge').on('click', function() { $('.change-alias-badge').on('click', function() {
var aliasWrapper = $(this).prev('.alias-wrapper'); var aliasWrapper = $(this).prev('.alias-wrapper');
var aliasSpan = aliasWrapper.find('.alias'); var aliasSpan = aliasWrapper.find('.alias');
var aliasInput = aliasWrapper.find('.alias-input'); var aliasInput = aliasWrapper.find('.alias-input');
var isEditing = $(this).hasClass('editing'); var isEditing = $(this).hasClass('editing');
aliasInput.toggleClass("d-none"); aliasInput.toggleClass("d-none");
if (isEditing) { if (isEditing) {
// Update alias text and switch to non-editing state // Update alias text and switch to non-editing state
var newAlias = aliasInput.val(); var newAlias = aliasInput.val();
aliasSpan.text(newAlias); aliasSpan.text(newAlias);
aliasSpan.show(); aliasSpan.show();
aliasInput.hide(); aliasInput.hide();
$(this).removeClass('editing').text('Change Alias'); $(this).removeClass('editing').text('Change Alias');
var articleId = $(aliasWrapper).data('id'); var articleId = $(aliasWrapper).data('id');
var ajaxUrl = "{{ route('branches.updatealias') }}"; var ajaxUrl = "{{ route('branches.updatealias') }}";
var data = { var data = {
articleId: articleId, articleId: articleId,
newAlias: newAlias newAlias: newAlias
}; };
$.ajax({ $.ajax({
url: ajaxUrl, url: ajaxUrl,
type: 'POST', type: 'POST',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
data: data, data: data,
success: function(response) { success: function(response) {
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(error); console.error(error);
} }
}); });
} else { } else {
// Switch to editing state // Switch to editing state
aliasSpan.hide(); aliasSpan.hide();
aliasInput.show().focus(); aliasInput.show().focus();
$(this).addClass('editing').text('Save Alias'); $(this).addClass('editing').text('Save Alias');
} }
}); });
var mytable = $(".dataTable").DataTable({ var mytable = $(".dataTable").DataTable({
ordering: true, ordering: true,
rowReorder: { rowReorder: {
//selector: 'tr' //selector: 'tr'
}, },
}); });
var isRowReorderComplete = false; var isRowReorderComplete = false;
mytable.on('row-reorder', function(e, diff, edit) { mytable.on('row-reorder', function(e, diff, edit) {
isRowReorderComplete = true; isRowReorderComplete = true;
}); });
mytable.on('draw', function() { mytable.on('draw', function() {
if (isRowReorderComplete) { if (isRowReorderComplete) {
var url = mytable.table().node().getAttribute('data-url'); var url = mytable.table().node().getAttribute('data-url');
var ids = mytable.rows().nodes().map(function(node) { var ids = mytable.rows().nodes().map(function(node) {
return $(node).data('id'); return $(node).data('id');
}).toArray(); }).toArray();
console.log(ids); console.log(ids);
$.ajax({ $.ajax({
url: url, url: url,
type: "POST", type: "POST",
headers: { headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content') "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
}, },
data: { data: {
id_order: ids id_order: ids
}, },
success: function(response) { success: function(response) {
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(error); console.error(error);
} }
}); });
isRowReorderComplete=false; isRowReorderComplete = false;
} }
});
}); });
});
function confirmDelete(url) { function confirmDelete(url) {
event.preventDefault(); event.preventDefault();
Swal.fire({ Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'You will not be able to recover this item!', text: 'You will not be able to recover this item!',
icon: 'warning', icon: 'warning',
@ -205,28 +213,29 @@ function confirmDelete(url) {
confirmButtonText: 'Delete', confirmButtonText: 'Delete',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Deleted!', 'The item has been deleted.', 'success'); Swal.fire('Deleted!', 'The item has been deleted.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error'); Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
} }
}); });
} }
}); });
} }
function confirmToggle(url) {
event.preventDefault(); function confirmToggle(url) {
Swal.fire({ event.preventDefault();
Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!', text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
icon: 'warning', icon: 'warning',
@ -234,28 +243,29 @@ function confirmToggle(url) {
confirmButtonText: 'Proceed', confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success'); Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error'); Swal.fire('Error!', 'An error occurred.', 'error');
} }
}); });
} }
}); });
} }
function confirmClone(url) {
event.preventDefault(); function confirmClone(url) {
Swal.fire({ event.preventDefault();
Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'Clonning will create replica of current row. No any linked data will be updated!', text: 'Clonning will create replica of current row. No any linked data will be updated!',
icon: 'warning', icon: 'warning',
@ -263,27 +273,24 @@ function confirmClone(url) {
confirmButtonText: 'Proceed', confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Updated!', 'Clonning Completed', 'success'); Swal.fire('Updated!', 'Clonning Completed', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error'); Swal.fire('Error!', 'An error occurred.', 'error');
} }
}); });
} }
}); });
} }
</script> </script>
@endpush @endpush

View File

@ -1,29 +1,47 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2><?php echo label('View Details'); ?></h2> <h2><?php echo label('View Details'); ?></h2>
<?php createButton("btn-primary btn-cancel","","Back to List",route('branches.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Back to List', route('branches.index')); ?>
</div>
<div class='card-body'>
<p><b>Companies Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->companies_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>Email :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->email}}</span></p><p><b>Telephone :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->telephone}}</span></p><p><b>Phone1 :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->phone1}}</span></p><p><b>Phone2 :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->phone2}}</span></p><p><b>Address :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->address}}</span></p><p><b>Company Reg :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->company_reg}}</span></p><p><b>Company Pan :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->company_pan}}</span></p><p><b>Logo :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->logo}}</span></p><p><b>Is Main :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->is_main}}</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 class='card-body'>
</div>
<p><b>Companies Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->companies_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>Email :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->email }}</span></p>
<p><b>Telephone :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->telephone }}</span></p>
<p><b>Phone1 :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->phone1 }}</span></p>
<p><b>Phone2 :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->phone2 }}</span></p>
<p><b>Address :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->address }}</span></p>
<p><b>Company Reg :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->company_reg }}</span></p>
<p><b>Company Pan :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->company_pan }}</span></p>
<p><b>Logo :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->logo }}</span></p>
<p><b>Is Main :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->is_main }}</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>
<div>
@endSection <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

@ -1,17 +1,24 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Caste') }}</h2> <h2 class="">{{ label('Add Caste') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('castes.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Cancel', route('castes.index')); ?>
</div> </div>
<div class='card-body'> <div class='card-body'>
<form action="{{$editable?route('castes.update',[$data->caste_id]):route('castes.store')}}" id="updateCustomForm" method="POST" > <form action="{{ $editable ? route('castes.update', [$data->caste_id]) : route('castes.store') }}" id="updateCustomForm"
@csrf <input type=hidden name='caste_id' value='{{$editable?$data->caste_id:''}}'/> method="POST">
<div class="row"><div class="col-lg-6">{{createText("title","title","Title",'',$editable?$data->title:'')}} @csrf <input type=hidden name='caste_id' value='{{ $editable ? $data->caste_id : '' }}' />
</div><div class="col-lg-12 pb-2">{{createPlainTextArea("remarks",'',"Remarks",$editable?$data->remarks:'')}} <div class="row">
</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?> <div class="col-lg-6">{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
<?php createButton("btn-primary btn-cancel","","Cancel",route('castes.index')); ?> </div>
</div> </form></div></div> <div class="col-lg-12 pb-2">{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
@endsection </div>
<div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('castes.index')); ?>
</div>
</form>
</div>
</div>
@endsection

View File

@ -1,182 +1,189 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class="card"> <div class="card">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Caste List") }}</h2> <h2>{{ label('Caste List') }}</h2>
<a href="{{ route('castes.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a> <a href="{{ route('castes.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
</div> </div>
<div class="card-body"> <div class="card-body">
<table class="table dataTable" id="tbl_castes" data-url="{{ route('castes.sort') }}"> <table class="dataTable table" id="tbl_castes" data-url="{{ route('castes.sort') }}">
<thead class="table-light"> <thead class="table-light">
<tr> <tr>
<th class="tb-col"><span class="overline-title">{{label("Sn.")}}</span></th> <th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("title") }}</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"><span class="overline-title">{{ label('alias') }}</span></th>
<th class="tb-col" data-sortable="false"><span <th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
class="overline-title">{{ label("Action") }}</span> </th>
</th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> @php
@php $i = 1;
$i = 1; @endphp
@endphp @foreach ($data as $item)
@foreach ($data as $item) <tr data-id="{{ $item->caste_id }}" data-display_order="{{ $item->display_order }}"
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
<tr data-id="{{$item->caste_id}}" data-display_order="{{$item->display_order}}" class="draggable-row <?php echo ($item->status==0)?"bg-light bg-danger":""; ?>"> <td class="tb-col">{{ $i++ }}</td>
<td class="tb-col">{{ $i++ }}</td><td class="tb-col">{{ $item->title }}</td> <td class="tb-col">{{ $item->title }}</td>
<td class="tb-col"> <td class="tb-col">
<div class="alias-wrapper" data-id="{{$item->caste_id}}"> <div class="alias-wrapper" data-id="{{ $item->caste_id }}">
<span class="alias">{{ $item->alias }}</span> <span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->caste_id}}" /> <input type="text" class="alias-input d-none" value="{{ $item->alias }}"
</div> id="alias_{{ $item->caste_id }}" />
<span class="badge badge-soft-primary change-alias-badge">change alias</span> </div>
</td> <span class="badge badge-soft-primary change-alias-badge">change alias</span>
<td class="tb-col"> </td>
<div class="dropdown d-inline-block"> <td class="tb-col">
<button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false"> <div class="dropdown d-inline-block">
<i class="ri-more-fill align-middle"></i> <button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown"
</button> aria-expanded="false">
<ul class="dropdown-menu dropdown-menu-end"> <i class="ri-more-fill align-middle"></i>
<li><a href="{{route('castes.show',[$item->caste_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li> </button>
<li><a href="{{route('castes.edit',[$item->caste_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li> <ul class="dropdown-menu dropdown-menu-end">
<li> <li><a href="{{ route('castes.show', [$item->caste_id]) }}" class="dropdown-item"><i
<a href="{{route('castes.toggle',[$item->caste_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)"> class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }} <li><a href="{{ route('castes.edit', [$item->caste_id]) }}" class="dropdown-item edit-item-btn"><i
</a> class="ri-pencil-fill text-muted me-2 align-bottom"></i> {{ label('Edit') }}</a></li>
<li>
</li> <a href="{{ route('castes.toggle', [$item->caste_id]) }}" class="dropdown-item toggle-item-btn"
<li> onclick="confirmToggle(this.href)">
<a href="{{route('castes.clone',[$item->caste_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)"> <i class="ri-article-fill text-muted me-2 align-bottom"></i>
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }} {{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
</a> </a>
</li>
<li>
<a href="{{route('castes.destroy',[$item->caste_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i> {{ label('Delete') }}
</a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach </li>
<li>
<a href="{{ route('castes.clone', [$item->caste_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>
</tbody> </li>
</table> <li>
<a href="{{ route('castes.destroy', [$item->caste_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>
</div> </ul>
</div> </div>
@endsection
</td>
@push("css") </tr>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css"> @endforeach
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
</tbody>
</table>
</div>
</div>
@endsection
@push('css')
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
@endpush @endpush
@push("js") @push('js')
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script> <script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script> <script>
$(document).ready(function(e) { $(document).ready(function(e) {
$('.change-alias-badge').on('click', function() { $('.change-alias-badge').on('click', function() {
var aliasWrapper = $(this).prev('.alias-wrapper'); var aliasWrapper = $(this).prev('.alias-wrapper');
var aliasSpan = aliasWrapper.find('.alias'); var aliasSpan = aliasWrapper.find('.alias');
var aliasInput = aliasWrapper.find('.alias-input'); var aliasInput = aliasWrapper.find('.alias-input');
var isEditing = $(this).hasClass('editing'); var isEditing = $(this).hasClass('editing');
aliasInput.toggleClass("d-none"); aliasInput.toggleClass("d-none");
if (isEditing) { if (isEditing) {
// Update alias text and switch to non-editing state // Update alias text and switch to non-editing state
var newAlias = aliasInput.val(); var newAlias = aliasInput.val();
aliasSpan.text(newAlias); aliasSpan.text(newAlias);
aliasSpan.show(); aliasSpan.show();
aliasInput.hide(); aliasInput.hide();
$(this).removeClass('editing').text('Change Alias'); $(this).removeClass('editing').text('Change Alias');
var articleId = $(aliasWrapper).data('id'); var articleId = $(aliasWrapper).data('id');
var ajaxUrl = "{{ route('castes.updatealias') }}"; var ajaxUrl = "{{ route('castes.updatealias') }}";
var data = { var data = {
articleId: articleId, articleId: articleId,
newAlias: newAlias newAlias: newAlias
}; };
$.ajax({ $.ajax({
url: ajaxUrl, url: ajaxUrl,
type: 'POST', type: 'POST',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
data: data, data: data,
success: function(response) { success: function(response) {
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(error); console.error(error);
} }
}); });
} else { } else {
// Switch to editing state // Switch to editing state
aliasSpan.hide(); aliasSpan.hide();
aliasInput.show().focus(); aliasInput.show().focus();
$(this).addClass('editing').text('Save Alias'); $(this).addClass('editing').text('Save Alias');
} }
}); });
var mytable = $(".dataTable").DataTable({ var mytable = $(".dataTable").DataTable({
ordering: true, ordering: true,
rowReorder: { rowReorder: {
//selector: 'tr' //selector: 'tr'
}, },
}); });
var isRowReorderComplete = false; var isRowReorderComplete = false;
mytable.on('row-reorder', function(e, diff, edit) { mytable.on('row-reorder', function(e, diff, edit) {
isRowReorderComplete = true; isRowReorderComplete = true;
}); });
mytable.on('draw', function() { mytable.on('draw', function() {
if (isRowReorderComplete) { if (isRowReorderComplete) {
var url = mytable.table().node().getAttribute('data-url'); var url = mytable.table().node().getAttribute('data-url');
var ids = mytable.rows().nodes().map(function(node) { var ids = mytable.rows().nodes().map(function(node) {
return $(node).data('id'); return $(node).data('id');
}).toArray(); }).toArray();
console.log(ids); console.log(ids);
$.ajax({ $.ajax({
url: url, url: url,
type: "POST", type: "POST",
headers: { headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content') "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
}, },
data: { data: {
id_order: ids id_order: ids
}, },
success: function(response) { success: function(response) {
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(error); console.error(error);
} }
}); });
isRowReorderComplete=false; isRowReorderComplete = false;
} }
});
}); });
});
function confirmDelete(url) { function confirmDelete(url) {
event.preventDefault(); event.preventDefault();
Swal.fire({ Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'You will not be able to recover this item!', text: 'You will not be able to recover this item!',
icon: 'warning', icon: 'warning',
@ -184,28 +191,29 @@ function confirmDelete(url) {
confirmButtonText: 'Delete', confirmButtonText: 'Delete',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Deleted!', 'The item has been deleted.', 'success'); Swal.fire('Deleted!', 'The item has been deleted.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error'); Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
} }
}); });
} }
}); });
} }
function confirmToggle(url) {
event.preventDefault(); function confirmToggle(url) {
Swal.fire({ event.preventDefault();
Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!', text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
icon: 'warning', icon: 'warning',
@ -213,28 +221,29 @@ function confirmToggle(url) {
confirmButtonText: 'Proceed', confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success'); Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error'); Swal.fire('Error!', 'An error occurred.', 'error');
} }
}); });
} }
}); });
} }
function confirmClone(url) {
event.preventDefault(); function confirmClone(url) {
Swal.fire({ event.preventDefault();
Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'Clonning will create replica of current row. No any linked data will be updated!', text: 'Clonning will create replica of current row. No any linked data will be updated!',
icon: 'warning', icon: 'warning',
@ -242,27 +251,24 @@ function confirmClone(url) {
confirmButtonText: 'Proceed', confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Updated!', 'Clonning Completed', 'success'); Swal.fire('Updated!', 'Clonning Completed', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error'); Swal.fire('Error!', 'An error occurred.', 'error');
} }
}); });
} }
}); });
} }
</script> </script>
@endpush @endpush

View File

@ -1,29 +1,36 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2><?php echo label('View Details'); ?></h2> <h2><?php echo label('View Details'); ?></h2>
<?php createButton("btn-primary btn-cancel","","Back to List",route('castes.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Back to List', route('castes.index')); ?>
</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><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 class='card-body'>
</div>
<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>
<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>
<div>
@endSection <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

@ -1,18 +1,30 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Cities') }}</h2> <h2 class="">{{ label('Add Cities') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('cities.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Cancel', route('cities.index')); ?>
</div> </div>
<div class='card-body'> <div class='card-body'>
<form action="{{$editable?route('cities.update',[$data->city_id]):route('cities.store')}}" id="updateCustomForm" method="POST" > <form action="{{ $editable ? route('cities.update', [$data->city_id]) : route('cities.store') }}" id="updateCustomForm"
@csrf <input type=hidden name='city_id' value='{{$editable?$data->city_id:''}}'/> method="POST">
<div class="row"><div class="col-lg-6">{{createCustomSelect('tbl_districts', 'title', 'district_id', $editable?$data->districts_id:'', 'Districts Id','districts_id', 'form-control select2','status<>-1')}}</div><div class="col-lg-6">{{createText("title","title","Title",'',$editable?$data->title:'')}} @csrf <input type=hidden name='city_id' value='{{ $editable ? $data->city_id : '' }}' />
</div><div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description",$editable?$data->description:'')}} <div class="row">
</div><div class="col-lg-12 pb-2">{{createPlainTextArea("remarks",'',"Remarks",$editable?$data->remarks:'')}} <div class="col-lg-6">
</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?> {{ createCustomSelect('tbl_districts', 'title', 'district_id', $editable ? $data->districts_id : '', 'Districts Id', 'districts_id', 'form-control select2', 'status<>-1') }}
<?php createButton("btn-primary btn-cancel","","Cancel",route('cities.index')); ?> </div>
</div> </form></div></div> <div class="col-lg-6">{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
@endsection </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"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('cities.index')); ?>
</div>
</form>
</div>
</div>
@endsection

View File

@ -1,185 +1,193 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class="card"> <div class="card">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Cities List") }}</h2> <h2>{{ label('Cities List') }}</h2>
<a href="{{ route('cities.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a> <a href="{{ route('cities.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
</div> </div>
<div class="card-body"> <div class="card-body">
<table class="table dataTable" id="tbl_cities" data-url="{{ route('cities.sort') }}"> <table class="dataTable table" id="tbl_cities" data-url="{{ route('cities.sort') }}">
<thead class="table-light"> <thead class="table-light">
<tr> <tr>
<th class="tb-col"><span class="overline-title">{{label("Sn.")}}</span></th> <th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("districts") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('districts') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("title") }}</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"><span class="overline-title">{{ label('alias') }}</span></th>
<th class="tb-col" data-sortable="false"><span <th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
class="overline-title">{{ label("Action") }}</span> </th>
</th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> @php
@php $i = 1;
$i = 1; @endphp
@endphp @foreach ($data as $item)
@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' : ''; ?>">
<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">{{ $i++ }}</td>
<td class="tb-col">{{ $i++ }}</td><td class="tb-col"> <td class="tb-col">
{!! getFieldData("tbl_districts", "title", "district_id", $item->districts_id) !!} {!! getFieldData('tbl_districts', 'title', 'district_id', $item->districts_id) !!}
</td><td class="tb-col">{{ $item->title }}</td> </td>
<td class="tb-col"> <td class="tb-col">{{ $item->title }}</td>
<div class="alias-wrapper" data-id="{{$item->city_id}}"> <td class="tb-col">
<span class="alias">{{ $item->alias }}</span> <div class="alias-wrapper" data-id="{{ $item->city_id }}">
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->city_id}}" /> <span class="alias">{{ $item->alias }}</span>
</div> <input type="text" class="alias-input d-none" value="{{ $item->alias }}"
<span class="badge badge-soft-primary change-alias-badge">change alias</span> id="alias_{{ $item->city_id }}" />
</td> </div>
<td class="tb-col"> <span class="badge badge-soft-primary change-alias-badge">change alias</span>
<div class="dropdown d-inline-block"> </td>
<button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false"> <td class="tb-col">
<i class="ri-more-fill align-middle"></i> <div class="dropdown d-inline-block">
</button> <button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown"
<ul class="dropdown-menu dropdown-menu-end"> aria-expanded="false">
<li><a href="{{route('cities.show',[$item->city_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li> <i class="ri-more-fill align-middle"></i>
<li><a href="{{route('cities.edit',[$item->city_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li> </button>
<li> <ul class="dropdown-menu dropdown-menu-end">
<a href="{{route('cities.toggle',[$item->city_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)"> <li><a href="{{ route('cities.show', [$item->city_id]) }}" class="dropdown-item"><i
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }} class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
</a> <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> <li>
<li> <a href="{{ route('cities.toggle', [$item->city_id]) }}" class="dropdown-item toggle-item-btn"
<a href="{{route('cities.clone',[$item->city_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)"> onclick="confirmToggle(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }} <i class="ri-article-fill text-muted me-2 align-bottom"></i>
</a> {{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
</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 align-bottom me-2 text-muted"></i> {{ label('Delete') }}
</a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach </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>
</tbody> </li>
</table> <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>
</div> </ul>
</div> </div>
@endsection
</td>
@push("css") </tr>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css"> @endforeach
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
</tbody>
</table>
</div>
</div>
@endsection
@push('css')
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
@endpush @endpush
@push("js") @push('js')
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script> <script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script> <script>
$(document).ready(function(e) { $(document).ready(function(e) {
$('.change-alias-badge').on('click', function() { $('.change-alias-badge').on('click', function() {
var aliasWrapper = $(this).prev('.alias-wrapper'); var aliasWrapper = $(this).prev('.alias-wrapper');
var aliasSpan = aliasWrapper.find('.alias'); var aliasSpan = aliasWrapper.find('.alias');
var aliasInput = aliasWrapper.find('.alias-input'); var aliasInput = aliasWrapper.find('.alias-input');
var isEditing = $(this).hasClass('editing'); var isEditing = $(this).hasClass('editing');
aliasInput.toggleClass("d-none"); aliasInput.toggleClass("d-none");
if (isEditing) { if (isEditing) {
// Update alias text and switch to non-editing state // Update alias text and switch to non-editing state
var newAlias = aliasInput.val(); var newAlias = aliasInput.val();
aliasSpan.text(newAlias); aliasSpan.text(newAlias);
aliasSpan.show(); aliasSpan.show();
aliasInput.hide(); aliasInput.hide();
$(this).removeClass('editing').text('Change Alias'); $(this).removeClass('editing').text('Change Alias');
var articleId = $(aliasWrapper).data('id'); var articleId = $(aliasWrapper).data('id');
var ajaxUrl = "{{ route('cities.updatealias') }}"; var ajaxUrl = "{{ route('cities.updatealias') }}";
var data = { var data = {
articleId: articleId, articleId: articleId,
newAlias: newAlias newAlias: newAlias
}; };
$.ajax({ $.ajax({
url: ajaxUrl, url: ajaxUrl,
type: 'POST', type: 'POST',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
data: data, data: data,
success: function(response) { success: function(response) {
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(error); console.error(error);
} }
}); });
} else { } else {
// Switch to editing state // Switch to editing state
aliasSpan.hide(); aliasSpan.hide();
aliasInput.show().focus(); aliasInput.show().focus();
$(this).addClass('editing').text('Save Alias'); $(this).addClass('editing').text('Save Alias');
} }
}); });
var mytable = $(".dataTable").DataTable({ var mytable = $(".dataTable").DataTable({
ordering: true, ordering: true,
rowReorder: { rowReorder: {
//selector: 'tr' //selector: 'tr'
}, },
}); });
var isRowReorderComplete = false; var isRowReorderComplete = false;
mytable.on('row-reorder', function(e, diff, edit) { mytable.on('row-reorder', function(e, diff, edit) {
isRowReorderComplete = true; isRowReorderComplete = true;
}); });
mytable.on('draw', function() { mytable.on('draw', function() {
if (isRowReorderComplete) { if (isRowReorderComplete) {
var url = mytable.table().node().getAttribute('data-url'); var url = mytable.table().node().getAttribute('data-url');
var ids = mytable.rows().nodes().map(function(node) { var ids = mytable.rows().nodes().map(function(node) {
return $(node).data('id'); return $(node).data('id');
}).toArray(); }).toArray();
console.log(ids); console.log(ids);
$.ajax({ $.ajax({
url: url, url: url,
type: "POST", type: "POST",
headers: { headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content') "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
}, },
data: { data: {
id_order: ids id_order: ids
}, },
success: function(response) { success: function(response) {
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(error); console.error(error);
} }
}); });
isRowReorderComplete=false; isRowReorderComplete = false;
} }
});
}); });
});
function confirmDelete(url) { function confirmDelete(url) {
event.preventDefault(); event.preventDefault();
Swal.fire({ Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'You will not be able to recover this item!', text: 'You will not be able to recover this item!',
icon: 'warning', icon: 'warning',
@ -187,28 +195,29 @@ function confirmDelete(url) {
confirmButtonText: 'Delete', confirmButtonText: 'Delete',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'DELETE', type: 'DELETE',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Deleted!', 'The item has been deleted.', 'success'); Swal.fire('Deleted!', 'The item has been deleted.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error'); Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
} }
}); });
} }
}); });
} }
function confirmToggle(url) {
event.preventDefault(); function confirmToggle(url) {
Swal.fire({ event.preventDefault();
Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!', text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
icon: 'warning', icon: 'warning',
@ -216,28 +225,29 @@ function confirmToggle(url) {
confirmButtonText: 'Proceed', confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success'); Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error'); Swal.fire('Error!', 'An error occurred.', 'error');
} }
}); });
} }
}); });
} }
function confirmClone(url) {
event.preventDefault(); function confirmClone(url) {
Swal.fire({ event.preventDefault();
Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'Clonning will create replica of current row. No any linked data will be updated!', text: 'Clonning will create replica of current row. No any linked data will be updated!',
icon: 'warning', icon: 'warning',
@ -245,27 +255,24 @@ function confirmClone(url) {
confirmButtonText: 'Proceed', confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Updated!', 'Clonning Completed', 'success'); Swal.fire('Updated!', 'Clonning Completed', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error'); Swal.fire('Error!', 'An error occurred.', 'error');
} }
}); });
} }
}); });
} }
</script> </script>
@endpush @endpush

View File

@ -1,29 +1,38 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2><?php echo label('View Details'); ?></h2> <h2><?php echo label('View Details'); ?></h2>
<?php createButton("btn-primary btn-cancel","","Back to List",route('cities.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Back to List', route('cities.index')); ?>
</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 class='card-body'>
</div>
<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>
<div>
@endSection <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

@ -1,19 +1,35 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Company') }}</h2> <h2 class="">{{ label('Add Company') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('companies.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Cancel', route('companies.index')); ?>
</div> </div>
<div class='card-body'> <div class='card-body'>
<form action="{{$editable?route('companies.update',[$data->company_id]):route('companies.store')}}" id="updateCustomForm" method="POST" > <form action="{{ $editable ? route('companies.update', [$data->company_id]) : route('companies.store') }}"
@csrf <input type=hidden name='company_id' value='{{$editable?$data->company_id:''}}'/> id="updateCustomForm" method="POST">
<div class="row"><div class="col-lg-6">{{createText("title","title","Title",'',$editable?$data->title:'')}} @csrf <input type=hidden name='company_id' value='{{ $editable ? $data->company_id : '' }}' />
</div><div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description",$editable?$data->description:'')}} <div class="row">
</div><div class="col-lg-6">{{createText("address","address","Address",'',$editable?$data->address:'')}} <div class="col-lg-6">{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
</div><div class="col-lg-6">{{createCustomSelect('tbl_cities', 'title', 'city_id', $editable?$data->cities_id:'', 'Cities Id','cities_id', 'form-control select2','status<>-1')}}</div><div class="col-lg-6">{{createCustomSelect('tbl_companytypes', 'title', 'companytype_id', $editable?$data->companytypes_id:'', 'Companytypes Id','companytypes_id', 'form-control select2','status<>-1')}}</div><div class="col-lg-12 pb-2">{{createPlainTextArea("remarks",'',"Remarks",$editable?$data->remarks:'')}} </div>
</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?> <div class="col-lg-12 pb-2">
<?php createButton("btn-primary btn-cancel","","Cancel",route('companies.index')); ?> {{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }}
</div> </form></div></div> </div>
@endsection <div class="col-lg-6">{{ createText('address', 'address', 'Address', '', $editable ? $data->address : '') }}
</div>
<div class="col-lg-6">
{{ createCustomSelect('tbl_cities', 'title', 'city_id', $editable ? $data->cities_id : '', 'Cities Id', 'cities_id', 'form-control select2', 'status<>-1') }}
</div>
<div class="col-lg-6">
{{ createCustomSelect('tbl_companytypes', 'title', 'companytype_id', $editable ? $data->companytypes_id : '', 'Companytypes Id', 'companytypes_id', 'form-control select2', 'status<>-1') }}
</div>
<div class="col-lg-12 pb-2">{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
</div>
<div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('companies.index')); ?>
</div>
</form>
</div>
</div>
@endsection

View File

@ -1,190 +1,200 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class="card"> <div class="card">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Companies List") }}</h2> <h2>{{ label('Companies List') }}</h2>
<a href="{{ route('companies.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a> <a href="{{ route('companies.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
</div> </div>
<div class="card-body"> <div class="card-body">
<table class="table dataTable" id="tbl_companies" data-url="{{ route('companies.sort') }}"> <table class="dataTable table" id="tbl_companies" data-url="{{ route('companies.sort') }}">
<thead class="table-light"> <thead class="table-light">
<tr> <tr>
<th class="tb-col"><span class="overline-title">{{label("Sn.")}}</span></th> <th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("title") }}</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"><span class="overline-title">{{ label('alias') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("address") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('address') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("cities") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('cities') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("companytypes") }}</span></th> <th class="tb-col"><span class="overline-title">{{ label('companytypes') }}</span></th>
<th class="tb-col" data-sortable="false"><span <th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
class="overline-title">{{ label("Action") }}</span> </th>
</th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> @php
@php $i = 1;
$i = 1; @endphp
@endphp @foreach ($data as $item)
@foreach ($data as $item) <tr data-id="{{ $item->company_id }}" data-display_order="{{ $item->display_order }}"
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
<tr data-id="{{$item->company_id}}" data-display_order="{{$item->display_order}}" class="draggable-row <?php echo ($item->status==0)?"bg-light bg-danger":""; ?>"> <td class="tb-col">{{ $i++ }}</td>
<td class="tb-col">{{ $i++ }}</td><td class="tb-col">{{ $item->title }}</td> <td class="tb-col">{{ $item->title }}</td>
<td class="tb-col"> <td class="tb-col">
<div class="alias-wrapper" data-id="{{$item->company_id}}"> <div class="alias-wrapper" data-id="{{ $item->company_id }}">
<span class="alias">{{ $item->alias }}</span> <span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->company_id}}" /> <input type="text" class="alias-input d-none" value="{{ $item->alias }}"
</div> id="alias_{{ $item->company_id }}" />
<span class="badge badge-soft-primary change-alias-badge">change alias</span> </div>
</td> <span class="badge badge-soft-primary change-alias-badge">change alias</span>
<td class="tb-col">{{ $item->address }}</td> </td>
<td class="tb-col"> <td class="tb-col">{{ $item->address }}</td>
{!! getFieldData("tbl_cities", "title", "city_id", $item->cities_id) !!} <td class="tb-col">
</td><td class="tb-col"> {!! getFieldData('tbl_cities', 'title', 'city_id', $item->cities_id) !!}
{!! getFieldData("tbl_companytypes", "title", "companytype_id", $item->companytypes_id) !!} </td>
</td><td class="tb-col"> <td class="tb-col">
<div class="dropdown d-inline-block"> {!! getFieldData('tbl_companytypes', 'title', 'companytype_id', $item->companytypes_id) !!}
<button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false"> </td>
<i class="ri-more-fill align-middle"></i> <td class="tb-col">
</button> <div class="dropdown d-inline-block">
<ul class="dropdown-menu dropdown-menu-end"> <button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown"
<li><a href="{{route('companies.show',[$item->company_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li> aria-expanded="false">
<li><a href="{{route('companies.edit',[$item->company_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li> <i class="ri-more-fill align-middle"></i>
<li> </button>
<a href="{{route('companies.toggle',[$item->company_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)"> <ul class="dropdown-menu dropdown-menu-end">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }} <li><a href="{{ route('companies.show', [$item->company_id]) }}" class="dropdown-item"><i
</a> class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
<li><a href="{{ route('companies.edit', [$item->company_id]) }}"
</li> class="dropdown-item edit-item-btn"><i class="ri-pencil-fill text-muted me-2 align-bottom"></i>
<li> {{ label('Edit') }}</a></li>
<a href="{{route('companies.clone',[$item->company_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)"> <li>
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }} <a href="{{ route('companies.toggle', [$item->company_id]) }}" class="dropdown-item toggle-item-btn"
</a> onclick="confirmToggle(this.href)">
<i class="ri-article-fill text-muted me-2 align-bottom"></i>
</li> {{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
<li> </a>
<a href="{{route('companies.destroy',[$item->company_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i> {{ label('Delete') }}
</a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach </li>
<li>
<a href="{{ route('companies.clone', [$item->company_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>
</tbody> </li>
</table> <li>
<a href="{{ route('companies.destroy', [$item->company_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>
</div> </ul>
</div> </div>
@endsection
</td>
@push("css") </tr>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css"> @endforeach
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
</tbody>
</table>
</div>
</div>
@endsection
@push('css')
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
@endpush @endpush
@push("js") @push('js')
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script> <script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script> <script>
$(document).ready(function(e) { $(document).ready(function(e) {
$('.change-alias-badge').on('click', function() { $('.change-alias-badge').on('click', function() {
var aliasWrapper = $(this).prev('.alias-wrapper'); var aliasWrapper = $(this).prev('.alias-wrapper');
var aliasSpan = aliasWrapper.find('.alias'); var aliasSpan = aliasWrapper.find('.alias');
var aliasInput = aliasWrapper.find('.alias-input'); var aliasInput = aliasWrapper.find('.alias-input');
var isEditing = $(this).hasClass('editing'); var isEditing = $(this).hasClass('editing');
aliasInput.toggleClass("d-none"); aliasInput.toggleClass("d-none");
if (isEditing) { if (isEditing) {
// Update alias text and switch to non-editing state // Update alias text and switch to non-editing state
var newAlias = aliasInput.val(); var newAlias = aliasInput.val();
aliasSpan.text(newAlias); aliasSpan.text(newAlias);
aliasSpan.show(); aliasSpan.show();
aliasInput.hide(); aliasInput.hide();
$(this).removeClass('editing').text('Change Alias'); $(this).removeClass('editing').text('Change Alias');
var articleId = $(aliasWrapper).data('id'); var articleId = $(aliasWrapper).data('id');
var ajaxUrl = "{{ route('companies.updatealias') }}"; var ajaxUrl = "{{ route('companies.updatealias') }}";
var data = { var data = {
articleId: articleId, articleId: articleId,
newAlias: newAlias newAlias: newAlias
}; };
$.ajax({ $.ajax({
url: ajaxUrl, url: ajaxUrl,
type: 'POST', type: 'POST',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
data: data, data: data,
success: function(response) { success: function(response) {
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(error); console.error(error);
} }
}); });
} else { } else {
// Switch to editing state // Switch to editing state
aliasSpan.hide(); aliasSpan.hide();
aliasInput.show().focus(); aliasInput.show().focus();
$(this).addClass('editing').text('Save Alias'); $(this).addClass('editing').text('Save Alias');
} }
}); });
var mytable = $(".dataTable").DataTable({ var mytable = $(".dataTable").DataTable({
ordering: true, ordering: true,
rowReorder: { rowReorder: {
//selector: 'tr' //selector: 'tr'
}, },
}); });
var isRowReorderComplete = false; var isRowReorderComplete = false;
mytable.on('row-reorder', function(e, diff, edit) { mytable.on('row-reorder', function(e, diff, edit) {
isRowReorderComplete = true; isRowReorderComplete = true;
}); });
mytable.on('draw', function() { mytable.on('draw', function() {
if (isRowReorderComplete) { if (isRowReorderComplete) {
var url = mytable.table().node().getAttribute('data-url'); var url = mytable.table().node().getAttribute('data-url');
var ids = mytable.rows().nodes().map(function(node) { var ids = mytable.rows().nodes().map(function(node) {
return $(node).data('id'); return $(node).data('id');
}).toArray(); }).toArray();
console.log(ids); console.log(ids);
$.ajax({ $.ajax({
url: url, url: url,
type: "POST", type: "POST",
headers: { headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content') "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
}, },
data: { data: {
id_order: ids id_order: ids
}, },
success: function(response) { success: function(response) {
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(error); console.error(error);
} }
}); });
isRowReorderComplete=false; isRowReorderComplete = false;
} }
});
}); });
});
function confirmDelete(url) { function confirmDelete(url) {
event.preventDefault(); event.preventDefault();
Swal.fire({ Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'You will not be able to recover this item!', text: 'You will not be able to recover this item!',
icon: 'warning', icon: 'warning',
@ -192,28 +202,29 @@ function confirmDelete(url) {
confirmButtonText: 'Delete', confirmButtonText: 'Delete',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Deleted!', 'The item has been deleted.', 'success'); Swal.fire('Deleted!', 'The item has been deleted.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error'); Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
} }
}); });
} }
}); });
} }
function confirmToggle(url) {
event.preventDefault(); function confirmToggle(url) {
Swal.fire({ event.preventDefault();
Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!', text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
icon: 'warning', icon: 'warning',
@ -221,28 +232,29 @@ function confirmToggle(url) {
confirmButtonText: 'Proceed', confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success'); Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error'); Swal.fire('Error!', 'An error occurred.', 'error');
} }
}); });
} }
}); });
} }
function confirmClone(url) {
event.preventDefault(); function confirmClone(url) {
Swal.fire({ event.preventDefault();
Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'Clonning will create replica of current row. No any linked data will be updated!', text: 'Clonning will create replica of current row. No any linked data will be updated!',
icon: 'warning', icon: 'warning',
@ -250,27 +262,24 @@ function confirmClone(url) {
confirmButtonText: 'Proceed', confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Updated!', 'Clonning Completed', 'success'); Swal.fire('Updated!', 'Clonning Completed', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error'); Swal.fire('Error!', 'An error occurred.', 'error');
} }
}); });
} }
}); });
} }
</script> </script>
@endpush @endpush

View File

@ -1,29 +1,40 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2><?php echo label('View Details'); ?></h2> <h2><?php echo label('View Details'); ?></h2>
<?php createButton("btn-primary btn-cancel","","Back to List",route('companies.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Back to List', route('companies.index')); ?>
</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>Description :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->description}}</span></p><p><b>Address :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->address}}</span></p><p><b>Cities Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->cities_id}}</span></p><p><b>Companytypes Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{$data->companytypes_id}}</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 class='card-body'>
</div>
<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>Address :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->address }}</span></p>
<p><b>Cities Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->cities_id }}</span></p>
<p><b>Companytypes Id :&nbsp;&nbsp;&nbsp;&nbsp;</b> <span>{{ $data->companytypes_id }}</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>
<div>
@endSection <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

@ -1,18 +1,27 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Company Type') }}</h2> <h2 class="">{{ label('Add Company Type') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('companytypes.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Cancel', route('companytypes.index')); ?>
</div> </div>
<div class='card-body'> <div class='card-body'>
<form action="{{$editable?route('companytypes.update',[$data->companytype_id]):route('companytypes.store')}}" id="updateCustomForm" method="POST" > <form action="{{ $editable ? route('companytypes.update', [$data->companytype_id]) : route('companytypes.store') }}"
@csrf <input type=hidden name='companytype_id' value='{{$editable?$data->companytype_id:''}}'/> id="updateCustomForm" method="POST">
<div class="row"><div class="col-lg-6">{{createText("title","title","Title",'',$editable?$data->title:'')}} @csrf <input type=hidden name='companytype_id' value='{{ $editable ? $data->companytype_id : '' }}' />
</div><div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description",$editable?$data->description:'')}} <div class="row">
</div><div class="col-lg-12 pb-2">{{createPlainTextArea("remarks",'',"Remarks",$editable?$data->remarks:'')}} <div class="col-lg-6">{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?> </div>
<?php createButton("btn-primary btn-cancel","","Cancel",route('companytypes.index')); ?> <div class="col-lg-12 pb-2">
</div> </form></div></div> {{ createTextarea('description', 'description ckeditor-classic', 'Description', $editable ? $data->description : '') }}
@endsection </div>
<div class="col-lg-12 pb-2">{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
</div>
<div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('companytypes.index')); ?>
</div>
</form>
</div>
</div>
@endsection

View File

@ -1,182 +1,190 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class="card"> <div class="card">
<div class="card-header d-flex justify-content-between align-items-center"> <div class="card-header d-flex justify-content-between align-items-center">
<h2>{{ label("Company Type List") }}</h2> <h2>{{ label('Company Type List') }}</h2>
<a href="{{ route('companytypes.create') }}" class="btn btn-primary"><span>{{label("Create New")}}</span></a> <a href="{{ route('companytypes.create') }}" class="btn btn-primary"><span>{{ label('Create New') }}</span></a>
</div> </div>
<div class="card-body"> <div class="card-body">
<table class="table dataTable" id="tbl_companytypes" data-url="{{ route('companytypes.sort') }}"> <table class="dataTable table" id="tbl_companytypes" data-url="{{ route('companytypes.sort') }}">
<thead class="table-light"> <thead class="table-light">
<tr> <tr>
<th class="tb-col"><span class="overline-title">{{label("Sn.")}}</span></th> <th class="tb-col"><span class="overline-title">{{ label('Sn.') }}</span></th>
<th class="tb-col"><span class="overline-title">{{ label("title") }}</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"><span class="overline-title">{{ label('alias') }}</span></th>
<th class="tb-col" data-sortable="false"><span <th class="tb-col" data-sortable="false"><span class="overline-title">{{ label('Action') }}</span>
class="overline-title">{{ label("Action") }}</span> </th>
</th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> @php
@php $i = 1;
$i = 1; @endphp
@endphp @foreach ($data as $item)
@foreach ($data as $item) <tr data-id="{{ $item->companytype_id }}" data-display_order="{{ $item->display_order }}"
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
<tr data-id="{{$item->companytype_id}}" data-display_order="{{$item->display_order}}" class="draggable-row <?php echo ($item->status==0)?"bg-light bg-danger":""; ?>"> <td class="tb-col">{{ $i++ }}</td>
<td class="tb-col">{{ $i++ }}</td><td class="tb-col">{{ $item->title }}</td> <td class="tb-col">{{ $item->title }}</td>
<td class="tb-col"> <td class="tb-col">
<div class="alias-wrapper" data-id="{{$item->companytype_id}}"> <div class="alias-wrapper" data-id="{{ $item->companytype_id }}">
<span class="alias">{{ $item->alias }}</span> <span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->companytype_id}}" /> <input type="text" class="alias-input d-none" value="{{ $item->alias }}"
</div> id="alias_{{ $item->companytype_id }}" />
<span class="badge badge-soft-primary change-alias-badge">change alias</span> </div>
</td> <span class="badge badge-soft-primary change-alias-badge">change alias</span>
<td class="tb-col"> </td>
<div class="dropdown d-inline-block"> <td class="tb-col">
<button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown" aria-expanded="false"> <div class="dropdown d-inline-block">
<i class="ri-more-fill align-middle"></i> <button class="btn btn-soft-secondary btn-sm dropdown" type="button" data-bs-toggle="dropdown"
</button> aria-expanded="false">
<ul class="dropdown-menu dropdown-menu-end"> <i class="ri-more-fill align-middle"></i>
<li><a href="{{route('companytypes.show',[$item->companytype_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li> </button>
<li><a href="{{route('companytypes.edit',[$item->companytype_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li> <ul class="dropdown-menu dropdown-menu-end">
<li> <li><a href="{{ route('companytypes.show', [$item->companytype_id]) }}" class="dropdown-item"><i
<a href="{{route('companytypes.toggle',[$item->companytype_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)"> class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }} <li><a href="{{ route('companytypes.edit', [$item->companytype_id]) }}"
</a> class="dropdown-item edit-item-btn"><i class="ri-pencil-fill text-muted me-2 align-bottom"></i>
{{ label('Edit') }}</a></li>
</li> <li>
<li> <a href="{{ route('companytypes.toggle', [$item->companytype_id]) }}"
<a href="{{route('companytypes.clone',[$item->companytype_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmClone(this.href)"> class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-file-copy-line align-bottom me-2 text-muted"></i> {{ label('Clone') }} <i class="ri-article-fill text-muted me-2 align-bottom"></i>
</a> {{ $item->status == 1 ? label('Unpublish') : label('Publish') }}
</a>
</li>
<li>
<a href="{{route('companytypes.destroy',[$item->companytype_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i> {{ label('Delete') }}
</a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach </li>
<li>
<a href="{{ route('companytypes.clone', [$item->companytype_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>
</tbody> </li>
</table> <li>
<a href="{{ route('companytypes.destroy', [$item->companytype_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>
</div> </ul>
</div> </div>
@endsection
</td>
@push("css") </tr>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css"> @endforeach
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
</tbody>
</table>
</div>
</div>
@endsection
@push('css')
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
@endpush @endpush
@push("js") @push('js')
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script> <script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script> <script>
$(document).ready(function(e) { $(document).ready(function(e) {
$('.change-alias-badge').on('click', function() { $('.change-alias-badge').on('click', function() {
var aliasWrapper = $(this).prev('.alias-wrapper'); var aliasWrapper = $(this).prev('.alias-wrapper');
var aliasSpan = aliasWrapper.find('.alias'); var aliasSpan = aliasWrapper.find('.alias');
var aliasInput = aliasWrapper.find('.alias-input'); var aliasInput = aliasWrapper.find('.alias-input');
var isEditing = $(this).hasClass('editing'); var isEditing = $(this).hasClass('editing');
aliasInput.toggleClass("d-none"); aliasInput.toggleClass("d-none");
if (isEditing) { if (isEditing) {
// Update alias text and switch to non-editing state // Update alias text and switch to non-editing state
var newAlias = aliasInput.val(); var newAlias = aliasInput.val();
aliasSpan.text(newAlias); aliasSpan.text(newAlias);
aliasSpan.show(); aliasSpan.show();
aliasInput.hide(); aliasInput.hide();
$(this).removeClass('editing').text('Change Alias'); $(this).removeClass('editing').text('Change Alias');
var articleId = $(aliasWrapper).data('id'); var articleId = $(aliasWrapper).data('id');
var ajaxUrl = "{{ route('companytypes.updatealias') }}"; var ajaxUrl = "{{ route('companytypes.updatealias') }}";
var data = { var data = {
articleId: articleId, articleId: articleId,
newAlias: newAlias newAlias: newAlias
}; };
$.ajax({ $.ajax({
url: ajaxUrl, url: ajaxUrl,
type: 'POST', type: 'POST',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
data: data, data: data,
success: function(response) { success: function(response) {
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(error); console.error(error);
} }
}); });
} else { } else {
// Switch to editing state // Switch to editing state
aliasSpan.hide(); aliasSpan.hide();
aliasInput.show().focus(); aliasInput.show().focus();
$(this).addClass('editing').text('Save Alias'); $(this).addClass('editing').text('Save Alias');
} }
}); });
var mytable = $(".dataTable").DataTable({ var mytable = $(".dataTable").DataTable({
ordering: true, ordering: true,
rowReorder: { rowReorder: {
//selector: 'tr' //selector: 'tr'
}, },
}); });
var isRowReorderComplete = false; var isRowReorderComplete = false;
mytable.on('row-reorder', function(e, diff, edit) { mytable.on('row-reorder', function(e, diff, edit) {
isRowReorderComplete = true; isRowReorderComplete = true;
}); });
mytable.on('draw', function() { mytable.on('draw', function() {
if (isRowReorderComplete) { if (isRowReorderComplete) {
var url = mytable.table().node().getAttribute('data-url'); var url = mytable.table().node().getAttribute('data-url');
var ids = mytable.rows().nodes().map(function(node) { var ids = mytable.rows().nodes().map(function(node) {
return $(node).data('id'); return $(node).data('id');
}).toArray(); }).toArray();
console.log(ids); console.log(ids);
$.ajax({ $.ajax({
url: url, url: url,
type: "POST", type: "POST",
headers: { headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content') "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
}, },
data: { data: {
id_order: ids id_order: ids
}, },
success: function(response) { success: function(response) {
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(error); console.error(error);
} }
}); });
isRowReorderComplete=false; isRowReorderComplete = false;
} }
});
}); });
});
function confirmDelete(url) { function confirmDelete(url) {
event.preventDefault(); event.preventDefault();
Swal.fire({ Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'You will not be able to recover this item!', text: 'You will not be able to recover this item!',
icon: 'warning', icon: 'warning',
@ -184,28 +192,29 @@ function confirmDelete(url) {
confirmButtonText: 'Delete', confirmButtonText: 'Delete',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Deleted!', 'The item has been deleted.', 'success'); Swal.fire('Deleted!', 'The item has been deleted.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred while deleting the item.', 'error'); Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
} }
}); });
} }
}); });
} }
function confirmToggle(url) {
event.preventDefault(); function confirmToggle(url) {
Swal.fire({ event.preventDefault();
Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!', text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
icon: 'warning', icon: 'warning',
@ -213,28 +222,29 @@ function confirmToggle(url) {
confirmButtonText: 'Proceed', confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success'); Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error'); Swal.fire('Error!', 'An error occurred.', 'error');
} }
}); });
} }
}); });
} }
function confirmClone(url) {
event.preventDefault(); function confirmClone(url) {
Swal.fire({ event.preventDefault();
Swal.fire({
title: 'Are you sure?', title: 'Are you sure?',
text: 'Clonning will create replica of current row. No any linked data will be updated!', text: 'Clonning will create replica of current row. No any linked data will be updated!',
icon: 'warning', icon: 'warning',
@ -242,27 +252,24 @@ function confirmClone(url) {
confirmButtonText: 'Proceed', confirmButtonText: 'Proceed',
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
reverseButtons: true reverseButtons: true
}).then((result) => { }).then((result) => {
if (result.isConfirmed) { if (result.isConfirmed) {
$.ajax({ $.ajax({
url: url, url: url,
type: 'GET', type: 'GET',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
success: function(response) { success: function(response) {
Swal.fire('Updated!', 'Clonning Completed', 'success'); Swal.fire('Updated!', 'Clonning Completed', 'success');
location.reload(); location.reload();
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
Swal.fire('Error!', 'An error occurred.', 'error'); Swal.fire('Error!', 'An error occurred.', 'error');
} }
}); });
} }
}); });
} }
</script> </script>
@endpush @endpush

View File

@ -1,29 +1,37 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2><?php echo label('View Details'); ?></h2> <h2><?php echo label('View Details'); ?></h2>
<?php createButton("btn-primary btn-cancel","","Back to List",route('companytypes.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Back to List', route('companytypes.index')); ?>
</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>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 class='card-body'>
</div>
<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>
<div>
@endSection <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

@ -1,34 +1,35 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<!-- start page title --> <!-- start page title -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between"> <div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">Add Country</h4> <h4 class="mb-sm-0">Add Country</h4>
<div class="page-title-right"> <div class="page-title-right">
<ol class="breadcrumb m-0"> <ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li> <li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">Add Country</li> <li class="breadcrumb-item active">Add Country</li>
</ol> </ol>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> <!-- end page title -->
<!-- end page title --> <form action="{{ route('countries.store') }}" id="storeCustomForm" method="POST">
<form action="{{route('countries.store')}}" id="storeCustomForm" method="POST"> @csrf
@csrf <div class='card'>
<div class='card'> <div class='card-body'>
<div class='card-body'>
<div class="row"> <div class="row">
<div class="col-lg-12">{{createText("title","title","Title")}}</div> <div class="col-lg-12">{{ createText('title', 'title', 'Title') }}</div>
<div class="col-lg-12 pb-2">{{createTextarea("description","description ckeditor-classic","Description")}}</div> <div class="col-lg-12 pb-2">{{ createTextarea('description', 'description ckeditor-classic', 'Description') }}
<div class="col-lg-12 pb-2">{{createPlainTextArea("remarks","remarks ","Remarks")}}</div> </div>
</div> <div class="col-lg-12 pb-2">{{ createPlainTextArea('remarks', 'remarks ', 'Remarks') }}</div>
</div> </div>
</div> </div>
<div class="col-md-12"> </div>
<?php createButton("btn-primary btn-store","","Submit"); ?> <div class="col-md-12">
<?php createButton("btn-danger btn-cancel","","Cancel",route('countries.index')); ?> <?php createButton('btn-primary btn-store', '', 'Submit'); ?>
</div> <?php createButton('btn-danger btn-cancel', '', 'Cancel', route('countries.index')); ?>
</form> </div>
@endsection </form>
@endsection

View File

@ -1,39 +1,40 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<!-- start page title --> <!-- start page title -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between"> <div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">Edit Country </h4> <h4 class="mb-sm-0">Edit Country </h4>
<div class="page-title-right"> <div class="page-title-right">
<ol class="breadcrumb m-0"> <ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li> <li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">Edit Country </li> <li class="breadcrumb-item active">Edit Country </li>
</ol> </ol>
</div> </div>
</div>
</div> </div>
</div> </div>
</div> <!-- end page title -->
<!-- end page title --> <form action="{{ route('countries.update', [$data->country_id]) }}" id="updateCustomForm" method="POST">
<form action="{{route('countries.update',[$data->country_id])}}" id="updateCustomForm" method="POST" > @csrf <input type=hidden name='country_id' value='{{ $data->country_id }}' />
@csrf <input type=hidden name='country_id' value='{{$data->country_id}}'/> <div class='card'>
<div class='card'>
<div class='card-body'>
<div class='card-body'>
<div class="row">
<div class="row"> <div class="col-lg-12">{{ createText('title', 'title', 'Title', '', $data->title) }}</div>
<div class="col-lg-12">{{createText("title","title","Title",'',$data->title)}}</div> <div class="col-lg-12 pb-4">
<div class="col-lg-12 pb-4">{{createTextarea("description","description ckeditor-classic","Description",$data->description)}}</div> {{ createTextarea('description', 'description ckeditor-classic', 'Description', $data->description) }}</div>
<div class="border border-dashed"></div> <div class="border border-dashed"></div>
<div class="col-lg-12 pb-2">{{createPlainTextArea("remarks",'',"Remarks",$data->remarks)}}</div> <div class="col-lg-12 pb-2">{{ createPlainTextArea('remarks', '', 'Remarks', $data->remarks) }}</div>
</div> </div>
</div> </div>
<div class="card-footer"> <div class="card-footer">
<div class="col-md-12"><?php createButton("btn-primary btn-update","","Update"); ?> <div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Update'); ?>
<?php createButton("btn-danger btn-cancel","","Cancel",route('countries.index')); ?> <?php createButton('btn-danger btn-cancel', '', 'Cancel', route('countries.index')); ?>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
@endsection @endsection

View File

@ -1,241 +1,253 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class="row"> <div class="row">
<div class="col-lg-4"> <div class="col-lg-4">
<form action="{{route('countries.store')}}" id="storeCustomForm" method="POST"> <form action="{{ route('countries.store') }}" id="storeCustomForm" method="POST">
@csrf @csrf
<div class='card'> <div class='card'>
<div class="card-header"> <div class="card-header">
<h2 class="card-title mb-0">Add Country</h2> <h2 class="card-title mb-0">Add Country</h2>
</div> </div>
<div class='card-body'> <div class='card-body'>
<div class="row"> <div class="row">
<div class="col-lg-12">{{createText("title","title","Title")}}</div> <div class="col-lg-12">{{ createText('title', 'title', 'Title') }}</div>
<div class="border border-dashed"></div> <div class="border border-dashed"></div>
<div class="col-lg-12 pb-3">{{createTextarea("description","description ","Description")}}</div> <div class="col-lg-12 pb-3">{{ createTextarea('description', 'description ', 'Description') }}</div>
<div class="border border-dashed"></div> <div class="border border-dashed"></div>
<div class="col-lg-12 pb-2">{{createPlainTextArea("remarks","remarks ","Remarks")}}</div> <div class="col-lg-12 pb-2">{{ createPlainTextArea('remarks', 'remarks ', 'Remarks') }}</div>
</div>
</div>
<div class="card-footer">
<div class="col-md-12">
<?php createButton("btn-primary btn-store", "", "Submit");?>
<?php createButton("btn-danger btn-cancel", "", "Cancel", route('countries.index'));?>
</div>
</div>
</div>
</form>
</div>
<div class="col-lg-8">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2 class="card-title mb-0">{{ label("Countries List") }}</h2>
</div>
<div class="card-body">
<table class="table dataTable" id="tbl_countries" data-url="{{ route('countries.sort') }}">
<thead class="table-light">
<tr>
<th class="tb-col text-uppercase"><span class="overline-title">{{label("Sn.")}}</span></th>
<th class="tb-col text-uppercase"><span class="overline-title">{{ label("title") }}</span></th>
<th class="tb-col text-uppercase"><span class="overline-title">{{ label("alias") }}</span></th>
<th class="tb-col text-uppercase" data-sortable="false"><span
class="overline-title">{{ label("Action") }}</span>
</th>
</tr>
</thead>
<tbody>
@php
$i = 1;
@endphp
@foreach ($data as $item)
<tr data-id="{{$item->country_id}}" data-display_order="{{$item->display_order}}" class="draggable-row <?php echo ($item->status == 0) ? "bg-light bg-danger" : ""; ?>">
<td class="tb-col">{{ $i++ }}</td><td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{$item->country_id}}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}" id="alias_{{$item->country_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('countries.show',[$item->country_id])}}" class="dropdown-item"><i class="ri-eye-fill align-bottom me-2 text-muted"></i> {{label("View")}}</a></li>
<li><a href="{{route('countries.edit',[$item->country_id])}}" class="dropdown-item edit-item-btn"><i class="ri-pencil-fill align-bottom me-2 text-muted"></i> {{label("Edit")}}</a></li>
<li>
<a href="{{route('countries.toggle',[$item->country_id])}}" class="dropdown-item toggle-item-btn" onclick="confirmToggle(this.href)">
<i class="ri-article-fill align-bottom me-2 text-muted"></i> {{ ($item->status==1)?label('Unpublish'):label('Publish') }}
</a>
</li>
<li>
<a href="{{route('countries.destroy',[$item->country_id])}}" class="dropdown-item remove-item-btn" onclick="confirmDelete(this.href)">
<i class="ri-delete-bin-fill align-bottom me-2 text-muted"></i> {{ label('Delete') }}
</a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div> </div>
</div>
<div class="card-footer">
<div class="col-md-12">
<?php createButton('btn-primary btn-store', '', 'Submit'); ?>
<?php createButton('btn-danger btn-cancel', '', 'Cancel', route('countries.index')); ?>
</div>
</div>
</div> </div>
</form>
</div> </div>
<div class="col-lg-8">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h2 class="card-title mb-0">{{ label('Countries List') }}</h2>
</div>
<div class="card-body">
<table class="dataTable table" id="tbl_countries" data-url="{{ route('countries.sort') }}">
<thead class="table-light">
<tr>
<th class="tb-col text-uppercase"><span class="overline-title">{{ label('Sn.') }}</span></th>
<th class="tb-col text-uppercase"><span class="overline-title">{{ label('title') }}</span></th>
<th class="tb-col text-uppercase"><span class="overline-title">{{ label('alias') }}</span></th>
<th class="tb-col text-uppercase" data-sortable="false"><span
class="overline-title">{{ label('Action') }}</span>
</th>
</tr>
</thead>
<tbody>
@php
$i = 1;
@endphp
@foreach ($data as $item)
<tr data-id="{{ $item->country_id }}" data-display_order="{{ $item->display_order }}"
class="draggable-row <?php echo $item->status == 0 ? 'bg-light bg-danger' : ''; ?>">
<td class="tb-col">{{ $i++ }}</td>
<td class="tb-col">{{ $item->title }}</td>
<td class="tb-col">
<div class="alias-wrapper" data-id="{{ $item->country_id }}">
<span class="alias">{{ $item->alias }}</span>
<input type="text" class="alias-input d-none" value="{{ $item->alias }}"
id="alias_{{ $item->country_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('countries.show', [$item->country_id]) }}" class="dropdown-item"><i
class="ri-eye-fill text-muted me-2 align-bottom"></i> {{ label('View') }}</a></li>
<li><a href="{{ route('countries.edit', [$item->country_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('countries.toggle', [$item->country_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('countries.destroy', [$item->country_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 @endsection
@push("css") @push('css')
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/1.13.5/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/rowreorder/1.4.0/css/rowReorder.dataTables.min.css">
@endpush @endpush
@push("js") @push('js')
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.68/vfs_fonts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.13.5/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script> <script src="https://cdn.datatables.net/rowreorder/1.4.0/js/dataTables.rowReorder.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script> <script>
$(document).ready(function(e) { $(document).ready(function(e) {
$('.change-alias-badge').on('click', function() { $('.change-alias-badge').on('click', function() {
var aliasWrapper = $(this).prev('.alias-wrapper'); var aliasWrapper = $(this).prev('.alias-wrapper');
var aliasSpan = aliasWrapper.find('.alias'); var aliasSpan = aliasWrapper.find('.alias');
var aliasInput = aliasWrapper.find('.alias-input'); var aliasInput = aliasWrapper.find('.alias-input');
var isEditing = $(this).hasClass('editing'); var isEditing = $(this).hasClass('editing');
aliasInput.toggleClass("d-none"); aliasInput.toggleClass("d-none");
if (isEditing) { if (isEditing) {
// Update alias text and switch to non-editing state // Update alias text and switch to non-editing state
var newAlias = aliasInput.val(); var newAlias = aliasInput.val();
aliasSpan.text(newAlias); aliasSpan.text(newAlias);
aliasSpan.show(); aliasSpan.show();
aliasInput.hide(); aliasInput.hide();
$(this).removeClass('editing').text('Change Alias'); $(this).removeClass('editing').text('Change Alias');
var articleId = $(aliasWrapper).data('id'); var articleId = $(aliasWrapper).data('id');
var ajaxUrl = "{{ route('countries.updatealias') }}"; var ajaxUrl = "{{ route('countries.updatealias') }}";
var data = { var data = {
articleId: articleId, articleId: articleId,
newAlias: newAlias newAlias: newAlias
}; };
$.ajax({ $.ajax({
url: ajaxUrl, url: ajaxUrl,
type: 'POST', type: 'POST',
headers: { headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}, },
data: data, data: data,
success: function(response) { success: function(response) {
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(error); console.error(error);
} }
}); });
} else { } else {
// Switch to editing state // Switch to editing state
aliasSpan.hide(); aliasSpan.hide();
aliasInput.show().focus(); aliasInput.show().focus();
$(this).addClass('editing').text('Save Alias'); $(this).addClass('editing').text('Save Alias');
} }
}); });
var mytable = $(".dataTable").DataTable({ var mytable = $(".dataTable").DataTable({
ordering: true, ordering: true,
rowReorder: { rowReorder: {
//selector: 'tr' //selector: 'tr'
}, },
}); });
var isRowReorderComplete = false; var isRowReorderComplete = false;
mytable.on('row-reorder', function(e, diff, edit) { mytable.on('row-reorder', function(e, diff, edit) {
isRowReorderComplete = true; isRowReorderComplete = true;
}); });
mytable.on('draw', function() { mytable.on('draw', function() {
if (isRowReorderComplete) { if (isRowReorderComplete) {
var url = mytable.table().node().getAttribute('data-url'); var url = mytable.table().node().getAttribute('data-url');
var ids = mytable.rows().nodes().map(function(node) { var ids = mytable.rows().nodes().map(function(node) {
return $(node).data('id'); return $(node).data('id');
}).toArray(); }).toArray();
console.log(ids); console.log(ids);
$.ajax({ $.ajax({
url: url, url: url,
type: "POST", type: "POST",
headers: { headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content') "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
}, },
data: { data: {
id_order: ids id_order: ids
}, },
success: function(response) { success: function(response) {
console.log(response); console.log(response);
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(error); console.error(error);
} }
}); });
isRowReorderComplete=false; isRowReorderComplete = false;
} }
}); });
}); });
function confirmDelete(url) {
event.preventDefault(); function confirmDelete(url) {
Swal.fire({ event.preventDefault();
title: 'Are you sure?', Swal.fire({
text: 'You will not be able to recover this item!', title: 'Are you sure?',
icon: 'warning', text: 'You will not be able to recover this item!',
showCancelButton: true, icon: 'warning',
confirmButtonText: 'Delete', showCancelButton: true,
cancelButtonText: 'Cancel', confirmButtonText: 'Delete',
reverseButtons: true cancelButtonText: 'Cancel',
}).then((result) => { reverseButtons: true
if (result.isConfirmed) { }).then((result) => {
$.ajax({ if (result.isConfirmed) {
url: url, $.ajax({
type: 'DELETE', url: url,
headers: { type: 'DELETE',
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') headers: {
}, 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
success: function(response) { },
Swal.fire('Deleted!', 'The item has been deleted.', 'success'); success: function(response) {
location.reload(); 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'); error: function(xhr, status, error) {
} Swal.fire('Error!', 'An error occurred while deleting the item.', 'error');
}); }
} });
}); }
} });
function confirmToggle(url) { }
event.preventDefault();
Swal.fire({ function confirmToggle(url) {
title: 'Are you sure?', event.preventDefault();
text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!', Swal.fire({
icon: 'warning', title: 'Are you sure?',
showCancelButton: true, text: 'Publish Status of Item will be changed!! if Unpublished, links will be dead!',
confirmButtonText: 'Proceed', icon: 'warning',
cancelButtonText: 'Cancel', showCancelButton: true,
reverseButtons: true confirmButtonText: 'Proceed',
}).then((result) => { cancelButtonText: 'Cancel',
if (result.isConfirmed) { reverseButtons: true
$.ajax({ }).then((result) => {
url: url, if (result.isConfirmed) {
type: 'GET', $.ajax({
headers: { url: url,
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') type: 'GET',
}, headers: {
success: function(response) { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
Swal.fire('Updated!', 'Publishing Status has been updated.', 'success'); },
location.reload(); success: function(response) {
}, Swal.fire('Updated!', 'Publishing Status has been updated.', 'success');
error: function(xhr, status, error) { location.reload();
Swal.fire('Error!', 'An error occurred.', 'error'); },
} error: function(xhr, status, error) {
}); Swal.fire('Error!', 'An error occurred.', 'error');
} }
}); });
} }
</script> });
}
</script>
@endpush @endpush

View File

@ -1,29 +1,37 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2><?php echo label('View Details'); ?></h2> <h2><?php echo label('View Details'); ?></h2>
<?php createButton("btn-primary btn-cancel","","Back to List",route('countries.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Back to List', route('countries.index')); ?>
</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>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 class='card-body'>
</div>
<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>
<div>
@endSection <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

@ -1,17 +1,24 @@
@extends('backend.template') @extends('layouts.app')
@section('content') @section('content')
<div class='card'> <div class='card'>
<div class='card-header d-flex justify-content-between align-items-center'> <div class='card-header d-flex justify-content-between align-items-center'>
<h2 class="">{{ label('Add Dags') }}</h2> <h2 class="">{{ label('Add Dags') }}</h2>
<?php createButton("btn-primary btn-cancel","","Cancel",route('dags.index')); ?> <?php createButton('btn-primary btn-cancel', '', 'Cancel', route('dags.index')); ?>
</div> </div>
<div class='card-body'> <div class='card-body'>
<form action="{{$editable?route('dags.update',[$data->dag_id]):route('dags.store')}}" id="updateCustomForm" method="POST" > <form action="{{ $editable ? route('dags.update', [$data->dag_id]) : route('dags.store') }}" id="updateCustomForm"
@csrf <input type=hidden name='dag_id' value='{{$editable?$data->dag_id:''}}'/> method="POST">
<div class="row"><div class="col-lg-6">{{createText("title","title","Title",'',$editable?$data->title:'')}} @csrf <input type=hidden name='dag_id' value='{{ $editable ? $data->dag_id : '' }}' />
</div><div class="col-lg-12 pb-2">{{createPlainTextArea("remarks",'',"Remarks",$editable?$data->remarks:'')}} <div class="row">
</div> <div class="col-md-12"><?php createButton("btn-primary btn-update","","Submit"); ?> <div class="col-lg-6">{{ createText('title', 'title', 'Title', '', $editable ? $data->title : '') }}
<?php createButton("btn-primary btn-cancel","","Cancel",route('dags.index')); ?> </div>
</div> </form></div></div> <div class="col-lg-12 pb-2">{{ createPlainTextArea('remarks', '', 'Remarks', $editable ? $data->remarks : '') }}
@endsection </div>
<div class="col-md-12"><?php createButton('btn-primary btn-update', '', 'Submit'); ?>
<?php createButton('btn-primary btn-cancel', '', 'Cancel', route('dags.index')); ?>
</div>
</form>
</div>
</div>
@endsection

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