Advertisement
Guest User

z

a guest
Aug 21st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.80 KB | None | 0 0
  1. @extends('layouts.app')
  2.  
  3. @section('content')
  4.     <div class="container">
  5.         <div class="row">
  6.             <div class="col-12">
  7.                 <h4>Project Add</h4>
  8.                 <hr>
  9.             </div>
  10.         </div>
  11.         <form id="form" method="post" action="{{ route('acp_projects_add') }}" enctype="multipart/form-data" onsubmit="return false">
  12.             {{ csrf_field() }}
  13.             <div class="form-row">
  14.                 <div class="form-group col-md-6">
  15.                     <label for="name">Name</label>
  16.                     <input type="text" name="name" id="name" class="form-control" placeholder=""
  17.                           aria-describedby="name">
  18.                     <small id="helpName" class="text-muted">Help text</small>
  19.                 </div>
  20.                 <div class="form-group col-md-6">
  21.                     <label for="url">URL</label>
  22.                     <input type="text" name="url" id="url" class="form-control" placeholder=""
  23.                           aria-describedby="url">
  24.                     <small id="helpUrl" class="text-muted">Help text</small>
  25.                 </div>
  26.                 <div class="form-group col-12">
  27.                     <label for="description">Description</label>
  28.                     <textarea name="description" id="description" class="form-control"
  29.                              aria-describedby="helpId"></textarea>
  30.                     <small id="helpDescription" class="text-muted">Help text</small>
  31.                 </div>
  32.                 <div class="form-group col-md-6">
  33.                     <label for="file_input">Upload</label>
  34.                     <input type="file" class="form-control-file" name="file_input" id="file_input" placeholder=""
  35.                           aria-describedby="fileHelpId" accept="image/*"
  36.                           onchange="changePreview(this, 'file_preview')">
  37.                     <small id="fileHelpId" class="form-text text-muted">Help text</small>
  38.                     <img id="file_preview" class="img-thumbnail" style="max-height: 240px; max-width: 240px;"/>
  39.                 </div>
  40.                 <div class="form-group col-md-6">
  41.                     <div class="row">
  42.                         <div class="form-group col-md-6">
  43.                             <label for="created_at">Started at</label>
  44.                             <input class="form-control" id="created_at" name="created_at" type="date">
  45.                         </div>
  46.                         <div class="form-group col-md-6">
  47.                             <label for="updated_at">Last updated at</label>
  48.                             <input class="form-control" id="updated_at" name="updated_at" type="date">
  49.                         </div>
  50.                     </div>
  51.                 </div>
  52.                 <div class="form-group col-12">
  53.                     <button class="btn btn-primary" type="submit" id="btn-submit">Submit</button>
  54.                     <input class="btn btn-warning" type="reset" value="Reset">
  55.                     <a href="{{ route('acp_projects') }}" class="btn btn-danger">Cancel</a>
  56.                 </div>
  57.                 <div class="form-group col-12" id="response">
  58.                 </div>
  59.             </div>
  60.         </form>
  61.     </div>
  62.  
  63.     <script>
  64.         document.getElementById('btn-submit').addEventListener('click', function () {
  65.             ProjectsAdd();
  66.         });
  67.  
  68.         function ProjectsAdd() {
  69.             let div_response = document.getElementById('response');
  70.             let form = document.getElementById('response');
  71.             let formData = new FormData(form);
  72.             axios.post("/api/projects", formData).then(
  73.                 function (response) {
  74.                     div_response.innerHTML = JSON.stringify(response);
  75.                 }
  76.             )
  77.         }
  78.     </script>
  79. @endsection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement