-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregistration.php
More file actions
107 lines (101 loc) · 4.48 KB
/
Copy pathregistration.php
File metadata and controls
107 lines (101 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<style>
#uni_modal .modal-content>.modal-footer,#uni_modal .modal-content>.modal-header{
display:none;
}
</style>
<div class="container-fluid">
<form action="" id="registration">
<div class="row">
<h3 class="text-center">Create New Account
<span class="float-right">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</span>
</h3>
<hr>
</div>
<div class="row align-items-center h-100">
<div class="col-lg-5 border-right">
<div class="form-group">
<label for="" class="control-label">Firstname</label>
<input type="text" class="form-control form-control-sm form" name="firstname" required>
</div>
<div class="form-group">
<label for="" class="control-label">Lastname</label>
<input type="text" class="form-control form-control-sm form" name="lastname" required>
</div>
<div class="form-group">
<label for="" class="control-label">Contact</label>
<input type="text" class="form-control form-control-sm form" name="contact" required>
</div>
<div class="form-group">
<label for="" class="control-label">Gender</label>
<select name="gender" id="" class="custom-select select" required>
<option>Male</option>
<option>Female</option>
</select>
</div>
</div>
<div class="col-lg-7">
<div class="form-group">
<label for="" class="control-label">Default Delivery Address</label>
<textarea class="form-control form" rows='3' name="default_delivery_address"></textarea>
</div>
<div class="form-group">
<label for="" class="control-label">Email</label>
<input type="text" class="form-control form-control-sm form" name="email" required>
</div>
<div class="form-group">
<label for="" class="control-label">Password</label>
<input type="password" class="form-control form-control-sm form" name="password" required>
</div>
<div class="form-group d-flex justify-content-between">
<a href="javascript:void()" id="login-show">Already have an Account</a>
<button class="btn btn-primary btn-flat">Register</button>
</div>
</div>
</div>
</form>
</div>
<script>
$(function(){
$('#login-show').click(function(){
uni_modal("","login.php")
})
$('#registration').submit(function(e){
e.preventDefault();
start_loader()
if($('.err-msg').length > 0)
$('.err-msg').remove();
$.ajax({
url:_base_url_+"classes/Master.php?f=register",
method:"POST",
data:$(this).serialize(),
dataType:"json",
error:err=>{
console.log(err)
alert_toast("an error occured",'error')
end_loader()
},
success:function(resp){
if(typeof resp == 'object' && resp.status == 'success'){
alert_toast("Account succesfully registered",'success')
setTimeout(function(){
location.reload()
},2000)
}else if(resp.status == 'failed' && !!resp.msg){
var _err_el = $('<div>')
_err_el.addClass("alert alert-danger err-msg").text(resp.msg)
$('[name="password"]').after(_err_el)
end_loader()
}else{
console.log(resp)
alert_toast("an error occured",'error')
end_loader()
}
}
})
})
})
</script>