| @@ 813-864 (lines=52) @@ | ||
| 810 | } |
|
| 811 | } |
|
| 812 | ||
| 813 | public function deletePayment(Request $request) |
|
| 814 | { |
|
| 815 | try { |
|
| 816 | $ids = $request->input('select'); |
|
| 817 | if (!empty($ids)) { |
|
| 818 | foreach ($ids as $id) { |
|
| 819 | $payment = $this->payment->where('id', $id)->first(); |
|
| 820 | if ($payment) { |
|
| 821 | $invoice = $this->invoice->find($payment->invoice_id); |
|
| 822 | if ($invoice) { |
|
| 823 | $invoice->status = 'pending'; |
|
| 824 | $invoice->save(); |
|
| 825 | } |
|
| 826 | $payment->delete(); |
|
| 827 | } else { |
|
| 828 | echo "<div class='alert alert-danger alert-dismissable'> |
|
| 829 | <i class='fa fa-ban'></i> |
|
| 830 | <b>"./* @scrutinizer ignore-type */ \Lang::get('message.alert').'!</b> './* @scrutinizer ignore-type */\Lang::get('message.failed').' |
|
| 831 | <button type=button class=close data-dismiss=alert aria-hidden=true>×</button> |
|
| 832 | './* @scrutinizer ignore-type */\Lang::get('message.no-record').' |
|
| 833 | </div>'; |
|
| 834 | //echo \Lang::get('message.no-record') . ' [id=>' . $id . ']'; |
|
| 835 | } |
|
| 836 | } |
|
| 837 | echo "<div class='alert alert-success alert-dismissable'> |
|
| 838 | <i class='fa fa-ban'></i> |
|
| 839 | <b>"./* @scrutinizer ignore-type */\Lang::get('message.alert').'!</b> './* @scrutinizer ignore-type */ |
|
| 840 | \Lang::get('message.success').' |
|
| 841 | <button type=button class=close data-dismiss=alert aria-hidden=true>×</button> |
|
| 842 | './* @scrutinizer ignore-type */\Lang::get('message.deleted-successfully').' |
|
| 843 | </div>'; |
|
| 844 | } else { |
|
| 845 | echo "<div class='alert alert-danger alert-dismissable'> |
|
| 846 | <i class='fa fa-ban'></i> |
|
| 847 | <b>"./* @scrutinizer ignore-type */\Lang::get('message.alert').'!</b> '. |
|
| 848 | /* @scrutinizer ignore-type */\Lang::get('message.failed').' |
|
| 849 | <button type=button class=close data-dismiss=alert aria-hidden=true>×</button> |
|
| 850 | './* @scrutinizer ignore-type */\Lang::get('message.select-a-row').' |
|
| 851 | </div>'; |
|
| 852 | //echo \Lang::get('message.select-a-row'); |
|
| 853 | } |
|
| 854 | } catch (\Exception $e) { |
|
| 855 | Bugsnag::notifyException($e); |
|
| 856 | echo "<div class='alert alert-danger alert-dismissable'> |
|
| 857 | <i class='fa fa-ban'></i> |
|
| 858 | <b>"./* @scrutinizer ignore-type */\Lang::get('message.alert').'!</b> '. |
|
| 859 | /* @scrutinizer ignore-type */ \Lang::get('message.failed').' |
|
| 860 | <button type=button class=close data-dismiss=alert aria-hidden=true>×</button> |
|
| 861 | '.$e->getMessage().' |
|
| 862 | </div>'; |
|
| 863 | } |
|
| 864 | } |
|
| 865 | } |
|
| 866 | ||
| @@ 223-271 (lines=49) @@ | ||
| 220 | * |
|
| 221 | * @return \Response |
|
| 222 | */ |
|
| 223 | public function destroy(Request $request) |
|
| 224 | { |
|
| 225 | try { |
|
| 226 | $ids = $request->input('select'); |
|
| 227 | if (!empty($ids)) { |
|
| 228 | foreach ($ids as $id) { |
|
| 229 | $tax = $this->tax->where('id', $id)->first(); |
|
| 230 | $taxClassId = $tax->tax_classes_id; |
|
| 231 | $taxClass = $this->tax_class->where('id', $taxClassId)->first(); |
|
| 232 | if ($tax) { |
|
| 233 | $taxClass->delete(); |
|
| 234 | $tax->delete(); |
|
| 235 | } else { |
|
| 236 | echo "<div class='alert alert-danger alert-dismissable'> |
|
| 237 | <i class='fa fa-ban'></i> |
|
| 238 | <b>"./* @scrutinizer ignore-type */ \Lang::get('message.alert').'!</b> './* @scrutinizer ignore-type */ \Lang::get('message.failed').' |
|
| 239 | <button type=button class=close data-dismiss=alert aria-hidden=true>×</button> |
|
| 240 | './* @scrutinizer ignore-type */\Lang::get('message.no-record').' |
|
| 241 | </div>'; |
|
| 242 | //echo \Lang::get('message.no-record') . ' [id=>' . $id . ']'; |
|
| 243 | } |
|
| 244 | } |
|
| 245 | echo "<div class='alert alert-success alert-dismissable'> |
|
| 246 | <i class='fa fa-ban'></i> |
|
| 247 | <b>"./* @scrutinizer ignore-type */\Lang::get('message.alert').'!</b> '. |
|
| 248 | /* @scrutinizer ignore-type */ \Lang::get('message.success').' |
|
| 249 | <button type=button class=close data-dismiss=alert aria-hidden=true>×</button> |
|
| 250 | './* @scrutinizer ignore-type */\Lang::get('message.deleted-successfully').' |
|
| 251 | </div>'; |
|
| 252 | } else { |
|
| 253 | echo "<div class='alert alert-danger alert-dismissable'> |
|
| 254 | <i class='fa fa-ban'></i> |
|
| 255 | <b>"./* @scrutinizer ignore-type */\Lang::get('message.alert').'!</b> '. |
|
| 256 | /* @scrutinizer ignore-type */ \Lang::get('message.failed').' |
|
| 257 | <button type=button class=close data-dismiss=alert aria-hidden=true>×</button> |
|
| 258 | './* @scrutinizer ignore-type */ \Lang::get('message.select-a-row').' |
|
| 259 | </div>'; |
|
| 260 | //echo \Lang::get('message.select-a-row'); |
|
| 261 | } |
|
| 262 | } catch (\Exception $e) { |
|
| 263 | echo "<div class='alert alert-danger alert-dismissable'> |
|
| 264 | <i class='fa fa-ban'></i> |
|
| 265 | <b>"./* @scrutinizer ignore-type */\Lang::get('message.alert').'!</b> '. |
|
| 266 | /* @scrutinizer ignore-type */\Lang::get('message.failed').' |
|
| 267 | <button type=button class=close data-dismiss=alert aria-hidden=true>×</button> |
|
| 268 | '.$e->getMessage().' |
|
| 269 | </div>'; |
|
| 270 | } |
|
| 271 | } |
|
| 272 | ||
| 273 | /** |
|
| 274 | * @param Request $request |
|