fix update quotes list
This commit is contained in:
parent
530d1c1b0c
commit
0c1eb7329d
@ -4,7 +4,6 @@ import { openNotification } from 'client/Elements/Notification';
|
||||
import CrmService from 'client/services/CrmService';
|
||||
import { getUser } from 'client/tools/user';
|
||||
import { CRM_PROXY_URL } from 'core/constants/urls';
|
||||
import { unionBy } from 'lodash';
|
||||
import { toJS } from 'mobx';
|
||||
import CalculationStore, { calculationUrls } from '../..';
|
||||
import customValues from '../lib/customValues';
|
||||
@ -94,7 +93,7 @@ export default async () => {
|
||||
}
|
||||
CalculationStore.setValue('recalcWithRevision', false);
|
||||
let quotes = toJS(CalculationStore.options.selectQuote);
|
||||
quotes = unionBy([new_quote], quotes);
|
||||
quotes = [new_quote].concat(quotes);
|
||||
|
||||
const { quote: selected_quoteid } = CalculationStore.values;
|
||||
const {
|
||||
@ -114,7 +113,10 @@ export default async () => {
|
||||
});
|
||||
|
||||
if (updated_quote) {
|
||||
quotes = unionBy(quotes, [updated_quote], 'value');
|
||||
const qIndex = quotes.findIndex(
|
||||
quote => quote.quoteid === updated_quote.quoteid,
|
||||
);
|
||||
quotes.splice(qIndex, 1, updated_quote);
|
||||
}
|
||||
|
||||
CalculationStore.setOptions('selectQuote', quotes);
|
||||
|
||||
Reference in New Issue
Block a user