 exports.create = (req, res) ->
   shopId = req.session.currentShop.shopId
   dealId = req.params.dealId
-  
+
   DealCategory.find().sort('name').exec( (err, categories ) ->
     res.render 'pages/shopmanagement/deals/create',
       {

exports.delete = (req, res) ->
  shopId = req.session.currentShop.shopId
  dealId = req.params.dealId
  
  Deal.findOne({_id: req.params.dealId}).exec (err, deal) ->
   
    res.render 'pages/shopmanagement/deals/delete',
      {
        deal: deal,

  format = type.split("/")
  if format[1] is "jpg" or format[1] is "jpeg" or format[1] is "png" or format[1] is "gif"
    fs.rename req.files.image.path, path, (err) ->

      Shop.findOne({_id: shopId}).exec (err, shop) ->

        if shop

          if file.path.indexOf('/') > -1
            splittednewname = (file.path).split('/')
          else
            splittednewname = (file.path).split('\\')

          image = "/upload/" + splittednewname[splittednewname.length-1]
          deal = new Deal
            shop: shop
