179 lines
2.7 KiB
JavaScript
179 lines
2.7 KiB
JavaScript
// src/lib/utils/defaults.js
|
|
|
|
import { SUPPORTER_SUBSCRIPTION_MODEL_NAME } from './constants';
|
|
|
|
/**
|
|
* @returns {App.Types['subscription']}
|
|
*/
|
|
export function defaultSubscription() {
|
|
return {
|
|
id: 0,
|
|
name: '',
|
|
details: '',
|
|
conditions: '',
|
|
monthly_fee: 0,
|
|
hourly_rate: 0,
|
|
included_hours_per_year: 0,
|
|
included_hours_per_month: 0
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @returns {App.Types['membership']}
|
|
*/
|
|
export function defaultMembership() {
|
|
return {
|
|
id: 0,
|
|
status: 3,
|
|
start_date: '',
|
|
end_date: '',
|
|
parent_member_id: 0,
|
|
subscription_model: defaultSubscription()
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @returns {App.Types['bankAccount']}
|
|
*/
|
|
export function defaultBankAccount() {
|
|
return {
|
|
id: 0,
|
|
mandate_date_signed: '',
|
|
bank: '',
|
|
account_holder_name: '',
|
|
iban: '',
|
|
bic: '',
|
|
mandate_reference: ''
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @returns {App.Types['licence']}
|
|
*/
|
|
export function defaultLicence() {
|
|
return {
|
|
id: 0,
|
|
status: 0,
|
|
number: '',
|
|
issued_date: '',
|
|
expiration_date: '',
|
|
country: '',
|
|
categories: []
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @returns {App.Locals['user']}
|
|
*/
|
|
export function defaultUser() {
|
|
return {
|
|
id: 0,
|
|
email: '',
|
|
first_name: '',
|
|
last_name: '',
|
|
password: '',
|
|
phone: '',
|
|
address: '',
|
|
zip_code: '',
|
|
city: '',
|
|
company: '',
|
|
dateofbirth: '',
|
|
notes: '',
|
|
profile_picture: '',
|
|
payment_status: 0,
|
|
status: 1,
|
|
role_id: 1,
|
|
membership: defaultMembership(),
|
|
licence: defaultLicence(),
|
|
bank_account: defaultBankAccount()
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @returns {App.Locals['user']}
|
|
*/
|
|
export function defaultSupporter() {
|
|
let supporter = {
|
|
id: 0,
|
|
email: '',
|
|
first_name: '',
|
|
last_name: '',
|
|
password: '',
|
|
phone: '',
|
|
address: '',
|
|
zip_code: '',
|
|
city: '',
|
|
company: '',
|
|
dateofbirth: '',
|
|
notes: '',
|
|
profile_picture: '',
|
|
payment_status: 0,
|
|
status: 5,
|
|
role_id: 0,
|
|
membership: defaultMembership(),
|
|
licence: defaultLicence(),
|
|
bank_account: defaultBankAccount()
|
|
};
|
|
supporter.membership.subscription_model.name = SUPPORTER_SUBSCRIPTION_MODEL_NAME;
|
|
return supporter;
|
|
}
|
|
|
|
/**
|
|
* @returns {App.Types['location']}
|
|
*/
|
|
export function defaultLocation() {
|
|
return {
|
|
latitude: 0,
|
|
longitude: 0
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @returns {App.Types['damage']}
|
|
*/
|
|
export function defaultDamage() {
|
|
return {
|
|
id: 0,
|
|
opponent: defaultUser(),
|
|
insurance: null,
|
|
notes: ''
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @returns {App.Types['insurance']}
|
|
*/
|
|
export function defaultInsurance() {
|
|
return {
|
|
id: 0,
|
|
company: '',
|
|
reference: '',
|
|
start_date: '',
|
|
end_date: '',
|
|
notes: ''
|
|
};
|
|
}
|
|
|
|
/**
|
|
* @returns {App.Types['car']}
|
|
*/
|
|
export function defaultCar() {
|
|
return {
|
|
id: 0,
|
|
name: '',
|
|
status: '',
|
|
brand: '',
|
|
model: '',
|
|
price: 0,
|
|
rate: 0,
|
|
start_date: '',
|
|
end_date: '',
|
|
color: '',
|
|
licence_plate: '',
|
|
location: defaultLocation(),
|
|
damages: [],
|
|
insurances: [],
|
|
notes: ''
|
|
};
|
|
}
|