Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Brunobento1990 committed Dec 23, 2024
1 parent 3fdd23f commit 751ce18
Show file tree
Hide file tree
Showing 28 changed files with 635 additions and 414 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/build-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@ name: Docker Image CI

on:
push:
branches: [ "main" ]
branches: ['main']

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build
run: docker build . -t brunobentocaina/open-adm-ui:latest
- name: Push
run: |
docker login -u brunobentocaina -p ${{ secrets.DOCKER_HUB_KEY }}
docker push brunobentocaina/open-adm-ui:latest
- uses: actions/checkout@v3
- name: Make envfile
run: |
cat > .env.production
echo "NEXT_PUBLIC_URL_API=secrets.URL_API" >> .env.production
echo "$(<.env.production)"
- name: Build
run: docker build . -t brunobentocaina/open-adm-ui:latest
- name: Push
run: |
docker login -u brunobentocaina -p ${{ secrets.DOCKER_HUB_KEY }}
docker push brunobentocaina/open-adm-ui:latest
2 changes: 1 addition & 1 deletion src/@open-adm/adapters/formik-adapter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface propsUseFormikAdapter {

export function useFormikAdapter<T = any>(props: propsUseFormikAdapter) {
const formik = useFormik({
initialValues: props.initialValues,
initialValues: props.initialValues ?? {},
validationSchema: props.validationSchema,
onSubmit: props.onSubmit,
});
Expand Down
46 changes: 45 additions & 1 deletion src/@open-adm/api/use-api-fatura.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useNewApi } from "../hooks/use-new-api";
import { IFaturaContasAReceber, IPagarFaturaAReceber } from "../types/contas-a-receber";
import { IFatura, IParcela } from "../types/fatura";

export function useApiFatura() {
Expand All @@ -23,6 +24,45 @@ export function useApiFatura() {
notAlert: true
})

const apiParcelasPorPedido = useNewApi({
method: 'GET',
url: 'parcela/pedido?pedidoId=',
notAlert: true
});

const apiGet = useNewApi({
method: 'GET',
url: 'parcela/get-by-id?id=',
notAlert: true
});

const apiPagarFatura = useNewApi({
method: 'PUT',
url: 'parcela/pagar',
notAlert: true
});

const apiEdit = useNewApi({
method: 'PUT',
url: 'parcela/edit'
});

async function parcelasDoPedido(pedidoId: string, statusFatura?: number): Promise<IFaturaContasAReceber[] | undefined> {
return await apiParcelasPorPedido.fecth<IFaturaContasAReceber[]>({ urlParams: `${pedidoId}&statusFatura=${statusFatura ?? '0'}` })
}

async function get(id: string): Promise<IFaturaContasAReceber | undefined> {
return await apiGet.fecth<IFaturaContasAReceber>({ urlParams: id })
}

async function pagar(body: IPagarFaturaAReceber): Promise<IFaturaContasAReceber | undefined> {
return await apiPagarFatura.fecth<IFaturaContasAReceber>({ body })
}

async function edit(body: Partial<IFaturaContasAReceber>): Promise<IFaturaContasAReceber | undefined> {
return await apiEdit.fecth<IFaturaContasAReceber>({ body })
}

async function editarParcela(body: IParcela): Promise<IParcela | undefined> {
return await editarParcelaApi.fecth({ body })
}
Expand All @@ -43,6 +83,10 @@ export function useApiFatura() {
editarParcela,
getFatura,
adicionarParcela,
excluirFatura
excluirFatura,
parcelasDoPedido,
pagar,
get,
edit
}
}
30 changes: 30 additions & 0 deletions src/@open-adm/api/use-api-parcela.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { useNewApi } from "../hooks/use-new-api";
import { IPagarParcela, IParcela } from "../types/fatura";

export function useApiParcela() {
const apiGet = useNewApi({
method: 'GET',
url: 'parcela/get-by-id',
notAlert: true,
})

const apiPagar = useNewApi({
method: 'PUT',
url: 'parcela/pagar'
})

async function obterParcela(id: string): Promise<IParcela | undefined> {
return await apiGet.fecth({
urlParams: `?id=${id}`
})
}

async function pagarParcela(pagarParcela: IPagarParcela): Promise<IParcela | undefined> {
return await apiPagar.fecth({ body: pagarParcela, message: 'Parcela paga com sucesso!' })
}

return {
obterParcela,
pagarParcela
}
}
18 changes: 18 additions & 0 deletions src/@open-adm/api/use-api-transacao.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { useNewApi } from "../hooks/use-new-api";
import { IExtratoTrasacao, ITransacaoFinanceira } from "../types/transacao-financeira";

