added print files uploader
This commit is contained in:
@@ -1147,6 +1147,49 @@ class AdminController extends Controller
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function printFiles(){
|
||||
return view('admin_pages.print_files');
|
||||
}
|
||||
|
||||
public function uploadPrintFile(){
|
||||
$AdminModel = new AdminModel;
|
||||
$vilualizer_array = $AdminModel->selectVisualizerPrint();
|
||||
|
||||
return view('admin_pages.upload_print_file')
|
||||
->with('vilualizer_array', $vilualizer_array);
|
||||
}
|
||||
|
||||
public function uploadPrintFileSave(Request $request)
|
||||
{
|
||||
$post = $request->all();
|
||||
$AdminModel = new AdminModel;
|
||||
|
||||
$template_path = "uniform-templates/" . $post['print_file_for'] . "/" . strtoupper($post['print_file_type']) . "/SIZES/" ;
|
||||
|
||||
for($i = 0; $i < count($post['uploadPrintFiles']); $i++){
|
||||
|
||||
$rawName = $request->file('uploadPrintFiles')[$i]->getClientOriginalName();
|
||||
Storage::disk('uploads')->put($template_path . $rawName, fopen($request->file('uploadPrintFiles')[$i], 'r+'));
|
||||
|
||||
$data = array(
|
||||
'TemplateCode' => $post['print_file_for'] ,
|
||||
'Path' => $template_path.$rawName,
|
||||
'Type' => strtoupper($post['print_file_type']),
|
||||
'Size' => pathinfo($rawName, PATHINFO_FILENAME)
|
||||
);
|
||||
// var_dump($data);
|
||||
$AdminModel->insertPrintFiles($data);
|
||||
}
|
||||
|
||||
return response()->json(array(
|
||||
'success' => true,
|
||||
'message'=> "Print Files(s) is successfully deleted."
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -66,6 +66,8 @@ Route::group(['middleware' => 'auth'], function () {
|
||||
|
||||
|
||||
Route::get('print-files', 'admin\AdminController@printFiles');
|
||||
Route::get('upload-print-file', 'admin\AdminController@uploadPrintFile');
|
||||
Route::post('upload-print-file/save', 'admin\AdminController@uploadPrintFileSave');
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -432,19 +432,35 @@ class AdminModel extends Model
|
||||
|
||||
function selectCommission(){
|
||||
$i = DB::select("SELECT t.StoreName, pd.InvoiceNumber, pd.CartKey, pd.Total, pd.SubTotal, pd.Tax, pd.Currency,
|
||||
(pd.Total * 0.029) AS proc_fee,
|
||||
(pd.SubTotal - 0.29) AS trans_rate, ROUND(((
|
||||
SELECT trans_rate) - (
|
||||
SELECT proc_fee)), 2) AS commission_rate, ROUND(((
|
||||
SELECT commission_rate) * 0.25), 2) AS twenty_five_percent, ROUND(((
|
||||
SELECT commission_rate) * 0.05), 2) AS five_percent
|
||||
FROM orders AS o
|
||||
INNER JOIN payment_details AS pd ON pd.CartKey = o.CartKey
|
||||
INNER JOIN teamstores AS t ON o.StoreId = t.Id
|
||||
GROUP BY pd.CartKey
|
||||
ORDER BY o.DateCreated");
|
||||
(pd.Total * 0.029) AS proc_fee,
|
||||
(pd.SubTotal - 0.29) AS trans_rate, ROUND(((
|
||||
SELECT trans_rate) - (
|
||||
SELECT proc_fee)), 2) AS commission_rate, ROUND(((
|
||||
SELECT commission_rate) * 0.25), 2) AS twenty_five_percent, ROUND(((
|
||||
SELECT commission_rate) * 0.05), 2) AS five_percent
|
||||
FROM orders AS o
|
||||
INNER JOIN payment_details AS pd ON pd.CartKey = o.CartKey
|
||||
INNER JOIN teamstores AS t ON o.StoreId = t.Id
|
||||
GROUP BY pd.CartKey
|
||||
ORDER BY o.DateCreated");
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
function selectVisualizerPrint(){
|
||||
$i = DB::select("SELECT t.TemplateCode, t.Thumbnail, t.TemplateName, t.IsActive,
|
||||
s.SportsName, tc.Category
|
||||
FROM templates AS t
|
||||
LEFT JOIN sports AS s ON t.SportsId = s.Id
|
||||
LEFT JOIN template_categories AS tc ON tc.Id = t.Category");
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function insertPrintFiles($data){
|
||||
|
||||
$i = DB::table('print_pattern_list')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user