progress indicators, bug fixes, after a while
This commit is contained in:
@@ -8,6 +8,7 @@ use Session;
|
||||
use Illuminate\Support\Arr;
|
||||
// use App\Http\Requests;
|
||||
use App\Http\Requests;
|
||||
use App\Jobs\NewMnoNotesEmailAlerts;
|
||||
// use Illuminate\Http\Request as Requests;
|
||||
|
||||
|
||||
@@ -175,6 +176,7 @@ class NetworkOperatorsController extends Controller
|
||||
$ip_addresses = Models\Mnoips::where('mno_id', $id)->get();
|
||||
$show_notes = Models\Mnonote::where('mno_id', $id)->get();
|
||||
$showdocuments = Models\MnoFile::where('mno_id', $id)->get();
|
||||
$recent_payments = Models\Mnopayment::where('mno_id', $id)->orderBy('id', 'DESC')->get();
|
||||
|
||||
if ($network_arr->support_emails) {
|
||||
$support_emails = json_decode($network_arr->support_emails, true);
|
||||
@@ -253,7 +255,8 @@ class NetworkOperatorsController extends Controller
|
||||
'old_connection_type' => $old_connection_type,
|
||||
'ip_addresses' => $ip_addresses,
|
||||
'recent_payments' => [],
|
||||
'show_notes' => $show_notes
|
||||
'show_notes' => $show_notes,
|
||||
'recent_payments' => $recent_payments
|
||||
];
|
||||
// dd($data);
|
||||
|
||||
@@ -275,6 +278,8 @@ class NetworkOperatorsController extends Controller
|
||||
$connection_types = ['VPN' => 'VPN', 'DIRECT' => 'DIRECT'];
|
||||
$ip_addresses = Models\Mnoips::where('mno_id', $id)->get();
|
||||
$notes_arr = Models\Mnonote::where('mno_id', $id)->get();
|
||||
$recent_payments = Models\Mnopayment::where('mno_id', $id)->orderBy('id', 'DESC')->get();
|
||||
$service_type_names = Models\Service::pluck('name', 'name');
|
||||
//dd($notes_arr); //with('mno_info')->
|
||||
if ($network_arr->support_emails) {
|
||||
$support_emails = json_decode($network_arr->support_emails, true);
|
||||
@@ -351,7 +356,9 @@ class NetworkOperatorsController extends Controller
|
||||
'connection_types' => $connection_types,
|
||||
'old_connection_type' => $old_connection_type,
|
||||
'ip_addresses' => $ip_addresses,
|
||||
'notes_arr' => $notes_arr
|
||||
'notes_arr' => $notes_arr,
|
||||
'recent_payments' => $recent_payments,
|
||||
'service_type_names' => $service_type_names
|
||||
];
|
||||
return view('network_ops.edit', $data);
|
||||
}
|
||||
@@ -494,8 +501,9 @@ class NetworkOperatorsController extends Controller
|
||||
$result = Models\Mnonote::create($notes_arr);
|
||||
|
||||
$notes = Models\Mnonote::with('mno_info', 'created_by_info')->find($result->id);
|
||||
|
||||
//todo : send emails
|
||||
//dispatch(new SendNewNotesEmailAlert($notes));
|
||||
dispatch(new NewMnoNotesEmailAlerts($notes));
|
||||
|
||||
if ($result) {
|
||||
$data = ['code' => 1, 'msg' => 'Notes successfully added'];
|
||||
@@ -529,6 +537,83 @@ class NetworkOperatorsController extends Controller
|
||||
}
|
||||
|
||||
}
|
||||
public function getSinglePayment($id)
|
||||
{
|
||||
$payment = Models\MnoPayment::find($id);
|
||||
if ($payment) {
|
||||
$services_arr = explode(',', $payment->services);
|
||||
|
||||
return response()->json([ 'code' => 1, 'result' => $payment, 'services_arr' => $services_arr]);
|
||||
}
|
||||
else{
|
||||
return response()->json([ 'code' => 3, 'msg' => 'Request could not be handled at this time']);
|
||||
}
|
||||
|
||||
}
|
||||
public function financeStore(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'mno_id' => 'required',
|
||||
'services' => 'required',
|
||||
'invoice_number' => 'required',
|
||||
'invoice_amount' => 'required|numeric',
|
||||
'invoice_date' => 'required',
|
||||
'invoice_status' => 'required'
|
||||
]);
|
||||
$auth_user = session('current_user');
|
||||
|
||||
|
||||
$finance_arr = [
|
||||
'invoice_number' => $request->invoice_number,
|
||||
'invoice_amount' => $request->invoice_amount,
|
||||
'invoice_date' => $request->invoice_date,
|
||||
'invoice_status' => $request->invoice_status,
|
||||
'services' => implode(',', $request->services),
|
||||
'user_id' => $auth_user['id'],
|
||||
'mno_id' => $request->mno_id
|
||||
];
|
||||
if ($request->has('remarks')) {
|
||||
$finance_arr['remarks'] = $request->remarks;
|
||||
}
|
||||
|
||||
$result = Models\Mnopayment::create($finance_arr);
|
||||
if ($result) {
|
||||
$data = ['code' => 1, 'msg' => 'Payment Details successfully added'];
|
||||
}
|
||||
else{
|
||||
$data = ['code' => 3, 'msg' => 'Your request could not be handled at this time'];
|
||||
}
|
||||
return response()->json($data, 200);
|
||||
}
|
||||
public function financeUpdate(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'payment_id' => 'required',
|
||||
'mno_id' => 'required',
|
||||
'services' => 'required',
|
||||
'invoice_number' => 'required',
|
||||
'invoice_amount' => 'required|numeric',
|
||||
'invoice_date' => 'required',
|
||||
'invoice_status' => 'required'
|
||||
]);
|
||||
$auth_user = session('current_user');
|
||||
$payment = Models\Mnopayment::findOrFail($request->payment_id);
|
||||
|
||||
$payment->invoice_number = $request->invoice_number;
|
||||
$payment->invoice_amount = $request->invoice_amount;
|
||||
$payment->invoice_date = $request->invoice_date;
|
||||
$payment->invoice_status = $request->invoice_status;
|
||||
$payment->services = implode(',', $request->services);
|
||||
$result = $payment->save();
|
||||
|
||||
if ($result) {
|
||||
$data = ['code' => 1, 'msg' => 'Payment Details successfully updated'];
|
||||
}
|
||||
else{
|
||||
$data = ['code' => 3, 'msg' => 'Your request could not be handled at this time'];
|
||||
}
|
||||
return response()->json($data, 200);
|
||||
}
|
||||
public function notesUpdate(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
@@ -562,6 +647,29 @@ class NetworkOperatorsController extends Controller
|
||||
}
|
||||
return response()->json($data, 200);
|
||||
}
|
||||
public function getMnoFile($id)
|
||||
{
|
||||
$mno_file = Models\MnoFile::with('mno_info')->findOrFail($id);
|
||||
|
||||
|
||||
$file = public_path('documents/mno_files/') . $mno_file->file_path;
|
||||
$headers = []; //['Content-Type: application/pdf'];
|
||||
$filename = $mno_file->name . "_" . $mno_file->name;
|
||||
$filename = $this->cleanStr($filename);
|
||||
$filename = $filename . "." . $mno_file->file_extension;
|
||||
return \Response::download($file, $filename, $headers);
|
||||
}
|
||||
public function cleanStr($string){
|
||||
// Replaces all spaces with hyphens.
|
||||
$string = str_replace(' ', '-', $string);
|
||||
|
||||
// Removes special chars.
|
||||
$string = preg_replace('/[^A-Za-z0-9\-]/', '', $string);
|
||||
// Replaces multiple hyphens with single one.
|
||||
$string = preg_replace('/-+/', '_', $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
public function destroy($id)
|
||||
{
|
||||
$result = Models\NetworkOps::destroy($id);
|
||||
|
||||
Reference in New Issue
Block a user