-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PCHR-3459: Add Tool Icon to Edit Job Contract Options #2620
PCHR-3459: Add Tool Icon to Edit Job Contract Options #2620
Conversation
@ajesamson please remove the |
@@ -29,6 +29,7 @@ define([ | |||
$scope.cancel = cancel; | |||
$scope.dpOpen = dpOpen; | |||
$scope.save = save; | |||
$scope.openRevisionChangeReasonEditor = openRevisionChangeReasonEditor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please sort aplhabetically
@@ -78,6 +78,11 @@ define([ | |||
$scope.cancel = cancel; | |||
$scope.filesValidate = filesValidate; | |||
$scope.save = save; | |||
$scope.openOptionsEditor = openOptionsEditor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please sort alphabetically.
$scope.openHoursLocationOptionsEditor = openHoursLocationOptionsEditor; | ||
$scope.openPayScaleGradeOptionsEditor = openPayScaleGradeOptionsEditor; | ||
$scope.openAnnualBenefitOptionsEditor = openAnnualBenefitOptionsEditor; | ||
$scope.openAnnualDeductionOptionsEditor = openAnnualDeductionOptionsEditor; | ||
|
||
// Init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove that comment, we don't need it as per styleguide
/** | ||
* Opens option editor window for contract type, location, end reason or insurance | ||
* | ||
* @param optionUrl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The param types are forgotten:
* @param {String} optionUrl
* @param {String} fieldName
if (fieldName === 'hrjobcontract_health_health_plan_type') { | ||
contractHealthService.getOptions(fieldName, true) | ||
.then(function (data) { | ||
var healthOptions = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Lodash here:
_.mapValues(_.indexBy([{key: 1, value: 'one'},{key: 2, value: 'two'}], 'key'), 'value')
>>> {1: "one", 2: "two"}
So it would be smth like:
var healthOptions = _.mapValues(_.indexBy(data, 'key'), 'value');
Also, between var x = ...
and other types of expressions, like function calls, please leave an empty line break.
function loadAnnualPayOptions (optionType, optionName) { | ||
return OptionGroup.valuesOf(optionType, false) | ||
.then(function (data) { | ||
var options = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use lodash
'sequential': 1, | ||
'field': fieldName | ||
}).done(function (data) { | ||
_.each(data.values, function (option) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we user lodash's map
to create an array and object generation as suggested above?
@@ -86,6 +89,61 @@ define([ | |||
}); | |||
}); | |||
|
|||
describe('when user clicks on the wrench icon', function () { | |||
locationUrl = '/civicrm/hours_location?reset=1'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we split this into multiple suites? One test is just too large and it is a bit difficult to follow what's going on here.
There should be multiple describes, smth like when user clicks on the "hours location" wrench icon
. etc
@@ -457,6 +459,61 @@ define([ | |||
}); | |||
}); | |||
|
|||
describe('when user clicks on the wrench icon', function () { | |||
locationUrl = '/civicrm/hours_location?reset=1'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
@@ -62,9 +62,6 @@ | |||
{/if} | |||
</div> | |||
</div> | |||
<script type="text/javascript"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave a description comment in the Tech description of the PR on why are you making this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tech description has been updated.
* @param optionName | ||
* @returns {*} | ||
* @param {String} optionType | ||
* @param {String} optionName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, why do we remove the return
here? Please leave it how it was, but in the documentation it should say what it returns. If it is a {Promise}
, then:
```* @return {Promise} resolved with ....`
Same for other places.
cf3cf7a
to
0e83888
Compare
c2e4a76
to
06ed650
Compare
409b296
to
ca4980d
Compare
Overview
Provision for editing options while creating record is not available for some Job Contract options. This PR add such facility for Contract Type, Normal Place of Work, Contract End Reason, Revision Change Reason, Location/Standard hours, Pay Scale/Grade, Annual Benefit, Annual Deductions and Plan Type.
Before
After
Technical Details
Tool icon is added next to the input for the specified options. Each tool icon makes a call to the respective controller method for launching and managing associated options.
Sample implementation of the controller method (such as openOptionsEditor) is shown below:
Each crmAngService loadForm method includes a callback to update the dropdown list.
Some other changes were made on Location/Standard hours and Pay Scale / Grade to allow for proper api update via ajax calls. Their templates use data-field value title instead of location and pay_scale respectively.
Call to API was added for some of the callbacks to have updated changes reflecting.
The snippet below was removed due to errors when initializing inline edit because of
$
being out of scope.The inline edit works without this implementation.
✅Manual Tests - passed
✅Jasmine Tests - passed
✅Backstopjs Test - passed
✅JS distributive files - included