Beispiel #1
0
def	Status(request):

    try:
	if CheckAccess(request,'23') != 'OK':
	    return render_to_response("mtmc/notaccess/mtmc.html")
    except:
	return HttpResponseRedirect('/')


    try:
	eq_id = request.session['eq_id']
    except:
	return HttpResponseRedirect('/mtmc')
	


    if request.method == 'POST':
	form = StatusForm(request.POST)
	if form.is_valid():
	    status = form.cleaned_data['status']
	    comment = form.cleaned_data['comment']
	    AddStatus(eq_id,status,comment,request)

    eq = GetEq(eq_id)

    form = StatusForm(None)

    data = GetStatusList(eq_id)
    
    c = RequestContext(request,{'form':form,'eq':eq,'data':data,'tmc':TmcUrl(eq)})
    c.update(csrf(request))
    return render_to_response("mtmc/status.html",c)
Beispiel #2
0
def change_status(request, task_id):
    status_form = StatusForm(request.POST)
    if status_form.is_valid():
        Task.objects.filter(
            pk=task_id).update(
            status=status_form.cleaned_data['status'])
    return redirect('/tasks/get/%s/' % task_id)
Beispiel #3
0
def add (request):
	form = StatusForm(request.POST or None)

	if request.method == 'POST' and form.is_valid():
		form.save()
		return HttpResponseRedirect('/status')

	context = RequestContext(request, {'form': form})
	return render_to_response('status/status_form.html', context)
Beispiel #4
0
def user_status(user_id):
    user = User.query.get_or_404(user_id)
    form = StatusForm(obj=user)
    if form.validate_on_submit():
        user.timestamp = datetime.datetime.utcnow()
        form.populate_obj(user)
        db.session.commit()
        flash('Successfully updated status for user: %s' % user.name)
        return redirect(url_for('index'))
    return render_template('user/status.html', form=form)
Beispiel #5
0
def status(request):

    if request.POST:
        form = StatusForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/status/')
    else:
        form = StatusForm()

    types = Status.objects.all()
    title = "Status Types"
    url = "status"

    return render(request, 'add.html', locals())
Beispiel #6
0
def update(request, id):
	status = Status.objects.get(pk=id)

	if request.method == 'POST':
		form = StatusForm(request.POST, instance=status)

		if form.is_valid():
			form.save()
			return HttpResponseRedirect('/status')

	else:
		form = StatusForm(instance=status)

	context = RequestContext(request, {'form': form, 'id': id})
	return render_to_response('status/status_edit.html', context)
Beispiel #7
0
def addStatus(request):

    if request.method == 'POST':
        # formulario enviado
        statusform = StatusForm(request.POST)

        if statusform.is_valid():
            # formulario validado correctamente
            statusform.save()
            return HttpResponseRedirect('/categorias/')

    else:
        # formulario inicial
        formset = StatusForm()

    return render_to_response('puntoventa/addProducto.html', { 'formset': StatusForm }, context_instance=RequestContext(request))
Beispiel #8
0
def status():
    form = StatusForm(csrf_enabled=False)
    if form.validate_on_submit():
        # query bookid here:
        st = Status.query.filter_by(bk_id=form.orderid.data)
        if not st is None:
            # login user here:
            ids = ['booked', 'started', 'wash', 'wheelcare', 'checkup']
            flash('Valid id')
            return render_template('display_details.html',
                                   cur_status=st,
                                   ids=ids)
        else:
            flash('Invalid id')
            return redirect(url_for('status', _external=True))
    return render_template('status.html', form=form)
def statEnt(canId):
    form=StatusForm()
    if request.method=='POST':
        #idc=request.form.get("Id")
        rd=request.form.get("rounds")
        st=request.form.get("stat")
        result1=db.execute("SELECT COUNT(id) FROM candidStat WHERE id=:id;",{"id":canId}).fetchone()[0]
        result2=db.execute("SELECT COUNT(id) FROM candid WHERE id=:id;",{"id":canId}).fetchone()[0]
            
        if(result1==0 and result2==1):
            db.execute(f"INSERT INTO candidStat(id,{rd}) VALUES(:id,:rounds);",
                                               {"id":int(canId),"rounds":st})    
            result=db.execute(f"SELECT c.id,c.name,c.email,c.phno,s.r1,s.r2,s.r3,s.r4,s.hr,s.os,s.joined FROM candid as c RIGHT JOIN candidStat as s ON c.id=s.id WHERE c.id={int(canId)};")
            details=result.fetchall()
            db.commit()
            flash(f'Entry done!','success')
            return render_template('dashboard.html',details=details)
        elif(result2==1 and result1!=0):
            db.execute(f"UPDATE candidStat SET {rd}=:st WHERE id={int(canId)};",{"st":st})
            result=db.execute(f"SELECT c.id,c.name,c.email,c.phno,s.r1,s.r2,s.r3,s.r4,s.hr,s.os,s.joined FROM candid as c RIGHT JOIN candidStat as s ON c.id=s.id WHERE c.id={int(canId)};")
            details=result.fetchall()
            db.commit()
            flash(f'Update done!','success')
            return render_template('dashboard.html',details=details)
    return render_template('statent.html',form=form)
