How to move checkbox of terms and conditions up [odoo 13] - checkbox

does anyone know how to move the conditions and positions checkbox up? I found the code for this checkbox in odooenter image description here and it has this parameter, but when I change the state of this parameter to "before", nothing happens
odoo version 13.0, ecommerce module
code of checkbox
<template id="payment_sale_note" inherit_id="payment" name="Accept Terms & Conditions" customize_show="True" active="True">
<xpath expr="//div[#id='payment_method'][hasclass('js_payment')]" position="before">
<div class="custom-control custom-checkbox float-right mt-2 oe_accept_cgv_button">
<input type="checkbox" id="checkbox_cgv" class="custom-control-input"/>
<label for="checkbox_cgv" class="custom-control-label">
I agree to the <a target="_BLANK" href="/shop/terms">terms & conditions</a>
</label>
</div>
</xpath>
</template>

In my odoo v13, i have managed it like that :
<template id="my_payment_tokens_list" inherit_id="payment.payment_tokens_list" >
<xpath expr="//form[hasclass('o_payment_form')]/div[1]" position="before">
<div class="pl-4 mb-3">
<input type="checkbox" id="checkbox_cgv" class="custom-control-input" required="This field is required"/>
<label for="checkbox_cgv" class="custom-control-label"> I agree with <a target="_BLANK" href="/shop/terms"><u>General Terms and Conditions of Sale</u></a></label>
</div>
</xpath>
</template>

Related

AngularJS disable input type button If other fields are not completed

I have a poll and would like to disable the input type button until you have selected a radio button from the poll options. This is what I have so far...
<div class="options" ng-hide="$root.offline">
<div class="overlay overlay--loading" ng-show="poll.loading"></div>
<div class="option" ng-repeat="option in poll.options">
<label>
<input type="radio" ng-model="$parent.response" name="poll-{{poll.ID}}" value="{{ option.option }}">
<span class="radiobtn" ng-hide="poll.answered"></span>
<span compile="option.option"></span>
</label>
<div class="result" ng-show="poll.answered">
<div class="result-bar">
<div ng-attr-style="{{'width: '+ option.percentage +'%;'}}"></div>
</div>
<div class="result-percentage">{{ option.percentage ? option.percentage : 0 }}%</div>
</div>
</div>
<input type="button" value="Vote" ng-hide="poll.answered || $root.offline" ng-click="vote()" ng-disabled="!$parent.response" />
</div>
This disables the button but when I select an option it's stil disabled.
Any help would be greatly appreciated. Thanks
Fixed it. Can't call parent outside the loop.
<input type="button" value="Vote" ng-hide="poll.answered || $root.offline" ng-click="vote()" ng-disabled="!response" />

nggettext - Translate a text has <a> tag inside it

I am trying to translate this text.
<label class="check" translate>
<input type="checkbox" name="tnc" ng-init="tnc=false" ng-model="tnc" /> I agree to the <a ng-click="open('terms.html')">
Terms of Service </a> & <a ng-click="open('privacy.html')">
Privacy Policy </a>
</label>
I ran 'grunt nggettext_extract' and it extracted source text as
<input type="checkbox" name="tnc" ng-init="tnc=false" ng-model="tnc"> I agree to the <a ng-click="open('terms.html')">
Terms of Service </a> & <a ng-click="open('privacy.html')">
Privacy Policy </a>
and I translated it like that
<input type="checkbox" name="tnc" ng-init="tnc=false" ng-model="tnc"><a ng-click="open('terms.html')">
Kullanım Şartları </a>'nı & <a ng-click="open('privacy.html')">
Gizlilik Sözleşmesi</a>'ni kabul ediyorum
After that, I ran 'grunt nggettext_compile'. It said 'Done, without errors.' but in my page, it says '[MISSING]'.
How can I correct it?
Thank you.

Dynamically add UI Bootstrap dropdowns with ng-repeat

