fix paging bug
This commit is contained in:
@@ -125,17 +125,6 @@ class SingleIncidentsTable extends Component {
|
|||||||
inputIdToFocus
|
inputIdToFocus
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
const changedIncidentsProxy = {
|
|
||||||
[UNLOCKED_INCIDENT_RELATED_WITH_RESERVATION]: changedUnlockedIncidentIds,
|
|
||||||
[UNLOCKED_INCIDENT_STANDALONE]: changedUnlockedIncidentIds,
|
|
||||||
[UNSCHEDULED_INCIDENT_BEFORE_RESERVATION]: changedUnscheduledIncidentIds,
|
|
||||||
[UNSCHEDULED_INCIDENT_AFTER_RESERVATION]: changedUnscheduledIncidentIds,
|
|
||||||
[UNSCHEDULED_INCIDENT_STANDALONE]: changedUnscheduledIncidentIds,
|
|
||||||
[BOOKING_SHORTENED]: changedBookingChangeIncidentIds,
|
|
||||||
[BOOKING_MOVED_TO_ANOTHER_DAY]: changedBookingChangeIncidentIds,
|
|
||||||
[BOOKING_CANCELED_LATE]: changedBookingChangeIncidentIds
|
|
||||||
};
|
|
||||||
|
|
||||||
const totalSelected = selectedUnlockedIncidentIds.length + selectedUnscheduledIncidentIds.length + selectedBookingChangeIncidentIds.length;
|
const totalSelected = selectedUnlockedIncidentIds.length + selectedUnscheduledIncidentIds.length + selectedBookingChangeIncidentIds.length;
|
||||||
const numberOfSelectedText = totalSelected > 0 ? ` (${totalSelected})` : '';
|
const numberOfSelectedText = totalSelected > 0 ? ` (${totalSelected})` : '';
|
||||||
|
|
||||||
@@ -175,7 +164,7 @@ class SingleIncidentsTable extends Component {
|
|||||||
const incidentType = parseInt(incidentData[0]) || null;
|
const incidentType = parseInt(incidentData[0]) || null;
|
||||||
const incidentID = parseInt(incidentData[1]) || null;
|
const incidentID = parseInt(incidentData[1]) || null;
|
||||||
|
|
||||||
if ((newValueFloat || (newValueFloat === 0)) && incidentType && incidentID){
|
if ((newValueFloat || (newValueFloat === 0) || (isNaN(newValueFloat))) && incidentType && incidentID){
|
||||||
const changedUnlockedIncidentIdsCopy = Object.assign({}, changedUnlockedIncidentIds);
|
const changedUnlockedIncidentIdsCopy = Object.assign({}, changedUnlockedIncidentIds);
|
||||||
const changedUnscheduledIncidentIdsCopy = Object.assign({}, changedUnscheduledIncidentIds);
|
const changedUnscheduledIncidentIdsCopy = Object.assign({}, changedUnscheduledIncidentIds);
|
||||||
const changedBookingChangeIncidentIdsCopy = Object.assign({}, changedBookingChangeIncidentIds);
|
const changedBookingChangeIncidentIdsCopy = Object.assign({}, changedBookingChangeIncidentIds);
|
||||||
@@ -287,11 +276,36 @@ class SingleIncidentsTable extends Component {
|
|||||||
case 'totalChargeFee':
|
case 'totalChargeFee':
|
||||||
clickablePrice = true;
|
clickablePrice = true;
|
||||||
let totalFee = 0;
|
let totalFee = 0;
|
||||||
const changedFee = changedIncidentsProxy[props.row['_original'].incidentType][props.row['_original'].incidentId];
|
|
||||||
if (changedFee || (changedFee === 0)){
|
let changedIncidentsProxy;
|
||||||
totalFee = changedFee;
|
switch (props.row['_original'].incidentType) {
|
||||||
priceFontColor = 'red';
|
case UNLOCKED_INCIDENT_STANDALONE:
|
||||||
|
case UNLOCKED_INCIDENT_RELATED_WITH_RESERVATION:
|
||||||
|
changedIncidentsProxy = changedUnlockedIncidentIds;
|
||||||
|
break;
|
||||||
|
case UNSCHEDULED_INCIDENT_STANDALONE:
|
||||||
|
case UNSCHEDULED_INCIDENT_BEFORE_RESERVATION:
|
||||||
|
case UNSCHEDULED_INCIDENT_AFTER_RESERVATION:
|
||||||
|
changedIncidentsProxy = changedUnscheduledIncidentIds;
|
||||||
|
break;
|
||||||
|
case BOOKING_CANCELED_LATE:
|
||||||
|
case BOOKING_MOVED_TO_ANOTHER_DAY:
|
||||||
|
case BOOKING_SHORTENED:
|
||||||
|
changedIncidentsProxy = changedBookingChangeIncidentIds;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const changedFee = changedIncidentsProxy[props.row['_original'].incidentId];
|
||||||
|
|
||||||
|
if (typeof changedFee === 'number'){
|
||||||
|
// Not undefined, maybe 0 or NaN
|
||||||
|
if (isNaN(changedFee)){
|
||||||
|
totalFee = '';
|
||||||
|
}else{
|
||||||
|
totalFee = changedFee;
|
||||||
|
priceFontColor = 'red';
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
|
//Not defined, in this context means it is not changed
|
||||||
totalFee = parseFloat((props.row['_original'].incidentPrice || props.value) || 0).toFixed(2);
|
totalFee = parseFloat((props.row['_original'].incidentPrice || props.value) || 0).toFixed(2);
|
||||||
}
|
}
|
||||||
// const totalFeeFormatted = parseFloat(totalFee).toFixed(2);
|
// const totalFeeFormatted = parseFloat(totalFee).toFixed(2);
|
||||||
@@ -320,7 +334,7 @@ class SingleIncidentsTable extends Component {
|
|||||||
style={{ color: priceFontColor }}
|
style={{ color: priceFontColor }}
|
||||||
type={'number'}
|
type={'number'}
|
||||||
onChange={priceChangeHandler}
|
onChange={priceChangeHandler}
|
||||||
defaultValue={priceAsNumber}
|
value={priceAsNumber}
|
||||||
autoFocus={priceInputID === inputIdToFocus}
|
autoFocus={priceInputID === inputIdToFocus}
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user