Completed
Pull Request — development (#724)
by Ashutosh
18:55 queued 09:17
created
app/Http/Controllers/Front/ClientController.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -79,18 +79,18 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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));
Please login to merge, or discard this patch.
app/Http/Controllers/User/AdminOrderInvoiceController.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -32,30 +32,30 @@  discard block
 block discarded – undo
32 32
                         ->addColumn('total', function ($model) use ($client) {
33 33
                             return currency_format($model->grand_total, $code = $client->currency);
34 34
                         })
35
-                         ->addColumn('paid', function ($model) use ($client) {
36
-                             $payment = \App\Model\Order\Payment::where('invoice_id', $model->id)->select('amount')->get();
37
-                             $c = count($payment);
38
-                             $sum = 0;
39
-                             for ($i = 0; $i <= $c - 1; $i++) {
40
-                                 $sum = $sum + $payment[$i]->amount;
41
-                             }
42
-
43
-                             return currency_format($sum, $code = $client->currency);
44
-                         })
45
-                         ->addColumn('balance', function ($model) use ($client) {
46
-                             $payment = \App\Model\Order\Payment::where('invoice_id', $model->id)->select('amount')->get();
47
-                             $c = count($payment);
48
-                             $sum = 0;
49
-                             for ($i = 0; $i <= $c - 1; $i++) {
50
-                                 $sum = $sum + $payment[$i]->amount;
51
-                             }
52
-                             $pendingAmount = ($model->grand_total) - ($sum);
53
-
54
-                             return currency_format($pendingAmount, $code = $client->currency);
55
-                         })
56
-                          ->addColumn('status', function ($model) {
57
-                              return $model->status;
58
-                          })
35
+                            ->addColumn('paid', function ($model) use ($client) {
36
+                                $payment = \App\Model\Order\Payment::where('invoice_id', $model->id)->select('amount')->get();
37
+                                $c = count($payment);
38
+                                $sum = 0;
39
+                                for ($i = 0; $i <= $c - 1; $i++) {
40
+                                    $sum = $sum + $payment[$i]->amount;
41
+                                }
42
+
43
+                                return currency_format($sum, $code = $client->currency);
44
+                            })
45
+                            ->addColumn('balance', function ($model) use ($client) {
46
+                                $payment = \App\Model\Order\Payment::where('invoice_id', $model->id)->select('amount')->get();
47
+                                $c = count($payment);
48
+                                $sum = 0;
49
+                                for ($i = 0; $i <= $c - 1; $i++) {
50
+                                    $sum = $sum + $payment[$i]->amount;
51
+                                }
52
+                                $pendingAmount = ($model->grand_total) - ($sum);
53
+
54
+                                return currency_format($pendingAmount, $code = $client->currency);
55
+                            })
56
+                            ->addColumn('status', function ($model) {
57
+                                return $model->status;
58
+                            })
59 59
                         ->addColumn('action', function ($model) {
60 60
                             $action = '';
61 61
                             $cont = new \App\Http\Controllers\Order\TaxRatesAndCodeExpiryController();
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
                             style='color:white;'> </i>&nbsp;&nbsp;View</a>"
77 77
                                     ."   $editAction $action";
78 78
                         })
79
-                         ->rawColumns(['checkbox', 'date', 'invoice_no', 'total', 'paid', 'balance', 'status', 'action'])
79
+                            ->rawColumns(['checkbox', 'date', 'invoice_no', 'total', 'paid', 'balance', 'status', 'action'])
80 80
                         ->make(true);
81 81
     }
82 82
 
@@ -104,16 +104,16 @@  discard block
 block discarded – undo
104 104
 
105 105
                             return $number;
106 106
                         })
