|
@@ -1,43 +1,46 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <DefaultTable
|
|
|
|
|
- ref="tableRef"
|
|
|
|
|
- :columns="columns"
|
|
|
|
|
- :loading="loading"
|
|
|
|
|
- :api-call="getCustomSchedules"
|
|
|
|
|
- :add-button-label="$t('opportunities.add')"
|
|
|
|
|
- :empty-message="$t('opportunities.empty_state')"
|
|
|
|
|
- :delete-function="deleteCustomSchedule"
|
|
|
|
|
- :mostrar-selecao-de-colunas="false"
|
|
|
|
|
- :mostrar-botao-fullscreen="false"
|
|
|
|
|
- :mostrar-toggle-inativos="false"
|
|
|
|
|
- :open-item="true"
|
|
|
|
|
- @on-row-click="onRowClick"
|
|
|
|
|
- @on-add-item="onAddItem"
|
|
|
|
|
- >
|
|
|
|
|
- <template #body-cell-status="template_props">
|
|
|
|
|
- <q-td :props="template_props">
|
|
|
|
|
- <q-chip
|
|
|
|
|
- :label="$t(`schedules.statuses.${template_props.row.schedule?.status}`)"
|
|
|
|
|
- :color="getStatusColor(template_props.row.schedule?.status)"
|
|
|
|
|
- text-color="white"
|
|
|
|
|
- size="sm"
|
|
|
|
|
- />
|
|
|
|
|
- </q-td>
|
|
|
|
|
- </template>
|
|
|
|
|
|
|
+ <q-page>
|
|
|
|
|
+ <DefaultHeaderPage />
|
|
|
|
|
+ <DefaultTable
|
|
|
|
|
+ ref="tableRef"
|
|
|
|
|
+ :columns="columns"
|
|
|
|
|
+ :loading="loading"
|
|
|
|
|
+ :api-call="getCustomSchedules"
|
|
|
|
|
+ :add-button-label="$t('opportunities.add')"
|
|
|
|
|
+ :empty-message="$t('opportunities.empty_state')"
|
|
|
|
|
+ :delete-function="deleteCustomSchedule"
|
|
|
|
|
+ :mostrar-selecao-de-colunas="false"
|
|
|
|
|
+ :mostrar-botao-fullscreen="false"
|
|
|
|
|
+ :mostrar-toggle-inativos="false"
|
|
|
|
|
+ :open-item="true"
|
|
|
|
|
+ @on-row-click="onRowClick"
|
|
|
|
|
+ @on-add-item="onAddItem"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #body-cell-status="template_props">
|
|
|
|
|
+ <q-td :props="template_props">
|
|
|
|
|
+ <q-chip
|
|
|
|
|
+ :label="$t(`schedules.statuses.${template_props.row.schedule?.status}`)"
|
|
|
|
|
+ :color="getStatusColor(template_props.row.schedule?.status)"
|
|
|
|
|
+ text-color="white"
|
|
|
|
|
+ size="sm"
|
|
|
|
|
+ />
|
|
|
|
|
+ </q-td>
|
|
|
|
|
+ </template>
|
|
|
|
|
|
|
|
- <template #body-cell-price_range="template_props">
|
|
|
|
|
- <q-td :props="template_props">
|
|
|
|
|
- {{ formatCurrency(template_props.row.min_price) }}
|
|
|
|
|
- {{ formatCurrency(template_props.row.max_price) }}
|
|
|
|
|
- </q-td>
|
|
|
|
|
- </template>
|
|
|
|
|
|
|
+ <template #body-cell-price_range="template_props">
|
|
|
|
|
+ <q-td :props="template_props">
|
|
|
|
|
+ {{ formatToBRLCurrency(template_props.row.min_price) }}
|
|
|
|
|
+ {{ formatToBRLCurrency(template_props.row.max_price) }}
|
|
|
|
|
+ </q-td>
|
|
|
|
|
+ </template>
|
|
|
|
|
|
|
|
- <template #body-cell-period="template_props">
|
|
|
|
|
- <q-td :props="template_props">
|
|
|
|
|
- {{ template_props.row.schedule?.period_type }}{{ $t('schedules.hours') }}
|
|
|
|
|
- </q-td>
|
|
|
|
|
- </template>
|
|
|
|
|
- </DefaultTable>
|
|
|
|
|
|
|
+ <template #body-cell-period="template_props">
|
|
|
|
|
+ <q-td :props="template_props">
|
|
|
|
|
+ {{ template_props.row.schedule?.period_type }}{{ $t('schedules.hours') }}
|
|
|
|
|
+ </q-td>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </DefaultTable>
|
|
|
|
|
+ </q-page>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
@@ -47,6 +50,8 @@ import { useQuasar } from 'quasar'
|
|
|
import { getCustomSchedules, deleteCustomSchedule } from 'src/api/customSchedule'
|
|
import { getCustomSchedules, deleteCustomSchedule } from 'src/api/customSchedule'
|
|
|
import DefaultTable from 'src/components/defaults/DefaultTable.vue'
|
|
import DefaultTable from 'src/components/defaults/DefaultTable.vue'
|
|
|
import AddEditCustomScheduleDialog from './components/AddEditCustomScheduleDialog.vue'
|
|
import AddEditCustomScheduleDialog from './components/AddEditCustomScheduleDialog.vue'
|
|
|
|
|
+import { formatToBRLCurrency } from 'src/helpers/utils'
|
|
|
|
|
+import DefaultHeaderPage from 'src/components/layout/DefaultHeaderPage.vue'
|
|
|
|
|
|
|
|
const { t } = useI18n()
|
|
const { t } = useI18n()
|
|
|
const $q = useQuasar()
|
|
const $q = useQuasar()
|
|
@@ -58,7 +63,7 @@ const columns = computed(() => [
|
|
|
name: 'id',
|
|
name: 'id',
|
|
|
label: 'ID',
|
|
label: 'ID',
|
|
|
align: 'left',
|
|
align: 'left',
|
|
|
- field: 'id',
|
|
|
|
|
|
|
+ field: row => row.schedule?.id,
|
|
|
sortable: true
|
|
sortable: true
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -86,21 +91,21 @@ const columns = computed(() => [
|
|
|
name: 'period',
|
|
name: 'period',
|
|
|
label: t('opportunities.period'),
|
|
label: t('opportunities.period'),
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- field: row => row.schedule?.period_type,
|
|
|
|
|
|
|
+ field: row => row.schedule?.period_type + ' h',
|
|
|
sortable: true
|
|
sortable: true
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: 'price_range',
|
|
name: 'price_range',
|
|
|
label: t('opportunities.price_range'),
|
|
label: t('opportunities.price_range'),
|
|
|
align: 'right',
|
|
align: 'right',
|
|
|
- field: row => `${row.min_price} - ${row.max_price}`,
|
|
|
|
|
|
|
+ field: row => `${formatToBRLCurrency(row.min_price)} - ${formatToBRLCurrency(row.max_price)}`,
|
|
|
sortable: false
|
|
sortable: false
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: 'status',
|
|
name: 'status',
|
|
|
label: t('common.terms.status'),
|
|
label: t('common.terms.status'),
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- field: row => row.schedule?.status,
|
|
|
|
|
|
|
+ field: row => t(`schedules.statuses.${row.schedule?.status}`),
|
|
|
sortable: true
|
|
sortable: true
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -124,13 +129,6 @@ const getStatusColor = (status) => {
|
|
|
return colors[status] || 'grey'
|
|
return colors[status] || 'grey'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const formatCurrency = (value) => {
|
|
|
|
|
- return new Intl.NumberFormat('pt-BR', {
|
|
|
|
|
- style: 'currency',
|
|
|
|
|
- currency: 'BRL'
|
|
|
|
|
- }).format(value)
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
const onAddItem = () => {
|
|
const onAddItem = () => {
|
|
|
$q.dialog({
|
|
$q.dialog({
|
|
|
component: AddEditCustomScheduleDialog,
|
|
component: AddEditCustomScheduleDialog,
|