mirror of
https://codeberg.org/artfulrobot/contactcats.git
synced 2025-06-25 16:38:05 +02:00
190 lines
8.5 KiB
HTML
190 lines
8.5 KiB
HTML
<div id=bootstrap-theme>
|
|
<div ng-if="$ctrl.presentation_order === null">
|
|
Loading...
|
|
</div>
|
|
<form ng-if="$ctrl.presentation_order"
|
|
ng-show="$ctrl.view === 'list'"
|
|
crm-ui-id-scope
|
|
>
|
|
|
|
<!-- I can see use of
|
|
presentation order/grouping
|
|
short title, "amazing"
|
|
longer title/description. "regular givers who..."
|
|
-->
|
|
|
|
<div class=help >{{ts('Each contact is assigned the first category that matches, using the assignment order. When categories are listed, the presentation order is used.')}}</div>
|
|
|
|
<div crm-ui-field="{name: 'cc.label', title: ts('Show')}" >
|
|
<input
|
|
crm-ui-id="ci.showOrder-execution"
|
|
type=radio
|
|
class=crm-form-radio
|
|
name="useOrder"
|
|
ng-model="$ctrl.uxOrderField"
|
|
value="execution_order"
|
|
ng-disabled="$ctrl.moveIdx !== null"
|
|
/>
|
|
<label crm-ui-for="ci.showOrder-execution">{{ts('Assignment order')}}</label>
|
|
<input
|
|
crm-ui-id="ci.showOrder-presentation"
|
|
type=radio
|
|
class=crm-form-radio
|
|
name="useOrder"
|
|
ng-model="$ctrl.uxOrderField"
|
|
value="presentation_order"
|
|
ng-disabled="$ctrl.moveIdx !== null"
|
|
/>
|
|
<label crm-ui-for="ci.showOrder-presentation">{{ts('Presentation order')}}</label>
|
|
|
|
</div>
|
|
|
|
<h2 ng-if="$ctrl.uxOrderField === 'execution_order'" >{{ts('Assignment order')}}</h2>
|
|
<h2 ng-if="$ctrl.uxOrderField === 'presentation_order'" >{{ts('Presentation order')}}</h2>
|
|
<p ng-if="$ctrl.uxOrderField === 'execution_order'" ><button class="btn btn-secondary" ng-click="$ctrl.copyOrder('presentation_order')" >{{ts('Copy from Presentation Order')}}</button></p>
|
|
<p ng-if="$ctrl.uxOrderField === 'presentation_order'" ><button class="btn btn-secondary" ng-click="$ctrl.copyOrder('execution_order')" >{{ts('Copy from Assignment Order')}}</button></p>
|
|
<ol class="crm-catmap {{$ctrl.moveIdx !== null ? 'moving' : ''}}">
|
|
<li ng-repeat="(idx, row) in $ctrl[$ctrl.uxOrderField]" class="{{idx === $ctrl.moveIdx ? 'being-moved' : ''}} {{row.deleted ? 'deleted' : ''}}">
|
|
<div class=panel>
|
|
<div class=panel-body>
|
|
<span class="contactcats-label" style="color: {{row.color ? row.color : 'inherit'}};" >
|
|
<i ng-if="row.icon" class="crm-i {{row.icon}}" ></i>
|
|
{{row.label}}
|
|
</span>
|
|
<span class="contactcats-description" >
|
|
{{row.description}}
|
|
</span>
|
|
|
|
<!-- button group? -->
|
|
<span class=contactcats-actions>
|
|
<button ng-if="$ctrl.moveIdx === null && !row.deleted" ng-click="$ctrl.edit(idx)" >
|
|
<i class="fa-pencil crm-i"></i> {{ts('Edit')}}
|
|
</button>
|
|
<button ng-if="$ctrl.moveIdx === null && !row.deleted" ng-click="$ctrl.deleteCategory(idx)">
|
|
<i class="fa-trash crm-i"></i> {{ts('Delete')}}
|
|
</button>
|
|
<button ng-if="$ctrl.moveIdx === null && row.deleted" ng-click="row.deleted = false;$ctrl.dirty = 'dirty';">
|
|
<i class="fa-trash crm-i"></i> {{ts('Un-Delete')}}
|
|
</button>
|
|
<button ng-if="$ctrl.moveIdx === null && !row.deleted && !(row.search_type === 'default' && $ctrl.uxOrderField === 'execution_order')" ng-click="$ctrl.moveIdx = idx"
|
|
class="btn"
|
|
ng-disabled="$ctrl.presentation_order.length === 1"
|
|
>
|
|
<i class="fa-arrows-up-down crm-i"></i> {{ts('Move')}}
|
|
</button>
|
|
<button ng-if="$ctrl.moveIdx !== null && idx === $ctrl.moveIdx"
|
|
class="btn btn-secondary"
|
|
ng-click="$ctrl.moveIdx = null" >
|
|
<i class="fa-circle-xmark crm-i"></i> {{ts('Cancel Move')}}
|
|
</button>
|
|
<button ng-click="$ctrl.moveTo(idx)" ng-show="$ctrl.moveIdx !== null && (idx === 0 && $ctrl.moveIdx > 0)" ><i class="fa-sort-up crm-i" ></i>{{ts('Before this')}}</button>
|
|
<button ng-click="$ctrl.moveTo(idx+1)" ng-show="$ctrl.canMoveBelow(row, idx)"
|
|
><i class="fa-sort-down crm-i" ></i>{{ts('After this')}}</button>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<!-- lower idx : {{idx}} moveIdx {{$ctrl.moveIdx}} -->
|
|
<!-- <div class="crm-contact-cats-move-target" ng-show="($ctrl.moveIdx < idx) || (idx +1 < $ctrl.moveIdx)" > -->
|
|
<!-- <button ng-click="$ctrl.moveTo(idx+1)" ><i class="fa-right-long crm-i" ></i>{{ts('Move to here')}}</button> -->
|
|
<!-- </div> -->
|
|
</li>
|
|
</ol>
|
|
|
|
<p>
|
|
<button ng-click="$ctrl.edit(-1)"
|
|
class="btn btn-secondary"
|
|
><i class="crm-i fa-add"></i> Add new category</button>
|
|
</p>
|
|
|
|
<p><button ng-click="$ctrl.save()" class="btn" ng-disabled="$ctrl.dirty === 'pristine'"><i class="crm-i fa-save"></i>
|
|
{{ts('Save changes')}}</button></p>
|
|
|
|
<div ng-if="$ctrl.saved" class="help">
|
|
Categories saved. Contacts will be updated shortly (when the next Scheduled
|
|
Job run happens).
|
|
</div>
|
|
</form>
|
|
|
|
<form ng-show="$ctrl.view === 'edit'"
|
|
crm-ui-id-scope>
|
|
<div>
|
|
<h2 ng-if="$ctrl.presentation_order.length > $ctrl.categoryToEdit.idx">{{ts('Edit category %1', {1 : $ctrl.[$ctrl.uxOrderField][$ctrl.categoryToEdit[$ctrl.uxOrderField]].label })}}</h2>
|
|
<h2 ng-if="$ctrl.presentation_order.length == $ctrl.categoryToEdit.idx" >{{ts('Add new category')}}</h2>
|
|
|
|
<div crm-ui-field="{name: 'cc.label', title: ts('Category label'), required: 1}" >
|
|
<input
|
|
crm-ui-id="ci.label"
|
|
name="label"
|
|
ng-model="$ctrl.categoryToEdit.label"
|
|
class="crm-form-text"
|
|
placeholder="{{ts('0123 Super lovely supporters')}}"
|
|
style="width: 100%"
|
|
/>
|
|
</div>
|
|
|
|
<div crm-ui-field="{name: 'cc.color', title: ts('Color')}" >
|
|
<input
|
|
crm-ui-id="ci.color"
|
|
name="color"
|
|
type="color"
|
|
ng-model="$ctrl.categoryToEdit.color"
|
|
class="crm-form-color"
|
|
/>
|
|
</div>
|
|
|
|
<div crm-ui-field="{name: 'cc.icon', title: ts('Icon')}" >
|
|
<!-- this seems buggy, doesn't update to show the icon given. -->
|
|
<input
|
|
crm-ui-id="cc.icon"
|
|
crm-ui-icon-picker
|
|
ng-model="$ctrl.categoryToEdit.icon"
|
|
/>
|
|
</div>
|
|
|
|
<div crm-ui-field="{name: 'cc.description', title: ts('Description')}" >
|
|
<input
|
|
crm-ui-id="ci.description"
|
|
name="description"
|
|
ng-model="$ctrl.categoryToEdit.description"
|
|
class="crm-form-textarea"
|
|
style="width: 100%"
|
|
/>
|
|
</div>
|
|
|
|
<div ng-if="cc.search_type !== 'default'" crm-ui-field="{name: 'cc.search_type', title: ts('How are contacts identified?')}" >
|
|
<select
|
|
crm-ui-id="ci.search_type"
|
|
name="search_type"
|
|
ng-model="$ctrl.categoryToEdit.search_type"
|
|
ng-change="$ctrl.fixSearchData()"
|
|
ng-show="$ctrl.categoryToEdit.search_type !== 'default'"
|
|
>
|
|
<option value="search" >{{ts('Search Kit search')}}</option>
|
|
<option value="group" >{{ts('Group')}}</option>
|
|
<!-- future? <option value="sql_template" >{{ts('SQL template')}}</option> -->
|
|
</select>
|
|
<div ng-show="$ctrl.categoryToEdit.search_type === 'default'" >{{ts('Default category')}}</div>
|
|
</div>
|
|
|
|
<!-- fields for search kit -->
|
|
<div ng-if="$ctrl.categoryToEdit.search_type === 'search'" crm-ui-field="{name:'cc.saved_search_id', title: ts('Search Kit search')}" >
|
|
<input crm-ui-id='cc.saved_search_id' crm-entityref="{entity: 'SavedSearch', select: {allowClear:false}}"
|
|
ng-model="$ctrl.categoryToEdit.search_data.saved_search_id" />
|
|
</div>
|
|
|
|
<!-- fields for groups -->
|
|
<div ng-if="$ctrl.categoryToEdit.search_type === 'group'" crm-ui-field="{name:'cc.group_id', title: ts('Group')}" >
|
|
<input crm-ui-id='cc.group_id' crm-entityref="{entity: 'Group', select: {allowClear:false}}"
|
|
ng-model="$ctrl.categoryToEdit.search_data.group_id" />
|
|
</div>
|
|
|
|
|
|
<!-- type=button means when you hit Enter in an input above this button is skipped while it looks for the first submit button. -->
|
|
<button type=button ng-click="$ctrl.view = 'list'"
|
|
class="btn btn-secondary"
|
|
>Cancel</button>
|
|
<button ng-click="$ctrl.updateEditedThing()" >Done</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<!-- <pre>{{ $ctrl.categoryToEdit }}</pre> -->
|