Skip to content

Commit

Permalink
Functions Completed
Browse files Browse the repository at this point in the history
  • Loading branch information
MadukaNuwantha committed Oct 18, 2020
1 parent b6860ef commit f79886f
Show file tree
Hide file tree
Showing 18 changed files with 252 additions and 620 deletions.
24 changes: 0 additions & 24 deletions backend/models/CompletedDeliveries.model.js

This file was deleted.

4 changes: 2 additions & 2 deletions backend/models/DeliveryQueue.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ const DeliveryQueueSchema = new Schema(
OrderId: { type: String, required: true },
CustomerName: { type: String, required: true },
ContactNo: { type: Number, required: true },
Item: { type: String, required: true },
Quantity: { type: Number, required: true },
Location: { type: String, required: true },
Driver: { type: String, required: true },
Vehicle: { type: String, required: true },
DeleveryDate: { type: Date, required: true },
DeleveryTime: { type: String, required: true },
},
{
timestamps: true,
Expand All @@ -21,4 +21,4 @@ const DeliveryQueueSchema = new Schema(

const DeliveryQueue = mongoose.model("DeliveryQueue",DeliveryQueueSchema);

module.exports = DeliveryQueue;
module.exports = DeliveryQueue;
24 changes: 0 additions & 24 deletions backend/models/OngoingDeliveries.model.js

This file was deleted.

80 changes: 0 additions & 80 deletions backend/routes/completeddeliveries.js

This file was deleted.

10 changes: 5 additions & 5 deletions backend/routes/deliveryqueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ router.route('/add').post((req, res) => {
const OrderId = (req.body.OrderId);
const CustomerName = (req.body.CustomerName);
const ContactNo = Number(req.body.ContactNo);
const Item = (req.body.Item);
const Quantity = Number(req.body.Quantity);
const Location = (req.body.Location);
const Driver = (req.body.Driver);
const Vehicle = (req.body.Vehicle);
const DeleveryDate = Date(req.body.DeleveryDate);
const DeleveryTime = (req.body.DeleveryTime);


const newDeliveryQueue = new DeliveryQueue({
OrderId,
CustomerName,
ContactNo,
Item,
Quantity,
Location,
Driver,
Vehicle,
DeleveryDate,
DeleveryTime,
});
newDeliveryQueue.save()
.then(() => res.json('Delivery Queue Added!'))
Expand All @@ -42,15 +42,15 @@ router.route('/add').post((req, res) => {
//Return one specific row

router.route('/:id').get((req, res) => {
DeliveryQueue.findById(req.params.id)
DeliveryQueue.findOne({OrderId:req.params.id})
.then(deliveryqueue => res.json(deliveryqueue))
.catch(err => res.status(400).json('Error : ' + err));
});

//Delete one specific record

router.route('/:id').delete((req, res) => {
DeliveryQueue.findByIdAndDelete(req.params.id)
DeliveryQueue.findOneAndDelete({OrderId:req.params.id})
.then(() => res.json('Delivery Queue has been deleted!'))
.catch(err => res.status(400).json('Error : ' + err));
});
Expand All @@ -63,12 +63,12 @@ router.route('/update/:id').post((req, res) => {
deliveryqueue.OrderId = (req.body.OrderId);
deliveryqueue.CustomerName = (req.body.CustomerName);
deliveryqueue.ContactNo = Number(req.body.ContactNo);
deliveryqueue.Item = (req.body.Item);
deliveryqueue.Quantity = Number(req.body.Quantity);
deliveryqueue.Location = (req.body.Location);
deliveryqueue.Driver = (req.body.Driver);
deliveryqueue.Vehicle = (req.body.Vehicle);
deliveryqueue.DeleveryDate = Date(req.body.DeleveryDate);
deliveryqueue.DeleveryTime = Date(req.body.DeleveryTime);

deliveryqueue.save()
.then(() => res.json('Delivery Queue updated'))
Expand Down
80 changes: 0 additions & 80 deletions backend/routes/ongoingdeliveries.js

This file was deleted.

6 changes: 6 additions & 0 deletions backend/routes/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ router.route('/:id').get((req,res) => {
.catch(err => res.status(400).json('Error : ' +err));
});


router.route('/:id').delete((req,res) => {
Order.findByIdAndDelete(req.params.id)
.then(() => res.json('Order deleted'))
Expand Down Expand Up @@ -75,5 +76,10 @@ router.route('/').get((req,res) => {
.catch(err => res.status(400).json('Error : ' +err));
});

router.route('/search/:id').get((req,res) => {
Order.findOne({orderNumber:req.params.id})
.then(order => res.json(order))
.catch(err => res.status(400).json('Error : ' +err));
});

module.exports = router;
2 changes: 2 additions & 0 deletions backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const orderRouter = require('./routes/order');
const vehicleRouter = require('./routes/vehicle');
const finishedproductRouter = require('./routes/finishedproduct');
const rawmaterialRouter = require('./routes/rawmaterial');
const deliveryQueueRouter = require('./routes/deliveryQueue');


const usersRouter = require('./routes/users');
Expand All @@ -49,6 +50,7 @@ app.use('/salary' , salaryRouter);
app.use('/employee', employeeRouter);
app.use('/order', orderRouter);
app.use('/vehicle', vehicleRouter);
app.use('/deliveryQueue', deliveryQueueRouter);

app.use('/users',usersRouter);
app.use('/equipments',equipmentRouter);
Expand Down
2 changes: 2 additions & 0 deletions debug.log
Original file line number Diff line number Diff line change
Expand Up @@ -2150,3 +2150,5 @@
[1017/001934.960:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
[1018/110055.060:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
[1018/152431.490:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
[1018/195538.205:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
[1018/212140.845:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
4 changes: 0 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ import OrderManagement from "./components/order-management.component";
//Delivery Management
import DeliveryQueueTable from "./components/DeliveryQueueTable.component";
import UpcomingDeliveriesTable from "./components/UpcomingDeliveriesTable.component";
import CompletedDeliveriesTable from "./components/CompletedDeliveriesTable.component";
import OngoingDeliveryTable from "./components/OngoingDeliveryTable.component";
import AssignDriverForm from "./components/AssignDriverForm.component";

//Vehicle Management
Expand Down Expand Up @@ -132,8 +130,6 @@ function App() {

<Route path="/Deliveries" exact component={DeliveryQueueTable} />
<Route path="/Upcoming" exact component={UpcomingDeliveriesTable} />
<Route path="/Completed" exact component={CompletedDeliveriesTable} />
<Route path="/Ongoing" exact component={OngoingDeliveryTable} />
<Route path="/AssignDriver" exact component={AssignDriverForm} />


Expand Down
7 changes: 1 addition & 6 deletions src/animations/LeftSideBar/LeftSection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,8 @@ const LeftSection = () => {
</Dropdown.Toggle>

<Dropdown.Menu>
<Dropdown.Item href="/Deliveries">Delivery Queue</Dropdown.Item>
<Dropdown.Item href="/Upcoming">Upcoming Deliveries</Dropdown.Item>
<Dropdown.Item href="/Ongoing">Ongoing Deliveries</Dropdown.Item>
<Dropdown.Item href="/Completed">Completed Deliveries</Dropdown.Item>
<Dropdown.Item href="/AssignDriver">Assign Driver</Dropdown.Item>
<Dropdown.Item href="/Deliveries">Delivery Queue</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>

Expand All @@ -82,8 +79,6 @@ const LeftSection = () => {

<Dropdown.Menu>
<Dropdown.Item href="VehicleManagement">Vehicle Management</Dropdown.Item>
<Dropdown.Item href="InsertVehicle">Insert Vehicle</Dropdown.Item>
<Dropdown.Item href="UpdateVehicle">Update Vehicle</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>

Expand Down
Loading

0 comments on commit f79886f

Please sign in to comment.