Fix showing service providers who have show in website unchecked

This commit is contained in:
Raghavendra Kamath
2018-03-09 18:01:48 +05:30
parent ca0678d950
commit ebc60d06f0
10 changed files with 664 additions and 519 deletions

View File

@@ -8,7 +8,7 @@ from frappe.website.website_generator import WebsiteGenerator
from frappe.utils import get_datetime from frappe.utils import get_datetime
class ServiceProvider(WebsiteGenerator): class ServiceProvider(WebsiteGenerator):
_website = frappe._dict( website = frappe._dict(
condition_field = "show_in_website", condition_field = "show_in_website",
) )
def validate(self): def validate(self):
@@ -31,8 +31,6 @@ class ServiceProvider(WebsiteGenerator):
else: else:
context.image = "/assets/foundation/img/default-membership-logo.png" context.image = "/assets/foundation/img/default-membership-logo.png"
def send_alert_to_inactive_service_providers(): def send_alert_to_inactive_service_providers():
for service_provider in frappe.get_all("Service Provider", fields=['email', 'title']): for service_provider in frappe.get_all("Service Provider", fields=['email', 'title']):
if get_last_login_diff(service_provider.email) == 80: if get_last_login_diff(service_provider.email) == 80:
@@ -55,7 +53,6 @@ def publish_service_provider():
if get_last_login_diff(service_provider.email) == 0 and service_provider.show_in_website == 0: if get_last_login_diff(service_provider.email) == 0 and service_provider.show_in_website == 0:
frappe.db.set_value('Service Provider', service_provider.name, 'show_in_website', 1, update_modified=False) frappe.db.set_value('Service Provider', service_provider.name, 'show_in_website', 1, update_modified=False)
def get_last_login_diff(user): def get_last_login_diff(user):
""" """
Returns difference between todays date and last login date Returns difference between todays date and last login date

View File

@@ -0,0 +1,23 @@
/* eslint-disable */
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.test("test: Service Provider", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Service Provider
() => frappe.tests.make('Service Provider', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});

View File

@@ -1,2 +1,3 @@
foundation.patches.v0_0.update_erpnext_job_route foundation.patches.v0_0.update_erpnext_job_route
foundation.patches.v0_0.change_website_to_website_url foundation.patches.v0_0.change_website_to_website_url
foundation.patches.v0_0.service_providers_website_to_website_url

View File

@@ -3,4 +3,4 @@ import frappe
def execute(): def execute():
frappe.db.sql(''' frappe.db.sql('''
ALTER TABLE `tabFoundation Fellowship` CHANGE `website` `website_url` varchar(140); ALTER TABLE `tabFoundation Fellowship` CHANGE `website` `website_url` varchar(140);
''') ''')

View File

@@ -0,0 +1,7 @@
import frappe
def execute():
frappe.db.sql('''
update `tabService Provider`
set website_url = website
''')

View File

@@ -349,6 +349,12 @@ a:visited {
background-color: #fff; background-color: #fff;
min-width: 200px; min-width: 200px;
transition: all 0.3s ease-out; transition: all 0.3s ease-out;
margin: 0 1rem;
}
@media screen and (min-width: 500px) {
.list-items {
margin: 0;
}
} }
.list-items:hover { .list-items:hover {
box-shadow: 0 5px 9px 0 rgba(0, 0, 0, 0.05); box-shadow: 0 5px 9px 0 rgba(0, 0, 0, 0.05);

View File

@@ -0,0 +1,71 @@
.indicator,
.indicator-right {
background: none;
font-size: 12px;
vertical-align: middle;
font-weight: bold;
color: #6c7680;
}
.indicator::before,
.indicator-right::after {
content: "";
display: inline-block;
height: 8px;
width: 8px;
border-radius: 8px;
}
.indicator::before {
margin: 0 4px 0 0;
}
.indicator-right::after {
margin: 0 0 0 4px;
}
.indicator.grey::before,
.indicator-right.grey::after {
background: #F0F4F7;
}
.indicator.blue::before,
.indicator-right.blue::after {
background: #5e64ff;
}
.indicator.red::before,
.indicator-right.red::after {
background: #ff5858;
}
.indicator.green::before,
.indicator-right.green::after {
background: #98d85b;
}
.indicator.orange::before,
.indicator-right.orange::after {
background: #ffa00a;
}
.indicator.purple::before,
.indicator-right.purple::after {
background: #743ee2;
}
.indicator.darkgrey::before,
.indicator-right.darkgrey::after {
background: #b8c2cc;
}
.indicator.black::before,
.indicator-right.black::after {
background: #36414C;
}
.indicator.yellow::before,
.indicator-right.yellow::after {
background: #FEEF72;
}
.indicator.light-blue::before,
.indicator-right.light-blue::after {
background: #7CD6FD;
}
.indicator.lightblue::before,
.indicator-right.lightblue::after {
background: #7CD6FD;
}
.modal-header .indicator {
float: left;
margin-top: 7.5px;
margin-right: 3px;
}

View File

@@ -145,6 +145,11 @@ a {
background-color: #fff; background-color: #fff;
min-width: 200px; min-width: 200px;
transition: all @transition; transition: all @transition;
margin: 0 1rem;
@media screen and (min-width: @screen-palm) {
margin: 0;
}
&:hover { &:hover {
box-shadow: 0 5px 9px 0 rgba(0, 0, 0, 0.05); box-shadow: 0 5px 9px 0 rgba(0, 0, 0, 0.05);

View File

@@ -11,6 +11,7 @@ def get_context(context):
route='service-providers', title='All Service Providers')] route='service-providers', title='All Service Providers')]
filters = dict() filters = dict()
filters['show_in_website'] = 1
if frappe.form_dict.country: if frappe.form_dict.country:
filters['country'] = frappe.form_dict.country filters['country'] = frappe.form_dict.country