added prettier

This commit is contained in:
Čarodej
2022-02-01 12:21:38 +01:00
parent 5ae875233b
commit b38b532cbe
284 changed files with 25410 additions and 25338 deletions

View File

@@ -1,261 +1,254 @@
<template>
<PopupWrapper name="create-team-folder">
<!--Title-->
<PopupHeader :title="popupTitle" icon="user-plus" />
<!--Content-->
<!--Content-->
<PopupContent>
<!--Item Thumbnail-->
<ThumbnailItem v-if="!isNewFolderTeamCreation" class="mb-5" :item="item" />
<!--Item Thumbnail-->
<ThumbnailItem v-if="! isNewFolderTeamCreation" class="mb-5" :item="item" />
<!--Form to set team folder-->
<!--Form to set team folder-->
<ValidationObserver @submit.prevent="createTeamFolder" ref="teamFolderForm" v-slot="{ invalid }" tag="form">
<!--Set folder name-->
<ValidationProvider v-if="isNewFolderTeamCreation" tag="div" mode="passive" name="Name" rules="required" v-slot="{ errors }">
<AppInputText :title="$t('popup_create_folder.label')" :error="errors[0]">
<input v-model="name" :class="{'border-red': errors[0]}" type="text" ref="name" class="focus-border-theme input-dark" :placeholder="$t('popup_create_folder.placeholder')">
</AppInputText>
<AppInputText :title="$t('popup_create_folder.label')" :error="errors[0]">
<input
v-model="name"
:class="{ 'border-red': errors[0] }"
type="text"
ref="name"
class="focus-border-theme input-dark"
:placeholder="$t('popup_create_folder.placeholder')"
/>
</AppInputText>
</ValidationProvider>
<!--Add Member-->
<ValidationProvider tag="div" mode="passive" name="Email" v-slot="{ errors }">
<AppInputText :title="$t('Add Member')" :error="errors[0]">
<div class="relative">
<span
v-if="email"
@click="addMember"
class="button-base theme absolute right-2 px-3 py-2 font-bold text-sm rounded-lg top-1/2 transform -translate-y-1/2 cursor-pointer"
>
Add
</span>
<input @keypress.enter.stop.prevent="addMember" ref="email" v-model="email" :class="{'border-red': errors[0]}" type="email" class="focus-border-theme input-dark" :placeholder="$t('Type member email...')">
</div>
</AppInputText>
</ValidationProvider>
<!--Add Member-->
<ValidationProvider tag="div" mode="passive" name="Email" v-slot="{ errors }">
<AppInputText :title="$t('Add Member')" :error="errors[0]">
<div class="relative">
<span
v-if="email"
@click="addMember"
class="button-base theme absolute right-2 top-1/2 -translate-y-1/2 transform cursor-pointer rounded-lg px-3 py-2 text-sm font-bold"
>
Add
</span>
<input
@keypress.enter.stop.prevent="addMember"
ref="email"
v-model="email"
:class="{ 'border-red': errors[0] }"
type="email"
class="focus-border-theme input-dark"
:placeholder="$t('Type member email...')"
/>
</div>
</AppInputText>
</ValidationProvider>
<!--Member list-->
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="Members" rules="required" v-slot="{ errors }">
<label class="input-label">{{ $t('Your Members') }}:</label>
<span v-if="errors[0]" class="error-message" style="margin-top: -5px">
{{ $t('Please add at least one member.') }}
</span>
<!--Member list-->
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="Members" rules="required" v-slot="{ errors }">
<label class="input-label">{{ $t('Your Members') }}:</label>
<span v-if="errors[0]" class="error-message" style="margin-top: -5px">
{{ $t('Please add at least one member.') }}
</span>
<TeamList v-model="invitations" />
<TeamList v-model="invitations" />
<p v-if="Object.values(invitations).length === 0" class="text-xs dark:text-gray-500">
{{ $t('Please add at least one member into your Team Folder.') }}
</p>
</ValidationProvider>
<p v-if="Object.values(invitations).length === 0" class="text-xs dark:text-gray-500">
{{ $t('Please add at least one member into your Team Folder.') }}
</p>
</ValidationProvider>
<InfoBox v-if="! isNewFolderTeamCreation" style="margin-bottom: 0">
<p v-html="$t('popup.move_into_team_disclaimer')"></p>
</InfoBox>
<InfoBox v-if="!isNewFolderTeamCreation" style="margin-bottom: 0">
<p v-html="$t('popup.move_into_team_disclaimer')"></p>
</InfoBox>
</ValidationObserver>
</PopupContent>
<!--Actions-->
<!--Actions-->
<PopupActions>
<ButtonBase
class="w-full"
@click.native="$closePopup()"
button-style="secondary"
>{{ $t('popup_move_item.cancel') }}
</ButtonBase>
<ButtonBase
class="w-full"
@click.native="createTeamFolder"
button-style="theme"
:loading="isLoading"
:disabled="isLoading"
>{{ popupSubmit }}
</ButtonBase>
<ButtonBase class="w-full" @click.native="$closePopup()" button-style="secondary">{{ $t('popup_move_item.cancel') }} </ButtonBase>
<ButtonBase class="w-full" @click.native="createTeamFolder" button-style="theme" :loading="isLoading" :disabled="isLoading">{{ popupSubmit }} </ButtonBase>
</PopupActions>
</PopupWrapper>
</template>
<script>
import AppInputText from "../Admin/AppInputText";
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import PopupWrapper from "../Others/Popup/PopupWrapper";
import PopupActions from "../Others/Popup/PopupActions";
import PopupContent from "../Others/Popup/PopupContent";
import PopupHeader from "../Others/Popup/PopupHeader";
import ThumbnailItem from "../Others/ThumbnailItem";
import ButtonBase from "../FilesView/ButtonBase";
import TeamList from "./Components/TeamList";
import {required} from 'vee-validate/dist/rules'
import InfoBox from "../Others/Forms/InfoBox";
import {events} from '../../bus'
import axios from "axios";
import {mapGetters} from "vuex";
import AppInputText from '../Admin/AppInputText'
import { ValidationProvider, ValidationObserver } from 'vee-validate/dist/vee-validate.full'
import PopupWrapper from '../Others/Popup/PopupWrapper'
import PopupActions from '../Others/Popup/PopupActions'
import PopupContent from '../Others/Popup/PopupContent'
import PopupHeader from '../Others/Popup/PopupHeader'
import ThumbnailItem from '../Others/ThumbnailItem'
import ButtonBase from '../FilesView/ButtonBase'
import TeamList from './Components/TeamList'
import { required } from 'vee-validate/dist/rules'
import InfoBox from '../Others/Forms/InfoBox'
import { events } from '../../bus'
import axios from 'axios'
import { mapGetters } from 'vuex'
export default {
name: 'CreateTeamFolderPopup',
components: {
ValidationProvider,
ValidationObserver,
AppInputText,
TeamList,
ThumbnailItem,
PopupWrapper,
PopupActions,
PopupContent,
PopupHeader,
ButtonBase,
required,
InfoBox,
},
computed: {
...mapGetters([
'user'
]),
popupTitle() {
return this.item ? this.$t('Convert as Team Folder') : this.$t('Create Team Folder')
},
popupSubmit() {
return this.item ? this.$t('Move & Invite Members') : this.$t('Create Team Folder')
},
isNewFolderTeamCreation() {
return !this.item
}
},
data() {
return {
invitations: [],
item: undefined,
name: undefined,
email: undefined,
isLoading: false,
}
},
methods: {
async createTeamFolder() {
const isValid = await this.$refs.teamFolderForm.validate()
export default {
name: 'CreateTeamFolderPopup',
components: {
ValidationProvider,
ValidationObserver,
AppInputText,
TeamList,
ThumbnailItem,
PopupWrapper,
PopupActions,
PopupContent,
PopupHeader,
ButtonBase,
required,
InfoBox,
},
computed: {
...mapGetters(['user']),
popupTitle() {
return this.item ? this.$t('Convert as Team Folder') : this.$t('Create Team Folder')
},
popupSubmit() {
return this.item ? this.$t('Move & Invite Members') : this.$t('Create Team Folder')
},
isNewFolderTeamCreation() {
return !this.item
},
},
data() {
return {
invitations: [],
item: undefined,
name: undefined,
email: undefined,
isLoading: false,
}
},
methods: {
async createTeamFolder() {
const isValid = await this.$refs.teamFolderForm.validate()
if (!isValid) return
if (!isValid) return
this.isLoading = true
this.isLoading = true
let route = this.name
? `/api/teams/folders`
: `/api/teams/folders/${this.item.data.id}/convert`
let route = this.name ? `/api/teams/folders` : `/api/teams/folders/${this.item.data.id}/convert`
let payload = this.name
? {
name: this.name,
invitations: this.invitations,
}
: {
invitations: this.invitations,
}
let payload = this.name
? {
name: this.name,
invitations: this.invitations,
}
: {
invitations: this.invitations,
}
axios
.post(route, payload)
.then(response => {
let isTeamFoldersLocation = this.$isThisRoute(this.$route, ['TeamFolders'])
axios
.post(route, payload)
.then((response) => {
let isTeamFoldersLocation = this.$isThisRoute(this.$route, ['TeamFolders'])
// Redirect into newly created team folder
if (isTeamFoldersLocation && this.$route.params.id) {
this.$router.push({name: 'TeamFolders', params: {id: response.data.data.id}})
// Redirect into newly created team folder
if (isTeamFoldersLocation && this.$route.params.id) {
this.$router.push({
name: 'TeamFolders',
params: { id: response.data.data.id },
})
// Add created team folder into Team Folder homepage view
} else if (isTeamFoldersLocation && !this.$route.params.id) {
this.$store.commit('ADD_NEW_FOLDER', response.data)
// Add created team folder into Team Folder homepage view
} else if (isTeamFoldersLocation && !this.$route.params.id) {
this.$store.commit('ADD_NEW_FOLDER', response.data)
// Redirect to Team Folders after converting simple folder
} else if (!isTeamFoldersLocation) {
this.$router.push({name: 'TeamFolders'})
}
// Redirect to Team Folders after converting simple folder
} else if (!isTeamFoldersLocation) {
this.$router.push({ name: 'TeamFolders' })
}
let toasterMessage = this.isNewFolderTeamCreation
? this.$t('Your Team was invited successfully.')
: this.$t('Your Team was invited and folder was moved into Team Folders section.')
let toasterMessage = this.isNewFolderTeamCreation
? this.$t('Your Team was invited successfully.')
: this.$t('Your Team was invited and folder was moved into Team Folders section.')
events.$emit('toaster', {
type: 'success',
message: toasterMessage,
})
events.$emit('toaster', {
type: 'success',
message: toasterMessage,
})
this.$store.dispatch('getAppData')
})
.catch(() => this.$isSomethingWrong())
.finally(() => {
this.isLoading = false
this.name = undefined
this.invitations = undefined
this.$store.dispatch('getAppData')
})
.catch(() => this.$isSomethingWrong())
.finally(() => {
this.isLoading = false
this.name = undefined
this.invitations = undefined
this.$closePopup()
})
},
addMember() {
if (this.$isInvalidEmail(this.email)) {
this.$refs.teamFolderForm.setErrors({
'Email': this.$t("You have to type valid email")
});
return;
}
this.$closePopup()
})
},
addMember() {
if (this.$isInvalidEmail(this.email)) {
this.$refs.teamFolderForm.setErrors({
Email: this.$t('You have to type valid email'),
})
return
}
if ( this.$cantInviteMember(this.email, this.invitations) ) {
this.$refs.teamFolderForm.setErrors({
'Email': this.$t("You have to upgrade your account to add this new member.")
});
return;
}
if (this.$cantInviteMember(this.email, this.invitations)) {
this.$refs.teamFolderForm.setErrors({
Email: this.$t('You have to upgrade your account to add this new member.'),
})
return
}
this.$refs.teamFolderForm.reset()
this.$refs.teamFolderForm.reset()
this.invitations.unshift({
type: 'invitation',
email: this.email,
permission: 'can-edit',
})
this.invitations.unshift({
type: 'invitation',
email: this.email,
permission: 'can-edit',
})
this.email = undefined
}
},
mounted() {
events.$on('popup:open', args => {
if (args.name !== 'create-team-folder') return
this.email = undefined
},
},
mounted() {
events.$on('popup:open', (args) => {
if (args.name !== 'create-team-folder') return
this.item = args.item
this.item = args.item
this.$nextTick(() => {
this.$nextTick(() => {
if (this.$isMobile()) return
if (this.$isMobile()) return
if (this.item) this.$refs.email.focus()
if (this.item)
this.$refs.email.focus()
if (!this.item) this.$refs.name.focus()
})
})
if (!this.item)
this.$refs.name.focus()
})
})
events.$on('popup:close', () => {
setTimeout(() => {
this.email = undefined
this.name = undefined
this.item = undefined
this.invitations = []
}, 150)
})
events.$on('popup:close', () => {
setTimeout(() => {
this.email = undefined
this.name = undefined
this.item = undefined
this.invitations = []
}, 150)
})
console.log(
);
}
}
console.log()
},
}
</script>
<style scoped lang="scss">
@import 'resources/sass/vuefilemanager/_inapp-forms.scss';
@import '../../../sass/vuefilemanager/forms';
@import 'resources/sass/vuefilemanager/_inapp-forms.scss';
@import '../../../sass/vuefilemanager/forms';
.item-thumbnail {
margin-bottom: 20px;
}
.item-thumbnail {
margin-bottom: 20px;
}
</style>