Skip to content

Commit

Permalink
Merge pull request #41 from xjlin0/envelopes_controls
Browse files Browse the repository at this point in the history
Envelopes controls
  • Loading branch information
xjlin0 authored Sep 28, 2024
2 parents cf548ac + 1ebefa4 commit fc398e0
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ def get_context_data(self, **kwargs):
) if self.request.user.privileged() else []

context.update({
'report_titles': self.request.GET.get('reportTitle', '').split('\n'),
'report_dates': self.request.GET.get('reportDate', '').split('\n'),
'report_titles': self.request.GET.get('reportTitle', ''),
'report_dates': self.request.GET.get('reportDate', ''),
'sender_color': self.request.GET.get('senderColor', '#000000'),
'sender_inner_width': self.request.GET.get('senderInnerWidth', '12rem'),
'sender_outer_width': self.request.GET.get('senderOuterWidth', '22rem'),
'sender_inner_width': self.request.GET.get('senderInnerWidth', '17rem'),
'sender_outer_width': self.request.GET.get('senderOuterWidth', '19rem'),
'meet_slug': self.request.GET.get('meet', ''),
'families': families,
'newLines': range(int(self.request.GET.get('newLines', '2'))),
'newLines': range(int(self.request.GET.get('newLines', '2') or '0')),
'attendee_url': '/persons/attendee/',
})
return context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ class AttendingmeetPrintConfigurationView(RouteGuard, ListView):
template_name = "persons/attendingmeet_print_configuration_view.html"

