<field name="name" reporter:datatype="text" oils_obj:required="true"/>
<field name="label" reporter:datatype="text" oils_obj:required="true" oils_persist:i18n="true"/>
<field reporter:label="Owner" name="owner" oils_obj:required="true" reporter:datatype="link"/>
+ <field reporter:label="Active" name="active" reporter:datatype="bool"/>
<field reporter:label="Locale" name="locale" reporter:datatype="link"/>
<field name="content_type" reporter:datatype="text"/>
<field name="template" reporter:datatype="text" oils_obj:required="true"/>
</div>
<div class="row mt-2">
<div class="col-lg-6">
- <h4 i18n>Template</h4>
+ <h4 i18n>
+ Template for "{{template.label()}}"
+ <span class="pl-2 text-warning" *ngIf="template.active() == 'f'">
+ (Inactive)
+ </span>
+ </h4>
<textarea rows="30" class="form-control"
spellcheck="false"
[ngModel]="template.template()"
</div>
<h4 class="mt-3" i18n>Compiled Content</h4>
<div class="border border-dark w-100">
- <pre>{{compiledContent}}</pre>
+ <pre class="p-1">{{compiledContent}}</pre>
</div>
</div>
</div>
};
const SAMPLE_TEMPLATE_DATA: any = {
- 'address-label': {
+ patron_address: {
patron: SAMPLE_JSON_DATA.patron,
address: SAMPLE_JSON_DATA.address
}
if ($template_id) {
# Requesting by ID, generally used for testing,
- # always pulls the latest value.
+ # always pulls the latest value and ignores the active flag
return $e->retrieve_config_print_template($template_id);
}
my $template = $e->search_config_print_template({
name => $name,
locale => $locale,
- owner => $org->id
+ owner => $org->id,
+ active => 't'
})->[0];
if ($template) {
name TEXT NOT NULL, -- programatic name
label TEXT NOT NULL, -- i18n
owner INT NOT NULL REFERENCES actor.org_unit (id),
+ active BOOLEAN NOT NULL DEFAULT FALSE,
locale TEXT REFERENCES config.i18n_locale(code)
ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
content_type TEXT NOT NULL DEFAULT 'text/html',
INSERT INTO config.print_template (id, name, locale, owner, label, template)
VALUES (
- 1, 'address-label', 'en-US',
+ 1, 'patron_address', 'en-US',
(SELECT id FROM actor.org_unit WHERE parent_ou IS NULL),
oils_i18n_gettext(1, 'Address Label', 'cpt', 'label'),
$TEMPLATE$
$scope.print_address = function(addr) {
egCore.print.print({
context : 'default',
- template: 'address-label',
- server_hosted: true,
+ template: 'patron_address',
scope : {
patron : patronSvc.current,
address : addr