Пример #1
0
def appointment_book_ajax_view(request):
    appointment = {}
    template = 'appointment/partials/confirmation_modal_content.html'
    dealer_factory = DealerShipServicesFactory()
    aptservice = dealer_factory.get_instance("appointment")
    if request.method == 'POST':
        aptservice = AppointmentService()
        #try:

        data = {}
        for key, value in request.POST.iteritems():
            if key == "start_time":
                #value = datetime.datetime.strptime(value, '%b. %d, %Y, %I:%M %p')
                value = datetime.datetime.strptime(value, '%Y-%m-%d %H:%M')
                value = timezone.make_aware(value)
            data[key] = value
        aptservice = AppointmentService()
        context = aptservice.create_update_appointment(data)

        aptservice.book_appointment_with_id(request.POST.get('id'),
                                            request.session["dealer_id"])
        appointment = aptservice.get_appointment_by_id(request.POST.get('id'))
        print appointment
        #except Exception, ex:
        #pass

    return render(request, template, appointment)
Пример #2
0
def save_advisor(request, dealer_code):
    customer_factory = CustomerServicesFactory()
    dealer_factory = DealerShipServicesFactory()
    resp = True
    user = None
    dealer_service = dealer_factory.get_instance(
        "dealership")  #DealerShipService()
    dealership = dealer_service.get_dealer_by(
        request.session.get("dealer_code"))
    rtype = request.GET.get("type", "appointment")
    if rtype == "appointment":
        #         if request.GET.get("advisor_id"):
        try:
            appointment_id = request.GET.get("appointment_id")

            service = AppointmentService()
            appointment = service.get_appointment(appointment_id)
            advisor_id = request.GET.get("advisor_id", appointment.advisor_id)
            save_advisor = service.save_advisor(appointment, advisor_id)
            cservice = customer_factory.get_instance("user")  #CUserService()
            if save_advisor:
                resp = True
            print appointment.customer.id
            print dealership.id
            print advisor_id
            save = cservice.save_my_advisor(appointment.customer.id,
                                            dealership.id, advisor_id)
            if save == False:
                resp = False
        except Exception, e:
            print e
Пример #3
0
def overview(request):
    searchform = SearchCustomerForm()
    aptservice = AppointmentService()
    breadcrumb = ["Today's Overview", "Daily View"]
    meters = aptservice.get_meters_data()
    template = 'overview/index.html'
    return render(request, template, {'breadcrumb':breadcrumb, 'meters':meters, 'searchform':searchform})
Пример #4
0
def appointment(request):
    searchform = SearchCustomerForm()
    custform = CustomerGuestAccountForm()
    vehicleform = CustomerVehichleForm()
    apptform = GuestAppointmentForm()
    guestform = GuestAccountForm()
    aptservice = AppointmentService()
    dealer_factory = DealerShipServicesFactory()
    dealer_service = dealer_factory.get_instance("dealership")
    vehicle_service = dealer_factory.get_instance("vehicle")
    dealer = dealer_service.get_dealer_by(request.session.get("dealer_code"))
    vehichles = vehicle_service.get_vehichles_dealer(dealer)
    vehicles = list(vehichles)
    breadcrumb = BreadCrumb()
    breadcrumb = breadcrumb.create_breadcrumb(["appointment"])
    status = aptservice.get_appointments_status()
    wayaway = aptservice.get_wayaway()
    advisors = aptservice.get_appointments_advisor(
        request.session["dealer_id"])
    wallboard = aptservice.get_appointments_wallboard_data(
        request.session["dealer_id"])
    template = 'appointment/index.html'
    qstring = {}
    for key, value in request.GET.iteritems():
        qstring[key] = value

    dealer_service = dealer_factory.get_instance("dealership")
    favorites = dealer_service.get_dealer_favorites(
        request.session["dealer_id"])

    config = {
        "username": request.user,
        "dealer_code": request.session["dealer_code"],
        "dealer_name": request.session["dealer_name"],
        "dealer_id": request.session["dealer_id"],
        "group": request.session["group"],
        "tab": "appointment",
        "CENTRIFUGE_URL": settings.CENTRIFUGE_URL,
        "CENTRIFUGE_SECRET": settings.CENTRIFUGE_SECRET
    }

    return render(
        request, template, {
            'config': config,
            "favorites": favorites,
            'breadcrumb': breadcrumb,
            'wallboard': wallboard,
            'searchform': searchform,
            'qstring': qstring,
            'searchform': searchform,
            'custform': custform,
            'guestform': guestform,
            'vehicleform': vehicleform,
            'apptform': apptform,
            'vehicles': mainjson.dumps(vehicles),
            'status': status['data'],
            'wayaway': wayaway['data'],
            'advisors': advisors,
            'qstring': qstring
        })
