Skip to content

Commit bb38438

Browse files
Css added
2 parents 800acff + 0c424c6 commit bb38438

63 files changed

Lines changed: 4326 additions & 524 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.idea/jsLibraryMappings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/watcherTasks.xml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
const formidable = require("formidable");
2+
const _ = require("lodash");
3+
const slugify = require("slugify");
4+
const CompanyPayment = require('../../Modules/Accountant/module.company.payment');
5+
const {next} = require("lodash");
6+
7+
/**
8+
* Create Company Payment controller
9+
* @param req
10+
* @param res
11+
* @returns {Promise<any>}
12+
*/
13+
const createCompanyPayment = (req, res) => {
14+
const {name,amount,date,type} = req.body
15+
// validate fields
16+
if(!name || !amount|| !date|| !type) {
17+
return res.status(400).json({
18+
error: "All fields are required"
19+
});
20+
}
21+
22+
CompanyPayment.create({name,amount,date,type},(err,name) => {
23+
if(err) {
24+
return res.status(400).json({
25+
error: 'Error Found'
26+
});
27+
}
28+
res.json(name);
29+
});
30+
}
31+
32+
/**
33+
* Get all Company Payments controller
34+
* @param req
35+
* @param res
36+
* @returns {Promise<any>}
37+
*/
38+
const getAllCompanyPayment = (req, res) => {
39+
let order = req.query.order ? req.query.order : 'asc'
40+
let sortBy = req.query.sortBy ? req.query.sortBy : '_id'
41+
42+
CompanyPayment.find()
43+
.sort([[sortBy, order]])
44+
.exec((err, companyPayments) => {
45+
if(err) {
46+
return res.status(400).json ({
47+
error: 'No company Payment Found'
48+
});
49+
}
50+
res.json(companyPayments);
51+
});
52+
}
53+
54+
/**
55+
* Get a specific Company payment controller
56+
* @param req
57+
* @param res
58+
* @param next
59+
* @param id
60+
* @returns {Promise<any>}
61+
*/
62+
const companyPaymentById = async (req, res) => {
63+
CompanyPayment.findById(req.params.id, (error, data) =>{
64+
if (error) {
65+
return next(error)
66+
} else {
67+
res.json(data)
68+
}
69+
})
70+
};
71+
72+
/**
73+
* Update the company payment controller
74+
* @param req
75+
* @param res
76+
* @returns {Promise<any>}
77+
*/
78+
const updateById = async(req, res) => {
79+
const { slug } = req.params
80+
const {name,amount,date,type} = req.body
81+
CompanyPayment.findOneAndUpdate({slug}, {name,amount,date,type}, {new: true})
82+
.exec((err,topic) => {
83+
if(err) console.log(err)
84+
res.json(topic);
85+
})
86+
};
87+
88+
/**
89+
* Delete company Payment controller
90+
* @param req
91+
* @param res
92+
* @returns {Promise<any>}
93+
*/
94+
const deleteById = async (req, res) => {
95+
const id = req.params.id
96+
await CompanyPayment.findByIdAndRemove(id).exec()
97+
res.send("Payment Deleted successfully");
98+
};
99+
100+
/**
101+
* export controllers
102+
* @type {{companyPaymentById: companyPaymentById,
103+
* createCompanyPayment: createCompanyPayment,
104+
* getAllCompanyPayment: getAllCompanyPayment,
105+
* updateById: updateById,
106+
* deleteById: deleteById}}
107+
*/
108+
module.exports = {
109+
companyPaymentById,
110+
createCompanyPayment,
111+
getAllCompanyPayment,
112+
updateById,
113+
deleteById
114+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
const Feedback = require('../../Modules/Student/module.feedback'); // Require the database structure
2+
3+
//Create Notices by getting details --------
4+
const CreateFeedBack = async (req, res) => {
5+
if (req.body) {
6+
const feedback = new Feedback(req.body);
7+
await feedback.save()
8+
.then(data => {
9+
res.status(200).send({ data: data });
10+
})
11+
.catch(error => {
12+
res.status(500).send({ error: error.message });
13+
});
14+
}
15+
}
16+
17+
// Get all Notices -------------
18+
const getAllFeedBack = async (req, res) => {
19+
await Feedback.find({})
20+
.then(data => {
21+
res.status(200).send({ data: data });
22+
})
23+
.catch(error => {
24+
res.status(500).send({ error: error.message });
25+
});
26+
}
27+
28+
29+
30+
31+
// Get GetAllFeedBackForParticularUser -------------
32+
const getTestAllFeedBack = async (req, res) => {
33+
await Feedback.find({ receivers: req.params.receivers } )
34+
.then(data => {
35+
res.status(200).send({ data: data });
36+
})
37+
.catch(error => {
38+
res.status(500).send({ error: error.message });
39+
});
40+
}
41+
42+
43+
44+
45+
const getSpecificFeedBack = async (req, res) => {
46+
const item2 = await Feedback.findById(req.params.id)
47+
48+
const title = item2.title;
49+
const type = item2.type;
50+
const receivers = item2.receivers;
51+
const description = item2.description;
52+
res.status(200).send({title: title, type: type, receivers: receivers, description: description});
53+
54+
}
55+
56+
57+
module.exports = {
58+
CreateFeedBack,
59+
getAllFeedBack,
60+
getSpecificFeedBack,
61+
getTestAllFeedBack
62+
};
63+
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
const Student = require('../../Modules/Student/module.student'); // Require the database structure
2+
3+
//Create Student by getting details -------- OK
4+
5+
const createStudent = async (req, res) => {
6+
if (req.body) {
7+
const student = new Student({
8+
FullName: req.body.FullName,
9+
LastName: req.body.LastName,
10+
NIC: req.body.NIC,
11+
AddressLineOne: req.body.AddressLineOne,
12+
AddressLineTwo: req.body.AddressLineTwo,
13+
BirthDay: req.body.BirthDay,
14+
Mobile: req.body.Mobile,
15+
OtherMobile: req.body.OtherMobile,
16+
Email: req.body.Email,
17+
referances: req.body.classes
18+
});
19+
student.save()
20+
.then(data => {
21+
res.status(200).send({ data: data });
22+
})
23+
.catch(error => {
24+
res.status(500).send({ error: error.message });
25+
});
26+
}
27+
}
28+
29+
30+
// Get all Students -------------
31+
const getAllStudents = async (req, res) => {
32+
await Student.find({})
33+
.populate('classes', 'name description pdf')
34+
.then(data => {
35+
res.status(200).send({ data: data });
36+
})
37+
.catch(error => {
38+
res.status(500).send({ error: error.message });
39+
});
40+
}
41+
42+
43+
// Get all Classes for particular Students------------- OK
44+
const getReferancesForStudent = async (req, res) => {
45+
if (req.params && req.params.id) {
46+
await Student.findById(req.params.id)
47+
.populate('classes', 'name description pdf')
48+
.then(data => {
49+
res.status(200).send({ data: data.referances });
50+
})
51+
.catch(error => {
52+
res.status(500).send({ error: error.message });
53+
});
54+
}
55+
}
56+
57+
/*
58+
//611cce5c418afb1da059cfb8
59+
const updateStudentDetails = async (req, res) => {
60+
61+
Student.findByIdAndUpdate('611cce5c418afb1da059cfb8', req.body,
62+
function (err, docs) {
63+
if (err){
64+
console.log(err)
65+
}
66+
else{
67+
console.log("Updated User : ", docs);
68+
res.status(200).send()
69+
}
70+
});
71+
}
72+
*/
73+
const getPerticulerStudent = async (req, res) => {
74+
const student = await Student.findById('611ccbd3b429311660b2a184')
75+
76+
const FullName = student.FullName;
77+
const LastName = student.LastName;
78+
const NIC = student.NIC;
79+
const AddressLineOne = student.AddressLineOne;
80+
const AddressLineTwo = student.AddressLineTwo;
81+
const BirthDay = student.BirthDay;
82+
const Mobile = student.Mobile;
83+
const OtherMobile = student.OtherMobile;
84+
const Email = student.Email;
85+
res.status(200).send({FullName: FullName, LastName: LastName, NIC: NIC, AddressLineOne: AddressLineOne,AddressLineTwo: AddressLineTwo, BirthDay: BirthDay, Mobile: Mobile, OtherMobile: OtherMobile, Email: Email});
86+
87+
}
88+
89+
90+
// update Details for particular Student------------- OK
91+
const updateStudentDetails = async (req, res) => {
92+
if (req.params && req.params.id) {
93+
Student.findByIdAndUpdate(req.params.id, req.body,
94+
function (err, docs) {
95+
if (err){
96+
console.log(err)
97+
}
98+
else{
99+
console.log("Updated User : ", docs);
100+
res.status(200).send()
101+
}
102+
});
103+
}
104+
}
105+
106+
// Get all Details for particular Student------------- OK
107+
const getDetailsForStudent = async (req, res) => {
108+
if (req.params && req.params.id) {
109+
const student = await Student.findById(req.params.id)
110+
.populate('classes', 'name description pdf')
111+
const FullName = student.FullName;
112+
const LastName = student.LastName;
113+
const NIC = student.NIC;
114+
const AddressLineOne = student.AddressLineOne;
115+
const AddressLineTwo = student.AddressLineTwo;
116+
const BirthDay = student.BirthDay;
117+
const Mobile = student.Mobile;
118+
const OtherMobile = student.OtherMobile;
119+
const Email = student.Email;
120+
const referances = student.referances;
121+
res.status(200).send({FullName: FullName, LastName: LastName, NIC: NIC, AddressLineOne: AddressLineOne,AddressLineTwo: AddressLineTwo, BirthDay: BirthDay, Mobile: Mobile, OtherMobile: OtherMobile, Email: Email, referances: referances});
122+
123+
}
124+
}
125+
126+
127+
128+
129+
module.exports = {
130+
createStudent,
131+
getAllStudents,
132+
getReferancesForStudent,
133+
getPerticulerStudent,
134+
updateStudentDetails,
135+
getDetailsForStudent
136+
};
137+

0 commit comments

Comments
 (0)