<commit_before>{% extends '::base.html.twig' %}


{% block body_start %}<body ng-app="app" ng-controller="ListingController">{% endblock %}


{% block body %}
    <div class="btn-group pull-right">
        <button type="button" class="btn btn-default" ng-click="addCategory()" title="{% trans %}Add Ministry Category{% endtrans %}">
            <span class="glyphicon glyphicon-plus"></span>
        </button>
        <button type="button" class="btn btn-default" ng-click="save()" title="{% trans %}Save Changes{% endtrans %}">
            <span class="glyphicon glyphicon-floppy-disk"></span>
        </button>
    </div>

    <h2>{% trans %}Ministries{% endtrans %}</h2>

    <div class="alert alert-danger ng-hide" ng-show="error">
        {{ '{{ error }}' }}
    </div>

    <table class="table table-bordered">
        <thead>
            <tr>
                <th class="col-md-2">{% trans %}Bereich{% endtrans %}</th>
                <th class="col-md-2">{% trans %}Unterbereich{% endtrans %}</th>
                <th class="col-md-2">{% trans %}Tasks{% endtrans %}</th>
                <th>{% trans %}Contact Persons{% endtrans %}</th>
                <th>{% trans %}Responsible Elders / Deacon{% endtrans %}</th>
                <th class="col-md-1 text-center">{% trans %}Actions{% endtrans %}</th>
            </tr>
        </thead>
        <tbody ng-repeat="ministryCategory in ministryCategories">
            <tr ng-repeat="ministry in ministryCategory.ministries">
                <td rowspan="{{ '{{ ministryCategory.ministries.length }}' }}" ng-if="$first">
                    <input type="text" ng-model="ministryCategory.name" class="form-control input-sm" ng-show="isEditable(ministryCategory)" />
                    <span ng-show="!isEditable(ministryCategory)">{{ '{{ ministryCategory.name }}' }}</span>
                </td>
                <td>
                    <input type="text" ng-model="ministry.name" class="form-control input-sm" ng-show="isEditable(ministryCategory)" />
                    <span ng-show="!isEditable(ministryCategory)">{{ '{{ ministry.name }}' }}</span>
                    <button type="button" class="btn btn-default btn-sm pull-right" ng-click="ministryCategory.newMinistry()" ng-show="isEditable(ministryCategory) && $last">
                        <span class="glyphicon glyphicon-plus"></span>
                    </button>
                </td>
                <td>
                    <textarea ng-model="ministry.description" class="form-control input-sm" ng-show="isEditable(ministryCategory)"></textarea>
                    <span ng-show="!isEditable(ministryCategory)">{{ '{{ ministry.description }}' }}</span>
                </td>
                <td>
                    <div ng-repeat="assignment in ministry.contactAssignments" class="row">
                        <div class="col-md-5" ng-show="isEditable(ministryCategory)">
                            <select class="form-control input-sm"
                             ng-model="assignment.group"
                             ng-options="group as group.name for group in groups track by group.id">
                                <option value="">- {% trans %}Group{% endtrans %} -</option>
                            </select>
                        </div>
                        <div class="col-md-5" ng-show="isEditable(ministryCategory)">
                            <select class="form-control input-sm"
                             ng-model="assignment.person"
                             ng-options="person as getPersonsLabel(person) for person in persons track by person.id">
                                <option value="">- {% trans %}Person{% endtrans %} -</option>
                            </select>
                        </div>
                        <div class="col-md-2" ng-show="isEditable(ministryCategory)">
                            <button type="button" class="btn btn-default btn-sm pull-right" ng-click="ministry.removeContact(assignment)" ng-show="isEditable(ministryCategory)">
                                <span class="glyphicon glyphicon-minus"></span>
                            </button>
                        </div>
                        <div class="col-md-12" ng-show="!isEditable(ministryCategory)">
                            <strong>
                                {{ '{{ assignment.group ? assignment.group.name : getPersonsLabel(assignment.person) }}' }}
                            </strong>
                        </div>
                    </div>
                    <button type="button" class="btn btn-default btn-sm pull-right" ng-click="ministry.newContact()" ng-show="isEditable(ministryCategory)">
                        <span class="glyphicon glyphicon-plus"></span>
                    </button>
                </td>
                <td>
                    <div ng-repeat="assignment in ministry.responsibleAssignments" class="row">
                        <div class="col-md-5" ng-show="isEditable(ministryCategory)">
                            <select class="form-control input-sm"
                             ng-model="assignment.group"
                             ng-options="group as group.name for group in groups track by group.id">
                                <option value="">- {% trans %}Group{% endtrans %} -</option>
                            </select>
                        </div>
                        <div class="col-md-5" ng-show="isEditable(ministryCategory)">
                            <select class="form-control input-sm"
                             ng-model="assignment.person"
                             ng-options="person as getPersonsLabel(person) for person in persons track by person.id">
                                <option value="">- {% trans %}Person{% endtrans %} -</option>
                            </select>
                        </div>
                        <div class="col-md-2" ng-show="isEditable(ministryCategory)">
                            <button type="button" class="btn btn-default btn-sm pull-right" ng-click="ministry.removeResponsible(assignment)" ng-show="isEditable(ministryCategory)">
                                <span class="glyphicon glyphicon-minus"></span>
                            </button>
                        </div>
                        <div class="col-md-12" ng-show="!isEditable(ministryCategory)">
                            <strong>
                                {{ '{{ assignment.group ? assignment.group.name : getPersonsLabel(assignment.person) }}' }}
                            </strong>
                        </div>
                    </div>
                    <button type="button" class="btn btn-default btn-sm pull-right" ng-click="ministry.newResponsible()" ng-show="isEditable(ministryCategory)">
                        <span class="glyphicon glyphicon-plus"></span>
                    </button>
                </td>
                <td class="text-center" rowspan="{{ '{{ ministryCategory.ministries.length }}' }}" ng-if="$first">
                    <button type="button" class="btn btn-default btn-sm" title="{% trans %}Edit Ministry Category{% endtrans %}"
                     ng-click="setEditable(ministryCategory)"
                     ng-show="!isEditable(ministryCategory)">
                        <span class="glyphicon glyphicon-pencil"></span>
                    </button>
                    <button type="button" class="btn btn-default btn-sm" title="{% trans %}Undo Changes{% endtrans %}"
                     ng-click="cancelEditing()"
                     ng-show="isEditable(ministryCategory)">
                        <span class="glyphicon glyphicon-ban-circle"></span>
                    </button>
                </td>
            </tr>
        </tbody>
        <tfoot>
            <tr ng-show="ministryCategories.length == 0">
                <td colspan="7">
                    {% trans %}There are no entries existing, yet.{% endtrans %}
                </td>
            </tr>
        </tfoot>
    </table>
{% endblock %}


