diff --git a/app/frontend/src/javascript/components/document-filters.tsx b/app/frontend/src/javascript/components/document-filters.tsx index 723dc742c..d8566b467 100644 --- a/app/frontend/src/javascript/components/document-filters.tsx +++ b/app/frontend/src/javascript/components/document-filters.tsx @@ -1,9 +1,10 @@ import React, { useEffect, useState } from 'react'; import { LabelledInput } from './base/labelled-input'; import { useTranslation } from 'react-i18next'; +import { TDateISODate } from '../typings/date-iso'; interface DocumentFiltersProps { - onFilterChange: (value: { reference: string, customer: string, date: Date }) => void + onFilterChange: (value: { reference: string, customer: string, date: TDateISODate }) => void } /** @@ -13,11 +14,11 @@ export const DocumentFilters: React.FC = ({ onFilterChange const { t } = useTranslation('admin'); // stores the value of reference input - const [referenceFilter, setReferenceFilter] = useState(''); + const [referenceFilter, setReferenceFilter] = useState(''); // stores the value of the customer input - const [customerFilter, setCustomerFilter] = useState(''); + const [customerFilter, setCustomerFilter] = useState(''); // stores the value of the date input - const [dateFilter, setDateFilter] = useState(null); + const [dateFilter, setDateFilter] = useState(null); /** * When any filter changes, trigger the callback with the current value of all filters diff --git a/app/frontend/src/javascript/components/payment-schedule/payment-schedules-list.tsx b/app/frontend/src/javascript/components/payment-schedule/payment-schedules-list.tsx index 0bd68c330..31dd30005 100644 --- a/app/frontend/src/javascript/components/payment-schedule/payment-schedules-list.tsx +++ b/app/frontend/src/javascript/components/payment-schedule/payment-schedules-list.tsx @@ -9,6 +9,7 @@ import { User } from '../../models/user'; import { PaymentSchedule } from '../../models/payment-schedule'; import { IApplication } from '../../models/application'; import PaymentScheduleAPI from '../../api/payment-schedule'; +import { TDateISODate } from '../../typings/date-iso'; declare const Application: IApplication; @@ -36,7 +37,7 @@ const PaymentSchedulesList: React.FC = ({ currentUser // current filter, by customer's name, for the schedules const [customerFilter, setCustomerFilter] = useState(null); // current filter, by date, for the schedules and the deadlines - const [dateFilter, setDateFilter] = useState(null); + const [dateFilter, setDateFilter] = useState(null); /** * Fetch from the API the payments schedules matching the given filters and reset the results table with the new schedules. diff --git a/app/frontend/src/javascript/models/event.ts b/app/frontend/src/javascript/models/event.ts index 9e8de3b37..52ef2cbf2 100644 --- a/app/frontend/src/javascript/models/event.ts +++ b/app/frontend/src/javascript/models/event.ts @@ -1,3 +1,5 @@ +import { TDateISO } from '../typings/date-iso'; + export interface Event { id: number, title: string, @@ -22,18 +24,18 @@ export interface Event { age_range: { name: string }, - start_date: Date, - start_time: Date, - end_date: Date, - end_time: Date, + start_date: TDateISO, + start_time: TDateISO, + end_date: TDateISO, + end_time: TDateISO, month: string; month_id: number, year: number, all_day: boolean, availability: { id: number, - start_at: Date, - end_at: Date + start_at: TDateISO, + end_at: TDateISO }, availability_id: number, amount: number, diff --git a/app/frontend/src/javascript/models/history-value.ts b/app/frontend/src/javascript/models/history-value.ts index 0a4110afd..435a21da8 100644 --- a/app/frontend/src/javascript/models/history-value.ts +++ b/app/frontend/src/javascript/models/history-value.ts @@ -1,7 +1,9 @@ +import { TDateISO } from '../typings/date-iso'; + export interface HistoryValue { id: number, value: string, - created_at: Date + created_at: TDateISO user: { id: number, name: string diff --git a/app/frontend/src/javascript/models/invoice.ts b/app/frontend/src/javascript/models/invoice.ts index 285180756..3d218ea84 100644 --- a/app/frontend/src/javascript/models/invoice.ts +++ b/app/frontend/src/javascript/models/invoice.ts @@ -1,8 +1,10 @@ +import { TDateISO } from '../typings/date-iso'; + export interface Invoice { id: number, - created_at: Date, + created_at: TDateISO, reference: string, - avoir_date: Date, + avoir_date: TDateISO, description: string user_id: number, total: number, @@ -11,7 +13,7 @@ export interface Invoice { is_avoir: boolean, is_subscription_invoice: boolean, is_online_card: boolean, - date: Date, + date: TDateISO, chained_footprint: boolean, main_object: { type: string, diff --git a/app/frontend/src/javascript/models/payment-schedule.ts b/app/frontend/src/javascript/models/payment-schedule.ts index 81cf6d899..2a2a7be62 100644 --- a/app/frontend/src/javascript/models/payment-schedule.ts +++ b/app/frontend/src/javascript/models/payment-schedule.ts @@ -1,3 +1,5 @@ +import { TDateISO, TDateISODate } from '../typings/date-iso'; + export enum PaymentScheduleItemState { New = 'new', Pending = 'pending', @@ -17,7 +19,7 @@ export enum PaymentMethod { export interface PaymentScheduleItem { id: number, amount: number, - due_date: Date, + due_date: TDateISO, state: PaymentScheduleItemState, invoice_id: number, payment_method: PaymentMethod, @@ -31,7 +33,7 @@ export interface PaymentSchedule { reference?: string, payment_method: PaymentMethod, items?: Array, - created_at?: Date, + created_at?: TDateISO, chained_footprint?: boolean, main_object?: { type: string, @@ -53,7 +55,7 @@ export interface PaymentScheduleIndexRequest { query: { reference?: string, customer?: string, - date?: Date, + date?: TDateISODate, page: number, size: number } @@ -74,5 +76,5 @@ export interface PayItemResponse { } export interface CancelScheduleResponse { - canceled_at: Date + canceled_at: TDateISO } diff --git a/app/frontend/src/javascript/models/payment.ts b/app/frontend/src/javascript/models/payment.ts index a3bcd5424..e8e9caba0 100644 --- a/app/frontend/src/javascript/models/payment.ts +++ b/app/frontend/src/javascript/models/payment.ts @@ -1,5 +1,6 @@ import { Reservation } from './reservation'; import { SubscriptionRequest } from './subscription'; +import { TDateISO } from '../typings/date-iso'; export interface PaymentConfirmation { requires_action?: boolean, @@ -26,7 +27,7 @@ export enum PaymentMethod { export type CartItem = { reservation: Reservation }| { subscription: SubscriptionRequest }| { prepaid_pack: { id: number } }| - { free_extension: { end_at: Date } }; + { free_extension: { end_at: TDateISO } }; export interface ShoppingCart { customer_id: number, diff --git a/app/frontend/src/javascript/models/price.ts b/app/frontend/src/javascript/models/price.ts index fcd1b0e8e..563e52c67 100644 --- a/app/frontend/src/javascript/models/price.ts +++ b/app/frontend/src/javascript/models/price.ts @@ -1,3 +1,5 @@ +import { TDateISO } from '../typings/date-iso'; + export interface PriceIndexFilter { priceable_type?: string, priceable_id?: number, @@ -20,7 +22,7 @@ export interface ComputePriceResult { price_without_coupon: number, details?: { slots: Array<{ - start_at: Date, + start_at: TDateISO, price: number, promo: boolean }> @@ -29,7 +31,7 @@ export interface ComputePriceResult { schedule?: { items: Array<{ amount: number, - due_date: Date + due_date: TDateISO }> } } diff --git a/app/frontend/src/javascript/models/reservation.ts b/app/frontend/src/javascript/models/reservation.ts index 49dc54115..eaec634ba 100644 --- a/app/frontend/src/javascript/models/reservation.ts +++ b/app/frontend/src/javascript/models/reservation.ts @@ -1,7 +1,9 @@ +import { TDateISO } from '../typings/date-iso'; + export interface ReservationSlot { id?: number, - start_at: Date, - end_at: Date, + start_at: TDateISO, + end_at: TDateISO, availability_id: number, offered: boolean } diff --git a/app/frontend/src/javascript/models/setting.ts b/app/frontend/src/javascript/models/setting.ts index 89eb1c577..a746a2732 100644 --- a/app/frontend/src/javascript/models/setting.ts +++ b/app/frontend/src/javascript/models/setting.ts @@ -1,4 +1,5 @@ import { HistoryValue } from './history-value'; +import { TDateISO } from '../typings/date-iso'; export enum SettingName { AboutTitle = 'about_title', @@ -127,7 +128,7 @@ export interface Setting { name: SettingName, localized?: string, value: string, - last_update?: Date, + last_update?: TDateISO, history?: Array } diff --git a/app/frontend/src/javascript/models/stripe.ts b/app/frontend/src/javascript/models/stripe.ts index 05766c7d7..64f683826 100644 --- a/app/frontend/src/javascript/models/stripe.ts +++ b/app/frontend/src/javascript/models/stripe.ts @@ -23,7 +23,7 @@ export interface Charge { application_fee_amount?: number, calculated_statement_descriptor: string, captured: boolean, - created: Date, + created: number, failure_code?: string failure_message?: string, fraud_details: Record, @@ -61,7 +61,7 @@ export interface Price { object: 'price', active: boolean, billing_scheme: 'per_unit' | 'tiered', - created: Date, + created: number, currency: string, livemode: boolean, lookup_key: string, @@ -108,7 +108,7 @@ export interface TaxRate { metadata: Record, percentage: number, state: string, - created: Date, + created: number, livemode: boolean, tax_type: 'vat' | 'sales_tax' | string } @@ -120,7 +120,7 @@ export interface SubscriptionItem { billing_thresholds: { usage_gte: number, }, - created: Date, + created: number, metadata: Record, price: Price, quantity: number, @@ -142,8 +142,8 @@ export interface Invoice { lines: [], metadata: Record, payment_intent: PaymentIntent, - period_end: Date, - period_start: Date, + period_end: number, + period_start: number, status: 'draft' | 'open' | 'paid' | 'uncollectible' | 'void', subscription: string, total: number @@ -154,8 +154,8 @@ export interface Subscription { id: string, object: 'subscription', cancel_at_period_end: boolean, - current_period_end: Date, - current_period_start: Date, + current_period_end: number, + current_period_start: number, customer: string, default_payment_method: string, items: [ diff --git a/app/frontend/src/javascript/models/subscription.ts b/app/frontend/src/javascript/models/subscription.ts index 36a17bd52..54c722994 100644 --- a/app/frontend/src/javascript/models/subscription.ts +++ b/app/frontend/src/javascript/models/subscription.ts @@ -1,21 +1,22 @@ import { Plan } from './plan'; +import { TDateISO } from '../typings/date-iso'; export interface Subscription { id: number, plan_id: number, - expired_at: Date, - canceled_at?: Date, + expired_at: TDateISO, + canceled_at?: TDateISO, plan: Plan } export interface SubscriptionRequest { plan_id: number, - start_at?: Date + start_at?: TDateISO } export interface UpdateSubscriptionRequest { id: number, - expired_at: Date, + expired_at: TDateISO, free: boolean } diff --git a/app/frontend/src/javascript/models/user-pack.ts b/app/frontend/src/javascript/models/user-pack.ts index ceaf25e25..655e61977 100644 --- a/app/frontend/src/javascript/models/user-pack.ts +++ b/app/frontend/src/javascript/models/user-pack.ts @@ -1,3 +1,4 @@ +import { TDateISO } from '../typings/date-iso'; export interface UserPackIndexFilter { user_id?: number, @@ -7,7 +8,7 @@ export interface UserPackIndexFilter { export interface UserPack { minutes_used: number, - expires_at: Date, + expires_at: TDateISO, prepaid_pack: { minutes: number, }