Exemplo n.º 1
0
def wa_sub_services():
    if  'full_name' in session:
        _id_sub_customer = request.args.get('index')
        _entity = None
        _data_services = serviceController().get_services_wa()
        if _id_sub_customer is not None:
            print(_id_sub_customer)
            _entity = serviceController().get_sub_service_by_id_wa(_id_sub_customer)
        return render_template('wa_sub_services.html', sub_service = _entity, data_services= _data_services)
    else:
        return redirect('/wa_login')
Exemplo n.º 2
0
def wa_list_sub_services():
    if  'full_name' in session:
        _id_service = request.args.get("iSlServicio")
        if _id_service is None:
            _id_service = 0
        print(_id_service)
        _data_sub_services = serviceController().get_sub_services_wa(_id_service)
        _data_services = serviceController().get_services_wa()
        return render_template('wa_list_sub_services.html',data_sub_services = _data_sub_services, data_services= _data_services)
    else:
        return redirect('/wa_login')
Exemplo n.º 3
0
def wa_sub_services_post():
    if  'full_name' in session:
        _entity = subServiceEntity()
        _entity.id = request.form.get("idtxtSubService")
        _id_service = request.form.get("iSlServicio")
        _entity.full_name = request.form.get("idTxtFullName")
        _entity.in_filter = request.form.get("idSlEnFiltro")
        _status = request.form.get("idSlEstado")
        if _entity.id is None:
            serviceController().add_sub_service(_entity,_id_service,_status)
        else:
            serviceController().update_sub_service(_entity,_id_service,_status)
        return redirect('/wa_list_sub_services')
    else:
        return redirect('/wa_login')
Exemplo n.º 4
0
def wa_list_services():
    if 'full_name' in session:
        _data_services = serviceController().get_services_wa()
        return render_template('wa_list_services.html',
                               data_services=_data_services)
    else:
        return redirect('/wa_login')
Exemplo n.º 5
0
def upload_image():
    if request.method == "POST":
        if request.files:
            image = request.files["image"]
            print('1')
            print(image)    
            print(os.path.join(app.config["IMAGE_UPLOADS"]))
            print(image.filename)
            print(os.path.join(app.config["IMAGE_UPLOADS"], image.filename))
            path_image = os.path.join(app.config["IMAGE_UPLOADS"], image.filename)
            image.save(os.path.join(app.config["IMAGE_UPLOADS"], image.filename))   
            print('2')               
            with open(path_image,"rb") as f:
                z=f.read()
                print(z)
                serviceController().update_file_image(1,z)                        
            return redirect(request.url)
    return render_template("upload_image.html")
Exemplo n.º 6
0
def wa_services():
    if  'full_name' in session:
        _id_service = request.args.get('index')
        _entity = None
        if _id_service is not None:
            _entity = serviceController().get_service_by_id_wa(_id_service)
        return render_template('wa_services.html', service = _entity)
    else:
        return redirect('/wa_login')
Exemplo n.º 7
0
def wa_services_post():
    if  'full_name' in session:
        _entity = serviceEntity()
        _entity.full_name = request.form["idTxtFullName"]
        _entity.color = request.form["idtxtColor"]
        _entity.id = request.form.get("idtxtService")
        _status = request.form.get("idSlEstado")
        if _entity.id is None:
            if request.files:
                image = request.files["idFileImage"]
                path_image = os.path.join(app.config["IMAGE_UPLOADS"], image.filename)
                image.save(path_image) 
                with open(path_image,"rb") as f:
                    _file_image=f.read()
                    _entity.file_image = _file_image
            serviceController().add_service(_entity)
        else:
            serviceController().update_service(_entity,_status)
            if request.files and request.files.get("idFileImage") is not None :
                image = request.files["idFileImage"]
                if image.filename:
                    path_image = os.path.join(app.config["IMAGE_UPLOADS"], image.filename)
                    image.save(path_image) 
                    with open(path_image,"rb") as f:
                        _file_image=f.read()
                    serviceController().update_file_image(_entity.id,_file_image)
        return redirect('/wa_list_services')
    else:
        return redirect('/wa_login')
Exemplo n.º 8
0
def get_sub_services_by_id_service_and_id_user():
    return serviceController().get_sub_services_by_id_service_and_id_user(request)
Exemplo n.º 9
0
def get_services_by_user(index):
    return serviceController().get_services_by_user(index)
Exemplo n.º 10
0
def get_services():
    return serviceController().get_services()