feat(web): asiento con indicador, folio, referencias 1 a 3 (cabecera y línea), cuenta/socio y vencimiento por línea
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8bbd05d07b
commit
eb84d73719
4 files changed
+60
-6
No files matched your search
@@ -7,11 +7,11 @@ import { map } from 'rxjs';
|
||||
import { API_URL, apiErrorMessage } from '../../core/api';
|
||||
import { formatNumber } from '../../core/format';
|
||||
import { SlDocumentApi } from '../../core/sl/sl-document';
|
||||
import { DateField, SelectField, TextField } from '../../shared/form';
|
||||
import { DateField, LookupField, SboField, SelectField, TextField, TextInput } from '../../shared/form';
|
||||
import type { DetailColumn } from '../../shared/grid/grid.types';
|
||||
import { RowsTable } from '../../shared/grid/rows-table';
|
||||
import { Icon, SboWindow, Toolbar, type StatusMessage, type WindowBadge } from '../../shared/window';
|
||||
import { ACCOUNT_LOOKUP, PROJECT_LOOKUP, dimensionLookup } from '../documents/dimension-lookups';
|
||||
import { ACCOUNT_LOOKUP, INDICATOR_LOOKUP, PROJECT_LOOKUP, dimensionLookup } from '../documents/dimension-lookups';
|
||||
import type { NavTarget } from '../documents/document-model';
|
||||
import { isManualJournal, journalOrigin, journalPayload, journalTotals, validateJournal } from './journal-model';
|
||||
|
||||
@@ -32,7 +32,7 @@ const dateOnly = (v: unknown): string => (typeof v === 'string' ? v.slice(0, 10)
|
||||
@Component({
|
||||
selector: 'sbo-journal-form-page',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
imports: [DateField, Icon, RouterLink, RowsTable, SboWindow, SelectField, TextField, Toolbar],
|
||||
imports: [DateField, Icon, LookupField, RouterLink, RowsTable, SboField, SboWindow, SelectField, TextField, TextInput, Toolbar],
|
||||
templateUrl: './journal-form.page.html',
|
||||
styleUrl: './journal-form.page.css',
|
||||
})
|
||||
@@ -71,6 +71,11 @@ export class JournalFormPage {
|
||||
protected readonly memo = linkedSignal(() => text(this.doc()?.['Memo']));
|
||||
protected readonly reference = linkedSignal(() => text(this.doc()?.['Reference']));
|
||||
protected readonly reference2 = linkedSignal(() => text(this.doc()?.['Reference2']));
|
||||
protected readonly reference3 = linkedSignal(() => text(this.doc()?.['Reference3']));
|
||||
protected readonly indicator = linkedSignal(() => text(this.doc()?.['Indicator']));
|
||||
protected readonly folioPrefix = linkedSignal(() => text(this.doc()?.['FolioPrefixString']));
|
||||
protected readonly folioNumber = linkedSignal(() => text(this.doc()?.['FolioNumber']));
|
||||
protected readonly indicatorLookup = INDICATOR_LOOKUP;
|
||||
protected readonly lines = linkedSignal<Row[]>(() => {
|
||||
const rows = ((this.doc()?.['JournalEntryLines'] as Row[] | undefined) ?? []).map((l) => ({ ...l }));
|
||||
return this.doc() ? rows : [{}, {}];
|
||||
@@ -102,8 +107,13 @@ export class JournalFormPage {
|
||||
|
||||
protected readonly columns: readonly DetailColumn[] = [
|
||||
{ key: 'AccountCode', title: 'Cuenta', type: 'lookup', required: true, lookup: ACCOUNT_LOOKUP, width: '170px' },
|
||||
{ key: 'ShortName', title: 'Cuenta / socio', type: 'text', width: '150px' },
|
||||
{ key: 'Debit', title: 'Debe', type: 'number', decimals: 2, width: '120px' },
|
||||
{ key: 'Credit', title: 'Haber', type: 'number', decimals: 2, width: '120px' },
|
||||
{ key: 'DueDate', title: 'Vencimiento', type: 'date', width: '120px' },
|
||||
{ key: 'Reference1', title: 'Ref. 1', type: 'text', width: '110px' },
|
||||
{ key: 'Reference2', title: 'Ref. 2', type: 'text', width: '110px' },
|
||||
{ key: 'AdditionalReference', title: 'Ref. 3', type: 'text', width: '110px' },
|
||||
{ key: 'LineMemo', title: 'Comentarios', type: 'text', width: '220px' },
|
||||
...([1, 2, 3, 4, 5] as const).map((n): DetailColumn => ({
|
||||
key: n === 1 ? 'CostingCode' : `CostingCode${n}`,
|
||||
@@ -163,7 +173,7 @@ export class JournalFormPage {
|
||||
this.setLines(rows);
|
||||
}
|
||||
|
||||
protected set(key: 'memo' | 'reference' | 'reference2', value: string): void {
|
||||
protected set(key: 'memo' | 'reference' | 'reference2' | 'reference3' | 'folioPrefix' | 'folioNumber', value: string): void {
|
||||
this[key].set(value);
|
||||
this.message.set(null);
|
||||
}
|
||||
@@ -192,6 +202,10 @@ export class JournalFormPage {
|
||||
memo: this.memo(),
|
||||
reference: this.reference(),
|
||||
reference2: this.reference2(),
|
||||
reference3: this.reference3(),
|
||||
indicator: this.indicator(),
|
||||
folioPrefix: this.folioPrefix(),
|
||||
folioNumber: this.folioNumber(),
|
||||
lines: this.lines(),
|
||||
};
|
||||
const errors = validateJournal(draft);
|
||||
|
||||
Reference in new issue
Block a user