diff --git a/app/assets/javascripts/admin/all.js b/app/assets/javascripts/admin/all.js
index b062e66261..e0a10d8a12 100644
--- a/app/assets/javascripts/admin/all.js
+++ b/app/assets/javascripts/admin/all.js
@@ -12,6 +12,7 @@
//= require angular
//= require angular-resource
//= require angular-animate
+//= require angular-sanitize
//= require admin/spree_core
//= require admin/spree_auth
//= require admin/spree_promo
diff --git a/app/assets/javascripts/admin/enterprises/controllers/enterprise_index_row_controller.js.coffee b/app/assets/javascripts/admin/enterprises/controllers/enterprise_index_row_controller.js.coffee
index 13c9b7dc08..226438c434 100644
--- a/app/assets/javascripts/admin/enterprises/controllers/enterprise_index_row_controller.js.coffee
+++ b/app/assets/javascripts/admin/enterprises/controllers/enterprise_index_row_controller.js.coffee
@@ -1,4 +1,16 @@
angular.module("admin.enterprises").controller "EnterpriseIndexRowCtrl", ($scope) ->
+ $scope.statusText = ->
+ issueCount = (issue for issue in $scope.enterprise.issues when !issue.resolved).length
+ if issueCount > 0
+ $scope.statusClass = "issue"
+ else
+ warningCount = (warning for warning in $scope.enterprise.warnings when !warning.resolved).length
+ if warningCount > 0
+ $scope.statusClass = "warning"
+ else
+ $scope.statusClass = "ok"
+
+
$scope.producerText = ->
switch $scope.enterprise.is_primary_producer
when true
@@ -30,6 +42,7 @@ angular.module("admin.enterprises").controller "EnterpriseIndexRowCtrl", ($scope
$scope.updateRowText = ->
$scope.producer = $scope.producerText()
$scope.package = $scope.packageText()
+ $scope.status = $scope.statusText()
$scope.producerError = ($scope.producer == "Choose")
$scope.packageError = ($scope.package == "Choose")
diff --git a/app/assets/javascripts/admin/enterprises/controllers/index_status_panel_controller.js.coffee b/app/assets/javascripts/admin/enterprises/controllers/index_status_panel_controller.js.coffee
new file mode 100644
index 0000000000..7a0765e29b
--- /dev/null
+++ b/app/assets/javascripts/admin/enterprises/controllers/index_status_panel_controller.js.coffee
@@ -0,0 +1,3 @@
+angular.module("admin.enterprises").controller 'indexStatusPanelCtrl', ($scope, $filter) ->
+ $scope.issues = $filter('filter')($scope.object.issues, {resolved: false })
+ $scope.warnings = $filter('filter')($scope.object.warnings, {resolved: false})
diff --git a/app/assets/javascripts/admin/enterprises/enterprises.js.coffee b/app/assets/javascripts/admin/enterprises/enterprises.js.coffee
index 2172b93725..6be7e00ffa 100644
--- a/app/assets/javascripts/admin/enterprises/enterprises.js.coffee
+++ b/app/assets/javascripts/admin/enterprises/enterprises.js.coffee
@@ -1 +1 @@
-angular.module("admin.enterprises", [
"admin.payment_methods",
"admin.utils",
"admin.shipping_methods",
"admin.users",
"textAngular",
"admin.side_menu",
"admin.taxons",
'admin.indexUtils',
'admin.dropdown',
'pasvaz.bindonce']
)
\ No newline at end of file
+angular.module("admin.enterprises", [
"admin.payment_methods",
"admin.utils",
"admin.shipping_methods",
"admin.users",
"textAngular",
"admin.side_menu",
"admin.taxons",
'admin.indexUtils',
'admin.dropdown',
'pasvaz.bindonce',
'ngSanitize']
)
\ No newline at end of file
diff --git a/app/assets/javascripts/templates/admin/panels/enterprise_status.html.haml b/app/assets/javascripts/templates/admin/panels/enterprise_status.html.haml
index aee049b538..b422f150c3 100644
--- a/app/assets/javascripts/templates/admin/panels/enterprise_status.html.haml
+++ b/app/assets/javascripts/templates/admin/panels/enterprise_status.html.haml
@@ -1 +1,29 @@
-enterprise_status {{ object.name }}
+.row.enterprise_status_panel{ ng: { controller: 'indexStatusPanelCtrl' } }
+ .alpha.sixteen.columns
+
+ %h3{ ng: { show: "issues.length == 0 && warnings.length == 0" } }
+ %i.icon-ok-sign
+ You're all set up and ready to go!
+
+ %table{ ng: { show: "issues.length > 0 || warnings.length > 0" } }
+ %thead
+ %th.severity
+ Severity
+ %th.description
+ Description
+ %th.resolve
+ Resolve
+ %tr{ ng: { repeat: "issue in issues"} }
+ %td.severity
+ %i.icon-warning-sign.issue
+ %td.description
+ %span{ bo: { bind: "issue.description" } }
+ %td.resolve
+ %div{ ng: { bind: { html: "issue.link" } } }
+ %tr{ ng: { repeat: "warning in warnings"} }
+ %td.severity.text-center
+ %i.icon-warning-sign.warning
+ %td.description
+ %span{ bo: { bind: "warning.description" } }
+ %td.resolve
+ %div{ ng: { bind: { html: "warning.link" } } }
diff --git a/app/assets/stylesheets/admin/enterprise_index_panels.css.scss b/app/assets/stylesheets/admin/enterprise_index_panels.css.scss
index 25a968e0d1..023efb28a2 100644
--- a/app/assets/stylesheets/admin/enterprise_index_panels.css.scss
+++ b/app/assets/stylesheets/admin/enterprise_index_panels.css.scss
@@ -1,24 +1,4 @@
.enterprise_package_panel, .enterprise_producer_panel {
- padding: 20px 0px;
-
- .error {
- display: block;
- color: #f57e80;
- border: 1px solid #f57e80;
- background-color: #fde6e7;
- // @include border-radius(3px);
- margin-bottom: 1em;
- padding: 0.5em;
- }
-
- .column.alpha, .columns.alpha {
- padding-left: 20px;
- }
-
- .column.omega, .columns.omega {
- padding-right: 20px;
- }
-
.info {
p {
font-size: 1rem;
@@ -101,3 +81,19 @@
}
}
}
+
+.enterprise_status_panel {
+ td.severity {
+ i {
+ font-size: 1.5rem;
+
+ &.issue{
+ color: #da5354;
+ }
+
+ &.warning{
+ color: #ff9848;
+ }
+ }
+ }
+}
diff --git a/app/assets/stylesheets/admin/index_panels.css.scss b/app/assets/stylesheets/admin/index_panels.css.scss
index 2453a34de5..8694c96dd6 100644
--- a/app/assets/stylesheets/admin/index_panels.css.scss
+++ b/app/assets/stylesheets/admin/index_panels.css.scss
@@ -13,20 +13,49 @@ tr.panel-toggle-row {
font-size: 1.2rem;
}
- &.error {
- &::before {
+ &::before {
+ font-family: FontAwesome;
+ font-weight: normal;
+ font-style: normal;
+ display: inline-block;
+ text-decoration: inherit;
+ position: absolute;
+ top: 5px;
+ right: 5px;
+ font-size: 2rem;
+ -webkit-font-smoothing: antialiased;
+ }
+
+ &.error::before {
+ content: "\f071";
+ color: #da5354;
+ }
+
+ &.status {
+ i.status::before {
font-family: FontAwesome;
font-weight: normal;
font-style: normal;
display: inline-block;
text-decoration: inherit;
- color: #DA5354;
- position: absolute;
- top: 5px;
- right: 5px;
- font-size: 2rem;
+ font-size: 1.5rem;
+ opacity: 0.5;
+ -webkit-font-smoothing: antialiased;
+ }
+
+ i.issue::before {
content: "\f071";
- -webkit-font-smoothing: antialiased
+ color: #da5354;
+ }
+
+ i.warning::before {
+ content: "\f071";
+ color: #ff9848;
+ }
+
+ i.ok::before {
+ content: "\f058";
+ color: #9fc820;
}
}
@@ -46,6 +75,10 @@ tr.panel-toggle-row {
* {
color: #1b3c56;
}
+
+ i.status::before {
+ opacity: 1.0;
+ }
}
}
@@ -72,7 +105,7 @@ tr.panel-row {
}
}
- td {
+ >td {
border-color: #444444;
padding: 0;
.panel {
@@ -82,6 +115,20 @@ tr.panel-row {
.row{
margin: 0px -4px;
+
+ padding: 20px 0px;
+
+ .column.alpha, .columns.alpha {
+ padding-left: 20px;
+
+ &.sixteen {
+ padding-right: 20px;
+ }
+ }
+
+ .column.omega, .columns.omega {
+ padding-right: 20px;
+ }
}
}
}
diff --git a/app/serializers/api/admin/index_enterprise_serializer.rb b/app/serializers/api/admin/index_enterprise_serializer.rb
index 0c5aef1b8e..a252557208 100644
--- a/app/serializers/api/admin/index_enterprise_serializer.rb
+++ b/app/serializers/api/admin/index_enterprise_serializer.rb
@@ -1,6 +1,8 @@
class Api::Admin::IndexEnterpriseSerializer < ActiveModel::Serializer
attributes :name, :id, :permalink, :is_primary_producer, :sells, :producer_profile_only, :owned, :edit_path
+ attributes :issues, :warnings
+
def owned
return true if options[:spree_current_user].admin?
object.owner == options[:spree_current_user]
@@ -9,4 +11,44 @@ class Api::Admin::IndexEnterpriseSerializer < ActiveModel::Serializer
def edit_path
edit_admin_enterprise_path(object)
end
+
+ def shipping_methods_ok?
+ return true unless object.is_distributor
+ object.shipping_methods.any?
+ end
+
+ def payment_methods_ok?
+ return true unless object.is_distributor
+ object.payment_methods.any?
+ end
+
+ def issues
+ [
+ {
+ resolved: shipping_methods_ok?,
+ description: "#{object.name} currently has no shipping methods.",
+ link: "Create New"
+ },
+ {
+ resolved: payment_methods_ok?,
+ description: "#{object.name} currently has no payment methods.",
+ link: "Create New"
+ },
+ {
+ resolved: object.confirmed?,
+ description: "Email confirmation is pending. We've sent a confirmation email to #{object.email}.",
+ link: "Resend Email"
+ }
+ ]
+ end
+
+ def warnings
+ [
+ {
+ resolved: object.visible,
+ description: "#{object.name} is not visible and so cannot be found on the map or in searches",
+ link: "Edit"
+ }
+ ]
+ end
end
diff --git a/app/views/admin/enterprises/_enterprise_user_index.html.haml b/app/views/admin/enterprises/_enterprise_user_index.html.haml
index bbe5fe0cb7..3eaff9dc13 100644
--- a/app/views/admin/enterprises/_enterprise_user_index.html.haml
+++ b/app/views/admin/enterprises/_enterprise_user_index.html.haml
@@ -50,8 +50,8 @@
%h5{ ng: { bind: "producer" } }
%td.package.panel-toggle.text-center{ ng: { show: 'columns.package.visible', class: "{error: packageError}" }, name: "package" }
%h5{ ng: { bind: "package" } }
- %td.status.panel-toggle.text-center{ ng: { show: 'columns.status.visible' }, name: "status" }
- %h5 Status
+ %td.status.panel-toggle.text-center{ ng: { show: 'columns.status.visible' }, bo: { class: "statusClass" }, name: "status" }
+ %i.status{ bo: { class: "status" } }
%td.manage{ ng: { show: 'columns.manage.visible' } }
%a.button.fullwidth{ bo: { href: 'enterprise.edit_path' } }
Manage