Skip to content

Commit

Permalink
Created part of new Site to choose Places
Browse files Browse the repository at this point in the history
  • Loading branch information
mjakubowski99 committed Oct 6, 2020
1 parent a011ff8 commit 5c7bea6
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 12 deletions.
88 changes: 88 additions & 0 deletions app/Http/Controllers/ChoosePlacesController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class ChoosePlacesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{

}

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$arrive_data = json_decode( $request->input('arrive_data') );
$arrive_data = collect( $arrive_data );
$arrive_ids = $arrive_data->pluck('arrive_id')->groupBy('arrive_id');

}

/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}

/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use App\PathFinding\PathFinder;
use DateTime;

class PlacesController extends Controller
class TraceFindController extends Controller
{
/**
* Display a listing of the resource.
Expand Down Expand Up @@ -50,12 +50,10 @@ public function store(TicketRequest $request)
$pathFinder = new PathFinder();

$founded_arrives = $pathFinder->findPath($dateOfJourney, $trace_begin, $trace_end);

$date_begin = collect();
$date_end = collect();
$trains = collect();


return view('chooseTrace.index', [
'founded_arrives' => $founded_arrives,
'trace_begin' => $trace_begin,
Expand Down
1 change: 1 addition & 0 deletions resources/views/choosePlaces/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@extends('choosePlaces.layout')
33 changes: 33 additions & 0 deletions resources/views/choosePlaces/layout.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">

<title>{{ config('app.name', 'Laravel') }}</title>

<!-- Scripts -->
<script src="{{ asset('js/app.js') }}" defer></script>

<!-- Fonts -->
<link rel="dns-prefetch" href="//fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">

<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body class="text-light" style="background-color: #1a1a1a;">
<div id="app">
<navbar-component main-href="{{url('/')}}" home-href="{{url('home')}}" class="bg-success"> </navbar-component>

<div class="card col-sm-12 mt-1 col-md text-center bg-dark">

</div>

</div>

</body>
</html>
25 changes: 21 additions & 4 deletions resources/views/chooseTrace/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,34 @@
<div id="app">
<navbar-component main-href="{{url('/')}}" home-href="{{url('home')}}" class="bg-success"> </navbar-component>



<div class="row mt-5 ml-5 mr-5">
@foreach($founded_arrives as $founded_arrive )
<div class="card col-sm-12 mt-1 col-md text-center bg-dark">
<h5 class="card-header"> @yield('calendar-icon') Lublin-Warszawa</h5>
<h5 class="card-header"> @yield('calendar-icon') {{$trace_begin}}-{{$trace_end}}</h5>
<div class="card-body pb-5">
<h3 class="card-header">Pociąg tlk200</h5>
<h3 class="card-header">Pociąg</h5>
<p class="card-text h1"> 11:20 <button class="btn btn-primary"> >> </button> 15:30</p>
<a href="#" class="btn btn-success">Zobacz trasę</a>
<a href="#" class="btn btn-success">Kup bilet</a>
<a class="btn btn-success" data-toggle="modal" data-target="#exampleModal" >Zobacz trasę</a>
<br/>
<form action="{{route('choosePlace')}}" method="POST">
@csrf
<input type="hidden" name="arrive_data" value="{{ json_encode($founded_arrive) }}" />
<label for="howManyPlaces"> Wpisz ilosc miejsc </label>
<input name="howManyPlaces" class="form-control" style="width: 50%; margin-left: auto; margin-right: auto;"/>
<button type="submit" class="btn btn-success"> Wybierz miejsce </button>
</form>
</div>

Przez:
<br/>
@foreach($founded_arrive as $f_arrive)
{{ $f_arrive->ID_STATION }} Odjezdza o: {{ $f_arrive->begin_date }}
<br/>
@endforeach
</div>

@endforeach
</div>

Expand Down
12 changes: 7 additions & 5 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@

Route::get('customizeTrain', 'CustomizeController@index')->middleware('adminCheck')->name('customizeTrain');
Route::post('customizeTrain', 'CustomizeController@store')->middleware('adminCheck');

Route::post('customizePlaces', 'CustomizePlaces@store')->middleware('adminCheck')->name('customizePlaces');
Route::get('destroy', 'CustomizePlaces@destroy')->middleware('adminCheck');

Route::get('customizeStation', 'StationController@index')->middleware('adminCheck');
Route::post('customizeStation', 'StationController@store')->middleware('adminCheck');
Route::get('destroyStations', 'StationController@destroy')->middleware('adminCheck');

Route::get('customizeArrives', 'ArrivesController@index')->middleware('adminCheck');
Route::post('customizeArrives', 'ArrivesController@store')->middleware('adminCheck')->name('customizeArrives');

Route::get('getStations/{trace_name}', 'ArrivesController@get');
Route::get('buyTicket', 'PlacesController@index')->name('buyTicket');
Route::post('buyTicket', 'PlacesController@store');
Route::get('test', 'PlacesController@forDate_18september2020_hour_1150_GiveGoodResponse');
Route::get('buyTicket', 'TraceFindController@index')->name('buyTicket');

Route::post('buyTicket', 'TraceFindController@store');

Route::post('choosePlace', 'ChoosePlacesController@store')->name('choosePlace');

0 comments on commit 5c7bea6

Please sign in to comment.