add.blade.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. @extends('layouts.idara.panel')
  2. @section('content')
  3. @include('backend.partials.import')
  4. @include('backend.partials.features')
  5. <section>
  6. <div class="card mt-4">
  7. <h5 class="card-header">Ajouter une coordonnées</h5>
  8. <div class="card-body">
  9. @if (count($errors) > 0)
  10. <div class="alert alert-danger">
  11. <strong>Whoops!</strong> Some problems with your input.<br><br>
  12. <ul>
  13. @foreach ($errors->all() as $error)
  14. <li>{{ $error }}</li>
  15. @endforeach
  16. </ul>
  17. </div>
  18. @endif
  19. <form action="{{url('contacts')}}" method="post" enctype="multipart/form-data">
  20. @csrf
  21. <div class="form-group Coordonnee " id="Coordonnee">
  22. <label class="" for="exampleFormControlInput1"><strong>Type de coordonnées :</strong> </label>
  23. <br>
  24. <select onchange="optionCheck()" class="form-control" name="Type" id="coorType" class="coordonnee" aria-describedby="validationServer04Feedback" style=" margin-bottom: 40px;" aria-placeholder="" required>
  25. <option disabled selected hidden>Vueillez selectionner une coordonnées</option>
  26. @foreach ($coorTypes as $coorType)
  27. @if($contactNull ==null)
  28. <option value="{{ $coorType->id }}" {{ old('coorType') == $coorType->id ? 'selected' : '' }}>{{ $coorType->type }}</option>
  29. @elseif($contactNull !==null)
  30. <option value="{{ $coorType->id }}" {{ old('coorType') == $coorType->id ? 'selected' : '' }} {{$coorType->id== '3' ? 'disabled' : '' }}>{{ $coorType->type }}</option>
  31. @endif
  32. @endforeach
  33. </select>
  34. </div>
  35. <div class="form-group t_val">
  36. <label><strong>Coordonnée</strong> </label>
  37. <input type="" class="form-control" name="coordonnees" placeholder="" required>
  38. </div>
  39. <div style="margin-top:10px">
  40. <a type="submit" class="btn" target="blank" href="https://www.google.com/maps/search/gg+maps+alger/@36.6968581,2.9521356,11z/data=!3m1!4b1" id="hiddenDiv" style=" background:yellow; border:1px; visibility:hidden;">
  41. Clickez Ici <i class="fa-solid fa-map-location-dot"></i> </a></div>
  42. <div class="form-group add">
  43. <button type="submit" class="btn btn-primary" value="Ajouter">Ajouter</button>
  44. </div>
  45. </form>
  46. </div>
  47. </div>
  48. </section>
  49. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.3/jquery.min.js" integrity="sha512-STof4xm1wgkfm7heWqFJVn58Hm3EtS31XFaagaa8VMReCXAkQnJZ+jEy8PCC/iT18dFy95WcExNHFTqLyp72eQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  50. <script>
  51. $(document).ready(function() {
  52. $("select[name=coorType]").on("change", function() {
  53. $value = $(this).val();
  54. $input = $(".t_val input");
  55. if ($value == 1)
  56. $input.removeAttr("class").attr({
  57. type: "tel"
  58. , class: "some-other-class form-control"
  59. , placeholder: "Ex: 0000000000"
  60. , pattern: "[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}"
  61. });
  62. else if ($value == 2)
  63. $input.removeAttr("class").attr({
  64. type: "tel"
  65. , class: "some-other-class form-control"
  66. , placeholder: "Ex: 021 ..."
  67. });
  68. else if ($value == 3)
  69. $input.removeAttr("class").attr({
  70. type: "email"
  71. , class: "some-other-class form-control"
  72. , placeholder: "Ex: xxxx@gmail.com"
  73. });
  74. else if ($value == 4)
  75. $input.removeAttr("class").attr({
  76. type: "url"
  77. , class: "some-other-class form-control"
  78. , placeholder: "https://goo.gl/maps/RpEVLKrSv549xcxb9"
  79. });
  80. else
  81. $input.removeAttr("class").attr({
  82. type: "text"
  83. , class: "some-other-class form-control"
  84. , placeholder: "Ex: https://www.xxxxxx.net/"
  85. });
  86. })
  87. })
  88. function optionCheck() {
  89. var option = document.getElementById("coorType").value;
  90. if (option == 4) {
  91. document.getElementById("hiddenDiv").style.visibility = "visible";
  92. } else {
  93. document.getElementById("hiddenDiv").style.visibility = "hidden";
  94. }
  95. }
  96. </script>
  97. <style>
  98. label {
  99. margin-bottom: 20px;
  100. }
  101. input {
  102. width: 100%;
  103. border-radius: 3px;
  104. }
  105. </style>
  106. @endsection