Beispiel #10
0
def	Page4(request):


    if CheckAccess(request,'5') != 'OK':
	return render_to_response("notaccess.html")

    try:
	contract_id = request.session['contract_id']
    except:
	return HttpResponseRedirect('/contract')


    ### --- Проверка доступа именно к этой заявке ---
    if CheckAccess(request,'4') != 'OK' and CheckDAccess(GetUserKod(request),contract_id) != 'OK':
	return HttpResponseRedirect('/contract')



    if request.method == 'POST':
	form = StatusForm(request.POST)
	if form.is_valid():
	    comment = form.cleaned_data['comment']
	    status = form.cleaned_data['status']
	    r = NewDStatus(request,GetUserKod(request),contract_id,comment,status)
	    if r == 'OK':
		### --- Уведомление о статусе ---
		EmailStatusInfo(contract_id)
		### --- Уведомление согласующими ---
		if status == '2' or status == '3':
		    EmailToPerson(contract_id)

    ### --- Получение данных заявки ---
    data = GetDData(contract_id)

    ### --- Доступные статусы ---
    status_list = GetDStatusList(data[5])
    form = StatusForm()
    form.fields['status'].choices = status_list

    ### --- Получение истории статусов ---
    d = GetDStatus(contract_id)

    c = RequestContext(request,{'data':data,'form':form,'d':d})
    c.update(csrf(request))
    return render_to_response("contract/page4.html",c)
Beispiel #11
0
def manual_update():
    if app.config['AUTO_MODE']:
        flash('You cannot update an status in Automatic Mode!')
        return redirect(url_for('get_all_status'))

    form = StatusForm()
    if form.is_submitted():
        new_status = {
            'status': int(form.status.data),
            'message': str(form.message.data),
            'date': datetime.now().strftime("%d-%m-%Y %H:%M:%S"),
            'auto_mode': False
        }
        STATUS_LIST.append(new_status)
        save_status(new_status)
        return redirect(url_for('get_all_status'))

    return render_template('manual_update.html', form=form)
Beispiel #12
0
def update_status(request):
    user = check_validation(request)
    data = 'Kids Zone is Cool'
    if user:
        if request.method == "POST":
            form = StatusForm(request.POST)
            if form.is_valid():
                status = form.cleaned_data.get('status')
                user_name = user.username
                print user_name
                USER = User.objects.all().filter(username=user_name).first()
                USER.status = status
                # status_text=User(username=user_name,status=status)
                # status_text.save()
                # data=status
                print status + "is posted"

        return render(request, 'feed.html', {})

    else:
        return redirect('/login/')
Beispiel #13
0
def editstatus(request, status_id):
    types = get_object_or_404(Status, pk=status_id)
    t = "Edit"

    if request.POST:
        form = StatusForm(request.POST, instance=types)
        if form.is_valid():
            form.save()

            return HttpResponseRedirect('/status/')

    else:
        form = StatusForm(instance=types)

    types = Status.objects.all()
    title = "Edit Status Type"
    url = "status"

    return render_to_response("edit.html", {
            'form': form,
            't': t,
    }, context_instance=RequestContext(request, locals()))
Beispiel #14
0
def status():
	form = StatusForm()

	context = {
		'form': form,
	}

	if form.validate_on_submit():
		oid = form.order_id.data

		appointment = get_appointment(oid)
		apdict = appointment.to_dict()
		context = {
			'appointment': apdict,
		}

		if appointment.to_dict() is not None:

			return render_template('checking.html', **context)
		else:
			flash('No existe la orden {}'.format(oid))
	return render_template('status.html', **context)
