-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7666f1c
commit c170180
Showing
15 changed files
with
427 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useNewApi } from '../hooks/use-new-api' | ||
import { ITabelaDePreco } from 'src/@open-adm/types/tabela-de-preco' | ||
|
||
export function useApiTabelaDePreco() { | ||
const apiTabelaDePrecoPadraoEcommerce = useNewApi({ | ||
method: 'GET', | ||
url: 'tabelas-de-precos/get-tabela-ativa', | ||
notAlert: true | ||
}) | ||
|
||
async function tabelaDePrecoEcommerce(): Promise<ITabelaDePreco | undefined> { | ||
return await apiTabelaDePrecoPadraoEcommerce.fecth() | ||
} | ||
|
||
return { | ||
tabelaDePrecoEcommerce | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { IconButton } from "@mui/material"; | ||
import IconifyIcon from "src/@core/components/icon"; | ||
import { YupAdapter } from "src/@open-adm/adapters/yup-adapter"; | ||
import { IItemPedidoCreate, IPedidoCreate } from "src/@open-adm/types/pedido"; | ||
import { formatMoney } from "src/@open-adm/utils/format-money"; | ||
import { listaIcones } from "src/configs/listaIcones"; | ||
|
||
export const initialValues: IPedidoCreate = { | ||
usuarioId: "", | ||
usuario: undefined!, | ||
itens: [], | ||
tabelaDePrecoId: "", | ||
tabelaDePreco: undefined! | ||
} | ||
|
||
export const schema = new YupAdapter() | ||
.string('usuarioId') | ||
.string('tabelaDePrecoId', 'Selecione a tabela de preço') | ||
.build(); | ||
|
||
interface propsConfig { | ||
remove: (index: number) => void; | ||
} | ||
|
||
export function config(props: propsConfig) { | ||
const coluns = [ | ||
{ | ||
field: 'descricao', | ||
headerName: 'Descricao', | ||
renderCell: (item: IItemPedidoCreate) => item.produto?.descricao | ||
}, | ||
{ | ||
field: 'peso', | ||
headerName: 'Peso', | ||
renderCell: (item: IItemPedidoCreate) => item.peso?.descricao | ||
}, | ||
{ | ||
field: 'tamanho', | ||
headerName: 'Tamanho', | ||
renderCell: (item: IItemPedidoCreate) => item.tamanho?.descricao | ||
}, | ||
{ | ||
field: 'quantidade', | ||
headerName: 'Qtd', | ||
renderCell: (item: IItemPedidoCreate) => item.quantidade | ||
}, | ||
{ | ||
field: 'valorUnitario', | ||
headerName: 'Vlr', | ||
renderCell: (item: IItemPedidoCreate) => formatMoney(item.valorUnitario) | ||
}, | ||
{ | ||
field: 'excluir', | ||
headerName: 'Excluir', | ||
renderCell: (_: any, i: number) => { | ||
return ( | ||
<IconButton> | ||
<IconifyIcon icon={listaIcones.delete} onClick={() => props.remove(i)} /> | ||
</IconButton> | ||
) | ||
} | ||
}, | ||
] | ||
|
||
return { | ||
coluns | ||
} | ||
} |
Oops, something went wrong.