@@ -84,7 +84,8 @@ discard block |
||
| 84 | 84 | $getProductId = $this->postCurl($url, "api_key_secret=$api_key_secret&api_function=search |
| 85 | 85 | &search_type=product&search_keyword=$product_sku"); |
| 86 | 86 | $details = json_decode($getProductId); |
| 87 | - if ($details->api_error_detected == 0 && is_array($details->page_message)) {//This is not true if Product_sku is updated |
|
| 87 | + if ($details->api_error_detected == 0 && is_array($details->page_message)) { |
|
| 88 | +//This is not true if Product_sku is updated |
|
| 88 | 89 | $productId = $details->page_message[0]->product_id; |
| 89 | 90 | } |
| 90 | 91 | |
@@ -120,7 +121,8 @@ discard block |
||
| 120 | 121 | &search_type=client&search_keyword=$email"); |
| 121 | 122 | |
| 122 | 123 | $details = json_decode($getUserId); |
| 123 | - if ($details->api_error_detected == 0 && is_array($details->page_message)) {//This is not true if email is updated |
|
| 124 | + if ($details->api_error_detected == 0 && is_array($details->page_message)) { |
|
| 125 | +//This is not true if email is updated |
|
| 124 | 126 | $userId = $details->page_message[0]->client_id; |
| 125 | 127 | } |
| 126 | 128 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $order_id = $order->id; |
| 146 | 146 | $updatesEndDate = Subscription::select('update_ends_at') |
| 147 | - ->where('product_id', $productid)->where('order_id', $order_id)->first(); |
|
| 147 | + ->where('product_id', $productid)->where('order_id', $order_id)->first(); |
|
| 148 | 148 | if ($updatesEndDate) { |
| 149 | 149 | foreach ($versions as $version) { |
| 150 | 150 | if ($version->created_at->toDateTimeString() |
@@ -417,9 +417,9 @@ discard block |
||
| 417 | 417 | ->addColumn('payment_method', function ($model) { |
| 418 | 418 | return $model->payment_method; |
| 419 | 419 | }) |
| 420 | - ->addColumn('payment_status', function ($model) { |
|
| 421 | - return $model->payment_status; |
|
| 422 | - }) |
|
| 420 | + ->addColumn('payment_status', function ($model) { |
|
| 421 | + return $model->payment_status; |
|
| 422 | + }) |
|
| 423 | 423 | ->addColumn('created_at', function ($model) { |
| 424 | 424 | $date1 = new DateTime($model->created_at); |
| 425 | 425 | $tz = \Auth::user()->timezone()->first()->name; |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | return $date; |
| 430 | 430 | }) |
| 431 | 431 | ->rawColumns(['checkbox', 'number', 'amount', |
| 432 | - 'payment_method', 'payment_status', 'created_at', ]) |
|
| 432 | + 'payment_method', 'payment_status', 'created_at', ]) |
|
| 433 | 433 | ->make(true); |
| 434 | 434 | } catch (Exception $ex) { |
| 435 | 435 | Bugsnag::notifyException($ex); |
@@ -455,17 +455,17 @@ discard block |
||
| 455 | 455 | ->addColumn('number', function ($model) { |
| 456 | 456 | return $model->invoice()->first()->number; |
| 457 | 457 | }) |
| 458 | - ->addColumn('total', function ($model) { |
|
| 459 | - return $model->amount; |
|
| 460 | - }) |
|
| 461 | - ->addColumn('created_at', function ($model) { |
|
| 462 | - $date1 = new DateTime($model->created_at); |
|
| 463 | - $tz = \Auth::user()->timezone()->first()->name; |
|
| 464 | - $date1->setTimezone(new DateTimeZone($tz)); |
|
| 465 | - $date = $date1->format('M j, Y, g:i a'); |
|
| 466 | - |
|
| 467 | - return $date; |
|
| 468 | - }) |
|
| 458 | + ->addColumn('total', function ($model) { |
|
| 459 | + return $model->amount; |
|
| 460 | + }) |
|
| 461 | + ->addColumn('created_at', function ($model) { |
|
| 462 | + $date1 = new DateTime($model->created_at); |
|
| 463 | + $tz = \Auth::user()->timezone()->first()->name; |
|
| 464 | + $date1->setTimezone(new DateTimeZone($tz)); |
|
| 465 | + $date = $date1->format('M j, Y, g:i a'); |
|
| 466 | + |
|
| 467 | + return $date; |
|
| 468 | + }) |
|
| 469 | 469 | |
| 470 | 470 | ->addColumn('payment_method', 'payment_status', 'created_at') |
| 471 | 471 | |
@@ -79,18 +79,18 @@ discard block |
||
| 79 | 79 | ->select('number', 'created_at', 'grand_total', 'id', 'status'); |
| 80 | 80 | |
| 81 | 81 | return \DataTables::of($invoices->get()) |
| 82 | - ->addColumn('number', function ($model) { |
|
| 82 | + ->addColumn('number', function($model) { |
|
| 83 | 83 | return $model->number; |
| 84 | 84 | }) |
| 85 | - ->addColumn('date', function ($model) { |
|
| 85 | + ->addColumn('date', function($model) { |
|
| 86 | 86 | $date = $model->created_at; |
| 87 | 87 | |
| 88 | 88 | return $date; |
| 89 | 89 | }) |
| 90 | - ->addColumn('total', function ($model) { |
|
| 90 | + ->addColumn('total', function($model) { |
|
| 91 | 91 | return currency_format($model->grand_total, $code = \Auth::user()->currency); |
| 92 | 92 | }) |
| 93 | - ->addColumn('Action', function ($model) { |
|
| 93 | + ->addColumn('Action', function($model) { |
|
| 94 | 94 | $status = $model->status; |
| 95 | 95 | $payment = ''; |
| 96 | 96 | if ($status == 'Pending' && $model->grand_total > 0) { |
@@ -155,19 +155,19 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | return \DataTables::of($versions) |
| 158 | - ->addColumn('id', function ($versions) { |
|
| 158 | + ->addColumn('id', function($versions) { |
|
| 159 | 159 | return ucfirst($versions->id); |
| 160 | 160 | }) |
| 161 | - ->addColumn('version', function ($versions) { |
|
| 161 | + ->addColumn('version', function($versions) { |
|
| 162 | 162 | return ucfirst($versions->version); |
| 163 | 163 | }) |
| 164 | - ->addColumn('title', function ($versions) { |
|
| 164 | + ->addColumn('title', function($versions) { |
|
| 165 | 165 | return ucfirst($versions->title); |
| 166 | 166 | }) |
| 167 | - ->addColumn('description', function ($versions) { |
|
| 167 | + ->addColumn('description', function($versions) { |
|
| 168 | 168 | return ucfirst($versions->description); |
| 169 | 169 | }) |
| 170 | - ->addColumn('file', function ($versions) use ($countExpiry, $countVersions, $clientid, $invoiceid, $productid) { |
|
| 170 | + ->addColumn('file', function($versions) use ($countExpiry, $countVersions, $clientid, $invoiceid, $productid) { |
|
| 171 | 171 | $invoice_id = Invoice::where('number', $invoiceid)->pluck('id')->first(); |
| 172 | 172 | $order = Order::where('invoice_id', '=', $invoice_id)->first(); |
| 173 | 173 | $order_id = $order->id; |
@@ -233,18 +233,18 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | return \DataTables::of($link) |
| 236 | - ->addColumn('version', function ($link) { |
|
| 236 | + ->addColumn('version', function($link) { |
|
| 237 | 237 | return ucfirst($link['tag_name']); |
| 238 | 238 | }) |
| 239 | - ->addColumn('name', function ($link) { |
|
| 239 | + ->addColumn('name', function($link) { |
|
| 240 | 240 | return ucfirst($link['name']); |
| 241 | 241 | }) |
| 242 | - ->addColumn('description', function ($link) { |
|
| 242 | + ->addColumn('description', function($link) { |
|
| 243 | 243 | $markdown = Markdown::convertToHtml(ucfirst($link['body'])); |
| 244 | 244 | |
| 245 | 245 | return $markdown; |
| 246 | 246 | }) |
| 247 | - ->addColumn('file', function ($link) use ($countExpiry, $countVersions, $invoiceid, $productid) { |
|
| 247 | + ->addColumn('file', function($link) use ($countExpiry, $countVersions, $invoiceid, $productid) { |
|
| 248 | 248 | $order = Order::where('invoice_id', '=', $invoiceid)->first(); |
| 249 | 249 | $order_id = $order->id; |
| 250 | 250 | $orderEndDate = Subscription::select('update_ends_at') |
@@ -280,20 +280,20 @@ discard block |
||
| 280 | 280 | $orders = Order::where('client', \Auth::user()->id); |
| 281 | 281 | |
| 282 | 282 | return \DataTables::of($orders->get()) |
| 283 | - ->addColumn('id', function ($model) { |
|
| 283 | + ->addColumn('id', function($model) { |
|
| 284 | 284 | return $model->id; |
| 285 | 285 | }) |
| 286 | - ->addColumn('product_name', function ($model) { |
|
| 286 | + ->addColumn('product_name', function($model) { |
|
| 287 | 287 | return $model->product()->first()->name; |
| 288 | 288 | }) |
| 289 | - ->addColumn('expiry', function ($model) { |
|
| 289 | + ->addColumn('expiry', function($model) { |
|
| 290 | 290 | $tz = \Auth::user()->timezone()->first()->name; |
| 291 | 291 | $end = $this->getExpiryDate($model); |
| 292 | 292 | |
| 293 | 293 | return $end; |
| 294 | 294 | }) |
| 295 | 295 | |
| 296 | - ->addColumn('Action', function ($model) { |
|
| 296 | + ->addColumn('Action', function($model) { |
|
| 297 | 297 | $sub = $model->subscription()->first(); |
| 298 | 298 | $order = Order::where('id', $model->id)->select('product')->first(); |
| 299 | 299 | $productid = $order->product; |
@@ -399,28 +399,28 @@ discard block |
||
| 399 | 399 | ->select('id', 'invoice_id', 'user_id', 'amount', 'payment_method', 'payment_status', 'created_at'); |
| 400 | 400 | |
| 401 | 401 | return \DataTables::of($payments->get()) |
| 402 | - ->addColumn('checkbox', function ($model) { |
|
| 402 | + ->addColumn('checkbox', function($model) { |
|
| 403 | 403 | if (\Input::get('client') != 'true') { |
| 404 | 404 | return "<input type='checkbox' class='payment_checkbox' |
| 405 | 405 | value=".$model->id.' name=select[] id=check>'; |
| 406 | 406 | } |
| 407 | 407 | }) |
| 408 | - ->addColumn('number', function ($model) { |
|
| 408 | + ->addColumn('number', function($model) { |
|
| 409 | 409 | return $model->invoice()->first()->number; |
| 410 | 410 | }) |
| 411 | - ->addColumn('amount', function ($model) { |
|
| 411 | + ->addColumn('amount', function($model) { |
|
| 412 | 412 | $currency = $model->invoice()->first()->currency; |
| 413 | 413 | $total = currency_format($model->amount, $code = $currency); |
| 414 | 414 | |
| 415 | 415 | return $total; |
| 416 | 416 | }) |
| 417 | - ->addColumn('payment_method', function ($model) { |
|
| 417 | + ->addColumn('payment_method', function($model) { |
|
| 418 | 418 | return $model->payment_method; |
| 419 | 419 | }) |
| 420 | - ->addColumn('payment_status', function ($model) { |
|
| 420 | + ->addColumn('payment_status', function($model) { |
|
| 421 | 421 | return $model->payment_status; |
| 422 | 422 | }) |
| 423 | - ->addColumn('created_at', function ($model) { |
|
| 423 | + ->addColumn('created_at', function($model) { |
|
| 424 | 424 | $date1 = new DateTime($model->created_at); |
| 425 | 425 | $tz = \Auth::user()->timezone()->first()->name; |
| 426 | 426 | $date1->setTimezone(new DateTimeZone($tz)); |
@@ -452,13 +452,13 @@ discard block |
||
| 452 | 452 | ->select('id', 'invoice_id', 'user_id', 'payment_method', 'payment_status', 'created_at', 'amount'); |
| 453 | 453 | //dd(\Input::all()); |
| 454 | 454 | return \DataTables::of($payments->get()) |
| 455 | - ->addColumn('number', function ($model) { |
|
| 455 | + ->addColumn('number', function($model) { |
|
| 456 | 456 | return $model->invoice()->first()->number; |
| 457 | 457 | }) |
| 458 | - ->addColumn('total', function ($model) { |
|
| 458 | + ->addColumn('total', function($model) { |
|
| 459 | 459 | return $model->amount; |
| 460 | 460 | }) |
| 461 | - ->addColumn('created_at', function ($model) { |
|
| 461 | + ->addColumn('created_at', function($model) { |
|
| 462 | 462 | $date1 = new DateTime($model->created_at); |
| 463 | 463 | $tz = \Auth::user()->timezone()->first()->name; |
| 464 | 464 | $date1->setTimezone(new DateTimeZone($tz)); |
@@ -105,16 +105,16 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | return \DataTables::of($query->take(50)) |
| 107 | 107 | ->setTotalRecords($query->count()) |
| 108 | - ->addColumn('checkbox', function ($model) { |
|
| 108 | + ->addColumn('checkbox', function($model) { |
|
| 109 | 109 | return "<input type='checkbox' class='order_checkbox' value=". |
| 110 | 110 | $model->id.' name=select[] id=check>'; |
| 111 | 111 | }) |
| 112 | - ->addColumn('date', function ($model) { |
|
| 112 | + ->addColumn('date', function($model) { |
|
| 113 | 113 | $date = $model->created_at; |
| 114 | 114 | |
| 115 | 115 | return "<span style='display:none'>$model->id</span>".$date; |
| 116 | 116 | }) |
| 117 | - ->addColumn('client', function ($model) { |
|
| 117 | + ->addColumn('client', function($model) { |
|
| 118 | 118 | $user = $this->user->where('id', $model->client)->first(); |
| 119 | 119 | $first = $user->first_name; |
| 120 | 120 | $last = $user->last_name; |
@@ -122,30 +122,30 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | return '<a href='.url('clients/'.$id).'>'.ucfirst($first).' '.ucfirst($last).'<a>'; |
| 124 | 124 | }) |
| 125 | - ->addColumn('productname', function ($model) { |
|
| 125 | + ->addColumn('productname', function($model) { |
|
| 126 | 126 | $productid = ($model->product); |
| 127 | 127 | $productName = Product::where('id', $productid)->pluck('name')->first(); |
| 128 | 128 | |
| 129 | 129 | return $productName; |
| 130 | 130 | }) |
| 131 | - ->addColumn('number', function ($model) { |
|
| 131 | + ->addColumn('number', function($model) { |
|
| 132 | 132 | return ucfirst($model->number); |
| 133 | 133 | }) |
| 134 | - ->addColumn('price_override', function ($model) { |
|
| 134 | + ->addColumn('price_override', function($model) { |
|
| 135 | 135 | $currency = $model->user()->find($model->client)->currency; |
| 136 | 136 | |
| 137 | 137 | return currency_format($model->price_override, $code = $currency); |
| 138 | 138 | }) |
| 139 | - ->addColumn('order_status', function ($model) { |
|
| 139 | + ->addColumn('order_status', function($model) { |
|
| 140 | 140 | return ucfirst($model->order_status); |
| 141 | 141 | }) |
| 142 | 142 | // ->showColumns('number', 'price_override', 'order_status') |
| 143 | - ->addColumn('update_ends_at', function ($model) { |
|
| 143 | + ->addColumn('update_ends_at', function($model) { |
|
| 144 | 144 | $end = $this->getEndDate($model); |
| 145 | 145 | |
| 146 | 146 | return $end; |
| 147 | 147 | }) |
| 148 | - ->addColumn('action', function ($model) { |
|
| 148 | + ->addColumn('action', function($model) { |
|
| 149 | 149 | $sub = $model->subscription()->first(); |
| 150 | 150 | $status = $this->checkInvoiceStatusByOrderId($model->id); |
| 151 | 151 | $url = $this->getUrl($model, $status, $sub); |
@@ -153,30 +153,30 @@ discard block |
||
| 153 | 153 | return $url; |
| 154 | 154 | }) |
| 155 | 155 | |
| 156 | - ->filterColumn('created_at', function ($query, $keyword) { |
|
| 156 | + ->filterColumn('created_at', function($query, $keyword) { |
|
| 157 | 157 | $sql = 'created_at like ?'; |
| 158 | 158 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 159 | 159 | }) |
| 160 | 160 | |
| 161 | - ->filterColumn('client', function ($query, $keyword) { |
|
| 161 | + ->filterColumn('client', function($query, $keyword) { |
|
| 162 | 162 | $sql = 'client like ?'; |
| 163 | 163 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 164 | 164 | }) |
| 165 | 165 | |
| 166 | - ->filterColumn('number', function ($query, $keyword) { |
|
| 166 | + ->filterColumn('number', function($query, $keyword) { |
|
| 167 | 167 | $sql = 'number like ?'; |
| 168 | 168 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 169 | 169 | }) |
| 170 | - ->filterColumn('price_override', function ($query, $keyword) { |
|
| 170 | + ->filterColumn('price_override', function($query, $keyword) { |
|
| 171 | 171 | $sql = 'price_override like ?'; |
| 172 | 172 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 173 | 173 | }) |
| 174 | - ->filterColumn('order_status', function ($query, $keyword) { |
|
| 174 | + ->filterColumn('order_status', function($query, $keyword) { |
|
| 175 | 175 | $sql = 'order_status like ?'; |
| 176 | 176 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 177 | 177 | }) |
| 178 | 178 | |
| 179 | - ->filterColumn('update_ends_at', function ($query, $keyword) { |
|
| 179 | + ->filterColumn('update_ends_at', function($query, $keyword) { |
|
| 180 | 180 | $sql = 'update_ends_at like ?'; |
| 181 | 181 | $query->whereRaw($sql, ["%{$keyword}%"]); |
| 182 | 182 | }) |