2020-06-30 12:04:34 +00:00
|
|
|
@extends("app.layout.base")
|
|
|
|
|
|
|
|
@section("title")
|
|
|
|
Account
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
@section("content")
|
2020-11-26 09:19:12 +00:00
|
|
|
<main class="justify-unset">
|
2020-08-11 16:21:51 +00:00
|
|
|
<h1 class="text-center sde-blue mt-1">{{__('msg.konto')}}</h1>
|
2020-09-07 07:53:15 +00:00
|
|
|
<form method="post" action="{{ route("users.accountupdate", ['user' => Auth::user()]) }}" onsubmit="return checkInputs()">
|
2020-07-01 08:13:49 +00:00
|
|
|
@csrf
|
|
|
|
@method("put")
|
2020-08-06 18:33:46 +00:00
|
|
|
<span>{{__('msg.navn')}}:</span>
|
2020-07-31 07:28:58 +00:00
|
|
|
<input type="text" value="{{ Auth::user()->name_first . " " . Auth::user()->name_last }}" disabled>
|
2020-08-06 18:33:46 +00:00
|
|
|
<span>{{__('msg.email')}}:</span>
|
2020-09-07 07:53:15 +00:00
|
|
|
<label hidden id="erroremail">Denne email er allerede taget!</label>
|
2020-08-25 12:48:52 +00:00
|
|
|
<input type="email" name="email" id="email" placeholder="x@y.z" value="{{ Auth::user()->email }}" required>
|
2020-08-06 18:33:46 +00:00
|
|
|
<span>{{__('msg.telefon')}} Nr.:</span>
|
2020-09-07 07:53:15 +00:00
|
|
|
<label hidden id="errorphone">Dette telefon nr. er allerede taget!</label>
|
2020-08-25 12:48:52 +00:00
|
|
|
<input type="tel" name="phone" id="phone" value="{{ Auth::user()->phone }}" placeholder="12345678" pattern="[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}" required>
|
2020-08-06 18:33:46 +00:00
|
|
|
<button type="submit" class="btn text-center btn-sde-blue mt-1">{{__('msg.rediger')}}</button>
|
2020-08-13 07:08:34 +00:00
|
|
|
<a onclick="window.history.back()" class="btn text-center btn-sde-blue mt-1">{{__('msg.tilbage')}}</a>
|
2020-06-30 12:04:34 +00:00
|
|
|
</form>
|
|
|
|
</main>
|
|
|
|
@endsection
|
2020-09-07 07:53:15 +00:00
|
|
|
|
|
|
|
@section("scripts")
|
|
|
|
<script src="{{ asset("/js/jquery-3.2.1.min.js") }}"></script>
|
|
|
|
<script>
|
|
|
|
function checkInputs() {
|
|
|
|
var save = true;
|
|
|
|
$mail = $('#email').val();
|
|
|
|
$phone = $('#phone').val();
|
|
|
|
$.ajax({
|
|
|
|
'async': false,
|
|
|
|
type: 'get',
|
|
|
|
url: '{{route('users.nameCheckUpdate')}}',
|
|
|
|
data: {'mailCheck':$mail, 'phoneCheck':$phone, 'id': {{Auth::user()->id}}},
|
|
|
|
success:function (data) {
|
|
|
|
if (data == 'both') {
|
|
|
|
$("#erroremail").show(100);
|
|
|
|
$("#erroremail").css('color', 'red');
|
|
|
|
$("#errorphone").show(100);
|
|
|
|
$("#errorphone").css('color', 'red');
|
|
|
|
save = false;
|
|
|
|
} else if(data == 'email'){
|
|
|
|
$("#errorphone").hide();
|
|
|
|
$("#erroremail").show(100);
|
|
|
|
$("#erroremail").css('color', 'red');
|
|
|
|
save = false;
|
|
|
|
} else if (data == 'phone') {
|
|
|
|
$("#erroremail").hide();
|
|
|
|
$("#errorphone").show(100);
|
|
|
|
$("#errorphone").css('color', 'red');
|
|
|
|
save = false;
|
|
|
|
} else {
|
|
|
|
$("#errorphone").hide();
|
|
|
|
$("#erroremail").hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
error:function (data) {
|
|
|
|
console.log(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (save)
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
@endsection
|