Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
109 changed files
with
5,238 additions
and
3,102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import axios from 'axios' | ||
|
||
function getCrsfToken() { | ||
// Get if exists CSRF TOKEN from HTML meta (as Laravel do) | ||
let tokenMeta = document.head.querySelector('meta[name="csrf-token"]') | ||
if (tokenMeta) return tokenMeta.content | ||
return null | ||
} | ||
|
||
function configureAxios() { | ||
axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; | ||
let token = getCrsfToken() | ||
if (token) axios.defaults.headers.common['X-CSRF-TOKEN'] = token; | ||
} | ||
|
||
function httpClient(){ | ||
if (window.axios) { | ||
return window.axios | ||
} else { | ||
configureAxios() | ||
return axios | ||
} | ||
} | ||
|
||
export default { | ||
getUser (cb) { | ||
let http = httpClient() | ||
http.get('/api/v1/user').then(response => { | ||
cb(response.data) | ||
}).catch( error => { | ||
console.log(error) | ||
}) | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import UsersManagement from './components/UsersManagement.vue' | ||
import UserInvitations from './components/invitations/UserInvitations.vue' | ||
import CreateUser from './components/CreateUser.vue' | ||
import CreateUserViaInvitation from './components/CreateUserViaInvitation.vue' | ||
import UsersDashboard from './components/dashboard/UsersDashboard.vue' | ||
import ModelTracking from './components/tracking/ModelTracking.vue' | ||
|
||
//PROFILE | ||
import UserProfile from './user-profile/UserProfileComponent.vue' | ||
import UserProfileInfoBox from './user-profile/components/UserProfileInfoBoxComponent.vue' | ||
|
||
//MAIN | ||
import UserForm from './main/UserForm.vue' | ||
|
||
//Full screen components: | ||
import RegisterUserByEmail from './components/RegisterUserByEmail.vue' | ||
import InviteUserFullScreen from './components/invitations/InviteUserFullScreen.vue' | ||
|
||
// Google Apps vue components | ||
import GoogleAppsDashboard from './components/google/GoogleAppsDashboard.vue' | ||
import GoogleAppsUsersList from './components/google/GoogleAppsUsersList.vue' | ||
|
||
// auto install | ||
if (typeof window !== 'undefined' && window.Vue) { | ||
// Register components | ||
Vue.component('users-management', UsersManagement) | ||
Vue.component('users-invitations', UserInvitations) | ||
Vue.component('create-user', CreateUser) | ||
Vue.component('create-user-via-invitation', CreateUserViaInvitation) | ||
Vue.component('users-dashboard', UsersDashboard) | ||
Vue.component('model-tracking', ModelTracking) | ||
// // expose AdminlteVue functions if auto installed | ||
// window.Vue.$adminlte = {todo, todo2} | ||
|
||
//Full screen components: | ||
Vue.component('register-user-by-email', RegisterUserByEmail) | ||
Vue.component('invite-user-fullscreen', InviteUserFullScreen) | ||
|
||
// Google Apps vue components | ||
Vue.component('google-apps-dashboard', GoogleAppsDashboard) | ||
Vue.component('google-apps-users-list', GoogleAppsUsersList) | ||
|
||
//Profile | ||
Vue.component('user-profile', UserProfile) | ||
Vue.component('user-profile-info-box', UserProfileInfoBox) | ||
|
||
//Main | ||
Vue.component('user-form', UserForm) | ||
} | ||
|
||
import { config } from './config/ebre-escool-users-migration' | ||
|
||
window.acacha_users = {} | ||
window.acacha_users.config = config | ||
|
||
//Components | ||
export { | ||
UsersManagement, | ||
UserInvitations, | ||
CreateUser, | ||
CreateUserViaInvitation, | ||
UsersDashboard, | ||
ModelTracking, | ||
RegisterUserByEmail, | ||
InviteUserFullScreen, | ||
GoogleAppsDashboard, | ||
GoogleAppsUsersList, | ||
UserProfile, | ||
UserProfileInfoBox, | ||
UserForm | ||
} | ||
|
||
import UserProfileStore from './store' | ||
|
||
//Stores | ||
export { | ||
UserProfileStore | ||
} | ||
|
||
//Vuex Modules | ||
import {AcachaUsersModule} from './store/modules/user' | ||
|
||
export { | ||
AcachaUsersModule | ||
} | ||
|
||
import {UserProfileStoreComponent} from './user-profile/base-components/UserProfileStoreComponent' | ||
|
||
export { | ||
UserProfileStoreComponent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template> | ||
<form role="form" method="post" @submit.prevent="submit" @keydown="clearErrors($event.target.name)"> | ||
<adminlte-input-text name="name" :form="form"></adminlte-input-text> | ||
|
||
<div class="form-group"> | ||
<label for="email">Email address</label> | ||
<input type="email" class="form-control" id="email" placeholder="Enter email" style="background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAAAXNSR0IArs4c6QAAAPhJREFUOBHlU70KgzAQPlMhEvoQTg6OPoOjT+JWOnRqkUKHgqWP4OQbOPokTk6OTkVULNSLVc62oJmbIdzd95NcuGjX2/3YVI/Ts+t0WLE2ut5xsQ0O+90F6UxFjAI8qNcEGONia08e6MNONYwCS7EQAizLmtGUDEzTBNd1fxsYhjEBnHPQNG3KKTYV34F8ec/zwHEciOMYyrIE3/ehKAqIoggo9inGXKmFXwbyBkmSQJqmUNe15IRhCG3byphitm1/eUzDM4qR0TTNjEixGdAnSi3keS5vSk2UDKqqgizLqB4YzvassiKhGtZ/jDMtLOnHz7TE+yf8BaDZXA509yeBAAAAAElFTkSuQmCC"); background-repeat: no-repeat; background-attachment: scroll; background-size: 16px 18px; background-position: 98% 50%; cursor: auto;"> | ||
</div> | ||
<div class="form-group"> | ||
<label for="password">Password</label> | ||
<input type="password" class="form-control" id="password" placeholder="Password" style="background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAAAXNSR0IArs4c6QAAAPhJREFUOBHlU70KgzAQPlMhEvoQTg6OPoOjT+JWOnRqkUKHgqWP4OQbOPokTk6OTkVULNSLVc62oJmbIdzd95NcuGjX2/3YVI/Ts+t0WLE2ut5xsQ0O+90F6UxFjAI8qNcEGONia08e6MNONYwCS7EQAizLmtGUDEzTBNd1fxsYhjEBnHPQNG3KKTYV34F8ec/zwHEciOMYyrIE3/ehKAqIoggo9inGXKmFXwbyBkmSQJqmUNe15IRhCG3byphitm1/eUzDM4qR0TTNjEixGdAnSi3keS5vSk2UDKqqgizLqB4YzvassiKhGtZ/jDMtLOnHz7TE+yf8BaDZXA509yeBAAAAAElFTkSuQmCC"); background-repeat: no-repeat; background-attachment: scroll; background-size: 16px 18px; background-position: 98% 50%; cursor: auto;"> | ||
</div> | ||
|
||
<div class="box-footer"> | ||
<button type="submit" class="btn btn-primary" :disabled="form.submitting || form.errors.any()">Update</button> | ||
</div> | ||
</form> | ||
</template> | ||
|
||
|
||
<script> | ||
import { mapGetters } from 'vuex' | ||
import { AdminlteInputTextComponent } from 'acacha-adminlte-vue-forms' | ||
export default { | ||
name: 'UserForm', | ||
components: { AdminlteInputTextComponent }, | ||
computed: { | ||
...mapGetters({ | ||
form: 'acacha-forms/form' | ||
}), | ||
}, | ||
methods: { | ||
submit () { | ||
console.log('SUBMIT!!!!!!!!!!') | ||
this.$store.dispatch('acacha-forms/put','/api/v1/user').then( response => { | ||
console.log(response) | ||
console.log(response.data) | ||
}).catch( error => { | ||
if (error.response.status === 422) return | ||
this.flash('' + error, 'Oooppssss something went wrong!', 'danger', 'ban'); | ||
}) | ||
}, | ||
clearErrors (fieldName) { | ||
if ( !fieldName ) return | ||
this.$store.dispatch('acacha-forms/clearErrorAction', fieldName) | ||
}, | ||
flash(message, title, color, icon) { | ||
if (typeof window.flash === "function") { | ||
window.flash(message, title, color, icon) | ||
} else { | ||
console.log('error!') | ||
// this.showAlert(message, title, color, icon) | ||
} | ||
} | ||
} | ||
} | ||
</script> |
Oops, something went wrong.