Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Commit

Permalink
basic nserion created
Browse files Browse the repository at this point in the history
  • Loading branch information
nairsajjal committed Jul 3, 2019
1 parent 06f6033 commit 4b2e18c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
7 changes: 7 additions & 0 deletions controllers/invoiceController.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,11 @@ router.get('/', (req,res)=> {
});
});

router.post('/',(req,res)=>{
insertRecord(req,res);
} );

function insertRecord(req, res){

}
module.exports = router;
3 changes: 3 additions & 0 deletions models/invoices.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ var invoiceSchema = new mongoose.Schema({
items_quantity: {
type: Number
},
items_price:{
tupe: Number
},
items_amount: {
type: Number
},
Expand Down
5 changes: 4 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ require('./models/db');
const express = require('express');
const path = require('path');
const exphbs =require('express-handlebars');

const bodyParser = require('body-parser');

const invoiceController = require('./controllers/invoiceController');

var app = express();

app.use(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json());

app.set('views', path.join(__dirname, '/views/'));
app.engine('hbs', exphbs({extname:'hbs', defaultLayout: 'mainLayout', layoutsDir:__dirname+'/views/layouts/'}));
app.set('view engine','hbs');
Expand Down
8 changes: 4 additions & 4 deletions views/invoices/addOrEdit.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1 class="page-header">{{viewTitle}}</h1>

<form>
<form action="/invoice" method="POST" autocomplete="off">
<div class="row">
<div class="col-md-6 col-lg-6">
<div class="form-group">
Expand All @@ -9,12 +9,12 @@
</div>
<div class="form-group">

<textarea class="form-control" placeholder="Who is this invoice from? (required)" required="" expanding-textarea="" cols="20" rows="3" style="resize: none;"></textarea>
<textarea class="form-control" placeholder="Who is this invoice from? (required)" name="invoice_from"required="" expanding-textarea="" cols="20" rows="3" style="resize: none;"></textarea>

</div>
<div class="form-group">
<label>Bill To:</label>
<textarea class="form-control" placeholder="Who is this invoice to? (required)" required="" expanding-textarea="" cols="20" rows="3"style="resize: none;"></textarea>
<textarea class="form-control" placeholder="Who is this invoice to? (required)" name="invoice_to" required="" expanding-textarea="" cols="20" rows="3"style="resize: none;"></textarea>
</div>
</div>
<div class="col-md-6 col-lg-6">
Expand Down Expand Up @@ -66,7 +66,7 @@
</div>
<div class="form-group col-2">

<input type="number" class="form-control" name="items_quantity" placeholder="Quantity">
<input type="number" class="form-control" name="items_price" placeholder="Price">
</div>
<div class="form-group col-2">

Expand Down

0 comments on commit 4b2e18c

Please sign in to comment.