bulk commit

This commit is contained in:
omair saleh
2020-08-27 11:20:50 +08:00
parent 7f712e6ca8
commit 7046e7ca36
10 changed files with 28 additions and 30 deletions
@@ -52,7 +52,6 @@ abstract class AbstractControllerLogic
return $this->logic($request);
} catch (ErrorException $exception){
dd($exception);
return (new ApiResponseObject($this->getNotificationTitle().' failed', $exception->getMessage(), $exception->getCode()))->handler();
}
@@ -60,6 +60,7 @@ class AuthenticateUserLogic extends AbstractControllerLogic
return $this->response(['access_token' => $token, 'redirect_url' => $this->authenticationRedirect->url()]);
} catch (\Exception $exception){
dd($exception);
throw new ErrorException($exception->getMessage(), $exception->getCode());
}
@@ -121,7 +121,6 @@ class CreateUserLogic extends AbstractControllerLogic
return $this->authenticateUserLogic->execute($request);
} catch (\Exception $exception){
dd($exception);
throw new ErrorException($exception->getMessage(), $exception->getCode());
}
}
@@ -9,10 +9,13 @@ class AuthenticationRedirect
{
public function url(){
$userRole = (int) Auth()->user()->role_id;
return $userRole === Roles::ADMIN || $userRole === Roles::SUPER_ADMIN ? route('company.profile', ['id' => 10]) : route('company.profile', ['id' => 1]);
if($userRole === Roles::ADMIN){
return route('admin.dashboard');
}
return route('company.profile', ['id' => Auth()->user()->employers->first()->company->id]);
}
+3 -2
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
@@ -49,8 +50,8 @@ class User extends AbstractModel implements
return $this->hasMany(PasswordReset::class, 'user_id', 'id');
}
public function employers(): hasMany {
return $this->hasMany(CompanyModule::class);
public function employers(): belongsToMany {
return $this->belongsToMany(CompanyModule::class, (new CompanyEmployee())->getTable(), 'user_id', 'module_id');
}
@@ -174,15 +174,15 @@
</div>
</div>
<div class="row">
<div class="col bg-white b-b b-t b-grey animated" :class="[{'shake': $v.parameters.confirmPassword.$error}]" :style="[$v.parameters.confirmPassword.$error ? {'border-bottom': 'solid 2px red !important'} : {}]">
<div class="col bg-white b-b b-t b-grey animated" :class="[{'shake': $v.parameters.confirm_password.$error}]" :style="[$v.parameters.confirm_password.$error ? {'border-bottom': 'solid 2px red !important'} : {}]">
<div class="row align-items-center">
<div class="col no-padding bg-white">
<div class="input-group transparent b-grey">
<span class="input-group-addon no-border">
<i class="fa fa-lock fa-fw p-l-15 p-t-20" style="padding-right: 22px;margin-left: -4px;"></i>
</span>
<input type="password" v-model="parameters.confirmPassword" placeholder="Confirm password" class="form-control no-border bg-white p-t-35 p-b-35 p-l-0 p-r-0">
<validation-error-component :validator="$v.parameters.confirmPassword" class="absolute fs-12" style=" top: 10px; right: 15px; z-index: 99;"></validation-error-component>
<input type="password" v-model="parameters.confirm_password" placeholder="Confirm password" class="form-control no-border bg-white p-t-35 p-b-35 p-l-0 p-r-0">
<validation-error-component :validator="$v.parameters.confirm_password" class="absolute fs-12" style=" top: 10px; right: 15px; z-index: 99;"></validation-error-component>
</div>
</div>
</div>
@@ -192,8 +192,8 @@
</div>
<div class="row m-t-30 align-items-center">
<div class="col-auto p-l-0 animated fadeInLeftBig slow">
<a :href="route('company.profile', 2)">
<div class="b-t b-b b-r b-success bg-success all-caps text-white p-t-15 p-b-15 p-l-50 p-r-50 bold font-lato pointer" style="letter-spacing: 8px;"><i class="fa fa-check fs-13"></i> Complete</div>
<a>
<div class="b-t b-b b-r b-success bg-success all-caps text-white p-t-15 p-b-15 p-l-50 p-r-50 bold font-lato pointer pointer" @click="submit(route('api.account.authentication.registration'), 'post', section, false, false)" style="letter-spacing: 8px;"><i class="fa fa-check fs-13"></i> Complete</div>
</a>
</div>
<div class="col animated fadeInRightBig slow">
@@ -236,7 +236,7 @@
phone: {},
wechat: {},
password: {},
confirmPassword: {}
confirm_password: {}
}
: {
@@ -248,7 +248,7 @@
phone: { required },
wechat: {},
password: { required },
confirmPassword: { sameAsPassword: sameAs('password') }
confirm_password: { sameAsPassword: sameAs('password') }
}
}
},
@@ -285,7 +285,14 @@
}
},
successHandler(response){
localStorage.setItem('user-token', response.payload.access_token);
this.$store.dispatch('userAuthentication', {access_token: response.payload.access_token});
this.error = '';
this.$store.dispatch('toggleSection', {name: 'loginSuccess', status: true})
setTimeout(function(){
window.location.href = response.payload.redirect_url;
}, 2000);
},
errorHandler(error){
@@ -68,13 +68,6 @@
<div class="col">
<h5 class="font-lato light lh-40 animated fadeInLeftBig slow" style="letter-spacing: 5px; ">Create Account</h5>
</div>
<div class="col-auto p-r-50 fs-10">
<div class="inline btn-rounded b-success bg-success b-a b-thick p-t-5 p-b-5 p-l-10 p-r-10 bold text-white">1</div>
<div class="inline text-success hint-text fs-10">
<i class="fa fa-minus"></i><i class="fa fa-minus"></i><i class="fa fa-minus"></i><i class="fa fa-minus"></i>
</div>
<div class="inline btn-rounded b-success b-a b-thick p-t-5 p-b-5 p-l-10 p-r-10 bold text-success">2</div>
</div>
</div>
<div class="row m-l-0 animated fadeInRightBig slow">
<div class="col">
@@ -83,7 +76,7 @@
</div>
</div>
</div>
<registration-form-component :email="parameters.email" section="loginSection"></registration-form-component>
<registration-form-component ref="registration" :email="parameters.email" section="loginSection"></registration-form-component>
</div>
</div>
</transition-component>
@@ -46,7 +46,7 @@
</div>
</div>
<onboarding-section-component :data="company"></onboarding-section-component>
<div class="row">
<div class="row" v-if="false">
<div class="col">
<div class="row m-b-20 m-l-0 m-r-0">
<div class="col pointer">
+2 -7
View File
@@ -8,16 +8,12 @@ export default {
method: method,
parameters: this.parameters
}).then(response => {
let success = response.ok,
statusCode = response.status;
let success = response.ok;
response.json().then(response => {
if(!success){
// if(statusCode === 401 && url !== route('api.account.authenticate')){
// window.location.href = route('authenticate.expire');
// }
errorNotification ? this.$store.dispatch('createNotification', {title: response.title, message: response.message, type: 'error'}): null;
this.errorHandler(response); return;
}
@@ -36,7 +32,6 @@ export default {
},
validate() {
if(this.$v){
console.log(this.$v.$invalid);
this.$v.$touch();
return !this.$v.$invalid;
}
+1 -1
View File
@@ -1,6 +1,6 @@
<div class="bg-white b-b b-grey">
<div class="container">
<div class="menu-bar header-sm-height" data-pages-init='horizontal-menu' data-hide-extra-li="2">
<div class="menu-bar header-sm-height invisible" data-pages-init='horizontal-menu' data-hide-extra-li="2">
<a href="#" class="btn-link toggle-sidebar hidden-lg-up pg pg-close" data-toggle="horizontal-menu">
</a>
<ul>