forked from idurar/idurar-erp-crm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request idurar#588 from idurar/feat/add-order-api
add order api and page
- Loading branch information
Showing
30 changed files
with
785 additions
and
25 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,2 @@ | ||
const createCRUDController = require('@/controllers/middlewaresControllers/createCRUDController'); | ||
module.exports = createCRUDController('Inventory'); |
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 @@ | ||
const createCRUDController = require('@/controllers/middlewaresControllers/createCRUDController'); | ||
module.exports = createCRUDController('Kyc'); |
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 @@ | ||
const createCRUDController = require('@/controllers/middlewaresControllers/createCRUDController'); | ||
module.exports = createCRUDController('Order'); |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const mongoose = require('mongoose'); | ||
mongoose.Promise = global.Promise; | ||
|
||
const inventorySchema = new mongoose.Schema({ | ||
removed: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
enabled: { | ||
type: Boolean, | ||
default: true, | ||
}, | ||
product: { | ||
type: String, | ||
trim: true, | ||
required: true, | ||
}, | ||
quantity: { | ||
type: Number, | ||
required: true, | ||
min: 0, // Ensure non-negative numbers | ||
}, | ||
unitPrice: { | ||
type: Number, | ||
required: true, | ||
min: 0, // Ensure non-negative numbers | ||
}, | ||
created: { | ||
type: Date, | ||
default: Date.now, | ||
}, | ||
}); | ||
|
||
module.exports = mongoose.model('Inventory', inventorySchema); |
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,38 @@ | ||
const mongoose = require('mongoose'); | ||
mongoose.Promise = global.Promise; | ||
|
||
const kycSchema = new mongoose.Schema({ | ||
removed: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
enabled: { | ||
type: Boolean, | ||
default: true, | ||
}, | ||
created: { | ||
type: Date, | ||
default: Date.now, | ||
}, | ||
// Fields for shipping | ||
name: { | ||
type: String, | ||
trim: true, | ||
required: true, | ||
}, | ||
address: { | ||
type: String, | ||
trim: true, | ||
required: true, | ||
}, | ||
contact: { | ||
type: String, | ||
required: true, | ||
}, | ||
filePath: { | ||
type: String, | ||
trim: true, | ||
}, | ||
}); | ||
|
||
module.exports = mongoose.model('Kyc', kycSchema); |
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,47 @@ | ||
const mongoose = require('mongoose'); | ||
mongoose.Promise = global.Promise; | ||
|
||
const orderSchema = new mongoose.Schema({ | ||
removed: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
enabled: { | ||
type: Boolean, | ||
default: true, | ||
}, | ||
created: { | ||
type: Date, | ||
default: Date.now, | ||
}, | ||
// Fields for shipping | ||
orderId: { | ||
type: String, | ||
trim: true, | ||
required: true, | ||
}, | ||
products: { | ||
type: String, // Consider changing this to an array of objects if you have multiple products | ||
trim: true, | ||
required: true, | ||
}, | ||
quantity: { | ||
type: Number, | ||
required: true, | ||
}, | ||
price: { | ||
type: Number, | ||
required: true, | ||
}, | ||
status: { | ||
type: String, | ||
enum: ['pending', 'shipped', 'delivered', 'cancelled'], | ||
required: true, | ||
}, | ||
notes: { | ||
type: String, | ||
trim: true, | ||
}, | ||
}); | ||
|
||
module.exports = mongoose.model('Order', orderSchema); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from 'react'; | ||
import { Form, Input, InputNumber } from 'antd'; | ||
|
||
export default function InventoryForm() { | ||
// Renamed to InventoryForm for clarity | ||
return ( | ||
<> | ||
<Form.Item | ||
label="Product" | ||
name="product" | ||
rules={[ | ||
{ | ||
required: true, | ||
message: 'Please input Product name!', | ||
}, | ||
]} | ||
> | ||
<Input /> | ||
</Form.Item> | ||
|
||
<Form.Item | ||
label="Quantity" | ||
name="quantity" | ||
rules={[ | ||
{ | ||
required: true, | ||
message: 'Please input Quantity!', | ||
type: 'number', | ||
min: 0, // Ensure non-negative numbers | ||
}, | ||
]} | ||
> | ||
<InputNumber /> | ||
</Form.Item> | ||
|
||
<Form.Item | ||
label="Unit Price" | ||
name="unitPrice" | ||
rules={[ | ||
{ | ||
required: true, | ||
message: 'Please input Unit Price!', | ||
type: 'number', | ||
min: 0, // Ensure non-negative numbers | ||
}, | ||
]} | ||
> | ||
<InputNumber | ||
formatter={(value) => `$ ${value}`} // Optional: format value as currency | ||
parser={(value) => value.replace(/\$\s?|(,*)/g, '')} // Optional: parse input as number | ||
/> | ||
</Form.Item> | ||
</> | ||
); | ||
} |
Oops, something went wrong.