Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-049
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-049
2021-049
Commits
53e4abe0
Commit
53e4abe0
authored
Jul 03, 2021
by
Gihan76
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Financial Details adding routes form with DB done!
parent
d80cf719
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
307 additions
and
0 deletions
+307
-0
BackEnd/WebBackEnd/models/finance.model.js
BackEnd/WebBackEnd/models/finance.model.js
+28
-0
BackEnd/WebBackEnd/routes/finance.route.js
BackEnd/WebBackEnd/routes/finance.route.js
+47
-0
WebFrontEnd/smartcoach-frontend/src/Components/Admin/add_financial_details.js
...ch-frontend/src/Components/Admin/add_financial_details.js
+232
-0
No files found.
BackEnd/WebBackEnd/models/finance.model.js
0 → 100644
View file @
53e4abe0
const
mongoose
=
require
(
'
mongoose
'
);
const
Schema
=
mongoose
.
Schema
;
let
FinanceSchema
=
new
Schema
({
// name : {type:String,required:true},
account_month
:
{
type
:
String
,
required
:
true
},
direct_income
:
{
type
:
String
,
required
:
true
},
indirect_income
:
{
type
:
String
,
required
:
true
},
total_income
:
{
type
:
String
,
required
:
true
},
direct_expenses
:
{
type
:
String
,
required
:
true
},
indirect_expenses
:
{
type
:
String
,
required
:
true
},
total_expenses
:
{
type
:
String
,
required
:
true
},
gross_revenue
:
{
type
:
String
,
required
:
true
}
},{
timestamps
:
true
});
// function getPrice(num){
// return (num/100).toFixed(2);
// }
//
// function setPrice(num){
// return num*100;
// }
const
Finance
=
mongoose
.
model
(
'
finance
'
,
FinanceSchema
);
module
.
exports
=
Finance
;
\ No newline at end of file
BackEnd/WebBackEnd/routes/finance.route.js
0 → 100644
View file @
53e4abe0
const
router
=
require
(
'
express
'
).
Router
();
//import models
const
Finance
=
require
(
'
../models/finance.model
'
);
let
Tutor
=
require
(
'
../models/tutor.user.model
'
);
router
.
route
(
'
/tutors
'
).
get
((
req
,
res
)
=>
{
Tutor
.
find
({},
{
tutor_name
:
1
,
_id
:
0
})
.
then
(
tutors
=>
res
.
json
(
tutors
))
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error:
'
+
err
));
});
router
.
route
(
'
/
'
).
get
((
req
,
res
)
=>
{
Finance
.
find
()
.
then
(
financedetails
=>
res
.
json
(
financedetails
))
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error :
'
+
err
));
});
router
.
route
(
'
/store
'
).
post
((
req
,
res
)
=>
{
// const tutname = req.body.tutname;
const
account_month
=
req
.
body
.
account_month
;
const
direct_income
=
req
.
body
.
direct_income
;
const
indirect_income
=
req
.
body
.
indirect_income
;
const
total_income
=
req
.
body
.
total_income
;
const
direct_expenses
=
req
.
body
.
direct_expenses
;
const
indirect_expenses
=
req
.
body
.
indirect_expenses
;
const
total_expenses
=
req
.
body
.
total_expenses
;
const
gross_revenue
=
req
.
body
.
gross_revenue
;
const
newFinancialDetails
=
new
Finance
({
// tutname,
account_month
,
direct_income
,
indirect_income
,
total_income
,
direct_expenses
,
indirect_expenses
,
total_expenses
,
gross_revenue
});
newFinancialDetails
.
save
()
.
then
(()
=>
res
.
json
(
'
Financial Details Added!
'
))
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error :
'
+
err
));
});
module
.
exports
=
router
;
\ No newline at end of file
WebFrontEnd/smartcoach-frontend/src/Components/Admin/add_financial_details.js
0 → 100644
View file @
53e4abe0
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment