bug fixes and new additions
This commit is contained in:
@@ -30,6 +30,14 @@ class ClientsController extends Controller
|
||||
];
|
||||
return view('client.index-tabulator', $data);
|
||||
}
|
||||
public function indexInactive(){
|
||||
$data = [
|
||||
'page_title' => 'Inactive Clients',
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
// dd('foo bar');
|
||||
return view('client.index-inactive', $data);
|
||||
}
|
||||
public function indexBak(){
|
||||
$client_arr = new Models\Client;
|
||||
$client_arr = $client_arr->with('auth_user_info','country_info', 'created_by_info')->orderBy('name', 'ASC')->paginate(10);
|
||||
@@ -73,6 +81,7 @@ class ClientsController extends Controller
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->select('clients.id', 'clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
|
||||
|
||||
->paginate(10);
|
||||
|
||||
if($request->has('keyword')){
|
||||
@@ -87,6 +96,56 @@ class ClientsController extends Controller
|
||||
return response()->json($client_arr);
|
||||
}
|
||||
|
||||
public function getInactiveClientJson(Request $request){
|
||||
|
||||
$client_arr = \DB::table('clients')
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->join('flags AS flags', 'flags.country', '=', 'clients.country')
|
||||
->select('clients.id', 'clients.name', 'clients.status','clients.progress_indicator_score', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
|
||||
->whereRaw("status = 'inactive'")
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
// ->paginate(15);
|
||||
|
||||
if($request->has('keyword')){
|
||||
$keyword = $request->keyword;
|
||||
$client_arr = \DB::table('clients')
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->join('flags AS flags', 'flags.country', '=', 'clients.country')
|
||||
->select('clients.id','clients.name', 'clients.status', 'clients.progress_indicator_score','clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy', 'flags.url AS theflag')
|
||||
->whereRaw("status = 'inactive'")
|
||||
->whereRaw("clients.name like '%$keyword%' or clients.status like '%$keyword%' OR clients.country like '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name like '%$keyword%' OR clients.progress_indicator_score like '%$keyword%'")
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
// ->paginate(15);
|
||||
}
|
||||
|
||||
return response()->json($client_arr);
|
||||
}
|
||||
public function getInacticeClientJsonRawJs(Request $request){
|
||||
$client_arr = \DB::table('clients')
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->select('clients.id', 'clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
|
||||
->whereRaw("status = 'inactive'")
|
||||
->paginate(10);
|
||||
|
||||
if($request->has('keyword')){
|
||||
$keyword = $request->keyword;
|
||||
$client_arr = \DB::table('clients')
|
||||
->join('auth_users AS aumngr', 'aumngr.id', '=', 'clients.auth_user_id')
|
||||
->join('auth_users AS aumodify', 'aumodify.id', '=', 'clients.last_modified_by')
|
||||
->select('clients.id','clients.name', 'clients.status', 'clients.country', 'aumngr.name As accountMgr', 'aumodify.name AS modifiedBy')
|
||||
// ->where('status', 'inactive')
|
||||
->whereRaw("status = 'inactive'")
|
||||
->whereRaw("clients.name like '%$keyword%' or clients.status like '%$keyword%' OR clients.country like '%$keyword%' OR aumngr.name like '%$keyword%' OR aumodify.name like '%$keyword%'")
|
||||
->paginate(10);
|
||||
}
|
||||
return response()->json($client_arr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
@@ -99,7 +158,7 @@ class ClientsController extends Controller
|
||||
$service_type = Models\Service::pluck('name', 'name');
|
||||
$payment_type = ['Prepaid' => 'Prepaid', 'Postpaid' => 'Postpaid']; //Models\PaymentType::pluck('name', 'id');
|
||||
$auth_users = Models\SystemUser::pluck('name', 'id');
|
||||
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective'];
|
||||
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective', 'Cancelled' => 'Cancelled'];
|
||||
$currency = Models\Currency::pluck('name','name');
|
||||
$company_types = ['Aggregator/Supplier' => 'Aggregator/Supplier', 'Enterprise' => 'Enterprise', 'Hybrid' => 'Hybrid'];
|
||||
$industries = Models\Industry::orderBy('name', 'ASC')->pluck('name', 'name');
|
||||
@@ -669,6 +728,7 @@ class ClientsController extends Controller
|
||||
'Telkom Kenya' => 'Telkom Kenya',
|
||||
'Orange Kenya' => 'Orange Kenya'
|
||||
];
|
||||
// dd($networks_raw);
|
||||
//->where('highlight', 'NO')
|
||||
$show_notes = Models\ClientNote::with('created_by_info', 'client_info')->where('client_id', $id)->orderBy('created_at', 'DESC')->get()->take(20);
|
||||
$show_notes_highlight = Models\ClientNote::with('created_by_info', 'client_info')->where('client_id', $id)->where('highlight', 'YES')->orderBy('created_at', 'DESC')->get()->take(1);
|
||||
@@ -684,7 +744,7 @@ class ClientsController extends Controller
|
||||
$support_fees = Models\ClientSupportFees::where('client_id', $id)->orderBy('id', 'DESC')->get();
|
||||
|
||||
$showdocuments = Models\ClientFile::where('client_id', $id)->get();
|
||||
$client_sender_ids = Models\SenderId::with('network_info', 'created_by_info')->where('client_id', $id)->orderBy('senderid', 'ASC')->get();
|
||||
//$client_sender_ids = Models\SenderId::with('network_info', 'created_by_info')->where('client_id', $id)->orderBy('senderid', 'ASC')->get();
|
||||
// dd($showdocuments[0]->name);
|
||||
if ($showclient->status == 'Live') {
|
||||
$status_bg = "info";
|
||||
@@ -695,7 +755,7 @@ class ClientsController extends Controller
|
||||
else{
|
||||
$status_bg = "danger";
|
||||
}
|
||||
|
||||
// dd($showclient->progress_indicator_score);
|
||||
if ($showclient->progress_indicator_score >= 70) {
|
||||
$progress_status_bg = "success";
|
||||
}
|
||||
@@ -705,7 +765,7 @@ class ClientsController extends Controller
|
||||
else{
|
||||
$progress_status_bg = "danger";
|
||||
}
|
||||
|
||||
// dump($progress_status_bg);
|
||||
|
||||
$renewal_due = 'N/A';
|
||||
$highlight_colour = 'none';
|
||||
@@ -777,8 +837,8 @@ class ClientsController extends Controller
|
||||
'showdocuments' => $showdocuments,
|
||||
'support_fees' => $support_fees,
|
||||
'recurring_arr' => $recurring_arr,
|
||||
'client_sender_ids' => $client_sender_ids,
|
||||
'sender_id_statuses' => $sender_id_statuses,
|
||||
// 'client_sender_ids' => $client_sender_ids,
|
||||
// 'sender_id_statuses' => $sender_id_statuses,
|
||||
'country_network_arr' => $country_networks,
|
||||
'mnos_arr' => ['' => '-- Select Country first --']
|
||||
];
|
||||
@@ -787,8 +847,8 @@ class ClientsController extends Controller
|
||||
// dd($value->network_info->name);
|
||||
// }
|
||||
// dd($data);
|
||||
// return view('client.show_original_copy', $data);
|
||||
return view('client.show_test', $data);
|
||||
// return view('client.show', $data);
|
||||
return view('client.show_accordion', $data);
|
||||
}
|
||||
|
||||
public function showReadonly($id){
|
||||
@@ -958,7 +1018,8 @@ class ClientsController extends Controller
|
||||
$countries = Models\Country::orderBy('en_short_name', 'ASC')->pluck('en_short_name','en_short_name');
|
||||
|
||||
$payment_type = ['Prepaid' => 'Prepaid', 'Postpaid' => 'Postpaid']; // Models\PaymentType::pluck('name', 'id')->toArray();
|
||||
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective'];
|
||||
// $status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective'];
|
||||
$status = ['Live' => 'Live', 'inactive' => 'Inactive', 'Prospective' => 'Prospective', 'Cancelled' => 'Cancelled'];
|
||||
$currency = Models\Currency::orderBy('name', 'ASC')->pluck('name', 'name');
|
||||
$existing_documents = Models\ClientFile::where('client_id', $id)->get();
|
||||
$files = [
|
||||
@@ -996,7 +1057,7 @@ class ClientsController extends Controller
|
||||
if ($client->progress_indicator !== "COMPLETED") {
|
||||
$stage_details = Models\ClientOnboardingMainStage::where('stage', $client->progress_indicator)->first();
|
||||
// dump($stage_details);
|
||||
$onboarding_sub_items_progress = Models\ClientOnboardingProgress::where('stage_id', $stage_details->stage_id)->where('client_id', $id)->pluck('name', 'name');
|
||||
$onboarding_sub_items_progress = Models\ClientOnboardingProgress::where('stage_id', $stage_details->stage_id)->where('client_id', $id)->where('status', 'COMPLETED')->pluck('name', 'name');
|
||||
// dd($onboarding_sub_items_progress);
|
||||
$onboarding_sub_items = Models\ClientOnboardingSubItem::where('stage_id', $stage_details->stage_id)->pluck('name', 'name');
|
||||
}
|
||||
@@ -1125,6 +1186,7 @@ class ClientsController extends Controller
|
||||
'has_pending' => $has_pending,
|
||||
'files' => $files
|
||||
];
|
||||
// dd($data['onboarding_sub_items_progress']);
|
||||
return view('client.edit', $data);
|
||||
}
|
||||
|
||||
@@ -1145,7 +1207,11 @@ class ClientsController extends Controller
|
||||
$get_stage_subs_items = Models\ClientOnboardingSubItem::where('stage_id', $current_pending_stage_details->stage_id)->get();
|
||||
#update the table for onboarding progress
|
||||
foreach ($request->onboarding_sub_items_progress as $value) {
|
||||
$stage_id = ['stage_id' => $current_pending_stage_details->stage_id, 'client_id' => $id, 'name' => $value ];
|
||||
$stage_id = [
|
||||
'stage_id' => $current_pending_stage_details->stage_id,
|
||||
'client_id' => $id,
|
||||
'name' => $value
|
||||
];
|
||||
$progress_arr = [
|
||||
'status' => 'COMPLETED'
|
||||
];
|
||||
@@ -1154,10 +1220,7 @@ class ClientsController extends Controller
|
||||
|
||||
//update the status of onboarding progress stage in clients
|
||||
$get_stage_onboarding_status = Models\ClientOnboardingProgress::where('client_id', $id)->where('stage_id', $current_pending_stage_details->stage_id)->where('status', 'COMPLETED')->get();
|
||||
// dd($get_stage_onboarding_status);
|
||||
$onboarding_progress_stage = json_decode($client_update->onboarding_progress_stage, true);
|
||||
|
||||
// dd(count($get_stage_subs_items) == count($get_stage_onboarding_status));
|
||||
if (count($get_stage_subs_items) == count($get_stage_onboarding_status)) {
|
||||
//check if all items have been completed and update
|
||||
$onboarding_progress_stage[$current_pending_stage_details->stage] = 'COMPLETED';
|
||||
@@ -1169,7 +1232,6 @@ class ClientsController extends Controller
|
||||
#$pending_stage = array_key_first($pending_stage);
|
||||
reset($pending_stage);
|
||||
$pending_stage = key($pending_stage);
|
||||
// dd($pending_stage);
|
||||
if ($pending_stage == true) {
|
||||
//Pending Exist
|
||||
$client_update->progress_indicator = $pending_stage;
|
||||
@@ -1276,15 +1338,16 @@ class ClientsController extends Controller
|
||||
#$client_update->progress_indicators = json_encode($request->onboarding_sub_items_progress);
|
||||
if ($client_update->progress_indicator != 'COMPLETED') {
|
||||
$client_update->onboarding_progress_stage = json_encode($onboarding_progress_stage);
|
||||
|
||||
// dump(json_encode($onboarding_progress_stage));
|
||||
$progress_breakdown = array_count_values($onboarding_progress_stage);
|
||||
// dd($progress_breakdown);
|
||||
if (array_has($progress_breakdown, ['COMPLETED']) == false) {
|
||||
// dd('foo');
|
||||
$indicator_score = "0";
|
||||
}
|
||||
else{
|
||||
$indicator_score = ($progress_breakdown['COMPLETED']/count($onboarding_progress_stage)) * 100;
|
||||
}
|
||||
|
||||
$indicator_score = number_format($indicator_score);
|
||||
$client_update->progress_indicator_score = $indicator_score;
|
||||
}
|
||||
|
||||
@@ -21,11 +21,10 @@ class Controller extends BaseController{
|
||||
public function log_query() {
|
||||
// , $binding, $timing 'bindings' => $binding)
|
||||
\DB::listen(function ($sql) {
|
||||
\Log::info('Showing query', array('sql' => $sql));
|
||||
$encoded_sql = json_encode($sql);
|
||||
$this->sendNtfy("Showing Query : " . $encoded_sql);
|
||||
}
|
||||
);
|
||||
\Log::info('Showing query', array('sql' => $sql));
|
||||
$encoded_sql = json_encode($sql);
|
||||
$this->sendNtfy("Showing Query : " . $encoded_sql);
|
||||
});
|
||||
}
|
||||
|
||||
public function sendNtfy($data){
|
||||
|
||||
@@ -5,18 +5,28 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models;
|
||||
use Session;
|
||||
|
||||
use DB;
|
||||
use Carbon\Carbon;
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
// dd('foo bar');
|
||||
|
||||
$currentdate = date('m-d');
|
||||
$total_clients = Models\Client::count();
|
||||
$ussd_clients = Models\Client::where('services', 'LIKE', '%ussd%')->orwhere('services', 'LIKE', '%A2P%')->count();
|
||||
$airtime_clients = Models\Client::where('services', 'LIKE', '%airtime%')->count();
|
||||
// dd($airtime_clients);
|
||||
$sms_clients = Models\Client::where('services', 'LIKE', '%sms%')->count();
|
||||
$voice_clients = Models\Client::where('services', 'LIKE', '%ivr%')->count();
|
||||
$expiring_contracts = Models\Client::where('contract_auto_renew', '<>', 'YES')->where('contract_validity', '<>', null)->orwhere('contract_validity', '<>', '')->orderBy('contract_validity', 'ASC')->take(5)->get();
|
||||
$user_activities = Models\UserActivity::where('user_id', '>', '1')->with('userInfo')->orderBy('created_at', 'DESC')->take(5)->get();
|
||||
$recent_clients = Models\Client::with('auth_user_info')->orderBy('id', 'DESC')->take(5)->get();
|
||||
// $upcoming_birthdays = Models\StaffMember::whereDate('dob', '>=', $currentdate)->orderBy('dob', 'ASC')->take(5)->get();
|
||||
$upcoming_birthdays = Models\StaffMember::whereRaw("(month(dob) >= month(curdate())) AND day(dob) >= day(curdate())")->orderBy('dob', 'ASC')->take(5)->get();
|
||||
$upcoming_hodidays = Models\NationalHoliday::whereRaw("(month(event_date) >= month(curdate()))")->orderBy('event_date', 'ASC')->take(5)->get();
|
||||
|
||||
// dd($upcoming_hodidays);
|
||||
// $recent_clients = Models\Client::orderBy('id', 'DESC')->take(5)->get();
|
||||
// dd($recent_clients);
|
||||
$data = [
|
||||
@@ -24,13 +34,14 @@ class DashboardController extends Controller
|
||||
'sms' => $sms_clients,
|
||||
'ussd' => $ussd_clients,
|
||||
'voice' => $voice_clients,
|
||||
'airtime' => $airtime_clients,
|
||||
'total' => $total_clients,
|
||||
'recent_clients' => $recent_clients,
|
||||
'user_activities' => $user_activities,
|
||||
'expiring_contracts' => $expiring_contracts
|
||||
'expiring_contracts' => $expiring_contracts,
|
||||
'upcoming_birthdays' => $upcoming_birthdays,
|
||||
'upcoming_hodidays' => $upcoming_hodidays
|
||||
];
|
||||
|
||||
// dd($data);
|
||||
return view('dashboard.index_two', $data);
|
||||
}
|
||||
|
||||
@@ -49,4 +60,71 @@ class DashboardController extends Controller
|
||||
return response()->json($event_arr);
|
||||
|
||||
}
|
||||
|
||||
public function getQuotes(){
|
||||
// put numbers against the quotes
|
||||
// $daily_quotes = Models\Client::where('services', 'LIKE', '%ivr%')->count();
|
||||
|
||||
$daily_quotes = DB::table('daily_quotes')
|
||||
->where('id', '>=', DB::raw('(SELECT FLOOR(RAND() * (SELECT MAX(id) FROM daily_quotes)))'))
|
||||
// ->limit(5)
|
||||
->first();
|
||||
return response()->json($daily_quotes);
|
||||
|
||||
}
|
||||
public function getMnosContracts(){
|
||||
$threeMonthsLater = Carbon::now()->addMonths(3)->format('m-d');
|
||||
$threeMonthsEarlier = Carbon::now()->addMonths(3)->format('m-d');
|
||||
$currentMonth = Carbon::now()->format('m');
|
||||
$today = Carbon::now()->format('m-d');
|
||||
|
||||
$expiring_three_months = Models\NetworkOps::where('contract_auto_renew', 'NO')->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') = ?", [$threeMonthsLater])->get();
|
||||
#$network_arr = Models\NetworkOps::where('contract_auto_renew', 'NO')->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') = ?", [$threeMonthsEarlier])->get();
|
||||
|
||||
|
||||
|
||||
$expired_in_current_month = Models\NetworkOps::whereRaw("DATE_FORMAT(contract_validity, '%m-%d') < ?", [$today])->get();
|
||||
$expired_overall = Models\NetworkOps::whereDate('contract_validity', '<', Carbon::now())->get();
|
||||
|
||||
// $network_arr = Models\NetworkOps::with('account_manager_info')
|
||||
// ->where('contract_auto_renew', 'NO')
|
||||
// ->get();
|
||||
|
||||
$expiring_current_month = Models\NetworkOps::whereMonth('contract_validity', $currentMonth)->get();
|
||||
$data = [
|
||||
'expiring_three_months' => $expiring_three_months->count(),
|
||||
'expired_overall' => $expired_overall->count(),
|
||||
'expiring_current_month' => $expiring_current_month->count()
|
||||
];
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function getClientContracts(){
|
||||
$threeMonthsLater = Carbon::now()->addMonths(3)->format('m-d');
|
||||
$threeMonthsEarlier = Carbon::now()->addMonths(3)->format('m-d');
|
||||
$currentMonth = Carbon::now()->format('m');
|
||||
$today = Carbon::now()->format('m-d');
|
||||
|
||||
$expiring_three_months = Models\Client::where('contract_auto_renew', 'NO')->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') = ?", [$threeMonthsLater])->get();
|
||||
#$network_arr = Models\NetworkOps::where('contract_auto_renew', 'NO')->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') = ?", [$threeMonthsEarlier])->get();
|
||||
|
||||
|
||||
|
||||
$expired_in_current_month = Models\Client::whereRaw("DATE_FORMAT(contract_validity, '%m-%d') < ?", [$today])->get();
|
||||
$expired_overall = Models\Client::whereDate('contract_validity', '<', Carbon::now())->get();
|
||||
|
||||
// $network_arr = Models\NetworkOps::with('account_manager_info')
|
||||
// ->where('contract_auto_renew', 'NO')
|
||||
// ->get();
|
||||
|
||||
|
||||
|
||||
$expiring_current_month = Models\Client::whereMonth('contract_validity', $currentMonth)->get();
|
||||
$data = [
|
||||
'expiring_three_months' => $expiring_three_months->count(),
|
||||
'expired_overall' => $expired_overall->count(),
|
||||
'expiring_current_month' => $expiring_current_month->count()
|
||||
];
|
||||
return response()->json($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ class GeneralDocumentsController extends Controller
|
||||
|
||||
$category_names = [
|
||||
'api' => 'API Documents',
|
||||
'airtime' => 'Click Airtime',
|
||||
'presentations' => 'Presentations',
|
||||
'rates' => 'SMS/Voice Rates',
|
||||
'scfees' => 'Short Code Fees',
|
||||
@@ -107,6 +108,7 @@ class GeneralDocumentsController extends Controller
|
||||
$categories = [
|
||||
'sidwl' => 'Sender ID Whitelisting Letter',
|
||||
'api' => 'API Docs',
|
||||
'airtime' => 'Click Airtime',
|
||||
'rates' => 'Rates',
|
||||
'scfees' => 'Short Code Fees',
|
||||
'presentations' => 'presentations',
|
||||
|
||||
@@ -5,6 +5,9 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models;
|
||||
use Spatie\Activitylog\Models\Activity;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Jobs\SendOtpEmailAlert;
|
||||
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
@@ -15,33 +18,113 @@ class LoginController extends Controller
|
||||
];
|
||||
return view('login.index', $data);
|
||||
}
|
||||
public function resendOtp(){
|
||||
if(!request()->session()->has('current_otpuser')){
|
||||
return redirect(url('login'))->withErrors("No session found. You need to be logged in!");
|
||||
}
|
||||
$otp_code = Str::random(6);
|
||||
\Log::info($otp_code);
|
||||
request()->session()->put('current_otpuser.otp', $otp_code);
|
||||
$otp_user = session('current_otpuser');
|
||||
|
||||
public function handleLogin(Request $request){
|
||||
$this->validate($request, ['email' => 'required', 'password' => 'required']);
|
||||
$otp_set = [
|
||||
'otp' => $otp_code,
|
||||
'email' => $otp_user['email'],
|
||||
'auth_name' => $otp_user['name']
|
||||
];
|
||||
dispatch(new SendOtpEmailAlert($otp_set));
|
||||
$data = [
|
||||
'otp_user_id' => $otp_user['id'],
|
||||
'page_title' => 'Login OTP',
|
||||
'auth_name' => $otp_user['name']
|
||||
];
|
||||
return view('login.otp', $data);
|
||||
}
|
||||
public function showOtpPage(){
|
||||
if(!request()->session()->has('current_otpuser')){
|
||||
$random = uniqid();
|
||||
return redirect(url('login'))->withErrors("$random | You need to be logged in ");
|
||||
}
|
||||
$otp_user = session('current_otpuser');
|
||||
$data = [
|
||||
'otp_user_id' => $otp_user['id'],
|
||||
'page_title' => 'Login OTP',
|
||||
'auth_name' => $otp_user['name']
|
||||
];
|
||||
return view('login.otp', $data);
|
||||
}
|
||||
public function handleLoginOtp(Request $request){
|
||||
$this->validate($request, ['email' => 'required', 'password' => 'required']);
|
||||
//system user : $table = "auth_users";
|
||||
$logged_in = Models\SystemUser::with('designation_info')->where('email', $request->email)->where('password', md5($request->password))->first();
|
||||
$logged_in = Models\SystemUser::with('designation_info')->where('email', $request->email)->where('password', md5($request->password))->first();
|
||||
|
||||
if(empty($logged_in)){
|
||||
return redirect("/")->withErrors(array("Incorrect Email/Password. Check and try again!"))->withInput();
|
||||
}
|
||||
|
||||
$otp_code = Str::random(6);
|
||||
$request->session()->regenerate(true);
|
||||
$request->session()->put('current_otpuser.id', $logged_in->id);
|
||||
$request->session()->put('current_otpuser.otp', $otp_code);
|
||||
$request->session()->put('current_otpuser.name', $logged_in->name);
|
||||
$request->session()->put('current_otpuser.email', $logged_in->email);
|
||||
$request->session()->put('current_otpuser.phone', $logged_in->phone);
|
||||
$request->session()->put('current_otpuser.datetime_sent', date('Y-m-d H:i:s'));
|
||||
$request->session()->put('current_otpuser.designation', $logged_in->designation_info->name);
|
||||
|
||||
$otp_set = ['otp' => $otp_code, 'email' => $logged_in->email, 'auth_name' => $logged_in->name];
|
||||
dispatch(new SendOtpEmailAlert($otp_set));
|
||||
return redirect(url('showotp'));
|
||||
}
|
||||
public function handleLogin(Request $request){
|
||||
// dump($request->all());
|
||||
$this->validate($request, ['otp' => 'required', 'otp_user_id' => 'required']);
|
||||
//system user : $table = "auth_users";
|
||||
$current_date = date('Y-m-d H:i:s');
|
||||
$otp_user = session('current_otpuser');
|
||||
|
||||
$date1 = new \DateTime($otp_user['datetime_sent']);
|
||||
$date2 = new \DateTime($current_date);
|
||||
|
||||
$interval = $date1->diff($date2);
|
||||
$minutes = ($interval->h * 60) + $interval->i;
|
||||
// dd($minutes);
|
||||
if($minutes > 2 ){
|
||||
return redirect("showotp")->withErrors(array("OTP Time Out. Resend and try again!"));
|
||||
}
|
||||
|
||||
$otp_user = session('current_otpuser');
|
||||
if(strtoupper($otp_user['otp']) !== strtoupper($request->otp)){
|
||||
|
||||
return redirect("showotp")->withErrors(array("Incorrect OTP. Check and try again!"))->withInput();
|
||||
}
|
||||
#$logged_in = Models\SystemUser::with('designation_info')->where('email', $request->email)->where('password', md5($request->password))->first();
|
||||
/*
|
||||
if(empty($logged_in)){
|
||||
return redirect("/")->withErrors(array("Incorrect Email/Password. Check and try again!"))->withInput();
|
||||
}
|
||||
|
||||
*/
|
||||
$request->session()->regenerate(true);
|
||||
$request->session()->put('current_user.id', $logged_in->id);
|
||||
$request->session()->put('current_user.name', $logged_in->name);
|
||||
$request->session()->put('current_user.email', $logged_in->email);
|
||||
$request->session()->put('current_user.phone', $logged_in->phone);
|
||||
$request->session()->put('current_user.designation', $logged_in->designation_info->name);
|
||||
$request->session()->put('current_user.id', $otp_user['id']);
|
||||
$request->session()->put('current_user.name', $otp_user['name']);
|
||||
$request->session()->put('current_user.email', $otp_user['email']);
|
||||
$request->session()->put('current_user.phone', $otp_user['phone']);
|
||||
$request->session()->put('current_user.designation', $otp_user['designation']);
|
||||
|
||||
\Log::info($logged_in->name . ' Successfully logged in at : ' . date('Y-m-d H:i:s'));
|
||||
|
||||
$content = $logged_in->name . " Successfully Logged In";
|
||||
activity()->log($logged_in->name . ' Successfully logged in at : ' . date('Y-m-d H:i:s'));
|
||||
\Log::info($otp_user['name']. ' Successfully logged in at : ' . date('Y-m-d H:i:s'));
|
||||
|
||||
$this->logUsersActivity($type = 'staff', $content, $logged_in->id);
|
||||
$content = $otp_user['name'] . " Successfully Logged In";
|
||||
// dd($content);
|
||||
#activity()->log($otp_user['name']. ' Successfully logged in at : ' . date('Y-m-d H:i:s'));
|
||||
|
||||
$this->logUsersActivity($type = 'staff', $content, $otp_user['id']);
|
||||
$this->deleteLoggedUser();
|
||||
$this->storeLoggedUser();
|
||||
|
||||
switch ($logged_in->designation_info->name) {
|
||||
return redirect(url('/'));
|
||||
/*
|
||||
switch ($otp_user['designation_info']) {
|
||||
case 'Administrator':
|
||||
return redirect(url('finance')); // change it to a combined dashboard
|
||||
break;
|
||||
@@ -53,6 +136,7 @@ class LoginController extends Controller
|
||||
return redirect(url('/'));
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public function handle_logout(Request $request) {
|
||||
@@ -65,8 +149,8 @@ class LoginController extends Controller
|
||||
$request->session()->flush();
|
||||
$request->session()->regenerate(true);
|
||||
|
||||
activity()->log($username . " Logged Out : " . date('Y-m-d H:i:s'));
|
||||
// $this->logUsersActivity($type = 'staff', $content, $user_id);
|
||||
#activity()->log($username . " Logged Out : " . date('Y-m-d H:i:s'));
|
||||
$this->logUsersActivity($type = 'staff', $content, $user_id);
|
||||
|
||||
return redirect("/");
|
||||
}
|
||||
|
||||
@@ -388,7 +388,13 @@ class NetworkOperatorsController extends Controller
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Requests\UpdateMnoRequest $request, $id)
|
||||
{
|
||||
{
|
||||
if ($request->has('document_one') && isset($request->document_one_name) == false) {
|
||||
return redirect()->back()->withErrors(array("You need to add a name for the document to be uploaded !"))->withInput();
|
||||
}
|
||||
if ($request->has('document_two') && isset($request->document_two_name) == false) {
|
||||
return redirect()->back()->withErrors(array("You need to add a name for the document to be uploaded !"))->withInput();
|
||||
}
|
||||
$operator_update = Models\NetworkOps::find($id);
|
||||
$paperless = new PaperLessNgx();
|
||||
if ($request->has('document_one') && $request->has('document_one_name')) {
|
||||
|
||||
@@ -35,7 +35,7 @@ class OfficeLocationsController extends Controller
|
||||
$id = $request->branch_id;
|
||||
$document_arr = \DB::table('branch_files')
|
||||
->join('auth_users', 'auth_users.id', '=', 'branch_files.uploaded_by')
|
||||
->select('branch_files.id', 'branch_files.name','branch_files.file_reff', 'auth_users.name AS UploadedBy', 'branch_files.created_at')
|
||||
->select('branch_files.id', 'branch_files.name', 'branch_files.validity_period','branch_files.file_reff', 'auth_users.name AS UploadedBy', 'branch_files.created_at')
|
||||
->orderBy('branch_files.name', 'ASC')
|
||||
->where('branch_files.branch_id', $id)
|
||||
->paginate(15);
|
||||
@@ -44,7 +44,7 @@ class OfficeLocationsController extends Controller
|
||||
$keyword = $request->keyword;
|
||||
$document_arr = \DB::table('branch_files')
|
||||
->join('auth_users', 'auth_users.id', '=', 'branch_files.uploaded_by')
|
||||
->select('branch_files.id', 'branch_files.name','branch_files.file_reff', 'auth_users.name AS UploadedBy', 'branch_files.created_at')
|
||||
->select('branch_files.id', 'branch_files.name', 'branch_files.validity_period', 'branch_files.file_reff', 'auth_users.name AS UploadedBy', 'branch_files.created_at')
|
||||
->orderBy('branch_files.name', 'ASC')
|
||||
->where('branch_files.branch_id', $id)
|
||||
->whereRaw("branch_files.name LIKE '%$keyword%' OR branch_files.description LIKE '%$keyword%' OR branch_files.filename LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%'")
|
||||
@@ -70,6 +70,7 @@ class OfficeLocationsController extends Controller
|
||||
'page_title' => 'Upload Document',
|
||||
'branch_id' => $id
|
||||
];
|
||||
// dd($data);
|
||||
return view('officelocations.filescreate', $data);
|
||||
}
|
||||
/**
|
||||
@@ -153,7 +154,7 @@ class OfficeLocationsController extends Controller
|
||||
|
||||
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();
|
||||
$filename = "erp_" . time() . str_random(6) . "." . $request->document_one->extension();
|
||||
$request->document_one->storeAs('branch_files', $filename, 'public');
|
||||
$document_arr['filename'] = $filename;
|
||||
$document_arr['branch_id'] = $request->branch_id;
|
||||
@@ -162,6 +163,7 @@ class OfficeLocationsController extends Controller
|
||||
$document_arr['file_extension'] = $request->document_one->extension();
|
||||
$document_arr['file_reff'] = time() . uniqid();
|
||||
$document_arr['name'] = $request->document_one_name;
|
||||
$document_arr['validity_period'] = $request->validity_period_one;
|
||||
$document_arr['uploaded_by'] = session('current_user.id');
|
||||
$result = Models\BranchFile::create($document_arr);
|
||||
}
|
||||
@@ -177,6 +179,7 @@ class OfficeLocationsController extends Controller
|
||||
$document_arr['file_extension'] = $request->document_two->extension();
|
||||
$document_arr['file_reff'] = time() . uniqid();
|
||||
$document_arr['name'] = $request->document_two_name;
|
||||
$document_arr['validity_period'] = $request->validity_period_two;
|
||||
$document_arr['uploaded_by'] = session('current_user.id');
|
||||
$result = Models\BranchFile::create($document_arr);
|
||||
}
|
||||
@@ -192,6 +195,7 @@ class OfficeLocationsController extends Controller
|
||||
$document_arr['file_extension'] = $request->document_three->extension();
|
||||
$document_arr['file_reff'] = time() . uniqid();
|
||||
$document_arr['name'] = $request->document_three_name;
|
||||
$document_arr['validity_period'] = $request->validity_period_third;
|
||||
$document_arr['uploaded_by'] = session('current_user.id');
|
||||
$result = Models\BranchFile::create($document_arr);
|
||||
}
|
||||
|
||||
@@ -102,12 +102,75 @@ class ReportsController extends Controller{
|
||||
->select('user_activities.id','auth_users.name', 'user_activities.content', 'user_activities.ip_address', 'user_activities.created_at', 'user_activities.updated_at')
|
||||
->whereRaw("user_activities.name like '%$keyword%' or user_activities.ip_address like '%$keyword%' OR user_activities.created_at like '%$keyword%' OR user_activities.updated_at like '%$keyword%'")
|
||||
->orderBy('user_activities.created_at', 'DESC')
|
||||
->get();
|
||||
// ->paginate(15);
|
||||
//->get();
|
||||
->paginate(50);
|
||||
}
|
||||
return response()->json($user_activities);
|
||||
}
|
||||
|
||||
public function getMnosContracts(){
|
||||
#$user_activities = Models\UserActivity::where('user_id', '>', '1')->with('userInfo')->orderBy('created_at', 'DESC')->take(5)->get();
|
||||
$data = [
|
||||
'page_title' => 'Expired MNO Contracts',
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
return view('reports.mno-expired-contracts', $data);
|
||||
}
|
||||
|
||||
public function getMnosContractsJson(Request $request){
|
||||
|
||||
$today = Carbon::now()->format('m-d');
|
||||
$expired_contracts = \DB::table('network_operators')
|
||||
->join('auth_users', 'auth_users.id', '=', 'network_operators.account_manager_id')
|
||||
->select('network_operators.id','auth_users.name AS accountManager', 'network_operators.name','network_operators.contact_person', 'network_operators.contact_person_email', 'network_operators.country', 'network_operators.contract_validity', 'network_operators.created_at')
|
||||
->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') < ?", [$today])
|
||||
->orderBy('network_operators.name', 'DESC')
|
||||
->get();
|
||||
|
||||
if($request->has('keyword')){
|
||||
$keyword = $request->keyword;
|
||||
$expired_contracts = \DB::table('network_operators')
|
||||
->join('auth_users', 'auth_users.id', '=', 'network_operators.account_manager_id')
|
||||
->select('network_operators.id','auth_users.name AS accountManager', 'network_operators.name','network_operators.contact_person', 'network_operators.contact_person_email', 'network_operators.country', 'network_operators.contract_validity', 'network_operators.created_at')
|
||||
->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') < ?", [$today])
|
||||
->whereRaw("network_operators.name like '%$keyword%' or network_operators.contact_person like '%$keyword%' OR network_operators.created_at like '%$keyword%' OR network_operators.contract_validity like '%$keyword%' OR network_operators.contact_person_email like '%$keyword%'")
|
||||
->orderBy('network_operators.name', 'DESC')
|
||||
->get();
|
||||
}
|
||||
return response()->json($expired_contracts);
|
||||
}
|
||||
|
||||
public function getClientContracts(){
|
||||
#$user_activities = Models\UserActivity::where('user_id', '>', '1')->with('userInfo')->orderBy('created_at', 'DESC')->take(5)->get();
|
||||
$data = [
|
||||
'page_title' => 'Expirted Client Contracts',
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
return view('reports.clients-expired-contracts', $data);
|
||||
}
|
||||
|
||||
public function getClientContractsJson(Request $request){
|
||||
$today = Carbon::now()->format('m-d');
|
||||
$expired_contracts = \DB::table('clients')
|
||||
->join('auth_users', 'auth_users.id', '=', 'clients.auth_user_id')
|
||||
->select('clients.id','auth_users.name AS accountManager', 'clients.name','clients.contact_person', 'clients.email', 'clients.country', 'clients.contract_validity', 'clients.created_at')
|
||||
->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') < ?", [$today])
|
||||
->orderBy('clients.name', 'DESC')
|
||||
->get();
|
||||
|
||||
if($request->has('keyword')){
|
||||
$keyword = $request->keyword;
|
||||
$expired_contracts = \DB::table('clients')
|
||||
->join('auth_users', 'auth_users.id', '=', 'clients.auth_user_id')
|
||||
->select('clients.id','auth_users.name AS accountManager', 'clients.name','clients.contact_person', 'clients.email', 'clients.country', 'clients.contract_validity', 'clients.created_at')
|
||||
->whereRaw("DATE_FORMAT(contract_validity, '%m-%d') < ?", [$today])
|
||||
->whereRaw("clients.name like '%$keyword%' or clients.contact_person like '%$keyword%' OR clients.created_at like '%$keyword%' OR clients.contract_validity like '%$keyword%' OR clients.contact_person_email like '%$keyword%'")
|
||||
->orderBy('clients.name', 'DESC')
|
||||
->get();
|
||||
}
|
||||
return response()->json($expired_contracts);
|
||||
}
|
||||
|
||||
public function getAmNewClients(){
|
||||
// $new_clients = Models\Client::where()
|
||||
}
|
||||
|
||||
@@ -5,13 +5,16 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models;
|
||||
use Session;
|
||||
use Excel;
|
||||
use App\Imports\Senderidimport;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
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);
|
||||
// dd($senderid_arr);
|
||||
$data = [
|
||||
'page_title' => 'Sender IDs',
|
||||
// 'senderid_arr' => $senderid_arr,
|
||||
@@ -25,23 +28,25 @@ class SenderIdController extends Controller
|
||||
$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','sender_ids.direct_mno', 'staffmodify.name AS modifiedBy')
|
||||
// ->join('network_operators', 'network_operators.id', '=', 'sender_ids.network_id')
|
||||
// ->join('clients', 'clients.id', '=', 'sender_ids.client_id')
|
||||
->select('sender_ids.id', 'mno_name', 'supplier_name', 'sender_ids.senderid', 'sender_ids.status', 'sender_ids.remarks', 'staffcreate.name As createdBy','sender_ids.direct_mno', 'staffmodify.name AS modifiedBy')
|
||||
->orderBy('sender_ids.senderid', 'ASC')
|
||||
->paginate(15);
|
||||
|
||||
if($request->has('keyword')){
|
||||
$queries = [];
|
||||
$keyword = $request->keyword;
|
||||
$queries['keyword'] = $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', 'sender_ids.direct_mno', '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%' OR sender_ids.direct_mno LIKE '%$keyword%'")
|
||||
// ->join('network_operators', 'network_operators.id', '=', 'sender_ids.network_id')
|
||||
// ->join('clients', 'clients.id', '=', 'sender_ids.client_id')
|
||||
->select('sender_ids.id', 'mno_name', 'supplier_name', 'sender_ids.senderid', 'sender_ids.status', 'sender_ids.remarks', 'staffcreate.name As createdBy', 'sender_ids.direct_mno', 'staffmodify.name AS modifiedBy')
|
||||
->whereRaw("sender_ids.senderid LIKE '%$keyword%' OR sender_ids.status LIKE '%$keyword%' OR mno_name LIKE '%$keyword%' OR supplier_name LIKE '%$keyword%' OR staffcreate.name LIKE '%$keyword%' OR staffmodify.name LIKE '%$keyword%' OR sender_ids.direct_mno LIKE '%$keyword%'")
|
||||
->orderBy('sender_ids.senderid', 'ASC')
|
||||
->paginate(15);
|
||||
->paginate(15)->appends($queries);
|
||||
}
|
||||
return response()->json($senderid_arr);
|
||||
}
|
||||
@@ -49,29 +54,46 @@ class SenderIdController extends Controller
|
||||
{
|
||||
#$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');
|
||||
$networks = \DB::table('network_operators')->Select(\DB::raw('concat(name, " (", country, ")") AS networkvalue, concat(name, " (", country, ")") AS network'))->orderBy('network')->get()->toArray();
|
||||
$network_arr = array_pluck($networks, 'network', 'networkvalue');
|
||||
$direct_mno_arr = ['YES' => 'YES', 'NO' => 'NO'];
|
||||
|
||||
// dd($network_arr);
|
||||
#$network_arr = array_combine($network_arr, $network_arr);
|
||||
|
||||
|
||||
$clients = Models\Client::pluck('name', 'id');
|
||||
// $clients = Models\Client::pluck('name', 'name');
|
||||
$clients = \DB::table('clients')->Select(\DB::raw('concat(name, " (", country, ")") AS clientvalue, concat(name, " (", country, ")") AS client'))->orderBy('client')->get()->toArray();
|
||||
$client_arr = array_pluck($clients, 'client', 'clientvalue');
|
||||
$staffmembers = Models\StaffMember::pluck('name', 'id');
|
||||
$status = ['Pending' => 'Pending', 'Inactive' => 'Inactive', 'Approved' => 'Approved'];
|
||||
#$status = ['Pending' => 'Pending', 'Inactive' => 'Inactive', 'Approved' => 'Approved'];
|
||||
#$status = ['Applied to MNO', 'Applied to Aggregator', 'Approved on MNO', 'Approved on Aggregator', 'Active', 'InActive'];
|
||||
$status = [
|
||||
'Applied to MNO' => 'Applied to MNO',
|
||||
'Applied to Aggregator' => 'Applied to Aggregator',
|
||||
'Approved on MNO' => 'Approved on MNO',
|
||||
'Approved on Aggregator' => 'Approved on Aggregator',
|
||||
'Active' => 'Active',
|
||||
'Inactive' => 'InActive'
|
||||
];
|
||||
|
||||
$data = [
|
||||
'page_title' => 'Create Sender ID',
|
||||
'network_arr' => [], // $network_arr,
|
||||
'network_arr' => $network_arr,
|
||||
'status' => $status,
|
||||
'clients' => $clients,
|
||||
'clients' => $client_arr,
|
||||
'direct_mno_arr' => $direct_mno_arr,
|
||||
'staffmembers' => $staffmembers
|
||||
];
|
||||
|
||||
// dd($data);
|
||||
return view('senderid.create', $data);
|
||||
}
|
||||
public function showuploadform(){
|
||||
$data = [
|
||||
'page_title' => 'Upload Sender IDs',
|
||||
];
|
||||
return view('senderid.uploadbulk', $data);
|
||||
}
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
@@ -82,14 +104,30 @@ class SenderIdController extends Controller
|
||||
{
|
||||
$request->validate([
|
||||
'senderid' => 'required|max:11',
|
||||
'network_id' => 'required',
|
||||
'mno_name' => 'required_if:direct_mno,YES',
|
||||
'supplier_name' => 'required_if:direct_mno,NO',
|
||||
'status' => 'required',
|
||||
'remarks' => 'sometimes',
|
||||
]);
|
||||
$check_duplicate = Models\SenderId::where('senderid', $request->senderid)
|
||||
->where('mno_name', $request->mno_name)
|
||||
->first();
|
||||
|
||||
if($check_duplicate){
|
||||
return redirect()->back()->withInput()->withErrors("Sender ID already exist for " . $request->mno_name );
|
||||
}
|
||||
|
||||
$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 ?? '';
|
||||
$senderid_arr['direct_mno'] = $request->direct_mno;
|
||||
|
||||
|
||||
// dd($senderid_arr);
|
||||
$result = Models\SenderId::create($senderid_arr);
|
||||
|
||||
/*
|
||||
if ($request->direct_mno == 'NO') {
|
||||
$mno_world_wide = Models\Worldwidemno::find($request->network_id);
|
||||
// code... save in the network ops with status as non-direct ... user createOrUpdate method
|
||||
@@ -98,37 +136,176 @@ class SenderIdController extends Controller
|
||||
$network_ops_arr['name'] = $mno_world_wide->network;
|
||||
$network_ops_arr['direct_business'] = 'NO'; // $mno_world_wide->network;
|
||||
$result = Models\NetworkOps::updateOrCreate(['name' => $mno_world_wide->network, 'country' => $mno_world_wide->country, 'direct_business' => 'NO'], $network_ops_arr);
|
||||
$senderid_arr['network_id'] = $result->id;
|
||||
}
|
||||
// dd($senderid_arr);
|
||||
|
||||
$result = Models\SenderId::create($senderid_arr);
|
||||
|
||||
//validate senderid with same client and same network
|
||||
// $result = Models\SenderId::create($senderid_arr);
|
||||
$result = Models\SenderId::updateOrCreate([
|
||||
'network_id' => $senderid_arr['network_id'],
|
||||
'client_id' => $senderid_arr['client_id'],
|
||||
'senderid' => $senderid_arr['senderid']
|
||||
], $senderid_arr);
|
||||
*/
|
||||
|
||||
#save services this has been moved to the main client table
|
||||
//$retval = $this->store_services($request->services, $result->id);
|
||||
|
||||
// dd('foo bar');
|
||||
Session::flash('success_message', 'Sender ID successfully added');
|
||||
return redirect(url('senderids'));
|
||||
}
|
||||
public function uploadstore(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'senderid_file' => 'required|max:6000|mimes:xlx,xlsx',
|
||||
]);
|
||||
|
||||
|
||||
$request->session()->put('current_user.rejected_rows_filename', '');
|
||||
|
||||
// dump($request->all());
|
||||
$networks = \DB::table('network_operators')->Select(\DB::raw('concat(name, " (", country, ")") AS networkvalue, concat(name, " (", country, ")") AS network'))->orderBy('network')->get()->toArray();
|
||||
|
||||
$network_arr = array_pluck($networks, 'network', 'networkvalue');
|
||||
|
||||
$clients = \DB::table('clients')->Select(\DB::raw('concat(name, " (", country, ")") AS clientvalue, concat(name, " (", country, ")") AS client'))->orderBy('client')->get()->toArray();
|
||||
$client_arr = array_pluck($clients, 'client', 'clientvalue');
|
||||
|
||||
if (!$request->hasFile('senderid_file') && !$request->senderid_file->isValid() ) {
|
||||
Session::flash('error_message', 'File could not be loaded');
|
||||
return redirect()->back();
|
||||
}
|
||||
$file = $request->senderid_file;
|
||||
$filename = "erp_" . time() . str_random(6) . "." . $request->senderid_file->extension();
|
||||
$request->senderid_file->storeAs('general_files', $filename, 'public');
|
||||
|
||||
$stored_file = public_path('documents/general_files/'.$filename);
|
||||
$extracted_arr = Excel::toArray(new Senderidimport, $stored_file);
|
||||
// dd($extracted_arr[0]);
|
||||
$row_count = $extracted_arr[0];
|
||||
$main = [];
|
||||
$count = 0;
|
||||
$senderid_arr = [];
|
||||
$rejected_rows = [];
|
||||
$rejected_rows_filename = public_path('documents/general_files/'. $filename . "_rejected_rows.txt");
|
||||
foreach ($extracted_arr[0] as $key => $value) {
|
||||
if ($value['senderid'] == null) {
|
||||
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
|
||||
continue;
|
||||
}
|
||||
if ($value['direct_mno'] == "YES" && $value['mno_name'] == null) {
|
||||
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
|
||||
continue;
|
||||
}
|
||||
if ($value['direct_mno'] == "NO" && $value['supplier_name'] == null) {
|
||||
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
|
||||
continue;
|
||||
}
|
||||
if ($value['direct_mno'] == "YES" && in_array($value['mno_name'], $network_arr) == true) {
|
||||
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
|
||||
continue;
|
||||
}
|
||||
if ($value['direct_mno'] == "NO" && in_array($value['supplier_name'], $client_arr) == true) {
|
||||
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
|
||||
continue;
|
||||
}
|
||||
$check_duplicate_mno = Models\SenderId::where('senderid', $value['senderid'])
|
||||
->where('mno_name', $value['mno_name'])
|
||||
->first();
|
||||
$check_duplicate_client = Models\SenderId::where('senderid', $value['senderid'])
|
||||
->where('supplier_name', $value['supplier_name'])
|
||||
->first();
|
||||
|
||||
if ($check_duplicate_mno && $value['direct_mno'] == "YES") {
|
||||
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
|
||||
continue;
|
||||
}
|
||||
if ($check_duplicate_client && $value['direct_mno'] == "NO") {
|
||||
file_put_contents($rejected_rows_filename, json_encode($value) . PHP_EOL, FILE_APPEND);
|
||||
continue;
|
||||
}
|
||||
if (strtoupper($value['direct_mno']) == 'YES') {
|
||||
// dd('foo bar');
|
||||
$senderid_arr['senderid'] = $value['senderid'];
|
||||
$senderid_arr['mno_name'] = $value['mno_name'];
|
||||
$senderid_arr['created_by'] = session('current_user.id');
|
||||
$senderid_arr['last_modified_by'] = session('current_user.id');
|
||||
$senderid_arr['remarks'] = $value['remarks'];
|
||||
$senderid_arr['direct_mno'] = 'YES';
|
||||
}
|
||||
else{
|
||||
$senderid_arr['senderid'] = $value['senderid'];
|
||||
$senderid_arr['supplier_name'] = $value['supplier_name'];
|
||||
$senderid_arr['created_by'] = session('current_user.id');
|
||||
$senderid_arr['last_modified_by'] = session('current_user.id');
|
||||
$senderid_arr['remarks'] = $value['remarks'];
|
||||
$senderid_arr['direct_mno'] = 'NO';
|
||||
}
|
||||
|
||||
// dd($senderid_arr);
|
||||
$result = Models\SenderId::create($senderid_arr);
|
||||
// dd($retval);
|
||||
|
||||
}
|
||||
|
||||
$request->session()->put('current_user.rejected_rows_filename', $filename . "_rejected_rows.txt");
|
||||
$rejected = file($rejected_rows_filename);
|
||||
|
||||
// dump(session('current_user.rejected_rows_filename'));
|
||||
// dd('the end');
|
||||
Session::flash('success_message', 'Bulk Sender ID successfully uploaded, review the report file!');
|
||||
return redirect(url('senderids'));
|
||||
}
|
||||
public function getUploadReport($name){
|
||||
$file = public_path('documents/general_files/') . $name;
|
||||
$headers = ['Content-Type' => 'text/plain '];
|
||||
return \Response::download($file, 'Sender ID Upload Report', $headers);
|
||||
}
|
||||
public function getSampleFile(){
|
||||
$file = public_path('documents/general_files/senderid_sample_file.xlsx');
|
||||
|
||||
#$extension = pathinfo($file, PATHINFO_EXTENSION);
|
||||
$headers = ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
|
||||
return \Response::download($file, 'Sender ID Sample Upload File', $headers);
|
||||
}
|
||||
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');
|
||||
|
||||
$networks = \DB::table('network_operators')->Select(\DB::raw('concat(name, " (", country, ")") AS networkvalue, concat(name, " (", country, ")") AS network'))->orderBy('network')->get()->toArray();
|
||||
$network_arr = array_pluck($networks, 'network', 'networkvalue');
|
||||
$direct_mno_arr = ['YES' => 'YES', 'NO' => 'NO'];
|
||||
// dd($network_arr);
|
||||
|
||||
$clients = Models\Client::pluck('name', 'id');
|
||||
$clients = \DB::table('clients')->Select(\DB::raw('concat(name, " (", country, ")") AS clientvalue, concat(name, " (", country, ")") AS client'))->orderBy('client')->get()->toArray();
|
||||
$client_arr = array_pluck($clients, 'client', 'clientvalue');
|
||||
$staffmembers = Models\StaffMember::pluck('name', 'id');
|
||||
$status = ['Pending' => 'Pending', 'Inactive' => 'Inactive', 'Approved' => 'Approved'];
|
||||
|
||||
// $status = ['Pending' => 'Pending', 'Inactive' => 'Inactive', 'Approved' => 'Approved'];
|
||||
$status = [
|
||||
'Applied to MNO' => 'Applied to MNO',
|
||||
'Applied to Aggregator' => 'Applied to Aggregator',
|
||||
'Approved on MNO' => 'Approved on MNO',
|
||||
'Approved on Aggregator' => 'Approved on Aggregator',
|
||||
'Active' => 'Active',
|
||||
'Inactive' => 'InActive'
|
||||
];
|
||||
|
||||
// $data = [
|
||||
// 'page_title' => 'Create Sender ID',
|
||||
// 'network_arr' => $network_arr, G*385058081508uq
|
||||
// 'status' => $status,
|
||||
// 'clients' => $clients,
|
||||
// 'senderid' => $senderid,
|
||||
// 'direct_mno_arr' => $direct_mno_arr,
|
||||
// 'staffmembers' => $staffmembers
|
||||
// ];
|
||||
$data = [
|
||||
'page_title' => 'Create Sender ID',
|
||||
'page_title' => 'Edit Sender ID',
|
||||
'network_arr' => $network_arr,
|
||||
'status' => $status,
|
||||
'clients' => $clients,
|
||||
'clients' => $client_arr,
|
||||
'senderid' => $senderid,
|
||||
'direct_mno_arr' => $direct_mno_arr,
|
||||
'staffmembers' => $staffmembers
|
||||
];
|
||||
|
||||
@@ -139,18 +316,33 @@ class SenderIdController extends Controller
|
||||
|
||||
$request->validate([
|
||||
'senderid' => 'required|max:11',
|
||||
'network_id' => 'required',
|
||||
'mno_name' => 'required_if:direct_mno,YES',
|
||||
'supplier_name' => 'required_if:direct_mno,NO',
|
||||
'status' => 'required',
|
||||
'remarks' => 'sometimes',
|
||||
]);
|
||||
|
||||
// dd($request->all());
|
||||
$senderid = Models\SenderId::findOrFail($id);
|
||||
|
||||
$senderid->senderid = $request->senderid;
|
||||
$senderid->client_id = $request->client_id;
|
||||
$senderid->mno_name = $request->mno_name ?? '';
|
||||
$senderid->status = $request->status;
|
||||
$senderid->network_id = $request->network_id;
|
||||
$senderid->supplier_name = $request->supplier_name ?? '';
|
||||
$senderid->remarks = $request->remarks;
|
||||
$senderid->direct_mno = $request->direct_mno;
|
||||
$senderid->last_modified_by = session('current_user.id');
|
||||
|
||||
// if ($request->direct_mno == 'NO') {
|
||||
// $mno_world_wide = Models\Worldwidemno::find($request->network_id);
|
||||
// // code... save in the network ops with status as non-direct ... user createOrUpdate method
|
||||
// $network_ops_arr['name'] = $mno_world_wide->network;
|
||||
// $network_ops_arr['country'] = $mno_world_wide->country;
|
||||
// $network_ops_arr['name'] = $mno_world_wide->network;
|
||||
// $network_ops_arr['direct_business'] = 'NO'; // $mno_world_wide->network;
|
||||
// $result = Models\NetworkOps::updateOrCreate(['name' => $mno_world_wide->network, 'country' => $mno_world_wide->country, 'direct_business' => 'NO'], $network_ops_arr);
|
||||
// $senderid->network_id = $result->id;
|
||||
// }
|
||||
|
||||
|
||||
$senderid->save();
|
||||
|
||||
|
||||
@@ -19,9 +19,22 @@ class ShortCodesController extends Controller{
|
||||
];
|
||||
return view('shortcodes.index', $data);
|
||||
}
|
||||
public function create(){
|
||||
$country_networks = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS network'))->orderBy('network')->pluck('network', 'network');
|
||||
$client_arr = Models\Client::pluck('name', 'id');
|
||||
$data = [
|
||||
'page_title' => 'New Short Code',
|
||||
'country_network_arr' => $country_networks,
|
||||
'client_arr' => $client_arr,
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
return view('shortcodes.create', $data);
|
||||
}
|
||||
|
||||
public function smsindex(){
|
||||
// $codes_data = Models\ClientShortCode::groupBy('code_type')->get();
|
||||
$country_networks = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS network'))->orderBy('network')->pluck('network', 'network');
|
||||
$client_arr = Models\Client::orderBy('name', 'ASC')->pluck('name', 'id');
|
||||
$codes_data = \DB::table('client_short_codes')
|
||||
->select('code_type', \DB::raw('count(*) as total'))
|
||||
->groupBy('code_type')
|
||||
@@ -44,12 +57,14 @@ class ShortCodesController extends Controller{
|
||||
'type' => 'SMS',
|
||||
'codes_data' => $codes_data,
|
||||
'networks_raw' => array_combine($networks_raw, $networks_raw),
|
||||
'country_network_arr' => $country_networks,
|
||||
'client_arr' => $client_arr,
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
return view('shortcodes.smsindex', $data);
|
||||
}
|
||||
public function getShortCodesJson(Request $request){
|
||||
$this->log_query();
|
||||
//$this->log_query();
|
||||
//$codes_data = Models\ClientShortCode::with('client_info', 'update_info')->where('code_type', 'sms')->orderBy('id', 'DESC')->get();
|
||||
|
||||
$shortcode_arr = \DB::table('client_short_codes')
|
||||
@@ -57,7 +72,7 @@ class ShortCodesController extends Controller{
|
||||
->join('clients', 'clients.id', '=', 'client_short_codes.client_id')
|
||||
->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.monthly_fee', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy')
|
||||
->where('client_short_codes.code_type', 'sms')
|
||||
->orderBy('client_short_codes.shortcode', 'ASC')
|
||||
->orderBy('client_short_codes.created_at', 'DESC')
|
||||
->paginate(15);
|
||||
|
||||
if($request->has('keyword')){
|
||||
@@ -69,7 +84,7 @@ class ShortCodesController extends Controller{
|
||||
->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.monthly_fee', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy')
|
||||
->whereRaw("code_type = '$code_type' AND (client_short_codes.name LIKE '%$keyword%' OR client_short_codes.shortcode LIKE '%$keyword%' OR client_short_codes.status LIKE '%$keyword%' OR client_short_codes.network LIKE '%$keyword%' OR client_short_codes.toll_free LIKE '%$keyword%' OR client_short_codes.monthly_fee LIKE '%$keyword%' OR client_short_codes.launch_date LIKE '%$keyword%' OR client_short_codes.expiry_date LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%')")
|
||||
// ->where('code_type', $code_type)
|
||||
->orderBy('client_short_codes.shortcode', 'ASC')
|
||||
->orderBy('client_short_codes.created_at', 'DESC')
|
||||
->paginate(15);
|
||||
}
|
||||
return response()->json($shortcode_arr);
|
||||
@@ -77,6 +92,8 @@ class ShortCodesController extends Controller{
|
||||
|
||||
public function ussdindex(){
|
||||
// $codes_data = Models\ClientShortCode::groupBy('code_type')->get();
|
||||
$country_networks = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS network'))->orderBy('network')->pluck('network', 'network');
|
||||
$client_arr = Models\Client::orderBy('name', 'ASC')->pluck('name', 'id');
|
||||
$codes_data = \DB::table('client_short_codes')
|
||||
->select('code_type', \DB::raw('count(*) as total'))
|
||||
->groupBy('code_type')
|
||||
@@ -85,8 +102,11 @@ class ShortCodesController extends Controller{
|
||||
'page_title' => 'Short Codes',
|
||||
'type' => 'USSD',
|
||||
'codes_data' => $codes_data,
|
||||
'country_network_arr' => $country_networks,
|
||||
'client_arr' => $client_arr,
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
|
||||
return view('shortcodes.ussdindex', $data);
|
||||
}
|
||||
public function getUssdShortCodesJson(Request $request){
|
||||
@@ -98,7 +118,7 @@ class ShortCodesController extends Controller{
|
||||
->join('clients', 'clients.id', '=', 'client_short_codes.client_id')
|
||||
->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.monthly_fee', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy')
|
||||
->where('client_short_codes.code_type', 'ussd')
|
||||
->orderBy('client_short_codes.shortcode', 'ASC')
|
||||
->orderBy('client_short_codes.created_at', 'DESC')
|
||||
->paginate(15);
|
||||
|
||||
if($request->has('keyword')){
|
||||
@@ -110,7 +130,7 @@ class ShortCodesController extends Controller{
|
||||
->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.monthly_fee', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy')
|
||||
->whereRaw("code_type = '$code_type' AND (client_short_codes.name LIKE '%$keyword%' OR client_short_codes.shortcode LIKE '%$keyword%' OR client_short_codes.status LIKE '%$keyword%' OR client_short_codes.network LIKE '%$keyword%' OR client_short_codes.toll_free LIKE '%$keyword%' OR client_short_codes.monthly_fee LIKE '%$keyword%' OR client_short_codes.launch_date LIKE '%$keyword%' OR client_short_codes.expiry_date LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%')")
|
||||
// ->where('code_type', $code_type)
|
||||
->orderBy('client_short_codes.shortcode', 'ASC')
|
||||
->orderBy('client_short_codes.created_at', 'DESC')
|
||||
->paginate(15);
|
||||
}
|
||||
return response()->json($shortcode_arr);
|
||||
@@ -119,6 +139,8 @@ class ShortCodesController extends Controller{
|
||||
|
||||
public function voiceindex(){
|
||||
// $codes_data = Models\ClientShortCode::groupBy('code_type')->get();
|
||||
$country_networks = \DB::table('network_operators')->Select(\DB::raw('id, concat(name, " (", country, ")") AS network'))->orderBy('network')->pluck('network', 'network');
|
||||
$client_arr = Models\Client::orderBy('name', 'ASC')->pluck('name', 'id');
|
||||
$codes_data = \DB::table('client_short_codes')
|
||||
->select('code_type', \DB::raw('count(*) as total'))
|
||||
->groupBy('code_type')
|
||||
@@ -127,6 +149,8 @@ class ShortCodesController extends Controller{
|
||||
'page_title' => 'Short Codes',
|
||||
'type' => 'Voice',
|
||||
'codes_data' => $codes_data,
|
||||
'country_network_arr' => $country_networks,
|
||||
'client_arr' => $client_arr,
|
||||
'current_user' => session('current_user')
|
||||
];
|
||||
return view('shortcodes.voiceindex', $data);
|
||||
@@ -140,7 +164,7 @@ class ShortCodesController extends Controller{
|
||||
->join('clients', 'clients.id', '=', 'client_short_codes.client_id')
|
||||
->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.monthly_fee','client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy')
|
||||
->where('client_short_codes.code_type', 'voice')
|
||||
->orderBy('client_short_codes.shortcode', 'ASC')
|
||||
->orderBy('client_short_codes.created_at', 'DESC')
|
||||
->paginate(15);
|
||||
|
||||
if($request->has('keyword')){
|
||||
@@ -152,7 +176,7 @@ class ShortCodesController extends Controller{
|
||||
->select('client_short_codes.id', 'client_short_codes.name', 'client_short_codes.shortcode', 'clients.name AS clientName', 'client_short_codes.network', 'client_short_codes.toll_free', 'client_short_codes.monthly_fee', 'client_short_codes.status', 'client_short_codes.remarks', 'client_short_codes.launch_date', 'client_short_codes.expiry_date', 'client_short_codes.last_updated_by', 'auth_users.name AS modifiedBy')
|
||||
->whereRaw("code_type = '$code_type' AND (client_short_codes.name LIKE '%$keyword%' OR client_short_codes.shortcode LIKE '%$keyword%' OR client_short_codes.status LIKE '%$keyword%' OR client_short_codes.network LIKE '%$keyword%' OR client_short_codes.toll_free LIKE '%$keyword%' OR client_short_codes.monthly_fee LIKE '%$keyword%' OR client_short_codes.launch_date LIKE '%$keyword%' OR client_short_codes.expiry_date LIKE '%$keyword%' OR clients.name LIKE '%$keyword%' OR auth_users.name LIKE '%$keyword%')")
|
||||
// ->where('code_type', $code_type)
|
||||
->orderBy('client_short_codes.shortcode', 'ASC')
|
||||
->orderBy('client_short_codes.created_at', 'DESC')
|
||||
->paginate(15);
|
||||
}
|
||||
return response()->json($shortcode_arr);
|
||||
|
||||
@@ -14,6 +14,29 @@ class UtilityController extends Controller
|
||||
public function underconstruction(){
|
||||
return view('utility.underconstruction');
|
||||
}
|
||||
public function migrateSenderids(){
|
||||
$senderid = Models\Senderidold::with('network_info', 'client_info')->where('direct_mno', 'YES')->get();
|
||||
// dd($senderid);
|
||||
$counter = 0;
|
||||
foreach ($senderid as $row) {
|
||||
|
||||
// dd($row);
|
||||
$senderid_arr['senderid'] = $row->senderid;
|
||||
$senderid_arr['created_by'] = $row->created_by;
|
||||
$senderid_arr['last_modified_by'] = $row->last_modified_by;
|
||||
$senderid_arr['remarks'] = $row->remarks;
|
||||
$senderid_arr['mno_name'] = $row->network_info->name . ' (' . $row->network_info->country .')';
|
||||
$senderid_arr['status'] = $row->status;
|
||||
$senderid_arr['direct_mno'] = $row->direct_mno;
|
||||
$senderid_arr['created_at'] = $row->created_at;
|
||||
$senderid_arr['modified_at'] = $row->modified_at;
|
||||
|
||||
$result = Models\SenderId::create($senderid_arr);
|
||||
// dump($result);
|
||||
$counter++;
|
||||
}
|
||||
return ['gip' => 'string', 'counter' => $counter];
|
||||
}
|
||||
public function EmailTest(Mailer $mailer)
|
||||
{
|
||||
dispatch(new SendTestEmail());
|
||||
|
||||
@@ -41,9 +41,13 @@ class UpdateMnoRequest extends FormRequest
|
||||
'contact_person_phone' => 'required',
|
||||
'contract_auto_renew' => 'required',
|
||||
'contract_validity' => 'required',
|
||||
|
||||
'document_one' => 'max:20480|mimes:png,jpg,jpeg,bmp,pdf,doc,docx,xlx,xlsx',
|
||||
'document_two' => 'max:20480|mimes:png,jpg,jpeg,bmp,pdf,doc,docx,xlx,xlsx',
|
||||
'sliding_rate_file' => 'max:10240|mimes:png,jpg,jpeg,bmp,pdf,doc,docx,xlx,xlsx',
|
||||
|
||||
// 'document_one_name' => 'required_with:document_one.*',
|
||||
// 'document_two_name' => 'required_with:document_two.*',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user