107
-                         ->addColumn('total', function ($model) use ($client) {
108
-                             $price = currency_format($model->price_override, $code = $client->currency);
107
+                            ->addColumn('total', function ($model) use ($client) {
108
+                                $price = currency_format($model->price_override, $code = $client->currency);
109 109
 
110
-                             return $price;
111
-                         })
112
-                         ->addColumn('status', function ($model) {
113
-                             $status = $model->order_status;
110
+                                return $price;
111
+                            })
112
+                            ->addColumn('status', function ($model) {
113
+                                $status = $model->order_status;
114 114
 
115
-                             return $status;
116
-                         })
115
+                                return $status;
116
+                            })
117 117
                         ->addColumn('action', function ($model) {
118 118
                             return '<a href='.url('orders/'.$model->id)." 
119 119
                             class='btn btn-sm btn-primary btn-xs'><i class='fa fa-eye' 
@@ -150,18 +150,18 @@  discard block
 block discarded – undo
150 150
                         ->addColumn('payment_method', function ($model) {
151 151
                             return $model->payment_method;
152 152
                         })
153
-                         ->addColumn('total', function ($model) use ($client,$extraAmt) {
154
-                             if ($model->invoice_id == 0) {
155
-                                 $amount = currency_format($extraAmt, $code = $client->currency);
156
-                             } else {
157
-                                 $amount = currency_format($model->amount, $code = $client->currency);
158
-                             }
159
-
160
-                             return $amount;
161
-                         })
162
-                         ->addColumn('status', function ($model) {
163
-                             return ucfirst($model->payment_status);
164
-                         })
153
+                            ->addColumn('total', function ($model) use ($client,$extraAmt) {
154
+                                if ($model->invoice_id == 0) {
155
+                                    $amount = currency_format($extraAmt, $code = $client->currency);
156
+                                } else {
157
+                                    $amount = currency_format($model->amount, $code = $client->currency);
158
+                                }
159
+
160
+                                return $amount;
161
+                            })
162
+                            ->addColumn('status', function ($model) {
163
+                                return ucfirst($model->payment_status);
164
+                            })
165 165
 
166 166
                         ->rawColumns(['checkbox', 'invoice_no', 'date', 'payment_method', 'total', 'status'])
167 167
                         ->make(true);
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
         $invoices = $invoice->where('user_id', $id)->orderBy('created_at', 'desc')->get();
15 15
 
16 16
         return\ DataTables::of($invoices)
17
-                        ->addColumn('checkbox', function ($model) {
17
+                        ->addColumn('checkbox', function($model) {
18 18
                             return "<input type='checkbox' class='invoice_checkbox' 
19 19
                             value=".$model->id.' name=select[] id=check>';
20 20
                         })
21
-                        ->addColumn('date', function ($model) use ($client) {
21
+                        ->addColumn('date', function($model) use ($client) {
22 22
                             $date1 = new \DateTime($model->date);
23 23
                             $tz = $client->timezone()->first()->name;
24 24
                             $date1->setTimezone(new \DateTimeZone($tz));
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 
27 27
                             return $date;
28 28
                         })
29
-                        ->addColumn('invoice_no', function ($model) {
29
+                        ->addColumn('invoice_no', function($model) {
30 30
                             return  	'<a href='.url('invoices/show?invoiceid='.$model->id).'>'.$model->number.'</a>';
31 31
                         })
32
-                        ->addColumn('total', function ($model) use ($client) {
32
+                        ->addColumn('total', function($model) use ($client) {
33 33
                             return currency_format($model->grand_total, $code = $client->currency);
34 34
                         })
35
-                         ->addColumn('paid', function ($model) use ($client) {
35
+                         ->addColumn('paid', function($model) use ($client) {
36 36
                              $payment = \App\Model\Order\Payment::where('invoice_id', $model->id)->select('amount')->get();
37 37
                              $c = count($payment);
38 38
                              $sum = 0;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
                              return currency_format($sum, $code = $client->currency);
44 44
                          })
45
-                         ->addColumn('balance', function ($model) use ($client) {
45
+                         ->addColumn('balance', function($model) use ($client) {
46 46
                              $payment = \App\Model\Order\Payment::where('invoice_id', $model->id)->select('amount')->get();
47 47
                              $c = count($payment);
48 48
                              $sum = 0;
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 
54 54
                              return currency_format($pendingAmount, $code = $client->currency);
55 55
                          })
56
-                          ->addColumn('status', function ($model) {
56
+                          ->addColumn('status', function($model) {
57 57
                               return $model->status;
58 58
                           })
59
-                        ->addColumn('action', function ($model) {
59
+                        ->addColumn('action', function($model) {
60 60
                             $action = '';
61 61
                             $cont = new \App\Http\Controllers\Order\TaxRatesAndCodeExpiryController();
62 62
                             $check = $cont->checkExecution($model->id);
@@ -86,35 +86,35 @@  discard block
 block discarded – undo
86 86
         $order = $client->order()->orderBy('created_at', 'desc')->get();
87 87
 
88 88
         return\ DataTables::of($order)
89
-                        ->addColumn('checkbox', function ($model) {
89
+                        ->addColumn('checkbox', function($model) {
90 90
                             return "<input type='checkbox' class='order_checkbox' 
91 91
                             value=".$model->id.' name=select[] id=checkorder>';
92 92
                         })
93
-                        ->addColumn('date', function ($model) {
93
+                        ->addColumn('date', function($model) {
94 94
                             return ucfirst($model->created_at);
95 95
                         })
96
-                        ->addColumn('product', function ($model) {
96
+                        ->addColumn('product', function($model) {
97 97
                             $productName = $model->product()->first() && $model->product()->first()->name ?
98 98
                             $model->product()->first()->name : 'Unknown';
99 99
 
100 100
                             return $productName;
101 101
                         })
102
-                        ->addColumn('number', function ($model) {
102
+                        ->addColumn('number', function($model) {
103 103
                             $number = $model->number;
104 104
 
105 105
                             return $number;
106 106
                         })
107
-                         ->addColumn('total', function ($model) use ($client) {
107
+                         ->addColumn('total', function($model) use ($client) {
108 108
                              $price = currency_format($model->price_override, $code = $client->currency);
109 109
 
110 110
                              return $price;
111 111
                          })
112
-                         ->addColumn('status', function ($model) {
112
+                         ->addColumn('status', function($model) {
113 113
                              $status = $model->order_status;
114 114
 
115 115
                              return $status;
116 116
                          })
117
-                        ->addColumn('action', function ($model) {
117
+                        ->addColumn('action', function($model) {
118 118
                             return '<a href='.url('orders/'.$model->id)." 
119 119
                             class='btn btn-sm btn-primary btn-xs'><i class='fa fa-eye' 
120 120
                             style='color:white;'> </i>&nbsp;&nbsp;View</a>";
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
         $extraAmt = $this->getExtraAmtPaid($id);
132 132
 
133 133
         return\ DataTables::of($payments)
134
-                        ->addColumn('checkbox', function ($model) {
134
+                        ->addColumn('checkbox', function($model) {
135 135
                             return "<input type='checkbox' class='payment_checkbox' 
136 136
                             value=".$model->id.' name=select[] id=checkpayment>';
137 137
                         })
138
-                        ->addColumn('invoice_no', function ($model) {
138
+                        ->addColumn('invoice_no', function($model) {
139 139
                             return $model->invoice()->first() ? $model->invoice()->first()->number : '--';
140 140
                         })
141
-                        ->addColumn('date', function ($model) {
141
+                        ->addColumn('date', function($model) {
142 142
                             $date = $model->created_at;
143 143
                             $date1 = new \DateTime($date);
144 144
                             $tz = \Auth::user()->timezone()->first()->name;
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 
148 148
                             return $date;
149 149
                         })
150
-                        ->addColumn('payment_method', function ($model) {
150
+                        ->addColumn('payment_method', function($model) {
151 151
                             return $model->payment_method;
152 152
                         })
153
-                         ->addColumn('total', function ($model) use ($client,$extraAmt) {
153
+                         ->addColumn('total', function($model) use ($client, $extraAmt) {
154 154
                              if ($model->invoice_id == 0) {
155 155
                                  $amount = currency_format($extraAmt, $code = $client->currency);
156 156
                              } else {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
                              return $amount;
161 161
                          })
162
-                         ->addColumn('status', function ($model) {
162
+                         ->addColumn('status', function($model) {
163 163
                              return ucfirst($model->payment_status);
164 164
                          })
165 165
 
Please login to merge, or discard this patch.