added print files view and delete
This commit is contained in:
@@ -1150,7 +1150,11 @@ class AdminController extends Controller
|
||||
|
||||
|
||||
public function printFiles(){
|
||||
return view('admin_pages.print_files');
|
||||
$AdminModel = new AdminModel;
|
||||
$selectGroupPrintFiles = $AdminModel->selectGroupPrintFiles();
|
||||
|
||||
return view('admin_pages.print_files')
|
||||
->with('selectPrintFiles', $selectGroupPrintFiles);
|
||||
}
|
||||
|
||||
public function uploadPrintFile(){
|
||||
@@ -1190,6 +1194,27 @@ class AdminController extends Controller
|
||||
|
||||
}
|
||||
|
||||
public function printFilesDetails($tempcode){
|
||||
$AdminModel = new AdminModel;
|
||||
$selectPrintFiles = $AdminModel->selectPrintFiles($tempcode);
|
||||
|
||||
if(empty($selectPrintFiles)){
|
||||
return redirect()->away('/admin/print-files');
|
||||
}
|
||||
|
||||
return view('admin_pages.view-print-file')
|
||||
->with('selectPrintFiles', $selectPrintFiles);
|
||||
}
|
||||
|
||||
public function printFilesDelete(Request $request){
|
||||
$post = $request->all();
|
||||
$AdminModel = new AdminModel;
|
||||
|
||||
$deletePrintFiles = $AdminModel->deletePrintFiles($post['id']);
|
||||
|
||||
return response()->json(array(
|
||||
'success' => true,
|
||||
'message'=> "Print File is successfully deleted."
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,8 @@ Route::group(['middleware' => 'auth'], function () {
|
||||
|
||||
|
||||
Route::get('print-files', 'admin\AdminController@printFiles');
|
||||
Route::get('print-files/{tempid}', 'admin\AdminController@printFilesDetails');
|
||||
Route::post('print-files/delete', 'admin\AdminController@printFilesDelete');
|
||||
Route::get('upload-print-file', 'admin\AdminController@uploadPrintFile');
|
||||
Route::post('upload-print-file/save', 'admin\AdminController@uploadPrintFileSave');
|
||||
|
||||
|
||||
@@ -463,4 +463,31 @@ class AdminModel extends Model
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectGroupPrintFiles(){
|
||||
$i = DB::select("SELECT ppl.TemplateCode, t.TemplateName, s.SportsName, tc.Category
|
||||
FROM print_pattern_list AS ppl
|
||||
INNER JOIN templates AS t ON t.TemplateCode = ppl.TemplateCode
|
||||
INNER JOIN sports AS s ON s.Id = t.SportsId
|
||||
INNER JOIN template_categories AS tc ON tc.Id = t.Category
|
||||
GROUP BY ppl.TemplateCode");
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectPrintFiles($tempCode){
|
||||
$i = DB::select("SELECT t.TemplateName, ppl.Id, ppl.Path, ppl.`Type`, ppl.Size from templates AS t
|
||||
INNER JOIN print_pattern_list AS ppl ON ppl.TemplateCode = t.TemplateCode
|
||||
WHERE t.TemplateCode = '$tempCode'
|
||||
ORDER BY ppl.`Type` ASC");
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function deletePrintFiles($id){
|
||||
$i = DB::table('print_pattern_list')
|
||||
->where("Id", $id)
|
||||
->delete();
|
||||
return $i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ scratch. This page gets rid of all links and provides the needed markup only.
|
||||
<!-- bootstrap-toggle -->
|
||||
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
|
||||
<!-- ekko-lightbox -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" rel="stylesheet">
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" rel="stylesheet">
|
||||
<!-- bootstrap-tagsinput -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-tagsinput/0.8.0/bootstrap-tagsinput.css">
|
||||
<!-- select2 -->
|
||||
@@ -134,7 +134,8 @@ scratch. This page gets rid of all links and provides the needed markup only.
|
||||
height: 100px;
|
||||
padding: 5px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<!--
|
||||
BODY TAG OPTIONS:
|
||||
@@ -1336,6 +1337,38 @@ desired effect
|
||||
|
||||
});
|
||||
|
||||
$(".btn-delete-print-file").click(function(e){
|
||||
e.preventDefault();
|
||||
var r = confirm("Do you really want to delete this Print File? This process cannot be undone.");
|
||||
if (r == true) {
|
||||
var id = $(this).data('id');
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : "{{ url('admin/print-files/delete') }}",
|
||||
data : {
|
||||
id: id
|
||||
},
|
||||
beforeSend: function(xhr){
|
||||
var token = $('meta[name="csrf_token"]').attr('content');
|
||||
if (token) {
|
||||
return xhr.setRequestHeader('X-CSRF-TOKEN', token);
|
||||
}
|
||||
},
|
||||
success : function(response){
|
||||
|
||||
if(response.success){
|
||||
alert(response.message);
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
|
||||
}); // end document ready
|
||||
|
||||
|
||||
@@ -35,9 +35,16 @@
|
||||
<div class="box-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="text-center">
|
||||
|
||||
</div>
|
||||
<ul class="list-group">
|
||||
@foreach ($selectPrintFiles as $template)
|
||||
<li class="list-group-item">
|
||||
<a href="{{ url('admin/print-files') . '/' . $template->TemplateCode }}"><b>{{ $template->TemplateName }}</b></a>
|
||||
<div>
|
||||
<small>{{ $template->TemplateCode . ' / ' . $template->SportsName . ' / ' . $template->Category }} </small>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
70
resources/views/admin_pages/view-print-file.blade.php
Normal file
70
resources/views/admin_pages/view-print-file.blade.php
Normal file
@@ -0,0 +1,70 @@
|
||||
@extends('admin.main')
|
||||
@section('content')
|
||||
<style>
|
||||
.additional-info{
|
||||
display:none;
|
||||
}
|
||||
</style>
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
<section class="content-header">
|
||||
<h1>
|
||||
{{ $selectPrintFiles[0]->TemplateName }} Print Files
|
||||
<!-- <small>Optional description</small> -->
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ url ('admin') }}"><i class="fa fa-dashboard"></i> Dashboard</a></li>
|
||||
<li><a href="{{ url ('admin/print-files') }}"><i class="fa fa-paint-brush"></i> Print Files</a></li>
|
||||
<li class="active">{{ $selectPrintFiles[0]->TemplateName }} Print Files</li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h4 class="box-title">Print File</h4>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<table class="table table-bordered table-condensed">
|
||||
<tr>
|
||||
<th class="col-sm-1 text-center">#</th>
|
||||
<th class="col-sm-3 text-center">Print File</th>
|
||||
<th class="text-center">Type</th>
|
||||
<th class="text-center">Size</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
@foreach ($selectPrintFiles as $key => $printfile)
|
||||
<tr>
|
||||
<td class="col-sm-1 text-center">{{ ++$key }}</div>
|
||||
</div>
|
||||
<td class="col-sm-3 text-center">
|
||||
<div class='print-file-holder' style="border: none;">
|
||||
<img class="svg-print-file-preview" src="{{ config('site_config.images_directory') . $printfile->Path }}" style="height: 100%;" />
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-center">{{ $printfile->Type }}</td>
|
||||
<td class="text-center">{{ $printfile->Size }}</td>
|
||||
<td class="text-center">
|
||||
<button class="btn btn-danger btn-delete-print-file" data-id="{{ $printfile->Id }}"><i class="fa fa-trash"></i> Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user