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 })
def status_ajax_view(request): context = {} if request.method == 'POST': aptservice = AppointmentService() context = aptservice.get_appointments_status() return JsonResponse(context)