def action(request, id): if request.POST.get('buton') == 'submeter': fun = funcionario.objects.get(id=id) fun.status = request.POST.get('lib') fun.save() m1 = msg(num_cham=00, ator=request.user.username, msg=request.POST.get('messa'), tipo="lib", id_col=id) m1.id = None m1.save() #subject, from_email, to = 'Solicitação da Sig Combibloc para a '+ Contato, settings.EMAIL_HOST_USER, '*****@*****.**' #text_content = 'This is an important message.' #html_content = '<head><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style type="text/css" rel="stylesheet" media="all">body{width:100%!important;height:100%;margin:0;line-height:1.4;background-color:#F2F4F6;color:#74787E;-webkit-text-size-adjust:none}body{width:100%!important;height:100%;margin:0;line-height:1.4;background-color:#F2F4F6;color:#74787E;-webkit-text-size-adjust:none}.email-wrapper{width:100%;margin:0;padding:0;background-color:#F2F4F6}.email-content{width:100%;margin:0;padding:0}.email-masthead{padding:25px0;text-align:center}.email-masthead_logo{max-width:400px;border:0}.email-masthead_name{font-size:16px;font-weight:bold;color:#2F3133;text-decoration:none;text-shadow:01px0white}.email-logo{max-height:50px}.email-body{width:100%;margin:0;padding:0;border-top:1pxsolid#EDEFF2;border-bottom:1pxsolid#EDEFF2;background-color:#FFF}.email-body_inner{width:570px;margin:0auto;padding:0}.email-footer{width:570px;margin:0auto;padding:0;text-align:center}.email-footerp{color:#AEAEAE}.body-action{width:100%;margin:30pxauto;padding:0;text-align:center}.body-dictionary{width:100%;overflow:hidden;margin:20pxauto10px;padding:0}.body-dictionarydd{margin:0010px0}.body-dictionarydt{clear:both;color:#000;font-weight:bold}.body-dictionarydd{margin-left:0;margin-bottom:10px}.body-sub{margin-top:25px;padding-top:25px;border-top:1pxsolid#EDEFF2;table-layout:fixed}.body-suba{word-break:break-all}.content-cell{padding:35px;background-image:linear-gradient( rgba(255,255,255,.7) 0%,rgba(255,255,255,.7) 100%),url("")}.align-right{text-align:right}h1{margin-top:0;color:#2F3133;font-size:19px;font-weight:bold}h2{margin-top:0;color:#2F3133;font-size:16px;font-weight:bold}h3{margin-top:0;color:#2F3133;font-size:14px;font-weight:bold}blockquote{margin:1.7rem0;padding-left:0.85rem;border-left:10pxsolid#F0F2F4}blockquotep{font-size:1.1rem;color:#999}blockquotecite{display:block;text-align:right;color:#666;font-size:1.2rem}cite{display:block;font-size:0.925rem}cite:before{content:"2014020"}p{margin-top:0;color:#74787E;font-size:16px;line-height:1.5em}p.sub{font-size:12px}p.center{text-align:center}table{width:100%}th{padding:0px5px;padding-bottom:8px;border-bottom:1pxsolid#EDEFF2}thp{margin:0;color:#9BA2AB;font-size:12px}td{padding:10px5px;color:#74787E;font-size:15px;line-height:18px}.content{align:center;padding:0}.data-wrapper{width:100%;margin:0;padding:35px0}.data-table{width:100%;margin:0}.data-tableth{text-align:left;padding:0px5px;padding-bottom:8px;border-bottom:1pxsolid#EDEFF2}.data-tablethp{margin:0;color:#9BA2AB;font-size:12px}.data-tabletd{padding:10px5px;color:#74787E;font-size:15px;line-height:18px}.button{display:inline-block;width:200px;background-color:#3869D4;border-radius:3px;color:#fff;font-size:15px;line-height:45px;text-align:center;text-decoration:none;-webkit-text-size-adjust:none;mso-hide:all}@mediaonlyscreenand(max-width:600px){.email-body_inner,.email-footer{width:100%!important}}@mediaonlyscreenand(max-width:500px){.button{width:100%!important}}</style></head><body dir="ltr"><table class="email-wrapper" width="100%" cellpadding="0" cellspacing="0"><tr><td class="content"><table class="email-content" width="100%" cellpadding="0" cellspacing="0"><tr><td class="email-masthead"><a class="email-masthead_name" href="https://example-hermes.com/" target="_blank"><img src="https://uploaddeimagens.com.br/images/001/404/729/original/SIG_1.png?1525586751" class="email-logo" /></a></td></tr><tr><td class="email-body" width="100%"><table class="email-body_inner" align="center" width="570" cellpadding="0" cellspacing="0"><tr><td class="content-cell"><h1>Olá ' +Contato+ ',</h1><p>A <strong>SIG COMBIBLOC </strong>solicitou sua empresa com interesse na realização de serviços. Por favor acesse o link aseguir para concluir esse cadastramento.</p><p>Para o primeiro acesso utilize os dados: <strong></br>login:</strong> '+post1.username+' </br><strong>senha:</strong> 1234qwer</p><table><thead><tr><td><a align="center" href=""><h1>LINK DE ACESSO</h1> </a></td></tr></tbody></table><hr /><p>Em caso de dúvidas entre em contato por: <a href="mailto:[email protected]">[email protected]</a> ou pelo telefone: (41)XXXX-XXXX" ou (41)XXXX-XXXX</p><p>Best Regards / Atenciosamente,<br /> Setor HSE-Sig Combibloc</p></td></tr></table></td></tr><tr><td><table class="email-footer" align="center" width="570" cellpadding="0" cellspacing="0"><tr><td class="content-cell"><p class="sub center" style="color:blue"> <strong><h2>SIG Combibloc do Brasil Ltda.</h2></strong><p style="color:blue">Rodovia BR 277 - 120,4 KM</p><p style="color:blue">83605-590 - Campo Largo - Paraná / Brasil</p></p></td></tr></table></td></tr></table></td></tr></table>' #msg = EmailMultiAlternatives(subject, text_content, from_email, ['*****@*****.**',post1.username]) #msg.attach_alternative(html_content, "text/html") #msg.send() Forr = encoder(str(id)) print(Forr) return redirect('documentosHse', Forr) else: doc = request.POST.get('nome_documento') sel = request.POST.get('sel') validade = request.POST.get('Validade') if sel == "nada": Forr = encoder(str(id)) return redirect('documentosHse', Forr) else: obj = documento.objects.get(funcionario=id, nome_documento=doc) obj.validade_documento = validade obj.hse = sel obj.save() Forr = encoder(str(id)) return redirect('documentosHse', Forr)
def doc_integracao(request, id): try: el = docs_integracao.objects.get(funcionario=id) except: el = None if el: el.delete() if request.method == 'POST': form = doc_Int_Form(request.POST, request.FILES) print(form.errors) print(request.FILES.get('arquivo')) if form.is_valid(): post = form.save(commit=False) post.arquivo = request.FILES.get('arquivo') post.funcionario = id post.validade_documento = datetime.strptime( request.POST.get('validade_documento'), "%d/%m/%Y").date() post.save() obj = funcionario.objects.get(id=id) print(obj) print(obj.data_int) obj.data_int = datetime.strptime( request.POST.get('validade_documento'), "%d/%m/%Y").date() obj.save() print( datetime.strptime(request.POST.get('validade_documento'), "%d/%m/%Y").date()) For = encoder(str(id)) return redirect('documentosHse', For) else: For = encoder(str(id)) return redirect('documentosHse', For)
def message_hse(request, id, num): if request.method == 'POST': form = msgForm(request.POST) print(form.errors) if form.is_valid(): post = form.save(commit=False) post.data = timezone.now() post.tipo = "123" post.id_col = "123" post.ator = request.user.username post.save() log = logs(num_cham=str(num), ator=request.user.username, acao=request.POST.get("msg"), tipo="msg") log.id = None log.save() aux1 = encoder(str(num)) aux2 = encoder(str(id)) return redirect('view_cham_hse', aux1, aux2) else: form = msgForm() aux1 = encoder(str(num)) aux2 = encoder(str(id)) return redirect('view_cham_hse', aux1, aux2)
def alter(request, num, id): el = chamado_hse.objects.get(id=num) el.status = "Aguardando HSE" el.resp_terc = request.POST.get('resp') el.save() print(el.status) aux1 = encoder(str(num)) aux2 = encoder(str(id)) return redirect('show_my_cham', aux1, aux2)
def include_col(request, id, num): lm = request.POST.get('num_cham') #recebe o número do chamado fun = request.POST.getlist('colab[]') # recebe os colaboradores selecionados key = request.POST.get('tps')#recebe o tipo de serviço relacionado arr1 = [] try: data = aux_table.objects.filter(num_cham = lm, tps = key) except: data = None if data: for rec in data: rec.delete() cont = 0 num_cham = lm for fb in fun: x = fb a,b = x.split(",") arr1.append(a) action = "" aux = (a +";") action = action + aux form = aux_tableForm(request.POST) print (form.errors) if form.is_valid(): post = form.save(commit=False) post.colab = a post.id_col = b post.save() y = action log = logs(num_cham=str(lm), ator=request.user.username, acao= str(arr1), tipo="add_col") log.id = None log.save() ab = encoder(str(num_cham)) cb = encoder(str(id)) return redirect('show_my_cham', ab, cb) else: num_cham = lm for fb in fun: x = fb a,b = x.split(",") arr1.append(a) form = aux_tableForm(request.POST) print (form.errors) print("adding:"+a+", with id:"+b) if form.is_valid(): post = form.save(commit=False) post.colab = a post.id_col = b post.save() log = logs(num_cham=str(lm), ator=request.user.username, acao= str(arr1), tipo="add_col") log.id = None log.save() ab = encoder(str(num_cham)) cb = encoder(str(id)) return redirect('show_my_cham', ab, cb)
def documentacao(request, idG, empG): id = decodif(idG) # id do funcionário emp = decodif(empG) # cód da empresa fun = funcionario.objects.get(id=id) resp = cad_resp.objects.get(id=fun.resp_id) print(resp) empr = empresa_terc.objects.get(id=emp) print(empr) print(fun.empresa_id) if request.method == 'POST': form = documentoForm(request.POST, request.FILES) print(form.errors) print(request.FILES.get('arquivo_documento')) if form.is_valid(): post = form.save(commit=False) post.arquivo_documento = request.FILES.get('arquivo_documento') post.funcionario = id post.email_resp = resp.email_resp post.email_emp = empr.email post.enviado = request.POST.get('enviado') post.nome_documento = request.POST.get('nome_documento') post.emp = request.POST.get('emp') post.save() fun.status = "AG" fun.save() aux1 = encoder(id) aux2 = encoder(emp) return redirect('documentacao', aux1, aux2) else: form = documentoForm() a_docs = docs.objects.filter(tipo="B").values_list('nome', flat=True) c_docs = docs.objects.filter(tipo="C") b_docs = docs.objects.all() envs = documento.objects.filter(funcionario=id) msgs = msg.objects.filter(id_col=id, tipo="lib") print(fun.data_int) return render( request, 'documentacao.html', { 'fun_data': fun.data_int, 'msgs': msgs, 'a_docs': a_docs, 'c_docs': c_docs, 'fun': fun, 'envs': envs, 'form': form, 'id': id, 'emp': emp })
def saveCham(request, num, id): mycham = chamado_hse.objects.get(id=num) mycham.status = request.POST.get('gr') mycham.save() emp = empresa_terc.objects.all() docs = documento.objects.filter(hse=1) subject, from_email, to = 'Alteração no Chamado' + str( id) + ', - Hse', settings.EMAIL_HOST_USER, '*****@*****.**' text_content = 'texto de chamados.' html_content = ' <head><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><style type="text/css" rel="stylesheet" media="all">body{width:100%!important;height:100%;margin:0;line-height:1.4;background-color:#F2F4F6;color:#74787E;-webkit-text-size-adjust:none}body{width:100%!important;height:100%;margin:0;line-height:1.4;background-color:#F2F4F6;color:#74787E;-webkit-text-size-adjust:none}.email-wrapper{width:100%;margin:0;padding:0;background-color:#F2F4F6}.email-content{width:100%;margin:0;padding:0}.email-masthead{padding:25px0;text-align:center}.email-masthead_logo{max-width:400px;border:0}.email-masthead_name{font-size:16px;font-weight:bold;color:#2F3133;text-decoration:none;text-shadow:01px0white}.email-logo{max-height:50px}.email-body{width:100%;margin:0;padding:0;border-top:1pxsolid#EDEFF2;border-bottom:1pxsolid#EDEFF2;background-color:#FFF}.email-body_inner{width:570px;margin:0auto;padding:0}.email-footer{width:570px;margin:0auto;padding:0;text-align:center}.email-footerp{color:#AEAEAE}.body-action{width:100%;margin:30pxauto;padding:0;text-align:center}.body-dictionary{width:100%;overflow:hidden;margin:20pxauto10px;padding:0}.body-dictionarydd{margin:0010px0}.body-dictionarydt{clear:both;color:#000;font-weight:bold}.body-dictionarydd{margin-left:0;margin-bottom:10px}.body-sub{margin-top:25px;padding-top:25px;border-top:1pxsolid#EDEFF2;table-layout:fixed}.body-suba{word-break:break-all}.content-cell{padding:35px;background-image:linear-gradient( rgba(255,255,255,.7) 0%,rgba(255,255,255,.7) 100%),url("")}.align-right{text-align:right}h1{margin-top:0;color:#2F3133;font-size:19px;font-weight:bold}h2{margin-top:0;color:#2F3133;font-size:16px;font-weight:bold}h3{margin-top:0;color:#2F3133;font-size:14px;font-weight:bold}blockquote{margin:1.7rem0;padding-left:0.85rem;border-left:10pxsolid#F0F2F4}blockquotep{font-size:1.1rem;color:#999}blockquotecite{display:block;text-align:right;color:#666;font-size:1.2rem}cite{display:block;font-size:0.925rem}cite:before{content:"2014020"}p{margin-top:0;color:#74787E;font-size:16px;line-height:1.5em}p.sub{font-size:12px}p.center{text-align:center}table{width:100%}th{padding:0px5px;padding-bottom:8px;border-bottom:1pxsolid#EDEFF2}thp{margin:0;color:#9BA2AB;font-size:12px}td{padding:10px5px;color:#74787E;font-size:15px;line-height:18px}.content{align:center;padding:0}.data-wrapper{width:100%;margin:0;padding:35px0}.data-table{width:100%;margin:0}.data-tableth{text-align:left;padding:0px5px;padding-bottom:8px;border-bottom:1pxsolid#EDEFF2}.data-tablethp{margin:0;color:#9BA2AB;font-size:12px}.data-tabletd{padding:10px5px;color:#74787E;font-size:15px;line-height:18px}.button{display:inline-block;width:200px;background-color:#3869D4;border-radius:3px;color:#fff;font-size:15px;line-height:45px;text-align:center;text-decoration:none;-webkit-text-size-adjust:none;mso-hide:all}@mediaonlyscreenand(max-width:600px){.email-body_inner,.email-footer{width:100%!important}}@mediaonlyscreenand(max-width:500px){.button{width:100%!important}}</style><style type="text/css">.tg{border-collapse:collapse;border-spacing:0}.tg td{font-family:Arial,sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black}.tg th{font-family:Arial,sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black}.tg .tg-t1lb{font-family:"Courier New",Courier,monospace!important;border-color:inherit;vertical-align:top}.tg .tg-gc4a{font-family:"Courier New",Courier,monospace!important;border-color:inherit;text-align:center}.tg .tg-ji20{font-family:"Courier New",Courier,monospace!important;border-color:inherit}</style></head><body dir="ltr"><table class="email-wrapper" width="100%" cellpadding="0" cellspacing="0"><tr><td class="content"><table class="email-content" width="100%" cellpadding="0" cellspacing="0"><tr><td class="email-masthead"><a class="email-masthead_name" href="https://example-hermes.com/" target="_blank"><img src="https://uploaddeimagens.com.br/images/001/404/729/original/SIG_1.png?1525586751" class="email-logo" /></a></td></tr><tr><td class="email-body" width="100%"><table class="email-body_inner" align="center" width="570" cellpadding="0" cellspacing="0"><tr><td class="content-cell"><h1>Olá ' + "NOME" + ',</h1><p class style="text-align:justify;">A <strong>SIG COMBIBLOC </strong>solicitou o envio dos documentos requisitados referentes á execução do Projeto: ######## abaixo bem como a continuidade do processo que deve ser concuído até ##/##/####. Evite atrasos, na devida liberação de acesso do pessoal que irá realizar as atividades solicitadas, todas as documentações exigidas deverão ser entreges conforme previsto.<br><strong>Solicitante :</strong>Diego do Nascimento<br><strong>Obs :</strong> Olá, conforme combinamos anteriormente, estou formalizando o processo de juntar as documentações referentes aos serviços que serão executados no projeto AMPLIAÇÃO BLOCO 3.<br> att, <br>Diego do Nascimento.</p><table class="tg"><tr><th class="tg-gc4a" rowspan="4">Solicitado: <span style="font-weight:bold;font-style:italic;color:rgb(254, 0, 0)">Trabalho em Altura</span><span style="font-style:italic;color:rgb(254, 0, 0)"> </span></th><th class="tg-3ib7"> Documentações Solicitadas</th></tr><tr><td class="tg-ji20">Cópia do treinamento NR 35<br>Duração mínima 8 horas</td></tr><tr><td class="tg-t1lb">Cópia ASO que deve contar eletroecefalograma<br>com especificação "Apto para trabalhar em altura"</td></tr><tr><td class="tg-t1lb">Ficha de EPI que evidenciar recebimento do cinto<br>de segurança com duplo balabarte, capacete e <br>respectivos CAs</td></tr></table><hr /><p>Em caso de dúvidas entre em contato por: <a href="mailto:[email protected]">[email protected]</a> ou pelos telefones: (41)XXXX-XXXX ; (41)XXXX-XXXX</p><p>Best Regards / Atenciosamente,<br /> Setor HSE-Sig Combibloc</p></td></tr></table></td></tr><tr><td><table class="email-footer" align="center" width="570" cellpadding="0" cellspacing="0"><tr><td class="content-cell"><p class="sub center" style="color:blue"> <strong><h2>SIG Combibloc do Brasil Ltda.</h2></strong><p style="color:blue">Rodovia BR 277 - 120,4 KM</p><p style="color:blue">83605-590 - Campo Largo - Paraná / Brasil</p></p></td></tr></table></td></tr></table></td></tr></table>' msg = EmailMultiAlternatives(subject, text_content, from_email, ['*****@*****.**', mycham.email_terc]) msg.attach_alternative(html_content, "text/html") msg.send() gth = encoder(num) hhy = encoder(id) return redirect('view_cham_hse', gth, hhy)
def message_fun(request, id): if request.method == 'POST': form = msgForm(request.POST) print (form.errors) if form.is_valid(): post = form.save(commit=False) post.data = timezone.now() post.ator = request.user.username post.save() log = logs(num_cham=str(num), ator=request.user.username, acao= request.POST.get("msg"), tipo="msg") log.id = None log.save() Forr = encoder(str(id)) return redirect('documentosHse', Forr) else: form = msgForm() For = encoder(str(id)) return redirect('documentosHse', For)
def message_sol(request, num, orig): if request.method == 'POST': form = msgForm(request.POST) bas = request.POST.getlist('ema[]') bas = list(set(bas)) for hn in bas: print(hn) print (form.errors) if form.is_valid(): post = form.save(commit=False) post.data = timezone.now() if request.POST.get('fun'): post.id_col = request.POST.get('fun') post.tipo = "lib" else: post.id_col = "123" post.tipo = "123" post.ator = request.user.username post.save() log = logs(num_cham=str(num), ator=request.user.username, acao= request.POST.get("msg"), tipo="msg") log.id = None log.save() if orig == "f_terc": pass else: obj = chamado_hse.objects.get(id=num) emp = empresa_terc.objects.all() if bas: context = { 'solicitante': request.user.username, 'emp': 'qwedsa', 'nome_proj': request.POST.get('nome_proj'), 'msg': request.POST.get("msg"), 'num': num, 'obj':obj, 'emp':emp, } message = EmailMessage('MSG_EMAIL.html', context, settings.EMAIL_HOST_USER, bas, render=True ) f = '/SIG_1.png' fp = open(os.path.join(os.path.dirname(__file__), f), 'rb') msg_img = MIMEImage(fp.read()) fp.close() msg_img.add_header('Content-ID', '<{}>'.format(f)) message.attach(msg_img) message.send() if orig == "ter": aux1 = encoder(str(num)) aux2 = encoder(request.POST.get('emp')) return redirect('show_my_cham', aux1, aux2) elif orig == "sol": aux1 = encoder(str(num)) return redirect('show_cham_sol', aux1) elif orig == "f_terc": aux1 = encoder(request.POST.get('fun')) aux2 = encoder(request.POST.get('empresa')) return redirect('documentacao', aux1, aux2) else: form = msgForm() aux1 = encoder(str(num)) return redirect('show_cham_sol', aux1)
def saveCham(request, num, id): mycham= chamado_hse.objects.get(id=num) if mycham.resp_terc: wq = mycham.resp_terc respo = cad_resp.objects.get(id= str(wq)) abc = respo.email_resp else: abc = "Res. não Informado" print(abc) mycham.status = request.POST.get('gr') mycham.save() aux = aux_table.objects.filter(num_cham=num) for el in aux: el.status = request.POST.get('gr') el.email_resp_cham = abc el.save() mycham.save() emp = empresa_terc.objects.all() docs = documento.objects.filter(hse=1) gth = encoder(str(num)) hhy = encoder(str(id)) return redirect('view_cham_hse', gth, hhy)
def action(request, id): if request.POST.get('buton') == 'submeter': Forr = encoder(str(id)) if request.POST.get('lib') == "BLOQ": return redirect('bloq_fun', Forr) fun = funcionario.objects.get(id=id) fun.status = request.POST.get('lib') fun.save() m1 = msg(num_cham=00, ator=request.user.username, msg=request.POST.get('messa'), tipo="lib", id_col=id) m1.id = None m1.save() #subject, from_email, to = 'Solicitação da Sig Combibloc para a '+ Contato, settings.EMAIL_HOST_USER, '*****@*****.**' #text_content = 'This is an important message.' #msg = EmailMultiAlternatives(subject, text_content, from_email, ['*****@*****.**',post1.username]) # #msg.attach_alternative(html_content, "text/html") #msg.send() Forr = encoder(str(id)) print(Forr) print('111') return redirect('documentosHse', Forr) else: doc = request.POST.get('nome_documento') sel = request.POST.get('sel') validade = request.POST.get('Validade') if sel == "nada": Forr = encoder(str(id)) print('222') return redirect('documentosHse', Forr) else: obj = documento.objects.get(funcionario=id, nome_documento=doc) obj.validade_documento = validade obj.hse = sel obj.save() Forr = encoder(str(id)) print('333') return redirect('documentosHse', Forr)