first commit

This commit is contained in:
2023-10-27 19:59:05 +03:00
commit 6b20c329a9
93 changed files with 11807 additions and 0 deletions

0
resources/css/app.css Executable file
View File

1
resources/js/app.js Executable file
View File

@ -0,0 +1 @@
import './bootstrap';

32
resources/js/bootstrap.js vendored Executable file
View File

@ -0,0 +1,32 @@
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from 'laravel-echo';
// import Pusher from 'pusher-js';
// window.Pusher = Pusher;
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: import.meta.env.VITE_PUSHER_APP_KEY,
// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',
// wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,
// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
// enabledTransports: ['ws', 'wss'],
// });

View File

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document create</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-2">
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left mb-2">
<h2>Add Document</h2>
</div>
<div class="pull-right">
<a class="btn btn-primary" href="{{ route('documents.show') }}"> Back</a>
</div>
</div>
</div>
@if(session('status'))
<div class="alert alert-success mb-1 mt-1">
{{ session('status') }}
</div>
@endif
<form action="{{ route('documents.store') }}" method="POST" enctype="multipart/form-data">
@csrf
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<strong>Document date:</strong>
<input type="date" name="date" class="form-control" placeholder="Product date">
@error('date')
<div class="alert alert-danger mt-1 mb-1">{{ $message }}</div>
@enderror
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<strong>Document type:</strong>
<select class="form-control" name="type">
@foreach(\App\Models\Document::getTitlesOfTypes() as $k => $value)
<option value="{{$k}}">{{$value}}</option>
@endforeach
</select>
</div>
</div>
<div class="row" style="padding-top: 20px">
<div class="col-xs-12 col-sm-12 col-md-12">
<label>Product quantity</label>
<input type="number" name="quantity" class="form-control">
@error('quantity')
<div class="alert alert-danger mt-1 mb-1">{{ $message }}</div>
@enderror
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<label>Product article</label>
<select class="form-control" name="product_id">
@foreach(\App\Models\Product::all() as $product)
<option value="{{$product->id}}">{{$product->article}}</option>
@endforeach
</select>
</div>
</div>
<button type="submit" class="btn btn-primary ml-3">Submit</button>
</form>
</div>
</body>
</html>

View File

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Documents</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-2">
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left">
<h2>Documents</h2>
</div>
<div class="pull-right mb-2">
<a class="btn btn-success" href="{{ route('products.index') }}"> Товары</a>
</div>
<div class="pull-right mb-2">
<a class="btn btn-success" href="{{ route('documents.create') }}"> Create Document</a>
</div>
</div>
</div>
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<table class="table table-bordered">
<thead>
<tr>
<th>Date</th>
<th>Type</th>
<th>Status</th>
<th>products</th>
</tr>
</thead>
<tbody>
@foreach ($documents as $document)
<tr>
<td>{{ $document->date }}</td>
<td>{{ $document->type == \App\Models\Document::TYPE_TO ? 'Поступление' : 'Расход' }}</td>
<td>{{ $document->status == 0 ? 'Not Applied' : 'Applied' }}</td>
<td>
@foreach($document->documentProducts as $documentProduct)
артикул - {{$documentProduct->product->article}}, было до: {{$documentProduct->past_quantity}}, количество: {{$documentProduct->quantity}}
@endforeach
</td>
<td>
@if($document->status == \App\Models\Document::STATUS_NOT_APPLIED)
<form action="/documents/apply/{{$document->id}}" method="POST">
@csrf
@method('POST')
<button type="submit" class="btn btn-danger">apply</button>
</form>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
{!! $documents->links() !!}
</div>
</body>
</html>

View File

@ -0,0 +1,71 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Product create</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-2">
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left mb-2">
<h2>Add product</h2>
</div>
<div class="pull-right">
<a class="btn btn-primary" href="{{ route('products.index') }}"> Back</a>
</div>
</div>
</div>
@if(session('status'))
<div class="alert alert-success mb-1 mt-1">
{{ session('status') }}
</div>
@endif
<form action="{{ route('products.store') }}" method="POST" enctype="multipart/form-data">
@csrf
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<strong>Product Name:</strong>
<input type="text" name="name" class="form-control" placeholder="Product Name">
@error('name')
<div class="alert alert-danger mt-1 mb-1">{{ $message }}</div>
@enderror
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Product article:</strong>
<input type="text" name="article" class="form-control" placeholder="Product article">
@error('article')
<div class="alert alert-danger mt-1 mb-1">{{ $message }}</div>
@enderror
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Product Price:</strong>
<input type="text" name="price" class="form-control" placeholder="Company Price">
@error('price')
<div class="alert alert-danger mt-1 mb-1">{{ $message }}</div>
@enderror
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Product quantity:</strong>
<input type="number" name="quantity" class="form-control" placeholder="Company quantity">
@error('quantity')
<div class="alert alert-danger mt-1 mb-1">{{ $message }}</div>
@enderror
</div>
</div>
<button type="submit" class="btn btn-primary ml-3">Submit</button>
</div>
</form>
</div>
</body>
</html>

View File

@ -0,0 +1,68 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Edit Product</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-2">
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left">
<h2>Edit Product</h2>
</div>
<div class="pull-right">
<a class="btn btn-primary" href="{{ route('products.index') }}" enctype="multipart/form-data">
Back</a>
</div>
</div>
</div>
@if(session('status'))
<div class="alert alert-success mb-1 mt-1">
{{ session('status') }}
</div>
@endif
<form action="{{ route('products.update',$product->id) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Product Name:</strong>
<input type="text" name="name" value="{{ $product->name }}" class="form-control"
placeholder="Product name">
@error('name')
<div class="alert alert-danger mt-1 mb-1">{{ $message }}</div>
@enderror
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Product price:</strong>
<input type="text" name="price" class="form-control" placeholder="Product price"
value="{{ $product->price }}">
@error('price')
<div class="alert alert-danger mt-1 mb-1">{{ $message }}</div>
@enderror
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Product quantity:</strong>
<input type="text" name="quantity" value="{{ $product->quantity }}" class="form-control"
placeholder="Product quantity">
@error('quantity')
<div class="alert alert-danger mt-1 mb-1">{{ $message }}</div>
@enderror
</div>
</div>
<button type="submit" class="btn btn-primary ml-3">Submit</button>
</div>
</form>
</div>
</body>
</html>

View File

@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Products</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" >
</head>
<body>
<div class="container mt-2">
<div class="row">
<div class="col-lg-12 margin-tb">
<div class="pull-left">
<h2>Products</h2>
</div>
<div class="pull-right mb-2">
<a class="btn btn-success" href="{{ route('products.create') }}"> Create Product</a>
</div>
</div>
</div>
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<table class="table table-bordered">
<thead>
<tr>
<th>Article</th>
<th>Name</th>
<th>price</th>
<th>quantity</th>
<th width="280px">Action</th>
</tr>
</thead>
<tbody>
@foreach ($products as $product)
<tr>
<td>{{ $product->article }}</td>
<td>{{ $product->name }}</td>
<td>{{ $product->price }}</td>
<td>{{ $product->quantity }}</td>
<td>
<form action="{{ route('products.destroy',$product->id) }}" method="Post">
<a class="btn btn-primary" href="{{ route('products.edit',$product->id) }}">Edit</a>
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
{!! $products->links() !!}
</div>
</body>
</html>

140
resources/views/welcome.blade.php Executable file

File diff suppressed because one or more lines are too long