diff --git a/app/Http/Controllers/admin/AdminController.php b/app/Http/Controllers/admin/AdminController.php
index 2d8baa5..32b82da 100644
--- a/app/Http/Controllers/admin/AdminController.php
+++ b/app/Http/Controllers/admin/AdminController.php
@@ -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(){
@@ -1189,7 +1193,28 @@ 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."
+ ));
+ }
}
\ No newline at end of file
diff --git a/app/Http/routes.php b/app/Http/routes.php
index 68fbeaf..0b19683 100644
--- a/app/Http/routes.php
+++ b/app/Http/routes.php
@@ -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');
diff --git a/app/Models/admin/AdminModel.php b/app/Models/admin/AdminModel.php
index 104417c..b16937e 100644
--- a/app/Models/admin/AdminModel.php
+++ b/app/Models/admin/AdminModel.php
@@ -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;
+ }
+
}
diff --git a/resources/views/admin/main.blade.php b/resources/views/admin/main.blade.php
index d53f8e1..8b2586b 100644
--- a/resources/views/admin/main.blade.php
+++ b/resources/views/admin/main.blade.php
@@ -34,7 +34,7 @@ scratch. This page gets rid of all links and provides the needed markup only.
-
+
@@ -134,7 +134,8 @@ scratch. This page gets rid of all links and provides the needed markup only.
height: 100px;
padding: 5px;
}
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | # |
+ Print File |
+ Type |
+ Size |
+ Action |
+
+ @foreach ($selectPrintFiles as $key => $printfile)
+
+ | {{ ++$key }}
+
+ |
+
+  . $printfile->Path }})
+
+ |
+ {{ $printfile->Type }} |
+ {{ $printfile->Size }} |
+
+
+ |
+
+ @endforeach
+
+
+
+
+
+
+
+
+
+
+
+
+@endsection
\ No newline at end of file