staff, mno, clients, bug fixes
This commit is contained in:
@@ -9,6 +9,7 @@ use Illuminate\Support\Arr;
|
||||
use App\Jobs\SendNewUssdClientEmail;
|
||||
use App\Jobs\SendUssdClientActiveEmail;
|
||||
use App\Jobs\SendNewNotesEmailAlert;
|
||||
use App\Http\Requests;
|
||||
|
||||
|
||||
class ClientsController extends Controller
|
||||
@@ -22,7 +23,7 @@ class ClientsController extends Controller
|
||||
{
|
||||
|
||||
$client_arr = new Models\Client;
|
||||
$client_arr = $client_arr->with('auth_user_info','country_info', 'created_by_info')->orderBy('name', 'ASC')->paginate(10);
|
||||
$client_arr = $client_arr->with('auth_user_info','country_info', 'created_by_info')->orderBy('name', 'ASC')->paginate(15);
|
||||
//dd($client_arr);
|
||||
$data = [
|
||||
'page_title' => 'Clients',
|
||||
@@ -93,48 +94,7 @@ class ClientsController extends Controller
|
||||
}
|
||||
return response()->json($client_arr);
|
||||
}
|
||||
public function indexOriginal()
|
||||
{
|
||||
|
||||
$client_arr = new Models\Client;
|
||||
$table_columns = \DB::select(\DB::raw("show full columns from clients"));
|
||||
$exclude_arr = [
|
||||
'updated_at', 'id', 'auth_user_id', 'pay_mode', 'type', 'created_at', 'currency'
|
||||
];
|
||||
$columns = [];
|
||||
$queries = [];
|
||||
foreach ($table_columns as $key) {
|
||||
$columns[$key->Field] = $key->Field;
|
||||
}
|
||||
foreach ($columns as $col) {
|
||||
if (request('filter') == $col) {
|
||||
$filter = request('filter');
|
||||
$keyword = request('keyword');
|
||||
$table_arr = ['staff_id', 'pay_mode'];
|
||||
// dump($col);
|
||||
// dump(in_array($col, $table_arr));
|
||||
if (in_array($col, $table_arr)) {
|
||||
$key = $this->get_filter_ids($filter, $keyword);
|
||||
if (!empty($key)) {
|
||||
$keyword = $key;
|
||||
}
|
||||
}
|
||||
$client_arr = $client_arr->where($col, 'like', '%'.$keyword.'%');
|
||||
$queries[$col] = request('keyword');
|
||||
}
|
||||
}
|
||||
|
||||
$client_arr = $client_arr->with('payment_type_info', 'service_info', 'auth_user_info', 'created_by_info')->orderBy('name', 'ASC')->paginate(10)->appends($queries);
|
||||
$columns = Arr::except($columns, $exclude_arr);
|
||||
$columns['pay_mode'] = 'Payment Mode';
|
||||
$data = [
|
||||
'page_title' => 'Clients',
|
||||
'columns' => $columns,
|
||||
'client_arr' => $client_arr,
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
return view('client.index', $data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
@@ -243,8 +203,6 @@ class ClientsController extends Controller
|
||||
'notes_body' => 'required'
|
||||
]);
|
||||
$auth_user = session('current_user');
|
||||
|
||||
// dd($request->all());
|
||||
//'email' => 'unique:users,email_address'
|
||||
$notes_arr = [
|
||||
'notes_body' => $request->notes_body,
|
||||
@@ -278,14 +236,13 @@ class ClientsController extends Controller
|
||||
'client_id' => 'required',
|
||||
'services' => 'required',
|
||||
'invoice_number' => 'required',
|
||||
'invoice_amount' => 'required',
|
||||
'invoice_amount' => 'required|numeric',
|
||||
'invoice_date' => 'required',
|
||||
'invoice_status' => 'required'
|
||||
]);
|
||||
$auth_user = session('current_user');
|
||||
|
||||
// dd($request->all());
|
||||
//'email' => 'unique:users,email_address'
|
||||
//dd($request->all());
|
||||
$finance_arr = [
|
||||
'invoice_number' => $request->invoice_number,
|
||||
'invoice_amount' => $request->invoice_amount,
|
||||
@@ -323,11 +280,15 @@ class ClientsController extends Controller
|
||||
'launch_date' => 'required'
|
||||
]);
|
||||
$auth_user = session('current_user');
|
||||
|
||||
$network = Models\NetworkOps::find($request->network);
|
||||
// dump($network);
|
||||
// dd($request->all());
|
||||
|
||||
$shortcode_arr = [
|
||||
'name' => $request->name,
|
||||
'client_id' => $request->client_id,
|
||||
'network' => $request->network,
|
||||
'network' => $network->name,
|
||||
'country' => $network->country,
|
||||
'shortcode' => $request->shortcode,
|
||||
'code_type' => $request->code_type,
|
||||
'toll_free' => $request->toll_free,
|
||||
@@ -356,7 +317,7 @@ class ClientsController extends Controller
|
||||
'client_id' => 'required',
|
||||
'services' => 'required',
|
||||
'invoice_number' => 'required',
|
||||
'invoice_amount' => 'required',
|
||||
'invoice_amount' => 'required|numeric',
|
||||
'invoice_date' => 'required',
|
||||
'invoice_status' => 'required'
|
||||
]);
|
||||
@@ -395,7 +356,6 @@ class ClientsController extends Controller
|
||||
}
|
||||
return response()->json($data, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
@@ -417,8 +377,98 @@ class ClientsController extends Controller
|
||||
$ussd_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'ussd')->get();
|
||||
$recent_payments = Models\ClientPayment::where('client_id', $id)->orderBy('id', 'DESC')->get();
|
||||
$countries = Models\Country::pluck('en_short_name','en_short_name');
|
||||
$networks = Models\NetworkOps::pluck('name', 'name');
|
||||
$networks = Models\NetworkOps::pluck('name', 'id');
|
||||
|
||||
$showdocuments = Models\ClientFile::where('client_id', $id)->get();
|
||||
if ($showclient->status == 'Live') {
|
||||
$status_bg = "info";
|
||||
}
|
||||
elseif ($showclient->status == 'Prospective') {
|
||||
$status_bg = "warning";
|
||||
}
|
||||
else{
|
||||
$status_bg = "danger";
|
||||
}
|
||||
|
||||
$renewal_due = 'N/A';
|
||||
$highlight_colour = 'none';
|
||||
//review this later
|
||||
if ($showclient->contract_validity == null || $showclient->contract_validity == '') {
|
||||
$renewal_due = "N/A";
|
||||
}
|
||||
else{
|
||||
$current_date = date_create(date('Y-m-d'));
|
||||
|
||||
$expiry_date = date_create($showclient->contract_validity);
|
||||
|
||||
$diff = date_diff($current_date, $expiry_date);
|
||||
|
||||
$polar = $diff->format("%R");
|
||||
|
||||
$months = $diff->format("%m");
|
||||
|
||||
$days = $diff->format("%a");
|
||||
if ($days < 31) {
|
||||
if ($polar == '-') {
|
||||
$highlight_colour = 'warning';
|
||||
$renewal_due = "Contract expired $days days(s) ago";
|
||||
}
|
||||
else{
|
||||
$renewal_due = "In $days day(s)" ;
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
if ($polar == '-') {
|
||||
$highlight_colour = 'warning';
|
||||
$renewal_due = "Contract expired $months month(s) ago";
|
||||
|
||||
}
|
||||
else{
|
||||
$renewal_due = "In $months months";
|
||||
}
|
||||
}
|
||||
}
|
||||
$data = [
|
||||
'page_title' => 'Client Profile',
|
||||
'showclient' => $showclient,
|
||||
'show_services' => $show_services,
|
||||
'service_type' => $service_type,
|
||||
'service_type_names' => $service_type_names,
|
||||
'show_notes' => $show_notes,
|
||||
'status_bg' => $status_bg,
|
||||
'voice_codes' => $voice_codes,
|
||||
'sms_codes' => $sms_codes,
|
||||
'ussd_codes' => $ussd_codes,
|
||||
'countries' => $countries,
|
||||
'networks' => $networks,
|
||||
'renewal_due' => $renewal_due,
|
||||
'recent_payments' => $recent_payments,
|
||||
'highlight_colour' => $highlight_colour,
|
||||
'showdocuments' => $showdocuments
|
||||
];
|
||||
|
||||
return view('client.show', $data);
|
||||
}
|
||||
public function showReadonly($id)
|
||||
{
|
||||
//with('short_code_info')->
|
||||
$showclient = Models\Client::with('service_info', 'country_info', 'auth_user_info', 'short_code_info')->find($id);
|
||||
$service_type = Models\Service::pluck('name', 'id');
|
||||
$service_type_names = Models\Service::pluck('name', 'name');
|
||||
$show_services = Models\ClientCategory::where('client_id', $id)->get();
|
||||
|
||||
//->where('highlight', 'NO')
|
||||
$show_notes = Models\ClientNote::with('created_by_info', 'client_info')->where('client_id', $id)->orderBy('id', 'DESC')->get()->take(20);
|
||||
$voice_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'voice')->get();
|
||||
$sms_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'sms')->get();
|
||||
$ussd_codes = Models\ClientShortCode::where('client_id', $id)->where('code_type', 'ussd')->get();
|
||||
$recent_payments = Models\ClientPayment::where('client_id', $id)->orderBy('id', 'DESC')->get();
|
||||
$countries = Models\Country::pluck('en_short_name','en_short_name');
|
||||
$networks = Models\NetworkOps::pluck('name', 'name');
|
||||
$all_shortcodes = Models\ClientShortCode::with('client_info', 'client_info', 'update_info')->where('client_id', $id)->orderBy('code_type', 'ASC')->get();
|
||||
$showdocuments = Models\ClientFile::where('client_id', $id)->get();
|
||||
|
||||
if ($showclient->status == 'Live') {
|
||||
$status_bg = "info";
|
||||
}
|
||||
@@ -485,9 +535,11 @@ class ClientsController extends Controller
|
||||
'networks' => $networks,
|
||||
'renewal_due' => $renewal_due,
|
||||
'recent_payments' => $recent_payments,
|
||||
'highlight_colour' => $highlight_colour
|
||||
'highlight_colour' => $highlight_colour,
|
||||
'all_shortcodes' => $all_shortcodes,
|
||||
'showdocuments' => $showdocuments
|
||||
];
|
||||
return view('client.show', $data);
|
||||
return view('client.show-readonly', $data);
|
||||
}
|
||||
public function showservices($id)
|
||||
{
|
||||
@@ -560,7 +612,7 @@ class ClientsController extends Controller
|
||||
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective'];
|
||||
$currency = Models\Currency::pluck('name', 'name'); //
|
||||
|
||||
$company_types = ['Aggregator/Supplier' => 'Aggregator/Supplier', 'Enterprise' => 'Enterprise', 'Hybrid' => 'Hybrid'];
|
||||
$company_types = ['Aggregator/Supplier' => 'Aggregator/Supplier', 'Enterprise' => 'Enterprise'];
|
||||
$auth_users = Models\Account::pluck('name', 'id');
|
||||
$industries = Models\Industry::orderBy('name', 'ASC')->pluck('name', 'name');
|
||||
$message_types_arr = ['International' => 'International', 'Local' => 'Local'];
|
||||
@@ -642,7 +694,7 @@ class ClientsController extends Controller
|
||||
$status_bg = "danger";
|
||||
}
|
||||
|
||||
$contract_types = ['bilateral' => 'bilateral', 'unilateral' => 'unilateral'];
|
||||
$contract_types = ['Bilateral' => 'Bilateral', 'Unilateral' => 'Unilateral'];
|
||||
$connections = ['SMPP' => 'SMPP', 'HTTP' => 'HTTP'];
|
||||
|
||||
|
||||
@@ -689,9 +741,10 @@ class ClientsController extends Controller
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
public function update(Requests\UpdateClientRequest $request, $id)
|
||||
{
|
||||
//Todo : work on the services and the sender IDs
|
||||
/*
|
||||
$request->validate([
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
@@ -700,9 +753,53 @@ class ClientsController extends Controller
|
||||
'currency' => 'required',
|
||||
'auth_user_id' => 'required'
|
||||
]);
|
||||
*/
|
||||
$client_update = Models\Client::find($id);
|
||||
|
||||
// dd($request->support_emails);
|
||||
if ($request->has('document_one') && $request->has('document_one_name')) {
|
||||
if ($request->file('document_one')->isValid()) {
|
||||
$filename = "erp_" . time() . str_random(6) . "." . $request->document_one->extension();
|
||||
$request->document_one->storeAs('client_files', $filename, 'public');
|
||||
$document_arr['file_path'] = $filename;
|
||||
$client_update->name = $request->name;
|
||||
|
||||
$document_arr['file_extension'] = $request->document_one->extension();
|
||||
$document_arr['file_reff'] = time() . uniqid();
|
||||
$document_arr['name'] = $request->document_one_name;
|
||||
$document_arr['created_by'] = session('current_user.id');
|
||||
$document_arr['client_id'] = $id;
|
||||
$result = Models\ClientFile::create($document_arr);
|
||||
}
|
||||
}
|
||||
if ($request->has('document_two') && $request->has('document_two_name')) {
|
||||
if ($request->file('document_two')->isValid()) {
|
||||
$filename = "erp_" . time() . str_random(6) . "." . $request->document_two->extension();
|
||||
$request->document_two->storeAs('client_files', $filename, 'public');
|
||||
$document_arr['file_path'] = $filename;
|
||||
$client_update->name = $request->name;
|
||||
|
||||
$document_arr['file_extension'] = $request->document_two->extension();
|
||||
$document_arr['file_reff'] = time() . uniqid();
|
||||
$document_arr['name'] = $request->document_two_name;
|
||||
$document_arr['created_by'] = session('current_user.id');
|
||||
$document_arr['client_id'] = $id;
|
||||
$result = Models\ClientFile::create($document_arr);
|
||||
}
|
||||
}
|
||||
if ($request->has('document_three') && $request->has('document_three_name')) {
|
||||
if ($request->file('document_three')->isValid()) {
|
||||
$filename = "erp_" . time() . str_random(6) . "." . $request->document_three->extension();
|
||||
$request->document_three->storeAs('client_files', $filename, 'public');
|
||||
$document_arr['file_path'] = $filename;
|
||||
$client_update->name = $request->name;
|
||||
|
||||
$document_arr['file_extension'] = $request->document_three->extension();
|
||||
$document_arr['file_reff'] = time() . uniqid();
|
||||
$document_arr['name'] = $request->document_three_name;
|
||||
$document_arr['created_by'] = session('current_user.id');
|
||||
$document_arr['client_id'] = $id;
|
||||
$result = Models\ClientFile::create($document_arr);
|
||||
}
|
||||
}
|
||||
|
||||
$client_update->name = $request->name;
|
||||
$client_update->email = $request->email;
|
||||
@@ -772,9 +869,6 @@ class ClientsController extends Controller
|
||||
}
|
||||
$retval = $this->update_services($request->services, $client_update->id);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Session::flash('success_message', 'Client successfully Updated');
|
||||
return redirect(url('clients', $id));
|
||||
}
|
||||
@@ -819,79 +913,54 @@ class ClientsController extends Controller
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function get_filter_ids($filter, $keyword)
|
||||
public function storeFiles(AddFilesRequest $request)
|
||||
{
|
||||
switch ($filter) {
|
||||
case 'status':
|
||||
$id = Models\Client::where('status', 'like', "%$keyword%")->get(['id']);
|
||||
if ($id->isEmpty()) {
|
||||
return '';
|
||||
}
|
||||
$step = json_decode($id);
|
||||
$the_id = $step[0]->id;
|
||||
return (count($step) > 0 ) ? $step[0]->id : "";
|
||||
break;
|
||||
case 'type':
|
||||
$id = Models\Client::where('type', 'like', "%$keyword%")->get(['id']);
|
||||
if ($id->isEmpty()) {
|
||||
return '';
|
||||
}
|
||||
$step = json_decode($id);
|
||||
$the_id = $step[0]->id;
|
||||
return (count($step) > 0 ) ? $step[0]->id : "";
|
||||
break;
|
||||
case 'country':
|
||||
$id = Models\Country::where('alpha_2_code', 'like', "%$keyword%")->orWhere('alpha_3_code', 'like', "%$keyword%")->orWhere('en_short_name', 'like', "%$keyword%")->get(['id']);
|
||||
if ($id->isEmpty()) {
|
||||
return '';
|
||||
}
|
||||
$step = json_decode($id);
|
||||
$the_id = $step[0]->id;
|
||||
return (count($step) > 0 ) ? $step[0]->id : "";
|
||||
break;
|
||||
case 'currency':
|
||||
$id = Models\Client::where('currency', 'like', "%$keyword%")->get(['id']);
|
||||
if ($id->isEmpty()) {
|
||||
return '';
|
||||
}
|
||||
$step = json_decode($id);
|
||||
$the_id = $step[0]->id;
|
||||
return (count($step) > 0 ) ? $step[0]->id : "";
|
||||
break;
|
||||
case 'auth_user_id':
|
||||
$id = Models\SystemUser::where('name', 'like', "%$keyword%")->get(['id']);
|
||||
if ($id->isEmpty()) {
|
||||
return '';
|
||||
}
|
||||
$step = json_decode($id);
|
||||
$the_id = $step[0]->id;
|
||||
return (count($step) > 0 ) ? $step[0]->id : "";
|
||||
break;
|
||||
case 'name':
|
||||
// $this->log_query();
|
||||
$id = Models\Client::where('name', 'like', "%$keyword%")->get(['id']);
|
||||
if ($id->isEmpty()) {
|
||||
return '';
|
||||
}
|
||||
$step = json_decode($id);
|
||||
return (count($step) > 0 ) ? $step[0]->id : "";
|
||||
break;
|
||||
case 'pay_mode':
|
||||
// $this->log_query();
|
||||
$id = Models\PaymentType::where('name', 'like', "%$keyword%")->get(['id']);
|
||||
if ($id->isEmpty()) {
|
||||
return '';
|
||||
}
|
||||
$step = json_decode($id);
|
||||
return (count($step) > 0 ) ? $step[0]->id : "";
|
||||
break;
|
||||
default:
|
||||
return '';
|
||||
break;
|
||||
$document_arr = $request->except('document');
|
||||
if ($request->hasFile('document')) {
|
||||
if ($request->file('document')->isValid()) {
|
||||
$filename = "erp_" . time() . "." . $request->document->extension();
|
||||
$request->document->storeAs('client_files', $filename, 'public');
|
||||
$document_arr['document'] = json_encode([$filename]);
|
||||
}
|
||||
}
|
||||
$document_arr['file_extension'] = $request->document->extension();
|
||||
$document_arr['file_reff'] = time() . uniqid();
|
||||
$document_arr['last_modified_by'] = session('current_user.id');
|
||||
|
||||
$result = Models\ClientFile::create($document_arr);
|
||||
|
||||
if ($result) {
|
||||
$data = ['code' => 1, 'msg' => 'Document successfully uploaded'];
|
||||
}
|
||||
else{
|
||||
$data = ['code' => 3, 'msg' => 'Your request could not be handled at this time'];
|
||||
}
|
||||
return response()->json($data, 200);
|
||||
|
||||
}
|
||||
public function getClientFile($id)
|
||||
{
|
||||
$client_file = Models\ClientFile::with('client_info')->findOrFail($id);
|
||||
//PDF file is stored under project/public/download/info.pdf
|
||||
$file = public_path('documents/client_files/') . $client_file->file_path;
|
||||
|
||||
$headers = []; //['Content-Type: application/pdf'];
|
||||
$filename = $client_file->client_info->name . "_" . $client_file->name;
|
||||
$filename = $this->cleanStr($filename);
|
||||
$filename = $filename . "." . $client_file->file_extension;
|
||||
|
||||
// $filename = str_replace(' ', '_', $filename);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class NetworkOperatorsController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
public function indexBAK()
|
||||
{
|
||||
$network_operators = new Models\NetworkOps;
|
||||
$table_columns = \DB::select(\DB::raw("show full columns from network_operators"));
|
||||
@@ -52,6 +52,36 @@ class NetworkOperatorsController extends Controller
|
||||
|
||||
return view('network_ops.index', $data);
|
||||
}
|
||||
public function index(){
|
||||
//$mno_arr = Models\NetworkOps::get();
|
||||
$data = [
|
||||
'page_title' => 'Mobile Network Operators',
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
return view('network_ops.index', $data);
|
||||
}
|
||||
public function getMnosJson(Request $request)
|
||||
{
|
||||
//$this->log_query();
|
||||
$mno_arr = \DB::table('network_operators')
|
||||
->join('staff_members AS staffam', 'staffam.id', '=', 'network_operators.account_manager_id')
|
||||
->join('staff_members AS staffmodify', 'staffmodify.id', '=', 'network_operators.last_modified_by')
|
||||
->select('network_operators.id', 'staffam.name AS accountManager', 'network_operators.name AS networkName', 'network_operators.country', 'network_operators.connection_status', 'staffmodify.name AS modifiedBy')
|
||||
->orderBy('network_operators.name', 'ASC')
|
||||
->paginate(15);
|
||||
|
||||
if($request->has('keyword')){
|
||||
$keyword = $request->keyword;
|
||||
$mno_arr = \DB::table('network_operators')
|
||||
->join('staff_members AS staffam', 'staffam.id', '=', 'network_operators.account_manager_id')
|
||||
->join('staff_members AS staffmodify', 'staffmodify.id', '=', 'network_operators.last_modified_by')
|
||||
->select('network_operators.id', 'staffam.name AS accountManager', 'network_operators.name AS networkName', 'network_operators.country', 'network_operators.connection_status', 'staffmodify.name AS modifiedBy')
|
||||
->whereRaw("network_operators.name LIKE '%$keyword%' OR network_operators.connection_status LIKE '%$keyword%' OR network_operators.country LIKE '%$keyword%' OR staffam.name LIKE '%$keyword%' ")
|
||||
->orderBy('network_operators.name', 'ASC')
|
||||
->paginate(15);
|
||||
}
|
||||
return response()->json($mno_arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
@@ -60,12 +90,16 @@ class NetworkOperatorsController extends Controller
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$countries = Models\Country::pluck('en_short_name','alpha_2_code');
|
||||
$countries = Models\Country::pluck('en_short_name','en_short_name');
|
||||
$account_manager = Models\SystemUser::pluck('name', 'id');
|
||||
$services = Models\Service::pluck('name', 'name');
|
||||
$status = ['Active' => 'Active', 'Inactive' => 'Inactive', 'Pending' => 'Pending'];
|
||||
$data = [
|
||||
'page_title' => 'Create Network Operator',
|
||||
'countries'=> $countries,
|
||||
'account_manager' => $account_manager
|
||||
'account_manager' => $account_manager,
|
||||
'services' => $services,
|
||||
'status' => $status
|
||||
];
|
||||
|
||||
return view('network_ops.create', $data);
|
||||
@@ -83,16 +117,41 @@ class NetworkOperatorsController extends Controller
|
||||
'name' => 'required',
|
||||
'country' => 'required',
|
||||
'account_manager_id' => 'required',
|
||||
'services' => 'required',
|
||||
'contact_person' => 'required',
|
||||
'email' => 'required',
|
||||
'phone' => 'required'
|
||||
]);
|
||||
|
||||
$operator_arr = [
|
||||
'name' => $request->name,
|
||||
'country' => $request->country,
|
||||
'account_manager_id' => $request->account_manager_id
|
||||
'account_manager_id' => $request->account_manager_id,
|
||||
'contact_person' => $request->contact_person,
|
||||
'connection_status' => $request->status,
|
||||
'contact_person_phone' => $request->phone,
|
||||
'contact_person_email' => $request->email,
|
||||
'last_modified_by' => session('current_user.id')
|
||||
];
|
||||
if ($request->has('services')) {
|
||||
$operator_arr['services'] = json_encode($request->services);
|
||||
}
|
||||
if ($request->has('phone')) {
|
||||
$operator_arr['phone'] = $request->phone;
|
||||
}
|
||||
if ($request->has('skype_name')) {
|
||||
$operator_arr['contact_person_skype'] = $request->skype_name;
|
||||
}
|
||||
if ($request->has('linkedin_name')) {
|
||||
$operator_arr['linkedin_name'] = $request->linkedin_name;
|
||||
}
|
||||
if ($request->has('contact_person')) {
|
||||
$operator_arr['contact_person'] = $request->contact_person;
|
||||
}
|
||||
|
||||
$saved = Models\NetworkOps::create($operator_arr);
|
||||
Session::flash('success_message', 'Network Operator successfully added');
|
||||
return redirect(url('network_ops'));
|
||||
return redirect(url('mnos'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,16 +180,76 @@ class NetworkOperatorsController extends Controller
|
||||
public function edit($id)
|
||||
{
|
||||
$network_arr = Models\NetworkOps::findOrFail($id);
|
||||
$countries = Models\Country::pluck('en_short_name','alpha_2_code');
|
||||
$countries = Models\Country::pluck('en_short_name','en_short_name');
|
||||
$account_manager = Models\SystemUser::pluck('name', 'id');
|
||||
$services = Models\Service::pluck('name', 'name');
|
||||
$connection_types = ['VPN' => 'VPN', 'DIRECT' => 'DIRECT'];
|
||||
$ip_addresses = Models\Mnoips::where('mno_id', $id)->get();
|
||||
if ($network_arr->support_emails) {
|
||||
$support_emails = json_decode($network_arr->support_emails, true);
|
||||
$support_emails = array_combine($support_emails, $support_emails);
|
||||
$old_support_emails = json_decode($network_arr->support_emails, true);
|
||||
}
|
||||
else{
|
||||
$support_emails = [];
|
||||
$old_support_emails = [];
|
||||
}
|
||||
if ($network_arr->support_phones) {
|
||||
$support_phones = json_decode($network_arr->support_phones, true);
|
||||
$support_phones = array_combine($support_phones, $support_phones);
|
||||
$old_support_phones = json_decode($network_arr->support_phones, true);
|
||||
}
|
||||
else{
|
||||
$support_phones = [];
|
||||
$old_support_phones = [];
|
||||
}
|
||||
|
||||
if ($network_arr->support_skype) {
|
||||
$support_skype_arr = json_decode($network_arr->support_skype, true);
|
||||
$support_skype_arr = array_combine($support_skype_arr, $support_skype_arr);
|
||||
$old_support_skype_arr = json_decode($network_arr->support_skype, true);
|
||||
}
|
||||
else{
|
||||
$support_skype_arr = [];
|
||||
$old_support_skype_arr = [];
|
||||
}
|
||||
$old_connection_type = [];
|
||||
if ($network_arr->connection_type) {
|
||||
$connection_type = json_decode($network_arr->connection_type, true);
|
||||
$connection_type = array_combine($connection_type, $connection_type);
|
||||
$old_connection_type = json_decode($network_arr->connection_type, true);
|
||||
}
|
||||
else{
|
||||
$old_connection_type = [];
|
||||
}
|
||||
|
||||
if ($network_arr->connection_status == 'Active') {
|
||||
$status_bg = "info";
|
||||
}
|
||||
elseif ($network_arr->connection_status == 'Pending') {
|
||||
$status_bg = "warning";
|
||||
}
|
||||
else{
|
||||
$status_bg = "danger";
|
||||
}
|
||||
$data = [
|
||||
'page_title' => 'Edit Network Operator',
|
||||
'network_arr' => $network_arr,
|
||||
'countries'=> $countries,
|
||||
'account_manager' => $account_manager
|
||||
'account_manager' => $account_manager,
|
||||
'current_services' => json_decode($network_arr->services, true),
|
||||
'services' => $services->toArray(),
|
||||
'support_emails' => $support_emails,
|
||||
'support_skype_arr' => $support_skype_arr,
|
||||
'support_phones' => $support_phones,
|
||||
'old_support_emails' => $old_support_emails,
|
||||
'old_support_skype_arr' => $old_support_skype_arr,
|
||||
'old_support_phones' => $old_support_phones,
|
||||
'status_bg' => $status_bg,
|
||||
'connection_types' => $connection_types,
|
||||
'old_connection_type' => $old_connection_type,
|
||||
'ip_addresses' => $ip_addresses
|
||||
];
|
||||
|
||||
return view('network_ops.edit', $data);
|
||||
}
|
||||
|
||||
@@ -147,18 +266,71 @@ class NetworkOperatorsController extends Controller
|
||||
'name' => 'required',
|
||||
'country' => 'required',
|
||||
'account_manager_id' => 'required',
|
||||
'services' => 'required',
|
||||
'contact_person' => 'required',
|
||||
'contact_person_email' => 'required',
|
||||
'contact_person_phone' => 'required'
|
||||
]);
|
||||
|
||||
|
||||
// dd($request->all());
|
||||
$operator_update = Models\NetworkOps::find($id);
|
||||
$operator_update->name = $request->name;
|
||||
$operator_update->country = $request->country;
|
||||
$operator_update->account_manager_id = $request->account_manager_id;
|
||||
|
||||
|
||||
$operator_update->contact_person_email = $request->contact_person_email;
|
||||
$operator_update->contact_person_phone = $request->contact_person_phone;
|
||||
$operator_update->contact_person = $request->contact_person;
|
||||
$operator_update->connection_status = $request->connection_status ?? "";
|
||||
$operator_update->connection_type = ($request->connection_type) ? json_encode($request->connection_type) : "";
|
||||
|
||||
$operator_update->contact_person_skype = $request->contact_person_skype ?? "";
|
||||
|
||||
#$operator_update->connections = ($request->connections) ? json_encode($request->connections) : "";
|
||||
$operator_update->services = ($request->services) ? json_encode($request->services) : "";
|
||||
$operator_update->support_emails = ($request->support_emails) ? json_encode($request->support_emails) : "";
|
||||
$operator_update->support_phones = ($request->support_phones) ? json_encode($request->support_phones) : "";
|
||||
$operator_update->support_skype = ($request->support_skype) ? json_encode($request->support_skype) : "";
|
||||
|
||||
|
||||
$result = $operator_update->save();
|
||||
|
||||
Session::flash('success_message', 'Network Operator successfully Updated');
|
||||
return redirect(url('network_ops'));
|
||||
return redirect(url('mnos'));
|
||||
}
|
||||
public function ipStore(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'mno_id' => 'required',
|
||||
'ip_address' => 'required|ipv4',
|
||||
'service' => 'required',
|
||||
'port' => 'sometimes|numeric',
|
||||
'status' => 'required'
|
||||
]);
|
||||
$auth_user = session('current_user');
|
||||
|
||||
$addresses_arr = [
|
||||
'ip_address' => $request->ip_address,
|
||||
'mno_id' => $request->mno_id,
|
||||
'service' => $request->service,
|
||||
'port' => $request->port,
|
||||
'status' => $request->status,
|
||||
'created_by' => $auth_user['id'],
|
||||
'last_modified_by' => $auth_user['id']
|
||||
];
|
||||
|
||||
|
||||
$result = Models\Mnoips::create($addresses_arr);
|
||||
|
||||
if ($result) {
|
||||
$data = ['code' => 1, 'msg' => 'IP Address successfully added'];
|
||||
}
|
||||
else{
|
||||
$data = ['code' => 3, 'msg' => 'Your request could not be handled at this time'];
|
||||
}
|
||||
return response()->json($data, 200);
|
||||
}
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
@@ -173,43 +345,6 @@ class NetworkOperatorsController extends Controller
|
||||
return response()->json($result_arr);
|
||||
}
|
||||
Session::flash('success_message', 'Network Operator successfully deleted!');
|
||||
return redirect(route('network_ops.index'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function get_filter_ids($filter, $keyword){
|
||||
switch ($filter) {
|
||||
case 'name':
|
||||
$id = Models\NetworkOps::where('name', 'like', "%$keyword%")->get(['id']);
|
||||
if ($id->isEmpty()) {
|
||||
return '';
|
||||
}
|
||||
$step = json_decode($id);
|
||||
$the_id = $step[0]->id;
|
||||
return (count($step) > 0 ) ? $step[0]->id : "";
|
||||
break;
|
||||
case 'country':
|
||||
$id = Models\Country::where('alpha_2_code', 'like', "%$keyword%")->orWhere('alpha_3_code', 'like', "%$keyword%")->orWhere('en_short_name', 'like', "%$keyword%")->get(['id']);
|
||||
if ($id->isEmpty()) {
|
||||
return '';
|
||||
}
|
||||
$step = json_decode($id);
|
||||
$the_id = $step[0]->id;
|
||||
return (count($step) > 0 ) ? $step[0]->id : "";
|
||||
break;
|
||||
case 'account_manager_id':
|
||||
$id = Models\SyatemUser::where('name', 'like', "%$keyword%")->get(['id']);
|
||||
if ($id->isEmpty()) {
|
||||
return '';
|
||||
}
|
||||
$step = json_decode($id);
|
||||
$the_id = $step[0]->id;
|
||||
return (count($step) > 0 ) ? $step[0]->id : "";
|
||||
break;
|
||||
default:
|
||||
return '';
|
||||
break;
|
||||
}
|
||||
return redirect(route('mnos.index'));
|
||||
}
|
||||
}
|
||||
|
||||
148
app/Http/Controllers/SenderIdController.php
Normal file
148
app/Http/Controllers/SenderIdController.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models;
|
||||
use Session;
|
||||
|
||||
class SenderIdController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$senderid_arr = new Models\SenderId;
|
||||
// $senderid_arr = $senderid_arr->with('modified_by_info', 'network_info', 'created_by_info')->orderBy('senderid', 'ASC')->paginate(15);
|
||||
// dd($senderid_arr);
|
||||
$data = [
|
||||
'page_title' => 'Sender IDs',
|
||||
// 'senderid_arr' => $senderid_arr,
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
return view('senderid.index', $data);
|
||||
}
|
||||
public function getSenderIdsJson(Request $request)
|
||||
{
|
||||
#$this->log_query();
|
||||
$senderid_arr = \DB::table('sender_ids')
|
||||
->join('staff_members AS staffcreate', 'staffcreate.id', '=', 'sender_ids.created_by')
|
||||
->join('staff_members AS staffmodify', 'staffmodify.id', '=', 'sender_ids.last_modified_by')
|
||||
->join('network_operators', 'network_operators.id', '=', 'sender_ids.network_id')
|
||||
->join('clients', 'clients.id', '=', 'sender_ids.client_id')
|
||||
->select('sender_ids.id', 'clients.name AS clientName', 'network_operators.name AS networkName', 'network_operators.country', 'sender_ids.senderid', 'sender_ids.status', 'sender_ids.network_id', 'network_operators.country','sender_ids.remarks', 'staffcreate.name As createdBy', 'staffmodify.name AS modifiedBy')
|
||||
->orderBy('sender_ids.senderid', 'ASC')
|
||||
->paginate(15);
|
||||
|
||||
if($request->has('keyword')){
|
||||
$keyword = $request->keyword;
|
||||
$senderid_arr = \DB::table('sender_ids')
|
||||
->join('staff_members AS staffcreate', 'staffcreate.id', '=', 'sender_ids.created_by')
|
||||
->join('staff_members AS staffmodify', 'staffmodify.id', '=', 'sender_ids.last_modified_by')
|
||||
->join('network_operators', 'network_operators.id', '=', 'sender_ids.network_id')
|
||||
->join('clients', 'clients.id', '=', 'sender_ids.client_id')
|
||||
->select('sender_ids.id', 'clients.name AS clientName', 'network_operators.name AS networkName', 'network_operators.country', 'sender_ids.senderid', 'sender_ids.status', 'sender_ids.network_id', 'network_operators.country','sender_ids.remarks', 'staffcreate.name As createdBy', 'staffmodify.name AS modifiedBy')
|
||||
->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,
|
||||
'status' => $status,
|
||||
'clients' => $clients,
|
||||
'staffmembers' => $staffmembers
|
||||
];
|
||||
|
||||
return view('senderid.create', $data);
|
||||
}
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function 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);
|
||||
|
||||
|
||||
#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'));
|
||||
}
|
||||
public function edit($id){
|
||||
$senderid = Models\SenderId::findOrFail($id);
|
||||
//dd($senderid);
|
||||
|
||||
$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',
|
||||
'network_arr' => $network_arr,
|
||||
'status' => $status,
|
||||
'clients' => $clients,
|
||||
'senderid' => $senderid,
|
||||
'staffmembers' => $staffmembers
|
||||
];
|
||||
|
||||
return view('senderid.edit', $data);
|
||||
}
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
||||
$request->validate([
|
||||
'senderid' => 'required|max:11',
|
||||
'network_id' => 'required',
|
||||
'status' => 'required',
|
||||
'remarks' => 'sometimes',
|
||||
]);
|
||||
|
||||
$senderid = Models\SenderId::findOrFail($id);
|
||||
|
||||
$senderid->senderid = $request->senderid;
|
||||
$senderid->client_id = $request->client_id;
|
||||
$senderid->status = $request->status;
|
||||
$senderid->network_id = $request->network_id;
|
||||
$senderid->remarks = $request->remarks;
|
||||
|
||||
$senderid->save();
|
||||
|
||||
Session::flash('success_message', 'Sender ID successfully Updated');
|
||||
return redirect(url('senderids'));
|
||||
}
|
||||
}
|
||||
141
app/Http/Controllers/StaffMembersController.php
Normal file
141
app/Http/Controllers/StaffMembersController.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models;
|
||||
use Session;
|
||||
|
||||
class StaffMembersController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$staff_members_arr = new Models\StaffMember;
|
||||
$data = [
|
||||
'page_title' => 'Staff Members',
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
return view('staff_members.index', $data);
|
||||
}
|
||||
public function getstaffMemberssJson(Request $request)
|
||||
{
|
||||
#$this->log_query();
|
||||
$staff_members_arr = \DB::table('staff_members')
|
||||
->join('departments', 'departments.id', '=', 'staff_members.department_id')
|
||||
->join('auth_users AS staffcreate', 'staffcreate.id', '=', 'staff_members.created_by')
|
||||
->join('auth_users AS staffmodify', 'staffmodify.id', '=', 'staff_members.modified_by')
|
||||
->select('staff_members.id', 'staffcreate.name AS createdBy', 'staff_members.name','staff_members.phone', 'staffmodify.name AS modifiedBy', 'departments.name AS deptName', 'staff_members.gender', 'staff_members.profile_pic', 'staff_members.email', 'staff_members.personal_email', 'staff_members.staff_number', 'staff_members.staff_number', 'staff_members.status', 'staff_members.location_country', 'staff_members.hire_date')
|
||||
->orderBy('staff_members.name', 'ASC')
|
||||
->paginate(10);
|
||||
|
||||
if($request->has('keyword')){
|
||||
$keyword = $request->keyword;
|
||||
$staff_members_arr = \DB::table('staff_members')
|
||||
->join('departments', 'departments.id', '=', 'staff_members.department_id')
|
||||
->join('auth_users AS staffcreate', 'staffcreate.id', '=', 'staff_members.created_by')
|
||||
->join('auth_users AS staffmodify', 'staffmodify.id', '=', 'staff_members.modified_by')
|
||||
->select('staff_members.id', 'staffcreate.name AS createdBy','staff_members.name', 'staff_members.phone', 'staffmodify.name AS modifiedBy', 'departments.name AS deptName', 'staff_members.gender', 'staff_members.profile_pic', 'staff_members.email', 'staff_members.personal_email', 'staff_members.staff_number', 'staff_members.status', 'staff_members.location_country', 'staff_members.hire_date')
|
||||
->whereRaw("staffcreate.name LIKE '%$keyword%' OR staffmodify.name LIKE '%$keyword%' OR staff_members.name LIKE '%$keyword%' OR departments.name LIKE '%$keyword%' OR staff_members.gender LIKE '%$keyword%' OR staff_members.email LIKE '%$keyword%' OR staff_members.personal_email LIKE '%$keyword%' OR staff_members.staff_number LIKE '%$keyword%' OR 'staff_members.staff_number' LIKE '%$keyword%' OR 'staff_members.location_country' LIKE '%$keyword%' OR 'staff_members.hire_date' LIKE '%$keyword%'")
|
||||
->orderBy('staff_members.name', 'ASC')
|
||||
->paginate(10);
|
||||
}
|
||||
return response()->json($staff_members_arr);
|
||||
}
|
||||
public function create()
|
||||
{
|
||||
$countries = Models\Country::pluck('en_short_name','en_short_name');
|
||||
$departments = Models\Department::pluck('name', 'id');
|
||||
$status = ['Inactive' => 'Inactive', 'Active' => 'Active', 'Pending Confirmation' => 'Pending Confirmation'];
|
||||
$gender_arr = ['Female' => 'Female', 'Male' => 'Male'];
|
||||
$data = [
|
||||
'page_title' => 'Add Staff Member',
|
||||
'countries' => $countries,
|
||||
'status' => $status,
|
||||
'gender_arr' => $gender_arr,
|
||||
'departments' => $departments,
|
||||
];
|
||||
|
||||
return view('staff_members.create', $data);
|
||||
}
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required',
|
||||
'gender' => 'required',
|
||||
'department_id' => 'required',
|
||||
'email' => 'required',
|
||||
'personal_email' => 'required',
|
||||
'phone' => 'required',
|
||||
'location_country' => 'required',
|
||||
'hire_date' => 'sometimes|date',
|
||||
'profile_pic' => 'sometimes',
|
||||
'staff_number' => 'sometimes'
|
||||
]);
|
||||
$staff_members_arr = $request->except('_token');
|
||||
$staff_members_arr['created_by'] = session('current_user.id');
|
||||
$staff_members_arr['modified_by'] = session('current_user.id');
|
||||
|
||||
|
||||
|
||||
$result = Models\StaffMember::create($staff_members_arr);
|
||||
Session::flash('success_message', 'Staff Member successfully added');
|
||||
return redirect(url('staffmembers'));
|
||||
}
|
||||
public function edit($id){
|
||||
$staff_member = Models\StaffMember::findOrFail($id);
|
||||
|
||||
$countries = Models\Country::pluck('en_short_name','en_short_name');
|
||||
$departments = Models\Department::pluck('name', 'id');
|
||||
$status = ['Inactive' => 'Inactive', 'Active' => 'Active', 'Pending Confirmation' => 'Pending Confirmation'];
|
||||
$gender_arr = ['Female' => 'Female', 'Male' => 'Male'];
|
||||
|
||||
$data = [
|
||||
'page_title' => 'Edit Staff Member Details',
|
||||
'countries' => $countries,
|
||||
'status' => $status,
|
||||
'staff_member' => $staff_member,
|
||||
'gender_arr' => $gender_arr,
|
||||
'departments' => $departments
|
||||
];
|
||||
|
||||
return view('staff_members.edit', $data);
|
||||
}
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required',
|
||||
'gender' => 'required',
|
||||
'department_id' => 'required',
|
||||
'email' => 'required',
|
||||
'personal_email' => 'required',
|
||||
'phone' => 'required',
|
||||
'location_country' => 'required',
|
||||
'hire_date' => 'sometimes|date'
|
||||
]);
|
||||
|
||||
$staff_member = Models\StaffMember::findOrFail($id);
|
||||
|
||||
$staff_member->name = $request->name;
|
||||
$staff_member->email = $request->email;
|
||||
$staff_member->status = $request->status;
|
||||
$staff_member->personal_email = $request->personal_email;
|
||||
$staff_member->department_id = $request->department_id;
|
||||
$staff_member->location_country = $request->location_country;
|
||||
$staff_member->phone = $request->phone;
|
||||
$staff_member->hire_date = $request->hire_date;
|
||||
$staff_member->staff_number = $request->staff_number;
|
||||
$staff_member->gender = $request->gender;
|
||||
if ($request->has('profile_pic')) {
|
||||
$staff_member->profile_pic = $request->profile_pic;
|
||||
}
|
||||
$staff_member->save();
|
||||
|
||||
Session::flash('success_message', 'Staff Member Details successfully Updated');
|
||||
return redirect(url('staffmembers'));
|
||||
}
|
||||
}
|
||||
32
app/Http/Requests/AddFilesRequest.php
Normal file
32
app/Http/Requests/AddFilesRequest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AddFilesRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
"name" => "required",
|
||||
"description" => "sometimes",
|
||||
"photo" => "required|max:2000|mimes:png,jpg,jpeg,bmp,pdf,docx",
|
||||
];
|
||||
}
|
||||
}
|
||||
41
app/Http/Requests/UpdateClientRequest.php
Normal file
41
app/Http/Requests/UpdateClientRequest.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateClientRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'country' => 'required',
|
||||
'status' => 'required',
|
||||
'currency' => 'required',
|
||||
'auth_user_id' => 'required',
|
||||
'document_one_name' => 'required_with:document_one.*',
|
||||
'document_two_name' => 'required_with:document_two.*',
|
||||
'document_two_name' => 'required_with:document_three.*',
|
||||
'document_one' => 'max:2000|mimes:png,jpg,jpeg,bmp,pdf,doc,docx',
|
||||
'document_three' => 'max:2000|mimes:png,jpg,jpeg,bmp,pdf,doc,docx',
|
||||
'document_three' => 'max:2000|mimes:png,jpg,jpeg,bmp,pdf,doc,docx'
|
||||
];
|
||||
}
|
||||
}
|
||||
14
app/Models/ClientFile.php
Normal file
14
app/Models/ClientFile.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ClientFile extends Model
|
||||
{
|
||||
protected $guarded = array('id');
|
||||
|
||||
public function client_info(){
|
||||
return $this->hasOne('App\Models\Client', 'id', 'client_id');
|
||||
}
|
||||
}
|
||||
10
app/Models/Department.php
Normal file
10
app/Models/Department.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Department extends Model
|
||||
{
|
||||
protected $guarded = array('id');
|
||||
}
|
||||
11
app/Models/Mnoips.php
Normal file
11
app/Models/Mnoips.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Mnoips extends Model
|
||||
{
|
||||
protected $guarded = array('id');
|
||||
public $table = "mno_ip_addresses";
|
||||
}
|
||||
@@ -9,11 +9,7 @@ class NetworkOps extends Model
|
||||
protected $guarded = array('id');
|
||||
public $table = "network_operators";
|
||||
|
||||
public function country_info(){
|
||||
return $this->hasOne('App\Models\Country', 'alpha_2_code', 'country');
|
||||
}
|
||||
|
||||
public function account_manager_info(){
|
||||
return $this->hasOne('App\Models\SystemUser', 'id', 'account_manager_id');
|
||||
return $this->hasOne('App\Models\StaffMember', 'id', 'account_manager_id');
|
||||
}
|
||||
}
|
||||
|
||||
21
app/Models/SenderId.php
Normal file
21
app/Models/SenderId.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SenderId extends Model{
|
||||
|
||||
protected $guarded = array('id');
|
||||
public $table = "sender_ids";
|
||||
|
||||
public function modified_by_info(){
|
||||
return $this->hasOne('App\Models\StaffMember', 'id', 'last_modified_by');
|
||||
}
|
||||
public function network_info(){
|
||||
return $this->hasOne('App\Models\NetworkOps', 'id', 'netowkr_id');
|
||||
}
|
||||
public function created_by_info(){
|
||||
return $this->hasOne('App\Models\StaffMember', 'id', 'created_by');
|
||||
}
|
||||
}
|
||||
21
app/Models/StaffMember.php
Normal file
21
app/Models/StaffMember.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class StaffMember extends Model
|
||||
{
|
||||
protected $guarded = array('id');
|
||||
public $table = "staff_members";
|
||||
|
||||
public function department_info(){
|
||||
return $this->hasOne('App\Models\Department', 'id', 'department_id');
|
||||
}
|
||||
public function created_by_info(){
|
||||
return $this->hasOne('App\Models\Account', 'id', 'created_by');
|
||||
}
|
||||
public function modified_by_info(){
|
||||
return $this->hasOne('App\Models\Account', 'id', 'modified_by');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user