Skip to content

Commit

Permalink
Merge pull request #16 from MarceloVichar/refactor/create-button-perm…
Browse files Browse the repository at this point in the history
…issions

corrigidas permissoes de criar entidades
  • Loading branch information
MarceloVichar authored Jan 23, 2024
2 parents eec3251 + 7b648b9 commit 5b8d3d6
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 9 deletions.
5 changes: 4 additions & 1 deletion pages/company/events/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
placeholder="Pesquisar evento por nome"
@update:modelValue="setQueryParam('filter[tour]', $event)"
/>
<AddEntityButton to="/company/events/create" />
<Can permission="events create">
<AddEntityButton to="/company/events/create" />
</Can>
</div>
<EventsTable
:data="data?.data"
Expand All @@ -27,6 +29,7 @@ import {getQueryParam, setQueryParam, useRouteQueryWatcher} from '~/composables/
import EventsTable from '~/components/app/company/events/EventsTable.vue';
import EventService from '~/services/api/company/event/EventService';
import AddEntityButton from '~/components/shared/AddEntityButton.vue';
import Can from '~/components/shared/Can.vue';
const eventsService = new EventService()
const route = useRoute()
Expand Down
5 changes: 4 additions & 1 deletion pages/company/records/drivers/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
placeholder="Pesquisar motorista por nome"
@update:modelValue="setQueryParam('filter[name]', $event)"
/>
<AddEntityButton to="/company/records/drivers/create" />
<Can permission="drivers create">
<AddEntityButton to="/company/records/drivers/create" />
</Can>
</div>
<DriversTable
:data="data?.data"
Expand All @@ -27,6 +29,7 @@ import {getQueryParam, setQueryParam, useRouteQueryWatcher} from '~/composables/
import DriversTable from '~/components/app/company/records/drivers/DriversTable.vue';
import DriverService from '~/services/api/company/records/driver/DriverService';
import AddEntityButton from '~/components/shared/AddEntityButton.vue';
import Can from '~/components/shared/Can.vue';
const driversService = new DriverService()
const route = useRoute()
Expand Down
5 changes: 4 additions & 1 deletion pages/company/records/locales/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
placeholder="Pesquisar local por nome"
@update:modelValue="setQueryParam('filter[name]', $event)"
/>
<AddEntityButton to="/company/records/locales/create" />
<Can permission="locales create">
<AddEntityButton to="/company/records/locales/create" />
</Can>
</div>
<LocalesTable
:data="data?.data"
Expand All @@ -27,6 +29,7 @@ import {getQueryParam, setQueryParam, useRouteQueryWatcher} from '~/composables/
import LocalesTable from '~/components/app/company/records/locales/LocalesTable.vue';
import LocaleService from '~/services/api/company/records/locale/LocaleService';
import AddEntityButton from '~/components/shared/AddEntityButton.vue';
import Can from '~/components/shared/Can.vue';
const localesService = new LocaleService()
const route = useRoute()
Expand Down
5 changes: 4 additions & 1 deletion pages/company/records/tour-guides/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
placeholder="Pesquisar guia de passeio por nome"
@update:modelValue="setQueryParam('filter[name]', $event)"
/>
<AddEntityButton to="/company/records/tour-guides/create" />
<Can permission="tour-guides create">
<AddEntityButton to="/company/records/tour-guides/create" />
</Can>
</div>
<TourGuidesTable
:data="data?.data"
Expand All @@ -27,6 +29,7 @@ import {getQueryParam, setQueryParam, useRouteQueryWatcher} from '~/composables/
import TourGuidesTable from '~/components/app/company/records/tour-guides/TourGuidesTable.vue';
import TourGuideService from '~/services/api/company/records/tour-guide/TourGuideService';
import AddEntityButton from '~/components/shared/AddEntityButton.vue';
import Can from '~/components/shared/Can.vue';
const tourGuidesService = new TourGuideService()
const route = useRoute()
Expand Down
5 changes: 4 additions & 1 deletion pages/company/records/tour-types/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
placeholder="Pesquisar tipo de passeio por nome"
@update:modelValue="setQueryParam('filter[name]', $event)"
/>
<AddEntityButton to="/company/records/tour-types/create" />
<Can permission="tour-types create">
<AddEntityButton to="/company/records/tour-types/create" />
</Can>
</div>
<TourTypesTable
:data="data?.data"
Expand All @@ -27,6 +29,7 @@ import {getQueryParam, setQueryParam, useRouteQueryWatcher} from '~/composables/
import TourTypesTable from '~/components/app/company/records/tour-types/TourTypesTable.vue';
import TourTypeService from '~/services/api/company/records/tour-type/TourTypeService';
import AddEntityButton from '~/components/shared/AddEntityButton.vue';
import Can from '~/components/shared/Can.vue';
const tourTypesService = new TourTypeService()
const route = useRoute()
Expand Down
5 changes: 4 additions & 1 deletion pages/company/records/tours/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
placeholder="Pesquisar passeio por nome"
@update:modelValue="setQueryParam('filter[name]', $event)"
/>
<AddEntityButton to="/company/records/tours/create" />
<Can permission="tours create">
<AddEntityButton to="/company/records/tours/create" />
</Can>
</div>
<ToursTable
:data="data?.data"
Expand All @@ -27,6 +29,7 @@ import {getQueryParam, setQueryParam, useRouteQueryWatcher} from '~/composables/
import ToursTable from '~/components/app/company/records/tours/ToursTable.vue';
import TourService from '~/services/api/company/records/tour/TourService';
import AddEntityButton from '~/components/shared/AddEntityButton.vue';
import Can from '~/components/shared/Can.vue';
const toursService = new TourService()
const route = useRoute()
Expand Down
5 changes: 4 additions & 1 deletion pages/company/records/vehicles/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
placeholder="Pesquisar veículo por modelo"
@update:modelValue="setQueryParam('filter[model]', $event)"
/>
<AddEntityButton to="/company/records/vehicles/create" />
<Can permission="vehicles create">
<AddEntityButton to="/company/records/vehicles/create" />
</Can>
</div>
<VehiclesTable
:data="data?.data"
Expand All @@ -27,6 +29,7 @@ import {getQueryParam, setQueryParam, useRouteQueryWatcher} from '~/composables/
import VehiclesTable from '~/components/app/company/records/vehicles/VehiclesTable.vue';
import VehicleService from '~/services/api/company/records/vehicle/VehicleService';
import AddEntityButton from '~/components/shared/AddEntityButton.vue';
import Can from '~/components/shared/Can.vue';
const vehiclesService = new VehicleService()
const route = useRoute()
Expand Down
5 changes: 4 additions & 1 deletion pages/company/sales/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<template>
<div class="flex flex-col gap-2">
<div class="flex justify-end">
<AddEntityButton to="/company/sales/create" text="Nova venda" />
<Can permission="sales create" text="Nova venda">
<AddEntityButton to="/company/sales/create" />
</Can>
</div>
<SalesFiltersForm />
<SalesTable
Expand All @@ -23,6 +25,7 @@ import SalesTable from '~/components/app/company/sales/SalesTable.vue';
import SaleService from '~/services/api/company/sale/SaleService';
import SalesFiltersForm from '~/components/app/company/sales/SalesFiltersForm.vue';
import AddEntityButton from '~/components/shared/AddEntityButton.vue';
import Can from '~/components/shared/Can.vue';
const salesService = new SaleService()
const route = useRoute()
Expand Down
5 changes: 4 additions & 1 deletion pages/company/users/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
:model-value="getQueryParam('filter[role]', '')"
@update:modelValue="setQueryParam('filter[role]', $event)"
/>
<AddEntityButton to="/company/users/create" />
<Can permission="users create">
<AddEntityButton to="/company/users/create" />
</Can>
</div>
<UsersTable
:data="data?.data"
Expand All @@ -38,6 +40,7 @@ import UserService from '~/services/api/company/user/UserService';
import CustomSelect from '~/components/shared/form/CustomSelect.vue';
import {companyUserRoles} from '~/data/objects';
import AddEntityButton from '~/components/shared/AddEntityButton.vue';
import Can from '~/components/shared/Can.vue';
const usersService = new UserService()
const route = useRoute()
Expand Down

0 comments on commit 5b8d3d6

Please sign in to comment.