RacingCustomerController.php 4.39 KB
<?php namespace App\Http\Controllers;

use Auth;
use Input;
use Config;
use Session;
use App\Http\Controllers;
use App\Http\Requests;
use Illuminate\Http\Request;
use DB;
use Log;
use App\Models\Group;
use App\Models\User;
use App\Models\CRMCall;

class RacingCustomerController extends Controller 
{
	public function __construct()
	{
		$this->middleware('auth');
		//$this->middleware('module_access');
	}
	
	public function saveRacingCustomer()
	{
	//$product_code = Input::get("product_code");
	$pb_name = Input::get("pb_name");
	$pb_code = Input::get("pb_code");
	$pb_landline_contact_no = Input::get("pb_landline_contact_no");
	$supervisor_mail_id = Input::get("supervisor_mail_id");
	$group_id = Input::get("group_id");
	$group_id_name = Input::get("group_id_name");
	$cust_id = Input::get("cust_id");
	$cust_name = Input::get("cust_name");
	$relationship_with_group_id = Input::get("relationship_with_group_id");
	$cust_id_next = Input::get("cust_id_next");
	$cust_name_next = Input::get("cust_name_next");
	$relationship_with_group_id_next = Input::get("relationship_with_group_id_next");
	$new_group_addition_to_group = Input::get("new_group_addition_to_group");
	$racing_from = Input::get("racing_from");

	if($pb_name=="")return "<script>simpleNotification('error','topRight','please enter pb name');</script>";
    if($pb_code=="")return "<script>simpleNotification('error','topRight','please enter pb code');</script>";
    if($pb_landline_contact_no=="")return "<script>simpleNotification('error','topRight','please enter PB landline Contact No.');</script>";
    if($supervisor_mail_id=="")return "<script>simpleNotification('error','topRight','please enter Supervisor Mail ID');</script>";
    if($group_id=="")return "<script>simpleNotification('error','topRight','please enter Group ID');</script>";
    if($group_id_name=="")return "<script>simpleNotification('error','topRight','please enter Group ID Name');</script>";
    if($cust_id=="")return "<script>simpleNotification('error','topRight','please enter Cust ID');</script>";
    if($cust_name=="")return "<script>simpleNotification('error','topRight','please enter Cust Name');</script>";
    if($relationship_with_group_id=="")return "<script>simpleNotification('error','topRight','please enter Relationship With Group ID');</script>";
    if($cust_id_next=="")return "<script>simpleNotification('error','topRight','please enter Cust ID');</script>";
    if($cust_name_next=="")return "<script>simpleNotification('error','topRight','please enter Cust Name');</script>";
    if($relationship_with_group_id_next=="")return "<script>simpleNotification('error','topRight','please enter Relationship With Group ID');</script>";
    if($new_group_addition_to_group=="")return "<script>simpleNotification('error','topRight','please select Grouping');</script>";
    if($racing_from=="")return "<script>simpleNotification('error','topRight','please enter Racing From');</script>";

	$setracingCutomer = array();

	$setracingCutomer[]="date='".date("Y-m-d H:i:s")."'";
	//$setracingCutomer[]="product_code='$product_code'";
	$setracingCutomer[]="pb_name='$pb_name'";
	$setracingCutomer[]="pb_code='$pb_code'";
	$setracingCutomer[]="pb_landline_contact_no='$pb_landline_contact_no'";
	$setracingCutomer[]="supervisor_mail_id='$supervisor_mail_id'";
	$setracingCutomer[]="group_id='$group_id'";
	$setracingCutomer[]="group_id_name='$group_id_name'";
	$setracingCutomer[]="cust_id='$cust_id'";
	$setracingCutomer[]="cust_name='$cust_name'";
	$setracingCutomer[]="relationship_with_group_id='$relationship_with_group_id'";
	$setracingCutomer[]="cust_id_next='$cust_id_next'";
	$setracingCutomer[]="cust_name_next='$cust_name_next'";
	$setracingCutomer[]="relationship_with_group_id_next='$relationship_with_group_id_next'";
	$setracingCutomer[]="new_group_addition_to_group='$new_group_addition_to_group'";
	$setracingCutomer[]="racing_from='$racing_from'";

	$setracingCut=implode(",",$setracingCutomer);

	DB::statement("insert into potentialcustomer_details set $setracingCut");

		return "<script>simpleNotification('success','topRight','Customer Details Saved Successfully');</script>";
	}
   public function updateracingcust()
   {
   	$id=Input::get("id");
   	$status=Input::get("supervisorstatus");

   	DB::statement("update potentialcustomer_details set supervisor_status='$status' where id=$id");

		return "<script>simpleNotification('success','topRight','Supervisor status Saved Successfully');</script>";
   }
	
}