public function getMrktOfcDriverCount($mrktOfcId)
 {
     $drvCnt = 0;
     $datef = date('Y-m-d');
     $curTime = date('H:m:s');
     $meal_plan = FoodjetsMealPlan::select('id', 'market_office_id')->where(DB::raw("DATE(meal_plan_date)"), $datef)->where('start_time', '<=', $curTime)->where('end_time', '>=', $curTime)->where('active', 'true')->where('market_office_id', $mrktOfcId)->first();
     if (!empty($meal_plan->id)) {
         $drvListIds = TodaysDriversInventory::select('todays_drivers_list_id')->where('foodjets_meal_plan_id', $meal_plan->id)->groupBy('todays_drivers_list_id')->get()->toArray();
         //echo '<pre>';        print_r($drvListIds);die;
         $drvCnt = TodaysDriversList::where('date', $datef)->whereIn('id', $drvListIds)->count();
     }
     return $drvCnt;
 }
Example #2
0
 public function getMenuItems($meal_plan_id)
 {
     $food = array();
     $foodjets_menu_id = FoodjetsMealPlan::where("id", "=", $meal_plan_id)->pluck("foodjets_menu_id");
     //$menu_item_id = FoodjetsMenuItems::select("restaurant_menu_item_id")->where("foodjets_menu_id","=",$foodjets_menu_id)->orderBy(DB::raw("Rand()"))->take(2)->get();
     $menu_item_id = FoodjetsMenuItems::select('restaurant_menu_item.name', 'restaurant_menu_item.description', 'restaurant_menu_item.category', 'restaurant_menu_item.image', 'restaurant_menu_item.selling_price', 'restaurant_menu_item.id', 'foodjets_menu_item.id as foodjets_menu_item_id', 'foodjets_menu_item.extra as extra', 'foodjets_menu_item.unlimited as unlimited')->join('restaurant_menu_item', 'restaurant_menu_item.id', '=', 'foodjets_menu_item.restaurant_menu_item_id')->join('restaurant', 'restaurant.id', '=', 'restaurant_menu_item.restaurant_id')->where('foodjets_menu_item.foodjets_menu_id', '=', $foodjets_menu_id)->orderBy('foodjets_menu_item.meal_serial_no', 'asc')->orderBy(DB::raw("Rand()"))->take(2)->get();
     foreach ($menu_item_id as $val) {
         $obj['food_id'] = $val->foodjets_menu_item_id;
         $obj['food_qty'] = 2;
         $food[] = $obj;
     }
     return $food;
 }
Example #3
0
 public function getDriversForZone($zoneId, $mrktOfcId)
 {
     $drivers = array();
     $datef = date('Y-m-d');
     $curTime = date('H:m:s');
     $meal_plan = FoodjetsMealPlan::select('id', 'market_office_id')->where(DB::raw("DATE(meal_plan_date)"), $datef)->where('start_time', '<=', $curTime)->where('end_time', '>=', $curTime)->where('active', 'true')->where('market_office_id', $mrktOfcId)->first();
     if (!empty($meal_plan->id)) {
         $drvListIds = TodaysDriversInventory::select('todays_drivers_list_id')->where('foodjets_meal_plan_id', $meal_plan->id)->groupBy('todays_drivers_list_id')->get()->toArray();
         //echo '<pre>';        print_r($drvListIds);die;
         $driversIds = TodaysDriversList::select('drivers_id', DB::raw('id as list_id'), DB::raw("{$meal_plan->id} AS meal_plan_id"))->where('date', $datef)->whereIn('id', $drvListIds)->where('market_office_city_delivery_zone_id', $zoneId)->get();
         foreach ($driversIds as $val) {
             $driverInfo = Driver::select(DB::raw('SUBSTRING(CONCAT_WS(" ",first_name,last_name),1,17) AS short_name'), DB::raw('CONCAT_WS(" ",first_name,last_name) AS driver_name'), 'image', 'onfleet_worker_status AS online_status')->where('id', $val['drivers_id'])->first();
             if ($driverInfo['image'] != "" && $driverInfo['image'] != null) {
                 $image = Config::get('images.driver') . $driverInfo['image'];
             } else {
                 $image = "/images/avatar.png";
             }
             if ($driverInfo['online_status'] == "true" && $driverInfo['online_status'] != null) {
                 $online_status = 1;
             } else {
                 $online_status = 0;
             }
             $driverInfo['image'] = $image;
             $driverInfo['online_status'] = $online_status;
             $driverInfo['meal_plan_id'] = $val['meal_plan_id'];
             $driverInfo['list_id'] = $val['list_id'];
             $driverInfo['driver_id'] = $val['drivers_id'];
             $drivers[] = $driverInfo;
         }
     }
     return $drivers;
 }