Skip to content

Commit

Permalink
implementada dash de admin
Browse files Browse the repository at this point in the history
  • Loading branch information
MarceloVichar committed Apr 11, 2024
1 parent 4e7a2b8 commit 7d34156
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 7 deletions.
2 changes: 1 addition & 1 deletion components/app/company/sales/form-steps/EventsStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async function fetchEvents(params) {
return await new EventService().index({...params, perPage: 100})
.then((response) => {
response.data.forEach((event) => {
event.tour = event?.tour?.name || ''
event.tour = `${event?.tour?.name} ${useFormattedDateTime(event?.departureDateTime)}`
})
events.value = response.data
})
Expand Down
2 changes: 1 addition & 1 deletion components/shared/CentralizedContainer.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="w-full flex justify-center">
<div class="w-full md:w-[600px]">
<div class="w-full md:w-[700px]">
<slot />
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions pages/admin/companies/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ definePageMeta({
title: 'Empresas',
})
async function fetchUsers() {
async function fetchCompanies() {
return companiesService.index({ ...route.query })
.catch(() => {
useNotify('error', 'Ops! Ocorreu algum erro, tente novamente mais tarde.')
})
}
const {pending, data, refresh} = useLazyAsyncData('users', await fetchUsers)
const {pending, data, refresh} = useLazyAsyncData('users', await fetchCompanies)
useRouteQueryWatcher(refresh)
Expand Down
34 changes: 32 additions & 2 deletions pages/admin/home.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
<template>
<div>
teste
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
<Card title="Empresas cadastradas" type="primary" :text="data?.companies || 0" />
<Card title="Usuários cadastrados" type="info" :text="data?.users || 0" />
</div>
</template>

<script setup>
import CompanyService from "~/services/api/admin/CompanyService";

Check failure on line 9 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

Strings must use singlequote
import UserService from "~/services/api/admin/UserService";

Check failure on line 10 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

Strings must use singlequote
import Card from "~/components/shared/Card.vue";

Check failure on line 11 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

Strings must use singlequote
useHead({
title: 'Dashboard',
})
definePageMeta({
layout: 'default',
})
const companyService = new CompanyService()
const userService = new UserService()
async function fetchData() {
const companies = await companyService.index()
.then((res) => res.meta?.total)

Check failure on line 26 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

Expected indentation of 4 spaces but found 6
.catch(() => {

Check failure on line 27 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

Expected indentation of 4 spaces but found 6
useNotify('error', 'Ops! Ocorreu algum erro, tente novamente mais tarde.')

Check failure on line 28 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

Expected indentation of 6 spaces but found 8
})

Check failure on line 29 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

Expected indentation of 4 spaces but found 6
const users = await userService.index()
.then((res) => res.meta?.total)

Check failure on line 32 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

Expected indentation of 4 spaces but found 6
.catch(() => {

Check failure on line 33 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

Expected indentation of 4 spaces but found 6
useNotify('error', 'Ops! Ocorreu algum erro, tente novamente mais tarde.')

Check failure on line 34 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

Expected indentation of 6 spaces but found 8
})
return {companies, users}
}
const {pending, data, refresh} = useLazyAsyncData('dashData', await fetchData)

Check warning on line 40 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

'pending' is assigned a value but never used

Check warning on line 40 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

'pending' is assigned a value but never used

Check warning on line 40 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

'refresh' is assigned a value but never used

Check warning on line 40 in pages/admin/home.vue

View workflow job for this annotation

GitHub Actions / check-eslint (20.x)

'refresh' is assigned a value but never used
</script>
5 changes: 4 additions & 1 deletion pages/auth/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ definePageMeta({
layout: 'auth',
})
useHead({
title: 'Login',
})
const isSending = ref(false)
const authStore = useAuth()
Expand All @@ -71,7 +75,6 @@ async function onSubmit() {
await authStore.login(form.data)
.then(() => {
navigateTo('/')
useNotify('success', 'Login realizado com sucesso')
})
.catch((err) => {
useNotify('error', _get(err, 'response.data.message', 'Não foi possível fazer login'))
Expand Down

0 comments on commit 7d34156

Please sign in to comment.