feat: кладовщик
Breaking Change
This commit is contained in:
@@ -72,7 +72,7 @@ public class ReportContract(IClientStorageContract clientStorage, ICurrencyStora
|
|||||||
return _baseWordBuilder
|
return _baseWordBuilder
|
||||||
.AddHeader("Клиенты по кредитным программам")
|
.AddHeader("Клиенты по кредитным программам")
|
||||||
.AddParagraph($"Сформировано на дату {DateTime.Now}")
|
.AddParagraph($"Сформировано на дату {DateTime.Now}")
|
||||||
.AddTable([25, 25, 25, 25], tableRows)
|
.AddTable([100, 100, 100, 100], tableRows)
|
||||||
.Build();
|
.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,7 +328,7 @@ public class ReportContract(IClientStorageContract clientStorage, ICurrencyStora
|
|||||||
return _baseWordBuilder
|
return _baseWordBuilder
|
||||||
.AddHeader("Вклады по кредитным программам")
|
.AddHeader("Вклады по кредитным программам")
|
||||||
.AddParagraph($"Сформировано на дату {DateTime.Now}")
|
.AddParagraph($"Сформировано на дату {DateTime.Now}")
|
||||||
.AddTable([25, 25, 25, 25], tableRows)
|
.AddTable([2000, 2000, 2000, 2000], tableRows)
|
||||||
.Build();
|
.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class MigraDocPdfBuilder : BasePdfBuilder
|
|||||||
// Добавляем столбцы с заданной шириной
|
// Добавляем столбцы с заданной шириной
|
||||||
foreach (var width in columnsWidths)
|
foreach (var width in columnsWidths)
|
||||||
{
|
{
|
||||||
var widthInCm = width / 28.35;
|
var widthInCm = width / 10.35;
|
||||||
var column = table.AddColumn(Unit.FromCentimeter(widthInCm));
|
var column = table.AddColumn(Unit.FromCentimeter(widthInCm));
|
||||||
column.Format.Alignment = ParagraphAlignment.Left;
|
column.Format.Alignment = ParagraphAlignment.Left;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,8 +143,14 @@ export const ReportViewer = ({
|
|||||||
return `${API_URL}/api/Report/SendReportDepositByCreditProgram`;
|
return `${API_URL}/api/Report/SendReportDepositByCreditProgram`;
|
||||||
case 'excel':
|
case 'excel':
|
||||||
return `${API_URL}/api/Report/SendExcelReportDepositByCreditProgram`;
|
return `${API_URL}/api/Report/SendExcelReportDepositByCreditProgram`;
|
||||||
case 'pdf':
|
case 'pdf': {
|
||||||
return `${API_URL}/api/Report/SendReportByCurrency`;
|
if (!fromDate || !toDate) {
|
||||||
|
throw new Error('Необходимо выбрать даты для PDF отчета');
|
||||||
|
}
|
||||||
|
const fromDateStr = format(fromDate, 'yyyy-MM-dd');
|
||||||
|
const toDateStr = format(toDate, 'yyyy-MM-dd');
|
||||||
|
return `${API_URL}/api/Report/SendReportByCurrency?fromDate=${fromDateStr}&toDate=${toDateStr}`;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
throw new Error('Выберите тип отчета');
|
throw new Error('Выберите тип отчета');
|
||||||
}
|
}
|
||||||
@@ -232,7 +238,15 @@ export const ReportViewer = ({
|
|||||||
const handleDownload = async () => {
|
const handleDownload = async () => {
|
||||||
try {
|
try {
|
||||||
let reportData = report;
|
let reportData = report;
|
||||||
if (!reportData) {
|
// Для PDF всегда делаем новый запрос с актуальными датами
|
||||||
|
if (selectedReport === 'pdf') {
|
||||||
|
if (!fromDate || !toDate) {
|
||||||
|
toast.error('Пожалуйста, выберите даты для PDF отчета');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
toast.loading('Загрузка отчета...');
|
||||||
|
reportData = await fetchReport();
|
||||||
|
} else if (!reportData) {
|
||||||
toast.loading('Загрузка отчета...');
|
toast.loading('Загрузка отчета...');
|
||||||
reportData = await fetchReport();
|
reportData = await fetchReport();
|
||||||
}
|
}
|
||||||
@@ -278,12 +292,6 @@ export const ReportViewer = ({
|
|||||||
body: values.body,
|
body: values.body,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Добавляем даты для PDF отчета
|
|
||||||
if (selectedReport === 'pdf' && fromDate && toDate) {
|
|
||||||
data.fromDate = format(fromDate, 'yyyy-MM-dd');
|
|
||||||
data.toDate = format(toDate, 'yyyy-MM-dd');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Отправляем запрос
|
// Отправляем запрос
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -316,9 +324,9 @@ export const ReportViewer = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Проверка, можно ли сгенерировать PDF отчет
|
// Проверка, можно ли сгенерировать/скачать/отправить PDF отчет
|
||||||
const isGenerateDisabled =
|
const isPdfActionDisabled =
|
||||||
isLoading || selectedReport !== 'pdf' || !fromDate || !toDate;
|
selectedReport === 'pdf' && (!fromDate || !toDate || isLoading);
|
||||||
|
|
||||||
// Отображение ошибки, если она есть
|
// Отображение ошибки, если она есть
|
||||||
const renderError = () => {
|
const renderError = () => {
|
||||||
@@ -344,7 +352,7 @@ export const ReportViewer = ({
|
|||||||
<div className="flex gap-4 mb-4">
|
<div className="flex gap-4 mb-4">
|
||||||
{/* Кнопка "Сгенерировать" только для PDF с выбранными датами */}
|
{/* Кнопка "Сгенерировать" только для PDF с выбранными датами */}
|
||||||
{selectedReport === 'pdf' && (
|
{selectedReport === 'pdf' && (
|
||||||
<Button onClick={handleGenerate} disabled={isGenerateDisabled}>
|
<Button onClick={handleGenerate} disabled={isPdfActionDisabled}>
|
||||||
{isLoading ? 'Загрузка...' : 'Сгенерировать'}
|
{isLoading ? 'Загрузка...' : 'Сгенерировать'}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
@@ -352,13 +360,16 @@ export const ReportViewer = ({
|
|||||||
{/* Кнопки "Скачать" и "Отправить" только когда выбран тип отчета */}
|
{/* Кнопки "Скачать" и "Отправить" только когда выбран тип отчета */}
|
||||||
{selectedReport && (
|
{selectedReport && (
|
||||||
<>
|
<>
|
||||||
<Button onClick={handleDownload} disabled={isLoading}>
|
<Button
|
||||||
|
onClick={handleDownload}
|
||||||
|
disabled={isPdfActionDisabled || isLoading}
|
||||||
|
>
|
||||||
{isLoading ? 'Загрузка...' : 'Скачать'}
|
{isLoading ? 'Загрузка...' : 'Скачать'}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setIsSendDialogOpen(true)}
|
onClick={() => setIsSendDialogOpen(true)}
|
||||||
disabled={isLoading}
|
disabled={isPdfActionDisabled || isLoading}
|
||||||
>
|
>
|
||||||
Отправить
|
Отправить
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ export const CreditPrograms = (): React.JSX.Element => {
|
|||||||
>();
|
>();
|
||||||
|
|
||||||
const handleAdd = (data: CreditProgramBindingModel) => {
|
const handleAdd = (data: CreditProgramBindingModel) => {
|
||||||
|
console.log('add', data);
|
||||||
createCreditProgram(data);
|
createCreditProgram(data);
|
||||||
setIsAddDialogOpen(false);
|
setIsAddDialogOpen(false);
|
||||||
};
|
};
|
||||||
@@ -104,6 +105,7 @@ export const CreditPrograms = (): React.JSX.Element => {
|
|||||||
...selectedItem,
|
...selectedItem,
|
||||||
...data,
|
...data,
|
||||||
});
|
});
|
||||||
|
console.log('edit', data);
|
||||||
setIsEditDialogOpen(false);
|
setIsEditDialogOpen(false);
|
||||||
setSelectedItem(undefined);
|
setSelectedItem(undefined);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ export const Currencies = (): React.JSX.Element => {
|
|||||||
>();
|
>();
|
||||||
|
|
||||||
const handleAdd = (data: CurrencyBindingModel) => {
|
const handleAdd = (data: CurrencyBindingModel) => {
|
||||||
|
console.log('add', data);
|
||||||
createCurrency(data);
|
createCurrency(data);
|
||||||
setIsAddDialogOpen(false);
|
setIsAddDialogOpen(false);
|
||||||
};
|
};
|
||||||
@@ -85,6 +86,7 @@ export const Currencies = (): React.JSX.Element => {
|
|||||||
...selectedItem,
|
...selectedItem,
|
||||||
...data,
|
...data,
|
||||||
});
|
});
|
||||||
|
console.log('edit', data);
|
||||||
setIsEditDialogOpen(false);
|
setIsEditDialogOpen(false);
|
||||||
setSelectedItem(undefined);
|
setSelectedItem(undefined);
|
||||||
}
|
}
|
||||||
@@ -132,6 +134,7 @@ export const Currencies = (): React.JSX.Element => {
|
|||||||
description="Добавьте новую валюту"
|
description="Добавьте новую валюту"
|
||||||
isOpen={isAddDialogOpen}
|
isOpen={isAddDialogOpen}
|
||||||
onClose={() => setIsAddDialogOpen(false)}
|
onClose={() => setIsAddDialogOpen(false)}
|
||||||
|
onSubmit={handleAdd}
|
||||||
>
|
>
|
||||||
<CurrencyFormAdd onSubmit={handleAdd} />
|
<CurrencyFormAdd onSubmit={handleAdd} />
|
||||||
</DialogForm>
|
</DialogForm>
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ function SidebarProvider({
|
|||||||
} as React.CSSProperties
|
} as React.CSSProperties
|
||||||
}
|
}
|
||||||
className={cn(
|
className={cn(
|
||||||
'group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-[500px] w-full',
|
'group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex h-[500px] w-[300px]',
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
Reference in New Issue
Block a user