Traceback (most recent call last):
File "/home/tridotscore/johnhenry/apps/frappe/frappe/utils/jinja.py", line 79, in render_template
return get_jenv().from_string(template).render(context)
File "/home/tridotscore/johnhenry/env/lib/python3.5/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/home/tridotscore/johnhenry/env/lib/python3.5/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/home/tridotscore/johnhenry/env/lib/python3.5/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 1, in top-level template code
File "/home/tridotscore/johnhenry/apps/cmswebsite/cmswebsite/./templates/Layout/customweb.html", line 65, in top-level template code
{% block content %} {% endblock %}{% block page_content %} {% endblock %}
File "<template>", line 15, in block "content"
File "/home/tridotscore/johnhenry/apps/johnhenrys_custom_app/johnhenrys_custom_app/./templates/Layout/sidebar.html", line 10, in top-level template code
<span>{{ UserDetails.full_name }}</span>
File "/home/tridotscore/johnhenry/env/lib/python3.5/site-packages/jinja2/sandbox.py", line 407, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'UserDetails' is undefined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/tridotscore/johnhenry/apps/frappe/frappe/website/render.py", line 47, in render
data = render_page_by_language(path)
File "/home/tridotscore/johnhenry/apps/frappe/frappe/website/render.py", line 151, in render_page_by_language
return render_page(path)
File "/home/tridotscore/johnhenry/apps/frappe/frappe/website/render.py", line 167, in render_page
return build(path)
File "/home/tridotscore/johnhenry/apps/frappe/frappe/website/render.py", line 174, in build
return build_page(path)
File "/home/tridotscore/johnhenry/apps/frappe/frappe/website/render.py", line 190, in build_page
html = frappe.render_template(context.source, context)
File "/home/tridotscore/johnhenry/apps/frappe/frappe/utils/jinja.py", line 81, in render_template
throw(title="Jinja Template Error", msg="<pre>{template}</pre><pre>{tb}</pre>".format(template=template, tb=get_traceback()))
File "/home/tridotscore/johnhenry/apps/frappe/frappe/__init__.py", line 364, in throw
msgprint(msg, raise_exception=exc, title=title, indicator='red')
File "/home/tridotscore/johnhenry/apps/frappe/frappe/__init__.py", line 350, in msgprint
_raise_exception()
File "/home/tridotscore/johnhenry/apps/frappe/frappe/__init__.py", line 316, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: <pre>{% extends "templates/Layout/customweb.html" %}
{% block title %}
Subscriptions
{% endblock %}
{% block content %}
{% if customer_id %}
<input type="hidden" name="hdnCustomer" id="hdnCustomer" value="{{customer_id}}" />
{% elif supplier_id %}
<input type="hidden" name="hdnSupplier" id="hdnSupplier" value="{{supplier_id}}" />
{% endif %}
<section class="dashboard">
<div class="">
<div class="row" style="margin-right: 0;margin-left: 0;">
<div class="col-md-3 col-xs-12 col-sm-3 pad-right-5 hidden-sm">
{% include "templates/Layout/sidebar.html" %}
</div>
<div class="col-md-9 col-xs-12 col-sm-12 pad-left-5">
<div class="content-data">
<div class="mobile-hide">
<h3>{{_("Subscription Info")}}</h3>
</div>
<div class="profile-detail-area" id="order_list" style="margin-bottom: 25px;">
{% if subscriptions %}
{% for item in subscriptions %}
<div class="col-md-12 col-xs-12" style="
border: 1px solid #dddddd;
margin-top: 15px;
">
<div class="subscription-title">Subscription {{loop.index}}
<p style="
font-weight: 500;
">Your order will be placed at midnight on ({{ frappe.format(item.order_creation_date, {'fieldtype': 'Date'}) }}) . Please make any changes necessary to your Farm Share order before this time.</p>
<!-- <a class="btn btn-primary subscription-item-add" data-sub-id="{{item.name}}">
<i class="fa fa-plus-circle"></i> Add New Item
</a> -->
<a class="btn btn-primary edit-subscription" data-sub-id="{{item.name}}" href="/subscription_checkout?id={{item.name}}" style="float: right;position: absolute;top: 5px;right: 5px;">
<i class="fa fa-pencil" style="margin-right: 5px"></i> Edit Subscription
</a>
{%if item.allow_customer_to_skip%}
<a class="btn btn-primary edit-subscription" data-sub-id="{{item.name}}" onclick="skip_subscription('{{item.name}}')" style="float: right;position: absolute;top: 5px;right: 175px;">
<i class="fa fa-times-circle" style="margin-right: 5px"></i> Skip Next Order {%if item.sub_skip_count>0%}
({{item.sub_skip_count}})
{%endif%}
</a>
{%endif%}
</div>
<div class="row" >
{% for plan in item.sub_plans %}
{%if (item.status =="Unpaid") %}
<div class="free_yp">
<p>
Your Order has been placed , but Your payment has been failed!
</p>
<div style="text-align: right">
<a href="/razor_pay_checkout?order_id={{item.order_info.name}}" class="btn btn-primary"> Pay Now </a>
</div>
</div>
{%endif%}
<div class="col-xs-12 hide-desk mobile-subscription-info" style="
padding: 0;
background: #fff;
margin-top: -10px;
padding: 10px 0;
">
<div class="col-xs-12">
<span class="info-title">
Delivery Frequency
</span>
<span class="info-value">
{%if item.delivery_frequency == 'Custom'%}
Monthly
{%else%}
{{item.delivery_frequency}}
{%endif%}
</span>
</div>
<div class="col-xs-12">
<span class="info-title">
Delivery Week
</span>
<span class="info-value">
{{item.delivery_week}}
</span>
</div>
<div class="col-xs-12">
<span class="info-title">
Delivery Day
</span>
<span class="info-value">
{{item.delivery_days}}
</span>
</div>
<div class="col-xs-12">
<span class="info-title">
Next Delivery Date
</span>
<span class="info-value">
{{frappe.format(item.next_delivery_date, {'fieldtype': 'Date'}) }}
</span>
</div>
</div>
<div class="col-md-12 col-sm-12" id="CustomerInfo">
<div class="col-md-12" id="ScrollTable" style="padding-left: 0px!important; padding-right: 0px !important;overflow-x:scroll">
<span id="idmem" style="display:none;">{{item.name}}</span>
<table class="table table-bordered tabm" style="">
<thead style="background-color: #fff;">
<tr style="background-color: #f5f5f5;">
<th style="border-bottom: 1px solid #dddddd;"> {{_("Delivery Frequency")}} </th>
<th style="border-bottom: 1px solid #dddddd;"> {{_("Next Delivery Date")}} </th>
<th style="border-bottom: 1px solid #dddddd;"> {{_("Status")}}</th>
{% if plan.plan_info.based_on=="Interval" %}
<th style="border-bottom: 1px solid #dddddd;">{{_("Plan Duration")}}</th>
<th style="border-bottom: 1px solid #dddddd;">{{_("Validity in Days")}}</th>
<th style="border-bottom: 1px solid #dddddd;">{{_("Expiry Date")}}</th>
<th style="border-bottom: 1px solid #dddddd;">{{_("Subscription Amount")}}</th>
{% if plan.plan_info.enable_wallet_credit == "Yes" %}
<th style="border-bottom: 1px solid #dddddd;">{{_("Amount To Wallet")}}</th>
<th style="border-bottom: 1px solid #dddddd;">{{_("Credit Interval")}}</th>
{% endif %}
{%else%}
{% if plan.plan_info.payment_option=="Prepaid" %}
<th style="border-bottom: 1px solid #dddddd;">{{_("Plan Type")}}</th>
<th style="border-bottom: 1px solid #dddddd;">Price</th>
{%else%}
<th style="border-bottom: 1px solid #dddddd;">{{_("Delivery Week")}}</th>
<th style="border-bottom: 1px solid #dddddd;">{{_("Delivery Day")}}</th>
{% endif %}
{% endif %}
</tr>
</thead>
<tbody>
<tr>
<td > {%if item.delivery_frequency == 'Custom'%}
Monthly
{%else%}
{{item.delivery_frequency}}
{%endif%}</td>
<td >{%if item.next_delivery_date%}{{ frappe.format(item.next_delivery_date, {'fieldtype': 'Date'}) }}
{%endif%}</td>
{%if item.status =="Active"%}
<td><span class="indicator green" style="color:green;">{{item.status}}</span></td>
{%endif%}
{%if item.status =="Past Due Date"%}
<td><span class="indicator orange" style="color:orange;">{{item.status}}</span></td>
{%endif%}
{%if item.status =="Cancelled"%}
<td><span class="indicator red" style="color:red;">{{item.status}}</span></td>
{%endif%}
{%if item.status =="Unpaid"%}
<td><span class="indicator red" style="color:red;">{{item.status}}</span></td>
{%endif%}
{% if plan.plan_info.based_on=="Interval" %}
<td style="padding: 14px;">{%if plan.plan_info.billing_interval_count%}{{plan.plan_info.billing_interval_count}} {{plan.plan_info.billing_interval}}(s) {%endif%}</td>
<td>{%if item.validity > 0 %}{{item.validity}} Day(s){%else%}0{%endif%}</td>
<td>{{item.current_end_date}}</td>
<td>{% if currency %}<span class="secondary-font-p">{{currency}}</span>{% else %}${% endif %}{%if plan.plan_info.price%}{{"%.2f" % plan.plan_info.price | float}}{%endif%}</td>
{% if plan.plan_info.enable_wallet_credit == "Yes" %}
<td>{% if currency %}<span class="secondary-font-p">{{currency}}</span>{% else %}${% endif %}{%if plan.plan_info.amount_to_wallet%}{{"%.2f" % plan.plan_info.amount_to_wallet | float}}{%endif%}</td>
<td>{%if plan.plan_info.interval_count%}{{plan.plan_info.interval_count}} {{plan.plan_info.interval}}(s){%endif%}</td>
{% endif %}
{%else%}
{% if plan.plan_info.payment_option=="Prepaid" %}
<td>{%if plan.plan_info.plan_type %} {{plan.plan_info.plan_type}} {%endif%}</td>
<td>{% if currency %}<span class="secondary-font-p">{{currency}}</span>{% else %}${% endif %}{%if plan.plan_info.price%}{{"%.2f" % plan.plan_info.price | float}}{%endif%}</td>
{%else%}
<td>{%if item.delivery_week %} {{item.delivery_week}} {%endif%}</td>
<td>{%if item.days %} {{item.days}} {%endif%}</td>
{% endif %}
{% endif %}
</tr>
</tbody>
</table>
</div>
<div class="col-md-12 col-xs-12" style="padding-left: 0px;padding-right: 0px;margin-top: 10px;">
{% if item.sub_items %}
<!-- <div class="row it-sec"> -->
<!-- <div class="col-md-12 col-xs-12"> -->
<div class="it-box" id="{{item.name}}">
<div class="item-table-head hidden-xs clearfix" style="background-color: #f5f5f5;">
<div class="col-md-6 col-sm-5">{{_("Item")}}</div>
<div class="col-md-6 col-sm-7">
<div class="col-md-4 col-sm-4 ralign">{{_("Price")}}</div>
<div class="col-md-4 col-sm-4" style="text-align: center;">{{_("Quantity")}}</div>
<div class="col-md-4 ralign col-sm-4">{{_("Total")}}</div>
<!-- <div class="col-md-2 ralign col-sm-4"></div> -->
</div>
</div>
<div class="item-details">
{% for pdt in item.sub_items %}
<div class="it-list">
<div class="row data_info" data-id="{{pdt.name}}" data-product="{{pdt.item_name}}" data-sub="{{item.name}}" data-price="{{pdt.price}}" data-qty="{{pdt.qty}}">
<div class="col-md-6 col-sm-5 col-xs-12">
<div class="col-md-4 col-xs-12 col-sm-3">
<div class="item-img">
<a href="/{{pdt.route}}"><img src="{%if pdt.image%}{{pdt.image}}{%else%}/assets/cmswebsite/images/no-img-120.jpg{%endif%}" class="img-responsive" style="margin: auto;" />
</a>
</div>
</div>
<div class="col-md-8 col-sm-9 col-xs-12" style="padding-left: 0">
<h5 class="subscription-item-title"><a style="line-height: 25px;" href="/{{pdt.route}}">{{pdt.item_name}}</a></h5>
{% if pdt.short_description %}
<div class="attr-list">{{pdt.short_description}}</div>
{% endif %}
{%if pdt.attribute_description%}
<div class="attr-list">{{pdt.attribute_description}}</div>
{% endif %}
</div>
</div>
<div class="col-md-6 col-sm-7 col-xs-12 hidden-xs">
<div class="col-md-4 col-sm-4 ralign">
{% if currency %}{{currency}}{% else %}${% endif %}
{{frappe.utils.fmt_money("%0.2f" % pdt.price | float)}}
</div>
<div class="col-md-4 col-sm-4" style="text-align: center;">
<!-- <div class="product-qty"><span class="fa fa-minus" onclick="subscriptionitemdecrQty(this)"></span> <span class="qty">{{pdt.qty}}</span> <span class="fa fa-plus" onclick="subscriptionitemincrQty(this)"></span></div> -->
{{pdt.qty}}
</div>
<div class="col-md-4 ralign col-sm-4 item-total">
{% if currency %}{{currency}}{% else %}${% endif %}
{{frappe.utils.fmt_money("%0.2f" % pdt.total | float)}}
</div>
<!-- <div class="col-md-2 ralign col-sm-4">
<span style="font-size: 20px;color: #c70808;cursor: pointer;" data-id="{{pdt.name}}" data-cartid="{{pdt.cartid}}" data-item="{{pdt.item}}" data-parent="{{pdt.cart_parent}}" onclick="remove_items($(this))"> <i class="fa fa-trash-o" aria-hidden="true"></i></span>
</div> -->
</div>
<div class="col-md-3 col-xs-12 hide-desk" style="position: static;">
<div class="col-md-4 col-xs-4">
<p>Price</p>
{% if currency %}{{currency}}{% else %}${% endif %}
{{frappe.utils.fmt_money("%0.2f" % pdt.price | float)}}
</div>
<div class="col-md-4 col-xs-4" style="text-align: center;">
<p>Quantity</p>
{{pdt.qty}}
<!-- <div class="product-qty"><span class="fa fa-minus" onclick="subscriptionitemdecrQty(this)"></span> <span class="qty">{{pdt.qty}}</span> <span class="fa fa-plus" onclick="subscriptionitemincrQty(this)"></span></div> -->
</div>
<div class="col-md-4 col-xs-4 ralign">
<p>Total</p>
<span class="item-total">
{% if currency %}{{currency}}{% else %}${% endif %}
{{frappe.utils.fmt_money("%0.2f" % pdt.total | float)}}
</span>
</div>
<!-- <div class="col-md-2 col-xs-3 ralign" style="position: absolute;top:0;right: 0">
<span style="font-size: 20px;color: #c70808;cursor: pointer;" data-id="{{pdt.name}}" data-cartid="{{pdt.cartid}}" data-item="{{pdt.item}}" data-parent="{{pdt.cart_parent}}" onclick="remove_items($(this))"> <i class="fa fa-trash-o" aria-hidden="true"></i></span>
</div> -->
</div>
</div>
</div>
{% endfor %}
</div>
<div class="item-footer">
</div>
</div>
<!-- </div>
</div> -->
{%endif%}
</div>
{% if plan.plan_features%}
<div class="col-md-12" id="ScrollFeature" style="min-height: 200px;padding:0px;background-color: #f5f5f5;margin-top: 15px !important;border: 1px solid #e1e8e3;overflow-y:scroll">
<div class="bottom-content" style="">
<h6 class="fs-18" style="">{{_("Subscription Features")}}</h6>
</div>
{% for n in plan.plan_features%}
<span style="width: 100%;padding: 10px 20px;float: left;text-align: left;">
<i class="fa fa-check" aria-hidden="true" style="color: #4caf50;font-size: 14px;padding-right: 10px;"></i> {{n.features}}
</span>
{% endfor %}
</div>
{%endif%}
</div>
{%endfor%}
</div>
</div>
{% endfor %}
{% else %}
<div style="padding: 5% 0;">Our Farm Share program is a cross between a "Co-op", and "Subscribe and Save". This great subscription program (Farm Share) allows you to enjoy automatic meat deliveries with benefits. To learn more visit our Subscription page.
<div style="text-align: center;margin-top: 20px;"><a href="/farm-share" class="btn btn-primary">Subscription</a></div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</section>
<div class="modal" id="ProductModal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Add New Item</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<label>Product</label>
<input type="text" id="SubscriptionItemSearch" class="form-control" placeholder="Search the products..." />
<table class="table table-bordered" id="ItemTable" style="display:none">
<thead>
<tr>
<td>Item</td>
<td>Quantity</td>
<td></td>
</tr>
</thead>
<tbody id="ItemHtml" >
</tbody>
</table>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-primary" onclick="AddSubscriptionItem()" >Save</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<style type="text/css">
.it-sec{
margin-bottom: 20px;
}
.addrBox{
background: #fff;
padding: 10px 15px;
border: 1px solid #ddd;
}
.item-table-head{
border-bottom: 1px solid #ddd;
padding: 5px 10px;
}
.it-box{
background: #fff;
border: 1px solid #ddd;
}
.it-list{
border-bottom: 1px solid #ddd;
padding: 10px;
}
.item-footer table td{
padding: 5px 15px;
}
.item-footer table{
width: 100%;
}
.ralign{
text-align: right;
font-size: 13px;
}
.item-table-head div{
font-weight: 600; font-size: 14px !important;
}
.hide-desk{
display: none;
margin-top: 10px;
}
.hide-desk div{
font-size: 12px;
}
.hide-desk p{
margin-bottom: 5px;
font-weight: 600;
font-size: 13px;
}
h5{
margin-bottom: 15px;
}
.attr-list{
font-size: 13px;
}
.free-item {
position: relative;
text-transform: uppercase;
}
.free-item .wrap {
width: 100px;
height: 188px;
position: absolute;
top: -10px;
left: -25px;
overflow: hidden;
}
.free-item span {
width: 160px;
height: 14px;
position: absolute;
top: 25px;
left: -45px;
z-index: 2;
overflow: hidden;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
box-shadow: 0 0 0 3px var(--primary-button-bg-color), 0px 21px 5px -18px rgba(0,0,0,0.6);
background: var(--primary-button-bg-color);
text-align: center;
font-size: 12px;
color: #fff;
}
@media only screen and (max-width: 767px){
.free-item .wrap{
left: -16px;
}
}
@media only screen and (max-width: 768px){
.it-list .row .col-xs-12{
padding-left: 10px;
padding-right: 5px;
}
.od-info{
font-size: 13px;
}
h3{
font-size: 18px;
}
.mobile-order-info{
background-color: #fff;
float: left;
border: 1px solid #ddd;
width: 100%;
padding-top: 10px;
padding-bottom: 10px;
margin-top: 10px;
}
.mobile-order-info h5 {
float: left;
width: 50%;
font-weight: normal;
}
.mobile-order-info .col-xs-12 div
{
float: left;
width: 50%;
padding-top: 3px;
}
}
@media only screen and (min-width: 769px){
.second-row
{
margin-top: 15px
}
}
#CustomerInfo {
padding-left: 0;
padding-right: 0;margin-left: -1px;
width: calc(100% + 2px);
}
.bottom-content {
/*background-color: #ebedf3;*/
background-color: #efefef;
padding: 5px 10px;
}
.tabm {
margin-bottom: 0px !important;
}
.fs-18,div#ScrollFeature span {
font-size: 15px !important;
}
.free_yp {
background: #f9e0d7;
padding: 20px 15px 5px;
margin-top: 10px;
margin-bottom: 10px;
border: 1px solid #f9e0d7;
}
.free_yp p span a{
background: #d02d1d !important;
border-color: #d02d1d !important;
color: #fff !important;
}
.free_yp p span {
float: right;
margin-top: -10px;
}
.free_yp p {
font-weight: 500;
}
.view-detail .fa {
margin-right: 5px;
margin-top: 3px;
color: #22262a;
}
.content-data h3 {
margin-top: 0;
margin-bottom: 15px;
}
.list-contain-a {
font-size: 18px !important;
}
.table tbody tr td {
border-top: 0; font-size: 14px;
}
.list-box {
padding: 0 0;
box-shadow: 0 0 0.625rem 0 rgba(0, 0, 0, 0.05) !important;
background-clip: border-box;
margin-top: 10px;
width: 100%;
float: left;
margin-bottom: 10px;
}
.box-style {
margin-right: 0;
margin-left: 0;
border: 1px solid #ddd;
background: #fff;
border-bottom: none;
}
.table {
margin-top: 10px;
}
.profile-detail-area {
min-height: 370px;
}
.view-detail {
border: 1px solid #ddd;
border-top: 0;
background: #f5f5f5;
padding: 10px 0;
}
.view-detail a {
padding: 13px;
color: #222;
}
.view-detail a:hover {
background: #e6e6e6;
}
@media screen and (min-width: 769px) {
.page-section {
margin: 0px auto;
max-width: 1366px;
padding: 14px 64px 0;
}
.content-data {
background-color: #fff;
padding: 15px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .08);
margin-bottom: 20px;
float: left;
width: 100%;
padding-top: 0px;
}
.content-data h3 {
margin-top: 0;
margin-bottom: -10px;
padding: 15px;
font-size: 18px;
/* border-bottom: 1px solid #dedfe3; */
width: calc(100% + 30px);
margin-left: -15px;
/* padding-left: 15px; */
background: {{theme_settings.header_bg_color}};
color: #3f4e5c;
}
}
.it-box .product-qty span.fa.fa-minus,.it-box .product-qty span.fa.fa-plus {
float: left;
font-size: 12px;
color: #b3b3b3;
cursor: pointer;
width: 33.33%;
float: left;
text-align: center;
margin-top: 5px;
padding-top: 3px;
padding-bottom: 5px;
}
.product-qty{margin-top: 0}
@media screen and (max-width: 767px) and (min-width: 320px) {
.btn {
margin-top: 0;
margin-bottom: 10px;
/*float: right;*/
}
.dashboard {
margin-top: 0;
}
.table tbody tr td {
width: 50% !important;
padding-top: 10px;
padding-bottom: 10px;
}
.table {
margin-bottom: 0;
margin-top: 0
}
.order-head {
color: #8d9ba9 !important;
}
.content-data h3 {
margin-top: 10px;
font-size: 18px;
}
}
.order-details-view {
float: left;
width: 100%;
border: 1px solid #dedfe3;
padding: 10px 15px;
border-bottom: 1px solid #dedfe3;
}
.order-details-view .col-md-6 {
padding: 0;
}
span.order-list-title {
color: #878787;
padding-right: 10px;
}
span.order-list-value {
color: #222;
}
.order-item {
float: left;
width: 100%;
padding: 15px;
border-bottom: 1px solid #dedfe3;
}
.order-item:last-child {
border-bottom: none;
}
.subscription-item-title{
margin-top: 0px;
}
a.btn.btn-primary.subscription-item-add {
margin-top: 0px;
float: right;
}
a.btn.btn-primary.subscription-item-add{margin-right: 0px;}
#ProductModal .modal-header{
float: left;
width: 100%;
margin-bottom: 15px;
}
#ProductModal .modal-header .modal-title{
width: 90%;
float: left;
}
#ProductModal .modal-body label{
font-weight: 500;
}
#ui-id-3 {
border: none !important;
width: 400px !important;
margin-top: 20px;
z-index: 99999 !important;
max-width: 100%;
}
#ui-id-3 .ui-menu-item{border:none !important;padding: 5px 10px !important;}
#ItemHtml tr td,#ItemTable td{
font-size: 14px;
font-weight: 500;
}
.subscription-title {
padding: 5px 15px;
float: left;
width: calc(100% + 30px);
background: #efefef;
margin-left: -15px;
margin-top: 0px;
font-weight: 600;border-bottom: 1px solid #ddd;
position: relative;
}
@media screen and (max-width: 767px) and (min-width: 320px) {
.edit-subscription{
font-size: 12px;position: relative !important;
right: 0 !important;
margin-left: 15px;
}
#ScrollFeature,.it-box{
display: none;
}
#CustomerInfo{display: none;}
}
span.info-title {
font-weight: 500;
width: 50%;
float: left;
}
</style>
{% endblock %}
{% block script %}
<script>
{% include "templates/includes/subscription.js" %}
</script>
<script type="text/javascript">
var subscriptionId="";
function remove_items(e){
var r = confirm("Do you want to remove this item?");
if (r == true) {
var customer = $('#hdnCustomer').val()
$.ajax({
type: 'POST',
Accept: 'application/json',
ContentType: 'application/json;charset=utf-8',
url: window.location.origin + '/api/method/daily_rate.daily_rate.api.deleteBudgetItems',
data: { 'name': e.attr("data-cartid"),
'user':frappe.session.user,
'customer':customer,
'parent': e.attr("data-parent")
},
dataType: "json",
async: false,
headers: {
'X-Frappe-CSRF-Token': frappe.csrf_token
},
success: function(data) {
console.log(data)
window.location.href="/subscription-list"
}
})
}
}
$(window).on('load', function () {
$(".subscription-item-add").click(function(){
$("#ItemHtml").html('');
$("#ProductModal").modal('show');
subscriptionId = $(this).attr("data-sub-id");
});
$("#SubscriptionItemSearch").bind("paste input", function(e) {
$("#SubscriptionItemSearch").val($("#SubscriptionItemSearch").val().replace("#", ""));
$("#SubscriptionItemSearch").val($("#SubscriptionItemSearch").val().replace("&", ""));
$("#SubscriptionItemSearch").val($("#SubscriptionItemSearch").val().replace("/", ""));
});
$('#SubscriptionItemSearch').catcomplete({
delay: 150,
source: function(request, response) {
$.ajax({
type: 'POST',
Accept: 'application/json',
ContentType: 'application/json;charset=utf-8',
url: window.location.origin + '/api/method/ecommerce_business_store.ecommerce_business_store.api.get_search_data',
data: { 'page_no': 1, 'page_len': 15, 'searchTxt': request.term },
dataType: "json",
async: false,
headers: {
'X-Frappe-CSRF-Token': frappe.csrf_token
},
success: function(r) {
var bty = []
if (r.message) {
$.each(r.message, function(key, value) {
var label = ''
var img = ''
if (value.doctype == 'Item') {
label = value.item
img = value.mini_cart
} else if (value.doctype == 'Search Keyword') {
label = value.keyword
} else if (value.doctype == "Brand") {
label = value.brand_name
} else {
label = value.category_name
}
if (value.doctype == 'Item') {
bty.push({
label: label,
img: img,
value: label,
content: label,
route: value.route,
doctype: value.doctype
})
}
})
}
response(bty)
}
})
},
minLength: 2,
select: function(event, ui) {
if($("#tr-"+ui.item.route).length == 0)
{
var html="<tr data-route='"+ui.item.route+"' id='tr-"+ui.item.route+"'><td><img src='"+ui.item.img+"' style='width:80px;margin-right:5px;float: left;'/>"+ui.item.content+"</td><td><input type='number' class='form-control itemqty' style='width:80px' value='1' min='1'/></td><td style='width:50px;'><a onclick=RemoveItem('"+ui.item.route+"')><i class='btn btn-sm btn-primary fa fa-trash'></i></a></td></tr>";
$("#ItemHtml").append(html);
$("#ItemTable").show();
}
else
{
$("#tr-"+ui.item.route).find(".itemqty").val(parseInt($("#tr-"+ui.item.route).find(".itemqty").val())+1);
}
$(this).val("");
return false;
}
}).keydown(function(e) {
// if(e.which==65&90)
$(".ui-menu-item").unbind("hover");
$(".ui-menu-item").removeClass("active")
if (e.which == 38 || e.which == 40) {
$(".ui-menu-item").unbind("hover");
$(".ui-menu-item").removeClass("active")
$(".ui-menu-item-wrapper").each(function() {
if ($(this).text() == $('#SubscriptionItemSearch').val()) {
$(this).parent().addClass("active")
}
})
}
if (e.which == 13) {
let s = false;
$(".ui-menu-item-wrapper").each(function() {
if ($(this).text() == $('#SubscriptionItemSearch').val()) {
s = true;
}
})
if (s == false) {
if ($('#SubscriptionItemSearch').val() == "") {
$('#message_modal .modal-title').text('Alert');
$('#message_modal .modal-body').html('Please enter any product/category name')
$('#message_modal').modal('show');
setTimeout(function() {
$('#message_modal').modal('hide')
}, 2000)
} else {
// window.location.href = window.location.origin + '/search?text=' + $('#SubscriptionItemSearch').val();
}
}
}
});
})
function AddSubscriptionItem(){
var result = confirm("Are you sure want to add this item to subscription?");
if(result)
{
var items = [];
$("#ItemHtml tr").each(function(){
var item={"item":$(this).attr("data-route"),
"qty":$(this).find(".itemqty").val()
}
items.push(item)
});
$.ajax({
type: 'POST',
Accept: 'application/json',
ContentType: 'application/json;charset=utf-8',
url: window.location.origin + '/api/method/subscription.templates.pages.subscription_list.update_subscription_items',
data: {'items': JSON.stringify(items),"subscription_id":subscriptionId},
dataType: "json",
async: false,
headers: {
'X-Frappe-CSRF-Token': frappe.csrf_token
},
success: function(data) {
if(data.message == "success")
{
$("#ProductModal").modal('hide');
window.location.href="/subscription-list"
}
}
})
}
}
function RemoveItem(route)
{
var result = confirm("Are you sure want to remove?");
if(result)
{
$("#tr-"+route).remove();
if($("#ItemHtml tr").length == 0)
{
$("#ItemTable").hide();
}
}
}
function subscriptionitemincrQty(control){
var old_qty = $(control).parent().parent().find(".product-qty span.qty").text();
var price = $(control).parent().parent().parent().parent().attr("data-price");
var new_qty = parseInt(old_qty)+1;
$.ajax({
type: 'POST',
Accept: 'application/json',
ContentType: 'application/json;charset=utf-8',
url: window.location.origin + '/api/method/subscription.templates.pages.subscription_list.update_subscription_item',
data: {'item_id': $(control).parent().parent().parent().parent().attr("data-id"),"subscription_id":$(control).parent().parent().parent().parent().attr("data-sub"),'qty':new_qty},
dataType: "json",
async: false,
headers: {
'X-Frappe-CSRF-Token': frappe.csrf_token
},
success: function(data) {
if(data.message == "success")
{
var total = parseFloat(new_qty*price).toFixed(2);
$(control).parent().parent().parent().parent().find(".item-total").text('{{currency}}'+total);
$(control).parent().parent().parent().parent().find(".product-qty span.qty").text(new_qty);
}
}
})
}
function subscriptionitemdecrQty(control)
{
var old_qty = $(control).parent().parent().find(".product-qty span.qty").text();
var price = $(control).parent().parent().parent().parent().attr("data-price");
var new_qty = parseInt(old_qty)-1;
if(old_qty>1){
$.ajax({
type: 'POST',
Accept: 'application/json',
ContentType: 'application/json;charset=utf-8',
url: window.location.origin + '/api/method/subscription.templates.pages.subscription_list.update_subscription_item',
data: {'item_id': $(control).parent().parent().parent().parent().attr("data-id"),"subscription_id":$(control).parent().parent().parent().parent().attr("data-sub"),'qty':new_qty},
dataType: "json",
async: false,
headers: {
'X-Frappe-CSRF-Token': frappe.csrf_token
},
success: function(data) {
if(data.message == "success")
{
var total = parseFloat(new_qty*price).toFixed(2);
$(control).parent().parent().parent().parent().find(".item-total").text('{{currency}}'+total);
$(control).parent().parent().parent().parent().find(".product-qty span.qty").text(new_qty);
}
}
})
}
}
function edit_subscription(subscription_id){
createCookie('subscription_id', subscription_id);
window.location.href="/subscription_checkout"
}
function skip_subscription(subscription_id){
$.ajax({
type: 'POST',
Accept: 'application/json',
ContentType: 'application/json;charset=utf-8',
url: window.location.origin + '/api/method/subscription.templates.pages.subscription_list.check_skip_availability',
data: {'subscription_id':subscription_id},
dataType: "json",
async: false,
headers: {
'X-Frappe-CSRF-Token': frappe.csrf_token
},
success: function(data) {
if(data.message.status == "success")
{
$('#message_modal .modal-title').text('Confirm');
var html = "Are you sure want to skip the next order?"
html += '<p style="margin-top: 10px;text-align: right;"><a style="margin-right:15px;" class="btn btn-success" onclick=skip_subscription_order("'+subscription_id+'")>Yes</a><a class="btn btn-danger" onclick=close_popup()>No</a></p>';
$('#message_modal .modal-body').html(html)
$('#message_modal').modal('show');
}
else{
$('#message_modal .modal-title').text('Message');
$('#message_modal .modal-body').html(data.message.message)
$('#message_modal').modal('show');
}
}
})
}
function close_popup(){
$('#message_modal').modal('hide');
}
function skip_subscription_order(subscription_id){
$.ajax({
type: 'POST',
Accept: 'application/json',
ContentType: 'application/json;charset=utf-8',
url: window.location.origin + '/api/method/subscription.templates.pages.subscription_list.skip_subscription_order',
data: {'subscription_id':subscription_id},
dataType: "json",
async: false,
headers: {
'X-Frappe-CSRF-Token': frappe.csrf_token
},
success: function(data) {
if(data.message.status == "success")
{
$('#message_modal .modal-title').text('Message');
$('#message_modal .modal-body').html("Your request has been submiited successfully.")
$('#message_modal').modal('show');
setTimeout(function() {
$('#message_modal').modal('hide');
window.location.href = "subscription-list";
}, 5000)
}
else{
$('#message_modal .modal-title').text('Alert');
$('#message_modal .modal-body').html(data.message.message);
$('#message_modal').modal('show');
}
}
});
}
</script>
{% endblock %}
</pre><pre>Traceback (most recent call last):
File "/home/tridotscore/johnhenry/apps/frappe/frappe/utils/jinja.py", line 79, in render_template
return get_jenv().from_string(template).render(context)
File "/home/tridotscore/johnhenry/env/lib/python3.5/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/home/tridotscore/johnhenry/env/lib/python3.5/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/home/tridotscore/johnhenry/env/lib/python3.5/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 1, in top-level template code
File "/home/tridotscore/johnhenry/apps/cmswebsite/cmswebsite/./templates/Layout/customweb.html", line 65, in top-level template code
{% block content %} {% endblock %}{% block page_content %} {% endblock %}
File "<template>", line 15, in block "content"
File "/home/tridotscore/johnhenry/apps/johnhenrys_custom_app/johnhenrys_custom_app/./templates/Layout/sidebar.html", line 10, in top-level template code
<span>{{ UserDetails.full_name }}</span>
File "/home/tridotscore/johnhenry/env/lib/python3.5/site-packages/jinja2/sandbox.py", line 407, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'UserDetails' is undefined
</pre>