-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0bd9905
commit f32c306
Showing
6 changed files
with
223 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 33 additions & 10 deletions
43
commcare_connect/templates/opportunity/all_opportunities_view.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,43 @@ | ||
{% extends "base.html" %} | ||
{% extends "opportunity/base.html" %} | ||
{% load static %} | ||
{% load sort_link %} | ||
{% load i18n %} | ||
{% load django_tables2 %} | ||
{% block title %}{{ request.org }} - All Opportunities{% endblock %} | ||
|
||
{% block title %}{{ request.org }} - Opportunities{% endblock %} | ||
{% block breadcrumbs_inner %} | ||
{{ block.super }} | ||
<li class="breadcrumb-item active" aria-current="page">All-Org View</li> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col"> | ||
<div class="container bg-white shadow"> | ||
<div class="mt-5 py-3"> | ||
<h1>All Opportunities</h1> | ||
<div class="table-responsive"> | ||
{% render_table table %} | ||
</div> | ||
<div class="pb-4"> | ||
<form method="get" | ||
hx-get="{% url 'opportunity:all_opportunities' org_slug=request.org.slug %}" | ||
hx-target="#opportunity-table" | ||
hx-push-url="true" | ||
class="mb-3"> | ||
<div class="row"> | ||
<div class="col-md-4"> | ||
<input type="text" name="search" value="{{ request.GET.search }}" class="form-control" placeholder="Search by name"> | ||
</div> | ||
<div class="col-md-3"> | ||
<select name="status" class="form-control"> | ||
<option value="">All Statuses</option> | ||
<option value="active" {% if request.GET.status == 'active' %}selected{% endif %}>Active</option> | ||
<option value="inactive" {% if request.GET.status == 'inactive' %}selected{% endif %}>Inactive</option> | ||
</select> | ||
</div> | ||
<div class="col-md-1"> | ||
<button type="submit" class="btn btn-primary">Search</button> | ||
</div> | ||
</div> | ||
</form> | ||
<div id="opportunity-table"> | ||
{% include 'opportunity/partial_opportunity_table.html' %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock content %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
commcare_connect/templates/opportunity/partial_opportunity_table.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{% load sort_link %} | ||
{% load django_tables2 %} | ||
{% load i18n %} | ||
<div d="opportunity-table"> | ||
<table class="table border table-responsive"> | ||
<thead class="table-light"> | ||
<tr> | ||
<th>{% sort_link 'name' 'Name' %}</th> | ||
<th>{% sort_link 'start_date' 'Start Date' %}</th> | ||
<th>{% sort_link 'end_date' 'End Date' %}</th> | ||
<th>Status</th> | ||
<th>Program</th> | ||
<th>Manage</th> | ||
</tr> | ||
</thead> | ||
<tbody x-ref="tbody"> | ||
{% for opportunity in page_obj %} | ||
<tr> | ||
<td>{{ opportunity.name }}</td> | ||
<td>{{ opportunity.start_date|default:"Not Set" }}</td> | ||
<td>{{ opportunity.end_date|default:"Not Set" }}</td> | ||
<td> | ||
{% if opportunity.is_setup_complete %} | ||
{% if opportunity.is_active %} | ||
<span class="badge bg-success rounded-pill">Active</span> | ||
{% else %} | ||
<span class="badge bg-secondary text-white rounded-pill">Inactive</span> | ||
{% endif %} | ||
{% else %} | ||
<span class="badge bg-warning text-white rounded-pill">Pending Setup</span> | ||
{% endif %} | ||
</td> | ||
<td>{% if opportunity.managed %} {{ opportunity.managedopportunity.program.name }} {% else %} - {% endif %}</td> | ||
<td width="300"> | ||
<div> | ||
<a class="btn btn-primary btn-sm" | ||
href="{% url 'opportunity:detail' org_slug=request.org.slug pk=opportunity.id %}"> | ||
<span class="bi bi-eye"></span><span class="d-none d-md-inline"> View</span> | ||
</a> | ||
{% if request.org_membership.is_viewer %} | ||
<button class="btn btn-warning btn-sm" disabled> | ||
<span class="bi bi-pen"></span><span class="d-none d-md-inline"> Edit</span> | ||
</button> | ||
{% if not opportunity.managed %} | ||
<button class="btn btn-primary btn-sm" disabled> | ||
<span class="bi bi-plus"></span><span class="d-none d-md-inline"> Add Budget</span> | ||
</button> | ||
{% endif %} | ||
{% else %} | ||
<a class="btn btn-warning btn-sm" | ||
href="{% url 'opportunity:edit' org_slug=request.org.slug pk=opportunity.id %}"><span | ||
class="bi bi-pen"></span><span class="d-none d-md-inline"> Edit</span></a> | ||
{% if not opportunity.managed %} | ||
<a class="btn btn-primary btn-sm" | ||
href="{% url 'opportunity:add_budget_existing_users' org_slug=request.org.slug pk=opportunity.id %}"><span | ||
class="bi bi-plus"></span><span class="d-none d-md-inline"> Add Budget</span> | ||
</a> | ||
{% endif %} | ||
{% endif %} | ||
</div> | ||
</td> | ||
|
||
</tr> | ||
{% empty %} | ||
<tr> | ||
<td colspan="3">{% translate "No opportunities yet." %}</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
<div> | ||
{% include 'pagination.html' %} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters