|
-
-
-
- function getPrice(priceWithTax, taxRate) {
- return numberDecimals(parseFloat(parseFloat(priceWithTax) / (taxRate + 1)), 3);
- }
-
-
- function getPriceWithTax(priceWithoutTax, taxRate) {
- return numberDecimals(parseFloat(parseFloat(priceWithoutTax) * (taxRate + 1)), 2);
- }
-
- function numberDecimals(num, decimals) {
- return Number(num).toFixed(decimals) ;
- }
-
-
- function formatPrice(price) {
- return numberDecimals(price, 2).replace('.', ',') + ' €';
- }
-
-
- function formatDate(date) {
- if (date) {
- return ('0' + date.getDate()).slice(-2) + '/' + ('0' + (date.getMonth() + 1)).slice(-2) + '/' + date.getFullYear();
- }
- return false;
- }
-
-
-
- function log(msg) {
- try {
- console.log(msg);
- } catch (e) {
-
- }
- }
-
-
- $.fn.serializeObject = function () {
- var o = {};
- var a = this.serializeArray();
- $.each(a, function () {
- if (o[this.name] !== undefined) {
- if (!o[this.name].push) {
- o[this.name] = [o[this.name]];
- }
- o[this.name].push(this.value || '');
- } else {
- o[this.name] = this.value || '';
- }
- });
- return o;
- };
-
-
- function getDateFormatted(date) {
- var _d = date.getDate(),
- d = _d > 9 ? _d : '0' + _d,
- _m = date.getMonth() + 1,
- m = _m > 9 ? _m : '0' + _m,
- formatted = date.getFullYear() + '-' + m + '-' + d;
- return formatted;
- }
-
-
- function userNotAllowToEdit() {
- alert('Vous n\'êtes pas autorisé à effectuer cette action');
- return false;
- }
|