A widget to estimate the cost of hiring in France
Module Web d'estimation du coût d'une embauche en France.
If you want to create your own specific interface, have a look at the API documentation.
Include this line where you want the widget to appear in your page:
<script src="http://embauche.beta.gouv.fr/modules/pointe/cout-embauche-widget.js"></script>
Reminder: this widget is in beta and may be updated at any time. Please send an email to contact[AT]embauche.beta.gouv.fr to request being sent potentially breaking update notices.
The widget's style is deliberately neutral to avoid visual integration problems. The host site's styles will affect the widget, and one can finalize the visual integration with a few CSS rules.
If you use Twitter Bootstrap version 2 CSS, an integration is provided. Simply add the following line after the inclusion of the widget:
<script async src="http://embauche.beta.gouv.fr/modules/pointe/bootstrap-compat.js"></script>
If you use version Bootstrap version 3, no compatibility line should be required.
- IE10.
- Safari 8.
- Opera 28.
These tests are run manually and may not be as up-to-date as the above.
- IE < 10.
- Safari < 5.1.
- Opera < 11.5.
The JS API is exposed in window.Embauche
.
At the moment, it depends on the widget being present in the DOM to load the configuration from it.
Please open an issue if you want to consume the API in a different way.
Returns the currently-displayed computed simulation data, as an object containing the OpenFisca-computed values, as identifiers from the OpenFisca legislation mapped to Number
values.
Calls the Paie API, parameterised with the current state of the form.
You can adjust the situation to compute by passing an object as the first argument (additionalParameters
). The parameters you can use are documented in the Paie API.
This function takes a callback as last argument. This callback will be called with three parameters:
- An optional error. The failed
XMLHttpRequest
, or aSyntaxError
if the fetched OpenFisca value is not properly formatted. - An object containing the OpenFisca-computed values, as identifiers from the OpenFisca legislation mapped to
Number
values. - The full OpenFisca response if you need everything it sends back.
If the callback is not input, returns the OpenFisca GET
URL to obtain the results, as documented in the /formula
API.
window.Embauche.OpenFisca.get({
zone_revitalisation_rurale: true
}, function(error, results) {
if (error) throw error;
window.alert('Employer would pay ' + results.salaire_super_brut + ' if this geographic zone was elected as a ZRR.')
});
This widget is packaged with Webpack and distributed through RawGit CDN.
RawGit does not offer any guarantees, we will distribute on our own servers when we get enough users to justify the investment.
To compile your modifications, clone this repository, cd
to it and npm install
. You can then run npm run compile
whenever you change a file to update files under dist
.
Run npm run dev
to get webpack's development server and visit the ouput url to work on index.html
with automatic page reloading on source change.
To work directly on a module with automatic page reloading , e.g. the cout-embauche-widget
, add dist/cout-embauche-widget
at the end of the ouput url.
Simply compile the widget and push your changes on GitHub.
This widget is covered by integration tests written with Watai under the test
folder. To run them locally, follow the installation guide and run npm test
.
These tests are run continuously on CircleCI.