# -*- coding: utf-8 -*-

from __future__ import division

from django.conf import settings
from django.shortcuts import render

from mch.models import SaleclerkInfo


def clerk_info_oauth(request):
    brand_id = request.GET.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
    unionid = request.GET.get('unionid', '')

    try:
        clerk = SaleclerkInfo.objects.get(brand_id=brand_id, unionid=unionid)
    except SaleclerkInfo.DoesNotExist:
        clerk = None

    return render(request, 'page/clerk_info.html', {
        'domain': settings.DOMAIN,
        'clerk_info': clerk and clerk.data,
    })
