Example #1
0
 def get(self):
     """Simply returns a rendered template with an enigmatic salutation."""
     upload_url = blobstore.create_upload_url('/upload')
     auth_session = None
     if 'id' in self.auth_session:
         auth_session = self.auth_session
     
     template_values = {
         'uploadurl' : upload_url,
         'auth_session': auth_session,
         'current_user': self.auth_current_user,
         'login_url':    self.auth_login_url(),
         'logout_url':   self.auth_logout_url(),
         'current_url':  self.request.url
     }
     if self.session.get('client') is not None:
         template_values['client'] = ClientModel.get(self.session.get('client'))
         
         history = JobHistoryModel.all()
         history.filter("Client =", ClientModel.get(self.session.get('client')))
         history.order("-Created")
         history.fetch(100);
         template_values['history'] = history
         
         jobs = JobModel.all()
         jobs.filter("Client =", ClientModel.get(self.session.get('client')))
         jobs.order("-Changed")
         jobs.fetch(100)
         template_values['jobs'] = jobs
         logging.log(logging.INFO, "client " + ClientModel.get(self.session.get('client')).Name + " has " + str(template_values['jobs'].count()) + " jobs")
         
     return self.render_response('clientlanding.html', **template_values)
Example #2
0
    def get(self, **kwargs):

        if not self.auth_current_user.is_admin and not self.auth_current_user.is_staff:
            return redirect(url_for('auth/login'))
        
        clientid = kwargs['clientid']
        jobs = JobModel.all()
        jobs.filter("Client = ", ClientModel.get(clientid))
        jobs.filter("Invoiced != " , True)
        context = []
        if self.request.is_xhr:
            for job in jobs:
                os = None
                js = None
                if job.OrderStage and lstOrderStages[job.OrderStage]: 
                    os = lstOrderStages[job.OrderStage]
                if job.JobStage:
                    js = lstJobStages[job.JobStage]
                    
                context.append({
                                'name' : job.Nickname, 
                                'jobstage': js, 
                                'orderstage': os, 
                                'id' : str(job.key()), 
                                'created': job.Created.strftime("%b %d %Y"), 
                                'quote' : job.Quote 
                                });
            return render_json_response(context)
        else:
            return render_response('hello.html', **context)
Example #3
0
    def get(self, **kwargs):
        auth_session = None
        if 'id' in self.auth_session:
            auth_session = self.auth_session

        template_values = {
            'auth_session': auth_session,
            'current_user': self.auth_current_user,
            'login_url': self.auth_login_url(),
            'logout_url': self.auth_logout_url(),
            'current_url': self.request.url
        }
        try:
            if kwargs['view'] is not None:
                template_values['view'] = kwargs['view']
        except:
            template_values['view'] = None

        if self.session.get('client') is not None:
            template_values['client'] = ClientModel.get(
                self.session.get('client'))
            history = JobHistoryModel.all()
            history.filter("Client =",
                           ClientModel.get(self.session.get('client')))
            history.order("-Created")
            history.fetch(100)
            template_values['history'] = history

            jobs = JobModel.all()
            jobs.filter("Client =",
                        ClientModel.get(self.session.get('client')))
            try:
                if kwargs['order']:
                    jobs.order(kwargs['order'])
                else:
                    jobs.order('OrderStage')
            except:
                jobs.order('OrderStage')

            template_values['jobs'] = jobs
            template_values['StatusInfo'] = {
                'OrderStages': OrderStatus(),
                'JobStages': JobStatus(),
                'allOrderStages': lstOrderStages,
                'allJobStages': lstJobStages
            }

        return self.render_response('clientlanding.html', **template_values)
Example #4
0
 def post(self, **kwargs):
     if not self.auth_current_user.is_admin and not self.auth_current_user.is_staff:
         return redirect(url_for('auth/login'))       
     if self.request.form.get('invoiceid'):
         invoice = InvoiceModel.get(self.request.form.get('invoiceid'))
         invoice.Paid = True
         invoice.put()       
         jobs = JobModel.all()
         jobs.filter("Invoice = ", invoice)
         for job in jobs: 
             job.OrderStage = OrderStatus.Paid
             job.put()
         
         context = {'invoiced': True }
         if self.request.is_xhr:
             return render_json_response(context)
