Skip to content

Commit

Permalink
Error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhavan committed Dec 2, 2018
1 parent 7e0ea4d commit 305f1e0
Show file tree
Hide file tree
Showing 14 changed files with 335 additions and 113 deletions.
1 change: 1 addition & 0 deletions app/Http/Controllers/InsuranceCompanyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function contributionsUpdate(InsuranceCompany $insuranceCompany)
'contribution' => ['array', new KeyIsID(Medicine::class), new KeyUnique()],
'contribution.*' => 'nullable|numeric|min:0|regex:/^\d+(\.[\d]{1,2})?$/',
];
$this->validate(request(), $rules);

foreach(Medicine::all() as $medicine)
{
Expand Down
Binary file added config/gitkraken-amd64.deb
Binary file not shown.
4 changes: 3 additions & 1 deletion public/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ a:visited {
color: #9FADBD;
}


.errorMessage {
color:red;
}
23 changes: 23 additions & 0 deletions public/web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
69 changes: 69 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<p align="center"><img src="https://laravel.com/assets/img/components/logo-laravel.svg"></p>

<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
</p>

## About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as:

- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).

Laravel is accessible, yet powerful, providing tools needed for large, robust applications.

## Learning Laravel

Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of any modern web application framework, making it a breeze to get started learning the framework.

If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 1100 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library.

## Laravel Sponsors

We would like to extend our thanks to the following sponsors for helping fund on-going Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell):

- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[British Software Development](https://www.britishsoftware.co)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- [UserInsights](https://userinsights.com)
- [Fragrantica](https://www.fragrantica.com)
- [SOFTonSOFA](https://softonsofa.com/)
- [User10](https://user10.com)
- [Soumettre.fr](https://soumettre.fr/)
- [CodeBrisk](https://codebrisk.com)
- [1Forge](https://1forge.com)
- [TECPRESSO](https://tecpresso.co.jp/)
- [Runtime Converter](http://runtimeconverter.com/)
- [WebL'Agence](https://weblagence.com/)
- [Invoice Ninja](https://www.invoiceninja.com)
- [iMi digital](https://www.imi-digital.de/)
- [Earthlink](https://www.earthlink.ro/)
- [Steadfast Collective](https://steadfastcollective.com/)
- [We Are The Robots Inc.](https://watr.mx/)
- [Understand.io](https://www.understand.io/)

## Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).

## Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.

## License

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
7 changes: 7 additions & 0 deletions resources/views/cart/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
<td>
{{-- @todo error class when $cartItem->verifyStock() == false --}}
<input type="number" name="medicines[{{ $loop->index }}][quantity]" value="{{ $cartItem->quantity }}"> ks
@if ($errors->has("medicines.0.quantity"))
@foreach ($errors->get("medicines.0.quantity") as $error)
<div class="errorMessage">
<strong>{{$error}}</strong>
</div>
@endforeach
@endif
<input type="hidden" name="medicines[{{ $loop->index }}][id]" value="{{ $cartItem->medicine->id }}">
</td>
<td>
Expand Down
96 changes: 55 additions & 41 deletions resources/views/insurance_companies/contributions.blade.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,61 @@
@extends('layouts.app')

@section('content')
<h1>Hrazení pojišťovny: {{ $insuranceCompany->name }} ({{ $insuranceCompany->code }})</h1>
<div class="container">
<h1>Hrazení pojišťovny: {{ $insuranceCompany->name }} ({{ $insuranceCompany->code }})</h1>

{{$errors}}

@if(empty($medicines))
<p>V databázi nejsou žádné léky.</p>
@else
<form method="post" action="{{route('insurance_companies.contributions.update', $insuranceCompany)}}">
@csrf
<table>
<thead>
<th>
Název léku
</th>
<th>
Cena celkem
</th>
<th>
Hrazeno
</th>
</thead>
<tbody>
@foreach($medicines as $medicine)
<tr>
<td>{!! $medicine->nameLink() !!}</td>
<td>{{ $medicine->price }} Kč</td>
<td>
<input type="number"
name="contribution[{{$medicine->id}}]"
min="0"
max="{{$medicine->price}}"
step="0.01"
value="{{ old('contribution['.$medicine->id.']', ($medicine->insuranceCompanies->count() ? $medicine->insuranceCompanies[0]->pivot->amount : null)) }}"
>
</td>
</tr>
@endforeach
</tbody>
</table>
<button type="send">Aktualizovat</button>
</form>
@if(empty($medicines))
<p>V databázi nejsou žádné léky.</p>
@else
<form method="post" action="{{route('insurance_companies.contributions.update', $insuranceCompany)}}">
@csrf
<table>
<thead>
<th>
Název léku
</th>
<th>
Cena celkem
</th>
<th>
Hrazeno
</th>
</thead>
<tbody>
<?php
$index = 0;
?>
@foreach($medicines as $medicine)
<?php
$index++;
?>
<tr>
<td>{!! $medicine->nameLink() !!}</td>
<td>{{ $medicine->price }} Kč</td>
<td>
<input type="number"
name="contribution[{{$medicine->id}}]"
min="0"
max="{{$medicine->price}}"
step="0.01"
value="{{ old('contribution['.$medicine->id.']', ($medicine->insuranceCompanies->count() ? $medicine->insuranceCompanies[0]->pivot->amount : null)) }}"
>
<br>
@if ($errors->has("contribution.{$index}"))
@foreach ($errors->get("contribution.{$index}") as $error)
<div class="errorMessage">
<strong>{{$error}}</strong>
</div>
@endforeach
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
<button type="send">Aktualizovat</button>
</form>
</div>
@endif
@endsection
6 changes: 5 additions & 1 deletion resources/views/insurance_companies/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<?php
use App\InsuranceCompany;
?>

@extends('layouts.app')

@section('content')
<div class="container">
<h1>Pojišťovny v databázi:</h1>

{{$errors}}
<!--{{$errors}}-->

@if(empty($insuranceCompanies))
<p>V databázi nejsou žádné pojišťovny.</p>
Expand Down
94 changes: 56 additions & 38 deletions resources/views/insurance_companies/sales.blade.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,63 @@
@extends('layouts.app')

@section('content')
<h1>Výkazy pojišťovny: {{ $insuranceCompany->name }} ({{ $insuranceCompany->code }})</h1>
<div class="container">
<h1>Výkazy pojišťovny: {{ $insuranceCompany->name }} ({{ $insuranceCompany->code }})</h1>

<form method="get" action="{{route('insurance_companies.sales', $insuranceCompany)}}">
<div>Od <input type="text" id="datepicker-from" name="from" value="{{$from}}"></div>
<div>Do <input type="text" id="datepicker-to" name="to" value="{{$to}}"></div>
<button type="send">Zobrazit</button>
</form>

@if(empty($reports))
<p>V období od {{$from}} do {{$to}} není pro danou pojišťovnu evidován žádný výkaz.</p>
@else
<table>
<thead>
<th>Období</th>
<th>Výše hrazení</th>
</thead>
<tbody>
@foreach($reports as $report)
<tr>
<td>
{{$report['date']}}
</td>
<td>
{{$report['price']}}
</td>
</tr>
<form method="get" action="{{route('insurance_companies.sales', $insuranceCompany)}}">
<div>Od: <input type="text" id="datepicker-from" name="from" value="{{$from}}"></div>
@if ($errors->has("from"))
@foreach ($errors->get("from") as $error)
<div class="errorMessage">
<strong>{{$error}}</strong>
</div>
@endforeach
@endif
<div>Do: <input type="text" id="datepicker-to" name="to" value="{{$to}}"></div>
@if ($errors->has("to"))
@foreach ($errors->get("to") as $error)
<div class="errorMessage">
<strong>{{$error}}</strong>
</div>
@endforeach
</tbody>
</table>
Celkem: <strong>{{$sum}} Kč</strong>
@endif
@endif
<br>
<button type="send" class="btn btn-success btn-lg">Zobrazit</button>
</form>

<br>
@if(empty($reports))
<p>V období od {{$from}} do {{$to}} není pro danou pojišťovnu evidován žádný výkaz.</p>
@else
<table>
<thead>
<th>Období</th>
<th>Výše hrazení</th>
</thead>
<tbody>
@foreach($reports as $report)
<tr>
<td>
{{$report['date']}}
</td>
<td>
{{$report['price']}}
</td>
</tr>
@endforeach
</tbody>
</table>
Celkem: <strong>{{$sum}} Kč</strong>
@endif

@push('scripts')
<script>
$(function()
{
$('#datepicker-from').datepicker($.datepicker.regional['cs']);
$('#datepicker-to').datepicker($.datepicker.regional['cs']);
});
</script>
@endpush
@push('scripts')
<script>
$(function()
{
$('#datepicker-from').datepicker($.datepicker.regional['cs']);
$('#datepicker-to').datepicker($.datepicker.regional['cs']);
});
</script>
@endpush
</div>
@endsection
23 changes: 18 additions & 5 deletions resources/views/medicines/edit_or_create.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
use App\Classes\Cart;
use App\Branch;
use App\InsuranceCompany;
if(isset($medicine))
$mode = 'edit';
Expand All @@ -20,16 +21,28 @@

<div>
Název:<br>
<input type="text" name="name" placeholder="Název" value="{{ old('name', $mode == 'edit' ? $medicine->name : null) }}" required>
<br>
<br>
<input type="text" name="name" placeholder="Název" value="{{ old('name', $mode == 'edit' ? $medicine->name : null)}}" required>
@if ($errors->has("name"))
@foreach ($errors->get("name") as $error)
<div class="errorMessage">
<strong>{{$error}}</strong>
</div>
@endforeach
@endif
</div>
<br>
<div>
Cena:<br>
<input type="number" name="price" placeholder="Cena > 0" value="{{ old('price', $mode == 'edit' ? $medicine->price : null ) }}" min=0 step=0.01 required>
<br>
<br>
@if ($errors->has("price"))
@foreach ($errors->get("price") as $error)
<div class="errorMessage">
<strong>{{$error}}</strong>
</div>
@endforeach
@endif
</div>
<br>
<div>
Nutnost předpisu:
<select name="prescription">
Expand Down
Loading

0 comments on commit 305f1e0

Please sign in to comment.