Skip to content

Instantly share code, notes, and snippets.

import { ITerms } from './index';
export interface ITerms {
totalPrice: number;
initialPayment: number;
periodMonth: number;
monthlyPayment: number;
initialPaymentRangePercent: {
min: number;
max: number;
const types = {
obj: 'Object',
arr: 'Array',
str: 'String',
num: 'Number',
func: 'Function',
bool: 'Boolean',
nil: 'Null',
undef: 'Undefined',
date: 'Date',
function getMinutes(time: number): string {
const minutes = Math.floor(time / (60 * 1000)).toString();
return minutes.length > 1 ? minutes : '0' + minutes;
}
function getSeconds(time: number): string {
const seconds = Math.round((time % (60 * 1000)) / 1000).toString();
return seconds.length > 1 ? seconds : '0' + seconds;
}
/**
* Store part
*/
export interface IWithOrders extends IWithApplication, IWithConfig, IWithWidgetDictionaries {
orders: IOrdersState;
}
/**
* State
*/
// Компонент для отображения некой ширины и высоты
const DisplaySize = ({ title, width, height }) => (
<div>
<h4>{title}</h4>
<p>Width: {width}px</p>
<p>Height: {height}px</p>
</div>
);
// Компонент для отслеживания ширины и высоты окна
export enum constants {
SET = 'feature/SET',
}
export type actions = {
set: {
type: constants.SET;
};
}
export const constants = {
FETCH_REQUEST: 'FETCH_REQUEST',
FETCH_SUCCESS: 'FETCH_SUCCESS',
FETCH_FAILURE: 'FETCH_FAILURE'
}
const initialState = {
isFetching: false,
error: false,
data: null
const emptyCounterparties = [];
const emptyProducts = [];
/** Список банков */
export const getCounterparties = (state) => state.orders.data.counterparties;
/** Конкретный банк */
export const getCounterparty = (state, props) =>
state.orders.data.counterparties[props.bankId] || null;
export enum constants {
FETCH_REQUEST = 'module/FETCH_REQUEST',
FETCH_SUCCESS = 'module/FETCH_SUCCESS',
FETCH_FAILURE = 'module/FETCH_FAILURE'
}
interface IState {
isFetching: Readonly<boolean>;
isError: Readonly<boolean>;
data: Readonly<IApiResponse>;
/**
* Пример использования:
*
* const source = {
* name: 'Test',
* last_name: 'Test',
* phone: '123456789'
* };
*
* const dist = {