create.blade.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. @extends('salesman.layouts.app')
  2. @section('panel_content')
  3. <section class="gry-bg py-4">
  4. <div class="profile">
  5. <div class="container">
  6. <div class="row">
  7. <div class="col-xxl-4 col-xl-5 col-lg-6 col-md-8 mx-auto">
  8. <div class="card">
  9. <div class="px-4 py-3 py-lg-4">
  10. <div class="">
  11. <form id="reg-form" class="form-default" role="form" action="{{ route('salesman.customers.store') }}" method="POST">
  12. @csrf
  13. <div class="form-group">
  14. <input type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" value="{{ old('name') }}" placeholder="{{ translate('Full Name') }}" name="name">
  15. @if ($errors->has('name'))
  16. <span class="invalid-feedback" role="alert">
  17. <strong>{{ $errors->first('name') }}</strong>
  18. </span>
  19. @endif
  20. </div>
  21. @if (addon_is_activated('otp_system'))
  22. <div class="form-group phone-form-group mb-1">
  23. <input type="tel" id="phone-code" class="form-control{{ $errors->has('phone') ? ' is-invalid' : '' }}" value="{{ old('phone') }}" placeholder="" name="phone" autocomplete="off">
  24. </div>
  25. <input type="hidden" name="country_code" value="">
  26. <div class="form-group email-form-group mb-1 d-none">
  27. <input type="email" class="form-control {{ $errors->has('email') ? ' is-invalid' : '' }}" value="{{ old('email') }}" placeholder="{{ translate('Email') }}" name="email" autocomplete="off">
  28. @if ($errors->has('email'))
  29. <span class="invalid-feedback" role="alert">
  30. <strong>{{ $errors->first('email') }}</strong>
  31. </span>
  32. @endif
  33. </div>
  34. <div class="form-group text-right">
  35. <button class="btn btn-link p-0 opacity-50 text-reset" type="button" onclick="toggleEmailPhone(this)">{{ translate('Use Email Instead') }}</button>
  36. </div>
  37. @else
  38. <div class="form-group">
  39. <input type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" value="{{ old('email') }}" placeholder="{{ translate('Email') }}" name="email">
  40. @if ($errors->has('email'))
  41. <span class="invalid-feedback" role="alert">
  42. <strong>{{ $errors->first('email') }}</strong>
  43. </span>
  44. @endif
  45. </div>
  46. @endif
  47. <div class="form-group">
  48. <input type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" placeholder="{{ translate('Password') }}" name="password">
  49. @if ($errors->has('password'))
  50. <span class="invalid-feedback" role="alert">
  51. <strong>{{ $errors->first('password') }}</strong>
  52. </span>
  53. @endif
  54. </div>
  55. <div class="form-group">
  56. <input type="password" class="form-control" placeholder="{{ translate('Confirm Password') }}" name="password_confirmation">
  57. </div>
  58. <div class="form-group">
  59. <input type="number" class="form-control" placeholder="{{ translate('Wallet Balance') }}" name="balance">
  60. </div>
  61. <div class="mb-5">
  62. <button type="submit" class="btn btn-primary btn-block fw-600">{{ translate('Create Virtual Account') }}</button>
  63. </div>
  64. </form>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </section>
  73. @endsection
  74. @section('script')
  75. @if(get_setting('google_recaptcha') == 1)
  76. <script src="https://www.google.com/recaptcha/api.js" async defer></script>
  77. @endif
  78. <script type="text/javascript">
  79. @if(get_setting('google_recaptcha') == 1)
  80. // making the CAPTCHA a required field for form submission
  81. $(document).ready(function(){
  82. // alert('helloman');
  83. $("#reg-form").on("submit", function(evt)
  84. {
  85. var response = grecaptcha.getResponse();
  86. if(response.length == 0)
  87. {
  88. //reCaptcha not verified
  89. alert("please verify you are humann!");
  90. evt.preventDefault();
  91. return false;
  92. }
  93. //captcha verified
  94. //do the rest of your validations here
  95. $("#reg-form").submit();
  96. });
  97. });
  98. @endif
  99. var isPhoneShown = true,
  100. countryData = window.intlTelInputGlobals.getCountryData(),
  101. input = document.querySelector("#phone-code");
  102. for (var i = 0; i < countryData.length; i++) {
  103. var country = countryData[i];
  104. if(country.iso2 == 'bd'){
  105. country.dialCode = '88';
  106. }
  107. }
  108. var iti = intlTelInput(input, {
  109. separateDialCode: true,
  110. utilsScript: "{{ static_asset('assets/js/intlTelutils.js') }}?1590403638580",
  111. onlyCountries: @php echo json_encode(\App\Models\Country::where('status', 1)->pluck('code')->toArray()) @endphp,
  112. customPlaceholder: function(selectedCountryPlaceholder, selectedCountryData) {
  113. if(selectedCountryData.iso2 == 'bd'){
  114. return "01xxxxxxxxx";
  115. }
  116. return selectedCountryPlaceholder;
  117. }
  118. });
  119. var country = iti.getSelectedCountryData();
  120. $('input[name=country_code]').val(country.dialCode);
  121. input.addEventListener("countrychange", function(e) {
  122. // var currentMask = e.currentTarget.placeholder;
  123. var country = iti.getSelectedCountryData();
  124. $('input[name=country_code]').val(country.dialCode);
  125. });
  126. function toggleEmailPhone(el){
  127. if(isPhoneShown){
  128. $('.phone-form-group').addClass('d-none');
  129. $('.email-form-group').removeClass('d-none');
  130. isPhoneShown = false;
  131. $(el).html('{{ translate('Use Phone Instead') }}');
  132. }
  133. else{
  134. $('.phone-form-group').removeClass('d-none');
  135. $('.email-form-group').addClass('d-none');
  136. isPhoneShown = true;
  137. $(el).html('{{ translate('Use Email Instead') }}');
  138. }
  139. }
  140. </script>
  141. @endsection