2016-08-05 12:00:34 +00:00
|
|
|
|
<style type="text/css">
|
|
|
|
|
#notification{
|
|
|
|
|
background-color: #ececec;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
left: 40%;
|
|
|
|
|
padding: 10px;
|
|
|
|
|
position: absolute;
|
|
|
|
|
text-align: center;
|
|
|
|
|
top: 40px;
|
|
|
|
|
width: auto;
|
|
|
|
|
z-index: 1200;
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
.badge-info{
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
}
|
|
|
|
|
#approver-list{
|
|
|
|
|
list-style: none;
|
|
|
|
|
margin-left: 5px;
|
|
|
|
|
}
|
|
|
|
|
#approver-list li {
|
|
|
|
|
border-bottom: 1px solid #efefef;
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
padding-bottom: 10px;
|
|
|
|
|
}
|
|
|
|
|
#approver-list .approver-avatar{
|
|
|
|
|
width: 60px;
|
|
|
|
|
height: 60px;
|
|
|
|
|
border-radius: 50px;
|
|
|
|
|
margin-right: 20px;
|
|
|
|
|
}
|
|
|
|
|
#approver-list .approver-check{
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
margin-top: 25px;
|
|
|
|
|
}
|
|
|
|
|
#approver-list .approver-check input{
|
|
|
|
|
margin-right: 5px;
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
}
|
|
|
|
|
#approver-list .approver-check label{
|
|
|
|
|
display: inline;
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
}
|
|
|
|
|
#approver-list .approver-title{
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|
2016-09-02 02:45:05 +00:00
|
|
|
|
<%
|
|
|
|
|
sub_managers = @module_app.sub_managers
|
|
|
|
|
sub_managers.delete(nil)
|
|
|
|
|
%>
|
2018-01-19 09:05:26 +00:00
|
|
|
|
<div id="notification"><%= t("announcement.click_on_submit") %></div>
|
2015-12-22 11:04:13 +00:00
|
|
|
|
<%= form_for @setting, url: (@setting.new_record? ? admin_announcement_createsettings_path : admin_announcement_updatesettings_path), html: {class: "form-horizontal main-forms"} do |f| %>
|
|
|
|
|
<div class="input-area">
|
|
|
|
|
<div class="control-group">
|
2018-01-19 09:05:26 +00:00
|
|
|
|
<%= f.label :top_limit, t("announcement.top_limit"), :class => "control-label muted" %>
|
2015-12-22 11:04:13 +00:00
|
|
|
|
<div class="controls">
|
|
|
|
|
<%= f.number_field :top_limit, :min => "0" %>
|
2018-01-19 09:05:26 +00:00
|
|
|
|
<span class="help-block"><%= t("announcement.for_unlimited") %></span>
|
2015-12-22 11:04:13 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2016-08-08 11:14:00 +00:00
|
|
|
|
<% if AnnouncementSetting.is_pro? %>
|
2016-08-05 12:00:34 +00:00
|
|
|
|
<% if !sub_managers.blank? %>
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<%= f.label "Approver Setting", :class => "control-label muted" %>
|
|
|
|
|
<div class="controls">
|
2018-01-19 09:05:26 +00:00
|
|
|
|
<a href="#approverModal" role="button" class="btn" data-toggle="modal"><%= t("announcement.approvers_list") %></a>
|
2016-08-05 12:00:34 +00:00
|
|
|
|
<span class="badge badge-info"><%= @setting.approvers.count %></span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<% else %>
|
|
|
|
|
<div class="control-group">
|
2018-01-19 09:05:26 +00:00
|
|
|
|
<a href="/admin/authorizations/announcement"><%= t("announcement.click_set_sub_manager") %></a>
|
2016-08-05 12:00:34 +00:00
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<div class="control-group">
|
|
|
|
|
<%= f.label "Send emails to", :class => "control-label muted" %>
|
|
|
|
|
<div class="controls">
|
2018-01-19 09:05:26 +00:00
|
|
|
|
<input type="checkbox" name="announcement_setting[email_to][]" value="admins" <%= @setting.email_to.include?("admins") ? "checked=checked" : "" %>> <%= t("admin") %>
|
|
|
|
|
<input type="checkbox" name="announcement_setting[email_to][]" value="managers" <%= @setting.email_to.include?("managers") ? "checked=checked" : "" %>> <%= t("manager") %>
|
|
|
|
|
<input type="checkbox" name="announcement_setting[email_to][]" value="approvers" <%= @setting.email_to.include?("approvers") ? "checked=checked" : "" %>> <%= t("announcement.approver") %>
|
2016-08-05 12:00:34 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="hidden-approver-list">
|
|
|
|
|
<% sub_managers.each do |sm| %>
|
|
|
|
|
<% if @setting.approvers.include?(sm.id.to_s) %>
|
|
|
|
|
<input type="hidden" id="check_<%= sm.id.to_s %>" value="<%= sm.id.to_s %>" name="announcement_setting[approvers][]">
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
2015-12-22 11:04:13 +00:00
|
|
|
|
</div>
|
2016-08-08 11:14:00 +00:00
|
|
|
|
<% end %>
|
2015-12-22 11:04:13 +00:00
|
|
|
|
<div class="form-actions">
|
|
|
|
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
|
|
|
|
</div>
|
2016-08-05 12:00:34 +00:00
|
|
|
|
<% end %>
|
2016-08-08 11:14:00 +00:00
|
|
|
|
<% if AnnouncementSetting.is_pro? %>
|
2016-08-05 12:00:34 +00:00
|
|
|
|
<div id="approverModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="approverModalLabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
2018-01-19 09:05:26 +00:00
|
|
|
|
<h3 id="approverModalLabel"><%= t("sub_manager") %></h3>
|
2016-08-05 12:00:34 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<ul id="approver-list">
|
|
|
|
|
<% sub_managers.each do |sm| %>
|
|
|
|
|
<li>
|
|
|
|
|
<%= image_tag sm.member_profile.avatar.thumb, :class => "approver-avatar" %>
|
|
|
|
|
<span class="approver-title"><%= sm.name %></span>
|
|
|
|
|
<span class="pull-right approver-check">
|
|
|
|
|
<input id="checkbox_<%= sm.id %>" type="checkbox" value="<%= sm.id %>" <%= @setting.approvers.include?(sm.id.to_s) ? "checked=checked" : "" %>>
|
2018-01-19 09:05:26 +00:00
|
|
|
|
<label for="checkbox_<%= sm.id %>"><%= t("announcement.approver") %></label>
|
2016-08-05 12:00:34 +00:00
|
|
|
|
</span>
|
|
|
|
|
</li>
|
|
|
|
|
<% end %>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Ok</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
var approverList = $(".hidden-approver-list");
|
|
|
|
|
$(".approver-check input").on("click",function(){
|
|
|
|
|
var el = $(this);
|
|
|
|
|
if(el.is(":checked")){
|
|
|
|
|
var t = $("<input type='hidden'>");
|
|
|
|
|
t.val(el.val());
|
|
|
|
|
t.attr("name", "announcement_setting[approvers][]");
|
|
|
|
|
t.attr("id", "check_" + el.val());
|
|
|
|
|
approverList.append(t);
|
|
|
|
|
}else{
|
|
|
|
|
approverList.find("#check_" + el.val()).remove();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
$("#approverModal").on("hidden",function(){
|
|
|
|
|
$("#notification").slideDown();
|
|
|
|
|
$(".badge-info").text($(".hidden-approver-list input").length);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
</script>
|
2016-08-08 11:14:00 +00:00
|
|
|
|
<% end %>
|
2016-08-05 12:00:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|