{% block javascripts %}
    {{ parent() }}

    <script type="text/javascript">
        // <![CDATA[
        angular.module('app', ['ui.bootstrap'])
            .constant('ministryCategories', {{ categories_json | raw }})
            .constant('persons', {{ persons_json | raw }})
            .constant('groups', {{ groups_json | raw }})
            .constant('updateUrl', '{{ path('ecgpb.member.ministry_category.update') }}')
            .controller('ListingController', function(
                $scope, $http, $modal,
                MinistryCategory, Ministry, ministryCategories, persons, groups,
                updateUrl
            ) {
                $scope.ministryCategories = ministryCategories.map(function(value) { return new MinistryCategory(value); });
                $scope.persons = persons;
                $scope.groups = groups;
                $scope.error = null;
                $scope.editableCategory = null;
                $scope.backupCategory = null;

                $scope.addCategory = function() {
                    var category = new MinistryCategory();
                    $scope.ministryCategories.push(category);
                    $scope.setEditable(category);
                };

                $scope.setEditable = function(ministryCategory) {
                    $scope.editableCategory = ministryCategory;<commit_msg>Removal of ministry categories in the view<commit_after>{% extends '::base.html.twig' %}


{% block body_start %}<body ng-app="app" ng-controller="ListingController">{% endblock %}


{% block body %}
    <div class="btn-group pull-right">
        <button type="button" class="btn btn-default" ng-click="addCategory()" title="{% trans %}Add Ministry Category{% endtrans %}">
            <span class="glyphicon glyphicon-plus"></span>
        </button>
        <button type="button" class="btn btn-default" ng-click="save()" title="{% trans %}Save Changes{% endtrans %}">
            <span class="glyphicon glyphicon-floppy-disk"></span>
        </button>
    </div>

    <h2>{% trans %}Ministries{% endtrans %}</h2>

    <div class="alert alert-danger ng-hide" ng-show="error">
        {{ '{{ error }}' }}
    </div>

    <table class="table table-bordered">
        <thead>
            <tr>
                <th class="col-md-2">{% trans %}Bereich{% endtrans %}</th>
                <th class="col-md-2">{% trans %}Unterbereich{% endtrans %}</th>
                <th class="col-md-2">{% trans %}Tasks{% endtrans %}</th>
                <th>{% trans %}Contact Persons{% endtrans %}</th>
                <th>{% trans %}Responsible Elders / Deacon{% endtrans %}</th>
                <th class="col-md-1 text-center">{% trans %}Actions{% endtrans %}</th>
            </tr>
        </thead>
        <tbody ng-repeat="ministryCategory in ministryCategories">
            <tr ng-repeat="ministry in ministryCategory.ministries">
                <td rowspan="{{ '{{ ministryCategory.ministries.length }}' }}" ng-if="$first">
                    <input type="text" ng-model="ministryCategory.name" class="form-control input-sm" ng-show="isEditable(ministryCategory)" />
                    <span ng-show="!isEditable(ministryCategory)">{{ '{{ ministryCategory.name }}' }}</span>
                </td>
                <td>
                    <input type="text" ng-model="ministry.name" class="form-control input-sm" ng-show="isEditable(ministryCategory)" />
                    <span ng-show="!isEditable(ministryCategory)">{{ '{{ ministry.name }}' }}</span>
                    <button type="button" class="btn btn-default btn-sm pull-right" ng-click="ministryCategory.newMinistry()" ng-show="isEditable(ministryCategory) && $last">
                        <span class="glyphicon glyphicon-plus"></span>
                    </button>
                </td>
                <td>
                    <textarea ng-model="ministry.description" class="form-control input-sm" ng-show="isEditable(ministryCategory)"></textarea>
                    <span ng-show="!isEditable(ministryCategory)">{{ '{{ ministry.description }}' }}</span>
                </td>
                <td>
                    <div ng-repeat="assignment in ministry.contactAssignments" class="row">
                        <div class="col-md-5" ng-show="isEditable(ministryCategory)">
                            <select class="form-control input-sm"
                             ng-model="assignment.group"
                             ng-options="group as group.name for group in groups track by group.id">
                                <option value="">- {% trans %}Group{% endtrans %} -</option>
                            </select>
                        </div>
                        <div class="col-md-5" ng-show="isEditable(ministryCategory)">
                            <select class="form-control input-sm"
                             ng-model="assignment.person"
                             ng-options="person as getPersonsLabel(person) for person in persons track by person.id">
                                <option value="">- {% trans %}Person{% endtrans %} -</option>
                            </select>
                        </div>
                        <div class="col-md-2" ng-show="isEditable(ministryCategory)">
                            <button type="button" class="btn btn-default btn-sm pull-right" ng-click="ministry.removeContact(assignment)" ng-show="isEditable(ministryCategory)">
                                <span class="glyphicon glyphicon-minus"></span>
                            </button>
                        </div>
                        <div class="col-md-12" ng-show="!isEditable(ministryCategory)">
                            <strong>
                                {{ '{{ assignment.group ? assignment.group.name : getPersonsLabel(assignment.person) }}' }}
                            </strong>
                        </div>
                    </div>
                    <button type="button" class="btn btn-default btn-sm pull-right" ng-click="ministry.newContact()" ng-show="isEditable(ministryCategory)">
                        <span class="glyphicon glyphicon-plus"></span>
                    </button>
                </td>
                <td>
                    <div ng-repeat="assignment in ministry.responsibleAssignments" class="row">
                        <div class="col-md-5" ng-show="isEditable(ministryCategory)">
                            <select class="form-control input-sm"
                             ng-model="assignment.group"
                             ng-options="group as group.name for group in groups track by group.id">
                                <option value="">- {% trans %}Group{% endtrans %} -</option>
                            </select>
                        </div>
                        <div class="col-md-5" ng-show="isEditable(ministryCategory)">
                            <select class="form-control input-sm"
                             ng-model="assignment.person"
                             ng-options="person as getPersonsLabel(person) for person in persons track by person.id">
                                <option value="">- {% trans %}Person{% endtrans %} -</option>
                            </select>
                        </div>
                        <div class="col-md-2" ng-show="isEditable(ministryCategory)">
                            <button type="button" class="btn btn-default btn-sm pull-right" ng-click="ministry.removeResponsible(assignment)" ng-show="isEditable(ministryCategory)">
                                <span class="glyphicon glyphicon-minus"></span>
                            </button>
                        </div>
                        <div class="col-md-12" ng-show="!isEditable(ministryCategory)">
                            <strong>
                                {{ '{{ assignment.group ? assignment.group.name : getPersonsLabel(assignment.person) }}' }}
                            </strong>
                        </div>
                    </div>
                    <button type="button" class="btn btn-default btn-sm pull-right" ng-click="ministry.newResponsible()" ng-show="isEditable(ministryCategory)">
                        <span class="glyphicon glyphicon-plus"></span>
                    </button>
                </td>
                <td class="text-center" rowspan="{{ '{{ ministryCategory.ministries.length }}' }}" ng-if="$first">
                    <button type="button" class="btn btn-default btn-sm" title="{% trans %}Edit Ministry Category{% endtrans %}"
                     ng-click="setEditable(ministryCategory)"
                     ng-show="!isEditable(ministryCategory)">
                        <span class="glyphicon glyphicon-pencil"></span>
                    </button>
                    <button type="button" class="btn btn-default btn-sm" title="{% trans %}Undo Changes{% endtrans %}"
                     ng-click="cancelEditing()"
                     ng-show="isEditable(ministryCategory)">
                        <span class="glyphicon glyphicon-ban-circle"></span>
                    </button>
                    <button type="button" class="btn btn-default btn-sm"
                     nait-confirm-click
                     confirm="{% trans %}Do you really want to remove this record?{% endtrans %}"
                     confirm-if=""
                     confirm-button-text="{% trans %}Yes{% endtrans %}"
                     cancel-button-text="{% trans %}No{% endtrans %}"
                     do="removeCategory(ministryCategory)">
                        <span class="glyphicon glyphicon-remove"></span>
                    </button>
                </td>
            </tr>
        </tbody>
        <tfoot>
            <tr ng-show="ministryCategories.length == 0">
                <td colspan="7">
                    {% trans %}There are no entries existing, yet.{% endtrans %}
                </td>
            </tr>
        </tfoot>
    </table>
{% endblock %}


{% block javascripts %}
    {{ parent() }}

    <script type="text/javascript">
        // <![CDATA[
        angular.module('app', ['ui.bootstrap', 'naitsirch.helpers'])
            .constant('ministryCategories', {{ categories_json | raw }})
            .constant('persons', {{ persons_json | raw }})
            .constant('groups', {{ groups_json | raw }})
            .constant('updateUrl', '{{ path('ecgpb.member.ministry_category.update') }}')
            .controller('ListingController', function(
                $scope, $http, $modal,
                MinistryCategory, Ministry, ministryCategories, persons, groups,
                updateUrl
            ) {
                $scope.ministryCategories = ministryCategories.map(function(value) { return new MinistryCategory(value); });
                $scope.persons = persons;
                $scope.groups = groups;
                $scope.error = null;
                $scope.editableCategory = null;
                $scope.backupCategory = null;

                $scope.addCategory = function() {
                    var category = new MinistryCategory();
                    $scope.ministryCategories.push(category);
                    $scope.setEditable(category);
                };

                $scope.removeCategory = function (ministryCategory) {
                    var index = $scope.ministryCategories.indexOf(ministryCategory);
                    $scope.ministryCategories.splice(index, 1);
                };

                $scope.setEditable = function(ministryCategory) {
                    $scope.editableCategory = ministryCategory;
{'fraction_non_alphanumeric': 0.14177818329278183, 'fraction_numerical': 0.001875506893755069, 'mean_word_length': 1.5645391914727675, 'pattern_counts': {'":': 0, '<': 277, '<?xml version=': 0, '>': 275, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3836705', 'n_tokens_mistral': 5312, 'n_tokens_neox': 4819, 'n_words': 979}