Feature: Added sale voucher to check sale import.
Chore: Frontend moved from Moment to date-fns and from dd-MMM-yyyy to ISO Date format.
This commit is contained in:
1 parent
7656c7e877
commit
fc3cd00662
102 files changed
+2121
-2103
No files matched your search
@@ -12,12 +12,12 @@ import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { Router } from '@angular/router';
|
||||
import moment from 'moment';
|
||||
|
||||
import { AccountTypeService } from '../account/account-type.service';
|
||||
import { environment } from '../app.environment';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
import { AccountType } from '../core/account-type';
|
||||
import { endOfMonth, formatDisplayDate, formatIsoDate } from '../core/date-utils';
|
||||
import { ConfirmDialogComponent } from '../shared/confirm-dialog/confirm-dialog.component';
|
||||
import { LockInfo } from './lock-info';
|
||||
import { SettingsService } from './settings.service';
|
||||
@@ -87,11 +87,11 @@ export class SettingsComponent {
|
||||
index: 0,
|
||||
lockOlder: false,
|
||||
olderRolling: false,
|
||||
olderDate: moment().date(moment().date(1).daysInMonth()).toDate(),
|
||||
olderDate: endOfMonth(new Date()),
|
||||
olderDays: 0,
|
||||
lockNewer: false,
|
||||
newerRolling: false,
|
||||
newerDate: moment().date(moment().date(1).daysInMonth()).toDate(),
|
||||
newerDate: endOfMonth(new Date()),
|
||||
newerDays: 0,
|
||||
accountTypes: s.accTypes.map(() => ({ accountType: false })),
|
||||
voucherTypes: s.vchTypes.map(() => ({ voucherType: false })),
|
||||
@@ -107,8 +107,8 @@ export class SettingsComponent {
|
||||
lockNewer = computed(() => this.lockInfoModel().lockNewer);
|
||||
newerRolling = computed(() => this.lockInfoModel().newerRolling);
|
||||
|
||||
rebaseDataModel = signal({
|
||||
date: moment(),
|
||||
rebaseDataModel = signal<{ date: Date }>({
|
||||
date: new Date(),
|
||||
});
|
||||
|
||||
rebaseDataForm = createForm(this.rebaseDataModel);
|
||||
@@ -133,13 +133,13 @@ export class SettingsComponent {
|
||||
if (this.lockOlder() && this.olderRolling()) {
|
||||
item.start.days = model.olderDays ?? 0;
|
||||
} else if (this.lockOlder() && !this.olderRolling()) {
|
||||
item.start.date = moment(model.olderDate ?? new Date()).format('DD-MMM-YYYY');
|
||||
item.start.date = formatIsoDate(model.olderDate ?? new Date());
|
||||
}
|
||||
if (this.lockNewer() && this.newerRolling()) {
|
||||
item.finish.days = model.newerDays ?? 0;
|
||||
}
|
||||
if (this.lockNewer() && !this.newerRolling()) {
|
||||
item.finish.date = moment(model.newerDate ?? new Date()).format('DD-MMM-YYYY');
|
||||
item.finish.date = formatIsoDate(model.newerDate ?? new Date());
|
||||
}
|
||||
|
||||
this.accountTypes().forEach((at: AccountType, index: number) => {
|
||||
@@ -156,12 +156,12 @@ export class SettingsComponent {
|
||||
|
||||
const validFrom = model.validFrom;
|
||||
if (validFrom) {
|
||||
item.validFrom = moment(validFrom).format('DD-MMM-YYYY');
|
||||
item.validFrom = formatIsoDate(validFrom);
|
||||
}
|
||||
|
||||
const validTill = model.validTill;
|
||||
if (validTill) {
|
||||
item.validTill = moment(validTill).format('DD-MMM-YYYY');
|
||||
item.validTill = formatIsoDate(validTill);
|
||||
}
|
||||
item.index = model.index ?? 0;
|
||||
|
||||
@@ -183,12 +183,13 @@ export class SettingsComponent {
|
||||
}
|
||||
|
||||
confirmRebase(): void {
|
||||
const rebaseDate = (this.rebaseDataModel().date ?? moment()).format('DD-MMM-YYYY');
|
||||
const rebaseDate = formatIsoDate(this.rebaseDataModel().date ?? new Date());
|
||||
const rebaseDisplay = formatDisplayDate(this.rebaseDataModel().date ?? new Date());
|
||||
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
||||
width: '250px',
|
||||
data: {
|
||||
title: 'Rebase the database?',
|
||||
content: `Are you sure you want to rebase the database as on ${rebaseDate}? This action is destructive and cannot be undone.`,
|
||||
content: `Are you sure you want to rebase the database as on ${rebaseDisplay}? This action is destructive and cannot be undone.`,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user