Beispiel #15
0
def TmcData3(request):
    """
    if CheckAccess(request,'2') != 'OK':
	return render_to_response("tmc/notaccess/tmc.html")
    """

    ## --- Номер заявки ---
    try:
        tmc_id = request.GET['tmc_id']
        request.session['tmc_id'] = tmc_id
    except:
        pass

    try:
        tmc_id = request.session['tmc_id']
    except:
        return HttpResponseRedirect("/tmc")

    if request.method == 'POST':
        form = StatusForm(request.POST)
        if form.is_valid():
            comment = form.cleaned_data['comment']
            status = form.cleaned_data['status']
            r = NewTmcStatus(GetUserKod(request), tmc_id, comment, status)
            if r == 'OK':
                EmailStatusInfo(tmc_id)

    d = GetTmcData(tmc_id)
    data = GetStatusHistory(tmc_id)

    form = StatusForm(None)
    form.fields['status'].choices = GetStatusList(d[5])

    s = GetLastStatus(tmc_id)

    c = RequestContext(request, {'d': d, 'form': form, 'data': data, 's': s})
    c.update(csrf(request))
    return render_to_response("tmc/tmcdata3.html", c)
Beispiel #16
0
def	MyStatus(request):


    ### --- Получение кода учетной записи ---
    try:
	kod = GetUserKod(request)
    except:
	return render_to_response("notaccess.html")


    if request.method == 'POST':
	form = StatusForm(request.POST)
	if form.is_valid():
	    status = form.cleaned_data['status']
	    NewStatus(kod,status)
    ## --- Данные учетной записи ---
    r = GetRec(kod)

    form = StatusForm(None)

    c = RequestContext(request,{'form':form,'r':r})
    c.update(csrf(request))
    return render_to_response("mydata/status.html",c)
Beispiel #17
0
def manage_orders(status_id):
    if not session.get('current_user'):
        return redirect('/login')
    elif not session.get('current_user')['role_id'] == 1:
        return render_template('401.html')
    form = StatusForm(request.form)
    if request.method == 'POST':
        db.db_save(
            f'update border set Status_id={form.status.data} where id={request.args.get("ord_id")}'
        )

    query = f"""
            select distinct o.id, o.buser_id, o.payment_type, o.time , u.name, u.last_name, u.surname, u.phone , s.sname, o.price from border o
    full outer join buser u on o.buser_id = u.id inner join cart c on u.id = c.buser_id inner join Order_cart_rel ok
        on o.id = ok.border_id and c.id=ok.cart_id inner join  Service_cart_rel r on r.cart_id = c.id inner join
    service s on r.service_id = s.id and r.cart_id = c.id where o.status_id={status_id} and c.status_id=7 order by id;
"""

    db_data = db.db_get(query, cur_type='all')
    data = prepare_data(db_data)
    return render_template('orders.html',
                           data=data,
                           form=form,
                           status_id=status_id)
