diff --git a/app/Http/Controllers/admin/AdminController.php b/app/Http/Controllers/admin/AdminController.php index 51c819e..35cdff2 100644 --- a/app/Http/Controllers/admin/AdminController.php +++ b/app/Http/Controllers/admin/AdminController.php @@ -11,6 +11,12 @@ use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Validator; // use Validator; use App\User; +use Illuminate\Support\Facades\Session; +use Excel; +use Illuminate\Support\Facades\File; +use Illuminate\Support\Facades\DB; +use Carbon\Carbon; + class AdminController extends Controller @@ -1341,4 +1347,54 @@ class AdminController extends Controller } return view('admin_pages.tracking_index')->with("tracking", $getTrackingStatus); } + + + public function importExcel(Request $request){ + //validate the xls file + $this->validate($request, array( + 'file' => 'required' + )); + + if($request->hasFile('file')){ + $extension = File::extension($request->file->getClientOriginalName()); + if ($extension == "xlsx" || $extension == "xls" || $extension == "csv") { + + $path = $request->file->getRealPath(); + $data = Excel::load($path, function($reader) { + })->get(); + if(!empty($data) && $data->count()){ + + // var_dump($data); + + foreach ($data as $key => $value) { + $insert[] = [ + 'TrackingNumber' => $value->tracking_number, + 'InvoiceNumber' => $value->invoice_number, + 'Carrier' => $value->carrier, + 'StepId' => 10, + 'ScannedBy' => 1, + 'created_at'=> Carbon::now() + ]; + } + + if(!empty($insert)){ + + $insertData = DB::table('tracking')->insert($insert); + if ($insertData) { + Session::flash('success', 'Your Data has successfully imported'); + }else { + Session::flash('error', 'Error inserting the data..'); + return back(); + } + } + } + + return back(); + + }else { + Session::flash('error', 'File is a '.$extension.' file.!! Please upload a valid xls/csv file..!!'); + return back(); + } + } +} } diff --git a/app/Http/routes.php b/app/Http/routes.php index 2efe5f0..1be0dff 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -92,6 +92,8 @@ Route::group(['middleware' => 'auth'], function () { Route::get('tracking', 'admin\AdminController@trackingIndex'); Route::post('post/update-hibernate', 'admin\AdminController@updateHibernate'); + Route::post('import', 'admin\AdminController@importExcel')->name('import'); + Route::get('duplicate-store/{id}/{newstore_id}', 'admin\AdminController@duplicateStore' ); diff --git a/app/Models/admin/AdminModel.php b/app/Models/admin/AdminModel.php index b9b45ff..1e56d62 100644 --- a/app/Models/admin/AdminModel.php +++ b/app/Models/admin/AdminModel.php @@ -7,430 +7,476 @@ use Illuminate\Support\Facades\DB; class AdminModel extends Model { - function selectPaymentDetails($field, $value){ + function selectPaymentDetails($field, $value) + { - if($field != "All"){ - $i = DB::table('payment_details') - ->where($field, $value) - ->orderby('Id', 'ASC') - ->get(); - }else{ + if ($field != "All") { + $i = DB::table('payment_details') + ->where($field, $value) + ->orderby('Id', 'ASC') + ->get(); + } else { $i = DB::table('payment_details') - ->leftjoin('orders', 'payment_details.CartKey', '=', 'orders.CartKey') - ->leftjoin('teamstores', 'teamstores.Id', '=', 'orders.StoreId') - ->select('payment_details.*', 'orders.StoreId', 'teamstores.StoreName') - ->where("payment_details.CartKey", "!=", null) - ->groupby('orders.CartKey') - ->orderby('payment_details.Id', 'ASC') - ->get(); - } - + ->leftjoin('orders', 'payment_details.CartKey', '=', 'orders.CartKey') + ->leftjoin('teamstores', 'teamstores.Id', '=', 'orders.StoreId') + ->select('payment_details.*', 'orders.StoreId', 'teamstores.StoreName') + ->where("payment_details.CartKey", "!=", null) + ->groupby('orders.CartKey') + ->orderby('payment_details.Id', 'ASC') + ->get(); + } + return $i; - } - - function selectOrderItem($field, $ck){ + } + + function selectOrderItem($field, $ck) + { $i = DB::table('orders') - ->where($field, $ck) - ->get(); + ->where($field, $ck) + ->get(); return $i; - } - - function itemGroup($cartKey){ - $pdo = DB::connection()->getPdo(); - $query = $pdo->prepare("SELECT orders.*, COUNT(orders.Id) AS qty, orders.Price * SUM(orders.Quantity) AS total_price, teamstores.StoreName FROM orders LEFT JOIN teamstores on teamstores.Id = orders.StoreId WHERE CartKey = :ck GROUP BY ProductId"); - $query->execute([':ck'=>$cartKey]); - $row = $query->fetchAll(\PDO::FETCH_OBJ); - return $row; - - } - - function selectDisplayItemThumb(){ + } + + function itemGroup($cartKey) + { + $pdo = DB::connection()->getPdo(); + $query = $pdo->prepare("SELECT orders.*, COUNT(orders.Id) AS qty, orders.Price * SUM(orders.Quantity) AS total_price, teamstores.StoreName FROM orders LEFT JOIN teamstores on teamstores.Id = orders.StoreId WHERE CartKey = :ck GROUP BY ProductId"); + $query->execute([':ck' => $cartKey]); + $row = $query->fetchAll(\PDO::FETCH_OBJ); + return $row; + } + + function selectDisplayItemThumb() + { $i = DB::table('teamstore_product_thumbnails') - ->where('ImageClass', 'active') - ->get(); + ->where('ImageClass', 'active') + ->get(); return $i; - } - - function selectShippingAddress($field, $value){ + } + + function selectShippingAddress($field, $value) + { $i = DB::table('shipping_addresses') - ->where($field, $value) - ->get(); + ->where($field, $value) + ->get(); return $i; } - function selectClientDesign($design_code){ + function selectClientDesign($design_code) + { $i = DB::table('client_designs') - ->where('DesignCode', $design_code) - ->get(); + ->where('DesignCode', $design_code) + ->get(); return $i; } - function insertTeamstore($data){ + function insertTeamstore($data) + { $i = DB::table('teamstores')->insert($data); return $i; } - function selectTeamstore(){ + function selectTeamstore() + { $i = DB::table('teamstores') - ->paginate(16); - return $i; - } - - function selectTeamstoreFilter($field, $value){ - - $i = DB::table('teamstores') - ->orderby($field, $value) - ->paginate(16); - return $i; - } - - function selectTeamstoreSearch($field, $value, $keyword){ - - $i = DB::table('teamstores') - ->where("StoreName", "LIKE","%$keyword%") - ->orderby($field, $value) - ->paginate(16); - return $i; - } - - function selectTeamstoreById($id){ - - $i = DB::table('teamstores') - ->where("Id", $id) - ->get(); + ->paginate(16); return $i; } - function updateTeamstore($id, $data){ + function selectTeamstoreFilter($field, $value) + { $i = DB::table('teamstores') - ->where("Id", $id) - ->update($data); + ->orderby($field, $value) + ->paginate(16); return $i; } - function deleteTeamstoreById($id){ + function selectTeamstoreSearch($field, $value, $keyword) + { $i = DB::table('teamstores') - ->where("Id", $id) - ->delete(); + ->where("StoreName", "LIKE", "%$keyword%") + ->orderby($field, $value) + ->paginate(16); return $i; } - function selectPattern(){ + function selectTeamstoreById($id) + { + + $i = DB::table('teamstores') + ->where("Id", $id) + ->get(); + return $i; + } + + function updateTeamstore($id, $data) + { + + $i = DB::table('teamstores') + ->where("Id", $id) + ->update($data); + return $i; + } + + function deleteTeamstoreById($id) + { + + $i = DB::table('teamstores') + ->where("Id", $id) + ->delete(); + return $i; + } + + function selectPattern() + { $i = DB::table('patterns') - ->get(); + ->get(); return $i; } - function selectPatternWithfield($field, $value){ + function selectPatternWithfield($field, $value) + { $i = DB::table('patterns') - ->where($field, $value) - ->get(); + ->where($field, $value) + ->get(); return $i; } - function selectClipartCategory(){ + function selectClipartCategory() + { $i = DB::table('clipart_categories') - ->leftjoin('user_logins', 'clipart_categories.UserId', '=', 'user_logins.id') - ->select('clipart_categories.*', 'user_logins.username') - ->orderby('clipart_categories.Ordering', 'ASC') - ->get(); + ->leftjoin('user_logins', 'clipart_categories.UserId', '=', 'user_logins.id') + ->select('clipart_categories.*', 'user_logins.username') + ->orderby('clipart_categories.Ordering', 'ASC') + ->get(); return $i; } - function ClipartCategory(){ + function ClipartCategory() + { $i = DB::table('clipart_categories') - ->leftjoin('user_logins', 'clipart_categories.UserId', '=', 'user_logins.id') - ->select('clipart_categories.*', 'user_logins.username') - ->orderby('clipart_categories.Ordering', 'ASC') - ->paginate(18); + ->leftjoin('user_logins', 'clipart_categories.UserId', '=', 'user_logins.id') + ->select('clipart_categories.*', 'user_logins.username') + ->orderby('clipart_categories.Ordering', 'ASC') + ->paginate(18); return $i; } - function selectStoreOwners($store_id){ + function selectStoreOwners($store_id) + { $i = DB::table('user_logins') - ->where('role', 'store_owner') - ->where('store_id', $store_id) - ->get(); + ->where('role', 'store_owner') + ->where('store_id', $store_id) + ->get(); return $i; } - function insertClipartCategory($data){ + function insertClipartCategory($data) + { $i = DB::table('clipart_categories')->insertGetId($data); return $i; } - function insertClipart($data){ + function insertClipart($data) + { $i = DB::table('cliparts')->insert($data); return $i; } - function updateClipartCatOrdering($order, $id){ + function updateClipartCatOrdering($order, $id) + { $i = DB::table('clipart_categories')->where('Id', $id) - ->update(['Ordering' => $order]); + ->update(['Ordering' => $order]); } - function userList(){ + function userList() + { $i = DB::table('user_logins') - ->select('id', 'name', 'username', 'email') - // ->where("name", "LIKE","%$keyword%") - // ->orWhere("username", "LIKE","%$keyword%") - // ->orWhere("email", "LIKE","%$keyword%") - ->where("role", "user") - ->orderby('name', 'ASC') - ->get(); + ->select('id', 'name', 'username', 'email') + // ->where("name", "LIKE","%$keyword%") + // ->orWhere("username", "LIKE","%$keyword%") + // ->orWhere("email", "LIKE","%$keyword%") + ->where("role", "user") + ->orderby('name', 'ASC') + ->get(); return $i; } - function makeUserAsStoreOwner($data){ - + function makeUserAsStoreOwner($data) + { + $i = DB::table('user_logins') - ->where("Id", $data['user_id']) - ->update(['role'=> 'store_owner', 'store_id'=> $data['store_id']]); + ->where("Id", $data['user_id']) + ->update(['role' => 'store_owner', 'store_id' => $data['store_id']]); return $i; } - function model_removeStoreAccess($data){ + function model_removeStoreAccess($data) + { $i = DB::table('user_logins') - ->where("Id", $data['user_id']) - ->update(['role'=> 'user', 'store_id'=> $data['store_id']]); + ->where("Id", $data['user_id']) + ->update(['role' => 'user', 'store_id' => $data['store_id']]); return $i; } - function deleteClipartCategory($id){ + function deleteClipartCategory($id) + { $i = DB::table('clipart_categories') - ->where("Id", $id) - ->delete(); + ->where("Id", $id) + ->delete(); return $i; } - function deleteClipart($id){ + function deleteClipart($id) + { $i = DB::table('cliparts') - ->where("Id", $id) - ->delete(); + ->where("Id", $id) + ->delete(); return $i; } - function updateClipartCategory($id, $data){ + function updateClipartCategory($id, $data) + { $i = DB::table('clipart_categories') - ->where("Id", $id) - ->update($data); - return $i; - } - - function selectCliparts($cat_id){ - - if($cat_id != 0 || $cat_id != ""){ - $i = DB::table('cliparts')->select('cliparts.*', 'clipart_categories.CategoryName') - ->leftjoin('clipart_categories', 'clipart_categories.Id','=','cliparts.CategoryId') - ->where('cliparts.CategoryId', $cat_id) - ->orderby("Id", "DESC") - ->paginate(16); - return $i; - }else{ - $i = DB::table('cliparts')->select('cliparts.*', 'clipart_categories.CategoryName') - ->leftjoin('clipart_categories', 'clipart_categories.Id','=','cliparts.CategoryId') - // ->where('cliparts.CategoryId', $cat_id) - ->orderby("Id", "DESC") - ->paginate(16); - return $i; - } - - - - - } - - function selectSports(){ - - $i = DB::table('sports') - ->orderby("SportsName", "ASC") - ->get(); - return $i; - } - - function selectSportsCategory($id){ - - $i = DB::table('template_categories') - ->where('TemplateId', $id) - ->orderby("Category", "ASC") - ->get(); - return $i; - } - - function selectStoreOrders(){ - $i = DB::table('orders')->select('orders.*', 'orders.Id as Order_Id', 'orders.DateCreated AS date_ordered', 'payment_details.InvoiceNumber', 'payment_details.Currency', 'payment_details.Payer_Email', 'payment_details.Payer_Firstname', 'payment_details.Payer_Lastname', 'shipping_addresses.*', 'teamstores.*') - ->leftjoin('payment_details', 'payment_details.CartKey','=','orders.CartKey') - ->leftjoin('shipping_addresses', 'shipping_addresses.PaymentDetail_Id','=','payment_details.Id') - ->leftjoin('teamstores', 'teamstores.Id','=','orders.StoreId') - // ->where('orders.StoreId', $store_id) - ->orderby('orders.DateCreated', 'DESC') - ->get(); + ->where("Id", $id) + ->update($data); return $i; } - function saveNewVisualizer($data){ + function selectCliparts($cat_id) + { + + if ($cat_id != 0 || $cat_id != "") { + $i = DB::table('cliparts')->select('cliparts.*', 'clipart_categories.CategoryName') + ->leftjoin('clipart_categories', 'clipart_categories.Id', '=', 'cliparts.CategoryId') + ->where('cliparts.CategoryId', $cat_id) + ->orderby("Id", "DESC") + ->paginate(16); + return $i; + } else { + $i = DB::table('cliparts')->select('cliparts.*', 'clipart_categories.CategoryName') + ->leftjoin('clipart_categories', 'clipart_categories.Id', '=', 'cliparts.CategoryId') + // ->where('cliparts.CategoryId', $cat_id) + ->orderby("Id", "DESC") + ->paginate(16); + return $i; + } + } + + function selectSports() + { + + $i = DB::table('sports') + ->orderby("SportsName", "ASC") + ->get(); + return $i; + } + + function selectSportsCategory($id) + { + + $i = DB::table('template_categories') + ->where('TemplateId', $id) + ->orderby("Category", "ASC") + ->get(); + return $i; + } + + function selectStoreOrders() + { + $i = DB::table('orders')->select('orders.*', 'orders.Id as Order_Id', 'orders.DateCreated AS date_ordered', 'payment_details.InvoiceNumber', 'payment_details.Currency', 'payment_details.Payer_Email', 'payment_details.Payer_Firstname', 'payment_details.Payer_Lastname', 'shipping_addresses.*', 'teamstores.*') + ->leftjoin('payment_details', 'payment_details.CartKey', '=', 'orders.CartKey') + ->leftjoin('shipping_addresses', 'shipping_addresses.PaymentDetail_Id', '=', 'payment_details.Id') + ->leftjoin('teamstores', 'teamstores.Id', '=', 'orders.StoreId') + // ->where('orders.StoreId', $store_id) + ->orderby('orders.DateCreated', 'DESC') + ->get(); + return $i; + } + + function saveNewVisualizer($data) + { $i = DB::table('templates')->insert($data); $id = DB::getPdo()->lastInsertId(); - + return array( - 'i' => $i, - 'lastId' => $id + 'i' => $i, + 'lastId' => $id ); } - function updateVisualizer($id, $data){ + function updateVisualizer($id, $data) + { $i = DB::table('templates') - ->where("Id", $id) - ->update($data); + ->where("Id", $id) + ->update($data); return $i; } - function saveVisualizerDefaultBodyColor($data){ + function saveVisualizerDefaultBodyColor($data) + { $i = DB::table('template_body_colors')->insert($data); - + return $i; } - function saveVisualizerDefaultTrimColor($data){ + function saveVisualizerDefaultTrimColor($data) + { $i = DB::table('template_trim_colors')->insert($data); return $i; } - function saveVisualizerPath($data){ + function saveVisualizerPath($data) + { $i = DB::table('template_paths')->insert($data); return $i; } - function selectVisualizer($sports_id, $sports_category){ + function selectVisualizer($sports_id, $sports_category) + { $i = DB::table('templates') - ->where('SportsId', $sports_id) - ->where('Category', $sports_category) - ->orderBy('Id', 'DESC') - ->get(); + ->where('SportsId', $sports_id) + ->where('Category', $sports_category) + ->orderBy('Id', 'DESC') + ->get(); return $i; } - function selectDisplayItemThumbById($id){ + function selectDisplayItemThumbById($id) + { $i = DB::table('teamstore_product_thumbnails') - ->where('ProductId', $id) - ->where('ImageClass', 'active') - ->get(); + ->where('ProductId', $id) + ->where('ImageClass', 'active') + ->get(); return $i; } - function selectOrder($field, $value){ + function selectOrder($field, $value) + { $i = DB::table('orders') - ->where($field, $value) - ->get(); + ->where($field, $value) + ->get(); return $i; } - function editVisualizer($id){ + function editVisualizer($id) + { $i = DB::table('templates') - ->where('Id', $id) - ->get(); + ->where('Id', $id) + ->get(); return $i; } - function deleteVisualizer($id){ + function deleteVisualizer($id) + { $i = DB::table('templates') - ->where("Id", $id) - ->delete(); + ->where("Id", $id) + ->delete(); return $i; } - function deleteDefaultBodyColor($tempCode){ + function deleteDefaultBodyColor($tempCode) + { $i = DB::table('template_body_colors') - ->where("TemplateCode", $tempCode) - ->delete(); + ->where("TemplateCode", $tempCode) + ->delete(); return $i; } - function deleteTemplatePath($tempCode){ + function deleteTemplatePath($tempCode) + { $i = DB::table('template_paths') - ->where("TemplateCode", $tempCode) - ->delete(); + ->where("TemplateCode", $tempCode) + ->delete(); return $i; } - function deleteDefaultTrimColor($tempCode){ + function deleteDefaultTrimColor($tempCode) + { $i = DB::table('template_trim_colors') - ->where("TemplateCode", $tempCode) - ->delete(); + ->where("TemplateCode", $tempCode) + ->delete(); return $i; } - function deletePrintPatternList($tempCode){ + function deletePrintPatternList($tempCode) + { $i = DB::table('print_pattern_list') - ->where("TemplateCode", $tempCode) - ->delete(); + ->where("TemplateCode", $tempCode) + ->delete(); return $i; } - - function selectTemplatePath($tempCode){ + + function selectTemplatePath($tempCode) + { $i = DB::table('template_paths') - ->where("TemplateCode", $tempCode) - ->get(); + ->where("TemplateCode", $tempCode) + ->get(); return $i; } - function selectDefaultBodyColor($tempCode){ + function selectDefaultBodyColor($tempCode) + { $i = DB::table('template_body_colors') - ->where("TemplateCode", $tempCode) - ->get(); + ->where("TemplateCode", $tempCode) + ->get(); return $i; } - function selectDefaultTrimColor($tempCode){ + function selectDefaultTrimColor($tempCode) + { $i = DB::table('template_trim_colors') - ->where("TemplateCode", $tempCode) - ->get(); + ->where("TemplateCode", $tempCode) + ->get(); return $i; } - - function updateDefaultBodyColor($tempCode, $data){ + + function updateDefaultBodyColor($tempCode, $data) + { $i = DB::table('template_body_colors') - ->where("TemplateCode", $tempCode) - ->update($data); + ->where("TemplateCode", $tempCode) + ->update($data); return $i; } - function updateVisualizerPath($id, $data){ + function updateVisualizerPath($id, $data) + { $i = DB::table('template_paths') - ->where("Id", $id) - ->update($data); + ->where("Id", $id) + ->update($data); return $i; } - function selectCommission(){ + function selectCommission() + { $i = DB::select("SELECT t.StoreName, pd.InvoiceNumber, pd.CartKey, pd.Total, pd.SubTotal, pd.Tax, pd.Currency, pd.ShippingCost, (pd.Total * 0.029) AS proc_fee, (pd.SubTotal - 0.29) AS trans_rate, ROUND((( @@ -444,26 +490,29 @@ class AdminModel extends Model GROUP BY pd.CartKey ORDER BY o.DateCreated"); - return $i; + return $i; } - function selectVisualizerPrint(){ + 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; + return $i; } - function insertPrintFiles($data){ + function insertPrintFiles($data) + { $i = DB::table('print_pattern_list')->insert($data); return $i; } - function selectGroupPrintFiles(){ + 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 @@ -471,77 +520,85 @@ class AdminModel extends Model INNER JOIN template_categories AS tc ON tc.Id = t.Category GROUP BY ppl.TemplateCode"); - return $i; + return $i; } - function selectPrintFiles($tempCode){ + 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; + return $i; } - function deletePrintFiles($id){ + function deletePrintFiles($id) + { $i = DB::table('print_pattern_list') - ->where("Id", $id) - ->delete(); - return $i; + ->where("Id", $id) + ->delete(); + return $i; } - function selectTax(){ + function selectTax() + { $i = DB::select("SELECT t.Id, t.StoreName, tx.DateCreated FROM tax AS tx INNER JOIN teamstores AS t ON t.Id = tx.TeamstoreId"); - return $i; + return $i; } - function selectTeamstoreProducts($field, $value){ + function selectTeamstoreProducts($field, $value) + { $i = DB::table('teamstore_products') - ->where($field, $value) - ->get(); + ->where($field, $value) + ->get(); return $i; } - function selectProductThumbnail($id){ + function selectProductThumbnail($id) + { $i = DB::table('teamstore_product_thumbnails') - ->where('ProductId', $id) - ->get(); + ->where('ProductId', $id) + ->get(); return $i; } - function insertStoreItem($data){ - + function insertStoreItem($data) + { + $i = DB::table('teamstore_products')->insert($data); var_dump($i); $id = DB::getPdo()->lastInsertId(); - + return array( - 'i' => $i, - 'lastId' => $id + 'i' => $i, + 'lastId' => $id ); } - function insertProductThumbnails($data){ + function insertProductThumbnails($data) + { $i = DB::table('teamstore_product_thumbnails')->insert($data); // $id = DB::getPdo()->lastInsertId(); - + return $i; } - function getTrackingStatus($invoice) { - $i = DB::select("SELECT t.InvoiceNumber, ts.StepLabel, pu.Name, DATE_FORMAT(t.created_at, '%m/%d/%Y %h:%i:%s %p') AS DateCreated + function getTrackingStatus($invoice) + { + $i = DB::select("SELECT t.InvoiceNumber, t.Carrier, t.TrackingNumber, t.StepId, ts.StepLabel, pu.Name, DATE_FORMAT(t.created_at, '%m/%d/%Y %h:%i:%s %p') AS DateCreated, c.Link FROM tracking AS t INNER JOIN tracking_steps AS ts ON ts.Id = t.StepId + LEFT JOIN carriers AS c ON c.Carrier = t.Carrier INNER JOIN production_user AS pu ON t.ScannedBy = pu.Id WHERE t.InvoiceNumber = '$invoice'"); - return $i; + return $i; } - } diff --git a/composer.json b/composer.json index 338bc52..84114a9 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,8 @@ "require": { "php": ">=5.5.9", "laravel/framework": "5.2.*", - "league/flysystem-sftp": "1.0.22" + "league/flysystem-sftp": "1.0.22", + "maatwebsite/excel": "~2.1.0" }, "require-dev": { "fzaninotto/faker": "~1.4", diff --git a/composer.lock b/composer.lock index f8cd701..642c5d0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "af8d6f68d559b9573b148063cd25b63b", + "content-hash": "0c83aa17d25e2e7ba255790fb4221ff1", "packages": [ { "name": "classpreloader/classpreloader", @@ -564,6 +564,88 @@ }, "time": "2019-10-16T20:05:49+00:00" }, + { + "name": "maatwebsite/excel", + "version": "2.1.30", + "source": { + "type": "git", + "url": "https://github.com/Maatwebsite/Laravel-Excel.git", + "reference": "f5540c4ba3ac50cebd98b09ca42e61f926ef299f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/f5540c4ba3ac50cebd98b09ca42e61f926ef299f", + "reference": "f5540c4ba3ac50cebd98b09ca42e61f926ef299f", + "shasum": "" + }, + "require": { + "illuminate/cache": "^5.0", + "illuminate/config": "^5.0", + "illuminate/filesystem": "^5.0", + "illuminate/support": "^5.0", + "jeremeamia/superclosure": "^2.3", + "nesbot/carbon": "~1.0", + "php": ">=5.5", + "phpoffice/phpexcel": "^1.8.1", + "tijsverkoyen/css-to-inline-styles": "~2.0" + }, + "require-dev": { + "mockery/mockery": "~1.0", + "orchestra/testbench": "3.1.*|3.2.*|3.3.*|3.4.*|3.5.*|3.6.*", + "phpseclib/phpseclib": "~1.0", + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "illuminate/http": "^5.0", + "illuminate/queue": "^5.0", + "illuminate/routing": "^5.0", + "illuminate/view": "^5.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Maatwebsite\\Excel\\ExcelServiceProvider" + ], + "aliases": { + "Excel": "Maatwebsite\\Excel\\Facades\\Excel" + } + } + }, + "autoload": { + "classmap": [ + "src/Maatwebsite/Excel" + ], + "psr-0": { + "Maatwebsite\\Excel\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Maatwebsite.nl", + "email": "patrick@maatwebsite.nl" + } + ], + "description": "Supercharged Excel exports in Laravel", + "keywords": [ + "PHPExcel", + "batch", + "csv", + "excel", + "export", + "import", + "laravel" + ], + "support": { + "issues": "https://github.com/Maatwebsite/Laravel-Excel/issues", + "source": "https://github.com/Maatwebsite/Laravel-Excel/tree/2.1" + }, + "time": "2018-09-04T19:00:09+00:00" + }, { "name": "monolog/monolog", "version": "1.24.0", @@ -843,6 +925,73 @@ ], "time": "2018-04-04T21:48:54+00:00" }, + { + "name": "phpoffice/phpexcel", + "version": "1.8.2", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PHPExcel.git", + "reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870", + "reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "php": "^5.2|^7.0" + }, + "require-dev": { + "squizlabs/php_codesniffer": "2.*" + }, + "type": "library", + "autoload": { + "psr-0": { + "PHPExcel": "Classes/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "http://blog.maartenballiauw.be" + }, + { + "name": "Erik Tilt" + }, + { + "name": "Franck Lefevre", + "homepage": "http://rootslabs.net" + }, + { + "name": "Mark Baker", + "homepage": "http://markbakeruk.net" + } + ], + "description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "https://github.com/PHPOffice/PHPExcel", + "keywords": [ + "OpenXML", + "excel", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "support": { + "issues": "https://github.com/PHPOffice/PHPExcel/issues", + "source": "https://github.com/PHPOffice/PHPExcel/tree/master" + }, + "abandoned": "phpoffice/phpspreadsheet", + "time": "2018-11-22T23:07:24+00:00" + }, { "name": "phpseclib/phpseclib", "version": "2.0.32", @@ -1185,6 +1334,59 @@ "homepage": "https://symfony.com", "time": "2016-07-30T07:22:48+00:00" }, + { + "name": "symfony/css-selector", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "b8999c1f33c224b2b66b38253f5e3a838d0d0115" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/b8999c1f33c224b2b66b38253f5e3a838d0d0115", + "reference": "b8999c1f33c224b2b66b38253f5e3a838d0d0115", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2016-06-29T05:40:00+00:00" + }, { "name": "symfony/debug", "version": "v3.0.9", @@ -1965,6 +2167,59 @@ ], "time": "2016-07-26T08:03:56+00:00" }, + { + "name": "tijsverkoyen/css-to-inline-styles", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", + "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/da444caae6aca7a19c0c140f68c6182e337d5b1c", + "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "php": "^5.5 || ^7.0 || ^8.0", + "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "TijsVerkoyen\\CssToInlineStyles\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Tijs Verkoyen", + "email": "css_to_inline_styles@verkoyen.eu", + "role": "Developer" + } + ], + "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", + "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", + "support": { + "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.4" + }, + "time": "2021-12-08T09:12:39+00:00" + }, { "name": "vlucas/phpdotenv", "version": "v2.6.1", @@ -3190,59 +3445,6 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21T13:59:46+00:00" }, - { - "name": "symfony/css-selector", - "version": "v3.0.9", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "b8999c1f33c224b2b66b38253f5e3a838d0d0115" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/b8999c1f33c224b2b66b38253f5e3a838d0d0115", - "reference": "b8999c1f33c224b2b66b38253f5e3a838d0d0115", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony CssSelector Component", - "homepage": "https://symfony.com", - "time": "2016-06-29T05:40:00+00:00" - }, { "name": "symfony/dom-crawler", "version": "v3.0.9", diff --git a/config/app.php b/config/app.php index 4fc7a63..d5d05b9 100644 --- a/config/app.php +++ b/config/app.php @@ -147,6 +147,7 @@ return [ Illuminate\Translation\TranslationServiceProvider::class, Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, + Maatwebsite\Excel\ExcelServiceProvider::class, /* * Application Service Providers... @@ -201,6 +202,7 @@ return [ 'URL' => Illuminate\Support\Facades\URL::class, 'Validator' => Illuminate\Support\Facades\Validator::class, 'View' => Illuminate\Support\Facades\View::class, + 'Excel' => Maatwebsite\Excel\Facades\Excel::class, ], diff --git a/resources/views/admin_pages/tracking_index.blade.php b/resources/views/admin_pages/tracking_index.blade.php index fdd4d79..330b9ae 100644 --- a/resources/views/admin_pages/tracking_index.blade.php +++ b/resources/views/admin_pages/tracking_index.blade.php @@ -40,6 +40,13 @@
--}} + +