Skip to content

mikaelletang/cout-embauche

 
 

Repository files navigation

A widget to estimate the cost of hiring in France

Module Web d'estimation du coût d'une embauche en France.

Online demo.

If you want to create your own specific interface, have a look at the API documentation.

Usage

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.

Style

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.

Using with Bootstrap

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.

Browser compatibility

Integration Tests Results

Also known to be compatible with:

  • IE10.
  • Safari 8.
  • Opera 28.

These tests are run manually and may not be as up-to-date as the above.

Not compatible with:

  • IE < 10.
  • Safari < 5.1.
  • Opera < 11.5.

JS API

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.

window.Embauche.OpenFisca.getLastResults()

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.

window.Embauche.OpenFisca.get([additionalParameters], callback)

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 a SyntaxError 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.

Example:

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.')
});

Build

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.

Compilation

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.

Distribution

Simply compile the widget and push your changes on GitHub.

Test

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.

About

Un estimateur de coût d'embauche

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 45.1%
  • JavaScript 43.2%
  • CSS 11.7%