This commit is contained in:
sayaliparab
2024-06-07 12:44:51 +05:30
parent 2d7e19fd9b
commit d107d4ab37
9 changed files with 686 additions and 281 deletions

View File

@@ -0,0 +1,124 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\ManageState;
use Illuminate\Http\Request;
use Exception;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
class ManageLocationController extends Controller
{
/*
Created By : Sayali parab
Created at : 07 June 2024
Use : To get the page.
*/
public function index()
{
$location = ManageState::latest()->get();
return view('Admin.pages.manage_states.manage_states', compact('location'));
}
/*
Created By : Sayali parab
Created at : 07 June 2024
Use : To store the location.
*/
public function store(Request $request)
{
try {
$location = new ManageState();
$location->name = $request->location_name;
$location->save();
return response()->json(['success' => true, 'status' => 200]);
} catch (\Exception $e) {
// Log the exception or handle it as needed
return response()->json(['success' => false, 'error' => $e->getMessage(), 'status' => 500]);
}
}
/*
Created By : Sayali parab
Created at : 07 June 2024
Use : To change status.
*/
public function change_location_status(Request $request)
{
try {
DB::beginTransaction();
$status = ManageState::find($request->location_id);
$status->is_active = $request->status;
$status->save();
// return response()->json(['status' => 200]);
DB::commit();
return jsonResponseWithSuccessMessage(__('success.update_data'));
} catch (Exception $e) {
Log::error("Update Status function Load Failed " . $e->getMessage());
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
/*
Created By : Sayali parab
Created at : 07 June 2024
Use : To delete location.
*/
public function delete_location($id)
{
try {
DB::beginTransaction();
$passport = ManageState::find($id);
$passport->delete();
DB::commit();
return response()->json(['success' => true, 'status' => 200]);
} catch (Exception $e) {
DB::rollBack();
Log::error("delete_location function Load Failed " . $e->getMessage());
return response()->json(['success' => false, 'status' => 500, 'message' => __('auth.something_went_wrong')]);
}
}
public function update(Request $request)
{
/*
Created By : Sayali parab
Created at : 07 June 2024
Use : To update location.
*/
try {
DB::beginTransaction();
$location_data = ManageState::find($request->id);
$location_data->name = $request->location_name;
$location_data->save();
DB::commit();
return jsonResponseWithSuccessMessage(__('success.update_data'));
} catch (Exception $e) {
DB::rollBack();
Log::error("Failed to update location: " . $e->getMessage());
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
}

View File

@@ -1,6 +1,7 @@
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
@@ -15,15 +16,15 @@ use Validator;
class ManageNewsAndArticlesController extends Controller
{
/**
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To get newsarticle page.
*/
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To get newsarticle page.
*/
public function index()
{
try {
$news_article = NewsArticle::with('category')->latest()->get()->toArray();
return view('Admin.pages.manage_cms.manage_new.manage_news', compact('news_article'));
@@ -31,17 +32,16 @@ class ManageNewsAndArticlesController extends Controller
Log::error("Manage Article Page Not Load: " . $e->getMessage());
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
}
}
/**
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To change status.
*/
/**
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To change status.
*/
public function change_news_article_Status(Request $request)
{
try {
$status = NewsArticle::find($request->program_id);
@@ -60,18 +60,18 @@ class ManageNewsAndArticlesController extends Controller
}
}
/**
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To edit.
*/
/**
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To edit.
*/
public function edit($id)
{
try {
$news_article_data = NewsArticle::find($id);
$news_categories = NewsArticleCategory::all()->toArray();
return view('Admin.pages.manage_cms.manage_new.manage_news_edit', compact('news_article_data','news_categories'));
return view('Admin.pages.manage_cms.manage_new.manage_news_edit', compact('news_article_data', 'news_categories'));
} catch (\Exception $e) {
// Handle the exception, you can log it or return an error response
return response()->json(['success' => false, 'error' => $e->getMessage(), 'status' => 500]);
@@ -81,7 +81,7 @@ class ManageNewsAndArticlesController extends Controller
// public function update(Request $request)
// {
// try {
// $update_news_article = NewsArticle::find($request->article_id);
// $update_news_article->name = $request->input('article_name');
@@ -122,79 +122,78 @@ class ManageNewsAndArticlesController extends Controller
// }
/**
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To update.
*/
* Created By : sayali parab
* Created at : 27 May 2024
* Use : To update.
*/
public function update(Request $request)
{
try {
$update_news_article = NewsArticle::find($request->article_id);
$update_news_article->name = $request->input('article_name');
$update_news_article->description = $request->input('article_dis');
{
try {
$update_news_article = NewsArticle::find($request->article_id);
$update_news_article->name = $request->input('article_name');
$update_news_article->description = $request->input('article_dis');
if ($request->hasFile('article_thmb')) {
if ($update_news_article->image) {
Storage::disk('public')->delete($update_news_article->thumbnail_image);
if ($request->hasFile('article_thmb')) {
if ($update_news_article->image) {
Storage::disk('public')->delete($update_news_article->thumbnail_image);
}
$uploadedFile = $request->file('article_thmb');
$extension = $uploadedFile->getClientOriginalExtension();
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
$path = $uploadedFile->storeAs('uploads/news_article_thumb', $filename, 'public');
$update_news_article->thumbnail_image = $path;
}
$uploadedFile = $request->file('article_thmb');
$extension = $uploadedFile->getClientOriginalExtension();
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
$path = $uploadedFile->storeAs('uploads/news_article_thumb', $filename, 'public');
$update_news_article->thumbnail_image = $path;
$update_news_article->save();
return response()->json(['success' => true, 'status' => 200]);
} catch (\Exception $e) {
return response()->json(['success' => false, 'error' => $e->getMessage(), 'status' => 500]);
}
$update_news_article->save();
return response()->json(['success' => true, 'status' => 200]);
} catch (\Exception $e) {
return response()->json(['success' => false, 'error' => $e->getMessage(), 'status' => 500]);
}
}
/**
* Created By : sayali parab
* Created at : 28 May 2024
* Use : To delete.
*/
public function delete_newsarticle($id)
{
try {
$blog = NewsArticle::find($id);
/**
* Created By : sayali parab
* Created at : 28 May 2024
* Use : To delete.
*/
public function delete_newsarticle($id)
{
if (!$blog) {
return response()->json(['error' => 'Aboutus entry not found.'], 404);
try {
$blog = NewsArticle::find($id);
if (!$blog) {
return response()->json(['error' => 'Aboutus entry not found.'], 404);
}
$blog->delete();
return response()->json(['success' => 'Aboutus entry deleted successfully.']);
} catch (\Exception $e) {
// Log the exception or handle it in a way that makes sense for your application
return response()->json(['error' => 'An error occurred while deleting the Aboutus entry.'], 500);
}
$blog->delete();
return response()->json(['success' => 'Aboutus entry deleted successfully.']);
} catch (\Exception $e) {
// Log the exception or handle it in a way that makes sense for your application
return response()->json(['error' => 'An error occurred while deleting the Aboutus entry.'], 500);
}
}
/**
* Created By : sayali parab
* Created at : 28 May 2024
* Use : To add.
*/
/**
* Created By : sayali parab
* Created at : 28 May 2024
* Use : To add.
*/
public function add()
{
$news_categories = NewsArticleCategory::all()->toArray();
return view('Admin.pages.manage_cms.manage_new.manage_news_add', compact('news_categories'));
$news_categories = NewsArticleCategory::all()->toArray();
return view('Admin.pages.manage_cms.manage_new.manage_news_add', compact('news_categories'));
}
// public function insert(Request $request)
// {
// try {
// $blog = new NewsArticle;
// $blog->name = $request->input('article_name');
@@ -227,41 +226,102 @@ public function delete_newsarticle($id)
// }
/**
* Created By : sayali parab
* Created at : 28 May 2024
* Use : To insert.
*/
* Created By : sayali parab
* Created at : 28 May 2024
* Use : To insert.
*/
// public function insert(Request $request)
// {
// try {
// // Validate the incoming request
// // $request->validate([
// // // 'article_name' => 'required|string',
// // // 'article_des' => 'required|string',
// // 'article_thmb' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
// // 'category' => 'required|string', // Assuming 'category' is the field for category selection
// // ]);
// DB::beginTransaction();
// // Handle thumbnail image upload
// if ($request->hasFile('article_thmb')) {
// $uploadedFile = $request->file('article_thmb');
// $filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
// $path = $uploadedFile->storeAs('uploads/news_article_thumb', $filename, 'public');
// }
// // Handle the image upload
// if ($request->hasFile('article_image')) {
// $image = $request->file('article_image');
// $imageName = date('YmdHi') . '_' . str_replace(' ', '',$image->getClientOriginalName());
// $image_path= $image->storeAs('uploads/news_article_image', $imageName, 'public');
// }
// // Create a new instance of NewsArticle model and populate it with data
// $blog = NewsArticle::create([
// 'name' => $request->input('article_name'),
// 'description' => $request->input('article_des'),
// 'news_articles_category_xid' => $request->input('category'),
// 'thumbnail_image' => $path, // Set thumbnail image path
// 'image'=> $image_path
// ]);
// // dd( $blog);
// DB::commit();
// return response()->json([
// 'success' => true,
// 'status' => 200,
// 'message' => 'News article added successfully',
// ]);
// } catch (\Exception $exception) {
// DB::rollBack();
// // Log the exception for further analysis
// Log::error('Error in insert method: ' . $exception->getMessage() . ' at ' . $exception->getFile() . ':' . $exception->getLine());
// // Return an error response
// return response()->json(['error' => 'Failed to add news article'], 500);
// }
// }
public function insert(Request $request)
{
try {
// Validate the incoming request
// $request->validate([
// // 'article_name' => 'required|string',
// // 'article_des' => 'required|string',
// 'article_thmb' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
// 'category' => 'required|string', // Assuming 'category' is the field for category selection
// ]);
$request->validate([
'article_thmb' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
'article_image' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
]);
DB::beginTransaction();
// Handle thumbnail image upload
$path = null;
$image_path = null;
if ($request->hasFile('article_thmb')) {
$uploadedFile = $request->file('article_thmb');
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
$path = $uploadedFile->storeAs('uploads/news_article_thumb', $filename, 'public');
}
// Create a new instance of NewsArticle model and populate it with data
if ($request->hasFile('article_image')) {
$image = $request->file('article_image');
$imageName = date('YmdHi') . '_' . str_replace(' ', '', $image->getClientOriginalName());
$image_path = $image->storeAs('uploads/news_article_image', $imageName, 'public');
}
$blog = NewsArticle::create([
'name' => $request->input('article_name'),
'description' => $request->input('article_des'),
'news_articles_category_xid' => $request->input('category'),
'thumbnail_image' => $path // Set thumbnail image path
'thumbnail_image' => $path,
'image' => $image_path
]);
// dd( $blog);
DB::commit();
return response()->json([
'success' => true,
'status' => 200,
@@ -271,12 +331,9 @@ public function delete_newsarticle($id)
DB::rollBack();
// Log the exception for further analysis
Log::error('Error in insert method: ' . $exception->getMessage() . ' at ' . $exception->getFile() . ':' . $exception->getLine());
// Return an error response
return response()->json(['error' => 'Failed to add news article'], 500);
}
}
}

View File

@@ -4,16 +4,17 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class ManageState extends Model
{
use HasFactory;
use SoftDeletes;
protected $table = 'manage_states';
// protected $dates = ['deleted_at'];
protected $fillable = [
' id ',
'id',
'name',
'is_active',
'email_address',
@@ -21,7 +22,7 @@ class ManageState extends Model
'modified_by',
'deleted_at',
'created_at',
'updated_at ',
'updated_at',
];
}

View File

@@ -207,7 +207,18 @@
</a>
</li>
<li class="tooltip-element <?php
if ($currentPage == 'manage-location') {
echo 'active';
}
?>" data-tooltip="4">
<a href="{{ route('manage_location') }}" data-active="4">
<div class="icons">
<img src="{{ asset('public/assets/img/location.png') }}" />
<span class="text">Manage States</span>
</div>
</a>
</li>
<!-- <button class="dropdown-btn-users mb-1">
<div class="icons d-flex align-items-center justify-content-start w-100">

View File

@@ -25,11 +25,11 @@ $currentPage = 'manage-news';
<div class="widget-content widget-content-area br-8 position-btn" style="overflow: auto;">
<table id="zero-config" class="table dt-table-hover news_letter_table" style="width:100%">
<thead class="text-center">
<th class="w-10px pe-2">
<!-- <th class="w-10px pe-2">
<div class="form-check form-check-sm form-check-custom form-check-solid me-3">
<input class="form-check-input" type="checkbox" data-kt-check="true" data-kt-check-target="#kt_table_users .form-check-input" value="1" />
</div>
</th>
</th> -->
<th class="text-start">Sr no</th>
<th class="text-start">Article Name</th>
<th class="text-start">Added Date </th>
@@ -41,11 +41,11 @@ $currentPage = 'manage-news';
@foreach ($news_article as $news_articles)
<tr>
<td>
<!-- <td>
<div class="form-check form-check-sm form-check-custom form-check-solid">
<input class="form-check-input" type="checkbox" value="1" />
</div>
</td>
</td> -->
<td class="text-start">{{$loop->iteration}}</td>
<td class="text-start">{{ $news_articles['name'] }}</td>
<td class="text-start">{{ \Carbon\Carbon::parse($news_articles['created_at'])->format('m/d/Y') }}</td>

View File

@@ -1,136 +1,131 @@
@extends('Admin.layouts.master')
@section('content')
@php
$currentPage = 'manage_cms';
@endphp
<style>
.error-message {
color: #FF0000;
}
@php
$currentPage = 'manage_cms';
@endphp
<style>
.error-message {
color: #FF0000;
}
form .error-message {
color: red;
/* Set your desired color here */
}
form .error-message {
color: red;
/* Set your desired color here */
}
form .input_class.error-message {
color: #0e1726;
}
</style>
form .input_class.error-message {
color: #0e1726;
}
</style>
<div class="layout-px-spacing">
<div class="middle-content container-xxl p-0">
<div class="row layout-top-spacing ">
<div class="top-tabel">
<div class="row">
<div class="col-md-4">
<a class="d-flex align-items-center justify-content-center pl-2" href="{{ route('manage.Newarticles') }}">
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
<h6 class="card-title p-0">Add News & Articles </h6>
</a>
</div>
<div class="col-md-8">
</div>
</div>
<div class="layout-px-spacing">
<div class="middle-content container-xxl p-0">
<div class="row layout-top-spacing ">
<div class="top-tabel">
<div class="row">
<div class="col-md-4">
<a class="d-flex align-items-center justify-content-center pl-2" href="{{ route('manage.Newarticles') }}">
<img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
<h6 class="card-title p-0">Add News & Articles </h6>
</a>
</div>
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
<div class="widget-content widget-content-area br-8 position-btn h-10">
<div class="view-details Article">
<form id="add_blog_form" enctype="multipart/form-data">
<div class="col-md-8">
</div>
</div>
</div>
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
<div class="widget-content widget-content-area br-8 position-btn h-10">
<div class="view-details Article">
<form id="add_blog_form" enctype="multipart/form-data">
@csrf
<div class="row">
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Article Name</label>
<input type="text" name="article_name" class="form-control input_class">
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Article Name</label>
<input type="text" name="article_name" class="form-control input_class">
</div>
<!-- <div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Image Upload</label>
<input type="file" name="article_image" class="form-control input_class" id="selectImage">
<img id="preview" src="#" alt="your image" class="mt-3 " style="display:none;width:20%;"/>
</div>
</div>
</div> -->
<div class="col-md-12">
<div class="form-group mt-3">
<label class="mr-2 mb-3" style="font-weight: 600;">Image Upload :</label>
<div class="multiple-file-upload">
<input type="file" class="filepond pan-frontside" name="article_image" id="imageInputNormal" data-max-file-size="3MB">
<div id="imageInputPreviewNormal" style="width: 30%;">
<img src="" alt="Image Preview" style="width: 40%;">
</div>
<div class="col-md-12">
<div class="form-group mt-3">
<label class="mr-2 mb-3" style="font-weight: 600;">Image Upload :</label>
<div class="multiple-file-upload">
<input type="file" class="filepond pan-frontside" name="article_image" id="imageInputNormal" data-max-file-size="3MB">
<div id="imageInputPreviewNormal" style="width: 30%;">
<img src="" alt="Image Preview" style="width: 40%;">
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Description</label>
<div id="news-quill-add" class="editor-quill" style="height: 100px;"></div>
<input type="hidden" id="article_des" name="article_des">
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Thumbnail Image:</label>
<input type="file" name="article_thmb" class="form-control input_class" id="selectThumbnailImage">
<img id="previewthumbnailimage" src="#" alt="your image" class="mt-3 w-20" style="display:none;width:20%;"/>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="company-name" class="label">Select Category</label>
<select class="form-control input_class" id="company-name" name="category">
<option value="">Select Category</option>
@foreach ($news_categories as $news_category)
<option value="{{ $news_category['id'] }}">{{ $news_category['name'] }}
</option>
@endforeach
<!-- Add more options as needed -->
</select>
</div>
</div>
<div class="col-md-12">
<button type="submit" id="add_newsletter"
class="download-btn-custom mt-3 custom-width-10">
<span>Save</span>
</button>
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Description</label>
<div id="news-quill-add" class="editor-quill" style="height: 100px;"></div>
<input type="hidden" id="article_des" name="article_des">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="company-name" class="label">Thumbnail Image:</label>
<input type="file" name="article_thmb" class="form-control input_class" id="selectThumbnailImage">
<div id="imagePreviewThumb" style="width: 30%;">
<img id="previewthumbnailimage" src="#" alt="Preview Image" class="mt-3 w-20" style="display:none; width:50%;" />
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="company-name" class="label">Select Category</label>
<select class="form-control input_class" id="company-name" name="category">
<option value="">Select Category</option>
@foreach ($news_categories as $news_category)
<option value="{{ $news_category['id'] }}">{{ $news_category['name'] }}
</option>
@endforeach
<!-- Add more options as needed -->
</select>
</div>
</div>
<div class="col-md-12">
<button type="submit" id="add_newsletter" class="download-btn-custom mt-3 custom-width-10">
<span>Save</span>
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
@endsection
</div>
</div>
@endsection
@section('section_script')
<script src="../src/plugins/src/table/datatable/datatables.js"></script>
<script src="{{ asset('public/assets/js/admin/manage_cms/manage_news/add_news.js') }}"></script>
<script>
$('#zero-config').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
"oPaginate": {
"sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
"sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>'
},
"sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
@@ -140,10 +135,9 @@
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
</script>
<script>
$(document).ready(function () {
$(document).ready(function() {
$('<button><a class="extra-btn width-max-content" href="archive-manage-customers.php">View Archive List</a></button><button><ul class="navbar-item flex-row ms-lg-auto ms-0"><li class="nav-item dropdown action-dropdown order-lg-0 order-1"><a href="javascript:void(0);"class="nav-link dropdown-toggle user extra-btn" id="actionDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><div class="avatar-container"><div class="avatar avatar-sm avatar-indicators avatar-online"><h3>Export</h3></div></div></a><div class="dropdown-menu position-absolute" aria-labelledby="actionDropdown"><div class="dropdown-item"><a href="#"><span>Download Overview</span></a></div><div class="dropdown-item"><a href="#"><span>Download Patient Data</span></a></div><div class="dropdown-item"><a href="#"> <span>Download Selected</span></a></div></div></li></ul></button>').insertBefore("#zero-config_filter label");
});
@@ -152,88 +146,86 @@
// });
</script>
<script>
var quill = new Quill('#news-quill-add', {
var quill = new Quill('#news-quill-add', {
theme: 'snow'
});
$('#add_newsletter').on("click", function (e) {
// alert('sdkjfb');
$('#add_newsletter').on("click", function(e) {
// alert('sdkjfb');
$('#add_blog_form').validate({
debug: false,
rules: {
article_name: {
required: true
},
article_des: {
required: true,
},
// article_image: {
// required: true
// },
article_thmb: {
required: true
},
category: {
required: true
},
$('#add_blog_form').validate({
debug: false,
rules: {
article_name: {
required: true
},
article_des: {
required: true,
},
// article_image: {
// required: true
// },
article_thmb: {
required: true
},
category: {
required: true
},
},
messages: {
article_name: {
required: "Please Enter Article name"
},
article_des: {
required: "Please Enter Description"
},
article_thmb: {
required: "Please Select Image"
},
category: {
required: "Please Select Article Category"
},
},
errorClass: 'error-message',
submitHandler: function (form) {
// Set the hidden input value to the HTML content of the Quill editor
var quillContent = quill.root.innerHTML;
$('#article_des').val(quillContent);
let base_url = url_path;
var formData = new FormData(form);
$('#add_newsletter').text('Please wait...').attr('disabled', true);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
messages: {
article_name: {
required: "Please Enter Article name"
},
article_des: {
required: "Please Enter Description"
},
article_thmb: {
required: "Please Select Image"
},
category: {
required: "Please Select Article Category"
},
$.ajax({
url: base_url + '/manage_insert_news',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function (response) {
if (response.status == 200) {
toastr.success('News and Article Added Successfully');
setTimeout(function () {
window.location.href = base_url + "/manage-new-articles";
}, 3000);
} else {
toastr.error("Something went wrong");
}
$('#add_newsletter').attr('disabled', false).text('Submit');
},
errorClass: 'error-message',
submitHandler: function(form) {
// Set the hidden input value to the HTML content of the Quill editor
var quillContent = quill.root.innerHTML;
$('#article_des').val(quillContent);
let base_url = url_path;
var formData = new FormData(form);
$('#add_newsletter').text('Please wait...').attr('disabled', true);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
url: base_url + '/manage_insert_news',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.status == 200) {
toastr.success('News and Article Added Successfully');
setTimeout(function() {
window.location.href = base_url + "/manage-new-articles";
}, 3000);
} else {
toastr.error("Something went wrong");
}
$('#add_newsletter').attr('disabled', false).text('Submit');
},
});
}
});
}
});
});
</script>
});
</script>
<script>
FilePond.registerPlugin(
@@ -246,4 +238,22 @@ $('#add_blog_form').validate({
);
</script>
@endsection
<script>
const imageInput = document.getElementById('selectThumbnailImage');
const imagePreview = document.getElementById('previewthumbnailimage');
imageInput.addEventListener('change', function() {
const file = this.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
imagePreview.style.display = 'block'; // Show the image preview container
imagePreview.src = event.target.result; // Set the source of the image preview to the selected image
};
reader.readAsDataURL(file);
} else {
imagePreview.style.display = 'none'; // Hide the image preview container if no file is selected
}
});
</script>
@endsection

View File

@@ -61,7 +61,8 @@ $currentPage = 'manage_cms';
</div> -->
<div class="col-md-12">
<!-- <div class="col-md-12">
<div class="form-group mt-3">
<label class="mr-2 mb-3" style="font-weight: 600;">Image Upload :</label>
<div class="multiple-file-upload">
@@ -71,9 +72,25 @@ $currentPage = 'manage_cms';
</div>
</div>
</div>
</div> -->
<div class="col-md-12">
<div class="form-group mt-3">
<label class="mr-2 mb-3" style="font-weight: 600;">Image Upload :</label>
<div class="multiple-file-upload">
<input type="file" class="filepond pan-frontside" name="article_image" id="imageInputNormal" data-max-file-size="3MB">
@if( $news_article_data->image)
<div id="imageInputPreviewNormal" style="width: 30%;">
<img src="{{ asset('storage/app/public' . $news_article_data->image) }}" alt="Image Preview" style="width: 40%;">
</div>
@endif
</div>
</div>
</div>
</div>
<div class="col-md-6">
<!-- <div class="form-group ">
@@ -347,4 +364,4 @@ $currentPage = 'manage_cms';
document.querySelector('.pan-frontside')
);
</script>
@endsection
@endsection

View File

@@ -0,0 +1,175 @@
@extends('Admin.layouts.master')
@section('content')
@php
$currentPage = 'manage-location';
@endphp
<div class="layout-px-spacing">
<div class="middle-content container-xxl p-0">
<div class="row layout-top-spacing ">
<div class="top-tabel">
<div class="row">
<div class="col-md-4">
<h6 class="card-title">Manage States</h6>
</div>
<div class="col-md-8">
</div>
</div>
</div>
<div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
<div class="widget-content widget-content-area br-8 position-btn" style="overflow: auto;">
<table id="zero-config" class="table dt-table-hover location_table" style="width:100%">
<thead class="text-center">
<meta name="csrf-token" content="{{ csrf_token() }}">
<tr>
<th class="text-start">Sr no</th>
<th class="text-start">Location</th>
<th class="no-content">Action</th>
</tr>
</thead>
<tbody class="text-center">
@foreach ($location as $locations)
<tr>
<td class="text-start">{{ $loop->iteration}}</td>
<td class="text-start">{{ $locations->name }}</td>
<td>
<div class="dropout">
<button class="more">
<span></span>
<span></span>
<span></span>
</button>
<ul>
<li>
<div class="switch-btn">
<input
type="checkbox" data-id = "{{ $locations->id }}"
class="active_location" id="switch{{ $locations->id }}" value="1"
{{ $locations->is_active ? 'checked' : '' }}
switch="bool" />
<label for="switch{{ $locations->id }}" data-on-label="Active"
data-off-label="Expired"></label>
</div>
</li>
<li>
<a href="#" data-toggle="modal" data-target="#edit-location-modal"
class="edit_location_value" data-location-id="{{ $locations->id }}"
data-location-name="{{ $locations->name }}" >
<img src="{{ asset('public/assets/img/edit.svg') }}" />
<span>Edit</span>
</a>
</li>
<li>
<a class="delete_location" data-id="{{ $locations->id }}" data-toggle="modal" data-target="#delete-location-modal">
<img
src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="add_location_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="modal-header p-0">
<h5 class="modal-title">Add State</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="row">
<form id="store_location">
@csrf
<div class="col-md-12 ">
<label for="add-faq-question">Name</label>
<input id="add_faq_question" name="location_name" class="form-control" type="text">
</div>
<button type="submit" id="submit_location" class="download-btn-custom mt-4 mx-auto w-25">
<span>Save</span>
</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="edit-location-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="modal-header p-0">
<h5 class="modal-title">Edit state</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="row">
<form id="edit_location">
<div class="col-md-12 mb-3">
@csrf
<input class="form-control" name="id" type="hidden"
value="" id="location_id">
<label for="">Name</label>
<input class="form-control" name="location_name" type="text"
value="" id="name">
</div>
<button type="submit" id="update_location" class="download-btn-custom mt-4 mx-auto w-25">
<span>Save</span>
</button>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="delete-location-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close">
x
</button>
</div>
<div class="modal-body">
<input type="hidden" id="delete_location_id" name="location_id">
<p class="modal-text">Are you sure you want to<br>Delete </p>
<div class="modal-btn d-flex ">
<a type="button" class="extra-btn" data-dismiss="modal">No</a>
<a type="button" class="download-btn-custom delete_location_button" data-dismiss="modal">Yes</a>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('section_script')
<script src="{{ asset('public/assets/js/admin/manage_location/main.js') }}"></script>
<script src="{{ asset('public/assets/js/admin/manage_location/add_location.js') }}"></script>
<script src="{{ asset('public/assets/js/admin/manage_location/edit_location.js') }}"></script>
<script>
$(document).ready(function() {
$(' <button><a class="extra-btn width-max-content" data-toggle="modal" data-target="#add_location_modal" href="">Add</a></button>')
.insertBefore("#zero-config_filter label");
});
</script>
@endsection

View File

@@ -21,6 +21,8 @@ use App\Http\Controllers\Admin\DashboardController;
use App\Http\Controllers\Admin\LoginController;
use App\Http\Controllers\Admin\ManageCmsController;
use App\Http\Controllers\Admin\RestaurantAppController;
use App\Http\Controllers\Admin\ManageLocationController;
Route::get('/', [LoginController::class, 'index'])->name('login');
Route::post('/check_login', [LoginController::class, 'login_check']);
@@ -155,4 +157,12 @@ Route::group(['middleware' => ['checkStatus']], function () {
Route::get('/manage_restaurant_archive', [ManageRestrauntController::class, 'archive_restaurant'])->name('restaurant_archive');
Route::delete('/manage_restaurant_archive/{id}', [ManageRestrauntController::class, 'archive_delete_restaurant']);
Route::post('/manage_restaurant_unarchive/{id}', [ManageRestrauntController::class, 'unarchive_restaurant'])->name('restaurant_unarchive');
//*******************************************************manage location********************************************************
Route::get('/manage_location', [ManageLocationController::class, 'index'])->name('manage_location');
Route::post('/insert_location', [ManageLocationController::class, 'store'])->name('store_location');
Route::get('/change_location_status', [ManageLocationController::class, 'change_location_status']);
Route::delete('/delete_location/{id}', [ManageLocationController::class, 'delete_location']);
Route::post('/update_location', [ManageLocationController::class, 'update']);
});