feat(web): pestañas Contenido, Logística y Finanzas en los documentos de ventas y compras, con datos del socio (contacto, direcciones, condiciones y forma de pago)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
GeorgeandClaude Sonnet 5.5 committed 2026-10-19 14:50:33 -05:00
1 parent c002c2cf3e
commit a3bd976bbd
7 files changed
+328 -32

No files matched your search

@@ -13,7 +13,7 @@ import { CheckboxField, CheckboxInput, DateField, LookupField, NumberField, Numb
import type { GridLine, GridMultiAdd } from '../../shared/grid/grid.types';
import { LinesGrid } from '../../shared/grid/lines-grid';
import type { VhLookup } from '../../shared/value-help/value-help.types';
import { Icon, MenuButton, type MenuItem, SboWindow, Toolbar, type StatusMessage, type WindowBadge } from '../../shared/window';
import { Icon, MenuButton, type MenuItem, SboWindow, Tab, Tabs, Toolbar, type StatusMessage, type WindowBadge } from '../../shared/window';
import { ValueHelp } from '../../shared/value-help/value-help';
import type { ListRow } from '../../shared/list/list.types';
import {
@@ -72,7 +72,7 @@ const folioAsNumber = (h: DocRecord): DocRecord => {
@Component({
selector: 'sbo-document-form-page',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [CheckboxField, CheckboxInput, DateField, Icon, LinesGrid, LookupField, MenuButton, NgTemplateOutlet, NumberField, NumberInput, RouterLink, RowsTable, SboField, SelectField, SelectInput, SboWindow, TextField, TextInput, TextareaField, Toolbar, ValueHelp],
imports: [Tab, Tabs, CheckboxField, CheckboxInput, DateField, Icon, LinesGrid, LookupField, MenuButton, NgTemplateOutlet, NumberField, NumberInput, RouterLink, RowsTable, SboField, SelectField, SelectInput, SboWindow, TextField, TextInput, TextareaField, Toolbar, ValueHelp],
templateUrl: './document-form.page.html',
styles: `
h1 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
@@ -480,13 +480,19 @@ export class DocumentFormPage {
const data = this.partnerData();
if (!data || !this.isNew()) return;
untracked(() => {
const ship = text(data['ShipToDefault']);
const bill = text(data['BilltoDefault']);
this.header.update((h) => ({
...h,
...('ShipToCode' in h && text(h['ShipToCode']) === '' && ship ? { ShipToCode: ship } : {}),
...('PayToCode' in h && text(h['PayToCode']) === '' && bill ? { PayToCode: bill } : {}),
}));
// lo que el socio trae por defecto (como en SAP): direcciones, condiciones y forma de pago, cuenta asociada
const defaults: Record<string, unknown> = {
ShipToCode: text(data['ShipToDefault']),
PayToCode: text(data['BilltoDefault']),
PaymentGroupCode: data['PayTermsGrpCode'] ?? '',
PaymentMethod: text(data['PeymentMethodCode']),
ControlAccount: text(data['DebitorAccount']),
};
this.header.update((h) => {
const next = { ...h };
for (const [key, value] of Object.entries(defaults)) if (this.headerKeys.includes(key) && text(next[key]) === '' && text(value) !== '') next[key] = value;
return next;
});
});
});
}
@@ -510,7 +516,7 @@ export class DocumentFormPage {
private readonly partnerDetail = httpResource<DocRecord>(() => {
const key = this.partnerKey();
return key && this.hasPartnerData
? { url: `${API_URL}/sl/BusinessPartners/${encodeURIComponent(key)}`, params: { $select: 'CardCode,BPAddresses,ContactEmployees,ShipToDefault,BilltoDefault' } }
? { url: `${API_URL}/sl/BusinessPartners/${encodeURIComponent(key)}`, params: { $select: 'CardCode,BPAddresses,ContactEmployees,ShipToDefault,BilltoDefault,PayTermsGrpCode,PeymentMethodCode,DebitorAccount' } }
: undefined;
});
private readonly partnerData = computed(() => (this.partnerDetail.hasValue() ? this.partnerDetail.value() : undefined));