export function useApiTransacao() {
const apiPeriodo = useNewApi({
method: 'POST',
url: 'transacao-financeira/periodo',
notAlert: true
})

async function extratoPeriodo(body: IExtratoTrasacao): Promise<ITransacaoFinanceira[] | undefined> {
return await apiPeriodo.fecth({ body })
}

return {
extratoPeriodo
}
}
3 changes: 2 additions & 1 deletion src/@open-adm/components/chip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const Chip = (props: CustomChipProps) => {
interface propsStatusApp {
cor: "default" | "primary" | "secondary" | "error" | "info" | "success" | "warning";
titulo?: string;
width?: string;
}

export function StatusApp(props: propsStatusApp) {
Expand All @@ -56,7 +57,7 @@ export function StatusApp(props: propsStatusApp) {
skin='light'
color={props.cor}
label={props.titulo}
sx={{ '& .MuiChip-label': { textTransform: 'capitalize' } }}
sx={{ '& .MuiChip-label': { textTransform: 'capitalize' }, width: props.width }}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export function DropDownMultiple(props: propsDropDownMultiple) {
const { fecth } = useNewApi({
method: props.method ?? 'GET',
url: props.url,
notLoading: true,
notAlert: true
})

Expand Down
28 changes: 12 additions & 16 deletions src/@open-adm/components/table-paginacao/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BoxApp } from '../box';
import { FooterTable } from './footer';
import { HeaderTable } from './header';
import { Card, CircularProgress, Divider, IconButton, Tooltip, Typography } from '@mui/material';
import { GridColDef, GridRenderCellParams } from '@mui/x-data-grid';
import { GridColDef } from '@mui/x-data-grid';
import IconifyIcon from 'src/@core/components/icon';
import { useApi } from 'src/@open-adm/hooks/use-api';
import { useModal } from '../modal/modal';
Expand All @@ -30,6 +30,7 @@ interface tableProps {
desabilitarColunaAcoes?: boolean;
metodo?: TypeMethod;
childrenHeader?: ReactNode;
minWidth?: number;
}

export function TableIndex(props: tableProps) {
Expand All @@ -53,7 +54,6 @@ export function TableIndex(props: tableProps) {
method: props.metodo ?? 'POST',
url: props.url,
notAlert: true,
notLoading: true,
});

const body = {
Expand Down Expand Up @@ -101,16 +101,14 @@ export function TableIndex(props: tableProps) {
function optionsColumns(): GridColDef<any>[] {
return [
{
flex: 0.175,
minWidth: 140,
width: 200,
field: 'dataDeCriacao',
headerName: 'Data de cadastro',
renderCell: (params: any) => formatDate(params?.dataDeCriacao),
sortable: true,
},
{
flex: 0.175,
minWidth: 140,
width: 200,
field: 'action',
headerName: 'Ações',
renderCell: (params: any) => {
Expand Down Expand Up @@ -164,8 +162,7 @@ export function TableIndex(props: tableProps) {
{
field: 'numero',
headerName: 'Número',
flex: 0.100,
minWidth: 80,
width: 80,
renderCell: (params: any) => (
<Typography variant='body2' sx={{ color: 'success' }}>
#{params.numero}
Expand Down Expand Up @@ -222,14 +219,13 @@ export function TableIndex(props: tableProps) {
<CircularProgress size={20} />
</BoxApp>
) : (
<>
<TablePaginacao
columns={[...defaultColuns(), ...props.columns, ...optionsColumns()]}
rows={rows}
sorting={sorting}
setSorting={setSorting}
/>
</>
<TablePaginacao
columns={[...defaultColuns(), ...props.columns, ...optionsColumns()]}
rows={rows}
sorting={sorting}
setSorting={setSorting}
minWidth={props.minWidth}
/>
)}
</BoxApp>
<Divider sx={{
Expand Down
2 changes: 1 addition & 1 deletion src/@open-adm/hooks/use-api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,4 @@ export function useApi() {
deleteApi,
getCnpj
}
}
}
3 changes: 0 additions & 3 deletions src/@open-adm/hooks/use-new-api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ interface propsUseApi {
url: string;
notHandleError?: boolean;
notAlert?: boolean;
notLoading?: boolean;
}

interface propsFecth {
Expand All @@ -35,8 +34,6 @@ export function useNewApi(props: propsUseApi) {
const { getItem } = useLocalStorage();

const URL_API = process.env.NEXT_PUBLIC_URL_API;
//const URL_API = 'http://localhost:8000/api/v1/'
//const URL_API = 'http://localhost:8000/api/v1/'

const api = axios.create({
baseURL: URL_API,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export function useApiConfiguracaoDeFrete() {
method: 'GET',
url: 'configuracao-de-frete/get',
notAlert: true,
notLoading: true
});

async function create(body: IConfiguracaoDeFreteCreate): Promise<IConfiguracaoDeFrete | undefined> {
Expand Down
4 changes: 2 additions & 2 deletions src/@open-adm/pages/estoque/relatorio-producao/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function RelatorioProducao() {
}
setLoading(false);
}
console.log('values', form.values)

return (
<Form
action="create"
Expand Down Expand Up @@ -134,4 +134,4 @@ export function RelatorioProducao() {
}
</Form>
)
}
}
Loading

0 comments on commit 751ce18

Please sign in to comment.