A ton of progress, search start
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('content')
|
||||
<form id="add-form">
|
||||
<form id="add-form" method="POST" action="{{ route('save') }}">
|
||||
{{ csrf_field() }}
|
||||
<div class="form-row justify-content-md-center">
|
||||
<div class="col-4">
|
||||
<select name="location" class="form-control select2-location">
|
||||
@ -9,29 +10,21 @@
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<input name="books[][barcode]" type="text" class="form-control barcode_input" placeholder="Barcode">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input name="books[][name]" type="text" class="form-control" placeholder="Name">
|
||||
</div>
|
||||
<div class="col">
|
||||
<select name="books[][authors]" class="form-control select2-author" multiple="multiple">
|
||||
</select>
|
||||
</div>
|
||||
<div class="row-container">
|
||||
@if (!empty($old))
|
||||
@foreach ($old as $index => $item)
|
||||
@include('partials/row', [ 'index' => $index, 'item' => $item ])
|
||||
@endforeach
|
||||
@include('partials/row', [ 'index' => count($old), 'item' => [] ])
|
||||
@else
|
||||
@include('partials/row', [ 'index' => 0])
|
||||
@endif
|
||||
</div>
|
||||
<div class="row">
|
||||
<button class="btn btn-primary" name="save" type="submit">
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div id="add-template" class="invisible">
|
||||
<div class="col">
|
||||
<input name="books[][barcode]" type="text" class="form-control barcode_input" placeholder="Barcode">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input name="books[][name]" type="text" class="form-control" placeholder="Name">
|
||||
</div>
|
||||
<div class="col">
|
||||
<select name="books[][authors]" class="form-control select2-author" multiple="multiple">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@include('partials/row', [ 'id' => 'add-template', 'htmlClass' => 'invisible' ])
|
||||
@endsection
|
21
resources/views/index.blade.php
Normal file
21
resources/views/index.blade.php
Normal file
@ -0,0 +1,21 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('content')
|
||||
<table class="table table-compact">
|
||||
<thead>
|
||||
<th>Name</th>
|
||||
<th>Authors</th>
|
||||
<th>Location</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($rows as $row)
|
||||
<tr>
|
||||
<td>{{ $row->name }}</td>
|
||||
<td>{{ $row->authors->pluck('name')->join(', ') }}</td>
|
||||
<td>{{ $row->location->name }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
{{ $rows->links() }}
|
||||
@endsection
|
@ -8,49 +8,20 @@
|
||||
|
||||
<title>{{ config('app.name') }}</title>
|
||||
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="{{ url('css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<link href="{{ mix('css/app.css') }}" rel="stylesheet">
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
|
||||
<link href="{{ url('css/select2-bs4.css') }}" rel="stylesheet">
|
||||
<link href="{{ url('css/app.css') }}" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
<a class="navbar-brand" href="#">{{ config('app.name') }}</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
|
||||
aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/add">Add</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form class="form-inline my-2 my-lg-0">
|
||||
<input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
|
||||
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
</nav>
|
||||
@include('partials/navbar')
|
||||
|
||||
<main role="main" class="container">
|
||||
@yield('content')
|
||||
</main><!-- /.container -->
|
||||
|
||||
<script
|
||||
src="https://code.jquery.com/jquery-3.2.1.min.js"
|
||||
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
|
||||
<script src="{{ url('js/bootstrap.min.js') }}"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
|
||||
<script src="{{ url('js/app.js') }}"></script>
|
||||
<script src="{{ mix('js/app.js') }}"></script>
|
||||
<script src="{{ asset('vendor/datatables/buttons.server-side.js') }}"></script>
|
||||
@stack('scripts')
|
||||
</body>
|
||||
</html>
|
||||
|
22
resources/views/partials/navbar.blade.php
Normal file
22
resources/views/partials/navbar.blade.php
Normal file
@ -0,0 +1,22 @@
|
||||
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
|
||||
<a class="navbar-brand" href="#">{{ config('app.name') }}</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
|
||||
aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/add">Add</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form class="form-inline my-2 my-lg-0" action="{{ route('search') }}">
|
||||
<input name="query" class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search" />
|
||||
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
</nav>
|
20
resources/views/partials/row.blade.php
Normal file
20
resources/views/partials/row.blade.php
Normal file
@ -0,0 +1,20 @@
|
||||
<div {!! !empty($id) ? 'id="' . $id . '" ' : '' !!}class="form-row {{ $htmlClass ?? '' }}" data-index="{{ $index ?? '__INDEX__' }}">
|
||||
<div class="col">
|
||||
<input name="books[{{ $index ?? '__INDEX__' }}][barcode]" type="text" class="form-control barcode_input" placeholder="Barcode" value="{{ $item['barcode'] ?? '' }}">
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<input name="books[{{ $index ?? '__INDEX__' }}][name]" type="text" class="form-control" placeholder="Name" value="{{ $item['name'] ?? '' }}">
|
||||
</div>
|
||||
<div class="col">
|
||||
<select name="books[{{ $index ?? '__INDEX__' }}][authors][]" class="form-control select2-author" multiple="multiple">
|
||||
@if(!empty($item['authors']))
|
||||
@foreach($item['authors'] as $author)
|
||||
<option value="{{ $author }}" selected="selected">{{ $author }}</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<button class="remove-row btn btn-danger">Remove</button>
|
||||
</div>
|
||||
</div>
|
@ -1 +0,0 @@
|
||||
@extends('layouts.main')
|
Reference in New Issue
Block a user