Rails.application.routes.draw do
 
 
  resources :sellers
  resources :clients
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
    root :to => 'home#index'
    get "dashboard", to: "home#dashboard", as: "dashboard"

    resources :batches
    devise_for :members
    resources :batch_line_items,:only =>[:index] 
    resources :users

    # #batchlineitems
    get "batch_line_items/search" =>'batch_line_items#search',:as =>'filter'
    get "batch_line_items/export_to_seller" =>'batch_line_items#export_to_seller',:as =>'export_to_seller'
    match "batch_line_items/export_seller" =>'batch_line_items#export_seller',:as =>'export_seller', :via => [:post ,:get]
    
    #batches
    get "batches/search" =>'batches#search',:as =>'batch_filter'
    #users
    get 'check_registered_email' => "users#check_registered_email" 
    #Encoder
    match 'batch_line_items/export' => 'batch_line_items#export', :as => 'export', :via => [:post ,:get]
     
    get 'get_batch' => 'batch_line_items#get_batch',:as => 'get_batch'

    get 'generate_cards/:id' => 'batch_line_items#generate_cards',:as => 'generate_cards'
    post "generate_card_account_items" =>"batch_line_items#generate_card_account_items"

    namespace :api, defaults: {format: :json} do
        #login
        post "auth/login" =>"auth#login"
        post "auth/logout" =>"auth#logout"
        
		#Encoder
		post "batch_line_items/register" =>"batch_line_items#register"

		#Batch
	    post "batches" => "batches#create"
	    post "batches/end" => "batches#batch_end"
	    get "batches/resume_batch" =>"batches#resume_batch"
	    get "batches/batch_progress_list" =>"batches#batch_progress_list"
        get "get_item_by_batch" =>"batch_line_items#get_item_by_batch"

        #client
        get "clients" => 'clients#index'

        #product
        get "products" => "products#index"

        #batch_line_items
        post "generate_card_account_items" =>"batch_line_items#generate_card_account_items"
        post "update_manufacture_uid" => "batch_line_items#update_manufacture_uid"
        post "update_barcode_and_account_no" => "batch_line_items#update_barcode_and_account_no"
        post "code_activate" => "batch_line_items#code_activate"
        get "activated_list" => "batch_line_items#activated_list"
        get "seller_info" => "batch_line_items#seller_info"
        
	end
end