Example #5
0
    def get(self, **kwargs):
        auth_session = None
        if 'id' in self.auth_session:
            auth_session = self.auth_session
        
        template_values = {
            'auth_session': auth_session,
            'current_user': self.auth_current_user,
            'login_url':    self.auth_login_url(),
            'logout_url':   self.auth_logout_url(),
            'current_url':  self.request.url
        }
        try:
            if kwargs['view'] is not None:
                template_values['view'] = kwargs['view']
        except: 
            template_values['view'] = None
            
            
        if self.session.get('client') is not None:
            template_values['client'] = ClientModel.get(self.session.get('client'))
            history = JobHistoryModel.all()
            history.filter("Client =", ClientModel.get(self.session.get('client')))
            history.order("-Created")
            history.fetch(100);
            template_values['history'] = history
            
            jobs = JobModel.all()
            jobs.filter("Client =", ClientModel.get(self.session.get('client')))
            try:
                if kwargs['order']:     
                    jobs.order(kwargs['order'])
                else:   
                    jobs.order('OrderStage')
            except: 
                jobs.order('OrderStage')
                

            template_values['jobs'] = jobs
            template_values['StatusInfo'] = {
                                    'OrderStages': OrderStatus(), 
                                    'JobStages' : JobStatus(), 
                                    'allOrderStages' : lstOrderStages, 
                                    'allJobStages' : lstJobStages
                                    }
            
        return self.render_response('clientlanding.html', **template_values)
Example #6
0
    def get(self):
        """Simply returns a rendered template with an enigmatic salutation."""
        upload_url = blobstore.create_upload_url('/upload')
        auth_session = None
        if 'id' in self.auth_session:
            auth_session = self.auth_session

        template_values = {
            'uploadurl': upload_url,
            'auth_session': auth_session,
            'current_user': self.auth_current_user,
            'login_url': self.auth_login_url(),
            'logout_url': self.auth_logout_url(),
            'current_url': self.request.url
        }
        if self.session.get('client') is not None:
            template_values['client'] = ClientModel.get(
                self.session.get('client'))

            history = JobHistoryModel.all()
            history.filter("Client =",
                           ClientModel.get(self.session.get('client')))
            history.order("-Created")
            history.fetch(100)
            template_values['history'] = history

            jobs = JobModel.all()
            jobs.filter("Client =",
                        ClientModel.get(self.session.get('client')))
            jobs.order("-Changed")
            jobs.fetch(100)
            template_values['jobs'] = jobs
            logging.log(
                logging.INFO,
                "client " + ClientModel.get(self.session.get('client')).Name +
                " has " + str(template_values['jobs'].count()) + " jobs")

        return self.render_response('clientlanding.html', **template_values)
Example #7
0
    def get(self, **kwargs):
        if not self.auth_current_user.is_admin and not self.auth_current_user.is_staff:
            return redirect(url_for('auth/login'))
        
        kwargs['client'] = ClientModel.get(kwargs['clientid'])
#        kwargs['history'] = db.Query("SELECT * FROM JobHistoryModel WHERE Client=:client ORDER BY Created LIMIT 30", client=ClientModel.get(kwargs['clientid']))
        history = JobHistoryModel.all()
        history.filter("Client =", ClientModel.get(kwargs['clientid']))
        history.order("-Created").fetch(200)
        kwargs['history'] = history
        kwargs['stages'] = lstStages
        kwargs['stagesEnum'] = Stages()
        jobs = JobModel.all()
        jobs.filter("Client =", ClientModel.get(kwargs['clientid']))
        try:
            if kwargs['order']:     
                jobs.order(kwargs['order'])
            else: 
                jobs.order('Stage')
        except: 
            jobs.order('Stage')
        kwargs['jobs'] = jobs
        return self.render_response('adminclient.html', **kwargs)
Example #8
0
    def get(self, **kwargs):
        if not self.auth_current_user.is_admin and not self.auth_current_user.is_staff:
            return redirect(url_for('auth/login'))
        
        kwargs['history'] = JobHistoryModel.all().order('-Created').fetch(20)
        for h in kwargs['history']:
            h.Created = h.Created.replace(tzinfo=pytz.timezone('US/Eastern')).astimezone(timezone("US/Eastern"))

        kwargs['StatusInfo'] = {
                                    'OrderStages': OrderStatus(), 
                                    'JobStages' : JobStatus(), 
                                    'allOrderStages' : lstOrderStages, 
                                    'allJobStages' : lstJobStages
                                    }
        jobs = JobModel.all()
        
        try:
            if kwargs['order']:     
                jobs.order(kwargs['order'])
            else: 
                jobs.order('OrderStage')
        except: 
            jobs.order('OrderStage')
            
        try: 
            if kwargs['clientid']:
                jobs.filter("Client = " , ClientModel.get(kwargs['clientid']))
        except:
            pass
        
        kwargs['jobs'] = jobs
        kwargs['clients'] = ClientModel.all()
        for job in kwargs['jobs']:
            job.Created = job.Created.replace(tzinfo=pytz.timezone('US/Mountain')).astimezone(timezone("US/Mountain"))
            
        return self.render_response('admindashboard.html', **kwargs)