示例#1
0
 public function getSearch(Request $req)
 {
     if (!$_GET) {
         return redirect()->action('SiteController@getIndex');
     }
     $query = $req->input('q', '');
     $paid = $req->input('paid', 0);
     $place = $req->input('place', '');
     $all_types = EventType::toTransList();
     $types = $req->input('types', []);
     $ilikey = function (string $str) {
         return strtr(" {$str} ", ' ', '%');
     };
     /** @var Builder $db_query */
     $db_query = Event::where('hidden', 0);
     if ($query) {
         $db_query->where('title', 'ilike', $ilikey($query));
     }
     //FIXME: improve this text search
     if ($paid) {
         $db_query->where('free', $paid == -1);
     }
     if ($place) {
         $db_query->where('location', 'ilike', $ilikey($place));
     }
     if ($types) {
         $db_query->whereIn('event_type_id', $types);
     }
     $events = $db_query->get();
     if (sizeof($events) == 1 && $query) {
         return redirect()->to(act('event@details', $events[0]->slug));
     }
     return view('event.search', compact('query', 'paid', 'place', 'all_types', 'types', 'events'));
 }
示例#2
0
 public function show($eventId)
 {
     $event = Event::where('user_id', '=', Auth::user()->id)->find($eventId);
     if (!$event) {
         return $this->respondNotFound('Event does not exist');
     }
     return $this->respond([$event->toArray()]);
 }
 public function eventRegistration(Request $request, $slug)
 {
     $input = $request->all();
     $refNo = uniqid();
     $event = Event::where('slug', $slug)->first();
     // REGISTER A USER
     $user = $this->registerUser($input);
     if (!$user) {
         return redirect()->back()->withInput();
     }
     // REGISTER A USER TO EVENT
     $this->registerUserToEvent($input, $user, $event);
     // RECORD TRANSACTION
     $this->recordTransaction($refNo, '7-Connect', $user, $event);
     // Get payment uri
     $paymentUrl = $this->processPayment($refNo, $slug);
     return redirect()->to($paymentUrl);
 }
