108 lines
4.8 KiB
PHP
108 lines
4.8 KiB
PHP
{{-- The @extends directive informs Blade that we are using the layout we defined in resources/views/layouts/app.blade.php. --}}
|
|
{{-- All of the content between @section('content') and @endsection will be injected into the location of the @yield('content') directive within the app.blade.php layout. --}}
|
|
{{-- The @include('common.errors') directive will load the template located at resources/views/common/errors.blade.php. --}}
|
|
|
|
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
<div class="container">
|
|
<div class="col-sm-offset-2 col-sm-8">
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading panel-search">
|
|
Search & Add City
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
<!-- Display Validation Errors -->
|
|
@include('common.errors')
|
|
|
|
<!-- New City Form -->
|
|
<form action="{{ url('city') }}" method="POST" class="form-horizontal">
|
|
@csrf
|
|
|
|
<!-- City Name -->
|
|
<div class="form-group">
|
|
<label for="city-name" class="col-sm-3 control-label">City</label>
|
|
|
|
<div class="col-sm-6">
|
|
<input type="text" name="name" id="city-name" class="form-control"
|
|
value="{{ old('city') }}">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add City Button -->
|
|
<div class="form-group">
|
|
<div class="col-sm-offset-3 col-sm-6">
|
|
<button type="submit" class="btn btn-default">
|
|
<i class="fa fa-btn fa-plus"></i>Add
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Current Cities -->
|
|
@if ($cities->isNotEmpty())
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
Current Cities
|
|
</div>
|
|
<div class="panel-heading">
|
|
|
|
<form action="{{ url('refresh') }}" method="POST">
|
|
@csrf
|
|
<button type="submit" id="refresh">
|
|
Refresh
|
|
</button>
|
|
</form>
|
|
|
|
</div>
|
|
<div class="panel-body">
|
|
<table class="table table-striped city-table">
|
|
<tbody>
|
|
|
|
@foreach ($cities as $city)
|
|
<tr>
|
|
<td class="table-text">
|
|
<div class="widget">
|
|
<div class="panel">
|
|
|
|
<form action="{{ url('city/' . $city->id) }}" method="POST">
|
|
@csrf
|
|
@method('delete')
|
|
<button type="submit" id="x">
|
|
X
|
|
</button>
|
|
</form>
|
|
|
|
<div class="city">
|
|
{{ "{$city->location_name}, {$city->location_country}" }}
|
|
</div>
|
|
|
|
<div class="temp">
|
|
<img src="{{ $city->weather_icon }}" alt="" width="60">
|
|
{{ $city->current_temperature }}°
|
|
</div>
|
|
|
|
<div class="weather-description">{{ $city->weather_description }}</div>
|
|
|
|
</div>
|
|
|
|
<div>Wind Speed: {{ $city->wind_speed }} KM/h from {{ $city->wind_dir }}
|
|
|
|
</div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endsection |