crawlinknetworks / crawlink-erp

3 stars 0 forks source link

[WEB][Admin] Product and product list update #134

Open paramanandapradhan opened 5 years ago

paramanandapradhan commented 5 years ago

Product create, list & view should updated. Recommended fields for product is:

  1. Name
  2. Desc
  3. Price (Product unit price in paisa )
  4. DescountPercent (Applied discount percent )
  5. MaxDiscountPercent (Max dis. a sales person can give to end customer)
  6. DiscountAmount (Discount amount value)
  7. Quantity (Initially it will be 1)
  8. Commission Percent (Commission percentage for a sales executive)
  9. CommisionAmount (Value)
  10. Billing fields (array of key and value pair):
    1. BillingKey and ForeignKey

Please look the following UI Mock product

paramanandapradhan commented 5 years ago

D -> delete icon A -> Add a new item

srikanth340 commented 5 years ago

Model: // const schema = new mongoose.Schema({ name: String, shortName: String, desc: String, productType: String, // Goods or Service type: Number, // Product type, Any other sub type we need to mention as a number code: String, // Product code quantity: Number, price: Number, // in paisa, sales price purchagePrice: Number, maxDiscountPercent: Number, discountPercent: Number, discountAmount: Number, commissionPercent: Number, commissionAmount: Number, taxes: [ { _id: false, name: String, desc: String, percent: Number, amount: Number, } ], totalTaxAmount: Number, billingFields: [{ _id: false, productKey: String, // Product collecction key, like quantity billingKey: String, // Ref key of billing collection operation: String, // How it will react in billing collection, means Add or replace or extend type: String, // Value type, Number, Days, value: Number, // Default/Fallback value of the product billing fields }], isActive: Boolean, banner: String, canChangeDiscont: Boolean, // At the time of billing, discount can be updated by admin or sales person canChangeQuantity: Boolean, // Can change quentity by Biller,

// Old values, we may not use this on new implementation
requestCredit: Number,
storageCredit: Number,
smsCredit: Number,
emailCredit: Number,
sitePageCredit: Number,
siteTicketCredit: Number,
voiceSmsCredit: Number,
validity: String,
cancelPolicy: String,
docSize: Number,

}, { timestamps: true });

API: billing module router.get("/api/products", AuthCtrl.checkUserIdToken, ProductCtrl.getAllProducts); router.get("/api/products/:productId", AuthCtrl.checkUserIdToken, ProductCtrl.getProduct); router.post("/api/products", AuthCtrl.checkUserIdToken, ProductCtrl.createProduct); router.put("/api/products/:productId", AuthCtrl.checkUserIdToken, ProductCtrl.updateProduct); router.delete("/api/products/:productId", AuthCtrl.checkUserIdToken, ProductCtrl.deleteProduct);