示例#4
0
 /**
  * Retrieve all Events of a certain status.
  *
  * @param  Request  $request
  * @param  string  $status
  * @return Collection|Response
  */
 public function indexWithStatus(Request $request, $status)
 {
     try {
         return Event::where('status', $status)->get();
     } catch (Exception $e) {
         return response()->error();
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $events = Event::where('organizer_id', $id)->get();
     if ($events->count() == 0) {
         $organizer = organizer::find($id);
         $organizer->delete();
     } else {
         return back()->withErrors(['No se puede eliminar un organizador con eventos asociados']);
     }
     return redirect('promoter/organizers');
 }
示例#6
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     //
     $events = Event::where('local_id', $id)->get();
     if ($events->count() == 0) {
         $local = Local::find($id);
         $local->delete();
     } else {
         return back()->withErrors(['No se puede eliminar un local con eventos asociados']);
     }
     return redirect('admin/local');
 }
 /**
  * получаем все собыитя для $cardNumber и между двух дат
  *
  * @param $cardNumber
  * @param Carbon $firstDayOfMonth
  * @param Carbon $endDayOfMonth
  * @return Collection
  */
 private function getEventsBetweenDatesAndCardNumber($cardNumber, Carbon $firstDayOfMonth, Carbon $endDayOfMonth)
 {
     $events = Event::where('card_number', $cardNumber)->where([['created_at', '>=', $firstDayOfMonth->toDateTimeString()], ['created_at', '<=', $endDayOfMonth->toDateTimeString()]])->orderBy('created_at')->get();
     return $events;
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id, int $id2
  * @return \Illuminate\Http\Response
  */
 public function showSub($id, $id2)
 {
     $category = Category::findOrFail($id2);
     $events = Event::where("cancelled", 0)->where('publication_date', '<', strtotime(Carbon::now()))->where('category_id', $id2)->whereHas('presentations', function ($query) {
         $query->where('starts_at', '>', time());
     })->paginate(8);
     return view('external.subcategory', ["events" => $events, "category" => $category]);
 }
 public function getEventBySlug($slug)
 {
     $event = Event::where('slug', $slug)->first();
     return $event;
 }
示例#10
0
 public function actionExcel(Request $request)
 {
     $input = $request->all();
     $flagBetweenDates = false;
     $flagFilterAll = false;
     //Condiciones que se pueden dar para filtrar la tabla
     if (empty($input['name']) and empty($input['firstDate']) and empty($input['lastDate'])) {
         $events = Event::all();
     } else {
         if ($input['name'] and empty($input['firstDate']) and empty($input['lastDate'])) {
             $events = Event::where('name', 'LIKE', '%' . $input['name'] . '%')->get();
         } elseif (empty($input['name']) and $input['firstDate'] and $input['lastDate']) {
             $flagBetweenDates = true;
         } elseif ($input['name'] and $input['firstDate'] and $input['lastDate']) {
             $flagFilterAll = true;
         }
     }
     $tickets = Ticket::all();
     $eventInformation = [];
     if ($flagBetweenDates) {
         $fechaIni = strtotime($input['firstDate']);
         $fechaFin = strtotime($input['lastDate']) + 86400;
         //return $fechaFin;
         $eventsDate = Presentation::whereBetween('starts_at', [$fechaIni, $fechaFin])->get();
         foreach ($eventsDate as $eventDate) {
             $event = Event::where('id', '=', $eventDate->event_id)->where('cancelled', '=', 0)->get();
             if (count($event) != 0) {
                 $tickets = Ticket::where('presentation_id', '=', $eventDate->id)->get();
                 $onlineTickets = 0;
                 $presentialTicket = 0;
                 $subTotalOnline = 0;
                 $subTotalPresential = 0;
                 foreach ($tickets as $ticket) {
                     if ($ticket->cancelled != 1) {
                         if (empty($ticket->salesman_id)) {
                             $onlineTickets = $onlineTickets + $ticket->quantity;
                             $subTotalPresential = $subTotalPresential + $ticket->total_price;
                         } else {
                             $presentialTicket = $presentialTicket + $ticket->quantity;
                             $subTotalOnline = $subTotalOnline + $ticket->total_price;
                         }
                     }
                 }
                 array_push($eventInformation, array($event[0]->name, date("d/m/Y", $eventDate->starts_at), $onlineTickets, $subTotalPresential, $presentialTicket, $subTotalOnline, $subTotalPresential + $subTotalOnline));
             }
         }
     } elseif ($flagFilterAll) {
         $fechaIni = strtotime($input['firstDate']);
         $fechaFin = strtotime($input['lastDate']) + 86400;
         //return $fechaFin;
         $eventsDate = Presentation::whereBetween('starts_at', [$fechaIni, $fechaFin])->get();
         foreach ($eventsDate as $eventDate) {
             //return $eventsDate;
             $event = Event::where('name', 'LIKE', '%' . $input['name'] . '%')->where('cancelled', '=', 0)->where('id', '=', $eventDate->event_id)->get();
             if ($event->count() != 0) {
                 $tickets = Ticket::where('presentation_id', '=', $eventDate->id)->get();
                 $onlineTickets = 0;
                 $presentialTicket = 0;
                 $subTotalOnline = 0;
                 $subTotalPresential = 0;
                 foreach ($tickets as $ticket) {
                     if ($ticket->cancelled != 1) {
                         if (empty($ticket->salesman_id)) {
                             $onlineTickets = $onlineTickets + $ticket->quantity;
                             $subTotalPresential = $subTotalPresential + $ticket->total_price;
                         } else {
                             $presentialTicket = $presentialTicket + $ticket->quantity;
                             $subTotalOnline = $subTotalOnline + $ticket->total_price;
                         }
                     }
                 }
                 array_push($eventInformation, array($event[0]->name, date("d/m/Y", $eventDate->starts_at), $onlineTickets, $subTotalPresential, $presentialTicket, $subTotalOnline, $subTotalPresential + $subTotalOnline));
             }
         }
     } else {
         foreach ($events as $event) {
             // pueden ser muchos eventos. Necesito información para llenar la tabla
             //filtro fechas si es necesario
             $eventsDate = Presentation::where('event_id', '=', $event->id)->where('cancelled', '=', 0)->get();
             foreach ($eventsDate as $eventDate) {
                 $tickets = Ticket::where('presentation_id', '=', $eventDate->id)->get();
                 $onlineTickets = 0;
                 $presentialTicket = 0;
                 $subTotalOnline = 0;
                 $subTotalPresential = 0;
                 foreach ($tickets as $ticket) {
                     if (empty($ticket->salesman_id)) {
                         $onlineTickets = $onlineTickets + $ticket->quantity;
                         $subTotalPresential = $subTotalPresential + $ticket->total_price;
                     } else {
                         $presentialTicket = $presentialTicket + $ticket->quantity;
                         $subTotalOnline = $subTotalOnline + $ticket->total_price;
                     }
                 }
                 array_push($eventInformation, array($event->name, date("d/m/Y", $eventDate->starts_at), $onlineTickets, $subTotalPresential, $presentialTicket, $subTotalOnline, $subTotalPresential + $subTotalOnline));
             }
         }
     }
     if ($input['type'] == 1) {
         Excel::create('Reporte de ventas starkticket', function ($excel) use($eventInformation, $flagBetweenDates, $input) {
             $excel->sheet('Reporte de ventas', function ($sheet) use($eventInformation, $flagBetweenDates, $input) {
                 $sheet->mergeCells('A1:G2');
                 $sheet->setCellValue('A1', "Reporte de ventas de tickets");
                 $sheet->cells('A1:G1', function ($cells) {
                     $cells->setAlignment('center');
                     $cells->setValignment('center');
                     $cells->setFontSize(30);
                 });
                 $sheet->mergeCells('A3:G3');
                 if ($flagBetweenDates) {
                     $sheet->setCellValue('A3', 'Fecha desde ' . $input['firstDate'] . '  hasta ' . $input['lastDate']);
                 } else {
                     $sheet->setCellValue('A3', "");
                 }
                 $sheet->cells('A3:G3', function ($cells) {
                     $cells->setAlignment('center');
                     $cells->setValignment('center');
                     $cells->setFontSize(14);
                 });
                 $cantidad = count($eventInformation) + 4;
                 $cellTotal = $cantidad + 1;
                 // comentarios no informativos
                 $ticketsOnline = 0;
                 //indica entradas vendidas online
                 $subTicketsOnline = 0;
                 // indica el subtotal de tickets ONLINE (precio)
                 $ticketsModulo = 0;
                 // indica entradas vendidas modulo
                 $subTicketsModulo = 0;
                 // indica el subtotal de tickets modulo (precio)
                 $totalPrice = 0;
                 // indica el total de ventas
                 foreach ($eventInformation as $eventInfo) {
                     $ticketsOnline = $ticketsOnline + $eventInfo[2];
                     $subTicketsOnline = $subTicketsOnline + $eventInfo[3];
                     $ticketsModulo = $ticketsModulo + $eventInfo[4];
                     $subTicketsModulo = $subTicketsModulo + $eventInfo[5];
                     $totalPrice = $totalPrice + $eventInfo[6];
                 }
                 $sheet->setBorder('B' . $cellTotal . ':G' . $cellTotal, 'thin');
                 $sheet->cells('B' . $cellTotal . ':F' . $cellTotal, function ($cells) {
                     $cells->setFontWeight('bold');
                     //$cells->setBackground('#008000');
                     $cells->setFontColor('#000000');
                     $cells->setAlignment('center');
                     $cells->setValignment('center');
                 });
                 $sheet->setCellValue('B' . $cellTotal, "TOTAL");
                 $sheet->setCellValue('C' . $cellTotal, $ticketsOnline);
                 $sheet->setCellValue('D' . $cellTotal, $subTicketsOnline);
                 $sheet->setCellValue('E' . $cellTotal, $ticketsModulo);
                 $sheet->setCellValue('F' . $cellTotal, $subTicketsModulo);
                 $sheet->setCellValue('G' . $cellTotal, $totalPrice);
                 $sheet->setBorder('A4:G' . $cantidad, 'thin');
                 $sheet->setCellValue('A4', "Nombre del evento");
                 $sheet->setCellValue('B4', "Fecha del evento");
                 $sheet->setCellValue('C4', "Entradas vendidas online");
                 $sheet->setCellValue('D4', "Subtotal");
                 $sheet->setCellValue('E4', "Entradas vendidas módulo");
                 $sheet->setCellValue('F4', "Subtotal");
                 $sheet->setCellValue('G4', "Total");
                 //$cells->setAlignment('center');
                 $sheet->cells('A4:G4', function ($cells) {
                     $cells->setFontWeight('bold');
                     $cells->setBackground('#008000');
                     $cells->setFontColor('#FFFFFF');
                     $cells->setAlignment('center');
                     $cells->setValignment('center');
                 });
                 $sheet->cells('A4:G500', function ($cells) {
                     $cells->setAlignment('center');
                     $cells->setValignment('center');
                 });
                 $sheet->setWidth(array('A' => '30', 'B' => '20', 'C' => '30', 'D' => '15', 'E' => '30', 'F' => '15', 'G' => '15'));
                 $sheet->setHeight(array('1' => '20'));
                 $data = $eventInformation;
                 $sheet->fromArray($data, true, 'A5', true, false);
             });
         })->download('xlsx');
     } else {
         Excel::create('Reporte de ventas starkticket', function ($excel) use($eventInformation, $flagBetweenDates, $input) {
             $excel->sheet('Reporte de ventas', function ($sheet) use($eventInformation, $flagBetweenDates, $input) {
                 $sheet->mergeCells('A1:G2');
                 $sheet->setCellValue('A1', "Reporte de ventas de tickets");
                 $sheet->cells('A1:G1', function ($cells) {
                     $cells->setAlignment('center');
                     $cells->setValignment('center');
                     $cells->setFontSize(30);
                 });
                 $sheet->mergeCells('A3:G3');
                 if ($flagBetweenDates) {
                     $sheet->setCellValue('A3', 'Fecha desde ' . $input['firstDate'] . '  hasta ' . $input['lastDate']);
                 } else {
                     $sheet->setCellValue('A3', "");
                 }
                 $sheet->cells('A3:G3', function ($cells) {
                     $cells->setAlignment('center');
                     $cells->setValignment('center');
                     $cells->setFontSize(14);
                 });
                 $cantidad = count($eventInformation) + 4;
                 $cellTotal = $cantidad + 1;
                 // comentarios no informativos
                 $ticketsOnline = 0;
                 //indica entradas vendidas online
                 $subTicketsOnline = 0;
                 // indica el subtotal de tickets ONLINE (precio)
                 $ticketsModulo = 0;
                 // indica entradas vendidas modulo
                 $subTicketsModulo = 0;
                 // indica el subtotal de tickets modulo (precio)
                 $totalPrice = 0;
                 // indica el total de ventas
                 foreach ($eventInformation as $eventInfo) {
                     $ticketsOnline = $ticketsOnline + $eventInfo[2];
                     $subTicketsOnline = $subTicketsOnline + $eventInfo[3];
                     $ticketsModulo = $ticketsModulo + $eventInfo[4];
                     $subTicketsModulo = $subTicketsModulo + $eventInfo[5];
                     $totalPrice = $totalPrice + $eventInfo[6];
                 }
                 $sheet->setBorder('B' . $cellTotal . ':G' . $cellTotal, 'thin');
                 $sheet->cells('B' . $cellTotal . ':F' . $cellTotal, function ($cells) {
                     $cells->setFontWeight('bold');
                     //$cells->setBackground('#008000');
                     $cells->setFontColor('#000000');
                     $cells->setAlignment('center');
                     $cells->setValignment('center');
                 });
                 $sheet->setCellValue('B' . $cellTotal, "TOTAL");
                 $sheet->setCellValue('C' . $cellTotal, $ticketsOnline);
                 $sheet->setCellValue('D' . $cellTotal, $subTicketsOnline);
                 $sheet->setCellValue('E' . $cellTotal, $ticketsModulo);
                 $sheet->setCellValue('F' . $cellTotal, $subTicketsModulo);
                 $sheet->setCellValue('G' . $cellTotal, $totalPrice);
                 $sheet->setBorder('A4:G' . $cantidad, 'thin');
                 $sheet->setCellValue('A4', "Nombre del evento");
                 $sheet->setCellValue('B4', "Fecha del evento");
                 $sheet->setCellValue('C4', "Entradas vendidas online");
                 $sheet->setCellValue('D4', "Subtotal");
                 $sheet->setCellValue('E4', "Entradas vendidas módulo");
                 $sheet->setCellValue('F4', "Subtotal");
                 $sheet->setCellValue('G4', "Total");
                 //$cells->setAlignment('center');
                 $sheet->cells('A4:G4', function ($cells) {
                     $cells->setFontWeight('bold');
                     $cells->setBackground('#008000');
                     $cells->setFontColor('#FFFFFF');
                     $cells->setAlignment('center');
                     $cells->setValignment('center');
                 });
                 $sheet->cells('A4:G500', function ($cells) {
                     $cells->setAlignment('center');
                     $cells->setValignment('center');
                 });
                 $sheet->setWidth(array('A' => '30', 'B' => '20', 'C' => '30', 'D' => '15', 'E' => '30', 'F' => '15', 'G' => '15'));
                 $sheet->setHeight(array('1' => '20'));
                 $data = $eventInformation;
                 $sheet->fromArray($data, true, 'A5', true, false);
             });
         })->export('pdf');
     }
 }
示例#11
0
 public function promoterHome()
 {
     $userId = Auth::user()->id;
     $events = Event::where("promoter_id", $userId)->whereHas('presentations', function ($query) {
         $query->where('starts_at', '>=', time());
     })->paginate(10);
     return view('internal.promoter.home', ["events" => $events]);
 }
示例#12
0
 public function deleteEvent(Request $request)
 {
     $validator = Validator::make($request->all(), ['event_id' => 'required|exists:events,id']);
     if ($validator->fails()) {
         return $validator->errors()->all();
     }
     $event = Event::where('id', '=', $request->event_id);
     if ($event->count()) {
         $event = $event->first();
     } else {
         return "invalid event";
     }
     $event = Event::where('id', '=', $request->event_id)->first()->delete();
     return "success";
 }
示例#13
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $events = Event::where('promoter_id', Auth::user()->id)->get();
     $accessPromotion = accessPromotion::orderBy('id')->get()->lists('description', 'id');
     return view('internal.promoter.newPromotion', ['events' => $events, 'accessPromotion' => $accessPromotion]);
 }