Пример #5
0
def time_weekly_slab_ajax_view(request):
    template = 'mobilecheckin/appoinments/time_weekly_slab.html'
    context = {}
    if request.method == 'POST': 
        aptservice = AppointmentService()
        context = aptservice.get_appoiontments_by_time(request.POST.get('year'),request.POST.get('month'),request.POST.get('day'),request.POST.get('hour'),request.POST.get('minute'))      
        context["id"] = request.POST.get('id')
    return render(request, template, context)
Пример #6
0
def appointment_row_ajax_view(request):
    template = 'mobilecheckin/appoinments/time_daily_row.html'
    context = {}
    if request.method == 'POST': 
        aptservice = AppointmentService()
        context = {'row':aptservice.get_appointment_by_id(request.POST.get('id'))}    
        print context
    return render(request, template, context)
Пример #7
0
def status_daily_slab_ajax_view(request):
    template = 'mobilecheckin/appointments/time_daily_slab.html'
    context = {}
    print "new function "
    if request.method == 'POST': 
        aptservice = AppointmentService()
        context = aptservice.get_appointments_by_status(request.POST.get('year'),request.POST.get('month'),request.POST.get('day'),request.POST.get('id'), request.POST.get('title'))      
        print context   
    return render(request, template, context)
Пример #8
0
def advisor_ajax_view(request):
    #template = 'overview/daily_slab.html'
    context = {}
    #print "old function "
    if request.method == 'POST': 
        aptservice = AppointmentService()
        context = aptservice.get_appointments_advisor()     
        #context['id'] = request.POST.get('id')    
    #return render(request, template, context)
    return JsonResponse(context)
Пример #9
0
def appointment_detail_ajax_view(request):
    template = 'mobilecheckin/appointments/detail.html'
    context = {}
    if request.method == 'POST': 
        aptservice = AppointmentService()
        id = request.POST.get('id')
        print id
        row  = aptservice.get_appointment_by_id(id)
        context = {"id": request.POST.get('id'), "row": row }#aptservice.get_appointment_by_id(request.POST.get('id'));     
    return render(request, template, context)
Пример #10
0
def appointment_time_ajax_view(request):

    template = 'appointment/time.html'
    grid_data = {}
    if request.method == 'POST':
        aptservice = AppointmentService()
        grid_data = aptservice.get_weekly_time_grid(
            request.POST.get('appt_id'), request.POST.get('date'),
            request.session["dealer_id"])
    return render(request, template, {'grid_data': grid_data})
Пример #11
0
def appointment_create_update(request):
    context = {}
    if request.method == 'POST':
        data = {}
        for key, value in request.POST.iteritems():
            if key == "start_time":
                #value = datetime.datetime.strptime(value, '%b. %d, %Y, %I:%M %p')
                value = datetime.datetime.strptime(value, '%Y-%m-%d %H:%M')
                value = timezone.make_aware(value)

            data[key] = value
        aptservice = AppointmentService()
        context = aptservice.create_update_appointment(data)
    return JsonResponse(context)
Пример #12
0
 def get_instance(self, name):
     if name == "user":
         return UserService()
     elif name == "vehicle":
         return VehicleService()
     elif name == "dealership":
         return DealerShipService()
     elif name == "repair":
         return RepairService()
     elif name == "appointment":
         return AppointmentService()
     elif name == "wayaway":
         return WayAwayService()
     elif name == "notification":
         return NotificationService()
     elif name == "capacity":
         return CapacityService()
     elif name == "email":
         return EmailService()
Пример #13
0
def meters_ajax_view(request):
    aptservice = AppointmentService()
    meters = aptservice.get_meters_data()
    template = 'dealership/app/meters.html'
    return render(request, template, {'meters':meters})
Пример #14
0
def status_ajax_view(request):
    context = {}
    if request.method == 'POST': 
        aptservice = AppointmentService()
        context = aptservice.get_appointments_status()     
    return JsonResponse(context)