master_template/resources/views/hulaki_khabar/Auth/registration.blade.php
2024-06-23 17:02:56 +05:45

116 lines
4.3 KiB
PHP

@extends('hulaki_khabar.layout.layout')
@section('content')
<div class="page-title-area">
<div class="container">
<div class="page-title-content">
<h2>रजिस्टर</h2>
<ul>
<li><a href="index.php">होमपेज</a></li>
<li>रजिस्टर</li>
</ul>
</div>
</div>
</div>
<!-- End Page Banner -->
<!-- Start Register Area -->
<section class="register-area ptb-50">
<div class="container">
<div class="register-form">
<h2>रजिस्टर</h2>
<form id="register-form" action={{ route('postRegistration') }}>
@csrf
<div class="form-group">
<label>नाम</label>
<input type="text" class="form-control" placeholder="नाम" id="name">
</div>
<div class="form-group">
<label>ईमेल</label>
<input type="text" class="form-control" placeholder="ईमेल" id="email">
</div>
<div class="form-group">
<label>फोन</label>
<input type="text" class="form-control" placeholder="फोन" id="phone">
</div>
<div class="form-group">
<label>पासवर्ड</label>
<input type="password" class="form-control" placeholder="पासवर्ड" id="password">
</div>
<div class="row align-items-center">
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="checkme">
<label class="form-check-label" for="checkme">पासवर्ड हेर्नुहोस?</label>
</div>
</div>
</div>
<button type="submit">रजिस्टर गर्नुहोस</button>
</form>
<div class="important-text">
<p>खाता ? <a href="{{route('postRegistration')}}">लगइन गर्नुहोस!</a></p>
</div>
</div>
</div>
</section>
@endsection
@push('js')
<script>
$(document).ready(function() {
$('#register-form').submit(function(e) {
e.preventDefault();
let form = $(this);
let name = $('#name').val();
let email = $('#email').val();
let password = $('#password').val();
let phone = $('#phone').val();
$.ajax({
url: form.attr('action'),
type: "POST",
data: {
name: name,
email: email,
phone: phone,
password: password,
_token: "{{ csrf_token() }}"
},
success: function(response) {
if (response.success) {
Swal.fire({
icon: 'success',
title: 'Success',
text: response.message
}).then((result) => {
if (result.isConfirmed) {
window.location.href = response.redirect_url;
}
});
} else {
Swal.fire({
icon: 'error',
title: 'Error',
text: response.message
});
}
},
error: function(xhr, status, error) {
let err = xhr.responseJSON;
let errorMsg = 'An error occurred during the request.';
if (err.errors) {
errorMsg = Object.values(err.errors).map(errMsg => errMsg.join(', ')).join(' ');
}
Swal.fire({
icon: 'error',
title: 'Error',
text: errorMsg
});
}
});
});
});
</script>
@endpush