This commit is contained in:
sayliraut
2024-06-26 12:18:12 +05:30
parent a65a3e27ad
commit 4e2c5b766a
3 changed files with 488 additions and 522 deletions

View File

@@ -92,6 +92,7 @@ class ManageNewsAndArticlesController extends Controller
$update_news_article = NewsArticle::find($request->article_id);
$update_news_article->name = $request->input('article_name');
$update_news_article->description = $request->input('article_dis');
$update_news_article->news_articles_category_xid = $request->input('category_xid');
@@ -156,39 +157,38 @@ class ManageNewsAndArticlesController extends Controller
* Created at : 28 May 2024
* Use : To insert.
*/
public function insert(Request $request)
{
try {
$blog = new NewsArticle;
$blog->name = $request->input('article_name');
$blog->description = $request->input('article_des');
$blog->news_articles_category_xid = $request->input('category');
public function insert(Request $request)
{
if ($request->hasFile('article_image')) {
$uploadedFile = $request->file('article_image');
$extension = $uploadedFile->getClientOriginalExtension();
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
$path = $uploadedFile->storeAs('uploads/news_article', $filename, 'public');
$blog->image = $path;
try {
$blog = new NewsArticle;
$blog->name = $request->input('article_name');
$blog->description = $request->input('article_des');
$blog->news_articles_category_xid = $request->input('category');
if ($request->hasFile('article_image')) {
$uploadedFile = $request->file('article_image');
$extension = $uploadedFile->getClientOriginalExtension();
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
$path = $uploadedFile->storeAs('uploads/news_article', $filename, 'public');
$blog->image = $path;
}
if ($request->hasFile('article_thmb')) {
$uploadedFile = $request->file('article_thmb');
$extension = $uploadedFile->getClientOriginalExtension();
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
$path = $uploadedFile->storeAs('uploads/news_article_thumb', $filename, 'public');
$blog->thumbnail_image = $path;
}
$blog->save();
return response()->json(['success' => true, 'status' => 200]);
} 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]);
}
if ($request->hasFile('article_thmb')) {
$uploadedFile = $request->file('article_thmb');
$extension = $uploadedFile->getClientOriginalExtension();
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
$path = $uploadedFile->storeAs('uploads/news_article_thumb', $filename, 'public');
$blog->thumbnail_image = $path;
}
$blog->save();
return response()->json(['success' => true,'status'=>200]);
} 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]);
}
}
}

View File