def get_context_data(self, **kwargs):
user_organization = self.request.user.organization
user_organization_full_name = user_organization.infos.get('full_name') or user_organization.display_name
context = super().get_context_data(**kwargs)
context.update({
'user_organization_full_name': user_organization_full_name,
'pdf_url': '/persons/attendingmeet_report/',
'envelopes_url': '/persons/attendingmeet_envelopes/',
"meets_endpoint_by_slug": "/occasions/api/organization_meets/",
Expand Down
Binary file added attendees/static/images/envelope.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
168 changes: 84 additions & 84 deletions attendees/static/js/persons/attendingmeet_print_configuration_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,6 @@ Attendees.attendingmeetPrintConfiguration = {
e.component.getEditor('meet').getDataSource().reload();
},
items: [
{
dataField: "reportTitle",
editorType: 'dxTextArea',
helpText: '(Optional) Sender address line 1 on envelope, or the Title on reports. Enter for new lines.',
label: {
text: 'Text 1',
},
editorOptions: {
height: 100,
autoResizeEnabled: true,
value: 'Sample title',
showClearButton: true,
buttons: [
'clear',
],
},
},
{
dataField: "reportDate",
editorType: 'dxTextArea',
helpText: '(Optional) Sender address line 2 on envelope, or the date on reports.',
label: {
text: 'Text 2',
},
editorOptions: {
height: 70,
autoResizeEnabled: true,
value: new Date().toLocaleDateString('en', { day: '2-digit', month: 'long', year: 'numeric' }),
showClearButton: true,
buttons: [
'clear',
],
},
},
{
dataField: 'meet',
isRequired: true,
Expand Down Expand Up @@ -109,6 +75,87 @@ Attendees.attendingmeetPrintConfiguration = {
}),
},
},
{
dataField: 'divisions',
editorType: 'dxTagBox',
validationRules: [{type: 'required'}],
isRequired: true,
label: {
text: 'divisions selector',
},
editorOptions: {
valueExpr: 'slug',
displayExpr: 'display_name',
placeholder: 'Select a value...',
showClearButton: true,
buttons:[
'clear',
{
name: 'selectAll',
stylingMode: 'outlined',
location: 'after',
options: {
icon: 'fas fa-solid fa-check-double',
type: 'default',
elementAttr: {
title: 'select all divisions',
},
onClick() {
Attendees.utilities.selectAllGroupedTags(Attendees.attendingmeetPrintConfiguration.form.getEditor('divisions'));
},
},
},
],
dataSource: new DevExpress.data.DataSource({
store: new DevExpress.data.CustomStore({
key: 'slug',
loadMode: 'raw',
load: (e) => {
const d = $.Deferred();
$.get(document.attendingmeetPrintConfigurationForm.dataset.divisionsEndpoint).done((response) => {
d.resolve(response.data);
Attendees.utilities.selectAllGroupedTags(Attendees.attendingmeetPrintConfiguration.form.getEditor('divisions'));
});
return d.promise();
},
})
}),
},
},
{
dataField: "reportTitle",
editorType: 'dxTextArea',
helpText: '(Optional) Sender address line 1 on envelope, or the Title on reports. Enter for new lines.',
label: {
text: 'Text 1 in bigger font',
},
editorOptions: {
height: 100,
autoResizeEnabled: true,
value: document.attendingmeetPrintConfigurationForm.dataset.userOrganizationFullName || 'Sample title',
showClearButton: true,
buttons: [
'clear',
],
},
},
{
dataField: "reportDate",
editorType: 'dxTextArea',
helpText: '(Optional) Sender address line 2 on envelope, or the date on reports. Enter for new lines.',
label: {
text: 'Text 2',
},
editorOptions: {
height: 100,
autoResizeEnabled: true,
value: new Date().toLocaleDateString('en', { day: '2-digit', month: 'long', year: 'numeric' }),
showClearButton: true,
buttons: [
'clear',
],
},
},
{
dataField: 'showPaused',
helpText: 'show paused participations in reports',
Expand All @@ -129,7 +176,7 @@ Attendees.attendingmeetPrintConfiguration = {
editorOptions: {
value: 2,
showSpinButtons: true,
showClearButton: true,
min: 0,
},
},
{
Expand All @@ -145,7 +192,7 @@ Attendees.attendingmeetPrintConfiguration = {
},
{
dataField: 'senderInnerWidth',
helpText: 'The inner width of the sender address controls its position, controls the left margin of the sender address. it should be smaller than outer width. Better to bigger than 16rem',
helpText: "The inner width of the sender address alters sender address horizontal position on envelopes only. It controls the width of the sender address. Smaller numbers make the sender's address more to the left. It should be smaller than outer width and bigger than 16rem.",
label: {
text: 'Inner width of the sender on envelopes',
},
Expand All @@ -155,61 +202,14 @@ Attendees.attendingmeetPrintConfiguration = {
},
{
dataField: 'senderOuterWidth',
helpText: 'The inner width of the sender address controls its position, controls the left margin of the recipient address. it should be bigger than inner width. Better to smaller than 29rem',
helpText: "The outer width of the sender address alters recipient address horizontal position on envelopes only, it controls the left margin of the recipient address. it should be bigger than inner width. Smaller numbers make the recipient's address more to the left. Better to smaller than 29rem",
label: {
text: 'Outer width of the sender on envelopes',
},
editorOptions: {
value: '19rem',
},
},
{
dataField: 'divisions',
editorType: 'dxTagBox',
validationRules: [{type: 'required'}],
isRequired: true,
label: {
text: 'divisions selector',
},
editorOptions: {
valueExpr: 'slug',
displayExpr: 'display_name',
placeholder: 'Select a value...',
showClearButton: true,
buttons:[
'clear',
{
name: 'selectAll',
stylingMode: 'outlined',
location: 'after',
options: {
icon: 'fas fa-solid fa-check-double',
type: 'default',
elementAttr: {
title: 'select all divisions',
},
onClick() {
Attendees.utilities.selectAllGroupedTags(Attendees.attendingmeetPrintConfiguration.form.getEditor('divisions'));
},
},
},
],
dataSource: new DevExpress.data.DataSource({
store: new DevExpress.data.CustomStore({
key: 'slug',
loadMode: 'raw',
load: (e) => {
const d = $.Deferred();
$.get(document.attendingmeetPrintConfigurationForm.dataset.divisionsEndpoint).done((response) => {
d.resolve(response.data);
Attendees.utilities.selectAllGroupedTags(Attendees.attendingmeetPrintConfiguration.form.getEditor('divisions'));
});
return d.promise();
},
})
}),
},
},
{
colCount: 12,
itemType: 'group',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,19 @@
{% for folk in families %}
{% if folk.families and folk.families|length > 0 %}
<div class="d-flex">

<div class="sender"
style="flex-basis: {{sender_outer_width}};">
<h6 class="center-text"
style="color:{{sender_color}}; width:{{sender_inner_width}}; text-align: center;">
{% for report_title in report_titles %}
{{ report_title }}
<br>
{% endfor %}
{% for report_date in report_dates %}
{{ report_date }}
<br>
{% endfor %}
<span style="font-family: dfkai-sb, stkaiti, cwTeXKai, 標楷體, kaiti, 华文楷体; font-size: 120%;">
{{report_titles|linebreaksbr}}
</span>
<br>
{{report_dates|linebreaksbr}}
</h6>
</div>

<div class="recipient">
<a class="link-as-text"
href="{{attendee_url}}{{folk.recipient_attendee_id}}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ <h4>
name="attendingmeetPrintConfigurationForm"
data-meets-endpoint-by-slug="{{meets_endpoint_by_slug|safe}}"
data-divisions-endpoint="{{divisions_endpoint|safe}}"
data-user-organization-full-name="{{user_organization_full_name}}"
data-envelopes-url="{{envelopes_url}}"
action="{{pdf_url}}">
<div id="print-configuration-form"></div>
</form>
<br>
<img src="/static/images/envelope.png" width="90%">
<div class="spinner-border d-none"
role="status">
<span class="sr-only">
Expand Down
Loading

0 comments on commit fc398e0

Please sign in to comment.