from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.contrib import messages


""" SCAN PKG CODE WITH DEVICE """
@login_required(login_url='/login')
def scan_device(request):

    template_name = 'scan_device.html'

    if request.method == 'POST':
        pass
    else:
        return render(request, template_name)


@login_required(login_url='/login')
def scan_cam(request):
    template_name = 'scan_cam.html'

    if request.method == 'POST':
        pass
    else:
        return render(request, template_name)


@login_required(login_url='/login')
def scan_cam_low(request):

    template_name = 'scan_cam_low.html'

    if request.method == 'POST':
        pass
    else:
        return render(request, template_name)



@login_required(login_url='/login')
def search(request):

    template_name = 'search.html'

    if request.method == 'POST':
        pallet_code = request.POST.get('pallet_code')
        messages.error(request, 'NO PRODUCT FOUND!!!')
        return redirect('/scan/scan_search/')

    else:
        return render(request, template_name)


