Restructure omni services and add Chatwoot research snapshot
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<div class="field-unit__label">
|
||||
<%= f.label field.attribute %>
|
||||
</div>
|
||||
<div class="field-unit__field feature-container">
|
||||
<% regular_features, premium_features = SuperAdmin::AccountFeaturesHelper.filtered_features(field.data).partition { |key_array, _val| !SuperAdmin::AccountFeaturesHelper.account_premium_features.include?(key_array.first) } %>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<% regular_features.each do |key_array, val| %>
|
||||
<% feature_key, display_name = key_array %>
|
||||
<div class="flex items-center justify-between p-3 bg-white rounded-lg shadow-sm outline outline-1 outline-n-container">
|
||||
<span class="text-sm text-slate-700"><%= display_name %></span>
|
||||
<span><%= check_box "enabled_features", "feature_#{feature_key}", { checked: val, class: "h-4 w-4 rounded border-slate-300 text-violet-600 focus:ring-violet-600" }, true, false %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<hr class="my-8 boshadow-sm outline outline-1 outline-n-container">
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<% premium_features.each do |key_array, val| %>
|
||||
<% feature_key, display_name = key_array %>
|
||||
<div class="flex items-center justify-between p-3 bg-white rounded-lg shadow-sm outline outline-1 outline-n-container">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-amber-500">
|
||||
<svg class="h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M480 224l-186.828 7.487L401.688 64l-59.247-32L256 208 169.824 32l-59.496 32 108.5 167.487L32 224v64l185.537-10.066L113.65 448l55.969 32L256 304l86.381 176 55.949-32-103.867-170.066L480 288z" fill="currentColor"/></svg>
|
||||
</span>
|
||||
<span class="text-sm text-slate-700"><%= display_name %></span>
|
||||
</div>
|
||||
<% should_disable = ChatwootHub.pricing_plan == 'community' %>
|
||||
<span><%= check_box "enabled_features", "feature_#{feature_key}", { checked: val, disabled: should_disable, class: "h-4 w-4 rounded border-slate-300 text-violet-600 focus:ring-violet-600" }, true, false %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,34 @@
|
||||
<div class="w-full">
|
||||
<% regular_features, premium_features = SuperAdmin::AccountFeaturesHelper.partition_features(field.data) %>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
||||
<% regular_features.each do |key_array, val| %>
|
||||
<% feature_key, display_name = key_array %>
|
||||
<div class="flex items-center justify-between p-3 bg-white rounded-md outline outline-n-container outline-1 shadow-sm">
|
||||
<span class="text-sm text-n-slate-12"><%= display_name %></span>
|
||||
<span class="<%= val.present? ? 'bg-green-400 text-white': 'bg-slate-50 text-slate-800' %> rounded-full p-1 inline-flex right-4 top-5">
|
||||
<svg width="12" height="12"><use xlink:href="#icon-tick-line" /></svg>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<hr class="my-8 border-t border-n-weak">
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
||||
<% premium_features.each do |key_array, val| %>
|
||||
<% feature_key, display_name = key_array %>
|
||||
<div class="flex items-center justify-between p-3 bg-white rounded-md outline outline-n-container outline-1 shadow-sm">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="bg-n-amber-3 text-n-amber-12 rounded-full p-1 inline-flex right-4 top-5">
|
||||
<svg width="12" height="12"><use xlink:href="#icon-lock-line" /></svg>
|
||||
</span>
|
||||
<span class="text-sm text-n-slate-12"><%= display_name %></span>
|
||||
</div>
|
||||
<span class="<%= val.present? ? 'bg-green-400 text-white': 'bg-slate-50 text-slate-800' %> rounded-full p-1 inline-flex right-4 top-5">
|
||||
<svg width="12" height="12"><use xlink:href="#icon-tick-line" /></svg>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,9 @@
|
||||
<div class="field-unit__label">
|
||||
<%= f.label field.attribute %>
|
||||
</div>
|
||||
<div class="field-unit__field">
|
||||
|
||||
<% JSON.parse(field.to_s).each do |key,val| %>
|
||||
<%= key %>: <%= number_field "account[limits]", key, value: val %> </br>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<%= field.to_s %>
|
||||
@@ -0,0 +1,3 @@
|
||||
<% JSON.parse(field.to_s).each do |k,v| %>
|
||||
<%= k %>: <%= v %> </br>
|
||||
<% end %>
|
||||
@@ -0,0 +1,41 @@
|
||||
<%
|
||||
# Get all feature names and their display names
|
||||
all_feature_display_names = SuperAdmin::AccountFeaturesHelper.feature_display_names
|
||||
|
||||
# Business and Enterprise plan features only
|
||||
premium_features = Enterprise::Billing::HandleStripeEventService::BUSINESS_PLAN_FEATURES +
|
||||
Enterprise::Billing::HandleStripeEventService::ENTERPRISE_PLAN_FEATURES
|
||||
|
||||
# Get only premium features with display names
|
||||
premium_features_with_display = premium_features.map do |feature|
|
||||
[feature, all_feature_display_names[feature] || feature.humanize]
|
||||
end.sort_by { |_, display_name| display_name }
|
||||
|
||||
# Get already selected features
|
||||
selected_features = field.selected_features
|
||||
%>
|
||||
|
||||
<div class="field-unit__label">
|
||||
<%= f.label :manually_managed_features %>
|
||||
</div>
|
||||
<div class="field-unit__field feature-container">
|
||||
<p class="text-gray-400 text-xs italic mb-4">Features that remain enabled even when account plan is downgraded</p>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<% premium_features_with_display.each do |feature_key, display_name| %>
|
||||
<div class="flex items-center justify-between p-3 bg-white rounded-lg shadow-sm outline outline-1 outline-n-container">
|
||||
<span class="text-sm text-slate-700"><%= display_name %></span>
|
||||
<span>
|
||||
<%= check_box_tag "account[manually_managed_features][]",
|
||||
feature_key,
|
||||
selected_features.include?(feature_key),
|
||||
class: "h-4 w-4 rounded border-slate-300 text-violet-600 focus:ring-violet-600" %>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<hr class="my-8 border-t border-n-weak">
|
||||
|
||||
<%= hidden_field_tag "account[manually_managed_features][]", "", id: nil %>
|
||||
</div>
|
||||
@@ -0,0 +1,31 @@
|
||||
<%
|
||||
selected_features = field.selected_features
|
||||
|
||||
# Get all feature names and their display names
|
||||
all_feature_display_names = SuperAdmin::AccountFeaturesHelper.feature_display_names
|
||||
|
||||
# Business and Enterprise plan features only
|
||||
premium_features = Enterprise::Billing::HandleStripeEventService::BUSINESS_PLAN_FEATURES +
|
||||
Enterprise::Billing::HandleStripeEventService::ENTERPRISE_PLAN_FEATURES
|
||||
%>
|
||||
|
||||
<% if selected_features.present? %>
|
||||
<div class="w-full">
|
||||
<p class="text-gray-400 text-xs italic mb-2">Features that remain enabled even when account plan is downgraded</p>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
|
||||
<% selected_features.each do |feature| %>
|
||||
<div class="flex items-center justify-between p-3 bg-white rounded-md outline outline-n-container outline-1 shadow-sm">
|
||||
<span class="text-sm text-n-slate-12"><%= all_feature_display_names[feature] || feature.humanize %></span>
|
||||
<span class="bg-green-400 text-white rounded-full p-1 inline-flex right-4 top-5">
|
||||
<svg width="12" height="12"><use xlink:href="#icon-tick-line" /></svg>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<hr class="my-8 border-t border-n-weak">
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="text-gray-400 text-xs italic">No manually managed features configured</p>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user