mirror of
https://github.com/frappe/books.git
synced 2024-12-23 03:19:01 +00:00
de7e5ba807
- cause now most of it is different from what it was
38 lines
918 B
TypeScript
38 lines
918 B
TypeScript
import { FormulaMap, ListsMap } from 'fyo/model/types';
|
|
import { Address as BaseAddress } from 'models/baseModels/Address/Address';
|
|
import { stateCodeMap } from 'regional/in';
|
|
import { titleCase } from 'utils';
|
|
|
|
export class Address extends BaseAddress {
|
|
formulas: FormulaMap = {
|
|
addressDisplay: async () => {
|
|
return [
|
|
this.addressLine1,
|
|
this.addressLine2,
|
|
this.city,
|
|
this.state,
|
|
this.country,
|
|
this.postalCode,
|
|
]
|
|
.filter(Boolean)
|
|
.join(', ');
|
|
},
|
|
|
|
pos: async () => {
|
|
const stateList = Object.keys(stateCodeMap).map(titleCase).sort();
|
|
const state = this.state as string;
|
|
if (stateList.includes(state)) {
|
|
return state;
|
|
}
|
|
return '';
|
|
},
|
|
};
|
|
|
|
static lists: ListsMap = {
|
|
...BaseAddress.lists,
|
|
pos: () => {
|
|
return Object.keys(stateCodeMap).map(titleCase).sort();
|
|
},
|
|
};
|
|
}
|