From 684606f4b2363aa4518acda6fcb5264111acf8f2 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 14 Jul 2023 00:45:27 -0400 Subject: [PATCH 1/4] #1202 adding jinjax macro to subscribers plan template --- .../admin/templates/admin/subscribers.html | 162 +++------------- .../macros/subscribers-plan-macro.html | 182 ++++++++++++++++++ 2 files changed, 204 insertions(+), 140 deletions(-) create mode 100644 subscribie/blueprints/admin/templates/macros/subscribers-plan-macro.html diff --git a/subscribie/blueprints/admin/templates/admin/subscribers.html b/subscribie/blueprints/admin/templates/admin/subscribers.html index 9953cc5e..140510c3 100644 --- a/subscribie/blueprints/admin/templates/admin/subscribers.html +++ b/subscribie/blueprints/admin/templates/admin/subscribers.html @@ -1,6 +1,6 @@ {% extends "admin/layout.html" %} {% block title %} Subscribers {% endblock %} - +{% import "macros/subscribers-plan-macro.html" as plan_template %} {% block body %}

My Subscribers

@@ -84,124 +84,23 @@

Search...

    • -
    • Title: - {{ subscription.plan.title }} -
    • -
    • - Interval: - {% if subscription.plan is not sameas None and subscription.plan.interval_unit is not sameas None %} - {{ subscription.plan.interval_unit.capitalize() }} - {% else %} - {{ subscription.plan.interval_unit }} - {% endif %} -
    • + {{ plan_template.subscriber_plan_title(subscription.plan.title, "subscription_title") }} + {{ plan_template.subscriber_plan_interval(subscription.plan) }} {% if subscription.chosen_options %} -
    • -
      - Chosen Options -
        - {% for choice in subscription.chosen_options %} -
      • {{ choice.choice_group_title }}: {{ choice.option_title }}
      • - {% endfor %} -
      -
      -
    • + {{ plan_template.subscriber_plan_chosen_options(subscription.chosen_options) }} {% endif %} -
    • Subscription ID: {{ subscription.uuid }}
    • -
    • Date started: {{ subscription.created_at.strftime('%Y-%m-%d') }}
    • -
    • - {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} - Price: - {{ subscription.showIntervalAmount() }} - {% else %} - (One-off. Not a subscription) - {% endif %} -
    • -
    • Sell price: - - {% if subscription.plan.requirements and subscription.plan.requirements.instant_payment %} - {{ subscription.showSellPrice() }}
    • - {% else %} - (No up-front fee) - {% endif %} - -
    • Status: - {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} - {% if subscription.stripe_pause_collection == "void" %} - Paused - {% else %} - {{ subscription.stripe_status }} - {% endif %} - {% else %} - Paid - {% endif %} -
    • - {% if subscription.stripe_cancel_at %} - Automatically Cancels at: - {{ subscription.stripe_cancel_at | timestampToDate }} - {% endif %} -
    • -
    • -
    • - {% if subscription.plan.requirements and subscription.plan.requirements.note_to_seller_required %} -
      - Order Note - {% if subscription.note %} - {{ subscription.note.note }} - {% else %} - No note was given. - {% endif %} -
      - {% endif %} -
    • -
    • Actions: - {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} - {% if subscription.stripe_status|lower in ['active', 'trialing', 'past_due', 'unpaid'] %} - {% if subscription.stripe_status|lower != 'trialing' and subscription.stripe_pause_collection != 'void' %} - - Pause - | - - Cancel - | - {% endif %} - {% endif %} - {% if subscription.stripe_pause_collection|lower == 'void' %} - - Resume - | - - Cancel - | - {% endif %} - {% endif %}
    • -
    • History: - View Transactions - -
    • -
    • Documents: - {% if subscription.documents|length == 0 %} - None - {% else %} -
        - {% for document in subscription.documents %} - {# Show documents assocated with subscription (if any) #} -
      • - {{ document.name }} | - {{ document.created_at.strftime('%Y-%m-%d') }}
      • - {% endfor %} -
      - {% endif %} -
    • + {{ plan_template.subscriber_plan_subscription_id("Subscription ID", subscription.uuid) }} + {{ plan_template.subscriber_plan_started_date(subscription.created_at) }} + {{ plan_template.subscriber_plan_interval_amount(subscription.plan.requirements, subscription) }} + {{ plan_template.subscriber_plan_sell_price("Sell price", "subscribers-plan-sell-price", subscription, transaction | default(null)) }} + {{ plan_template.subscriber_plan_status("subscription-status",subscription, transaction | default(null)) }} + {% if subscription.stripe_cancel_at %} + {{ plan_template.subscriber_plan_cancel_at(subscription.stripe_cancel_at) }} + {% endif %} + {{ plan_template.subscriber_plan_order_note(subscription.plan.requirements, subscription) }} + {{ plan_template.subscriber_plan_actions(subscription.plan.requirements, subscription) }} + {{ plan_template.subscriber_plan_history(subscription.person.uuid) }} + {{ plan_template.subscriber_plan_documents(subscription.documents) }}
  • @@ -214,29 +113,12 @@

    Search...

    {% if transaction.is_donation %}
    {% endif %} diff --git a/subscribie/blueprints/admin/templates/macros/subscribers-plan-macro.html b/subscribie/blueprints/admin/templates/macros/subscribers-plan-macro.html new file mode 100644 index 00000000..47f4c8d5 --- /dev/null +++ b/subscribie/blueprints/admin/templates/macros/subscribers-plan-macro.html @@ -0,0 +1,182 @@ +{% macro subscriber_plan_title(title, class_name) -%} +
  • Title: + {{ title }} +
  • + {%- endmacro %} + + + {% macro subscriber_plan_interval(plan) -%} +
  • + Interval: + {% if plan is not sameas None and plan.interval_unit is not sameas None %} + {{ plan.interval_unit.capitalize() }} + {% else %} + {{ plan.interval_unit }} + {% endif %} +
  • + {%- endmacro %} + + + {% macro subscriber_plan_chosen_options(chosen_options) -%} +
  • +
    + Chosen Options +
      + {% for choice in chosen_options %} +
    • {{ choice.choice_group_title }}: {{ choice.option_title }}
    • + {% endfor %} +
    +
    +
  • + {%- endmacro %} + + + {% macro subscriber_plan_subscription_id(title, uuid) -%} +
  • {{ title }}: {{ uuid }}
  • + {%- endmacro %} + + {% macro subscriber_plan_started_date(created_at) -%} +
  • Date started: {{ created_at.strftime('%Y-%m-%d') }}
  • + {%- endmacro %} + + {% macro subscriber_plan_interval_amount(plan_requirements, subscription) -%} +
  • Price: + + {% if plan_requirements and plan_requirements.subscription %} + {{ subscription.showIntervalAmount() }} + {% else %} + (One-off. Not a subscription) + {% endif %} + +
  • + {%- endmacro %} + + {% macro subscriber_plan_sell_price(title, class_name, subscription, transaction) -%} +
  • {{ title }}: + + {% if subscription.plan.requirements and subscription.plan.requirements.instant_payment %} + {{ subscription.showSellPrice() }} + {% elif transaction %} + {{ transaction.showSellPrice() }} + {% else %} + (No up-front fee) + {% endif %} + +
  • + {%- endmacro %} + + + {% macro subscriber_plan_status(class_name, subscription, transaction) -%} +
  • Status: + {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} + {% if subscription.stripe_pause_collection == "void" %} + Paused + {% else %} + {{ subscription.stripe_status }} + {% endif %} + {% elif transaction %} + transaction.status + {% else %} + Paid + {% endif %} +
  • + {%- endmacro %} + + + + {% macro subscriber_plan_cancel_at(cancel_at) -%} +
  • + Automatically Cancels at: + {{ cancel_at | timestampToDate }} +
  • + {%- endmacro %} + + + {% macro subscriber_plan_order_note(plan_requirements, subscription) -%} +
  • + {% if plan_requirements and plan_requirements.note_to_seller_required %} +
    + Order Note + {% if subscription.note %} + {{ subscription.note.note }} + {% else %} + No note was given. + {% endif %} +
    + {% endif %} +
  • + {%- endmacro %} + + + {% macro subscriber_plan_actions(plan_requirements, subscription) -%} + {% if plan_requirements and plan_requirements.subscription %} +
  • Actions: + {% if subscription.stripe_status|lower in ['active', 'trialing', 'past_due', 'unpaid'] %} + {% if subscription.stripe_status|lower != 'trialing' and subscription.stripe_pause_collection != 'void' %} + + Pause + | + + Cancel + | + {% endif %} + {% endif %} + {% if subscription.stripe_pause_collection|lower == 'void' %} + + Resume + | + + Cancel + | + {% endif %} + {% endif %}
  • + {%- endmacro %} + + + {% macro subscriber_plan_history(person_uuid)-%} +
  • History: + View Transactions + +
  • + {%- endmacro %} + + + {% macro subscriber_plan_documents(documents)-%} +
  • Documents: + {% if documents|length == 0 %} + None + {% else %} + + {% endif %} +
  • + {%- endmacro %} + + + {% macro subscriber_transaction_comment(title, comment) -%} +
  • + {% if comment %} +
    + {{ title }} + {{ comment }} + {% else %} + No note was given. +
    + {% endif %} +
  • + + {%- endmacro %} From ad85ffce60d890a8ca01d0abf72adbdd19a10067 Mon Sep 17 00:00:00 2001 From: chrisjsimpson Date: Sat, 15 Jul 2023 12:54:26 +0100 Subject: [PATCH 2/4] Revert "#1202 adding jinjax macro to subscribers plan template" This reverts commit 684606f4b2363aa4518acda6fcb5264111acf8f2. --- .../admin/templates/admin/subscribers.html | 162 +++++++++++++--- .../macros/subscribers-plan-macro.html | 182 ------------------ 2 files changed, 140 insertions(+), 204 deletions(-) delete mode 100644 subscribie/blueprints/admin/templates/macros/subscribers-plan-macro.html diff --git a/subscribie/blueprints/admin/templates/admin/subscribers.html b/subscribie/blueprints/admin/templates/admin/subscribers.html index 140510c3..9953cc5e 100644 --- a/subscribie/blueprints/admin/templates/admin/subscribers.html +++ b/subscribie/blueprints/admin/templates/admin/subscribers.html @@ -1,6 +1,6 @@ {% extends "admin/layout.html" %} {% block title %} Subscribers {% endblock %} -{% import "macros/subscribers-plan-macro.html" as plan_template %} + {% block body %}

    My Subscribers

    @@ -84,23 +84,124 @@

    Search...

    • - {{ plan_template.subscriber_plan_title(subscription.plan.title, "subscription_title") }} - {{ plan_template.subscriber_plan_interval(subscription.plan) }} +
    • Title: + {{ subscription.plan.title }} +
    • +
    • + Interval: + {% if subscription.plan is not sameas None and subscription.plan.interval_unit is not sameas None %} + {{ subscription.plan.interval_unit.capitalize() }} + {% else %} + {{ subscription.plan.interval_unit }} + {% endif %} +
    • {% if subscription.chosen_options %} - {{ plan_template.subscriber_plan_chosen_options(subscription.chosen_options) }} +
    • +
      + Chosen Options +
        + {% for choice in subscription.chosen_options %} +
      • {{ choice.choice_group_title }}: {{ choice.option_title }}
      • + {% endfor %} +
      +
      +
    • {% endif %} - {{ plan_template.subscriber_plan_subscription_id("Subscription ID", subscription.uuid) }} - {{ plan_template.subscriber_plan_started_date(subscription.created_at) }} - {{ plan_template.subscriber_plan_interval_amount(subscription.plan.requirements, subscription) }} - {{ plan_template.subscriber_plan_sell_price("Sell price", "subscribers-plan-sell-price", subscription, transaction | default(null)) }} - {{ plan_template.subscriber_plan_status("subscription-status",subscription, transaction | default(null)) }} - {% if subscription.stripe_cancel_at %} - {{ plan_template.subscriber_plan_cancel_at(subscription.stripe_cancel_at) }} - {% endif %} - {{ plan_template.subscriber_plan_order_note(subscription.plan.requirements, subscription) }} - {{ plan_template.subscriber_plan_actions(subscription.plan.requirements, subscription) }} - {{ plan_template.subscriber_plan_history(subscription.person.uuid) }} - {{ plan_template.subscriber_plan_documents(subscription.documents) }} +
    • Subscription ID: {{ subscription.uuid }}
    • +
    • Date started: {{ subscription.created_at.strftime('%Y-%m-%d') }}
    • +
    • + {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} + Price: + {{ subscription.showIntervalAmount() }} + {% else %} + (One-off. Not a subscription) + {% endif %} +
    • +
    • Sell price: + + {% if subscription.plan.requirements and subscription.plan.requirements.instant_payment %} + {{ subscription.showSellPrice() }}
    • + {% else %} + (No up-front fee) + {% endif %} + +
    • Status: + {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} + {% if subscription.stripe_pause_collection == "void" %} + Paused + {% else %} + {{ subscription.stripe_status }} + {% endif %} + {% else %} + Paid + {% endif %} +
    • + {% if subscription.stripe_cancel_at %} + Automatically Cancels at: + {{ subscription.stripe_cancel_at | timestampToDate }} + {% endif %} +
    • +
    • +
    • + {% if subscription.plan.requirements and subscription.plan.requirements.note_to_seller_required %} +
      + Order Note + {% if subscription.note %} + {{ subscription.note.note }} + {% else %} + No note was given. + {% endif %} +
      + {% endif %} +
    • +
    • Actions: + {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} + {% if subscription.stripe_status|lower in ['active', 'trialing', 'past_due', 'unpaid'] %} + {% if subscription.stripe_status|lower != 'trialing' and subscription.stripe_pause_collection != 'void' %} + + Pause + | + + Cancel + | + {% endif %} + {% endif %} + {% if subscription.stripe_pause_collection|lower == 'void' %} + + Resume + | + + Cancel + | + {% endif %} + {% endif %}
    • +
    • History: + View Transactions + +
    • +
    • Documents: + {% if subscription.documents|length == 0 %} + None + {% else %} +
        + {% for document in subscription.documents %} + {# Show documents assocated with subscription (if any) #} +
      • + {{ document.name }} | + {{ document.created_at.strftime('%Y-%m-%d') }}
      • + {% endfor %} +
      + {% endif %} +
  • @@ -113,12 +214,29 @@

    Search...

    {% if transaction.is_donation %}
      - {{ plan_template.subscriber_plan_title("Donation", "subscription_title") }} - {{ plan_template.subscriber_plan_subscription_id("Transaction ID", transaction.uuid) }} - {{ plan_template.subscriber_plan_started_date(transaction.created_at) }} - {{ plan_template.subscriber_plan_sell_price("Donation amount", "donation_amount", subscription | default(null), transaction) }} - {{ plan_template.subscriber_plan_status("transaction-status",subscription | default(null), transaction.payment_status) }} - {{ plan_template.subscriber_transaction_comment("Donation Note", transaction.comment) }} +
    • Title: + Donation +
    • +
    • Transaction ID: {{ transaction.uuid }}
    • +
    • Date: {{ transaction.created_at.strftime('%Y-%m-%d') }}
    • +
    • + Price: + {{ transaction.showSellPrice() }} +
    • + +
    • Status: + {{ transaction.payment_status }} +
    • +
    • + {% if transaction.comment %} +
      + Donation Note + {{ transaction.comment }} + {% else %} + No note was given. +
      + {% endif %} +
    {% endif %} diff --git a/subscribie/blueprints/admin/templates/macros/subscribers-plan-macro.html b/subscribie/blueprints/admin/templates/macros/subscribers-plan-macro.html deleted file mode 100644 index 47f4c8d5..00000000 --- a/subscribie/blueprints/admin/templates/macros/subscribers-plan-macro.html +++ /dev/null @@ -1,182 +0,0 @@ -{% macro subscriber_plan_title(title, class_name) -%} -
  • Title: - {{ title }} -
  • - {%- endmacro %} - - - {% macro subscriber_plan_interval(plan) -%} -
  • - Interval: - {% if plan is not sameas None and plan.interval_unit is not sameas None %} - {{ plan.interval_unit.capitalize() }} - {% else %} - {{ plan.interval_unit }} - {% endif %} -
  • - {%- endmacro %} - - - {% macro subscriber_plan_chosen_options(chosen_options) -%} -
  • -
    - Chosen Options -
      - {% for choice in chosen_options %} -
    • {{ choice.choice_group_title }}: {{ choice.option_title }}
    • - {% endfor %} -
    -
    -
  • - {%- endmacro %} - - - {% macro subscriber_plan_subscription_id(title, uuid) -%} -
  • {{ title }}: {{ uuid }}
  • - {%- endmacro %} - - {% macro subscriber_plan_started_date(created_at) -%} -
  • Date started: {{ created_at.strftime('%Y-%m-%d') }}
  • - {%- endmacro %} - - {% macro subscriber_plan_interval_amount(plan_requirements, subscription) -%} -
  • Price: - - {% if plan_requirements and plan_requirements.subscription %} - {{ subscription.showIntervalAmount() }} - {% else %} - (One-off. Not a subscription) - {% endif %} - -
  • - {%- endmacro %} - - {% macro subscriber_plan_sell_price(title, class_name, subscription, transaction) -%} -
  • {{ title }}: - - {% if subscription.plan.requirements and subscription.plan.requirements.instant_payment %} - {{ subscription.showSellPrice() }} - {% elif transaction %} - {{ transaction.showSellPrice() }} - {% else %} - (No up-front fee) - {% endif %} - -
  • - {%- endmacro %} - - - {% macro subscriber_plan_status(class_name, subscription, transaction) -%} -
  • Status: - {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} - {% if subscription.stripe_pause_collection == "void" %} - Paused - {% else %} - {{ subscription.stripe_status }} - {% endif %} - {% elif transaction %} - transaction.status - {% else %} - Paid - {% endif %} -
  • - {%- endmacro %} - - - - {% macro subscriber_plan_cancel_at(cancel_at) -%} -
  • - Automatically Cancels at: - {{ cancel_at | timestampToDate }} -
  • - {%- endmacro %} - - - {% macro subscriber_plan_order_note(plan_requirements, subscription) -%} -
  • - {% if plan_requirements and plan_requirements.note_to_seller_required %} -
    - Order Note - {% if subscription.note %} - {{ subscription.note.note }} - {% else %} - No note was given. - {% endif %} -
    - {% endif %} -
  • - {%- endmacro %} - - - {% macro subscriber_plan_actions(plan_requirements, subscription) -%} - {% if plan_requirements and plan_requirements.subscription %} -
  • Actions: - {% if subscription.stripe_status|lower in ['active', 'trialing', 'past_due', 'unpaid'] %} - {% if subscription.stripe_status|lower != 'trialing' and subscription.stripe_pause_collection != 'void' %} - - Pause - | - - Cancel - | - {% endif %} - {% endif %} - {% if subscription.stripe_pause_collection|lower == 'void' %} - - Resume - | - - Cancel - | - {% endif %} - {% endif %}
  • - {%- endmacro %} - - - {% macro subscriber_plan_history(person_uuid)-%} -
  • History: - View Transactions - -
  • - {%- endmacro %} - - - {% macro subscriber_plan_documents(documents)-%} -
  • Documents: - {% if documents|length == 0 %} - None - {% else %} -
      - {% for document in documents %} - {# Show documents assocated with subscription (if any) #} -
    • {{ document.name }} | - {{ document.created_at.strftime('%Y-%m-%d') }}
    • - {% endfor %} -
    - {% endif %} -
  • - {%- endmacro %} - - - {% macro subscriber_transaction_comment(title, comment) -%} -
  • - {% if comment %} -
    - {{ title }} - {{ comment }} - {% else %} - No note was given. -
    - {% endif %} -
  • - - {%- endmacro %} From 893abcea3d263800f691afe7504dd488ab00dd6a Mon Sep 17 00:00:00 2001 From: chrisjsimpson Date: Sat, 15 Jul 2023 13:12:11 +0100 Subject: [PATCH 3/4] Fix #1202 added maro subscriber_subscription_plan_card.html --- .../admin/templates/admin/subscribers.html | 126 +----------------- .../subscriber_subscription_plan_card.html | 124 +++++++++++++++++ 2 files changed, 127 insertions(+), 123 deletions(-) create mode 100644 subscribie/blueprints/admin/templates/macros/subscriber_subscription_plan_card.html diff --git a/subscribie/blueprints/admin/templates/admin/subscribers.html b/subscribie/blueprints/admin/templates/admin/subscribers.html index 9953cc5e..14b90135 100644 --- a/subscribie/blueprints/admin/templates/admin/subscribers.html +++ b/subscribie/blueprints/admin/templates/admin/subscribers.html @@ -1,7 +1,8 @@ -{% extends "admin/layout.html" %} +{% extends "admin/layout.html" %} {% block title %} Subscribers {% endblock %} {% block body %} +{% from 'macros/subscriber_subscription_plan_card.html' import subscriber_subscription_plan_card %}

    My Subscribers

    @@ -82,128 +83,7 @@

    Search...

      {% for subscription in person.subscriptions %}
    • -
      -
        -
      • Title: - {{ subscription.plan.title }} -
      • -
      • - Interval: - {% if subscription.plan is not sameas None and subscription.plan.interval_unit is not sameas None %} - {{ subscription.plan.interval_unit.capitalize() }} - {% else %} - {{ subscription.plan.interval_unit }} - {% endif %} -
      • - {% if subscription.chosen_options %} -
      • -
        - Chosen Options -
          - {% for choice in subscription.chosen_options %} -
        • {{ choice.choice_group_title }}: {{ choice.option_title }}
        • - {% endfor %} -
        -
        -
      • - {% endif %} -
      • Subscription ID: {{ subscription.uuid }}
      • -
      • Date started: {{ subscription.created_at.strftime('%Y-%m-%d') }}
      • -
      • - {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} - Price: - {{ subscription.showIntervalAmount() }} - {% else %} - (One-off. Not a subscription) - {% endif %} -
      • -
      • Sell price: - - {% if subscription.plan.requirements and subscription.plan.requirements.instant_payment %} - {{ subscription.showSellPrice() }}
      • - {% else %} - (No up-front fee) - {% endif %} - -
      • Status: - {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} - {% if subscription.stripe_pause_collection == "void" %} - Paused - {% else %} - {{ subscription.stripe_status }} - {% endif %} - {% else %} - Paid - {% endif %} -
      • - {% if subscription.stripe_cancel_at %} - Automatically Cancels at: - {{ subscription.stripe_cancel_at | timestampToDate }} - {% endif %} -
      • -
      • -
      • - {% if subscription.plan.requirements and subscription.plan.requirements.note_to_seller_required %} -
        - Order Note - {% if subscription.note %} - {{ subscription.note.note }} - {% else %} - No note was given. - {% endif %} -
        - {% endif %} -
      • -
      • Actions: - {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} - {% if subscription.stripe_status|lower in ['active', 'trialing', 'past_due', 'unpaid'] %} - {% if subscription.stripe_status|lower != 'trialing' and subscription.stripe_pause_collection != 'void' %} - - Pause - | - - Cancel - | - {% endif %} - {% endif %} - {% if subscription.stripe_pause_collection|lower == 'void' %} - - Resume - | - - Cancel - | - {% endif %} - {% endif %}
      • -
      • History: - View Transactions - -
      • -
      • Documents: - {% if subscription.documents|length == 0 %} - None - {% else %} -
          - {% for document in subscription.documents %} - {# Show documents assocated with subscription (if any) #} -
        • - {{ document.name }} | - {{ document.created_at.strftime('%Y-%m-%d') }}
        • - {% endfor %} -
        - {% endif %} -
      • -
      -
      + {{ subscriber_subscription_plan_card(subscription) }}
    • {% endfor %}
    diff --git a/subscribie/blueprints/admin/templates/macros/subscriber_subscription_plan_card.html b/subscribie/blueprints/admin/templates/macros/subscriber_subscription_plan_card.html new file mode 100644 index 00000000..eac916d7 --- /dev/null +++ b/subscribie/blueprints/admin/templates/macros/subscriber_subscription_plan_card.html @@ -0,0 +1,124 @@ +{% macro subscriber_subscription_plan_card(subscription) -%} +
    +
      +
    • Title: + {{ subscription.plan.title }} +
    • +
    • + Interval: + {% if subscription.plan is not sameas None and subscription.plan.interval_unit is not sameas None %} + {{ subscription.plan.interval_unit.capitalize() }} + {% else %} + {{ subscription.plan.interval_unit }} + {% endif %} +
    • + {% if subscription.chosen_options %} +
    • +
      + Chosen Options +
        + {% for choice in subscription.chosen_options %} +
      • {{ choice.choice_group_title }}: {{ choice.option_title }}
      • + {% endfor %} +
      +
      +
    • + {% endif %} +
    • Subscription ID: {{ subscription.uuid }}
    • +
    • Date started: {{ subscription.created_at.strftime('%Y-%m-%d') }}
    • +
    • + {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} + Price: + {{ subscription.showIntervalAmount() }} + {% else %} + (One-off. Not a subscription) + {% endif %} +
    • +
    • Sell price: + + {% if subscription.plan.requirements and subscription.plan.requirements.instant_payment %} + {{ subscription.showSellPrice() }}
    • + {% else %} + (No up-front fee) + {% endif %} + +
    • Status: + {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} + {% if subscription.stripe_pause_collection == "void" %} + Paused + {% else %} + {{ subscription.stripe_status }} + {% endif %} + {% else %} + Paid + {% endif %} +
    • + {% if subscription.stripe_cancel_at %} + Automatically Cancels at: + {{ subscription.stripe_cancel_at | timestampToDate }} + {% endif %} +
    • +
    • +
    • + {% if subscription.plan.requirements and subscription.plan.requirements.note_to_seller_required %} +
      + Order Note + {% if subscription.note %} + {{ subscription.note.note }} + {% else %} + No note was given. + {% endif %} +
      + {% endif %} +
    • +
    • Actions: + {% if subscription.plan.requirements and subscription.plan.requirements.subscription %} + {% if subscription.stripe_status|lower in ['active', 'trialing', 'past_due', 'unpaid'] %} + {% if subscription.stripe_status|lower != 'trialing' and subscription.stripe_pause_collection != 'void' %} + + Pause + | + + Cancel + | + {% endif %} + {% endif %} + {% if subscription.stripe_pause_collection|lower == 'void' %} + + Resume + | + + Cancel + | + {% endif %} + {% endif %}
    • +
    • History: + View Transactions + +
    • +
    • Documents: + {% if subscription.documents|length == 0 %} + None + {% else %} +
        + {% for document in subscription.documents %} + {# Show documents assocated with subscription (if any) #} +
      • + {{ document.name }} | + {{ document.created_at.strftime('%Y-%m-%d') }}
      • + {% endfor %} +
      + {% endif %} +
    • +
    +
    +{%- endmacro %} \ No newline at end of file From ba7e19c46e84f09f0bbf30c0e35ab445ff27f124 Mon Sep 17 00:00:00 2001 From: chrisjsimpson Date: Sat, 15 Jul 2023 13:17:14 +0100 Subject: [PATCH 4/4] #1202 naming. subscriber_subscription_plan_card(subscription) -> subscriber_subscription_card(subscription) --- subscribie/blueprints/admin/templates/admin/subscribers.html | 4 ++-- ...ption_plan_card.html => subscriber_subscription_card.html} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename subscribie/blueprints/admin/templates/macros/{subscriber_subscription_plan_card.html => subscriber_subscription_card.html} (98%) diff --git a/subscribie/blueprints/admin/templates/admin/subscribers.html b/subscribie/blueprints/admin/templates/admin/subscribers.html index 14b90135..3fb1e733 100644 --- a/subscribie/blueprints/admin/templates/admin/subscribers.html +++ b/subscribie/blueprints/admin/templates/admin/subscribers.html @@ -2,7 +2,7 @@ {% block title %} Subscribers {% endblock %} {% block body %} -{% from 'macros/subscriber_subscription_plan_card.html' import subscriber_subscription_plan_card %} +{% from 'macros/subscriber_subscription_card.html' import subscriber_subscription_card %}

    My Subscribers

    @@ -83,7 +83,7 @@

    Search...

      {% for subscription in person.subscriptions %}
    • - {{ subscriber_subscription_plan_card(subscription) }} + {{ subscriber_subscription_card(subscription) }}
    • {% endfor %}
    diff --git a/subscribie/blueprints/admin/templates/macros/subscriber_subscription_plan_card.html b/subscribie/blueprints/admin/templates/macros/subscriber_subscription_card.html similarity index 98% rename from subscribie/blueprints/admin/templates/macros/subscriber_subscription_plan_card.html rename to subscribie/blueprints/admin/templates/macros/subscriber_subscription_card.html index eac916d7..0035daa1 100644 --- a/subscribie/blueprints/admin/templates/macros/subscriber_subscription_plan_card.html +++ b/subscribie/blueprints/admin/templates/macros/subscriber_subscription_card.html @@ -1,4 +1,4 @@ -{% macro subscriber_subscription_plan_card(subscription) -%} +{% macro subscriber_subscription_card(subscription) -%}
    • Title: