Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @extends('layouts.app')
- @section('content')
- <div class="container">
- <div class="row">
- <div class="col-12">
- <h4>Project Add</h4>
- <hr>
- </div>
- </div>
- <form id="form" method="post" action="{{ route('acp_projects_add') }}" enctype="multipart/form-data" onsubmit="return false">
- {{ csrf_field() }}
- <div class="form-row">
- <div class="form-group col-md-6">
- <label for="name">Name</label>
- <input type="text" name="name" id="name" class="form-control" placeholder=""
- aria-describedby="name">
- <small id="helpName" class="text-muted">Help text</small>
- </div>
- <div class="form-group col-md-6">
- <label for="url">URL</label>
- <input type="text" name="url" id="url" class="form-control" placeholder=""
- aria-describedby="url">
- <small id="helpUrl" class="text-muted">Help text</small>
- </div>
- <div class="form-group col-12">
- <label for="description">Description</label>
- <textarea name="description" id="description" class="form-control"
- aria-describedby="helpId"></textarea>
- <small id="helpDescription" class="text-muted">Help text</small>
- </div>
- <div class="form-group col-md-6">
- <label for="file_input">Upload</label>
- <input type="file" class="form-control-file" name="file_input" id="file_input" placeholder=""
- aria-describedby="fileHelpId" accept="image/*"
- onchange="changePreview(this, 'file_preview')">
- <small id="fileHelpId" class="form-text text-muted">Help text</small>
- <img id="file_preview" class="img-thumbnail" style="max-height: 240px; max-width: 240px;"/>
- </div>
- <div class="form-group col-md-6">
- <div class="row">
- <div class="form-group col-md-6">
- <label for="created_at">Started at</label>
- <input class="form-control" id="created_at" name="created_at" type="date">
- </div>
- <div class="form-group col-md-6">
- <label for="updated_at">Last updated at</label>
- <input class="form-control" id="updated_at" name="updated_at" type="date">
- </div>
- </div>
- </div>
- <div class="form-group col-12">
- <button class="btn btn-primary" type="submit" id="btn-submit">Submit</button>
- <input class="btn btn-warning" type="reset" value="Reset">
- <a href="{{ route('acp_projects') }}" class="btn btn-danger">Cancel</a>
- </div>
- <div class="form-group col-12" id="response">
- </div>
- </div>
- </form>
- </div>
- <script>
- document.getElementById('btn-submit').addEventListener('click', function () {
- ProjectsAdd();
- });
- function ProjectsAdd() {
- let div_response = document.getElementById('response');
- let form = document.getElementById('response');
- let formData = new FormData(form);
- axios.post("/api/projects", formData).then(
- function (response) {
- div_response.innerHTML = JSON.stringify(response);
- }
- )
- }
- </script>
- @endsection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement