feat: Lotes (datos maestros de inventario): lista y formulario de BatchNumberDetails con clave numérica y sin «Nuevo»
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3e27f370dc
commit
91d5135dc7
16 files changed
+244
-12
No files matched your search
@@ -63,6 +63,12 @@ export class MasterFormPage {
|
||||
initialValue: this.route.snapshot.paramMap.get('key'),
|
||||
});
|
||||
protected readonly isNew = computed(() => this.key() === null);
|
||||
/** SAP no crea este registro desde aquí (los lotes): sin botón «Nuevo» y `/nuevo` vuelve a la lista. */
|
||||
protected readonly creatable = this.screen.creatable !== false;
|
||||
|
||||
constructor() {
|
||||
if (!this.creatable && this.isNew()) void this.router.navigate(['..'], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
// --- datos ---------------------------------------------------------------------------------
|
||||
|
||||
@@ -128,10 +134,12 @@ export class MasterFormPage {
|
||||
if (this.isNew()) return { label: 'Nuevo', tone: 'info' };
|
||||
const d = this.doc();
|
||||
if (!d) return undefined;
|
||||
if (this.screen.badge) return this.screen.badge(d);
|
||||
return d['Frozen'] === 'tYES' ? { label: 'Inactivo', tone: 'muted' } : { label: 'Activo', tone: 'ok' };
|
||||
});
|
||||
protected readonly windowTitle = computed(() => {
|
||||
const d = this.doc();
|
||||
if (this.screen.titleField && d) return `${this.screen.singular} · ${text(d[this.screen.titleField])}`;
|
||||
const code = this.screen.displayField && d ? displayCode({ Code: text(d[this.screen.keyField]), FormatCode: text(d[this.screen.displayField]) }) : d?.[this.screen.keyField];
|
||||
return code === undefined ? this.screen.singular : `${this.screen.singular} · ${text(code)}`;
|
||||
});
|
||||
@@ -189,7 +197,7 @@ export class MasterFormPage {
|
||||
|
||||
protected async go(target: MasterNavTarget): Promise<void> {
|
||||
try {
|
||||
const next = await this.api.neighbour(this.screen.resource, this.screen.keyField, target, this.key(), this.screen.baseFilter);
|
||||
const next = await this.api.neighbour(this.screen.resource, this.screen.keyField, target, this.key(), this.screen.baseFilter, this.screen.keyType === 'number');
|
||||
if (next === null) {
|
||||
this.message.set({ kind: 'warn', text: 'No hay más registros en esa dirección.' });
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user