using LHDN.CRM.Models.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using LHDN.CRM.BC.Common;
using LHDN.CRM.Web.Controllers;
using LHDN.CRM.Web.Filters;

namespace LHDN.CRM.Web.Controllers
{
    public class TaskController : BaseController
    {
        [CRMAuthorize(Constant.Authentication.Task.CreateUpdateTask)]
        public ActionResult Detail(string id)
        {
            AddAntiforgeryToken();
            ViewBag.TaskId = id;

            return View("Index");
        }
        
        [CRMAuthorize(Constant.Authentication.Task.CreateUpdateTask)]
        public ActionResult New(EntityUpdateViewModel model)
        {
            ViewBag.ActivityId = model.ActivityID;
            ViewBag.CaseId = model.CaseID;
            ViewBag.RefNo = model.CaseRefNo;

            AddAntiforgeryToken();
            return View("Index");
        }
        
        [CRMAuthorize(Constant.Authentication.Task.SearchTask)]
        public ActionResult Search()
        {
            AddAntiforgeryToken();
            return View();
        }

        [HttpPost]
        [CRMAuthorize(Constant.Authentication.Task.SearchTask)]
        public ActionResult Listing(DashboardTilesStatusViewModel model)
        {
            ViewBag.TableType = (int)Constant.TableType.Task;
            ViewBag.TaskStatusId = model.Status1ID;
            ViewBag.LinkfromDashboard = true;

            AddAntiforgeryToken();
            return View("Search");
        }
    }
}