Skip to content

Commit

Permalink
Merge pull request #649 from it-at-m/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
manjencic authored Oct 22, 2024
2 parents bc2dac9 + e6088f8 commit 288b98f
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 19 deletions.
5 changes: 3 additions & 2 deletions zmsadmin/js/page/availabilityDay/form/formButtons.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const FormButtons = (props) => {
className="button button--diamond" disabled={disabled || data.startDate == selectedDate}>Ab diesem Tag ändern</button>
<button onClick={onUpdateSingle}
title="Öffnungszeit aktualisieren"
className="button button--diamond" disabled={(data && !data.id) || hasConflicts}>Aktualisieren</button>
className="button button--diamond" disabled={(data && !data.id) || hasConflicts || props.isCreatingExclusion}>Aktualisieren</button>
</div>
</div>
)
Expand All @@ -35,7 +35,8 @@ FormButtons.propTypes = {
onEditInFuture: PropTypes.func,
onDelete: PropTypes.func,
onUpdateSingle: PropTypes.func,
selectedDate: PropTypes.number
selectedDate: PropTypes.number,
isCreatingExclusion: PropTypes.bool
}

export default FormButtons
4 changes: 3 additions & 1 deletion zmsadmin/js/page/availabilityDay/form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class AvailabilityForm extends Component {
onUpdateSingle={this.props.onUpdateSingle}
selectedDate={this.props.selectedDate}
hasConflicts={hasConflicts}
isCreatingExclusion={this.props.isCreatingExclusion}
/>}
</div>
)
Expand Down Expand Up @@ -91,7 +92,8 @@ AvailabilityForm.propTypes = {
onEditInFuture: PropTypes.func,
setErrorRef: PropTypes.func,
onDelete: PropTypes.func,
onUpdateSingle: PropTypes.func
onUpdateSingle: PropTypes.func,
isCreatingExclusion: PropTypes.bool
}

export default AvailabilityForm
17 changes: 13 additions & 4 deletions zmsadmin/js/page/availabilityDay/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class AvailabilityPage extends Component {
this.waitintervall = 1000;
this.errorElement = null;
this.successElement = null;
this.isCreatingExclusion = false
this.setErrorRef = element => {
this.errorElement = element
};
Expand Down Expand Up @@ -152,6 +153,7 @@ class AvailabilityPage extends Component {


onRevertUpdates() {
this.isCreatingExclusion = false
this.setState(Object.assign({}, getInitialState(this.props), {
selectedTab: this.state.selectedTab
}), () => {
Expand Down Expand Up @@ -292,10 +294,16 @@ class AvailabilityPage extends Component {
const yesterday = selectedDay.clone().subtract(1, 'days')
const tomorrow = selectedDay.clone().add(1, 'days')

this.isCreatingExclusion = true;

let endDateTimestamp = (parseInt(yesterday.unix(), 10) < availability.startDate) ?
parseInt(selectedDay.unix(), 10) :
parseInt(yesterday.unix(), 10);

let name = availability.description;
name = name.replaceAll('Ausnahme zu Terminserie ', '');
name = name.replaceAll('Fortführung der Terminserie ', '');

const originAvailability = this.editExclusionAvailability(
Object.assign({}, availability),
null,
Expand All @@ -304,10 +312,11 @@ class AvailabilityPage extends Component {
'origin'
)

if (availability.startDate === selectedDay.unix()) {
originAvailability.description = `Ausnahme zu Terminserie ` + name;
}

let exclusionAvailability = originAvailability;
let name = availability.description;
name = name.replaceAll('Ausnahme zu Terminserie ', '');
name = name.replaceAll('Fortführung der Terminserie ', '');
if (originAvailability.startDate < selectedDay.unix()) {
exclusionAvailability = this.editExclusionAvailability(
Object.assign({}, availability),
Expand All @@ -317,7 +326,6 @@ class AvailabilityPage extends Component {
'exclusion'
)
}


let futureAvailability = originAvailability;
if (parseInt(tomorrow.unix(), 10) <= availability.endDate) {
Expand Down Expand Up @@ -725,6 +733,7 @@ class AvailabilityPage extends Component {
this.state.conflictList :
{itemList: {}, conflictIdList: {}}
}
isCreatingExclusion={this.isCreatingExclusion}
/>
}

Expand Down
4 changes: 3 additions & 1 deletion zmsadmin/js/page/availabilityDay/layouts/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class Accordion extends Component
onDelete={onDelete}
errorList={hasError(eventId) ? errorList : {}}
conflictList={hasConflict(eventId) ? Object.assign({}, conflictList): {}}
isCreatingExclusion={this.props.isCreatingExclusion}
/>
</div>
</section>
Expand Down Expand Up @@ -183,7 +184,8 @@ Accordion.propTypes = {
onEditInFuture: PropTypes.func,
setErrorRef: PropTypes.func,
stateChanged: PropTypes.bool,
errorElement: PropTypes.element
errorElement: PropTypes.element,
isCreatingExclusion: PropTypes.bool
}

export default Accordion
20 changes: 10 additions & 10 deletions zmsadmin/public/_js/reactcomponents.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion zmsadmin/public/_js/reactcomponents.js.map

Large diffs are not rendered by default.

0 comments on commit 288b98f

Please sign in to comment.