fix(TServicoPedido): Ajustes diversos na tela de pedido
This commit is contained in:
parent
df46a60b81
commit
714a0e1f97
6 changed files with 19 additions and 8 deletions
|
|
@ -62,13 +62,13 @@ function TPessoaTableFormSubview({
|
||||||
</ItemTitle>
|
</ItemTitle>
|
||||||
<ItemDescription>{data.pessoa?.email || 'Email não informado'}</ItemDescription>
|
<ItemDescription>{data.pessoa?.email || 'Email não informado'}</ItemDescription>
|
||||||
{params
|
{params
|
||||||
.filter((param) => Number(param.valor) === data.servico.servico_tipo_id)
|
.filter((param) => Number(param.valor) === data?.servico?.servico_tipo_id)
|
||||||
.map((param) => (
|
.map((param) => (
|
||||||
<TPessoaCartaoForm form={form} index={item_index} key={param.config_id} />
|
<TPessoaCartaoForm form={form} index={item_index} key={param.config_id} />
|
||||||
))}
|
))}
|
||||||
</ItemContent>
|
</ItemContent>
|
||||||
<ItemActions>
|
<ItemActions>
|
||||||
{data.servico.requer_biometria === 'S' && (
|
{data?.servico?.requer_biometria === 'S' && (
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
size="icon-lg"
|
size="icon-lg"
|
||||||
|
|
@ -82,7 +82,7 @@ function TPessoaTableFormSubview({
|
||||||
<FingerprintIcon />
|
<FingerprintIcon />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{data.servico.requer_biometria && (
|
{data?.servico?.requer_biometria && (
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
size="icon-lg"
|
size="icon-lg"
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,15 @@ async function executeGCalculoServicoService(
|
||||||
taxa_judiciaria: response.data.taxa_judiciaria ?? 0,
|
taxa_judiciaria: response.data.taxa_judiciaria ?? 0,
|
||||||
valor_iss: response.data.valor_iss ?? 0,
|
valor_iss: response.data.valor_iss ?? 0,
|
||||||
pessoa_id: data?.pessoa?.pessoa_id ?? null,
|
pessoa_id: data?.pessoa?.pessoa_id ?? null,
|
||||||
subview: {
|
subview: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (data?.pessoa?.pessoa_id) {
|
||||||
|
item.subview = {
|
||||||
servico: data.servico_tipo,
|
servico: data.servico_tipo,
|
||||||
pessoa: data.pessoa,
|
pessoa: data.pessoa,
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ export default function HandleSelectTServicoTipoAction({
|
||||||
onOpenPessoaForm,
|
onOpenPessoaForm,
|
||||||
onAddItem,
|
onAddItem,
|
||||||
}: HandleSelectTServicoTipoInterface) {
|
}: HandleSelectTServicoTipoInterface) {
|
||||||
|
|
||||||
if (!servico || !emolumento) {
|
if (!servico || !emolumento) {
|
||||||
return {
|
return {
|
||||||
status: 422,
|
status: 422,
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ function TServicoItemPedidoFormTableComponent({
|
||||||
form,
|
form,
|
||||||
params,
|
params,
|
||||||
}: TServicoItemPedidoFormTableInterface) {
|
}: TServicoItemPedidoFormTableInterface) {
|
||||||
|
console.log(data)
|
||||||
return (
|
return (
|
||||||
<div className="rounded-md border">
|
<div className="rounded-md border">
|
||||||
<Table>
|
<Table>
|
||||||
|
|
|
||||||
|
|
@ -254,6 +254,7 @@ export default function TServicoPedidoForm({ servico_pedido_id }: TServicoPedido
|
||||||
|
|
||||||
// Adiciona o item a tabela e verifica se deve ou não montar a subview da linha da tabela
|
// Adiciona o item a tabela e verifica se deve ou não montar a subview da linha da tabela
|
||||||
const handleSelectServicoTipo = useCallback(() => {
|
const handleSelectServicoTipo = useCallback(() => {
|
||||||
|
|
||||||
const response = HandleSelectTServicoTipoAction({
|
const response = HandleSelectTServicoTipoAction({
|
||||||
servico: selectedServicoTipo,
|
servico: selectedServicoTipo,
|
||||||
emolumento: selectedEmolumento,
|
emolumento: selectedEmolumento,
|
||||||
|
|
@ -265,6 +266,7 @@ export default function TServicoPedidoForm({ servico_pedido_id }: TServicoPedido
|
||||||
if (response?.status) {
|
if (response?.status) {
|
||||||
setResponse(response);
|
setResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [selectedServicoTipo, selectedEmolumento, handleOpenPessoaForm, handleAddItemBasic]);
|
}, [selectedServicoTipo, selectedEmolumento, handleOpenPessoaForm, handleAddItemBasic]);
|
||||||
|
|
||||||
// Cálculo automático dos totais
|
// Cálculo automático dos totais
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,11 @@ export function useTServicoItemPedidoCalculoHook<TFormValues extends FieldValues
|
||||||
}
|
}
|
||||||
|
|
||||||
setTServicoItemPedido((prev) => {
|
setTServicoItemPedido((prev) => {
|
||||||
|
|
||||||
const safePrev = Array.isArray(prev) ? prev : [];
|
const safePrev = Array.isArray(prev) ? prev : [];
|
||||||
|
|
||||||
const novoItem = response?.data as TServicoItemPedidoCalculoResponseInterface;
|
const novoItem = response;
|
||||||
|
|
||||||
if (!novoItem) return safePrev;
|
if (!novoItem) return safePrev;
|
||||||
|
|
||||||
const novoArray = [...safePrev, novoItem];
|
const novoArray = [...safePrev, novoItem];
|
||||||
|
|
@ -50,9 +52,10 @@ export function useTServicoItemPedidoCalculoHook<TFormValues extends FieldValues
|
||||||
}
|
}
|
||||||
|
|
||||||
return novoArray;
|
return novoArray;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return response?.data;
|
return response;
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue