]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/eg2/src/app/staff/sandbox/sandbox.component.html
LP#1835982: add GridCellTextGenerator to the btGrid in the sandbox
[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" hiddenFields="id"
37     fieldOrder="owner,name,description,marc_format,marc_record_type,tag"
38     [fieldOptions]="{marc_record_type:{customValues:[{id:'biblio'},{id:'serial'},{id:'authority'}]},description:{customTemplate:{template:descriptionTemplate,context:{'hello':'goodbye'}}}}"
39     recordId="1" orgDefaultAllowed="owner">
40   </eg-fm-record-editor>
41   <button class="btn btn-dark" (click)="openEditor()">
42       Fm Record Editor
43   </button>
44 </div>
45 <!-- / FM Editor Experiments ----------------------------- -->
46
47 <!-- Progress Dialog Experiments ----------------------------- -->
48 <div class="row mb-3">
49   <div class="col-lg-3">
50     <button class="btn btn-outline-danger" (click)="progress.increment()">Increment Inline</button>
51     <eg-help-popover [placement]="'bottom'" helpText="Exercise your clicking finger by clicking the button above.">
52     </eg-help-popover>
53   </div>
54   <div class="col-lg-3">
55     <eg-progress-inline [max]="100" [value]="1" #progress></eg-progress-inline>
56   </div>
57 </div>
58 <div class="row mb-3">
59   <div class="col-lg-4">
60     <eg-progress-dialog #progressDialog>
61     </eg-progress-dialog>
62     <button class="btn btn-light" (click)="showProgress()">Test Progress Dialog</button>
63   </div>
64   <div class="col-lg-3">
65     <eg-help-popover helpLink="https://www.youtube.com/watch?v=dQw4w9WgXcQ" helpText="This popover is supposed to help or something...!"></eg-help-popover>
66     <eg-combobox [allowFreeText]="true" 
67       placeholder="Combobox with static data"
68       [entries]="cbEntries"></eg-combobox>
69   </div>
70   <div class="col-lg-3">
71     <eg-help-popover helpText="You have to type to see any options in this dropdown."></eg-help-popover>
72     <eg-combobox
73       placeholder="Combobox with dynamic data that does not enable click if no search term is supplied"
74       [asyncDataSource]="cbAsyncSource"></eg-combobox>
75   </div>
76 </div>
77 <div class="row mb-3">
78   <div class="col-lg-4">
79    <eg-help-popover helpText="If you like Toast you must click below!" placement="'auto'"></eg-help-popover>
80    <button class="btn btn-info" (click)="testToast()">Test Toast Message</button>
81   </div>
82   <div class="col-lg-2">
83     Org select with limit perms
84   </div>
85   <div class="col-lg-2">
86     <eg-org-select [limitPerms]="['REGISTER_WORKSTATION']">
87     </eg-org-select>
88   </div>
89 </div>
90 <div class="row mb-3">
91   <div class="col-lg-4">
92   </div>
93   <div class="col-lg-3">
94     <eg-combobox placeholder="Combobox with @idlClass = 'aou' @idlField='shortname'" idlClass="aou" idlField="shortname" [asyncSupportsEmptyTermClick]="true">
95     </eg-combobox>
96   </div>
97   <div class="col-lg-3">
98     <eg-combobox placeholder="Combobox with @idlClass = 'cvrfm'" idlClass="cvrfm" [asyncSupportsEmptyTermClick]="true">
99     </eg-combobox>
100   </div>
101   <div class="col-lg-3">
102     <eg-combobox placeholder="Combobox with @idlClass = 'csp'" idlClass="csp" [asyncSupportsEmptyTermClick]="true">
103     </eg-combobox>
104   </div>
105 </div>
106 <div class="row mb-3">
107   <div class="col-lg-4">
108   </div>
109   <div class="col-lg-3">
110     <eg-combobox placeholder="Combobox with @idlClass = 'aou'" idlClass="aou" [asyncSupportsEmptyTermClick]="true">
111     </eg-combobox>
112   </div>
113   <div class="col-lg-3">
114     <eg-multi-select idlClass="acpl" linkedLibraryLabel="owning_lib" [startValue]="'{129,130,131}'">
115     </eg-multi-select>
116   </div>
117 </div>
118 <!-- /Progress Dialog Experiments ----------------------------- -->
119
120 <!-- eg strings -->
121 <!--
122 <div class="row mb-3">
123     <eg-string #helloString text="Hello, {{name}}" i18n-text></eg-string>
124     <button class="btn btn-success" (click)="testStrings()">Test Strings</button>
125 </div>
126 -->
127
128 <div class="row mb-3">
129     <ng-template #helloStrTmpl let-name="name" i18n>Hello, {{name}}</ng-template>
130     <!--
131     <eg-string #helloStr key="helloKey" [template]="helloStrTmpl"></eg-string>
132     -->
133     <eg-string key="staff.sandbox.test" [template]="helloStrTmpl"></eg-string>
134     <button class="btn btn-success" (click)="testStrings()">Test Strings</button>
135 </div>
136
137 <div class="row">
138   <div class="form-group">
139     <eg-date-select (onChangeAsDate)="changeDate($event)"
140         initialYmd="2017-03-04">
141     </eg-date-select>
142   </div>
143   <div>HERE: {{testDate}}</div>
144 </div>
145
146 <!-- printing -->
147
148 <h4>PRINTING</h4>
149
150 <div class="d-flex">
151   <div class="mr-2">
152     <button class="btn btn-info" (click)="doPrint()">Test Local Print</button>
153     <ng-template #printTemplate let-context>Hello, {{context.world}}!</ng-template>
154   </div>
155   <div class="mr-2">
156     <button class="btn btn-info" (click)="printWithDialog()">
157       Print with dialog (Hatch Only)
158     </button>
159   </div>
160   <div class="mr-2">
161     <button class="btn btn-info" 
162       (click)="testServerPrint()">Test Server-Generated Print</button>
163   </div>
164 </div>
165
166 <br/><br/>
167 <div class="row">
168   <div class="col-lg-3">
169     <eg-translate #translate [idlObject]="oneBtype" fieldName="name"></eg-translate>
170     <button class="btn btn-info"
171       (click)="translate.open({size:'lg'})">Translate</button>
172   </div>
173 </div>
174 <br/><br/>
175
176
177 <div>
178   <h4>Cross-tab communications example</h4>
179   <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. 
180      You should see the message that you sent to the other browser tab.</p>
181 </div>
182 <div class="row">
183   <div class="col-lg-3">
184     <input type="text" #sendSbMessage placeholder="message to send to another tab" size="40" (change)="sendMessage($event)">
185   </div>
186   <div class="col-lg-3">
187     message received: {{sbChannelText}}
188   </div>
189 </div>
190 <br/><br/>
191
192 <ngb-accordion>
193   <ngb-panel title="Open me for comboboxes">
194     <ng-template ngbPanelContent>
195       <eg-org-select></eg-org-select>
196       <eg-combobox>
197         <eg-combobox-entry entryId="bib" entryLabel="Bibliographic Records"
198           i18n-entryLabel></eg-combobox-entry>
199         <eg-combobox-entry entryId="auth" entryLabel="Authority Records"
200           i18n-entryLabel></eg-combobox-entry>
201         <eg-combobox-entry entryId="bib-acq" entryLabel="Acquisitions Records"
202           i18n-entryLabel></eg-combobox-entry>
203       </eg-combobox>
204     </ng-template>
205   </ngb-panel>
206 </ngb-accordion>
207
208 <!-- grid stuff -->
209 <ng-template #cellTmpl let-row="row" let-col="col" let-userContext="userContext">
210   HELLO {{userContext.hello}}
211   <button>{{row.id()}}</button>
212 </ng-template>
213 <eg-grid #cbtGrid idlClass="cbt" 
214   [dataSource]="btSource" 
215   [rowClassCallback]="btGridRowClassCallback"
216   [rowFlairIsEnabled]="true"
217   [rowFlairCallback]="btGridRowFlairCallback"
218   [cellClassCallback]="btGridCellClassCallback"
219   [stickyHeader]="true"
220   [cellTextGenerator]="btGridCellTextGenerator"
221   [sortable]="true">
222   <eg-grid-toolbar-action label="Action that needs a single row" i18n-label
223     (onClick)="complimentEvergreen($event)" [disableOnRows]="notOneSelectedRow">
224   </eg-grid-toolbar-action>
225   <eg-grid-toolbar-action [isSeparator]="true">
226   </eg-grid-toolbar-action>
227   <eg-grid-toolbar-action label="Another Action" i18n-label
228     (onClick)="complimentEvergreen2($event)">
229   </eg-grid-toolbar-action>
230   <eg-grid-column name="test" [cellTemplate]="cellTmpl" 
231     [cellContext]="btGridTestContext" [sortable]="false">
232   </eg-grid-column>
233   <eg-grid-column [sortable]="false" path="owner.name"></eg-grid-column>
234   <eg-grid-column [sortable]="false" path="datetime_test" 
235     datatype="timestamp" [datePlusTime]="true"></eg-grid-column>
236 </eg-grid>
237
238 <br/><br/>
239 <div class="row">
240   <div class="col">
241     <eg-daterange-select
242       ngModel #myRange="ngModel"
243       [initialRangeStart]="sevenDaysAgo()"
244       [initialRangeLength]="5"
245       [markDisabled]="allFutureDates">
246     </eg-daterange-select>
247     Your range is: {{myRange.value | json}}
248   </div>
249   <div class="col">
250     <form [formGroup]="myTimeForm">
251       <eg-datetime-select
252         formControlName="datetime">
253       </eg-datetime-select>
254       Your datetime is: {{myTimeForm.get('datetime').value | json}}
255     </form>
256   </div>
257 </div>
258 <label for="date-time-input">
259   Set the datetime and timezone library settings, and enter a valid datetime string for an exciting animation surprise:
260 </label>
261 <input id="date-time-input" type="text" class="date-time-input" ngModel egValidDatetime required>
262 <br/><br/>
263
264 <h4>Grid with filtering</h4>
265 <eg-grid #acpGrid idlClass="acp"
266   [dataSource]="acpSource"
267   [filterable]="true"
268   [sortable]="true"
269   [stickyHeader]="true"
270   showFields="barcode,location,circ_lib,price,dummy_title,create_date"
271 >
272   <eg-grid-toolbar-action label="Edit Selected" i18n-label [action]="editSelected">
273   </eg-grid-toolbar-action>
274   <eg-grid-column [sortable]="true" [filterable]="false"  path="barcode"></eg-grid-column>
275   <eg-grid-column [sortable]="true" path="circ_lib"></eg-grid-column>
276   <eg-grid-column [sortable]="true" path="price"></eg-grid-column>
277   <eg-grid-column [sortable]="true" path="dummy_title"></eg-grid-column>
278   <eg-grid-column [sortable]="true" path="create_date"></eg-grid-column>
279 </eg-grid>
280
281 <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">
282 </eg-fm-record-editor>
283 <eg-string #successString text="Updated succeeded!" i18n-text></eg-string>
284 <eg-string #updateFailedString text="Updated failed!" i18n-text></eg-string>
285
286 <h4>PCRUD auto flesh and FormatService detection</h4>
287 <div *ngIf="aMetarecord">Fingerprint: {{aMetarecord}}</div>
288
289 <div class="row">
290   <div class="card col-md-6">
291     <div class="card-body">
292       <h3 class="card-title">Do you like template-driven forms?</h3>
293       <div class="card-text">
294         <eg-org-family-select
295           [ancestorSelectorChecked]="true"
296           [hideDescendantSelector]="true"
297           selectedOrgId="7"
298           labelText="Choose the best libraries"
299           ngModel #bestOnes="ngModel">
300         </eg-org-family-select>
301         The best libraries are: {{bestOnes.value | json}}
302         <hr>
303         <eg-combobox [(ngModel)]="kingdom" [allowFreeText]="true">
304           <eg-combobox-entry entryId="Bacteria"></eg-combobox-entry>
305           <eg-combobox-entry entryId="Archaea"></eg-combobox-entry>
306           <eg-combobox-entry entryId="Protozoa"></eg-combobox-entry>
307           <eg-combobox-entry entryId="Chromista"></eg-combobox-entry>
308           <eg-combobox-entry entryId="Plantae"></eg-combobox-entry>
309           <eg-combobox-entry entryId="Fungi"></eg-combobox-entry>
310           <eg-combobox-entry entryId="Animalia"></eg-combobox-entry>
311         </eg-combobox>
312       Result: {{kingdom | json}}
313         <hr>
314         <eg-date-select [(ngModel)]="dateObject">
315         </eg-date-select>
316       ngModel: {{dateObject.toLocaleDateString()}}
317       </div>
318     </div>
319   </div>
320   <form class="card col-md-4" [formGroup]="ranganathan">
321     <div class="card-body">
322       <h3 class="card-title">Or perhaps reactive forms interest you?</h3>
323       <div class="card-text">
324         Choose your favorite law of library science: 
325         <eg-combobox formControlName="law" value="second" 
326           [allowFreeText]="true" [startIdFiresOnChange]="true">
327           <eg-combobox-entry entryId="first" entryLabel="Books are for use" i18n-entryLabel></eg-combobox-entry>
328           <eg-combobox-entry entryId="second" entryLabel="Every person his or her book" i18n-entryLabel></eg-combobox-entry>
329           <eg-combobox-entry entryId="third" entryLabel="Every book its reader" i18n-entryLabel></eg-combobox-entry>
330           <eg-combobox-entry entryId="fourth" entryLabel="Save the time of the reader" i18n-entryLabel></eg-combobox-entry>
331           <eg-combobox-entry entryId="fifth" entryLabel="Library is a growing organism" i18n-entryLabel></eg-combobox-entry>
332           <eg-combobox-entry entryId="wrong" entryLabel="42" i18n-entryLabel></eg-combobox-entry>
333         </eg-combobox>
334         <div *ngIf="!ranganathan.valid" class="alert alert-danger">
335           <span class="material-icons">error</span>
336           <span i18n>That isn't a real law of library science!</span>
337         </div>
338       </div>
339     </div>
340   </form>
341   <form class="card col-md-4" [formGroup]="badOrgForm">
342     <div class="card-body">
343       <h3 class="card-title">Another reactive form!</h3>
344       <div class="card-text">
345         <eg-org-family-select
346           formControlName="badOrgSelector"
347           labelText="Choose the fanciest libraries">
348         </eg-org-family-select>
349         <div *ngIf="!badOrgForm.valid" class="alert alert-danger">
350           <span class="material-icons">error</span>
351           <span i18n>Too many fancy libraries!</span>
352         </div>
353       </div>
354     </div>
355   </form>
356 </div>
357
358 <button (click)="confirmNumber(1)">Confirm 1</button>
359 <button (click)="confirmNumber(0)">Confirm 0</button>
360 <button (click)="confirmNumber(20)">Confirm 20</button>
361
362 <eg-confirm-dialog #numConfirmDialog
363   i18n-dialogTitle
364   dialogTitle="Confirm Number"
365   [dialogBodyTemplate]="confirmMsg">
366 </eg-confirm-dialog>
367 <ng-template #confirmMsg>
368   <span i18n>Are you sure you want to confirm {numThings, plural, =1 {this thing} other {these {{numThings}} things}}?</span>
369 </ng-template>
370
371 <div class="row">
372   <eg-fm-record-editor #bresvEditor
373     idlClass="bresv"
374     hiddenFields="capture_staff,usr" readonlyFields="cancel_time">
375   </eg-fm-record-editor>
376   <button class="btn btn-info" (click)="bresvEditor.open({})">
377     Test Readonly Date
378   </button>
379 </div>
380
381 <div class="row m-3 p-3 border-top border-dark">
382   <div class="col-lg-3">Simple Combobox using [(ngModel)]</div>
383   <div class="col-lg-3">
384     <eg-combobox [(ngModel)]="simpleCombo" [allowFreeText]="true">
385       <eg-combobox-entry 
386         entryId="abc" entryLabel="ABC" i18n-entryLabel></eg-combobox-entry>
387       <eg-combobox-entry 
388         entryId="def" entryLabel="DEF" i18n-entryLabel></eg-combobox-entry>
389     </eg-combobox>
390   </div>
391   <div class="col-lg-3">
392     <span i18n>Combobox Value: {{simpleCombo ? simpleCombo.label : ''}}</span>
393   </div>
394 </div>
395
396 <div class="mt-4 mb-4">
397   <h4>Inline FM Editor</h4>
398   <div class="row">
399     <div class="col-lg-6">
400       <eg-fm-record-editor displayMode="inline"
401         idlClass="cbt" mode="update" recordId="1" orgDefaultAllowed="owner">
402       </eg-fm-record-editor>
403     </div>
404   </div>
405 </div>
406
407 <div class="mt-4 mb-4">
408   <h4>Grid Stock Selector Display and Filtering</h4>
409   <eg-grid #eventsGrid idlClass="atevdef"
410     [dataSource]="eventsDataSource"
411     showFields="name,hook,validator,reactor"
412     [sortable]="true" [filterable]="true">
413     <!-- demo how explicit fields and auto fields support link field selector
414          display and filtering consisently without additional biolerplate -->
415     <eg-grid-column name="name"></eg-grid-column>
416     <eg-grid-column name="hook"></eg-grid-column>
417   </eg-grid>
418 </div>