Beispiel #1
0
 public function createRetailer()
 {
     $retailer = new Retailer();
     $retailer->admin_id = 1;
     $retailer->category_id = 1;
     $retailer->name = "asdasdasdad";
     $this->assertTrue($retailer->create());
 }
Beispiel #2
0
 public function createRetailerOnSignUp($user, $data)
 {
     $retailer = new Retailer();
     $retailer->admin_id = $user->id;
     $retailer->category_id = $data['category'];
     $retailer->name = $data['spaname'];
     $retailer->save();
     Activity::log(['contentId' => $retailer->id, 'contentType' => 'Retailer', 'action' => 'Create', 'description' => 'Created a retailer', 'details' => 'Retailer Name: ' . $retailer->name, 'updated' => false]);
 }
 /**
  * Show a list of all the retailers formatted for Datatables.
  *
  * @return Datatables JSON
  */
 public function getData()
 {
     $retailers = Retailer::select(array('retailers.name', 'retailers.id', 'addresses.address', 'company_register_id', 'business_categories.name AS category', 'retailers.website', 'retailers.created_at'))->leftJoin('addresses', 'addresses.id', '=', 'retailers.address_id')->leftJoin('business_categories', 'business_categories.id', '=', 'retailers.category_id');
     return Datatables::of($retailers)->add_column('actions', '<a href="{{{ URL::to(\'admin/retailers/\' . $id . \'/edit\' ) }}}" class="iframe btn btn-xs btn-default">{{{ Lang::get(\'button.edit\') }}}</a>
                             <a href="{{{ URL::to(\'admin/retailers/\' . $id . \'/delete\' ) }}}" class="iframe btn btn-xs btn-danger">{{{ Lang::get(\'button.delete\') }}}</a>
         ')->remove_column('id')->make();
 }
 public function run()
 {
     DB::statement("TRUNCATE TABLE retailers");
     $adminId = User::select('id')->where('username', 'dungho')->first()->id;
     $retailer = new Retailer();
     $retailer->name = 'Minh Toan Graxy';
     $retailer->category_id = 1;
     $retailer->address_id = 1;
     $retailer->admin_id = $adminId;
     $retailer->company_register_id = 'MT00001';
     $retailer->created_at = new DateTime();
     $retailer->updated_at = new DateTime();
     $retailer->save();
     $retailer = new Retailer();
     $retailer->name = 'Phi Lu';
     $retailer->category_id = 1;
     $retailer->address_id = 2;
     $retailer->admin_id = $adminId;
     $retailer->company_register_id = 'PL00001';
     $retailer->created_at = new DateTime();
     $retailer->updated_at = new DateTime();
     $retailer->save();
 }
Beispiel #5
0
 /**
  * Show the form for editing the specified outlet.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($outlet)
 {
     $countries = Country::lists('country', 'id');
     $cities = City::where('country_id', Country::DEFAULT_COUNTRY)->lists('city', 'id');
     $retailers = Retailer::owner()->lists('name', 'id');
     $addresses = Address::select(array('addresses.id', 'addresses.address'))->lists('address', 'id');
     $images = Picture::getByRefId($outlet->id, 'outlet');
     if ($outlet->status == 'active') {
         $title = Lang::get('site/outlets/title.outlet_update');
     } else {
         $title = Lang::get('site/outlets/title.create_a_new_outlet');
     }
     return View::make('site.outlets.edit', compact('countries', 'cities', 'outlet', 'title', 'retailers', 'addresses'))->nest('imageForm', 'site.partials.image.create', ['refId' => $outlet->id, 'type' => 'outlet', 'images' => $images]);
 }
Beispiel #6
0
 public function run()
 {
     DB::statement("TRUNCATE TABLE outlets");
     $adminId = User::select('id')->where('username', 'dungho')->first()->id;
     $retailerMT = Retailer::select('id')->where('company_register_id', 'MT00001')->first()->id;
     $retailerPL = Retailer::select('id')->where('company_register_id', 'PL00001')->first()->id;
     $outlets = array(array('name' => 'Minh Toan Graxy - Spa Beauty', 'outlet_register_id' => 'MTID001', 'website' => 'www.minhtoan.com.vn', 'retailer_id' => $retailerMT), array('name' => 'Minh Toan Graxy - Spa One', 'outlet_register_id' => 'MTID002', 'website' => 'www.minhtoan.com.vn', 'retailer_id' => $retailerMT), array('name' => 'Minh Toan Graxy - Spa Two', 'outlet_register_id' => 'MTID003', 'website' => 'www.minhtoan.com.vn', 'retailer_id' => $retailerMT), array('name' => 'Phi Lu - Spa Beauty', 'outlet_register_id' => 'PLID001', 'website' => 'www.philu.com.vn', 'retailer_id' => $retailerPL));
     foreach ($outlets as $key => $value) {
         $outlet = new Outlet();
         $outlet->name = $value['name'];
         $outlet->address_id = rand(1, 5);
         $outlet->outlet_register_id = $value['outlet_register_id'];
         $outlet->website = $value['website'];
         $outlet->admin_id = $adminId;
         $outlet->description_id = 1;
         $outlet->status = 'active';
         $outlet->retailer_id = $value['retailer_id'];
         $outlet->save();
     }
 }
Beispiel #7
0
 public static function getKeyValueData()
 {
     return array(null => 'Select A Spa') + Retailer::lists('name', 'id');
 }
Beispiel #8
0
 public function postBook()
 {
     $response = null;
     $Bill = null;
     $spa_id = Input::get('spaName');
     $outlet_id = Input::get('spaLocation');
     $service_id = Input::get('serviceName');
     $apptDate = Input::get('apptDate');
     $apptTime = Input::get('timeSlot');
     if (!empty($spa_id) && !empty($outlet_id) && !empty($service_id) && !empty($apptDate)) {
         $apptDateTime = strtotime($apptDate . " " . $apptTime);
         $service = Service::find($service_id);
         $response = array("retailerName" => Retailer::find($spa_id)->name, "outletName" => Outlet::find($outlet_id)->name, "serviceName" => $service->name . " (" . $service->time_operate . " mins)", "apptDateTime" => $apptDateTime, "price" => $service->price);
         if (!Auth::user()) {
             return View::make('site/user/book', compact('response', 'Bill'));
         }
         $deal = Deal::where('service_id', '=', $service_id)->where('deal_type', '=', 'Service')->first();
         if ($deal == null) {
             $deal = new Deal();
             $deal->service_id = $service_id;
             $deal->deal_type = 'Service';
             $deal->title = $service->name;
             $deal->amount = $service->price;
             $deal->discount = 0;
             $deal->special_request = "";
             $deal->status = "active";
             $deal->save();
         }
         $Bill = new DealTransaction();
         $Bill->deal_id = $deal->id;
         $Bill->consumer_id = Auth::user()->id;
         $Bill->consumer_email = Auth::user()->email;
         $Bill->qty = 1;
         $Bill->amount = $service->price;
         $Bill->total = $service->price;
         $Bill->save();
         return View::make('site/user/book', compact('response', 'Bill'));
     }
     return Redirect::to('/');
 }