_form.blade.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. {{ csrf_field() }}
  2. <div class="box box-primary">
  3. <div class="box-header with-border">
  4. <h3 class="box-title"></h3>
  5. </div>
  6. <div class="box-body">
  7. <div class="row">
  8. <div class="col-md-6">
  9. <div class="form-group">
  10. <label for="name">Nome:</label>
  11. <input type="text" name="name" class="form-control title" value="{{ old('name', isset($section) ? $section->name : '') }}">
  12. </div>
  13. </div>
  14. <div class="col-md-6">
  15. <div class="form-group">
  16. <label for="slug">Slug:</label>
  17. <input type="text" name="slug" class="form-control slug" value="{{ old('slug', isset($section) ? $section->slug : '') }}">
  18. </div>
  19. </div>
  20. </div>
  21. <input name="layout" type="hidden" value="{{isset($section) ? $section->layout : ''}}" id="layout">
  22. @if(false)
  23. <div class="row">
  24. <div class="col-md-6">
  25. <div class="form-group">
  26. <label for="layout">Layout:</label>
  27. <br>
  28. @for($x=1;$x<=6;$x++)
  29. <div style="padding:10px;float:left;{{(isset($section) && $section->layout == 'layout_' . $x) ? 'background-color:red;' : ''}} " class="selImg" data-id="layout_{{$x}}">
  30. <img src="/images/layout_{{$x}}.png" style="width:150px;">
  31. </div>
  32. @endfor
  33. <input name="layout" type="hidden" value="{{isset($section) ? $section->layout : ''}}" id="layout">
  34. </div>
  35. </div>
  36. <div class="col-md-6">
  37. <div class="form-group">
  38. <label for="type">Tipologia:</label>
  39. <select name="type" id="type" class="form-control" required>
  40. <option value="">Seleziona una tipologia</option>
  41. <option value="section" {{ old('type', isset($section) ? $section->type : '') == 'section' ? 'selected' : '' }}>Nazionale</option>
  42. <option value="region" {{ old('type', isset($section) ? $section->type : '') == 'region' ? 'selected' : '' }}>Regionale</option>
  43. </select>
  44. </div>
  45. </div>
  46. </div>
  47. @endif
  48. <input name="position" type="hidden" value="{{isset($section) ? $section->position : '0'}}">
  49. <div class="row">
  50. <div class="col-md-6">
  51. <div class="form-group">
  52. <label for="type">Tipologia:</label>
  53. <select name="type" id="type" class="form-control" required>
  54. <option value="">Seleziona una tipologia</option>
  55. <option value="section" {{ old('type', isset($section) ? $section->type : '') == 'section' ? 'selected' : '' }}>Nazionale</option>
  56. <option value="region" {{ old('type', isset($section) ? $section->type : '') == 'region' ? 'selected' : '' }}>Regionale</option>
  57. </select>
  58. </div>
  59. </div>
  60. <div class="col-md-3">
  61. <div class="form-group">
  62. <label for="show_social">Mostra box Facebook:</label><br>
  63. <input type="checkbox" name="show_social" value="on" {{ old('show_social') ? 'checked' : '' }}>
  64. </div>
  65. </div>
  66. <div class="col-md-3">
  67. <div class="form-group">
  68. <label for="show_social_twitter">Mostra box Twitter:</label><br>
  69. <input type="checkbox" name="show_social_twitter" value="on" {{ old('show_social_twitter') ? 'checked' : '' }}>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. <div class="box-footer">
  75. @if(Auth::user()->only_read == false)
  76. <button type="submit" class="btn btn-success">{{ $submit_text }}</button>
  77. @endif
  78. <a href="{{ route('sections.index') }}" class="btn btn-info">Annulla</a>
  79. </div>
  80. </div>
  81. @section('extra_js')
  82. <script>
  83. $(function () {
  84. $(".title").keyup(function(){
  85. var Text = $(this).val();
  86. Text = Text.toLowerCase();
  87. Text = Text.replace(/[^a-zA-Z0-9]+/g,'-');
  88. $(".slug").val(Text);
  89. });
  90. $(".selImg").click(function(){
  91. $(".selImg").css("background-color", "white");
  92. $(this).css("background-color", "red");
  93. var id = $(this).attr("data-id");
  94. $("#layout").val(id);
  95. });
  96. });
  97. </script>
  98. @stop