mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 06:57:35 +08:00
allow users to set coordinate display type (#141)
This commit is contained in:
@@ -903,6 +903,7 @@ func printUserInfo(user *models.User) {
|
||||
fmt.Printf("[DigitGroupingSymbol] %s (%d)\n", user.DigitGroupingSymbol, user.DigitGroupingSymbol)
|
||||
fmt.Printf("[DigitGrouping] %s (%d)\n", user.DigitGrouping, user.DigitGrouping)
|
||||
fmt.Printf("[CurrencyDisplayType] %s (%d)\n", user.CurrencyDisplayType, user.CurrencyDisplayType)
|
||||
fmt.Printf("[CoordinateDisplayType] %s (%d)\n", user.CoordinateDisplayType, user.CoordinateDisplayType)
|
||||
fmt.Printf("[ExpenseAmountColor] %s (%d)\n", user.ExpenseAmountColor, user.ExpenseAmountColor)
|
||||
fmt.Printf("[IncomeAmountColor] %s (%d)\n", user.IncomeAmountColor, user.IncomeAmountColor)
|
||||
fmt.Printf("[FeatureRestriction] %s (%d)\n", user.FeatureRestriction, user.FeatureRestriction)
|
||||
|
||||
@@ -421,6 +421,15 @@ func (a *UsersApi) UserUpdateProfileHandler(c *core.WebContext) (any, *errs.Erro
|
||||
userNew.CurrencyDisplayType = core.CURRENCY_DISPLAY_TYPE_INVALID
|
||||
}
|
||||
|
||||
if userUpdateReq.CoordinateDisplayType != nil && *userUpdateReq.CoordinateDisplayType != user.CoordinateDisplayType {
|
||||
user.CoordinateDisplayType = *userUpdateReq.CoordinateDisplayType
|
||||
userNew.CoordinateDisplayType = *userUpdateReq.CoordinateDisplayType
|
||||
modifyProfileBasicInfo = true
|
||||
anythingUpdate = true
|
||||
} else {
|
||||
userNew.CoordinateDisplayType = core.COORDINATE_DISPLAY_TYPE_INVALID
|
||||
}
|
||||
|
||||
if userUpdateReq.ExpenseAmountColor != nil && *userUpdateReq.ExpenseAmountColor != user.ExpenseAmountColor {
|
||||
user.ExpenseAmountColor = *userUpdateReq.ExpenseAmountColor
|
||||
userNew.ExpenseAmountColor = *userUpdateReq.ExpenseAmountColor
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package core
|
||||
|
||||
import "fmt"
|
||||
|
||||
// CoordinateDisplayType represents the display type of geographic coordinates
|
||||
type CoordinateDisplayType byte
|
||||
|
||||
// Coordinate Display Type
|
||||
const (
|
||||
COORDINATE_DISPLAY_TYPE_DEFAULT CoordinateDisplayType = 0
|
||||
COORDINATE_DISPLAY_TYPE_LATITUDE_LONGITUDE_DECIMAL_DEGREES CoordinateDisplayType = 1
|
||||
COORDINATE_DISPLAY_TYPE_LONGITUDE_LATITUDE_DECIMAL_DEGREES CoordinateDisplayType = 2
|
||||
COORDINATE_DISPLAY_TYPE_LATITUDE_LONGITUDE_DECIMAL_MINUTES CoordinateDisplayType = 3
|
||||
COORDINATE_DISPLAY_TYPE_LONGITUDE_LATITUDE_DECIMAL_MINUTES CoordinateDisplayType = 4
|
||||
COORDINATE_DISPLAY_TYPE_LATITUDE_LONGITUDE_DEGREES_MINUTES_SECONDS CoordinateDisplayType = 5
|
||||
COORDINATE_DISPLAY_TYPE_LONGITUDE_LATITUDE_DEGREES_MINUTES_SECONDS CoordinateDisplayType = 6
|
||||
COORDINATE_DISPLAY_TYPE_INVALID CoordinateDisplayType = 255
|
||||
)
|
||||
|
||||
// String returns a textual representation of the geographic coordinates display type enum
|
||||
func (d CoordinateDisplayType) String() string {
|
||||
switch d {
|
||||
case COORDINATE_DISPLAY_TYPE_DEFAULT:
|
||||
return "Default"
|
||||
case COORDINATE_DISPLAY_TYPE_LATITUDE_LONGITUDE_DECIMAL_DEGREES:
|
||||
return "Latitude Longitude (Decimal Degrees)"
|
||||
case COORDINATE_DISPLAY_TYPE_LONGITUDE_LATITUDE_DECIMAL_DEGREES:
|
||||
return "Longitude Latitude (Decimal Degrees)"
|
||||
case COORDINATE_DISPLAY_TYPE_LATITUDE_LONGITUDE_DECIMAL_MINUTES:
|
||||
return "Latitude Longitude (Decimal Minutes)"
|
||||
case COORDINATE_DISPLAY_TYPE_LONGITUDE_LATITUDE_DECIMAL_MINUTES:
|
||||
return "Longitude Latitude (Decimal Minutes)"
|
||||
case COORDINATE_DISPLAY_TYPE_LATITUDE_LONGITUDE_DEGREES_MINUTES_SECONDS:
|
||||
return "Latitude Longitude (Degrees Minutes Seconds)"
|
||||
case COORDINATE_DISPLAY_TYPE_LONGITUDE_LATITUDE_DEGREES_MINUTES_SECONDS:
|
||||
return "Longitude Latitude (Degrees Minutes Seconds)"
|
||||
case COORDINATE_DISPLAY_TYPE_INVALID:
|
||||
return "Invalid"
|
||||
default:
|
||||
return fmt.Sprintf("Invalid(%d)", int(d))
|
||||
}
|
||||
}
|
||||
+95
-91
@@ -82,61 +82,63 @@ func (s AmountColorType) String() string {
|
||||
|
||||
// User represents user data stored in database
|
||||
type User struct {
|
||||
Uid int64 `xorm:"PK"`
|
||||
Username string `xorm:"VARCHAR(32) UNIQUE NOT NULL"`
|
||||
Email string `xorm:"VARCHAR(100) UNIQUE NOT NULL"`
|
||||
Nickname string `xorm:"VARCHAR(64) NOT NULL"`
|
||||
Password string `xorm:"VARCHAR(64) NOT NULL"`
|
||||
Salt string `xorm:"VARCHAR(10) NOT NULL"`
|
||||
CustomAvatarType string `xorm:"VARCHAR(10)"`
|
||||
DefaultAccountId int64
|
||||
TransactionEditScope TransactionEditScope `xorm:"TINYINT NOT NULL"`
|
||||
Language string `xorm:"VARCHAR(10)"`
|
||||
DefaultCurrency string `xorm:"VARCHAR(3) NOT NULL"`
|
||||
FirstDayOfWeek core.WeekDay `xorm:"TINYINT NOT NULL"`
|
||||
LongDateFormat core.LongDateFormat `xorm:"TINYINT"`
|
||||
ShortDateFormat core.ShortDateFormat `xorm:"TINYINT"`
|
||||
LongTimeFormat core.LongTimeFormat `xorm:"TINYINT"`
|
||||
ShortTimeFormat core.ShortTimeFormat `xorm:"TINYINT"`
|
||||
DecimalSeparator core.DecimalSeparator `xorm:"TINYINT"`
|
||||
DigitGroupingSymbol core.DigitGroupingSymbol `xorm:"TINYINT"`
|
||||
DigitGrouping core.DigitGroupingType `xorm:"TINYINT"`
|
||||
CurrencyDisplayType core.CurrencyDisplayType `xorm:"TINYINT"`
|
||||
ExpenseAmountColor AmountColorType `xorm:"TINYINT"`
|
||||
IncomeAmountColor AmountColorType `xorm:"TINYINT"`
|
||||
FeatureRestriction core.UserFeatureRestrictions
|
||||
Disabled bool
|
||||
Deleted bool `xorm:"NOT NULL"`
|
||||
EmailVerified bool `xorm:"NOT NULL"`
|
||||
CreatedUnixTime int64
|
||||
UpdatedUnixTime int64
|
||||
DeletedUnixTime int64
|
||||
LastLoginUnixTime int64
|
||||
Uid int64 `xorm:"PK"`
|
||||
Username string `xorm:"VARCHAR(32) UNIQUE NOT NULL"`
|
||||
Email string `xorm:"VARCHAR(100) UNIQUE NOT NULL"`
|
||||
Nickname string `xorm:"VARCHAR(64) NOT NULL"`
|
||||
Password string `xorm:"VARCHAR(64) NOT NULL"`
|
||||
Salt string `xorm:"VARCHAR(10) NOT NULL"`
|
||||
CustomAvatarType string `xorm:"VARCHAR(10)"`
|
||||
DefaultAccountId int64
|
||||
TransactionEditScope TransactionEditScope `xorm:"TINYINT NOT NULL"`
|
||||
Language string `xorm:"VARCHAR(10)"`
|
||||
DefaultCurrency string `xorm:"VARCHAR(3) NOT NULL"`
|
||||
FirstDayOfWeek core.WeekDay `xorm:"TINYINT NOT NULL"`
|
||||
LongDateFormat core.LongDateFormat `xorm:"TINYINT"`
|
||||
ShortDateFormat core.ShortDateFormat `xorm:"TINYINT"`
|
||||
LongTimeFormat core.LongTimeFormat `xorm:"TINYINT"`
|
||||
ShortTimeFormat core.ShortTimeFormat `xorm:"TINYINT"`
|
||||
DecimalSeparator core.DecimalSeparator `xorm:"TINYINT"`
|
||||
DigitGroupingSymbol core.DigitGroupingSymbol `xorm:"TINYINT"`
|
||||
DigitGrouping core.DigitGroupingType `xorm:"TINYINT"`
|
||||
CurrencyDisplayType core.CurrencyDisplayType `xorm:"TINYINT"`
|
||||
CoordinateDisplayType core.CoordinateDisplayType `xorm:"TINYINT"`
|
||||
ExpenseAmountColor AmountColorType `xorm:"TINYINT"`
|
||||
IncomeAmountColor AmountColorType `xorm:"TINYINT"`
|
||||
FeatureRestriction core.UserFeatureRestrictions
|
||||
Disabled bool
|
||||
Deleted bool `xorm:"NOT NULL"`
|
||||
EmailVerified bool `xorm:"NOT NULL"`
|
||||
CreatedUnixTime int64
|
||||
UpdatedUnixTime int64
|
||||
DeletedUnixTime int64
|
||||
LastLoginUnixTime int64
|
||||
}
|
||||
|
||||
// UserBasicInfo represents a view-object of user basic info
|
||||
type UserBasicInfo struct {
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Nickname string `json:"nickname"`
|
||||
AvatarUrl string `json:"avatar"`
|
||||
AvatarProvider string `json:"avatarProvider,omitempty"`
|
||||
DefaultAccountId int64 `json:"defaultAccountId,string"`
|
||||
TransactionEditScope TransactionEditScope `json:"transactionEditScope"`
|
||||
Language string `json:"language"`
|
||||
DefaultCurrency string `json:"defaultCurrency"`
|
||||
FirstDayOfWeek core.WeekDay `json:"firstDayOfWeek"`
|
||||
LongDateFormat core.LongDateFormat `json:"longDateFormat"`
|
||||
ShortDateFormat core.ShortDateFormat `json:"shortDateFormat"`
|
||||
LongTimeFormat core.LongTimeFormat `json:"longTimeFormat"`
|
||||
ShortTimeFormat core.ShortTimeFormat `json:"shortTimeFormat"`
|
||||
DecimalSeparator core.DecimalSeparator `json:"decimalSeparator"`
|
||||
DigitGroupingSymbol core.DigitGroupingSymbol `json:"digitGroupingSymbol"`
|
||||
DigitGrouping core.DigitGroupingType `json:"digitGrouping"`
|
||||
CurrencyDisplayType core.CurrencyDisplayType `json:"currencyDisplayType"`
|
||||
ExpenseAmountColor AmountColorType `json:"expenseAmountColor"`
|
||||
IncomeAmountColor AmountColorType `json:"incomeAmountColor"`
|
||||
EmailVerified bool `json:"emailVerified"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Nickname string `json:"nickname"`
|
||||
AvatarUrl string `json:"avatar"`
|
||||
AvatarProvider string `json:"avatarProvider,omitempty"`
|
||||
DefaultAccountId int64 `json:"defaultAccountId,string"`
|
||||
TransactionEditScope TransactionEditScope `json:"transactionEditScope"`
|
||||
Language string `json:"language"`
|
||||
DefaultCurrency string `json:"defaultCurrency"`
|
||||
FirstDayOfWeek core.WeekDay `json:"firstDayOfWeek"`
|
||||
LongDateFormat core.LongDateFormat `json:"longDateFormat"`
|
||||
ShortDateFormat core.ShortDateFormat `json:"shortDateFormat"`
|
||||
LongTimeFormat core.LongTimeFormat `json:"longTimeFormat"`
|
||||
ShortTimeFormat core.ShortTimeFormat `json:"shortTimeFormat"`
|
||||
DecimalSeparator core.DecimalSeparator `json:"decimalSeparator"`
|
||||
DigitGroupingSymbol core.DigitGroupingSymbol `json:"digitGroupingSymbol"`
|
||||
DigitGrouping core.DigitGroupingType `json:"digitGrouping"`
|
||||
CurrencyDisplayType core.CurrencyDisplayType `json:"currencyDisplayType"`
|
||||
CoordinateDisplayType core.CoordinateDisplayType `json:"coordinateDisplayType"`
|
||||
ExpenseAmountColor AmountColorType `json:"expenseAmountColor"`
|
||||
IncomeAmountColor AmountColorType `json:"incomeAmountColor"`
|
||||
EmailVerified bool `json:"emailVerified"`
|
||||
}
|
||||
|
||||
// UserLoginRequest represents all parameters of user login request
|
||||
@@ -177,25 +179,26 @@ type UserResendVerifyEmailRequest struct {
|
||||
|
||||
// UserProfileUpdateRequest represents all parameters of user updating profile request
|
||||
type UserProfileUpdateRequest struct {
|
||||
Email string `json:"email" binding:"omitempty,notBlank,max=100,validEmail"`
|
||||
Nickname string `json:"nickname" binding:"omitempty,notBlank,max=64"`
|
||||
Password string `json:"password" binding:"omitempty,min=6,max=128"`
|
||||
OldPassword string `json:"oldPassword" binding:"omitempty,min=6,max=128"`
|
||||
DefaultAccountId int64 `json:"defaultAccountId,string" binding:"omitempty,min=1"`
|
||||
TransactionEditScope *TransactionEditScope `json:"transactionEditScope" binding:"omitempty,min=0,max=6"`
|
||||
Language string `json:"language" binding:"omitempty,min=2,max=16"`
|
||||
DefaultCurrency string `json:"defaultCurrency" binding:"omitempty,len=3,validCurrency"`
|
||||
FirstDayOfWeek *core.WeekDay `json:"firstDayOfWeek" binding:"omitempty,min=0,max=6"`
|
||||
LongDateFormat *core.LongDateFormat `json:"longDateFormat" binding:"omitempty,min=0,max=3"`
|
||||
ShortDateFormat *core.ShortDateFormat `json:"shortDateFormat" binding:"omitempty,min=0,max=3"`
|
||||
LongTimeFormat *core.LongTimeFormat `json:"longTimeFormat" binding:"omitempty,min=0,max=3"`
|
||||
ShortTimeFormat *core.ShortTimeFormat `json:"shortTimeFormat" binding:"omitempty,min=0,max=3"`
|
||||
DecimalSeparator *core.DecimalSeparator `json:"decimalSeparator" binding:"omitempty,min=0,max=3"`
|
||||
DigitGroupingSymbol *core.DigitGroupingSymbol `json:"digitGroupingSymbol" binding:"omitempty,min=0,max=4"`
|
||||
DigitGrouping *core.DigitGroupingType `json:"digitGrouping" binding:"omitempty,min=0,max=2"`
|
||||
CurrencyDisplayType *core.CurrencyDisplayType `json:"currencyDisplayType" binding:"omitempty,min=0,max=11"`
|
||||
ExpenseAmountColor *AmountColorType `json:"expenseAmountColor" binding:"omitempty,min=0,max=4"`
|
||||
IncomeAmountColor *AmountColorType `json:"incomeAmountColor" binding:"omitempty,min=0,max=4"`
|
||||
Email string `json:"email" binding:"omitempty,notBlank,max=100,validEmail"`
|
||||
Nickname string `json:"nickname" binding:"omitempty,notBlank,max=64"`
|
||||
Password string `json:"password" binding:"omitempty,min=6,max=128"`
|
||||
OldPassword string `json:"oldPassword" binding:"omitempty,min=6,max=128"`
|
||||
DefaultAccountId int64 `json:"defaultAccountId,string" binding:"omitempty,min=1"`
|
||||
TransactionEditScope *TransactionEditScope `json:"transactionEditScope" binding:"omitempty,min=0,max=6"`
|
||||
Language string `json:"language" binding:"omitempty,min=2,max=16"`
|
||||
DefaultCurrency string `json:"defaultCurrency" binding:"omitempty,len=3,validCurrency"`
|
||||
FirstDayOfWeek *core.WeekDay `json:"firstDayOfWeek" binding:"omitempty,min=0,max=6"`
|
||||
LongDateFormat *core.LongDateFormat `json:"longDateFormat" binding:"omitempty,min=0,max=3"`
|
||||
ShortDateFormat *core.ShortDateFormat `json:"shortDateFormat" binding:"omitempty,min=0,max=3"`
|
||||
LongTimeFormat *core.LongTimeFormat `json:"longTimeFormat" binding:"omitempty,min=0,max=3"`
|
||||
ShortTimeFormat *core.ShortTimeFormat `json:"shortTimeFormat" binding:"omitempty,min=0,max=3"`
|
||||
DecimalSeparator *core.DecimalSeparator `json:"decimalSeparator" binding:"omitempty,min=0,max=3"`
|
||||
DigitGroupingSymbol *core.DigitGroupingSymbol `json:"digitGroupingSymbol" binding:"omitempty,min=0,max=4"`
|
||||
DigitGrouping *core.DigitGroupingType `json:"digitGrouping" binding:"omitempty,min=0,max=2"`
|
||||
CurrencyDisplayType *core.CurrencyDisplayType `json:"currencyDisplayType" binding:"omitempty,min=0,max=11"`
|
||||
CoordinateDisplayType *core.CoordinateDisplayType `json:"coordinateDisplayType" binding:"omitempty,min=0,max=6"`
|
||||
ExpenseAmountColor *AmountColorType `json:"expenseAmountColor" binding:"omitempty,min=0,max=4"`
|
||||
IncomeAmountColor *AmountColorType `json:"incomeAmountColor" binding:"omitempty,min=0,max=4"`
|
||||
}
|
||||
|
||||
// UserProfileUpdateResponse represents the data returns to frontend after updating profile
|
||||
@@ -255,27 +258,28 @@ func (u *User) CanEditTransactionByTransactionTime(transactionTime int64, utcOff
|
||||
// ToUserBasicInfo returns a user basic view-object according to database model
|
||||
func (u *User) ToUserBasicInfo(avatarProvider core.UserAvatarProviderType, avatarUrl string) *UserBasicInfo {
|
||||
return &UserBasicInfo{
|
||||
Username: u.Username,
|
||||
Email: u.Email,
|
||||
Nickname: u.Nickname,
|
||||
AvatarUrl: avatarUrl,
|
||||
AvatarProvider: string(avatarProvider),
|
||||
DefaultAccountId: u.DefaultAccountId,
|
||||
TransactionEditScope: u.TransactionEditScope,
|
||||
Language: u.Language,
|
||||
DefaultCurrency: u.DefaultCurrency,
|
||||
FirstDayOfWeek: u.FirstDayOfWeek,
|
||||
LongDateFormat: u.LongDateFormat,
|
||||
ShortDateFormat: u.ShortDateFormat,
|
||||
LongTimeFormat: u.LongTimeFormat,
|
||||
ShortTimeFormat: u.ShortTimeFormat,
|
||||
DecimalSeparator: u.DecimalSeparator,
|
||||
DigitGroupingSymbol: u.DigitGroupingSymbol,
|
||||
DigitGrouping: u.DigitGrouping,
|
||||
CurrencyDisplayType: u.CurrencyDisplayType,
|
||||
ExpenseAmountColor: u.ExpenseAmountColor,
|
||||
IncomeAmountColor: u.IncomeAmountColor,
|
||||
EmailVerified: u.EmailVerified,
|
||||
Username: u.Username,
|
||||
Email: u.Email,
|
||||
Nickname: u.Nickname,
|
||||
AvatarUrl: avatarUrl,
|
||||
AvatarProvider: string(avatarProvider),
|
||||
DefaultAccountId: u.DefaultAccountId,
|
||||
TransactionEditScope: u.TransactionEditScope,
|
||||
Language: u.Language,
|
||||
DefaultCurrency: u.DefaultCurrency,
|
||||
FirstDayOfWeek: u.FirstDayOfWeek,
|
||||
LongDateFormat: u.LongDateFormat,
|
||||
ShortDateFormat: u.ShortDateFormat,
|
||||
LongTimeFormat: u.LongTimeFormat,
|
||||
ShortTimeFormat: u.ShortTimeFormat,
|
||||
DecimalSeparator: u.DecimalSeparator,
|
||||
DigitGroupingSymbol: u.DigitGroupingSymbol,
|
||||
DigitGrouping: u.DigitGrouping,
|
||||
CurrencyDisplayType: u.CurrencyDisplayType,
|
||||
CoordinateDisplayType: u.CoordinateDisplayType,
|
||||
ExpenseAmountColor: u.ExpenseAmountColor,
|
||||
IncomeAmountColor: u.IncomeAmountColor,
|
||||
EmailVerified: u.EmailVerified,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -321,6 +321,10 @@ func (s *UserService) UpdateUser(c core.Context, user *models.User, modifyUserLa
|
||||
updateCols = append(updateCols, "currency_display_type")
|
||||
}
|
||||
|
||||
if core.COORDINATE_DISPLAY_TYPE_DEFAULT <= user.CoordinateDisplayType && user.CoordinateDisplayType <= core.COORDINATE_DISPLAY_TYPE_LONGITUDE_LATITUDE_DEGREES_MINUTES_SECONDS {
|
||||
updateCols = append(updateCols, "coordinate_display_type")
|
||||
}
|
||||
|
||||
if models.AMOUNT_COLOR_TYPE_DEFAULT <= user.ExpenseAmountColor && user.ExpenseAmountColor <= models.AMOUNT_COLOR_TYPE_BLACK_OR_WHITE {
|
||||
updateCols = append(updateCols, "expense_amount_color")
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { ref, computed, useTemplateRef } from 'vue';
|
||||
|
||||
import { useI18n } from '@/locales/helpers.ts';
|
||||
|
||||
import type { MapPosition } from '@/core/map.ts';
|
||||
import type { Coordinate } from '@/core/coordinate.ts';
|
||||
import type { MapInstance } from '@/lib/map/base.ts';
|
||||
import { createMapInstance } from '@/lib/map/index.ts';
|
||||
|
||||
@@ -21,18 +21,18 @@ const props = defineProps<{
|
||||
height?: string;
|
||||
mapClass?: string;
|
||||
mapStyle?: Record<string, string>;
|
||||
geoLocation?: MapPosition;
|
||||
geoLocation?: Coordinate;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'click', geoLocation: MapPosition): void;
|
||||
(e: 'click', geoLocation: Coordinate): void;
|
||||
}>();
|
||||
|
||||
const { tt, getCurrentLanguageInfo } = useI18n();
|
||||
|
||||
const mapContainer = useTemplateRef<HTMLElement>('mapContainer');
|
||||
const mapInstance = ref<MapInstance | null>(createMapInstance());
|
||||
const initCenter = ref<MapPosition>({
|
||||
const initCenter = ref<Coordinate>({
|
||||
latitude: 0,
|
||||
longitude: 0
|
||||
});
|
||||
@@ -92,7 +92,7 @@ function initMapView(): void {
|
||||
zoomIn: tt('Zoom in'),
|
||||
zoomOut: tt('Zoom out'),
|
||||
},
|
||||
onClick: (geoLocation: MapPosition) => {
|
||||
onClick: (geoLocation: Coordinate) => {
|
||||
emit('click', geoLocation);
|
||||
}
|
||||
});
|
||||
@@ -113,7 +113,7 @@ function initMapView(): void {
|
||||
}
|
||||
}
|
||||
|
||||
function setMarkerPosition(geoLocation?: MapPosition): void {
|
||||
function setMarkerPosition(geoLocation?: Coordinate): void {
|
||||
if (!mapInstance.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,20 +39,20 @@ import MapView from '@/components/common/MapView.vue';
|
||||
|
||||
import { useI18n } from '@/locales/helpers.ts';
|
||||
|
||||
import type { MapPosition } from '@/core/map.ts';
|
||||
import type { Coordinate } from '@/core/coordinate.ts';
|
||||
|
||||
import { isSupportGetGeoLocationByClick } from '@/lib/map/index.ts';
|
||||
|
||||
type MapViewType = InstanceType<typeof MapView>;
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue?: MapPosition;
|
||||
modelValue?: Coordinate;
|
||||
setGeoLocationByClickMap?: boolean;
|
||||
show: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', value: MapPosition | undefined): void;
|
||||
(e: 'update:modelValue', value: Coordinate | undefined): void;
|
||||
(e: 'update:setGeoLocationByClickMap', value: boolean): void;
|
||||
(e: 'update:show', value: boolean): void;
|
||||
}>();
|
||||
@@ -61,7 +61,7 @@ const { tt } = useI18n();
|
||||
|
||||
const map = useTemplateRef<MapViewType>('map');
|
||||
|
||||
const geoLocation = computed<MapPosition | undefined>({
|
||||
const geoLocation = computed<Coordinate | undefined>({
|
||||
get: () => {
|
||||
return props.modelValue;
|
||||
},
|
||||
@@ -70,10 +70,10 @@ const geoLocation = computed<MapPosition | undefined>({
|
||||
}
|
||||
});
|
||||
|
||||
function updateSpecifiedGeoLocation(mapPosition: MapPosition): void {
|
||||
function updateSpecifiedGeoLocation(coordinate: Coordinate): void {
|
||||
if (isSupportGetGeoLocationByClick() && props.setGeoLocationByClickMap) {
|
||||
geoLocation.value = mapPosition;
|
||||
map.value?.setMarkerPosition(mapPosition);
|
||||
geoLocation.value = coordinate;
|
||||
map.value?.setMarkerPosition(coordinate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
import type { TypeAndName } from '@/core/base.ts';
|
||||
|
||||
export interface Coordinate {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
}
|
||||
|
||||
export enum CoordinateDisplayOrder {
|
||||
LatitudeLongitude = 0,
|
||||
LongitudeLatitude = 1
|
||||
}
|
||||
|
||||
export enum CoordinateDisplayFormat {
|
||||
DecimalDegrees = 0,
|
||||
DecimalMinutes = 1,
|
||||
DegreesMinutesSeconds = 2
|
||||
}
|
||||
|
||||
export enum CoordinateDirectionFormat {
|
||||
Signed = 0,
|
||||
Directional = 1
|
||||
}
|
||||
|
||||
export class CoordinateDisplayType implements TypeAndName {
|
||||
private static readonly allInstances: CoordinateDisplayType[] = [];
|
||||
private static readonly allInstancesByType: Record<number, CoordinateDisplayType> = {};
|
||||
|
||||
public static readonly SystemDefaultType: number = 0;
|
||||
public static readonly LatitudeLongitudeDecimalDegrees = new CoordinateDisplayType(1, 'Latitude Longitude D.D°', CoordinateDisplayOrder.LatitudeLongitude, CoordinateDisplayFormat.DecimalDegrees, CoordinateDirectionFormat.Signed);
|
||||
public static readonly LongitudeLatitudeDecimalDegrees = new CoordinateDisplayType(2, 'Longitude Latitude D.D°', CoordinateDisplayOrder.LongitudeLatitude, CoordinateDisplayFormat.DecimalDegrees, CoordinateDirectionFormat.Signed);
|
||||
public static readonly LatitudeLongitudeDecimalMinutes = new CoordinateDisplayType(3, 'Latitude Longitude D°M.M\'', CoordinateDisplayOrder.LatitudeLongitude, CoordinateDisplayFormat.DecimalMinutes, CoordinateDirectionFormat.Directional);
|
||||
public static readonly LongitudeLatitudeDecimalMinutes = new CoordinateDisplayType(4, 'Longitude Latitude D°M.M\'', CoordinateDisplayOrder.LongitudeLatitude, CoordinateDisplayFormat.DecimalMinutes, CoordinateDirectionFormat.Directional);
|
||||
public static readonly LatitudeLongitudeDegreesMinutesSeconds = new CoordinateDisplayType(5, 'Latitude Longitude D°M\'S"', CoordinateDisplayOrder.LatitudeLongitude, CoordinateDisplayFormat.DegreesMinutesSeconds, CoordinateDirectionFormat.Directional);
|
||||
public static readonly LongitudeLatitudeDegreesMinutesSeconds = new CoordinateDisplayType(6, 'Longitude Latitude D°M\'S"', CoordinateDisplayOrder.LongitudeLatitude, CoordinateDisplayFormat.DegreesMinutesSeconds, CoordinateDirectionFormat.Directional);
|
||||
|
||||
public static readonly Default = CoordinateDisplayType.LatitudeLongitudeDecimalDegrees;
|
||||
|
||||
public readonly type: number;
|
||||
public readonly name: string;
|
||||
public readonly displayOrder: CoordinateDisplayOrder;
|
||||
public readonly displayFormat: CoordinateDisplayFormat;
|
||||
public readonly directionFormat: CoordinateDirectionFormat;
|
||||
|
||||
private constructor(type: number, name: string, displayOrder: CoordinateDisplayOrder, displayFormat: CoordinateDisplayFormat, directionFormat: CoordinateDirectionFormat) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.displayOrder = displayOrder;
|
||||
this.displayFormat = displayFormat;
|
||||
this.directionFormat = directionFormat;
|
||||
|
||||
CoordinateDisplayType.allInstances.push(this);
|
||||
CoordinateDisplayType.allInstancesByType[type] = this;
|
||||
}
|
||||
|
||||
public static values(): CoordinateDisplayType[] {
|
||||
return CoordinateDisplayType.allInstances;
|
||||
}
|
||||
|
||||
public static valueOf(type: number): CoordinateDisplayType | undefined {
|
||||
return CoordinateDisplayType.allInstancesByType[type];
|
||||
}
|
||||
}
|
||||
|
||||
export function getNormalizedCoordinate(value: Coordinate): Coordinate {
|
||||
if (!value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
const normalizedLatitude = Math.max(-90, Math.min(90, value.latitude));
|
||||
const normalizedLongitude = ((value.longitude + 180) % 360 + 360) % 360 - 180;
|
||||
|
||||
return {
|
||||
latitude: normalizedLatitude,
|
||||
longitude: normalizedLongitude
|
||||
};
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
export interface MapPosition {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import {
|
||||
type Coordinate,
|
||||
CoordinateDisplayOrder,
|
||||
CoordinateDisplayFormat,
|
||||
CoordinateDirectionFormat,
|
||||
CoordinateDisplayType,
|
||||
getNormalizedCoordinate
|
||||
} from '@/core/coordinate.ts';
|
||||
|
||||
export function formatCoordinate(value: Coordinate, coordinateDisplayType: number): string {
|
||||
if (!value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
value = getNormalizedCoordinate(value);
|
||||
|
||||
const displayType = CoordinateDisplayType.valueOf(coordinateDisplayType) || CoordinateDisplayType.Default;
|
||||
const formattedLatitude = formatCoordinateValue(value.latitude, 'N', 'S', displayType.displayFormat, displayType.directionFormat);
|
||||
const formattedLongitude = formatCoordinateValue(value.longitude, 'E', 'W', displayType.displayFormat, displayType.directionFormat);
|
||||
|
||||
if (displayType.displayOrder === CoordinateDisplayOrder.LatitudeLongitude) {
|
||||
return `${formattedLatitude}, ${formattedLongitude}`;
|
||||
} else if (displayType.displayOrder === CoordinateDisplayOrder.LongitudeLatitude) {
|
||||
return `${formattedLongitude}, ${formattedLatitude}`;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function formatCoordinateValue(value: number, positiveDirectionName: string, negativeDirectionName: string, displayFormat: CoordinateDisplayFormat, directionFormat: CoordinateDirectionFormat): string {
|
||||
let prefix = '';
|
||||
let suffix = '';
|
||||
|
||||
if (directionFormat === CoordinateDirectionFormat.Signed) {
|
||||
prefix = value >= 0 ? '' : '-';
|
||||
} else if (directionFormat === CoordinateDirectionFormat.Directional) {
|
||||
suffix = value >= 0 ? positiveDirectionName : negativeDirectionName;
|
||||
}
|
||||
|
||||
value = Math.abs(value);
|
||||
|
||||
if (displayFormat === CoordinateDisplayFormat.DecimalDegrees) {
|
||||
return `${prefix}${value.toFixed(6)}${suffix}`;
|
||||
} else if (displayFormat === CoordinateDisplayFormat.DecimalMinutes) {
|
||||
const degrees = Math.floor(value);
|
||||
const minutes = (value - degrees) * 60;
|
||||
return `${prefix}${degrees}°${minutes.toFixed(5)}'${suffix}`;
|
||||
} else if (displayFormat === CoordinateDisplayFormat.DegreesMinutesSeconds) {
|
||||
const degrees = Math.floor(value);
|
||||
const minutes = Math.floor((value - degrees) * 60);
|
||||
const seconds = (value - degrees - minutes / 60) * 3600;
|
||||
return `${prefix}${degrees}°${minutes}'${seconds.toFixed(4)}"${suffix}`;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
import type { MapPosition } from '@/core/map.ts';
|
||||
import type { Coordinate } from '@/core/coordinate.ts';
|
||||
import type { MapProvider, MapInstance, MapInstanceInitOptions } from './base.ts';
|
||||
|
||||
import { asyncLoadAssets } from '@/lib/misc.ts';
|
||||
@@ -105,7 +105,7 @@ export class AmapMapInstance implements MapInstance {
|
||||
this.inited = true;
|
||||
}
|
||||
|
||||
public setMapCenterTo(center: MapPosition, zoomLevel: number): void {
|
||||
public setMapCenterTo(center: Coordinate, zoomLevel: number): void {
|
||||
if (!AmapMapProvider.AMap || !this.amapInstance) {
|
||||
return;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ export class AmapMapInstance implements MapInstance {
|
||||
});
|
||||
}
|
||||
|
||||
public setMapCenterMarker(position: MapPosition): void {
|
||||
public setMapCenterMarker(position: Coordinate): void {
|
||||
if (!AmapMapProvider.AMap || !this.amapInstance) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
import type { MapPosition } from '@/core/map.ts';
|
||||
import type { Coordinate } from '@/core/coordinate.ts';
|
||||
import type { MapProvider, MapInstance, MapInstanceInitOptions } from './base.ts';
|
||||
|
||||
import { asyncLoadAssets } from '@/lib/misc.ts';
|
||||
@@ -96,7 +96,7 @@ export class BaiduMapInstance implements MapInstance {
|
||||
this.inited = true;
|
||||
}
|
||||
|
||||
public setMapCenterTo(center: MapPosition, zoomLevel: number): void {
|
||||
public setMapCenterTo(center: Coordinate, zoomLevel: number): void {
|
||||
if (!BaiduMapProvider.BMap || !this.baiduMapInstance) {
|
||||
return;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ export class BaiduMapInstance implements MapInstance {
|
||||
}
|
||||
}
|
||||
|
||||
public setMapCenterMarker(position: MapPosition): void {
|
||||
public setMapCenterMarker(position: Coordinate): void {
|
||||
if (!BaiduMapProvider.BMap || !this.baiduMapInstance) {
|
||||
return;
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
import type { MapPosition } from '@/core/map.ts';
|
||||
import type { Coordinate } from '@/core/coordinate.ts';
|
||||
|
||||
export interface MapProvider {
|
||||
getWebsite(): string;
|
||||
@@ -13,18 +13,18 @@ export interface MapInstance {
|
||||
readonly defaultZoomLevel: number;
|
||||
readonly minZoomLevel: number;
|
||||
initMapInstance(mapContainer: HTMLElement, options: MapInstanceInitOptions): void;
|
||||
setMapCenterTo(center: MapPosition, zoomLevel: number): void;
|
||||
setMapCenterMarker(position: MapPosition): void;
|
||||
setMapCenterTo(center: Coordinate, zoomLevel: number): void;
|
||||
setMapCenterMarker(position: Coordinate): void;
|
||||
removeMapCenterMarker(): void;
|
||||
}
|
||||
|
||||
export interface MapInstanceInitOptions {
|
||||
readonly language?: string;
|
||||
readonly initCenter: MapPosition;
|
||||
readonly initCenter: Coordinate;
|
||||
readonly zoomLevel: number;
|
||||
readonly text: {
|
||||
readonly zoomIn: string;
|
||||
readonly zoomOut: string;
|
||||
};
|
||||
readonly onClick?: (position: MapPosition) => void;
|
||||
readonly onClick?: (position: Coordinate) => void;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
import type { MapPosition } from '@/core/map.ts';
|
||||
import type { Coordinate } from '@/core/coordinate.ts';
|
||||
import type { MapProvider, MapInstance, MapInstanceInitOptions } from './base.ts';
|
||||
|
||||
import { asyncLoadAssets } from '@/lib/misc.ts';
|
||||
@@ -94,7 +94,7 @@ export class GoogleMapInstance implements MapInstance {
|
||||
this.inited = true;
|
||||
}
|
||||
|
||||
public setMapCenterTo(center: MapPosition, zoomLevel: number): void {
|
||||
public setMapCenterTo(center: Coordinate, zoomLevel: number): void {
|
||||
if (!GoogleMapProvider.GoogleMap || !this.googleMapInstance) {
|
||||
return;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ export class GoogleMapInstance implements MapInstance {
|
||||
this.googleMapInstance.setZoom(zoomLevel);
|
||||
}
|
||||
|
||||
public setMapCenterMarker(position: MapPosition): void {
|
||||
public setMapCenterMarker(position: Coordinate): void {
|
||||
if (!GoogleMapProvider.GoogleMap || !this.googleMapInstance) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
import type { MapPosition } from '@/core/map.ts';
|
||||
import type { Coordinate } from '@/core/coordinate.ts';
|
||||
|
||||
import { type LeafletTileSource, type LeafletTileSourceExtraParam, LEAFLET_TILE_SOURCES } from '@/consts/map.ts';
|
||||
|
||||
@@ -97,8 +97,7 @@ export class LeafletMapInstance implements MapInstance {
|
||||
center: [ options.initCenter.latitude, options.initCenter.longitude ],
|
||||
zoom: options.zoomLevel,
|
||||
attributionControl: false,
|
||||
zoomControl: false,
|
||||
worldCopyJump: true
|
||||
zoomControl: false
|
||||
});
|
||||
|
||||
let tileUrlFormat, tileUrlSubDomains, annotationUrlFormat, annotationUrlSubDomains: string | undefined;
|
||||
@@ -180,7 +179,7 @@ export class LeafletMapInstance implements MapInstance {
|
||||
this.inited = true;
|
||||
}
|
||||
|
||||
public setMapCenterTo(center: MapPosition, zoomLevel: number): void {
|
||||
public setMapCenterTo(center: Coordinate, zoomLevel: number): void {
|
||||
if (!this.leafletInstance) {
|
||||
return;
|
||||
}
|
||||
@@ -188,7 +187,7 @@ export class LeafletMapInstance implements MapInstance {
|
||||
this.leafletInstance.setView([ center.latitude, center.longitude ], zoomLevel);
|
||||
}
|
||||
|
||||
public setMapCenterMarker(position: MapPosition): void {
|
||||
public setMapCenterMarker(position: Coordinate): void {
|
||||
if (!LeafletMapProvider.Leaflet || !this.leafletInstance) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1826,6 +1826,13 @@
|
||||
"Currency Unit": "Währungseinheit",
|
||||
"Currency Name": "Währungsname",
|
||||
"Currency Symbol": "Währungssymbol",
|
||||
"Geographic Location Format": "Geographic Location Format",
|
||||
"Latitude Longitude D.D°": "Latitude Longitude D.D°",
|
||||
"Longitude Latitude D.D°": "Longitude Latitude D.D°",
|
||||
"Latitude Longitude D°M.M'": "Latitude Longitude D°M.M'",
|
||||
"Longitude Latitude D°M.M'": "Longitude Latitude D°M.M'",
|
||||
"Latitude Longitude D°M'S\"": "Latitude Longitude D°M'S\"",
|
||||
"Longitude Latitude D°M'S\"": "Longitude Latitude D°M'S\"",
|
||||
"Expense Amount Color": "Farbe des Ausgabenbetrags",
|
||||
"Income Amount Color": "Farbe des Einnahmenbetrags",
|
||||
"Show Account Balance": "Kontostand anzeigen",
|
||||
|
||||
@@ -1826,6 +1826,13 @@
|
||||
"Currency Unit": "Currency Unit",
|
||||
"Currency Name": "Currency Name",
|
||||
"Currency Symbol": "Currency Symbol",
|
||||
"Geographic Location Format": "Geographic Location Format",
|
||||
"Latitude Longitude D.D°": "Latitude Longitude D.D°",
|
||||
"Longitude Latitude D.D°": "Longitude Latitude D.D°",
|
||||
"Latitude Longitude D°M.M'": "Latitude Longitude D°M.M'",
|
||||
"Longitude Latitude D°M.M'": "Longitude Latitude D°M.M'",
|
||||
"Latitude Longitude D°M'S\"": "Latitude Longitude D°M'S\"",
|
||||
"Longitude Latitude D°M'S\"": "Longitude Latitude D°M'S\"",
|
||||
"Expense Amount Color": "Expense Amount Color",
|
||||
"Income Amount Color": "Income Amount Color",
|
||||
"Show Account Balance": "Show Account Balance",
|
||||
|
||||
@@ -1826,6 +1826,13 @@
|
||||
"Currency Unit": "Unidad monetaria",
|
||||
"Currency Name": "Nombre de moneda",
|
||||
"Currency Symbol": "Símbolo de moneda",
|
||||
"Geographic Location Format": "Geographic Location Format",
|
||||
"Latitude Longitude D.D°": "Latitude Longitude D.D°",
|
||||
"Longitude Latitude D.D°": "Longitude Latitude D.D°",
|
||||
"Latitude Longitude D°M.M'": "Latitude Longitude D°M.M'",
|
||||
"Longitude Latitude D°M.M'": "Longitude Latitude D°M.M'",
|
||||
"Latitude Longitude D°M'S\"": "Latitude Longitude D°M'S\"",
|
||||
"Longitude Latitude D°M'S\"": "Longitude Latitude D°M'S\"",
|
||||
"Expense Amount Color": "Color del importe del gasto",
|
||||
"Income Amount Color": "Color del importe del ingreso",
|
||||
"Show Account Balance": "Mostrar saldo de cuenta",
|
||||
|
||||
@@ -46,6 +46,10 @@ import {
|
||||
CurrencySortingType
|
||||
} from '@/core/currency.ts';
|
||||
|
||||
import {
|
||||
CoordinateDisplayType
|
||||
} from '@/core/coordinate.ts';
|
||||
|
||||
import {
|
||||
PresetAmountColor
|
||||
} from '@/core/color.ts';
|
||||
@@ -385,6 +389,26 @@ export function useI18n() {
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getLocalizedDisplayNameAndTypeWithSystemDefault(typeAndNames: TypeAndName[], defaultValue: number, defaultType: TypeAndName): TypeAndDisplayName[] {
|
||||
const ret: TypeAndDisplayName[] = [];
|
||||
|
||||
ret.push({
|
||||
type: defaultValue,
|
||||
displayName: t('System Default') + (defaultType.name ? ` (${t(defaultType.name)})` : '')
|
||||
});
|
||||
|
||||
for (let i = 0; i < typeAndNames.length; i++) {
|
||||
const nameAndType = typeAndNames[i];
|
||||
|
||||
ret.push({
|
||||
type: nameAndType.type,
|
||||
displayName: t(nameAndType.name)
|
||||
});
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getLocalizedNumeralSeparatorFormats<T extends NumeralSymbolType>(allSeparatorArray: T[], localeDefaultType: T | undefined, systemDefaultType: T, languageDefaultValue: number): LocalizedNumeralSymbolType[] {
|
||||
let defaultSeparatorType: T | undefined = localeDefaultType;
|
||||
|
||||
@@ -1699,6 +1723,7 @@ export function useI18n() {
|
||||
getAllDigitGroupingTypes,
|
||||
getAllCurrencyDisplayTypes,
|
||||
getAllCurrencySortingTypes: () => getLocalizedDisplayNameAndType(CurrencySortingType.values()),
|
||||
getAllCoordinateDisplayTypes: () => getLocalizedDisplayNameAndTypeWithSystemDefault(CoordinateDisplayType.values(), CoordinateDisplayType.SystemDefaultType, CoordinateDisplayType.Default),
|
||||
getAllExpenseAmountColors: () => getAllExpenseIncomeAmountColors(CategoryType.Expense),
|
||||
getAllIncomeAmountColors: () => getAllExpenseIncomeAmountColors(CategoryType.Income),
|
||||
getAllAccountCategories,
|
||||
|
||||
@@ -1826,6 +1826,13 @@
|
||||
"Currency Unit": "Unità valuta",
|
||||
"Currency Name": "Nome valuta",
|
||||
"Currency Symbol": "Simbolo valuta",
|
||||
"Geographic Location Format": "Geographic Location Format",
|
||||
"Latitude Longitude D.D°": "Latitude Longitude D.D°",
|
||||
"Longitude Latitude D.D°": "Longitude Latitude D.D°",
|
||||
"Latitude Longitude D°M.M'": "Latitude Longitude D°M.M'",
|
||||
"Longitude Latitude D°M.M'": "Longitude Latitude D°M.M'",
|
||||
"Latitude Longitude D°M'S\"": "Latitude Longitude D°M'S\"",
|
||||
"Longitude Latitude D°M'S\"": "Longitude Latitude D°M'S\"",
|
||||
"Expense Amount Color": "Colore importo spesa",
|
||||
"Income Amount Color": "Colore importo entrata",
|
||||
"Show Account Balance": "Mostra saldo conto",
|
||||
|
||||
@@ -1826,6 +1826,13 @@
|
||||
"Currency Unit": "通貨単位",
|
||||
"Currency Name": "通貨名",
|
||||
"Currency Symbol": "通貨記号",
|
||||
"Geographic Location Format": "Geographic Location Format",
|
||||
"Latitude Longitude D.D°": "Latitude Longitude D.D°",
|
||||
"Longitude Latitude D.D°": "Longitude Latitude D.D°",
|
||||
"Latitude Longitude D°M.M'": "Latitude Longitude D°M.M'",
|
||||
"Longitude Latitude D°M.M'": "Longitude Latitude D°M.M'",
|
||||
"Latitude Longitude D°M'S\"": "Latitude Longitude D°M'S\"",
|
||||
"Longitude Latitude D°M'S\"": "Longitude Latitude D°M'S\"",
|
||||
"Expense Amount Color": "支出金額の色",
|
||||
"Income Amount Color": "収入金額の色",
|
||||
"Show Account Balance": "口座残高を表示",
|
||||
|
||||
@@ -1826,6 +1826,13 @@
|
||||
"Currency Unit": "Единица валюты",
|
||||
"Currency Name": "Название валюты",
|
||||
"Currency Symbol": "Символ валюты",
|
||||
"Geographic Location Format": "Geographic Location Format",
|
||||
"Latitude Longitude D.D°": "Latitude Longitude D.D°",
|
||||
"Longitude Latitude D.D°": "Longitude Latitude D.D°",
|
||||
"Latitude Longitude D°M.M'": "Latitude Longitude D°M.M'",
|
||||
"Longitude Latitude D°M.M'": "Longitude Latitude D°M.M'",
|
||||
"Latitude Longitude D°M'S\"": "Latitude Longitude D°M'S\"",
|
||||
"Longitude Latitude D°M'S\"": "Longitude Latitude D°M'S\"",
|
||||
"Expense Amount Color": "Цвет суммы расхода",
|
||||
"Income Amount Color": "Цвет суммы дохода",
|
||||
"Show Account Balance": "Показать баланс счета",
|
||||
|
||||
@@ -1826,6 +1826,13 @@
|
||||
"Currency Unit": "Одиниця валюти",
|
||||
"Currency Name": "Назва валюти",
|
||||
"Currency Symbol": "Символ валюти",
|
||||
"Geographic Location Format": "Geographic Location Format",
|
||||
"Latitude Longitude D.D°": "Latitude Longitude D.D°",
|
||||
"Longitude Latitude D.D°": "Longitude Latitude D.D°",
|
||||
"Latitude Longitude D°M.M'": "Latitude Longitude D°M.M'",
|
||||
"Longitude Latitude D°M.M'": "Longitude Latitude D°M.M'",
|
||||
"Latitude Longitude D°M'S\"": "Latitude Longitude D°M'S\"",
|
||||
"Longitude Latitude D°M'S\"": "Longitude Latitude D°M'S\"",
|
||||
"Expense Amount Color": "Колір суми витрат",
|
||||
"Income Amount Color": "Колір суми доходу",
|
||||
"Show Account Balance": "Показати баланс рахунку",
|
||||
|
||||
@@ -1826,6 +1826,13 @@
|
||||
"Currency Unit": "Đơn vị tiền tệ",
|
||||
"Currency Name": "Tên tiền tệ",
|
||||
"Currency Symbol": "Ký hiệu tiền tệ",
|
||||
"Geographic Location Format": "Geographic Location Format",
|
||||
"Latitude Longitude D.D°": "Latitude Longitude D.D°",
|
||||
"Longitude Latitude D.D°": "Longitude Latitude D.D°",
|
||||
"Latitude Longitude D°M.M'": "Latitude Longitude D°M.M'",
|
||||
"Longitude Latitude D°M.M'": "Longitude Latitude D°M.M'",
|
||||
"Latitude Longitude D°M'S\"": "Latitude Longitude D°M'S\"",
|
||||
"Longitude Latitude D°M'S\"": "Longitude Latitude D°M'S\"",
|
||||
"Expense Amount Color": "Màu số tiền chi tiêu",
|
||||
"Income Amount Color": "Màu số tiền thu nhập",
|
||||
"Show Account Balance": "Hiển thị số dư tài khoản",
|
||||
|
||||
@@ -1826,6 +1826,13 @@
|
||||
"Currency Unit": "货币单位",
|
||||
"Currency Name": "货币名称",
|
||||
"Currency Symbol": "货币符号",
|
||||
"Geographic Location Format": "地理位置格式",
|
||||
"Latitude Longitude D.D°": "纬度 经度 D.D°",
|
||||
"Longitude Latitude D.D°": "经度 纬度 D.D°",
|
||||
"Latitude Longitude D°M.M'": "纬度 经度 D°M.M'",
|
||||
"Longitude Latitude D°M.M'": "经度 纬度 D°M.M'",
|
||||
"Latitude Longitude D°M'S\"": "纬度 经度 D°M'S\"",
|
||||
"Longitude Latitude D°M'S\"": "经度 纬度 D°M'S\"",
|
||||
"Expense Amount Color": "支出金额颜色",
|
||||
"Income Amount Color": "收入金额颜色",
|
||||
"Show Account Balance": "显示账户余额",
|
||||
|
||||
@@ -1826,6 +1826,13 @@
|
||||
"Currency Unit": "貨幣單位",
|
||||
"Currency Name": "貨幣名稱",
|
||||
"Currency Symbol": "貨幣符號",
|
||||
"Geographic Location Format": "地理位置格式",
|
||||
"Latitude Longitude D.D°": "緯度 經度 D.D°",
|
||||
"Longitude Latitude D.D°": "經度 緯度 D.D°",
|
||||
"Latitude Longitude D°M.M'": "緯度 經度 D°M.M'",
|
||||
"Longitude Latitude D°M.M'": "經度 緯度 D°M.M'",
|
||||
"Latitude Longitude D°M'S\"": "緯度 經度 D°M'S\"",
|
||||
"Longitude Latitude D°M'S\"": "經度 緯度 D°M'S\"",
|
||||
"Expense Amount Color": "支出金額顏色",
|
||||
"Income Amount Color": "收入金額顏色",
|
||||
"Show Account Balance": "顯示帳戶餘額",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { PartialRecord } from '@/core/base.ts';
|
||||
import type { YearMonth, StartEndTime } from '@/core/datetime.ts';
|
||||
import type { MapPosition } from '@/core/map.ts';
|
||||
import { type Coordinate, getNormalizedCoordinate } from '@/core/coordinate.ts';
|
||||
import { TransactionType } from '@/core/transaction.ts';
|
||||
|
||||
import { Account, type AccountInfoResponse } from './account.ts';
|
||||
@@ -74,7 +74,7 @@ export class Transaction implements TransactionInfoResponse {
|
||||
}
|
||||
|
||||
|
||||
public set geoLocation(value: MapPosition) {
|
||||
public set geoLocation(value: Coordinate) {
|
||||
this._geoLocation = TransactionGeoLocation.of(value);
|
||||
}
|
||||
|
||||
@@ -196,8 +196,20 @@ export class Transaction implements TransactionInfoResponse {
|
||||
this._pictures = [];
|
||||
}
|
||||
|
||||
public setGeoLocation(geoLocation?: TransactionGeoLocation): void {
|
||||
this._geoLocation = geoLocation;
|
||||
public getNormalizedGeoLocation(): Coordinate | undefined {
|
||||
if (!this._geoLocation) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return this._geoLocation.toNormalizedCoordinate();
|
||||
}
|
||||
|
||||
public setGeoLocation(geoLocation?: Coordinate): void {
|
||||
if (geoLocation) {
|
||||
this._geoLocation = TransactionGeoLocation.createNewGeoLocation(geoLocation.latitude, geoLocation.longitude);
|
||||
} else {
|
||||
this._geoLocation = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
public setLatitudeAndLongitude(latitude: number, longitude: number): void {
|
||||
@@ -228,7 +240,7 @@ export class Transaction implements TransactionInfoResponse {
|
||||
tagIds: this.tagIds,
|
||||
pictureIds: this.getPictureIds(),
|
||||
comment: this.comment,
|
||||
geoLocation: this.geoLocation,
|
||||
geoLocation: this.getNormalizedGeoLocation(),
|
||||
clientSessionId: clientSessionId
|
||||
};
|
||||
}
|
||||
@@ -247,7 +259,7 @@ export class Transaction implements TransactionInfoResponse {
|
||||
tagIds: this.tagIds,
|
||||
pictureIds: this.getPictureIds(),
|
||||
comment: this.comment,
|
||||
geoLocation: this.geoLocation
|
||||
geoLocation: this.getNormalizedGeoLocation()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -410,8 +422,12 @@ export class TransactionGeoLocation implements TransactionGeoLocationRequest {
|
||||
return new TransactionGeoLocation(latitude, longitude);
|
||||
}
|
||||
|
||||
public static of(mapPosition: MapPosition): TransactionGeoLocation {
|
||||
return new TransactionGeoLocation(mapPosition.latitude, mapPosition.longitude);
|
||||
public static of(coordinate: Coordinate): TransactionGeoLocation {
|
||||
return new TransactionGeoLocation(coordinate.latitude, coordinate.longitude);
|
||||
}
|
||||
|
||||
public toNormalizedCoordinate(): Coordinate {
|
||||
return getNormalizedCoordinate(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -502,7 +518,7 @@ export interface TransactionListInMonthByPageRequest {
|
||||
readonly keyword: string;
|
||||
}
|
||||
|
||||
export type TransactionGeoLocationResponse = MapPosition;
|
||||
export type TransactionGeoLocationResponse = Coordinate;
|
||||
|
||||
export interface TransactionInfoResponse {
|
||||
readonly id: string;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { LongDateFormat, ShortDateFormat, LongTimeFormat, ShortTimeFormat } from '@/core/datetime.ts';
|
||||
import { DecimalSeparator, DigitGroupingSymbol, DigitGroupingType } from '@/core/numeral.ts';
|
||||
import { CurrencyDisplayType } from '@/core/currency.ts';
|
||||
import { CoordinateDisplayType } from '@/core/coordinate.ts';
|
||||
import { PresetAmountColor } from '@/core/color.ts';
|
||||
import type { LocalizedPresetCategory } from '@/core/category.ts';
|
||||
import { TransactionEditScopeType } from '@/core/transaction.ts';
|
||||
@@ -25,6 +26,7 @@ export class User {
|
||||
public digitGroupingSymbol: number = 0;
|
||||
public digitGrouping: number = 0;
|
||||
public currencyDisplayType: number = 0;
|
||||
public coordinateDisplayType: number = 0;
|
||||
public expenseAmountColor: number = 0;
|
||||
public incomeAmountColor: number = 0;
|
||||
|
||||
@@ -51,6 +53,7 @@ export class User {
|
||||
this.digitGroupingSymbol = user.digitGroupingSymbol;
|
||||
this.digitGrouping = user.digitGrouping;
|
||||
this.currencyDisplayType = user.currencyDisplayType;
|
||||
this.coordinateDisplayType = user.coordinateDisplayType;
|
||||
this.expenseAmountColor = user.expenseAmountColor;
|
||||
this.incomeAmountColor = user.incomeAmountColor;
|
||||
}
|
||||
@@ -87,6 +90,7 @@ export class User {
|
||||
digitGroupingSymbol: this.digitGroupingSymbol,
|
||||
digitGrouping: this.digitGrouping,
|
||||
currencyDisplayType: this.currencyDisplayType,
|
||||
coordinateDisplayType: this.coordinateDisplayType,
|
||||
expenseAmountColor: this.expenseAmountColor,
|
||||
incomeAmountColor: this.incomeAmountColor
|
||||
};
|
||||
@@ -104,6 +108,7 @@ export class User {
|
||||
user.digitGroupingSymbol = userInfo.digitGroupingSymbol;
|
||||
user.digitGrouping = userInfo.digitGrouping;
|
||||
user.currencyDisplayType = userInfo.currencyDisplayType;
|
||||
user.coordinateDisplayType = userInfo.coordinateDisplayType;
|
||||
user.expenseAmountColor = userInfo.expenseAmountColor;
|
||||
user.incomeAmountColor = userInfo.incomeAmountColor;
|
||||
|
||||
@@ -134,6 +139,7 @@ export interface UserBasicInfo {
|
||||
readonly digitGroupingSymbol: number;
|
||||
readonly digitGrouping: number;
|
||||
readonly currencyDisplayType: number;
|
||||
readonly coordinateDisplayType: number;
|
||||
readonly expenseAmountColor: number;
|
||||
readonly incomeAmountColor: number;
|
||||
readonly emailVerified: boolean;
|
||||
@@ -184,6 +190,7 @@ export interface UserProfileUpdateRequest {
|
||||
readonly digitGroupingSymbol?: number;
|
||||
readonly digitGrouping?: number;
|
||||
readonly currencyDisplayType?: number;
|
||||
readonly coordinateDisplayType?: number;
|
||||
readonly expenseAmountColor?: number;
|
||||
readonly incomeAmountColor?: number;
|
||||
}
|
||||
@@ -216,6 +223,7 @@ export const EMPTY_USER_BASIC_INFO: UserBasicInfo = {
|
||||
digitGroupingSymbol: DigitGroupingSymbol.LanguageDefaultType,
|
||||
digitGrouping: DigitGroupingType.LanguageDefaultType,
|
||||
currencyDisplayType: CurrencyDisplayType.Default.type,
|
||||
coordinateDisplayType: CoordinateDisplayType.Default.type,
|
||||
expenseAmountColor: PresetAmountColor.DefaultExpenseColor.type,
|
||||
incomeAmountColor: PresetAmountColor.DefaultIncomeColor.type,
|
||||
emailVerified: false
|
||||
|
||||
@@ -106,6 +106,11 @@ export const useUserStore = defineStore('user', () => {
|
||||
return userInfo.currencyDisplayType;
|
||||
});
|
||||
|
||||
const currentUserCoordinateDisplayType = computed<number>(() => {
|
||||
const userInfo = currentUserBasicInfo.value || EMPTY_USER_BASIC_INFO;
|
||||
return userInfo.coordinateDisplayType;
|
||||
});
|
||||
|
||||
const currentUserExpenseAmountColor = computed<number>(() => {
|
||||
const userInfo = currentUserBasicInfo.value || EMPTY_USER_BASIC_INFO;
|
||||
return userInfo.expenseAmountColor;
|
||||
@@ -324,6 +329,7 @@ export const useUserStore = defineStore('user', () => {
|
||||
currentUserDigitGroupingSymbol,
|
||||
currentUserDigitGrouping,
|
||||
currentUserCurrencyDisplayType,
|
||||
currentUserCoordinateDisplayType,
|
||||
currentUserExpenseAmountColor,
|
||||
currentUserIncomeAmountColor,
|
||||
// functions
|
||||
|
||||
@@ -92,6 +92,7 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo
|
||||
const defaultCurrency = computed<string>(() => userStore.currentUserDefaultCurrency);
|
||||
const defaultAccountId = computed<string>(() => userStore.currentUserDefaultAccountId);
|
||||
const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWeek);
|
||||
const coordinateDisplayType = computed<number>(() => userStore.currentUserCoordinateDisplayType);
|
||||
|
||||
const allTimezones = computed<LocalizedTimezoneInfo[]>(() => getAllTimezones(true));
|
||||
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
||||
@@ -416,8 +417,9 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo
|
||||
currentTimezoneOffsetMinutes,
|
||||
showAccountBalance,
|
||||
defaultCurrency,
|
||||
firstDayOfWeek,
|
||||
defaultAccountId,
|
||||
firstDayOfWeek,
|
||||
coordinateDisplayType,
|
||||
allTimezones,
|
||||
allAccounts,
|
||||
allVisibleAccounts,
|
||||
|
||||
@@ -30,6 +30,7 @@ export function useUserProfilePageBase() {
|
||||
getAllDigitGroupingSymbols,
|
||||
getAllDigitGroupingTypes,
|
||||
getAllCurrencyDisplayTypes,
|
||||
getAllCoordinateDisplayTypes,
|
||||
getAllExpenseAmountColors,
|
||||
getAllIncomeAmountColors,
|
||||
getAllTransactionEditScopeTypes,
|
||||
@@ -63,6 +64,7 @@ export function useUserProfilePageBase() {
|
||||
const allDigitGroupingSymbols = computed<TypeAndDisplayName[]>(() => getAllDigitGroupingSymbols());
|
||||
const allDigitGroupingTypes = computed<LocalizedDigitGroupingType[]>(() => getAllDigitGroupingTypes());
|
||||
const allCurrencyDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllCurrencyDisplayTypes());
|
||||
const allCoordinateDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllCoordinateDisplayTypes());
|
||||
const allExpenseAmountColorTypes = computed<TypeAndDisplayName[]>(() => getAllExpenseAmountColors());
|
||||
const allIncomeAmountColorTypes = computed<TypeAndDisplayName[]>(() => getAllIncomeAmountColors());
|
||||
const allTransactionEditScopeTypes = computed<TypeAndDisplayName[]>(() => getAllTransactionEditScopeTypes());
|
||||
@@ -106,6 +108,7 @@ export function useUserProfilePageBase() {
|
||||
newProfile.value.digitGroupingSymbol === oldProfile.value.digitGroupingSymbol &&
|
||||
newProfile.value.digitGrouping === oldProfile.value.digitGrouping &&
|
||||
newProfile.value.currencyDisplayType === oldProfile.value.currencyDisplayType &&
|
||||
newProfile.value.coordinateDisplayType === oldProfile.value.coordinateDisplayType &&
|
||||
newProfile.value.expenseAmountColor === oldProfile.value.expenseAmountColor &&
|
||||
newProfile.value.incomeAmountColor === oldProfile.value.incomeAmountColor) {
|
||||
return 'Nothing has been modified';
|
||||
@@ -195,6 +198,7 @@ export function useUserProfilePageBase() {
|
||||
allDigitGroupingSymbols,
|
||||
allDigitGroupingTypes,
|
||||
allCurrencyDisplayTypes,
|
||||
allCoordinateDisplayTypes,
|
||||
allExpenseAmountColorTypes,
|
||||
allIncomeAmountColorTypes,
|
||||
allTransactionEditScopeTypes,
|
||||
|
||||
@@ -690,7 +690,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<template #item.geoLocation="{ item }">
|
||||
<span v-if="item.geoLocation">{{ `(${item.geoLocation.longitude}, ${item.geoLocation.latitude})` }}</span>
|
||||
<span v-if="item.geoLocation">{{ `(${formatCoordinate(item.geoLocation, coordinateDisplayType)})` }}</span>
|
||||
<span v-else-if="!item.geoLocation">{{ tt('None') }}</span>
|
||||
</template>
|
||||
<template #item.tagIds="{ item }">
|
||||
@@ -889,6 +889,7 @@ import {
|
||||
getUtcOffsetByUtcOffsetMinutes,
|
||||
getTimezoneOffsetMinutes
|
||||
} from '@/lib/datetime.ts';
|
||||
import { formatCoordinate } from '@/lib/coordinate.ts';
|
||||
import {
|
||||
getAccountMapByName
|
||||
} from '@/lib/account.ts';
|
||||
@@ -1015,6 +1016,7 @@ const showAccountBalance = computed<boolean>(() => settingsStore.appSettings.sho
|
||||
const currentTimezoneOffsetMinutes = computed<number>(() => getTimezoneOffsetMinutes(settingsStore.appSettings.timeZone));
|
||||
|
||||
const defaultCurrency = computed<string>(() => userStore.currentUserDefaultCurrency);
|
||||
const coordinateDisplayType = computed<number>(() => userStore.currentUserCoordinateDisplayType);
|
||||
|
||||
const allSteps = computed<StepBarItem[]>(() => {
|
||||
const steps: StepBarItem[] = [
|
||||
|
||||
@@ -278,7 +278,7 @@
|
||||
v-model:menu="geoMenuState"
|
||||
>
|
||||
<template #selection>
|
||||
<span class="cursor-pointer" v-if="transaction.geoLocation">{{ `(${transaction.geoLocation.longitude}, ${transaction.geoLocation.latitude})` }}</span>
|
||||
<span class="cursor-pointer" v-if="transaction.geoLocation">{{ `(${formatCoordinate(transaction.geoLocation, coordinateDisplayType)})` }}</span>
|
||||
<span class="cursor-pointer" v-else-if="!transaction.geoLocation">{{ geoLocationStatusInfo }}</span>
|
||||
</template>
|
||||
|
||||
@@ -483,7 +483,7 @@ import { useTransactionTagsStore } from '@/stores/transactionTag.ts';
|
||||
import { useTransactionsStore } from '@/stores/transaction.ts';
|
||||
import { useTransactionTemplatesStore } from '@/stores/transactionTemplate.ts';
|
||||
|
||||
import type { MapPosition } from '@/core/map.ts';
|
||||
import type { Coordinate } from '@/core/coordinate.ts';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { TransactionType, TransactionEditScopeType } from '@/core/transaction.ts';
|
||||
import { TemplateType, ScheduledTemplateFrequencyType } from '@/core/template.ts';
|
||||
@@ -499,6 +499,7 @@ import {
|
||||
getTimezoneOffsetMinutes,
|
||||
getCurrentUnixTime
|
||||
} from '@/lib/datetime.ts';
|
||||
import { formatCoordinate } from '@/lib/coordinate.ts';
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import {
|
||||
getTransactionPrimaryCategoryName,
|
||||
@@ -567,6 +568,7 @@ const {
|
||||
transaction,
|
||||
defaultCurrency,
|
||||
defaultAccountId,
|
||||
coordinateDisplayType,
|
||||
allTimezones,
|
||||
allVisibleAccounts,
|
||||
allAccountsMap,
|
||||
@@ -1073,9 +1075,9 @@ function updateGeoLocation(forceUpdate: boolean): void {
|
||||
geoLocationStatus.value = GeoLocationStatus.Getting;
|
||||
}
|
||||
|
||||
function updateSpecifiedGeoLocation(mapPosition: MapPosition): void {
|
||||
function updateSpecifiedGeoLocation(coordinate: Coordinate): void {
|
||||
if (isSupportGetGeoLocationByClick() && setGeoLocationByClickMap.value) {
|
||||
transaction.value.setLatitudeAndLongitude(mapPosition.latitude, mapPosition.longitude);
|
||||
transaction.value.setLatitudeAndLongitude(coordinate.latitude, coordinate.longitude);
|
||||
map.value?.setMarkerPosition(transaction.value.geoLocation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,6 +263,25 @@
|
||||
|
||||
<v-divider />
|
||||
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col cols="12" md="6">
|
||||
<v-select
|
||||
item-title="displayName"
|
||||
item-value="type"
|
||||
persistent-placeholder
|
||||
:disabled="loading || saving"
|
||||
:label="tt('Geographic Location Format')"
|
||||
:placeholder="tt('Geographic Location Format')"
|
||||
:items="allCoordinateDisplayTypes"
|
||||
v-model="newProfile.coordinateDisplayType"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
|
||||
<v-divider />
|
||||
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col cols="12" md="6">
|
||||
@@ -360,6 +379,7 @@ const {
|
||||
allDigitGroupingSymbols,
|
||||
allDigitGroupingTypes,
|
||||
allCurrencyDisplayTypes,
|
||||
allCoordinateDisplayTypes,
|
||||
allExpenseAmountColorTypes,
|
||||
allIncomeAmountColorTypes,
|
||||
allTransactionEditScopeTypes,
|
||||
|
||||
@@ -338,7 +338,7 @@
|
||||
>
|
||||
<template #title>
|
||||
<f7-block class="list-item-custom-title no-padding no-margin">
|
||||
<span v-if="transaction.geoLocation">{{ `(${transaction.geoLocation.longitude}, ${transaction.geoLocation.latitude})` }}</span>
|
||||
<span v-if="transaction.geoLocation">{{ `(${formatCoordinate(transaction.geoLocation, coordinateDisplayType)})` }}</span>
|
||||
<span v-else-if="!transaction.geoLocation">{{ geoLocationStatusInfo }}</span>
|
||||
</f7-block>
|
||||
</template>
|
||||
@@ -515,6 +515,7 @@ import {
|
||||
getTimezoneOffset,
|
||||
getTimezoneOffsetMinutes
|
||||
} from '@/lib/datetime.ts';
|
||||
import { formatCoordinate } from '@/lib/coordinate.ts';
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import { getTransactionPrimaryCategoryName, getTransactionSecondaryCategoryName } from '@/lib/category.ts';
|
||||
import { setTransactionModelByTransaction } from '@/lib/transaction.ts';
|
||||
@@ -554,8 +555,9 @@ const {
|
||||
transaction,
|
||||
currentTimezoneOffsetMinutes,
|
||||
defaultCurrency,
|
||||
firstDayOfWeek,
|
||||
defaultAccountId,
|
||||
firstDayOfWeek,
|
||||
coordinateDisplayType,
|
||||
allTimezones,
|
||||
allVisibleAccounts,
|
||||
allAccountsMap,
|
||||
|
||||
@@ -41,6 +41,10 @@
|
||||
<f7-list-item class="list-item-with-header-and-title list-item-no-item-after" header="Decimal Separator" title="Dot (.)" link="#"></f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-list strong inset dividers class="margin-vertical skeleton-text" v-if="loading">
|
||||
<f7-list-item class="list-item-with-header-and-title list-item-no-item-after" header="Geographic Location Format" title="Coordinate Format" link="#"></f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-list strong inset dividers class="margin-vertical skeleton-text" v-if="loading">
|
||||
<f7-list-item class="list-item-with-header-and-title list-item-no-item-after" header="Expense Amount Color" title="Amount Color" link="#"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title list-item-no-item-after" header="Income Amount Color" title="Amount Color" link="#"></f7-list-item>
|
||||
@@ -365,6 +369,28 @@
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-list form strong inset dividers class="margin-vertical" v-if="!loading">
|
||||
<f7-list-item
|
||||
link="#"
|
||||
class="list-item-with-header-and-title list-item-no-item-after"
|
||||
:header="tt('Geographic Location Format')"
|
||||
:title="findDisplayNameByType(allCoordinateDisplayTypes, newProfile.coordinateDisplayType)"
|
||||
@click="showCoordinateDisplayTypePopup = true"
|
||||
>
|
||||
<list-item-selection-popup value-type="item"
|
||||
key-field="type" value-field="type"
|
||||
title-field="displayName"
|
||||
:title="tt('Geographic Location Format')"
|
||||
:enable-filter="true"
|
||||
:filter-placeholder="tt('Geographic Location Format')"
|
||||
:filter-no-items-text="tt('No results')"
|
||||
:items="allCoordinateDisplayTypes"
|
||||
v-model:show="showCoordinateDisplayTypePopup"
|
||||
v-model="newProfile.coordinateDisplayType">
|
||||
</list-item-selection-popup>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-list form strong inset dividers class="margin-vertical" v-if="!loading">
|
||||
<f7-list-item
|
||||
link="#"
|
||||
@@ -477,6 +503,7 @@ const {
|
||||
allDigitGroupingSymbols,
|
||||
allDigitGroupingTypes,
|
||||
allCurrencyDisplayTypes,
|
||||
allCoordinateDisplayTypes,
|
||||
allExpenseAmountColorTypes,
|
||||
allIncomeAmountColorTypes,
|
||||
allTransactionEditScopeTypes,
|
||||
@@ -514,6 +541,7 @@ const showCurrencyDisplayTypePopup = ref<boolean>(false);
|
||||
const showDigitGroupingPopup = ref<boolean>(false);
|
||||
const showDigitGroupingSymbolPopup = ref<boolean>(false);
|
||||
const showDecimalSeparatorPopup = ref<boolean>(false);
|
||||
const showCoordinateDisplayTypePopup = ref<boolean>(false);
|
||||
const showExpenseAmountColorPopup = ref<boolean>(false);
|
||||
const showIncomeAmountColorPopup = ref<boolean>(false);
|
||||
const showMoreActionSheet = ref<boolean>(false);
|
||||
|
||||
Reference in New Issue
Block a user