]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html
LP1831390 ControlValueAccessor continued
[Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / sandbox / sandbox.component.html
1
2 <eg-staff-banner bannerText="Sandbox" i18n-bannerText>
3 </eg-staff-banner>
4
5 <eg-title 
6   i18n-prefix i18n-suffix
7   prefix=":) {{dynamicTitleText}}"
8   suffix="Sandbox">
9 </eg-title>
10 <eg-help-popover [placement]="'right'" helpText="This page is for random ng stuff!"></eg-help-popover>
11 <div class="row flex pt-2">
12   <div i18n> Modify Page Title: </div>
13   <div class="col-lg-2">
14     <input type="text" [(ngModel)]="dynamicTitleText" class="form-control"/>
15   </div>
16 </div>
17
18 <!-- FM Editor Experiments ----------------------------- -->
19 <div class="row mb-3">
20   <ng-template #descriptionTemplate 
21       let-field="field" let-record="record" let-hello="hello">
22   <!-- example custom template for editing the 'description' field -->
23     <textarea
24       placeholder="{{hello}}"
25       class="form-control"
26       name="{{field.name}}"
27       [readonly]="field.readOnly"
28       [required]="field.isRequired()"
29       [ngModel]="record[field.name]()"
30       (ngModelChange)="record[field.name]($event)">
31     </textarea>
32   </ng-template>
33   <!-- note: fieldOptions would be best defined in the .ts file, but
34       want to demostrate it can be set in the template as well -->
35   <eg-fm-record-editor #fmRecordEditor 
36       idlClass="cmrcfld" mode="create" 
37       [fieldOptions]="{marc_record_type:{customValues:[{id:'biblio'},{id:'serial'},{id:'authority'}]},description:{customTemplate:{template:descriptionTemplate,context:{'hello':'goodbye'}}}}"
38       recordId="1" orgDefaultAllowed="owner">
39   </eg-fm-record-editor>
40   <button class="btn btn-dark" (click)="openEditor()">
41       Fm Record Editor
42   </button>
43 </div>
44 <!-- / FM Editor Experiments ----------------------------- -->
45
46 <!-- Progress Dialog Experiments ----------------------------- -->
47 <div class="row mb-3">
48   <div class="col-lg-3">
49     <button class="btn btn-outline-danger" (click)="progress.increment()">Increment Inline</button>
50     <eg-help-popover [placement]="'bottom'" helpText="Exercise your clicking finger by clicking the button above.">
51     </eg-help-popover>
52   </div>
53   <div class="col-lg-3">
54     <eg-progress-inline [max]="100" [value]="1" #progress></eg-progress-inline>
55   </div>
56 </div>
57 <div class="row mb-3">
58   <div class="col-lg-4">
59     <eg-progress-dialog #progressDialog>
60     </eg-progress-dialog>
61     <button class="btn btn-light" (click)="showProgress()">Test Progress Dialog</button>
62   </div>
63   <div class="col-lg-3">
64     <eg-help-popover helpLink="https://www.youtube.com/watch?v=dQw4w9WgXcQ" helpText="This popover is supposed to help or something...!"></eg-help-popover>
65     <eg-combobox [allowFreeText]="true" 
66       placeholder="Combobox with static data"
67       [entries]="cbEntries"></eg-combobox>
68   </div>
69   <div class="col-lg-3">
70     <eg-help-popover helpText="You have to type to see any options in this dropdown."></eg-help-popover>
71     <eg-combobox
72       placeholder="Combobox with dynamic data that does not enable click if no search term is supplied"
73       [asyncDataSource]="cbAsyncSource"></eg-combobox>
74   </div>
75 </div>
76 <div class="row mb-3">
77   <div class="col-lg-4">
78    <eg-help-popover helpText="If you like Toast you must click below!" placement="'auto'"></eg-help-popover>
79    <button class="btn btn-info" (click)="testToast()">Test Toast Message</button>
80   </div>
81   <div class="col-lg-2">
82     Org select with limit perms
83   </div>
84   <div class="col-lg-2">
85     <eg-org-select [limitPerms]="['REGISTER_WORKSTATION']">
86     </eg-org-select>
87   </div>
88 </div>
89 <div class="row mb-3">
90   <div class="col-lg-4">
91   </div>
92   <div class="col-lg-3">
93     <eg-combobox placeholder="Combobox with @idlClass = 'aou' @idlField='shortname'" idlClass="aou" idlField="shortname" [asyncSupportsEmptyTermClick]="true">
94     </eg-combobox>
95   </div>
96   <div class="col-lg-3">
97     <eg-combobox placeholder="Combobox with @idlClass = 'cvrfm'" idlClass="cvrfm" [asyncSupportsEmptyTermClick]="true">
98     </eg-combobox>
99   </div>
100   <div class="col-lg-3">
101     <eg-combobox placeholder="Combobox with @idlClass = 'csp'" idlClass="csp" [asyncSupportsEmptyTermClick]="true">
102     </eg-combobox>
103   </div>
104 </div>
105 <div class="row mb-3">
106   <div class="col-lg-4">
107   </div>
108   <div class="col-lg-3">
109     <eg-combobox placeholder="Combobox with @idlClass = 'aou'" idlClass="aou" [asyncSupportsEmptyTermClick]="true">
110     </eg-combobox>
111   </div>
112   <div class="col-lg-3">
113   </div>
114 </div>
115 <!-- /Progress Dialog Experiments ----------------------------- -->
116
117 <!-- eg strings -->
118 <!--
119 <div class="row mb-3">
120     <eg-string #helloString text="Hello, {{name}}" i18n-text></eg-string>
121     <button class="btn btn-success" (click)="testStrings()">Test Strings</button>
122 </div>
123 -->
124
125 <div class="row mb-3">
126     <ng-template #helloStrTmpl let-name="name" i18n>Hello, {{name}}</ng-template>
127     <!--
128     <eg-string #helloStr key="helloKey" [template]="helloStrTmpl"></eg-string>
129     -->
130     <eg-string key="staff.sandbox.test" [template]="helloStrTmpl"></eg-string>
131     <button class="btn btn-success" (click)="testStrings()">Test Strings</button>
132 </div>
133
134 <div class="row">
135   <div class="form-group">
136     <eg-date-select (onChangeAsDate)="changeDate($event)"
137         initialYmd="2017-03-04">
138     </eg-date-select>
139   </div>
140   <div>HERE: {{testDate}}</div>
141 </div>
142
143 <!-- printing -->
144
145 <button class="btn btn-secondary" (click)="doPrint()">Test Print</button>
146 <ng-template #printTemplate let-context>Hello, {{context.world}}!</ng-template>
147
148 <button class="btn btn-secondary" (click)="printWithDialog()">Print with dialog</button>
149
150 <br/><br/>
151 <div class="row">
152   <div class="col-lg-3">
153     <eg-translate #translate [idlObject]="oneBtype" fieldName="name"></eg-translate>
154     <button class="btn btn-info"
155       (click)="translate.open({size:'lg'})">Translate</button>
156   </div>
157 </div>
158 <br/><br/>
159
160 <div>
161   <h4>Cross-tab communications example</h4>
162   <p>To test, open this sandbox in a second browser tab. Enter something in the input box below, then switch to the other tab and click anywhere on the page. 
163      You should see the message that you sent to the other browser tab.</p>
164 </div>
165 <div class="row">
166   <div class="col-lg-3">
167     <input type="text" #sendSbMessage placeholder="message to send to another tab" size="40" (change)="sendMessage($event)">
168   </div>
169   <div class="col-lg-3">
170     message received: {{sbChannelText}}
171   </div>
172 </div>
173
174 <!-- grid stuff -->
175 <ng-template #cellTmpl let-row="row" let-col="col" let-userContext="userContext">
176   HELLO {{userContext.hello}}
177   <button>{{row.id()}}</button>
178 </ng-template>
179 <eg-grid #cbtGrid idlClass="cbt" 
180   [dataSource]="btSource" 
181   [rowClassCallback]="btGridRowClassCallback"
182   [rowFlairIsEnabled]="true"
183   [rowFlairCallback]="btGridRowFlairCallback"
184   [cellClassCallback]="btGridCellClassCallback"
185   [stickyHeader]="true"
186   [sortable]="true">
187   <eg-grid-toolbar-action label="Action that needs a single row" i18n-label
188     (onClick)="complimentEvergreen($event)" [disableOnRows]="notOneSelectedRow">
189   </eg-grid-toolbar-action>
190   <eg-grid-toolbar-action [isSeparator]="true">
191   </eg-grid-toolbar-action>
192   <eg-grid-toolbar-action label="Another Action" i18n-label
193     (onClick)="complimentEvergreen2($event)">
194   </eg-grid-toolbar-action>
195   <eg-grid-column name="test" [cellTemplate]="cellTmpl" 
196     [cellContext]="btGridTestContext" [sortable]="false">
197   </eg-grid-column>
198   <eg-grid-column [sortable]="false" path="owner.name"></eg-grid-column>
199   <eg-grid-column [sortable]="false" path="datetime_test" 
200     datatype="timestamp" [datePlusTime]="true"></eg-grid-column>
201 </eg-grid>
202
203 <br/><br/>
204
205 <h4>Grid with filtering</h4>
206 <eg-grid #acpGrid idlClass="acp"
207   [dataSource]="acpSource"
208   [filterable]="true"
209   [sortable]="true"
210   [showLinkSelectors]="true"
211   [stickyHeader]="true"
212   showFields="barcode,location,circ_lib,price,dummy_title,create_date"
213 >
214   <eg-grid-toolbar-action label="Edit Selected" i18n-label [action]="editSelected">
215   </eg-grid-toolbar-action>
216   <eg-grid-column [sortable]="true" [filterable]="false"  path="barcode"></eg-grid-column>
217   <eg-grid-column [sortable]="true" path="circ_lib"></eg-grid-column>
218   <eg-grid-column [sortable]="true" path="price"></eg-grid-column>
219   <eg-grid-column [sortable]="true" path="dummy_title"></eg-grid-column>
220   <eg-grid-column [sortable]="true" path="create_date"></eg-grid-column>
221 </eg-grid>
222
223 <eg-fm-record-editor #acpEditDialog idlClass="acp" hiddenFields="call_number,creator,create_date,editor,edit_time,loan_duration,fine_level,dummy_author,dummy_isbn,ref,floating,holdable,circ_as_type,active_date,mint_condition,cost,deleted,deposit,deposit_amount,circulate,status_changed_time,copy_number">
224 </eg-fm-record-editor>
225 <eg-string #successString text="Updated succeeded!" i18n-text></eg-string>
226 <eg-string #updateFailedString text="Updated failed!" i18n-text></eg-string>
227
228 <h4>PCRUD auto flesh and FormatService detection</h4>
229 <div *ngIf="aMetarecord">Fingerprint: {{aMetarecord}}</div>
230
231 <div class="row">
232   <div class="card col-md-6">
233     <div class="card-body">
234       <h3 class="card-title">Do you like template-driven forms?</h3>
235       <div class="card-text">
236         <eg-org-family-select
237           [ancestorSelectorChecked]="true"
238           [hideDescendantSelector]="true"
239           selectedOrgId="7"
240           labelText="Choose the best libraries"
241           ngModel #bestOnes="ngModel">
242         </eg-org-family-select>
243         The best libraries are: {{bestOnes.value | json}}
244         <hr>
245         <eg-combobox ngModel #templateEntry="ngModel" [allowFreeText]="true">
246           <eg-combobox-entry entryId="Bacteria"></eg-combobox-entry>
247           <eg-combobox-entry entryId="Archaea"></eg-combobox-entry>
248           <eg-combobox-entry entryId="Protozoa"></eg-combobox-entry>
249           <eg-combobox-entry entryId="Chromista"></eg-combobox-entry>
250           <eg-combobox-entry entryId="Plantae"></eg-combobox-entry>
251           <eg-combobox-entry entryId="Fungi"></eg-combobox-entry>
252           <eg-combobox-entry entryId="Animalia"></eg-combobox-entry>
253         </eg-combobox>
254       Result: {{templateEntry.value | json}}
255         <hr>
256         <eg-date-select [(ngModel)]="dateObject">
257         </eg-date-select>
258       ngModel: {{dateObject.toLocaleDateString()}}
259       </div>
260     </div>
261   </div>
262   <form class="card col-md-4" [formGroup]="ranganathan">
263     <div class="card-body">
264       <h3 class="card-title">Or perhaps reactive forms interest you?</h3>
265       <div class="card-text">
266         Choose your favorite law of library science: 
267         <eg-combobox formControlName="law" value="second" 
268           [allowFreeText]="true" [startIdFiresOnChange]="true">
269           <eg-combobox-entry entryId="first" entryLabel="Books are for use" i18n-entryLabel></eg-combobox-entry>
270           <eg-combobox-entry entryId="second" entryLabel="Every person his or her book" i18n-entryLabel></eg-combobox-entry>
271           <eg-combobox-entry entryId="third" entryLabel="Every book its reader" i18n-entryLabel></eg-combobox-entry>
272           <eg-combobox-entry entryId="fourth" entryLabel="Save the time of the reader" i18n-entryLabel></eg-combobox-entry>
273           <eg-combobox-entry entryId="fifth" entryLabel="Library is a growing organism" i18n-entryLabel></eg-combobox-entry>
274           <eg-combobox-entry entryId="wrong" entryLabel="42" i18n-entryLabel></eg-combobox-entry>
275         </eg-combobox>
276         <div *ngIf="!ranganathan.valid" class="alert alert-danger">
277           <span class="material-icons">error</span>
278           <span i18n>That isn't a real law of library science!</span>
279         </div>
280       </div>
281     </div>
282   </form>
283   <form class="card col-md-4" [formGroup]="badOrgForm">
284     <div class="card-body">
285       <h3 class="card-title">Another reactive form!</h3>
286       <div class="card-text">
287         <eg-org-family-select
288           formControlName="badOrgSelector"
289           labelText="Choose the fanciest libraries">
290         </eg-org-family-select>
291         <div *ngIf="!badOrgForm.valid" class="alert alert-danger">
292           <span class="material-icons">error</span>
293           <span i18n>Too many fancy libraries!</span>
294         </div>
295       </div>
296     </div>
297   </form>
298 </div>
299
300 <button (click)="confirmNumber(1)">Confirm 1</button>
301 <button (click)="confirmNumber(0)">Confirm 0</button>
302 <button (click)="confirmNumber(20)">Confirm 20</button>
303
304 <eg-confirm-dialog #numConfirmDialog
305   i18n-dialogTitle
306   dialogTitle="Confirm Number"
307   [dialogBodyTemplate]="confirmMsg">
308 </eg-confirm-dialog>
309 <ng-template #confirmMsg>
310   <span i18n>Are you sure you want to confirm {numThings, plural, =1 {this thing} other {these {{numThings}} things}}?</span>
311 </ng-template>
312
313 <div class="row">
314   <eg-fm-record-editor #bresvEditor
315     idlClass="bresv"
316     hiddenFields="capture_staff,usr" readonlyFields="cancel_time">
317   </eg-fm-record-editor>
318   <button class="btn btn-info" (click)="bresvEditor.open({})">
319     Test Readonly Date
320   </button>
321 </div>
322
323 <div class="row m-3 p-3 border-top border-dark">
324   <div class="col-lg-3">Simple Combobox using [(ngModel)]</div>
325   <div class="col-lg-3">
326     <eg-combobox [(ngModel)]="simpleCombo" [allowFreeText]="true">
327       <eg-combobox-entry 
328         entryId="abc" entryLabel="ABC" i18n-entryLabel></eg-combobox-entry>
329       <eg-combobox-entry 
330         entryId="def" entryLabel="DEF" i18n-entryLabel></eg-combobox-entry>
331     </eg-combobox>
332   </div>
333   <div class="col-lg-3">
334     <span i18n>Combobox Value: {{simpleCombo ? simpleCombo.label : ''}}</span>
335   </div>
336 </div>
337