I'm new to using AngularJS and UI Bootstrap and I'm trying to add dropdowns dynamically using ng-repeat. The problem is that when any one dropdown is clicked it triggers all of them. I'm guessing I'm doing something really stupid with my code and I would appreciate it if someone could point me in the right direction on how to make this code work:
<div class="form-group" data-ng-repeat="item in ctrl.items">
<div class="col-sm-4">
<input type="text" class="form-control" placeholder="" name="itemDescription" data-ng-model="item.description">
</div>
<div class="col-sm-5">
<div class="input-group">
<input type="tel" class="form-control" placeholder="" name="value" data-ng-model="item.value">
<div class="input-group-btn" dropdown is-open="ctrl.isOpen">
<button type="button" class="btn btn-default dropdown-toggle" dropdown-toggle>Dropdown <span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
<li></li>
</ul>
</div>
</div>
</div>
The problem is that with more than one dropdown, a click results in all dropdowns being triggered and its probably something really easy but I'm having a hard time with it.
Appreciate any help
/Regards Kris
The issue is is-open="ctrl.isOpen". You are binding the opening of all of them with ctrl. It should be bound to something distinct for each repeat, i.e. something like is-open="item.isOpen"

How to properly handle nested forms in Angularjs

I am using angularjs for the front-end of my web app. I currently have a comments view that contains multiple reply and edit forms (due to ng-repeat). How could I rewrite the code below so form validation can be applied appropriately to each of the forms (currently the code is only showing a form for reply comment). I have tried using ng-form, but I was unsuccessful.
<div class="comments">
<div ng-hide="comments.length>0||angular.isUndefined(comments)" ng-cloak>
<p class="center">No comments yet, be the first one!</p>
</div>
<div class="comment clearfix" ng-repeat="comment in comments track by $index"
style="padding-left:{{comment.margin}}px">
<div class="body" style="padding-left:60px">
<span ng-hide="comment.edit_mode">{{comment.comment}}</span>
<div ng-show="comment.edit_mode">
<textarea msd-elastic="" ng-model="comment.comment" class="form-control" rows="1">{{comment.comment}}</textarea>
</div>
</div>
<div class="add-comment reply" ng-show="open_reply" ng-cloak>
<form name="form.replyForm" class="form-inline clearfix" role="form"
ng-submit="Submit(reply.comment,story.id,reply.anonymous,comment.comment_id,$index);open_reply=false;reply.comment=''"
novalidate>
<div id="comment-form">
<img ng-src="{{user.avatar}}" alt="" class="avatar"/>
<span>
<textarea msd-elastic ng-model="reply.comment" class="form-control message" rows="1"
placeholder="Add a comment..." ng-click="show_reply_anonymous_checkbox=true"
focus-on="open_reply" name="comment" required></textarea>
<span style="color:red" ng-show="form.replyForm.comment.$error.required">test</span>
</span>
<button type="submit" ng-disabled="form.replyForm.$invalid"
class="btn btn-primary submit">
Reply
</button>
</div>
</form>
</div>
</div>

Binding one value to checkboxes

i am getting swallowed by an issue.
I have this code currently
<div ng-repeat="list in ConnectivityDetails">
<div class="connectivity">
<div class="title">
Disable Connectivity??</div>
<div class="decision">
<p style="float: left;">
<input type="checkbox" ng-checked="list.Connectivity"/>
<label for="Yes">
</label>
<span class="spans">Yes</span>
</p>
<p>
<input type="checkbox" ng-model="list.Connectivity"/>
<label for="No">
</label>
<span class="spans">No</span>
</p>
</div>
</div>
</div>
Problem:
I am getting both the text boxes checked though the returning object is having only one value, how to bind true (Yes) for the checkbox and false (NO) for the other?
My Object Contains this:
var data = [{PracticeID: "1",Connectivity: "true", LabKey: "2154879",PracticeKey: "ABNCJFUE", CloudServiceURL: "ABC215947"}]";
I want to bind Connectivity value to one of the checkboxes
Help!
Thank you
Fiddle: http://jsfiddle.net/ymZdx/3/
So it should be:
<p style="float: left;">
<input type="checkbox" ng-model="list.Connectivity" />
<label for="Yes">
</label>
<span class="spans">Yes</span>
</p>
<p>
<input type="checkbox" ng-model="list.Connectivity" ng-true-value="false" ng-false-value="true" />
<label for="No">
</label>
<span class="spans">No</span>
</p>

Resources