addTicket.blade.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. @extends('admin.layouts')
  2. @section('content')
  3. <div class="page-content container">
  4. @if($errors->any())
  5. <div class="alert alert-danger" role="alert">
  6. <button class="close" data-dismiss="alert" aria-label="Close"><span
  7. aria-hidden="true">&times;</span><span class="sr-only">{{trans('home.close')}}</span>
  8. </button>
  9. {{$errors->first()}}
  10. </div>
  11. @endif
  12. <div class="panel">
  13. <div class="panel-heading p-20">
  14. <h1 class="panel-title cyan-600"><i class="icon wb-add"></i>发起工单</h1>
  15. </div>
  16. <div class="panel-body">
  17. <form action="/ticket/add" method="post" enctype="multipart/form-data" class="form-horizontal"
  18. onsubmit="return Submit()">
  19. <div class="form-body">
  20. <div class="form-group">
  21. <label class="control-label col-md-2">用户名</label>
  22. <div class="col-md-8">
  23. <input type="text" class="form-control" name="email" value="{{Request::get('email')}}"
  24. id="email" autocomplete="off" autofocus required/>
  25. </div>
  26. </div>
  27. <div class="form-group">
  28. <label class="control-label col-md-2">标题</label>
  29. <div class="col-md-8">
  30. <input type="text" class="form-control" name="title" id="title" autocomplete="off"
  31. required/>
  32. </div>
  33. </div>
  34. <div class="form-group">
  35. <label class="control-label col-md-2">内容</label>
  36. <div class="col-md-8">
  37. <textarea class="form-control" rows="5" name="content" id="content"
  38. placeholder="{{trans('home.ticket_table_content')}}"></textarea>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="form-actions">
  43. <div class="row">
  44. <div class="col-md-offset-2 col-md-10">
  45. <button type="submit" class="btn btn-success">提 交</button>
  46. </div>
  47. </div>
  48. </div>
  49. </form>
  50. </div>
  51. </div>
  52. </div>
  53. @endsection
  54. @section('script')
  55. <script type="text/javascript">
  56. // ajax同步提交
  57. function Submit() {
  58. $.ajax({
  59. type: "POST",
  60. url: "/ticket/add",
  61. async: false,
  62. data: {
  63. _token: '{{csrf_token()}}',
  64. email: $('#email').val(),
  65. title: $('#title').val(),
  66. content: $('#content').val()
  67. },
  68. dataType: 'json',
  69. success: function (ret) {
  70. swal.fire({title: ret.message, type: 'success', timer: 1000})
  71. .then(() => window.location.href = '/ticket');
  72. }
  73. });
  74. return false;
  75. }
  76. </script>
  77. @endsection