update for contract invoices

This commit is contained in:
merelendor 2023-11-03 17:14:01 +03:00
parent 43e9a22697
commit 387295b357
9 changed files with 136 additions and 61 deletions

View File

@ -33,6 +33,8 @@ export const getDeals = ({ dispatch, update = false }) =>
return new Promise((resolve, reject) => return new Promise((resolve, reject) =>
{ {
let last = 0;
axios.post(url, {}, { axios.post(url, {}, {
withCredentials: true, withCredentials: true,
}) })
@ -40,23 +42,21 @@ export const getDeals = ({ dispatch, update = false }) =>
{ {
console.log("ACTION", "deals", "getDeals()", "response", response.data); console.log("ACTION", "deals", "getDeals()", "response", response.data);
/* for(let i in response.data)
if(update)
{ {
for(let i in response.data) const n = parseInt(response.data[i].opp_number, 10);
if(n > last)
{ {
if(response.data[i].opp_number == "20325") last = n;
{
response.data[i].statuscode_id = 101;
}
} }
} }
*/
dispatch({ dispatch({
type: actionTypes.DEALS_LIST, type: actionTypes.DEALS_LIST,
data: { data: {
list: response.data list: response.data,
last,
} }
}); });
@ -73,7 +73,8 @@ export const getDeals = ({ dispatch, update = false }) =>
dispatch({ dispatch({
type: actionTypes.DEALS_LIST, type: actionTypes.DEALS_LIST,
data: { data: {
list: [] list: [],
last,
} }
}); });

View File

@ -71,36 +71,42 @@ export const downloadInvoiceFile = ({ payload, filename }) =>
export const getInvoiceKASKO = ({ number }) => export const getInvoiceKASKO = ({ number }) =>
{ {
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/invoice/kasko`, { number }, return new Promise((resolve, reject) =>
{ {
withCredentials: true, axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/invoice/kasko`, { number },
}) {
.then(async (response) => withCredentials: true,
{ })
console.log("getInvoiceKASKO", { response: response.data }); .then(async (response) =>
resolve(); {
}) console.log("getInvoiceKASKO", { response: response.data });
.catch((error) => resolve(response.data);
{ })
console.error(error); .catch((error) =>
reject(); {
console.error(error);
reject();
});
}); });
} }
export const getInvoiceFinGap = ({ number }) => export const getInvoiceFinGap = ({ number }) =>
{ {
axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/invoice/fingap`, { number }, return new Promise((resolve, reject) =>
{ {
withCredentials: true, axios.post(`${ process.env.NEXT_PUBLIC_SELF_API_HOST }/api/contract/invoice/fingap`, { number },
}) {
.then(async (response) => withCredentials: true,
{ })
console.log("getInvoiceFinGap", { response: response.data }); .then(async (response) =>
resolve(); {
}) console.log("getInvoiceFinGap", { response: response.data });
.catch((error) => resolve(response.data);
{ })
console.error(error); .catch((error) =>
reject(); {
console.error(error);
reject();
});
}); });
} }

View File

@ -30,11 +30,11 @@ class QuestionnaireForm extends React.Component
_handle_onCreateQuestionnaire = (event) => _handle_onCreateQuestionnaire = (event) =>
{ {
event.preventDefault(); event.preventDefault();
const { onQuestionnaire, deal_id } = this.props; const { onQuestionnaire, deal_id, last_deal_id } = this.props;
this.setState({ loading: true, }, () => this.setState({ loading: true, }, () =>
{ {
createQuestionnaire(deal_id) createQuestionnaire(last_deal_id)
.then(() => .then(() =>
{ {
onQuestionnaire(); onQuestionnaire();
@ -315,6 +315,8 @@ export default class DocumentsForm extends Step
const { index, statuscode_id, dealSelected, documents, questionnaire_status, onQuestionnaire, } = this.props; const { index, statuscode_id, dealSelected, documents, questionnaire_status, onQuestionnaire, } = this.props;
const { open, uploaded, uploading, loading, completed } = this.state; const { open, uploaded, uploading, loading, completed } = this.state;
console.log("DocumentsForm", "render", { props: this.props });
return ( return (
<div className={`${ this.status === statuscode_id ? "current" : statuscode_id > this.status ? "done" : "" }`}> <div className={`${ this.status === statuscode_id ? "current" : statuscode_id > this.status ? "done" : "" }`}>
<p> { dealSelected }</p> <p> { dealSelected }</p>
@ -337,6 +339,7 @@ export default class DocumentsForm extends Step
questionnaire_status={ questionnaire_status } questionnaire_status={ questionnaire_status }
onQuestionnaire={ onQuestionnaire } onQuestionnaire={ onQuestionnaire }
deal_id={ dealSelected } deal_id={ dealSelected }
last_deal_id={ this.props.deals.last }
/> />
</div> </div>
</div> </div>

View File

@ -16,6 +16,7 @@ class DealsStatus extends React.Component
currentSelected: null, currentSelected: null,
dealSelected: undefined, dealSelected: undefined,
deals: undefined, deals: undefined,
lastDealNumber: 0,
} }
} }
@ -32,7 +33,17 @@ class DealsStatus extends React.Component
getDeals({ dispatch }); getDeals({ dispatch });
} }
componentDidUpdate(prevProps, prevState) { } componentDidUpdate(prevProps, prevState)
{
if(prevState.deals.list === null && this.state.deals.list !== null)
{
let lastDealNumber = 0;
for(let i in this.state.deals.list)
{
console.log("DealsStatus", this.state.deals.list[i]);
}
}
}
_onDealsUpdate = () => _onDealsUpdate = () =>
{ {
@ -102,6 +113,8 @@ class DealsStatus extends React.Component
const { currentContractModalOpened, allContractModalOpened, currentSelected, dealSelected, deals, status, } = this.state const { currentContractModalOpened, allContractModalOpened, currentSelected, dealSelected, deals, status, } = this.state
const { questionnaire_status, onQuestionnaire, } = this.props; const { questionnaire_status, onQuestionnaire, } = this.props;
console.log("render", { deals });
return ( return (
<> <>
{ deals.list !== undefined && deals.list !== null && deals.list.length > 0 && ( { deals.list !== undefined && deals.list !== null && deals.list.length > 0 && (

View File

@ -7155,14 +7155,11 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
display: flex; display: flex;
gap: 40px 20px; gap: 40px 20px;
flex-wrap: wrap; flex-wrap: wrap;
padding-bottom: 40px;
} }
.contract_invoices_list .invoice { .contract_invoices_list .invoice {
max-width: 23%; max-width: 23%;
width: 23%; width: 23%;
min-height: 90px; min-height: 85px;
border-bottom: solid 1px var(--gray-light);
border-left: solid 1px var(--gray-light);
padding-bottom: 10px; padding-bottom: 10px;
align-items: flex-start; align-items: flex-start;
justify-content: space-between; justify-content: space-between;
@ -7189,7 +7186,7 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
} }
.contract_invoices_list .invoice p { .contract_invoices_list .invoice p {
line-height: 15px; line-height: 15px;
color: var(--text_not_active); color: var(--gray);
} }
@media all and (max-width: 1280px) { @media all and (max-width: 1280px) {
.contract_invoices_list .invoice p { .contract_invoices_list .invoice p {
@ -7202,7 +7199,6 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
align-items: flex-start; align-items: flex-start;
justify-content: flex-start; justify-content: flex-start;
width: 100%; width: 100%;
padding-left: 10px;
} }
.contract_invoices_list .invoice .actions .icon { .contract_invoices_list .invoice .actions .icon {
margin-top: 5px; margin-top: 5px;
@ -7219,6 +7215,9 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block .block_body .fines_
padding: 0; padding: 0;
zoom: 0.65; zoom: 0.65;
} }
.contract_invoices_list .invoice .actions .icon.formal {
background-image: url("data:image/svg+xml,%3Csvg width='26' height='28' viewBox='0 0 26 28' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 3.5C2 1.84315 3.34315 0.5 5 0.5H18.3701L20.7774 4L23.1848 7.06354V24.5C23.1848 26.1569 21.8417 27.5 20.1848 27.5H5C3.34314 27.5 2 26.1569 2 24.5V3.5Z' fill='%231C01A9'/%3E%3Cpath opacity='0.4' d='M23.1858 11.5V7L19.334 6.5L23.1858 11.5Z' fill='%230C0C0C'/%3E%3Cline y1='-0.5' x2='11.5553' y2='-0.5' transform='matrix(1 -9.89866e-05 0.000132759 1 6.81445 7.50098)' stroke='%23F0F0F0'/%3E%3Cline y1='-0.5' x2='11.5553' y2='-0.5' transform='matrix(1 -9.89866e-05 0.000132759 1 6.81445 12.501)' stroke='%23F0F0F0'/%3E%3Cline y1='-0.5' x2='11.5553' y2='-0.5' transform='matrix(1 -9.89866e-05 0.000132759 1 6.81445 17.501)' stroke='%23F0F0F0'/%3E%3Cline y1='-0.5' x2='11.5553' y2='-0.5' transform='matrix(1 -9.89866e-05 0.000132759 1 6.81445 22.501)' stroke='%23F0F0F0'/%3E%3Cpath d='M23.1858 7H19.3711C18.8188 7 18.3711 6.55228 18.3711 6V3.5V0.5L23.1858 7Z' fill='%232F80ED'/%3E%3C/svg%3E");
}
.contract_invoices_list .invoice .actions .icon .extension { .contract_invoices_list .invoice .actions .icon .extension {
font-weight: 600; font-weight: 600;
font-size: 12px; font-size: 12px;

View File

@ -8189,14 +8189,14 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
display: flex; display: flex;
gap: 40px 20px; gap: 40px 20px;
flex-wrap: wrap; flex-wrap: wrap;
padding-bottom: 40px; // padding-bottom: 40px;
.invoice { .invoice {
max-width: 23%; max-width: 23%;
width: 23%; width: 23%;
min-height: 90px; min-height: 85px;
border-bottom: solid 1px var(--gray-light); //border-bottom: solid 1px var(--gray-light);
border-left: solid 1px var(--gray-light); //border-left: solid 1px var(--gray-light);
padding-bottom: 10px; padding-bottom: 10px;
align-items: flex-start; align-items: flex-start;
@ -8221,7 +8221,7 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
p { p {
line-height: 15px; line-height: 15px;
color: var(--text_not_active); color: var(--gray);
@media all and (max-width: 1280px) { @media all and (max-width: 1280px) {
font-size: 13px; font-size: 13px;
@ -8234,7 +8234,7 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
align-items: flex-start; align-items: flex-start;
justify-content: flex-start; justify-content: flex-start;
width: 100%; width: 100%;
padding-left: 10px; //padding-left: 10px;
.icon { .icon {
margin-top: 5px; margin-top: 5px;
@ -8251,6 +8251,10 @@ main .dropdown_blocks_list.zero-margin.gibdd .dropdown_block {
padding: 0; padding: 0;
zoom: 0.65; zoom: 0.65;
&.formal {
background-image: url("data:image/svg+xml,%3Csvg width='26' height='28' viewBox='0 0 26 28' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 3.5C2 1.84315 3.34315 0.5 5 0.5H18.3701L20.7774 4L23.1848 7.06354V24.5C23.1848 26.1569 21.8417 27.5 20.1848 27.5H5C3.34314 27.5 2 26.1569 2 24.5V3.5Z' fill='%231C01A9'/%3E%3Cpath opacity='0.4' d='M23.1858 11.5V7L19.334 6.5L23.1858 11.5Z' fill='%230C0C0C'/%3E%3Cline y1='-0.5' x2='11.5553' y2='-0.5' transform='matrix(1 -9.89866e-05 0.000132759 1 6.81445 7.50098)' stroke='%23F0F0F0'/%3E%3Cline y1='-0.5' x2='11.5553' y2='-0.5' transform='matrix(1 -9.89866e-05 0.000132759 1 6.81445 12.501)' stroke='%23F0F0F0'/%3E%3Cline y1='-0.5' x2='11.5553' y2='-0.5' transform='matrix(1 -9.89866e-05 0.000132759 1 6.81445 17.501)' stroke='%23F0F0F0'/%3E%3Cline y1='-0.5' x2='11.5553' y2='-0.5' transform='matrix(1 -9.89866e-05 0.000132759 1 6.81445 22.501)' stroke='%23F0F0F0'/%3E%3Cpath d='M23.1858 7H19.3711C18.8188 7 18.3711 6.55228 18.3711 6V3.5V0.5L23.1858 7Z' fill='%232F80ED'/%3E%3C/svg%3E");
}
.extension { .extension {
font-weight: 600; font-weight: 600;
font-size: 12px; font-size: 12px;

View File

@ -14,7 +14,7 @@ import Footer from '../components/Footer';
import Company from "../components/Company"; import Company from "../components/Company";
import InnerMenu from "./components/InnerMenu"; import InnerMenu from "./components/InnerMenu";
import { downloadInvoiceFile, getContract, getContractDebtInvoiceFile, getContractInfo, getContractInvoices, getContractPenaltyInvoiceFile, signGetGUIDEntity, signGetWMDoc } from './../../actions'; import { downloadInvoiceFile, getContract, getContractDebtInvoiceFile, getContractInfo, getContractInvoices, getContractPenaltyInvoiceFile, getFile, getInvoiceFinGap, getInvoiceKASKO, signGetGUIDEntity, signGetWMDoc } from './../../actions';
import AccountLayout from "../components/Layout/Account"; import AccountLayout from "../components/Layout/Account";
import ContractHeader from "./components/ContractHeader"; import ContractHeader from "./components/ContractHeader";
@ -38,12 +38,64 @@ class Invoice extends React.Component
{ {
case "kaskoProlong": case "kaskoProlong":
{ {
getInvoiceKASKO({ number: contract_number })
.then(async (document_result) =>
{
let document = undefined;
console.log({ document_result });
for(let i in document_result)
{
if(document_result[i].period_type === "prolong")
{
document = document_result[i];
break;
}
}
if(document !== undefined)
{
await getFile({ id: document.invoice_url, filename: `ЛК ЭВОЛЮЦИЯ - договор ${ contract_number } - ${ group.title }.${ document.invoice_extension }` });
}
this.setState({ loading: false });
})
.catch((document_result_error) =>
{
console.error({ document_result_error });
this.setState({ loading: false });
});
} }
break; break;
case "fingapProlong": case "fingapProlong":
{ {
getInvoiceFinGap({ number: contract_number })
.then(async (document_result) =>
{
let document = undefined;
console.log({ document_result });
for(let i in document_result)
{
if(document_result[i].period_type === "prolong")
{
document = document_result[i];
break;
}
}
console.log({ document });
if(document !== undefined)
{
await getFile({ id: document.invoice_url, filename: `ЛК ЭВОЛЮЦИЯ - договор ${ contract_number } - ${ group.title }.${ document.invoice_extension }` });
}
this.setState({ loading: false });
})
.catch((document_result_error) =>
{
console.error({ document_result_error });
this.setState({ loading: false });
});
} }
break; break;
@ -51,12 +103,12 @@ class Invoice extends React.Component
{ {
const guid_result = await signGetGUIDEntity({ contract_number }); const guid_result = await signGetGUIDEntity({ contract_number });
console.log({ guid_result, code: group.code }); console.log({ guid_result, code: group.code });
await downloadInvoiceFile({ payload: { entity_id: guid_result.entityid, code: group.code }, filename: `ЛК Эволюция - договор ${ contract_number } - ${ group.title }.pdf` }); await downloadInvoiceFile({ payload: { entity_id: guid_result.entityid, code: group.code }, filename: `ЛК ЭВОЛЮЦИЯ - договор ${ contract_number } - ${ group.title }.pdf` });
this.setState({ loading: false });
} }
break; break;
} }
this.setState({ loading: false });
}); });
} }
@ -73,8 +125,7 @@ class Invoice extends React.Component
<div className="invoice"> <div className="invoice">
<p>{ group.title }</p> <p>{ group.title }</p>
<div className="actions"> <div className="actions">
<div className="icon"> <div className="icon formal">
<span className="extension">PDF</span>
</div> </div>
<div className="download"> <div className="download">
{ loading ? ( { loading ? (

View File

@ -18,14 +18,11 @@ const dealsReducer = (state = initialState.deals, action) =>
case actionTypes.DEALS_LIST: case actionTypes.DEALS_LIST:
{ {
console.log("actionTypes.DEALS_LIST", actionTypes.DEALS_LIST, { action }); console.log("actionTypes.DEALS_LIST", actionTypes.DEALS_LIST, { action });
console.log({
...state,
list: action.data.list,
});
return { return {
...state, ...state,
list: action.data.list, list: action.data.list,
last: action.data.last,
}; };
} }

View File

@ -239,6 +239,7 @@ export const defaultState = {
{ {
loaded: false, loaded: false,
list: null, list: null,
last: 0,
details: {}, details: {},
/*{ /*{
loaded: false, loaded: false,