Appointments Module: Add Service A to several Locations

Hello everyone,

It was noticed that when adding a Service under Appointments we cannot choose several Locations for this service, only one:

image

And when it was tried to create a new service, with same Name, for a different location, we have an error message because service name is unique:

image

I think maybe this is something that would be nice to discuss with you, because it can be normal to have the same service to different Locations on the same area (ZW for instance).

Do you think is a good ideia to schedule a meeting to check it together? Thanks!

cc: @mksd

Here where the service name validation is being done.

$scope.validateServiceName = function () {
	$scope.createServiceForm.name.$setValidity('uniqueServiceName', 
isServiceNameUnique($scope.service));
};

var isServiceNameUnique = function (service) {
	if (!service.name) {
		return true;
	}
	return !$scope.services.some(function (existingService) {
		var isConflictingName = existingService.name.toLowerCase() === service.name.toLowerCase();
		return service.uuid ? isConflictingName && (service.uuid !== existingService.uuid) : isConflictingName;
	});
};

Thanks @ifernandes for raising this.

Also, whatever the business needs was at the time of this choice, this validation should not have been done in JavaScript IMO, a Java validator should have been introduced.

Getting back to the business flow, this is problematic:

<class name="AppointmentServiceDefinition" .. >

  <many-to-one name="location" .. />

Why could a service definition not be linked to multiple locations (‘many to many’)?

@angshuonline @binduak @pushpa446, thoughts?

Can we discuss this over the next PAT call?

Sure. We didnt have this requirement before. You can either raise a PR or raise a feature request.

Created

  • BAH-1072: Appointments Service Definition names to be unique per location