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