You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
4.5 KiB
PHTML

@extends('layouts.app')
@section('pageTitle', 'Create new post - ')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-7 px-4">
<h3>Create new post</h3>
<br>
<form action="{{route('posts.store')}}" method="post" enctype="multipart/form-data">
@csrf
<div class="form-group">
<label for="type">Post Type</label>
<select name="type" id="type" class="form-select @error('type') is-invalid @enderror">
<option value="blog" selected>Blog Post</option>
<option value="music">Music</option>
<option value="gallery">Photo Gallery</option>
</select>
@error('type')
<span class="invalid-feedback" role="alert">
{{ $message }}
</span>
@enderror
</div>
<div class="form-group mt-4">
<label for="title">Post Title</label>
<input type="text" class="form-control @error('title') is-invalid @enderror" id="title"
name="title" required/>
@error('title')
<span class="invalid-feedback" role="alert">
{{ $message }}
</span>
@enderror
</div>
<div class="form-group mt-4">
<label for="content">Post Content</label>
<div class="form-floating">
<textarea class="form-control @error('content') is-invalid @enderror" required
placeholder="Enter markdown here" id="content"
name="content" style="height: 200px"></textarea>
</div>
@error('content')
<span class="invalid-feedback" role="alert">
{{ $message }}
</span>
@enderror
</div>
<div class="form-group mt-4">
<label for="images" class="form-label">Upload files</label>
<div class="input-group">
<input class="form-control @error('uploads') is-invalid @enderror" type="file" id="uploads"
name="uploads[]" multiple>
<div class="btn btn-outline-danger" onclick="clearUploads()"
title="Clear selected files">
<i class="bi bi-x-circle"></i>
</div>
</div>
@error('uploads')
<span class="invalid-feedback" role="alert">
{{$message}}
</span>
@enderror
</div>
<div class="form-group mt-4">
<label for="location">Location</label>
<input type="text" name="location" id="location"
class="form-control @error('location') is-invalid @enderror">
@error('location')
<span class="invalid-feedback" role="alert">
{{$message}}}
</span>
@enderror
</div>
<div class="form-group mt-4">
<label for="tags">Tags</label>
<input type="text" name="tags" id="tags"
class="form-control @error('tags') is-invalid @enderror">
@error('tags')
<span class="invalid-feedback" role="alert">
{{$message}}
</span>
@enderror
</div>
<div class="form-group mt-4">
<button type="submit" class="btn btn-primary px-5">Upload</button>
</div>
</form>
</div>
</div>
</div>
<script>
function clearUploads() {
document.getElementById('uploads').value = null;
}
</script>
@endsection