added sender ID to the clients Tab in Show view plus bug fixes
This commit is contained in:
@@ -42,23 +42,23 @@ class SenderIdController extends Controller
|
||||
->whereRaw("sender_ids.senderid LIKE '%$keyword%' OR sender_ids.status LIKE '%$keyword%' OR network_operators.name LIKE '%$keyword%' OR network_operators.country LIKE '%$keyword%' OR staffcreate.name LIKE '%$keyword%' OR staffmodify.name LIKE '%$keyword%' OR clients.name LIKE '%$keyword%'")
|
||||
->orderBy('sender_ids.senderid', 'ASC')
|
||||
->paginate(15);
|
||||
}
|
||||
}
|
||||
return response()->json($senderid_arr);
|
||||
}
|
||||
public function create()
|
||||
{
|
||||
#$network_arr = Models\NetworkOps::pluck('name','country');
|
||||
|
||||
|
||||
$networks = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS network'))->orderBy('network')->get()->toArray();
|
||||
$network_arr = array_pluck($networks, 'network', 'id');
|
||||
// dd($network_arr);
|
||||
#$network_arr = array_combine($network_arr, $network_arr);
|
||||
|
||||
|
||||
|
||||
$clients = Models\Client::pluck('name', 'id');
|
||||
$staffmembers = Models\StaffMember::pluck('name', 'id');
|
||||
$status = ['Pending' => 'Pending', 'Inactive' => 'Inactive', 'Approved' => 'Approved'];
|
||||
|
||||
|
||||
$data = [
|
||||
'page_title' => 'Create Sender ID',
|
||||
'network_arr' => $network_arr,
|
||||
@@ -87,14 +87,14 @@ class SenderIdController extends Controller
|
||||
$senderid_arr['created_by'] = session('current_user.id');
|
||||
$senderid_arr['last_modified_by'] = session('current_user.id');
|
||||
$senderid_arr['remarks'] = $request->remarks ?? '';
|
||||
|
||||
|
||||
|
||||
$result = Models\SenderId::create($senderid_arr);
|
||||
|
||||
|
||||
|
||||
|
||||
#save services this has been moved to the main client table
|
||||
//$retval = $this->store_services($request->services, $result->id);
|
||||
|
||||
|
||||
Session::flash('success_message', 'Sender ID successfully added');
|
||||
return redirect(url('senderids'));
|
||||
}
|
||||
@@ -104,12 +104,12 @@ class SenderIdController extends Controller
|
||||
|
||||
$networks = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS network'))->orderBy('network')->get()->toArray();
|
||||
$network_arr = array_pluck($networks, 'network', 'id');
|
||||
|
||||
|
||||
|
||||
$clients = Models\Client::pluck('name', 'id');
|
||||
$staffmembers = Models\StaffMember::pluck('name', 'id');
|
||||
$status = ['Pending' => 'Pending', 'Inactive' => 'Inactive', 'Approved' => 'Approved'];
|
||||
|
||||
|
||||
|
||||
$data = [
|
||||
'page_title' => 'Create Sender ID',
|
||||
@@ -131,9 +131,9 @@ class SenderIdController extends Controller
|
||||
'status' => 'required',
|
||||
'remarks' => 'sometimes',
|
||||
]);
|
||||
|
||||
|
||||
$senderid = Models\SenderId::findOrFail($id);
|
||||
|
||||
|
||||
$senderid->senderid = $request->senderid;
|
||||
$senderid->client_id = $request->client_id;
|
||||
$senderid->status = $request->status;
|
||||
@@ -145,4 +145,28 @@ class SenderIdController extends Controller
|
||||
Session::flash('success_message', 'Sender ID successfully Updated');
|
||||
return redirect(url('senderids'));
|
||||
}
|
||||
public function direct_store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'senderid' => 'required|max:11',
|
||||
'network_id' => 'required',
|
||||
'status' => 'required',
|
||||
'remarks' => 'sometimes',
|
||||
]);
|
||||
$senderid_arr = $request->except('_token');
|
||||
$senderid_arr['created_by'] = session('current_user.id');
|
||||
$senderid_arr['last_modified_by'] = session('current_user.id');
|
||||
$senderid_arr['remarks'] = $request->remarks ?? '';
|
||||
|
||||
|
||||
$result = Models\SenderId::create($senderid_arr);
|
||||
|
||||
|
||||
if($result){
|
||||
return response()->json([ 'code' => 1, 'result' => 'success']);
|
||||
}
|
||||
else {
|
||||
return response()->json([ 'code' => 3, 'msg' => 'Request could not be handled at this time']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user