This repository has been archived by the owner on Feb 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added eslint prettier and fixed files
- Loading branch information
Camel Aissani
committed
May 18, 2021
1 parent
015c861
commit cd1c51e
Showing
144 changed files
with
14,189 additions
and
11,674 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"parserOptions": { | ||
"ecmaVersion": 12, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"semi": "error", | ||
"quotes": ["error", "single", { "avoidEscape": true }], | ||
"no-unused-vars": [ | ||
"error", | ||
{ | ||
"vars": "all", | ||
"args": "after-used", | ||
"ignoreRestSiblings": true | ||
} | ||
] | ||
}, | ||
"env": { | ||
"node": true, | ||
"browser": true, | ||
"jquery": true, | ||
"es2021": true | ||
}, | ||
"extends": ["eslint:recommended"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bkp | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"semi": true, | ||
"tabWidth": 2, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,67 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
|
||
module.exports = function(contract, rentDate, previousRent, settlements) { | ||
const rent = { | ||
term: 0, | ||
month: 0, | ||
year: 0, | ||
preTaxAmounts: [ | ||
// { | ||
// description: '', | ||
// amount: '' | ||
// } | ||
], | ||
charges: [ | ||
// { | ||
// description: '', | ||
// amount: '' | ||
// } | ||
], | ||
discounts: [ | ||
// { | ||
// origin: '', // 'contract', 'settlement' | ||
// description: '', | ||
// amount: '' | ||
// } | ||
], | ||
debts: [ | ||
// { | ||
// description: '', | ||
// amount: '' | ||
// } | ||
], | ||
vats: [ | ||
// { | ||
// origin: '', // 'contract', 'settlement' | ||
// description: '', | ||
// rate: 0, | ||
// amount: 0 | ||
// } | ||
], | ||
payments: [ | ||
// { | ||
// date: '', | ||
// amount: 0, | ||
// type: '', | ||
// reference: '' | ||
// } | ||
], | ||
description: '', | ||
total: { | ||
balance: 0, | ||
preTaxAmount: 0, | ||
charges: 0, | ||
discount: 0, | ||
vat: 0, | ||
grandTotal: 0, | ||
payment: 0 | ||
} | ||
}; | ||
const tasks_dir = path.join(__dirname, 'tasks'); | ||
const taskFiles = fs.readdirSync(tasks_dir); | ||
return taskFiles.reduce((rent, taskFile) => { | ||
const task = require(path.join(tasks_dir, taskFile)); | ||
return task(contract, rentDate, previousRent, settlements, rent); | ||
}, rent); | ||
module.exports = function (contract, rentDate, previousRent, settlements) { | ||
const rent = { | ||
term: 0, | ||
month: 0, | ||
year: 0, | ||
preTaxAmounts: [ | ||
// { | ||
// description: '', | ||
// amount: '' | ||
// } | ||
], | ||
charges: [ | ||
// { | ||
// description: '', | ||
// amount: '' | ||
// } | ||
], | ||
discounts: [ | ||
// { | ||
// origin: '', // 'contract', 'settlement' | ||
// description: '', | ||
// amount: '' | ||
// } | ||
], | ||
debts: [ | ||
// { | ||
// description: '', | ||
// amount: '' | ||
// } | ||
], | ||
vats: [ | ||
// { | ||
// origin: '', // 'contract', 'settlement' | ||
// description: '', | ||
// rate: 0, | ||
// amount: 0 | ||
// } | ||
], | ||
payments: [ | ||
// { | ||
// date: '', | ||
// amount: 0, | ||
// type: '', | ||
// reference: '' | ||
// } | ||
], | ||
description: '', | ||
total: { | ||
balance: 0, | ||
preTaxAmount: 0, | ||
charges: 0, | ||
discount: 0, | ||
vat: 0, | ||
grandTotal: 0, | ||
payment: 0, | ||
}, | ||
}; | ||
const tasks_dir = path.join(__dirname, 'tasks'); | ||
const taskFiles = fs.readdirSync(tasks_dir); | ||
return taskFiles.reduce((rent, taskFile) => { | ||
const task = require(path.join(tasks_dir, taskFile)); | ||
return task(contract, rentDate, previousRent, settlements, rent); | ||
}, rent); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,69 @@ | ||
const moment = require('moment'); | ||
|
||
module.exports = function(contract, rentDate, previousRent, settlements, rent) { | ||
const currentMoment = moment(rentDate, 'DD/MM/YYYY HH:mm'); | ||
rent.term = Number(currentMoment.format('YYYYMMDDHH')); | ||
if (contract.frequency === 'months') { | ||
rent.term = Number(moment(currentMoment).startOf('month').format('YYYYMMDDHH')); | ||
} | ||
if (contract.frequency === 'days') { | ||
rent.term = Number(moment(currentMoment).startOf('day').format('YYYYMMDDHH')); | ||
} | ||
if (contract.frequency === 'hours') { | ||
rent.term = Number(moment(currentMoment).startOf('hour').format('YYYYMMDDHH')); | ||
} | ||
rent.month = currentMoment.month() + 1; // 0 based | ||
rent.year = currentMoment.year(); | ||
module.exports = function ( | ||
contract, | ||
rentDate, | ||
previousRent, | ||
settlements, | ||
rent | ||
) { | ||
const currentMoment = moment(rentDate, 'DD/MM/YYYY HH:mm'); | ||
rent.term = Number(currentMoment.format('YYYYMMDDHH')); | ||
if (contract.frequency === 'months') { | ||
rent.term = Number( | ||
moment(currentMoment).startOf('month').format('YYYYMMDDHH') | ||
); | ||
} | ||
if (contract.frequency === 'days') { | ||
rent.term = Number( | ||
moment(currentMoment).startOf('day').format('YYYYMMDDHH') | ||
); | ||
} | ||
if (contract.frequency === 'hours') { | ||
rent.term = Number( | ||
moment(currentMoment).startOf('hour').format('YYYYMMDDHH') | ||
); | ||
} | ||
rent.month = currentMoment.month() + 1; // 0 based | ||
rent.year = currentMoment.year(); | ||
|
||
contract.properties.filter((property) => { | ||
const entryMoment = moment(property.entryDate, 'DD/MM/YYYY').startOf('day'); | ||
const exitMoment = moment(property.exitDate, 'DD/MM/YYYY').endOf('day'); | ||
contract.properties | ||
.filter((property) => { | ||
const entryMoment = moment(property.entryDate, 'DD/MM/YYYY').startOf( | ||
'day' | ||
); | ||
const exitMoment = moment(property.exitDate, 'DD/MM/YYYY').endOf('day'); | ||
|
||
return currentMoment.isBetween(entryMoment, exitMoment, contract.frequency, '[]'); | ||
}).forEach(function (property) { | ||
if (property.property) { | ||
const name = property.property.name || ''; | ||
const preTaxAmount = property.rent || 0; | ||
const expenses = property.expenses || []; | ||
return currentMoment.isBetween( | ||
entryMoment, | ||
exitMoment, | ||
contract.frequency, | ||
'[]' | ||
); | ||
}) | ||
.forEach(function (property) { | ||
if (property.property) { | ||
const name = property.property.name || ''; | ||
const preTaxAmount = property.rent || 0; | ||
const expenses = property.expenses || []; | ||
|
||
rent.preTaxAmounts.push({ | ||
description: name, | ||
amount: preTaxAmount | ||
}); | ||
rent.preTaxAmounts.push({ | ||
description: name, | ||
amount: preTaxAmount, | ||
}); | ||
|
||
if (expenses.length) { | ||
rent.charges.push(...expenses.map(({title, amount}) => ({ | ||
description: title, | ||
amount | ||
}))); | ||
} | ||
if (expenses.length) { | ||
rent.charges.push( | ||
...expenses.map(({ title, amount }) => ({ | ||
description: title, | ||
amount, | ||
})) | ||
); | ||
} | ||
} | ||
}); | ||
if (settlements) { | ||
rent.description = settlements.description || ''; | ||
} | ||
return rent; | ||
if (settlements) { | ||
rent.description = settlements.description || ''; | ||
} | ||
return rent; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
module.exports = function(contract, rentDate, previousRent, settlements, rent) { | ||
if (settlements && settlements.debts) { | ||
settlements.debts.forEach(debt => { | ||
rent.debts.push({ | ||
description: debt.description, | ||
amount: debt.amount | ||
}); | ||
}); | ||
} | ||
return rent; | ||
module.exports = function ( | ||
contract, | ||
rentDate, | ||
previousRent, | ||
settlements, | ||
rent | ||
) { | ||
if (settlements && settlements.debts) { | ||
settlements.debts.forEach((debt) => { | ||
rent.debts.push({ | ||
description: debt.description, | ||
amount: debt.amount, | ||
}); | ||
}); | ||
} | ||
return rent; | ||
}; |
Oops, something went wrong.