Exemplo n.º 1
0
def getAllFrequency():
    global action
    global response
    
    form = FrequencyTypeForm(request.form)
    if form.validate_on_submit():
        action = 'save'
        response = services.saveFrequencyType(current_user.parking.identificationCode, form.description.data, form.type.data, form.time.data, int(form.timeType.data), form.priority.data, form.combinablePreviousFrequency.data)
        cleanFields(response, form)

    frequencyTypeList = services.getAllFrequencyType(current_user.parking.identificationCode)
    
    rt = render_template('abm-frequency.html', form=form, frequencyTypeList=frequencyTypeList, action=action, response=response)
    
    action = None
    response = None
    
    return rt    
Exemplo n.º 2
0
def updateFrequencyType(id):
    global action
    global response

    frequencyTypeSelected = services.findFrequencyTypeById(current_user.parking.identificationCode, id)

    form = FrequencyTypeForm(request.form, description=frequencyTypeSelected.description, timeType=frequencyTypeSelected.timeType.id, time=frequencyTypeSelected.time, type=frequencyTypeSelected.type.id, priority=frequencyTypeSelected.priority, combinablePreviousFrequency=frequencyTypeSelected.combinablePreviousFrequency)
    if form.validate_on_submit():
        action = 'update'
        response = services.updateFrequencyType(current_user.parking.identificationCode, id, form.description.data, form.timeType.data, form.time.data, form.type.data, form.priority.data, form.combinablePreviousFrequency.data)
        return redirect(url_for('.getAllFrequency'))

    frequencyTypeList = services.getAllFrequencyType(current_user.parking.identificationCode)
    
    rt = render_template('abm-frequency.html', form=form, frequencyTypeList=frequencyTypeList, action=action, response=response)
    
    action = None
    response = None
    
    return rt
Exemplo n.º 3
0
    def loadFrequencyTypeValues(self):
        self.frequency.choices = [("999", "Seleccione")]

        for frequencyTypeValue in services.getAllFrequencyType(current_user.parking.identificationCode).frequencies:
            self.frequency.choices.append(( str(frequencyTypeValue.id).decode('base64'), frequencyTypeValue.description))