@@ -1,103 +1,107 @@
@extends('Admin.layouts.master')
@section('content')
@php
$currentPage = 'manage-news';
@endphp
@php
$currentPage = 'manage-news';
@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 News & Articles</h6>
</div>
<div class="col-md-8">
<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 News & Articles</h6>
</div>
<div class="col-md-8">
</div>
</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 news_letter_table" style="width:100%">
<thead class="text-center">
<!-- <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 class="text-start">Sr no</th>
<th class="text-start">Article Name</th>
<th class="text-start">Added Date </th>
<th class="">Image</th>
<th class="no-content">Action</th>
</tr>
</thead>
<tbody class="text-center">
@foreach ($news_article as $news_articles)
<tr>
<!-- <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 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>
<!-- <td><img src="../src/assets/img/video.png"></td> -->
<td><img src="{{ asset('storage/app/public/' . $news_articles['thumbnail_image']) }}" height="50px" width="50px"></td>
<td>
<div class="dropout">
<button class="more">
<span></span>
<span></span>
<span></span>
</button>
<ul>
<li>
<div class="switch-btn">
<input data-id="{{ $news_articles['id'] }}" {{ $news_articles['is_active'] ? 'checked' : '' }} type="checkbox" class="active_newsletter" id="switch{{ $news_articles['id'] }}" switch="bool" />
<label for="switch{{ $news_articles['id'] }}" data-on-label="Active" data-off-label="Expired"></label>
<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 news_letter_table" style="width:100%">
<thead class="text-center">
<!-- <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 class="text-start">Sr no</th>
<th class="text-start">Article Name</th>
<th class="text-start">Added Date </th>
<th class="">Image</th>
<th class="">Category</th>
<th class="no-content">Action</th>
</tr>
</thead>
<tbody class="text-center">
@foreach ($news_article as $news_articles)
<tr>
<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>
<td><img src="{{ asset('storage/app/public/' . $news_articles['thumbnail_image']) }}"
height="50px" width="50px"></td>
<td class="text-start">
{{ $news_articles['category']['name'] }}</td>
<td>
<div class="dropout">
<button class="more">
<span></span>
<span></span>
<span></span>
</button>
<ul>
<li>
<div class="switch-btn">
<input data-id="{{ $news_articles['id'] }}"
{{ $news_articles['is_active'] ? 'checked' : '' }}
type="checkbox" class="active_newsletter"
id="switch{{ $news_articles['id'] }}" switch="bool" />
<label for="switch{{ $news_articles['id'] }}"
data-on-label="Active" data-off-label="Expired"></label>
</div>
</li>
<li>
<a href="{{ url('manage_edit_news/' . $news_articles['id']) }}">
<img src="{{ asset('public/assets/img/edit.svg') }}" />
<span>Edit</span>
</a>
</li>
<li>
<!-- <a href="" data-toggle="modal" data-target="#delete-modal">
<img src="{{ asset('assets/img/delete-recycle.svg') }}" />
</li>
<li>
<a href="{{ url('manage_edit_news/' . $news_articles['id']) }}">
<img src="{{ asset('public/assets/img/edit.svg') }}" />
<span>Edit</span>
</a>
</li>
<li>
<!-- <a href="" data-toggle="modal" data-target="#delete-modal">
<img src="{{ asset('assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a> -->
<a class="delete_news" data-id="{{ $news_articles['id'] }}"
data-toggle="modal" data-target="#delete-modal">
<img
src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a> -->
<a class="delete_news" data-id="{{ $news_articles['id'] }}" data-toggle="modal" data-target="#delete-modal">
<img src="{{ asset('public/assets/img/delete-recycle.svg') }}" />
<span>Delete</span>
</a>
</li>
</ul>
</div>
</td>
</tr>
</a>
</li>
</ul>
</div>
</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
@@ -122,91 +126,90 @@ $currentPage = 'manage-news';
@section('section_script')
<script src="../src/plugins/src/table/datatable/datatables.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>'
},
"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...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
</script>
<script>
var manageAddNewsRoute = "{{ route('manage_add_news') }}";
</script>
<script>
// $(document).ready(function() {
// $('<button><a class="extra-btn width-max-content" href="{{ route('manage_add_news')}}">Add New</a ></button > ').insertBefore("#zero-config_filter label");
// });
// $('<button><a class="extra-btn width-max-content" href="' + manageAddNewsRoute + '">Add New </a></button>').insertBefore("#zero-config_filter label");
$(document).ready(function() {
$('<button><a class="extra-btn width-max-content" href="' + manageAddNewsRoute + '"> Add New </a></button>').insertBefore("#zero-config_filter label");
});
</script>
<script>
$(".news_letter_table").on("change", ".active_newsletter", function() {
let base_url = url_path;
var status = $(this).prop("checked") == true ? 1 : 0;
var program_id = $(this).data("id");
$.ajax({
type: "GET",
dataType: "json",
url: base_url + '/change-article-Status',
data: {
status: status,
program_id: program_id,
},
success: function(data) {
if (status == 1) {
toastr.options = {
"timeOut": 500
}
toastr.success("Status Activate successfully. !!");
} else {
toastr.error("Status Deactivate successfully. !!");
}
<script src="../src/plugins/src/table/datatable/datatables.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>'
},
"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...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
</script>
<script>
var manageAddNewsRoute = "{{ route('manage_add_news') }}";
</script>
<script>
// $(document).ready(function() {
// $('<button><a class="extra-btn width-max-content" href="{{ route('manage_add_news') }}">Add New</a ></button > ').insertBefore("#zero-config_filter label");
// });
// $('<button><a class="extra-btn width-max-content" href="' + manageAddNewsRoute + '">Add New </a></button>').insertBefore("#zero-config_filter label");
$(document).ready(function() {
$('<button><a class="extra-btn width-max-content" href="' + manageAddNewsRoute +
'"> Add New </a></button>').insertBefore("#zero-config_filter label");
});
</script>
<script>
$(".news_letter_table").on("change", ".active_newsletter", function() {
let base_url = url_path;
var status = $(this).prop("checked") == true ? 1 : 0;
var program_id = $(this).data("id");
$.ajax({
type: "GET",
dataType: "json",
url: base_url + '/change-article-Status',
data: {
status: status,
program_id: program_id,
},
success: function(data) {
if (status == 1) {
toastr.options = {
"timeOut": 500
}
toastr.success("Status Activate successfully. !!");
} else {
toastr.error("Status Deactivate successfully. !!");
}
},
});
});
</script>
<script>
$(document).on("click", ".delete_news", function() {
var delete_id = $(this).data('id');
$('#delete_news_id').val(delete_id);
});
});
</script>
<script>
$(document).on("click", ".delete_news", function () {
var delete_id = $(this).data('id');
$('#delete_news_id').val(delete_id);
});
$(document).on("click", ".delete_news_button", function (e) {
e.preventDefault();
let base_url = url_path;
var delete_id = $('#delete_news_id').val();
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
type: "DELETE",
url: base_url + "/delete_article/" + delete_id,
success: function (response) {
console.log(response);
toastr.success("Blog Deleted Successfully");
window.location.href = base_url + "/manage-new-articles";
}
});
});
$(document).on("click", ".delete_news_button", function(e) {
e.preventDefault();
let base_url = url_path;
var delete_id = $('#delete_news_id').val();
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
type: "DELETE",
url: base_url + "/delete_article/" + delete_id,
success: function(response) {
console.log(response);
toastr.success("Blog Deleted Successfully");
window.location.href = base_url + "/manage-new-articles";
}
});
});
</script>
@endsection

