diff --git a/actions/contractActions.js b/actions/contractActions.js
index 4c4e87f..eb30140 100644
--- a/actions/contractActions.js
+++ b/actions/contractActions.js
@@ -397,11 +397,13 @@ export const getContractGraphicChangeSignatories = ({ dispatch, number }) =>
export const getContractGraphicChangeVariants = ({ dispatch, number, variants = {} }) =>
{
- console.log("ACTION", "getContractGraphicChangeVariants", { ...{ number }, ...variants });
+ console.log("ACTION", "getContractGraphicChangeVariants", { ...{ number }, ...{ variants: variants } });
return new Promise((resolve, reject) =>
{
- axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/variants`, { ...{ number }, ...variants },
+ console.log("{ ...{ number }, ...variants }", { ...{ number }, ...{ variants: variants } });
+
+ axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/variants`, { ...{ number }, ...{ variants: variants } },
{
withCredentials: true,
})
@@ -447,11 +449,31 @@ export const getContractGraphicChangeCalculationsList = ({ dispatch, number }) =
});
}
-export const getContractGraphicChangeOptions = ({ dispatch, number }) =>
+export const getContractGraphicChangeOptions = ({ dispatch, number, variants }) =>
{
+ console.log("ACTION", "getContractGraphicChangeOptions", { ...{ number }, ...variants });
+
return new Promise((resolve, reject) =>
{
- resolve();
+ console.log("{ ...{ number }, ...variants }", { ...{ number }, ...variants });
+
+ axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/change/options`, { ...{ number }, ...{ variants: variants } },
+ {
+ withCredentials: true,
+ })
+ .then(async (response) =>
+ {
+ console.log("ACTION", "getContractGraphicChangeOptions", "response.data", response.data);
+
+ dispatch({ type: actionTypes.CONTRACT_CHANGE, data: { options: response.data } });
+ resolve();
+ })
+ .catch((error) =>
+ {
+ console.error("ACTION", "getContractGraphicChangeOptions", "error");
+ console.error(error);
+ reject();
+ });
});
}
diff --git a/lib/CRMRequest/index.js b/lib/CRMRequest/index.js
index 080568a..8ec1288 100644
--- a/lib/CRMRequest/index.js
+++ b/lib/CRMRequest/index.js
@@ -5,6 +5,7 @@ import cookie from 'cookie';
import moment from 'moment';
import jwt from 'jsonwebtoken';
import { cors } from '../cors';
+import { inspect } from 'util';
export default async function CRMRequest(req, res, path, params)
{
@@ -44,7 +45,7 @@ export default async function CRMRequest(req, res, path, params)
.then((crm_response) =>
{
console.log("crm_response for", path);
- console.log(crm_response.data);
+ console.log(inspect(crm_response.data, true, null, true));
res.status(200).json(crm_response.data);
})
diff --git a/pages/api/contract/change/options.js b/pages/api/contract/change/options.js
new file mode 100644
index 0000000..997edb0
--- /dev/null
+++ b/pages/api/contract/change/options.js
@@ -0,0 +1,12 @@
+// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
+import CRMRequest from '../../../../lib/CRMRequest';
+
+export default async function handler(req, res)
+{
+ console.log("-".repeat(50));
+ console.log("API", "contract", "change", "options", "req.body.variants");
+ console.log(req.body.variants);
+ console.log("-".repeat(50));
+
+ await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetTypeOptions`, { ...{ contract_number: req.body.number }, ...req.body.variants });
+}
\ No newline at end of file
diff --git a/pages/api/contract/change/variants.js b/pages/api/contract/change/variants.js
index 3bb057e..1a7d0c6 100644
--- a/pages/api/contract/change/variants.js
+++ b/pages/api/contract/change/variants.js
@@ -3,5 +3,9 @@ import CRMRequest from '../../../../lib/CRMRequest';
export default async function handler(req, res)
{
+ console.log("req.body.variantsreq.body.variantsreq.body.variantsreq.body.variants");
+ console.log(req.body.variants);
+ console.log("-".repeat(50));
+
await CRMRequest(req, res, `${ process.env.CRM_API_HOST }/lk/add-contract/GetAvaliableGraphChangeTypes`, { ...{ contract_number: req.body.number }, ...req.body.variants });
}
\ No newline at end of file
diff --git a/pages/contract/change/components/CalculationsList/index.js b/pages/contract/change/components/CalculationsList/index.js
index 4d6f424..76c5ff1 100644
--- a/pages/contract/change/components/CalculationsList/index.js
+++ b/pages/contract/change/components/CalculationsList/index.js
@@ -59,21 +59,23 @@ export default class CalculationsList extends React.Component
const { number, calculations } = this.props;
+ console.log("\x1B[31m calculations \x1B[34m", calculations);
+
return (
- { calculations.map((calculation, index) =>
+ { calculations !== undefined && calculations !== null && calculations.map((calculation, index) =>
(
Расчет № { calculation.label }
- { calculation.date_offset_type_comment !== null && (<>{ calculation.date_offset_type_comment }
>) }
- { calculation.number_paydate_comment !== null && (<>{ calculation.number_paydate_comment }
>) }
- { calculation.insurance_price_result_comment !== null && (<>{ calculation.insurance_price_result_comment }
>) }
- { calculation.fix_last_payment_available_comment !== null && (<>{ calculation.fix_last_payment_available_comment }
>) }
- { calculation.period_new_comment !== null && (<>{ calculation.period_new_comment }
>) }
- { calculation.sum_comment !== null && (<>{ calculation.sum_comment }
>) }
+ { calculation.date_offset_type_comment !== null && (<>{ `${ calculation.date_offset_type_comment.label }: ${ calculation.date_offset_type_comment.value }` }
>) }
+ { calculation.number_paydate_comment !== null && (<>{ `${ calculation.number_paydate_comment.label }: ${ calculation.number_paydate_comment.value }` }
>) }
+ { calculation.insurance_price_result_comment !== null && (<>{ `${ calculation.insurance_price_result_comment.label }: ${ calculation.insurance_price_result_comment.value } ` }
>) }
+ { calculation.fix_last_payment_available_comment !== null && (<>{ `${ calculation.fix_last_payment_available_comment.label }: ${ calculation.fix_last_payment_available_comment.value ? "да" : "нет" }` }
>) }
+ { calculation.period_new_comment !== null && (<>{ `${ calculation.period_new_comment.label }: ${ calculation.period_new_comment.value }` }
>) }
+ { calculation.sum_comment !== null && (<>{ `${ calculation.sum_comment.label }: ${ calculation.sum_comment.value }` }
>) }
this._handle_onCalculation(calculation.addcontract_number) }>Подробнее
diff --git a/pages/contract/change/components/Comparison/index.js b/pages/contract/change/components/Comparison/index.js
index d5c46f6..27b758a 100644
--- a/pages/contract/change/components/Comparison/index.js
+++ b/pages/contract/change/components/Comparison/index.js
@@ -110,42 +110,34 @@ export default class Comparison extends React.Component
{ calculation !== undefined && calculation !== null && calculation.fix_last_payment_available_comment !== null && (
-
-
+
+
) }
{ calculation !== undefined && calculation !== null && calculation.date_offset_type_comment !== null && (
-
-
+
+
) }
{ calculation !== undefined && calculation !== null && calculation.insurance_price_result_comment !== null && (
-
- { calculation.insurance_price_result_comment }
-
+
{ calculation.insurance_price_result_comment.label }: { calculation.insurance_price_result_comment.value }
) }
{ calculation !== undefined && calculation !== null && calculation.number_paydate_comment !== null && (
-
- { calculation.number_paydate_comment }
-
+
{ calculation.number_paydate_comment.label }: { calculation.number_paydate_comment.value }
) }
{ calculation !== undefined && calculation !== null && calculation.period_new_comment !== null && (
-
- { calculation.period_new_comment }
-
+
{ calculation.period_new_comment.label }: { calculation.period_new_comment.value }
) }
{ calculation !== undefined && calculation !== null && calculation.sum_comment !== null && (
-
- { calculation.sum_comment }
-
+
{ calculation.sum_comment.label }: { calculation.sum_comment.value }
) }
{/*}
diff --git a/pages/contract/change/components/Options/index.js b/pages/contract/change/components/Options/index.js
index 7bc2d1d..352051d 100644
--- a/pages/contract/change/components/Options/index.js
+++ b/pages/contract/change/components/Options/index.js
@@ -1,4 +1,5 @@
import React from "react";
+import { getContractGraphicChangeOptions } from "../../../../../actions";
import DateInput from "../../../../components/DatePicker";
export default class Options extends React.Component
@@ -12,12 +13,34 @@ export default class Options extends React.Component
contract_date: null,
agreement: null,
rules: null,
- loading: false,
+ loading: true,
};
}
componentDidMount()
{
+ const { dispatch, number, variants } = this.props;
+
+ const varianst_for_options = {};
+ for(let i in variants.types)
+ {
+ if(variants.types[i].value)
+ {
+ varianst_for_options[variants.types[i].name] = true;
+ }
+ }
+
+ console.log("varianst_for_options", varianst_for_options);
+
+ getContractGraphicChangeOptions({ dispatch, number, variants: varianst_for_options })
+ .then(() =>
+ {
+
+ })
+ .catch(() =>
+ {
+
+ });
}
_handle_onBack = (event) =>
@@ -35,7 +58,9 @@ export default class Options extends React.Component
render()
{
const { loading, date, car, contract_date, agreement, rules } = this.state;
- const { number } = this.props;
+ const { variants } = this.props;
+
+ console.log("Change", "Options", "render()", "variants", variants);
return (
diff --git a/pages/contract/change/components/VariantsList/index.js b/pages/contract/change/components/VariantsList/index.js
index 314a2af..3fc5686 100644
--- a/pages/contract/change/components/VariantsList/index.js
+++ b/pages/contract/change/components/VariantsList/index.js
@@ -45,6 +45,11 @@ export default class VariantsList extends React.Component
return false;
}
+ _handle_onOptions = () =>
+ {
+ this.props.onOptions();
+ }
+
render()
{
const { number, variants_types, selected, blocked, loading } = this.props;
@@ -53,7 +58,7 @@ export default class VariantsList extends React.Component
Варианты изменения графиков
-
)
}) }
-
+
{ loading && (
diff --git a/pages/contract/change/index.js b/pages/contract/change/index.js
index 1fcff26..4353790 100644
--- a/pages/contract/change/index.js
+++ b/pages/contract/change/index.js
@@ -219,6 +219,9 @@ class ChangeGraphicPage extends React.Component
}
}
+ console.log("variantsvariantsvariantsvariantsvariants???????????");
+ console.log(variants);
+
getContractGraphicChangeVariants({ dispatch: this.props.dispatch, number: this.props.number, variants })
.then(() =>
{
@@ -323,7 +326,14 @@ class ChangeGraphicPage extends React.Component
{ mode_options ? (
-
+
) : (
<>
{ variants !== null && (
diff --git a/pages/support/appeals.js b/pages/support/appeals.js
index 7f26e30..4b0c535 100644
--- a/pages/support/appeals.js
+++ b/pages/support/appeals.js
@@ -135,7 +135,9 @@ class SupportAppealsPage extends React.Component
Номер обращения: { appeal.number } от { moment(appeal.created_date, "YYYY-MM-DD").format("DD.MM.YYYY") }
Отвественный ОРК: { appeal.owner }
-
Договор(ы): { appeal.contracts }
+ { appeal.contracts.length > 0 && (
+
Договор{ appeal.contracts.length > 1 && "ы" }: { appeal.contracts.map((contract, contract_index) => (№ { contract }{ contract_index < appeal.contracts.length - 1 && ", " })) }
+ ) }
{ status[appeal.status].title }