示例#14
0
 public function destroy(Request $request, $id)
 {
     $v = Event::find($id);
     if ($v) {
         // retrieve image detail prior to deletion
         $images = DB::table('files')->join('event_files', 'files.id', '=', 'event_files.file_id')->where('event_files.event_id', $id)->get();
         $res = Event::where("id", $id)->where('user_id', Auth::user()->id)->delete();
         if ($res) {
             // delete also the images from db and local storage
             if (count($images) > 0) {
                 foreach ($images as $image) {
                     try {
                         $imgFile = File::find($image->file_id);
                         if ($imgFile) {
                             $imgFile->delete();
                             \Illuminate\Support\Facades\File::delete(MyHelper::getImageFromStorage($id, $imgFile->new_filename));
                         }
                     } catch (\Exception $e) {
                         Log::info($e->getMessage());
                     }
                 }
             }
             $request->session()->flash("notif", "Event successfully deleted");
             return ['error' => false];
         } else {
             return ['error' => true, 'message' => 'Failed to delete event!'];
         }
     } else {
         $request->session()->flash("notif", "Event not available!");
         return ['error' => true];
     }
 }
示例#15
0
    public function getCalendar($year, $month)
    {
        $template = '
   {table_open}<table class="calendar" border="0" cellpadding="0" cellspacing="0">{/table_open}

   {heading_row_start}<tr class="calendar-header">{/heading_row_start}

   {heading_previous_cell}<th><a href="{previous_url}">&lt;&lt;</a></th>{/heading_previous_cell}
   {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
   {heading_next_cell}<th><a href="{next_url}">&gt;&gt;</a></th>{/heading_next_cell}

   {heading_row_end}</tr>{/heading_row_end}

   {week_row_start}<tr>{/week_row_start}
   {week_day_cell}<td>{week_day}</td>{/week_day_cell}
   {week_row_end}</tr>{/week_row_end}

   {cal_row_start}<tr>{/cal_row_start}
   {cal_cell_start}<td class="day">{/cal_cell_start}

   {cal_cell_content}<div class="date">{day}</div><div>{content}</div>{/cal_cell_content}
   {cal_cell_content_today}<div class="highlight date">{day}</div><div>{content}</div>{/cal_cell_content_today}

   {cal_cell_no_content}{day}{/cal_cell_no_content}
   {cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today}

   {cal_cell_blank}&nbsp;{/cal_cell_blank}

   {cal_cell_end}</td>{/cal_cell_end}
   {cal_row_end}</tr>{/cal_row_end}

   {table_close}</table>{/table_close}
';
        $config = array('month_type' => 'long', 'day_type' => 'long', 'template' => $template);
        Calendar::initialize($config);
        $array = array();
        foreach (range(1, 31) as $day) {
            $dateN = date('N', strtotime($year . '-' . $month . '-' . str_pad($day, 2, 0, STR_PAD_LEFT)));
            $meetings = Meeting::where('day_index', $dateN)->where('active', 1)->orderBy('meeting_time', 'ASC')->get();
            $meetingString = '<h4>Meetings</h4>';
            if (count($meetings)) {
                foreach ($meetings as $meeting) {
                    $meetingString .= '<p>' . date('g:i a', strtotime($meeting->meeting_time)) . '<br/>' . $meeting->meeting . '</p>';
                }
            } else {
                $meetingString = '<p>No meetings are scehduled for this day.</p>';
            }
            $eventString = '<h4>Events</h4>';
            $events = Event::where('datetime', date('Y-m-d', strtotime($year . '-' . $month . '-' . str_pad($day, 2, 0, STR_PAD_LEFT))))->get();
            if (count($events)) {
                foreach ($events as $event) {
                    $eventString .= '<p>' . $event->description;
                }
            } else {
                $eventString .= '<p>No events are scheduled for this day.</p>';
            }
            $array[$day] = $meetingString . $eventString;
        }
        return $array;
    }
示例#16
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($eventId)
 {
     $tables = Event::where('id', '=', $eventId)->first()->room->tables;
     return $this->respond([$tables]);
 }
示例#17
0
 /**
  * 通过key删除事件.
  *
  * @param string $eventId eventId
  */
 public function distoryByEventKey($eventKey)
 {
     return $this->model->where('key', $eventKey)->delete();
 }
示例#18
0
 public function index()
 {
     $events = Event::where('date', '>=', date("Y-m-d"))->orderBy('date', 'asc')->get();
     return view('events.index', ['events' => $events]);
 }