View File

@@ -1,367 +1,330 @@
@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">Edit News & Articles </h6>
</a>
</div>
<div class="col-md-8">
<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">Edit News & Articles </h6>
</a>
</div>
<div class="col-md-8">
</div>
</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="update_news" enctype="multipart/form-data">
<div class="row">
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Article Name</label>
<input type="hidden" name="article_id" value="{{ $news_article_data['id'] }}" class="form-control">
<input type="text" class="form-control" value="{{ $news_article_data['name'] }}" name="article_name">
</div>
</div>
<div class="col-md-6">
<!-- <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="{{ asset('storage/app/public/' . $news_article_data['image']) }}" alt="Image Preview" style="width: 40%;">
</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 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="update_news" enctype="multipart/form-data">
<div class="row">
<div class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Image Upload</label>
<input type="file" name="article_image" id="imageInputNormal" class="form-control">
<div id="imageInputPreviewNormal" style="width: 30%;">
<img src="{{ asset('storage/app/public/' . $news_article_data['image']) }}" alt="Image Preview" style="width: 40%;">
<label for="company-name" class="label">Article Name</label>
<input type="hidden" name="article_id" value="{{ $news_article_data['id'] }}"
class="form-control">
<input type="text" class="form-control"
value="{{ $news_article_data['name'] }}" name="article_name">
</div>
</div>
<div class="col-md-6">
<!-- <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="{{ asset('storage/app/public/' . $news_article_data['image']) }}" alt="Image Preview" style="width: 40%;">
</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 class="col-md-6">
<div class="form-group ">
<label for="company-name" class="label">Image Upload</label>
<input type="file" name="article_image" id="imageInputNormal"
class="form-control">
<div id="imageInputPreviewNormal" style="width: 30%;">
<img src="{{ asset('storage/app/public/' . $news_article_data['image']) }}"
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-edit" class="editor-quill" style="height: 100px;">{!! $news_article_data['description'] !!}</div>
<input type="hidden" id="article_dis" name="article_dis" value="{{ $news_article_data['description'] }}">
</div> -->
<div class="form-group">
<label for="company-name" class="label">Description</label>
<div id="news-quill-edit" class="editor-quill" style="height: 100px;">
{!! $news_article_data['description'] !!}</div>
<input type="hidden" id="article_dis" name="article_dis"
value="{{ $news_article_data['description'] }}">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="state" class="label">Select Category</label>
<select id="state" name="category_xid" class="form-control">
<option value="">Select Category</option>
@foreach ($news_categories as $news_category)
<option value="{{ $news_category['id'] }}"
{{ $news_article_data->news_articles_category_xid == $news_category['id'] ? 'selected' : '' }}>
{{ $news_category['name'] }}
</option>
@endforeach
</select>
</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" id="imageInputThumb"
class="form-control">
<div id="imagePreviewThumb" style="width: 30%;">
<img src="{{ asset('storage/app/public/' . $news_article_data['thumbnail_image']) }}"
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-edit" class="editor-quill" style="height: 100px;">{!! $news_article_data['description'] !!}</div>
<input type="hidden" id="article_dis" name="article_dis" value="{{ $news_article_data['description'] }}">
</div> -->
<div class="form-group">
<label for="company-name" class="label">Description</label>
<div id="news-quill-edit" class="editor-quill" style="height: 100px;">{!! $news_article_data['description'] !!}</div>
<input type="hidden" id="article_dis" name="article_dis" value="{{ $news_article_data['description'] }}">
</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" id="imageInputThumb" class="form-control">
<div id="imagePreviewThumb" style="width: 30%;">
<img src="{{ asset('storage/app/public/' . $news_article_data['thumbnail_image']) }}" alt="Image Preview" style="width: 40%;">
</div>
<div class="col-md-12">
<button class="download-btn-custom mt-3 custom-width-10" id="update_news_btn">
<span>Save</span>
</a>
</div>
</div>
<div class="col-md-12">
<button class="download-btn-custom mt-3 custom-width-10" id="update_news_btn">
<span>Save</span>
</a>
</div>
</div>
</form>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('section_script')
<script src="../src/plugins/src/table/datatable/datatables.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>'
<script src="../src/plugins/src/table/datatable/datatables.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>'
},
"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...",
"sLengthMenu": "Results : _MENU_",
},
"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...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
</script>
<script>
$(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");
});
// var quill = new Quill('#news-quill-edit', {
// theme: 'snow'
// });
</script>
<!-- <script>
$('#update_news_btn').on("click", function(e) {
// alert('kjh');
$('#update_news').validate({
// ignore: [],
debug: false,
rules: {
article_name: {
required: true
},
article_dis: {
required: true
},
// category: {
// required: true
// },
},
messages: {
article_name: {
required: "Please Enter Article name"
},
article_dis: {
required: "Please Enter Description"
},
// category: {
// required: "Please Select Article Category"
// },
},
errorClass: 'error-message',
submitHandler: function(form) {
let base_url = url_path;
var formData = new FormData(form);
$('#update_news_btn').text('Please wait...');
$('#update_news_btn').attr('disabled', true);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
url: base_url + '/manage_update_news',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.status == 200) {
toastr.success('News and Article Updated Successfully');
setTimeout(function() {
window.location.href = base_url + "/manage-new-articles";
}, 1000);
} else if (response.status == 204) {
toastr.error(response.error);
} else {
toastr.error("Something went wrong");
}
$('#update_news_btn').attr('disabled', false);
$('#update_news_btn').text('Submit');
},
});
}
"stripeClasses": [],
"lengthMenu": [7, 10, 20, 50],
"pageLength": 10
});
});
</script> -->
<script>
// Initialize Quill editor
var quill = new Quill('#news-quill-edit', {
theme: 'snow'
});
$('#update_news_btn').on("click", function(e) {
$('#update_news').validate({
debug: false,
rules: {
article_name: {
required: true
},
article_dis: {
required: true
},
// article_image: {
// required: true
// },
// article_thmb: {
// required: true
// },
},
messages: {
article_name: {
required: "Please Enter Article name"
},
article_dis: {
required: "Please Enter Description"
},
// article_image: {
// required: "Please select image"
// },
// article_thmb: {
// required: "Please select image"
// },
},
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_dis').val(quillContent);
let base_url = url_path;
var formData = new FormData(form);
$('#update_news_btn').text('Please wait...');
$('#update_news_btn').attr('disabled', true);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
url: base_url + '/manage_update_news',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.status == 200) {
toastr.success('News and Article Updated Successfully');
setTimeout(function() {
window.location.href = base_url + "/manage-new-articles";
}, 1000);
} else if (response.status == 204) {
toastr.error(response.error);
} else {
toastr.error("Something went wrong");
}
$('#update_news_btn').attr('disabled', false);
$('#update_news_btn').text('Submit');
},
});
}
</script>
<script>
$(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");
});
});
</script>
<script>
const imageInputEdit = document.getElementById('imageInputNormal');
const imagePreviewEdit = document.getElementById('imageInputPreviewNormal');
// var quill = new Quill('#news-quill-edit', {
// theme: 'snow'
// });
</script>
<script>
// Initialize Quill editor
var quill = new Quill('#news-quill-edit', {
theme: 'snow'
});
imageInputEdit.addEventListener('change', function() {
const file = this.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
const img = document.createElement('img');
img.src = event.target.result;
img.style.maxWidth = '200px';
img.style.maxHeight = '200px';
$('#update_news_btn').on("click", function(e) {
$('#update_news').validate({
debug: false,
rules: {
article_name: {
required: true
},
article_dis: {
required: true
},
category_xid: {
required: true
},
// article_image: {
// required: true
// },
// article_thmb: {
// required: true
// },
},
messages: {
article_name: {
required: "Please Enter Article name"
},
article_dis: {
required: "Please Enter Description"
},
category_xid: {
required: "Please Enter Category"
},
// article_image: {
// required: "Please select image"
// },
// article_thmb: {
// required: "Please select image"
// },
},
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_dis').val(quillContent);
let base_url = url_path;
var formData = new FormData(form);
$('#update_news_btn').text('Please wait...');
$('#update_news_btn').attr('disabled', true);
$.ajaxSetup({
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
});
$.ajax({
url: base_url + '/manage_update_news',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.status == 200) {
toastr.success('News and Article Updated Successfully');
setTimeout(function() {
window.location.href = base_url +
"/manage-new-articles";
}, 1000);
} else if (response.status == 204) {
toastr.error(response.error);
} else {
toastr.error("Something went wrong");
}
$('#update_news_btn').attr('disabled', false);
$('#update_news_btn').text('Submit');
},
});
}
});
});
</script>
<script>
const imageInputEdit = document.getElementById('imageInputNormal');
const imagePreviewEdit = document.getElementById('imageInputPreviewNormal');
imageInputEdit.addEventListener('change', function() {
const file = this.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
const img = document.createElement('img');
img.src = event.target.result;
img.style.maxWidth = '200px';
img.style.maxHeight = '200px';
imagePreviewEdit.innerHTML = '';
imagePreviewEdit.appendChild(img);
};
reader.readAsDataURL(file);
} else {
imagePreviewEdit.innerHTML = '';
imagePreviewEdit.appendChild(img);
};
reader.readAsDataURL(file);
} else {
imagePreviewEdit.innerHTML = '';
}
});
}
});
const imageInput = document.getElementById('imageInputThumb');
const imagePreview = document.getElementById('imagePreviewThumb');
const imageInput = document.getElementById('imageInputThumb');
const imagePreview = document.getElementById('imagePreviewThumb');
imageInput.addEventListener('change', function() {
console.log("in change kjbck");
const file = this.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
const img = document.createElement('img');
img.src = event.target.result;
img.style.maxWidth = '200px';
img.style.maxHeight = '200px';
imageInput.addEventListener('change', function() {
console.log("in change kjbck");
const file = this.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
const img = document.createElement('img');
img.src = event.target.result;
img.style.maxWidth = '200px';
img.style.maxHeight = '200px';
imagePreview.innerHTML = '';
imagePreview.appendChild(img);
};
reader.readAsDataURL(file);
} else {
imagePreview.innerHTML = '';
imagePreview.appendChild(img);
};
reader.readAsDataURL(file);
} else {
imagePreview.innerHTML = '';
}
});
</script>
<script>
FilePond.registerPlugin(
FilePondPluginImagePreview,
FilePondPluginImageExifOrientation,
FilePondPluginFileValidateSize,
);
FilePond.create(
document.querySelector('.pan-frontside')
);
</script>
@endsection
}
});
</script>
<script>
FilePond.registerPlugin(
FilePondPluginImagePreview,
FilePondPluginImageExifOrientation,
FilePondPluginFileValidateSize,
);
FilePond.create(
document.querySelector('.pan-frontside')
);
</script>
@endsection