public function getServiceform($token1)
 {
     $status = 0;
     $token = explode('===', $token1);
     $lead_id = hotelform::where('token', $token[0])->get();
     // dd($lead_id);
     foreach ($lead_id as $lead) {
         $leadcode = $lead->leadcode;
         if ($lead->token == $token[0]) {
             $status = 1;
         }
     }
     //dd($dealtype);
     if ($status == 1) {
         $dealtype = Deal::where('leadcode', $leadcode)->get();
         foreach ($dealtype as $dealt) {
             $evcode = $dealt->Eventcode;
             # code...
         }
         $vip = vipbooking::where('leadcode', $leadcode)->max('id');
         $event = Event::where('eventcode', $evcode)->get();
         $leadsheet = leadsheet::where('leadcode', $leadcode)->get();
         $benefits = benefits::where('leadcode', $leadcode)->get();
         return View('form/serviceform')->with(array('lead_id' => $lead_id, 'dealtype' => $dealtype, 'event' => $event, 'leadsheet' => $leadsheet, 'benefits' => $benefits, 'vip' => $vip));
     } else {
         echo 'token expired';
     }
 }
 public function getViewlead($leadid)
 {
     $varr = Auth::user()->empid;
     $evarr = User::where('empid', $varr)->get();
     $edetails = Employee::where('emp_ide_id', $varr)->get();
     $mleads = leadsheet::where('leadcat', '=', 'Marketing')->where('id', $leadid)->get();
     $leadscallback = callback::where('leadid', $leadid)->get();
     return View('marketing/viewlead')->with(array('edetails' => $edetails, 'mleads' => $mleads, 'leadscallback' => $leadscallback));
 }
 public function postDelegatedealclose()
 {
     $post = Input::get();
     $editleadid = $post['leadid'];
     $leadcode = $post['leadcode'];
     if ($post['boq'] == '1') {
         $save = leadsheet::where('id', $editleadid)->update(array('boq' => $post['boq']));
         return redirect('initiator/updatenewdeal/' . $editleadid . '');
     }
     if ($post['boq'] == '0') {
         $save = leadsheet::where('id', $editleadid)->update(array('boq' => $post['boq'], 'blowout' => '0', 'status' => '0'));
         return redirect('initiator/blowoutleads/');
     }
 }
 public function getViewdetails($dealid)
 {
     $leadsheet = leadsheet::where('leadcode', $dealid)->get();
     // dd($leadsheet);
     $varr = Auth::user()->empid;
     $evarr = User::where('empid', $varr)->get();
     $emp = Employee::where('emp_ide_id', $varr)->get();
     foreach ($emp as $empp) {
         $fromemail = $empp->email;
     }
     // dd($fromemail);
     $lead_id = Deal::where('leadcode', $dealid)->get();
     foreach ($lead_id as $editlead) {
         $dealid = $editlead->Id;
         $leadcode = $editlead->leadcode;
     }
     // dd($dealid);
     $editlead = vipbooking::where('leadcode', $leadcode)->where('deal_id', $dealid)->where('id', DB::raw("(select max(`id`) from vipbooking)"))->get();
     $delegateinfo = delegatedealinfo::where('leadcode', $leadcode)->where('deal_id', $dealid)->get();
     //dd(count($editlead));
     return View('initiator/viewdetails')->with(array('lead_id' => $lead_id, 'editlead' => $editlead, 'emp' => $emp, 'delegateinfo' => $delegateinfo, 'leadsheet' => $leadsheet));
 }