Beispiel #18
0
def add_edit_item(request, model_name, add_edit, edit_id):
    """Add/Edit page for the inventory"""
    if add_edit == "add":
        edit_id = None
    if _checkModel(model_name):
        directory = "asset_inventory/add_edit_Pages/"
        # Adding or Editing a Job
        if model_name == "Job":
            templateFile = directory + "Job.html"
            post_data = request.POST or None

            try:
                Job_Instance = Job.objects.get(pk=edit_id)
            except Job.DoesNotExist:
                Job_Instance = None
                if add_edit == "edit":
                    return HttpResponseRedirect(reverse("asset_inventory_add_edit_item", args=["Job", "add", "new"]))

            Job_Form = JobForm(post_data, instance=Job_Instance)

            if Job_Form.is_valid():
                Job_Occurance = Job_Form.save()
                return HttpResponseRedirect(reverse("asset_inventory_list_model", args=["Job"]))
            return render_to_response(templateFile, {"form": Job_Form}, context_instance=RequestContext(request))
        # Adding or Editing a Location
        elif model_name == "Location":
            templateFile = directory + "Location.html"
            post_data = request.POST or None

            try:
                Location_Instance = Location.objects.get(pk=edit_id)
            except Location.DoesNotExist:
                Location_Instance = None
                if add_edit == "edit":
                    return HttpResponseRedirect(
                        reverse("asset_inventory_add_edit_item", args=["Location", "add", "new"])
                    )

            Location_Form = LocationForm(post_data, instance=Location_Instance)

            if Location_Form.is_valid():
                Location_Occurance = Location_Form.save()
                return HttpResponseRedirect(reverse("asset_inventory_list_model", args=["Location"]))

            return render_to_response(templateFile, {"form": Location_Form}, context_instance=RequestContext(request))

        # Adding or Editing a Person
        elif model_name == "Person":
            templateFile = directory + "Person.html"
            post_data = request.POST or None

            try:
                Person_Instance = Person.objects.get(pk=edit_id)
            except Person.DoesNotExist:
                Person_Instance = None
                if add_edit == "edit":
                    return HttpResponseRedirect(reverse("asset_inventory_add_edit_item", args=["Person", "add", "new"]))

            Person_Form = PersonForm(post_data, instance=Person_Instance)

            if Person_Form.is_valid():
                Person_Occurance = Person_Form.save()
                return HttpResponseRedirect(reverse("asset_inventory_list_model", args=["Person"]))

            return render_to_response(templateFile, {"form": Person_Form}, context_instance=RequestContext(request))

        # Adding or Editing a Purchase
        elif model_name == "Purchase":
            templateFile = directory + "Purchase.html"
            post_data = request.POST or None

            try:
                Purchase_Instance = Purchase.objects.get(pk=edit_id)
            except Purchase.DoesNotExist:
                Purchase_Instance = None
                if add_edit == "edit":
                    return HttpResponseRedirect(
                        reverse("asset_inventory_add_edit_item", args=["Purchase", "add", "new"])
                    )

            Purchase_Form = PurchaseForm(post_data, instance=Purchase_Instance)

            if Purchase_Form.is_valid():
                Purchase_Occurance = Purchase_Form.save()
                return HttpResponseRedirect(reverse("asset_inventory_list_model", args=["Purchase"]))

            return render_to_response(templateFile, {"form": Purchase_Form}, context_instance=RequestContext(request))
        # Adding or Editing a Status
        elif model_name == "Status":
            templateFile = directory + "Status.html"
            post_data = request.POST or None

            try:
                Status_Instance = Status.objects.get(pk=edit_id)
            except Status.DoesNotExist:
                Status_Instance = None
                if add_edit == "edit":
                    return HttpResponseRedirect(reverse("asset_inventory_add_edit_item", args=["Status", "add", "new"]))

            Status_Form = StatusForm(post_data, instance=Status_Instance)

            if Status_Form.is_valid():
                Status_Occurance = Status_Form.save()
                return HttpResponseRedirect(reverse("asset_inventory_list_model", args=["Status"]))

            return render_to_response(templateFile, {"form": Status_Form}, context_instance=RequestContext(request))
        # Adding or Editing a Esign
        elif model_name == "Esign":
            templateFile = directory + "Esign.html"
            post_data = request.POST or None

            try:
                Esign_Instance = Esign.objects.get(pk=edit_id)
            except Esign.DoesNotExist:
                Esign_Instance = None
                if add_edit == "edit":
                    return HttpResponseRedirect(reverse("asset_inventory_add_edit_item", args=["Esign", "add", "new"]))

            Esign_Form = EsignForm(post_data, instance=Esign_Instance)

            if Esign_Form.is_valid():
                Esign_Occurance = Esign_Form.save()
                return HttpResponseRedirect(reverse("asset_inventory_list_model", args=["Esign"]))

            return render_to_response(templateFile, {"form": Esign_Form}, context_instance=RequestContext(request))
        # Adding or Editing a Device
        elif model_name == "Device":
            templateFile = directory + "Device.html"
            post_data = request.POST or None

            try:
                Device_Instance = Device.objects.get(pk=edit_id)
            except Device.DoesNotExist:
                Device_Instance = None
                if add_edit == "edit":
                    return HttpResponseRedirect(reverse("asset_inventory_add_edit_item", args=["Device", "add", "new"]))

            Device_Form = DeviceForm(post_data, instance=Device_Instance)

            if Device_Form.is_valid():
                Device_Occurance = Device_Form.save()
                return HttpResponseRedirect(reverse("asset_inventory_list_model", args=["Device"]))

            return render_to_response(templateFile, {"form": Device_Form}, context_instance=RequestContext(request))
    # This is a catch all response, if some unforseen error manages
    # to occur with the calling of add/edit pages
    else:
        render_to_response(reverse("homepage"))