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
775 changed files
with
166,772 additions
and
2 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,53 @@ | ||
<template> | ||
<adminlte-vue-modal :show="show" color="danger" @hide="onHide" :id="id"> | ||
<h4 slot="title">{{title}}</h4> | ||
<p>{{body}}</p> | ||
<div class="modal-footer" slot="footer"> | ||
<input type="hidden" id="user_id" value=""/> | ||
<button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button> | ||
<button type="button" class="btn btn-outline" id="confirm-action-button" | ||
@click="confirm"> | ||
<i v-if="this.acting" id="acting-user-spinner" class="fa fa-refresh fa-spin"></i> {{confirmText}} | ||
</button> | ||
</div> | ||
</adminlte-vue-modal> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
acting: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
show: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
title: { | ||
type: String, | ||
default: 'Confirm dialog' | ||
}, | ||
body: { | ||
type: String, | ||
default: 'Are you sure you want to execute this action?' | ||
}, | ||
id: { | ||
type: String, | ||
default: 'confirm-dialog' | ||
}, | ||
confirmText: { | ||
type: String, | ||
default: 'Delete' | ||
} | ||
}, | ||
methods: { | ||
onHide() { | ||
this.$emit('hide') | ||
}, | ||
confirm() { | ||
this.$emit('confirm') | ||
} | ||
} | ||
} | ||
</script> |
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,141 @@ | ||
<template> | ||
<div id="add-user"> | ||
<adminlte-vue-box color="success" :collapsed="isCollapsed"> | ||
<span slot="title">Create User</span> | ||
<!--TODO : use alert adminlte--> | ||
<div class="alert alert-success alert-dismissible" v-show="form.succeeded" id="create-user-result"> | ||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> | ||
<strong>User created!</strong> <br> | ||
</div> | ||
<form role="form" id="create-user-form" @submit.prevent="submit" @keydown="clearErrors($event.target.name)"> | ||
<div class="box-body"> | ||
<div class="form-group" :class="{ 'has-error': form.errors.has('name') }"> | ||
<label for="inputCreateUserName">Name</label> | ||
<input type="text" class="form-control" id="inputCreateUserName" placeholder="Enter name" | ||
name="name" value="" v-model="form.name"> | ||
<transition name="fade"> | ||
<span class="help-block" id="errorForInputCreateUserName" v-if="form.errors.has('name')" v-text="form.errors.get('name')"></span> | ||
</transition> | ||
</div> | ||
|
||
<div class="form-group" :class="{ 'has-error': form.errors.has('email') }" v-if="!this.email"> | ||
<label for="inputCreateUserEmail">Email address</label> | ||
<input type="email" class="form-control" id="inputCreateUserEmail" placeholder="Enter email" | ||
name="email" value="" v-model="form.email" > | ||
<transition name="fade"> | ||
<span class="help-block" id="errorForInputCreateUserEmail" v-if="form.errors.has('email')" v-text="form.errors.get('email')"></span> | ||
</transition> | ||
</div> | ||
<template v-else> | ||
<input type="hidden" id="inputCreateUserEmail" name="email" v-model="form.email"> | ||
<transition name="fade"> | ||
<span class="help-block" id="errorForInputCreateUserEmail" v-if="form.errors.has('email')" v-text="form.errors.get('email')"></span> | ||
</transition> | ||
</template> | ||
|
||
|
||
<div class="form-group" :class="{ 'has-error': form.errors.has('password') }"> | ||
<label for="inputCreateUserPassword">Password</label> | ||
|
||
<div class="input-group"> | ||
<div class="input-group-btn"> | ||
<button type="button" class="btn btn-success" @click="proposePassword()"><i class="fa fa-refresh"></i></button> | ||
</div> | ||
<input type="text" class="form-control" id="inputCreateUserPassword" placeholder="Password" | ||
name="password" value="" v-model="form.password"> | ||
</div> | ||
<transition name="fade"> | ||
<span class="help-block" id="errorForInputCreateUserPassword" v-if="form.errors.has('password')" v-text="form.errors.get('password')"></span> | ||
</transition> | ||
|
||
</div> | ||
|
||
</div> | ||
<!-- /.box-body --> | ||
|
||
<div class="box-footer"> | ||
<button type="submit" id="create-user-button" class="btn btn-primary":disabled="form.errors.any()"><i v-if="form.submitting" id="create-user-spinner" class="fa fa-refresh fa-spin"></i> Create</button> | ||
</div> | ||
</form> | ||
</adminlte-vue-box> | ||
</div> | ||
</template> | ||
|
||
<style src="./css/fade.css"></style> | ||
|
||
<script> | ||
import Form from 'acacha-forms' | ||
import {Box} from 'adminlte-vue' | ||
import generatePassword from 'password-generator' | ||
export default { | ||
data: function () { | ||
return { | ||
form: new Form({ name: '', email: '', password: '', token: null }), | ||
isCollapsed: this.collapsed | ||
} | ||
}, | ||
components: { | ||
'adminlte-vue-box' : Box | ||
}, | ||
props: { | ||
apiUri: { | ||
type: String, | ||
default: '/api/v1/management/users/invitations' | ||
}, | ||
collapsed: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
email: { | ||
type: String, | ||
default: null | ||
}, | ||
token: { | ||
type: String, | ||
default: null | ||
} | ||
}, | ||
methods: { | ||
submit () { | ||
var password = this.form.password | ||
this.form.post(this.apiUri) | ||
.then(response => { | ||
this.$events.fire('reload-user-list') | ||
this.$emit('onSubmitOk',password) | ||
}) | ||
.catch(error => { | ||
console.log('User created error: ' + error) | ||
console.log(this.form.errors.all()) | ||
}) | ||
}, | ||
clearErrors (name) { | ||
this.form.errors.clear(name) | ||
}, | ||
proposePassword() { | ||
this.form.password = generatePassword() | ||
}, | ||
initValues() { | ||
if (this.email) this.form.email = this.email | ||
if (this.token) this.form.token = this.token | ||
} | ||
}, | ||
mounted () { | ||
this.form.clearOnSubmit = true | ||
this.proposePassword() | ||
this.initValues() | ||
}, | ||
events: { | ||
'collapse-create-user' () { | ||
this.isCollapsed = true | ||
}, | ||
'expand-create-user' () { | ||
this.isCollapsed = false | ||
} | ||
} | ||
} | ||
</script> |
75 changes: 75 additions & 0 deletions
75
resources/assets/js/components/CreateUserViaInvitation.vue
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,75 @@ | ||
<template> | ||
<div id="create-user-via-invitation"> | ||
<div v-if="finishing" id="create-user-via-invitation-finishing"> | ||
<div class="callout callout-success"> | ||
<h4>User created ok!</h4> | ||
<p><i id="redirecting-to-home" class="fa fa-refresh fa-spin"></i> Redirecting to home page....</p> | ||
</div> | ||
</div> | ||
<div v-else> | ||
<div class="callout callout-success"> | ||
<h4>Thanks for accepting the user invitation {{ this.email }}!</h4> | ||
|
||
<p>Please fill the below form to finish user invitation process...</p> | ||
</div> | ||
|
||
<create-user :api-url="this.apiUri" @onSubmitOk="finish" | ||
:email="this.email" :token="this.token"></create-user> | ||
</div> | ||
|
||
</div> | ||
</template> | ||
|
||
<style src="./css/fade.css"></style> | ||
|
||
<script> | ||
import CreateUser from './CreateUser.vue' | ||
import axios from 'axios' | ||
export default { | ||
components: { | ||
'create-user' : CreateUser | ||
}, | ||
data: function () { | ||
return { | ||
finishing: false | ||
} | ||
}, | ||
props: { | ||
apiUri: { | ||
type: String, | ||
default: '/api/v1/management/users/user-invitation-accept' | ||
}, | ||
email: { | ||
type: String, | ||
default: null | ||
}, | ||
token: { | ||
type: String, | ||
default: null | ||
}, | ||
urlToRedirect: { | ||
type: String, | ||
default: '/home' | ||
} | ||
}, | ||
methods: { | ||
finish(password) { | ||
this.finishing = true | ||
var component = this | ||
axios.post('/login', { | ||
email: component.email, | ||
password: password | ||
}) | ||
.then(function (response) { | ||
window.location = component.urlToRedirect | ||
}) | ||
.catch(function (error) { | ||
console.log(error); | ||
}); | ||
} | ||
} | ||
} | ||
</script> |
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,111 @@ | ||
<template> | ||
<div :id="'editable-field-' + this.resource + '-' + this.id + '-' + this.name"> | ||
<label class="control-label" v-if="!editing" @dblclick="toogleEditing" :id="'editable-field-label-' + this.resource + '-' + this.id + '-' + this.name"> | ||
{{ value }} | ||
<i class="fa fa-edit" style="color: green;" v-if="!editing" @click="toogleEditing"></i> | ||
</label> | ||
<div class="input-group" v-if="editing"> | ||
<div class="form-group" :class="{ 'has-error': form.errors.has('name') }"> | ||
<input type="text" class="form-control" v-model="value" :name="this.name" :id="'input-edit-' + this.resource + '-' + this.id + '-field-' + this.name" | ||
@keyup.esc="toogleEditing" @keyup.enter="save" @keydown="clearErrors($event.target.name)"> | ||
</div> | ||
<div class="input-group-addon bg-green"> | ||
<i v-if="form.submitting" id="editable-spinner" class="fa fa-refresh fa-spin"></i> | ||
<i v-else class="fa fa-check" @click="save" :id="'edit-button-' + this.resource + '-' + this.id + '-field-' + this.name"></i> | ||
</div> | ||
<div class="input-group-addon bg-red"> | ||
<i class="fa fa-remove" @click="toogleEditing"></i> | ||
</div> | ||
</div> | ||
<transition name="fade"> | ||
<span class="help-block text-red" :id="'errorForInput-' + this.resource + '-' + this.id + '-field-' + this.name" v-if="form.errors.has(this.name)" v-text="form.errors.get(this.name)"></span> | ||
</transition> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Form from 'acacha-forms' | ||
export default { | ||
/* | ||
* The component's data. | ||
*/ | ||
data() { | ||
return { | ||
editing: this.edit, | ||
afterSaveEventName: this.afterSaveEvent, | ||
form: new Form({ [this.name] : this.content }) | ||
}; | ||
}, | ||
computed: { | ||
value: { | ||
get: function () { | ||
return this.form[this.name] | ||
}, | ||
set: function (newValue) { | ||
this.form[this.name] = newValue | ||
} | ||
} | ||
}, | ||
props: { | ||
'resource': { | ||
type: String, | ||
required: true | ||
}, | ||
'name': { | ||
type: String, | ||
required: true | ||
}, | ||
'id': { | ||
type: Number, | ||
required: true | ||
}, | ||
'apiUri': { | ||
type: String, | ||
required: true | ||
}, | ||
'edit': { | ||
type: Boolean, | ||
default: true | ||
}, | ||
'content': { | ||
type: String, | ||
default: "" | ||
}, | ||
'afterSaveEvent': { | ||
type: String, | ||
default: "reload" | ||
} | ||
}, | ||
methods: { | ||
clearErrors (name) { | ||
this.form.errors.clear(name) | ||
}, | ||
/** | ||
* Toogle edit state | ||
*/ | ||
toogleEditing() { | ||
this.editing = !this.editing; | ||
}, | ||
/** | ||
* Save change | ||
*/ | ||
save() { | ||
var component = this | ||
this.form.put(this.apiUri + '/' + this.id) | ||
.then(response => { | ||
component.$events.fire(this.afterSaveEventName) | ||
component.toogleEditing(); | ||
}) | ||
.catch(error => { | ||
if(error.response.status != 422) toastr.info('Error saving! ' + error) | ||
}) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style src="./css/fade.css"></style> |
Oops, something went wrong.