mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
(typing) use TDateISO for typing dates
This commit is contained in:
parent
b4ae80457e
commit
814ebfe52d
@ -1,9 +1,10 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { LabelledInput } from './base/labelled-input';
|
import { LabelledInput } from './base/labelled-input';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { TDateISODate } from '../typings/date-iso';
|
||||||
|
|
||||||
interface DocumentFiltersProps {
|
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<DocumentFiltersProps> = ({ onFilterChange
|
|||||||
const { t } = useTranslation('admin');
|
const { t } = useTranslation('admin');
|
||||||
|
|
||||||
// stores the value of reference input
|
// stores the value of reference input
|
||||||
const [referenceFilter, setReferenceFilter] = useState('');
|
const [referenceFilter, setReferenceFilter] = useState<string>('');
|
||||||
// stores the value of the customer input
|
// stores the value of the customer input
|
||||||
const [customerFilter, setCustomerFilter] = useState('');
|
const [customerFilter, setCustomerFilter] = useState<string>('');
|
||||||
// stores the value of the date input
|
// stores the value of the date input
|
||||||
const [dateFilter, setDateFilter] = useState(null);
|
const [dateFilter, setDateFilter] = useState<TDateISODate>(null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When any filter changes, trigger the callback with the current value of all filters
|
* When any filter changes, trigger the callback with the current value of all filters
|
||||||
|
@ -9,6 +9,7 @@ import { User } from '../../models/user';
|
|||||||
import { PaymentSchedule } from '../../models/payment-schedule';
|
import { PaymentSchedule } from '../../models/payment-schedule';
|
||||||
import { IApplication } from '../../models/application';
|
import { IApplication } from '../../models/application';
|
||||||
import PaymentScheduleAPI from '../../api/payment-schedule';
|
import PaymentScheduleAPI from '../../api/payment-schedule';
|
||||||
|
import { TDateISODate } from '../../typings/date-iso';
|
||||||
|
|
||||||
declare const Application: IApplication;
|
declare const Application: IApplication;
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ const PaymentSchedulesList: React.FC<PaymentSchedulesListProps> = ({ currentUser
|
|||||||
// current filter, by customer's name, for the schedules
|
// current filter, by customer's name, for the schedules
|
||||||
const [customerFilter, setCustomerFilter] = useState<string>(null);
|
const [customerFilter, setCustomerFilter] = useState<string>(null);
|
||||||
// current filter, by date, for the schedules and the deadlines
|
// current filter, by date, for the schedules and the deadlines
|
||||||
const [dateFilter, setDateFilter] = useState<Date>(null);
|
const [dateFilter, setDateFilter] = useState<TDateISODate>(null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch from the API the payments schedules matching the given filters and reset the results table with the new schedules.
|
* Fetch from the API the payments schedules matching the given filters and reset the results table with the new schedules.
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { TDateISO } from '../typings/date-iso';
|
||||||
|
|
||||||
export interface Event {
|
export interface Event {
|
||||||
id: number,
|
id: number,
|
||||||
title: string,
|
title: string,
|
||||||
@ -22,18 +24,18 @@ export interface Event {
|
|||||||
age_range: {
|
age_range: {
|
||||||
name: string
|
name: string
|
||||||
},
|
},
|
||||||
start_date: Date,
|
start_date: TDateISO,
|
||||||
start_time: Date,
|
start_time: TDateISO,
|
||||||
end_date: Date,
|
end_date: TDateISO,
|
||||||
end_time: Date,
|
end_time: TDateISO,
|
||||||
month: string;
|
month: string;
|
||||||
month_id: number,
|
month_id: number,
|
||||||
year: number,
|
year: number,
|
||||||
all_day: boolean,
|
all_day: boolean,
|
||||||
availability: {
|
availability: {
|
||||||
id: number,
|
id: number,
|
||||||
start_at: Date,
|
start_at: TDateISO,
|
||||||
end_at: Date
|
end_at: TDateISO
|
||||||
},
|
},
|
||||||
availability_id: number,
|
availability_id: number,
|
||||||
amount: number,
|
amount: number,
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
import { TDateISO } from '../typings/date-iso';
|
||||||
|
|
||||||
export interface HistoryValue {
|
export interface HistoryValue {
|
||||||
id: number,
|
id: number,
|
||||||
value: string,
|
value: string,
|
||||||
created_at: Date
|
created_at: TDateISO
|
||||||
user: {
|
user: {
|
||||||
id: number,
|
id: number,
|
||||||
name: string
|
name: string
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
import { TDateISO } from '../typings/date-iso';
|
||||||
|
|
||||||
export interface Invoice {
|
export interface Invoice {
|
||||||
id: number,
|
id: number,
|
||||||
created_at: Date,
|
created_at: TDateISO,
|
||||||
reference: string,
|
reference: string,
|
||||||
avoir_date: Date,
|
avoir_date: TDateISO,
|
||||||
description: string
|
description: string
|
||||||
user_id: number,
|
user_id: number,
|
||||||
total: number,
|
total: number,
|
||||||
@ -11,7 +13,7 @@ export interface Invoice {
|
|||||||
is_avoir: boolean,
|
is_avoir: boolean,
|
||||||
is_subscription_invoice: boolean,
|
is_subscription_invoice: boolean,
|
||||||
is_online_card: boolean,
|
is_online_card: boolean,
|
||||||
date: Date,
|
date: TDateISO,
|
||||||
chained_footprint: boolean,
|
chained_footprint: boolean,
|
||||||
main_object: {
|
main_object: {
|
||||||
type: string,
|
type: string,
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { TDateISO, TDateISODate } from '../typings/date-iso';
|
||||||
|
|
||||||
export enum PaymentScheduleItemState {
|
export enum PaymentScheduleItemState {
|
||||||
New = 'new',
|
New = 'new',
|
||||||
Pending = 'pending',
|
Pending = 'pending',
|
||||||
@ -17,7 +19,7 @@ export enum PaymentMethod {
|
|||||||
export interface PaymentScheduleItem {
|
export interface PaymentScheduleItem {
|
||||||
id: number,
|
id: number,
|
||||||
amount: number,
|
amount: number,
|
||||||
due_date: Date,
|
due_date: TDateISO,
|
||||||
state: PaymentScheduleItemState,
|
state: PaymentScheduleItemState,
|
||||||
invoice_id: number,
|
invoice_id: number,
|
||||||
payment_method: PaymentMethod,
|
payment_method: PaymentMethod,
|
||||||
@ -31,7 +33,7 @@ export interface PaymentSchedule {
|
|||||||
reference?: string,
|
reference?: string,
|
||||||
payment_method: PaymentMethod,
|
payment_method: PaymentMethod,
|
||||||
items?: Array<PaymentScheduleItem>,
|
items?: Array<PaymentScheduleItem>,
|
||||||
created_at?: Date,
|
created_at?: TDateISO,
|
||||||
chained_footprint?: boolean,
|
chained_footprint?: boolean,
|
||||||
main_object?: {
|
main_object?: {
|
||||||
type: string,
|
type: string,
|
||||||
@ -53,7 +55,7 @@ export interface PaymentScheduleIndexRequest {
|
|||||||
query: {
|
query: {
|
||||||
reference?: string,
|
reference?: string,
|
||||||
customer?: string,
|
customer?: string,
|
||||||
date?: Date,
|
date?: TDateISODate,
|
||||||
page: number,
|
page: number,
|
||||||
size: number
|
size: number
|
||||||
}
|
}
|
||||||
@ -74,5 +76,5 @@ export interface PayItemResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface CancelScheduleResponse {
|
export interface CancelScheduleResponse {
|
||||||
canceled_at: Date
|
canceled_at: TDateISO
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Reservation } from './reservation';
|
import { Reservation } from './reservation';
|
||||||
import { SubscriptionRequest } from './subscription';
|
import { SubscriptionRequest } from './subscription';
|
||||||
|
import { TDateISO } from '../typings/date-iso';
|
||||||
|
|
||||||
export interface PaymentConfirmation {
|
export interface PaymentConfirmation {
|
||||||
requires_action?: boolean,
|
requires_action?: boolean,
|
||||||
@ -26,7 +27,7 @@ export enum PaymentMethod {
|
|||||||
export type CartItem = { reservation: Reservation }|
|
export type CartItem = { reservation: Reservation }|
|
||||||
{ subscription: SubscriptionRequest }|
|
{ subscription: SubscriptionRequest }|
|
||||||
{ prepaid_pack: { id: number } }|
|
{ prepaid_pack: { id: number } }|
|
||||||
{ free_extension: { end_at: Date } };
|
{ free_extension: { end_at: TDateISO } };
|
||||||
|
|
||||||
export interface ShoppingCart {
|
export interface ShoppingCart {
|
||||||
customer_id: number,
|
customer_id: number,
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { TDateISO } from '../typings/date-iso';
|
||||||
|
|
||||||
export interface PriceIndexFilter {
|
export interface PriceIndexFilter {
|
||||||
priceable_type?: string,
|
priceable_type?: string,
|
||||||
priceable_id?: number,
|
priceable_id?: number,
|
||||||
@ -20,7 +22,7 @@ export interface ComputePriceResult {
|
|||||||
price_without_coupon: number,
|
price_without_coupon: number,
|
||||||
details?: {
|
details?: {
|
||||||
slots: Array<{
|
slots: Array<{
|
||||||
start_at: Date,
|
start_at: TDateISO,
|
||||||
price: number,
|
price: number,
|
||||||
promo: boolean
|
promo: boolean
|
||||||
}>
|
}>
|
||||||
@ -29,7 +31,7 @@ export interface ComputePriceResult {
|
|||||||
schedule?: {
|
schedule?: {
|
||||||
items: Array<{
|
items: Array<{
|
||||||
amount: number,
|
amount: number,
|
||||||
due_date: Date
|
due_date: TDateISO
|
||||||
}>
|
}>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
import { TDateISO } from '../typings/date-iso';
|
||||||
|
|
||||||
export interface ReservationSlot {
|
export interface ReservationSlot {
|
||||||
id?: number,
|
id?: number,
|
||||||
start_at: Date,
|
start_at: TDateISO,
|
||||||
end_at: Date,
|
end_at: TDateISO,
|
||||||
availability_id: number,
|
availability_id: number,
|
||||||
offered: boolean
|
offered: boolean
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { HistoryValue } from './history-value';
|
import { HistoryValue } from './history-value';
|
||||||
|
import { TDateISO } from '../typings/date-iso';
|
||||||
|
|
||||||
export enum SettingName {
|
export enum SettingName {
|
||||||
AboutTitle = 'about_title',
|
AboutTitle = 'about_title',
|
||||||
@ -127,7 +128,7 @@ export interface Setting {
|
|||||||
name: SettingName,
|
name: SettingName,
|
||||||
localized?: string,
|
localized?: string,
|
||||||
value: string,
|
value: string,
|
||||||
last_update?: Date,
|
last_update?: TDateISO,
|
||||||
history?: Array<HistoryValue>
|
history?: Array<HistoryValue>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ export interface Charge {
|
|||||||
application_fee_amount?: number,
|
application_fee_amount?: number,
|
||||||
calculated_statement_descriptor: string,
|
calculated_statement_descriptor: string,
|
||||||
captured: boolean,
|
captured: boolean,
|
||||||
created: Date,
|
created: number,
|
||||||
failure_code?: string
|
failure_code?: string
|
||||||
failure_message?: string,
|
failure_message?: string,
|
||||||
fraud_details: Record<string, unknown>,
|
fraud_details: Record<string, unknown>,
|
||||||
@ -61,7 +61,7 @@ export interface Price {
|
|||||||
object: 'price',
|
object: 'price',
|
||||||
active: boolean,
|
active: boolean,
|
||||||
billing_scheme: 'per_unit' | 'tiered',
|
billing_scheme: 'per_unit' | 'tiered',
|
||||||
created: Date,
|
created: number,
|
||||||
currency: string,
|
currency: string,
|
||||||
livemode: boolean,
|
livemode: boolean,
|
||||||
lookup_key: string,
|
lookup_key: string,
|
||||||
@ -108,7 +108,7 @@ export interface TaxRate {
|
|||||||
metadata: Record<string, unknown>,
|
metadata: Record<string, unknown>,
|
||||||
percentage: number,
|
percentage: number,
|
||||||
state: string,
|
state: string,
|
||||||
created: Date,
|
created: number,
|
||||||
livemode: boolean,
|
livemode: boolean,
|
||||||
tax_type: 'vat' | 'sales_tax' | string
|
tax_type: 'vat' | 'sales_tax' | string
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ export interface SubscriptionItem {
|
|||||||
billing_thresholds: {
|
billing_thresholds: {
|
||||||
usage_gte: number,
|
usage_gte: number,
|
||||||
},
|
},
|
||||||
created: Date,
|
created: number,
|
||||||
metadata: Record<string, unknown>,
|
metadata: Record<string, unknown>,
|
||||||
price: Price,
|
price: Price,
|
||||||
quantity: number,
|
quantity: number,
|
||||||
@ -142,8 +142,8 @@ export interface Invoice {
|
|||||||
lines: [],
|
lines: [],
|
||||||
metadata: Record<string, unknown>,
|
metadata: Record<string, unknown>,
|
||||||
payment_intent: PaymentIntent,
|
payment_intent: PaymentIntent,
|
||||||
period_end: Date,
|
period_end: number,
|
||||||
period_start: Date,
|
period_start: number,
|
||||||
status: 'draft' | 'open' | 'paid' | 'uncollectible' | 'void',
|
status: 'draft' | 'open' | 'paid' | 'uncollectible' | 'void',
|
||||||
subscription: string,
|
subscription: string,
|
||||||
total: number
|
total: number
|
||||||
@ -154,8 +154,8 @@ export interface Subscription {
|
|||||||
id: string,
|
id: string,
|
||||||
object: 'subscription',
|
object: 'subscription',
|
||||||
cancel_at_period_end: boolean,
|
cancel_at_period_end: boolean,
|
||||||
current_period_end: Date,
|
current_period_end: number,
|
||||||
current_period_start: Date,
|
current_period_start: number,
|
||||||
customer: string,
|
customer: string,
|
||||||
default_payment_method: string,
|
default_payment_method: string,
|
||||||
items: [
|
items: [
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
import { Plan } from './plan';
|
import { Plan } from './plan';
|
||||||
|
import { TDateISO } from '../typings/date-iso';
|
||||||
|
|
||||||
export interface Subscription {
|
export interface Subscription {
|
||||||
id: number,
|
id: number,
|
||||||
plan_id: number,
|
plan_id: number,
|
||||||
expired_at: Date,
|
expired_at: TDateISO,
|
||||||
canceled_at?: Date,
|
canceled_at?: TDateISO,
|
||||||
plan: Plan
|
plan: Plan
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SubscriptionRequest {
|
export interface SubscriptionRequest {
|
||||||
plan_id: number,
|
plan_id: number,
|
||||||
start_at?: Date
|
start_at?: TDateISO
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UpdateSubscriptionRequest {
|
export interface UpdateSubscriptionRequest {
|
||||||
id: number,
|
id: number,
|
||||||
expired_at: Date,
|
expired_at: TDateISO,
|
||||||
free: boolean
|
free: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { TDateISO } from '../typings/date-iso';
|
||||||
|
|
||||||
export interface UserPackIndexFilter {
|
export interface UserPackIndexFilter {
|
||||||
user_id?: number,
|
user_id?: number,
|
||||||
@ -7,7 +8,7 @@ export interface UserPackIndexFilter {
|
|||||||
|
|
||||||
export interface UserPack {
|
export interface UserPack {
|
||||||
minutes_used: number,
|
minutes_used: number,
|
||||||
expires_at: Date,
|
expires_at: TDateISO,
|
||||||
prepaid_pack: {
|
prepaid_pack: {
|
||||||
minutes: number,
|
minutes: number,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user