self._savePl(acqLitSavePlDialog.getValues());
}
- dojo.byId('acq-lit-notes-new-button').onclick = function(){acqLitCreateLiNoteDialog.show();}
+ //dojo.byId('acq-lit-notes-new-button').onclick = function(){acqLitCreateLiNoteDialog.show();}
dojo.byId('acq-lit-select-toggle').onclick = function(){self.toggleSelect()};
dojo.byId('acq-lit-info-back-button').onclick = function(){self.show('list')};
this.show('notes');
acqLitCreateLiNoteSubmit.onClick = function() {
- acqLitCreateLiNoteDialog.hide();
- var value = acqLitCreateLiNoteDialog.getValues().note;
+ var value = acqLitCreateNoteText.attr('value');
if(!value) return;
var note = new fieldmapper.acqlin();
note.isnew(true);
note.value(value);
- li.lineitem_notes().push(note);
note.lineitem(li.id());
- self.addLiNote(li, note);
+ self.updateLiNotes(li, note);
}
dojo.byId('acq-lit-notes-save-button').onclick = function() {
}
this.addLiNote = function(li, note) {
+ if(note.isdeleted()) return;
var self = this;
var row = self.liNotesRow.cloneNode(true);
- dojo.query('[name=creator]', row)[0].innerHTML = note.creator() || ''; /* XXX */
- dojo.query('[name=editor]', row)[0].innerHTML = note.editor() || ''; /* XXX */
+ dojo.query('[name=value]', row)[0].innerHTML = note.value();
- if(note.create_time()) {
- dojo.query('[name=create_time]', row)[0].innerHTML =
- dojo.date.locale.format(
- dojo.date.stamp.fromISOString(note.create_time()),
- {formatLength:'short'});
- }
+ dojo.query('[name=delete]', row)[0].onclick = function() {
+ note.isdeleted(true);
+ self.liNotesTbody.removeChild(row);
+ };
if(note.edit_time()) {
dojo.query('[name=edit_time]', row)[0].innerHTML =
{formatLength:'short'});
}
- new openils.widget.AutoFieldWidget({
- fmField : 'value',
- fmObject : note,
- parentNode : dojo.query('[name=value]', row)[0],
- widgetClass : 'dijit.form.Textarea',
- }).build(
- function(w) {
- dojo.connect(w, 'onChange',
- function() {
- note.value(this.attr('value'));
- note.ischanged(true);
- }
- );
- }
- );
-
- dojo.query('[name=delete]', row)[0].onclick = function() {
- note.isdeleted(true);
- self.liNotesTbody.removeChild(row);
- };
-
self.liNotesTbody.appendChild(row);
}
- this.updateLiNotes = function(li) {
- progressDialog.show();
+ this.updateLiNotes = function(li, newNote) {
- var notes = li.lineitem_notes().filter(
- function(note) {
- if(note.ischanged() || note.isnew() || note.isdeleted())
- return note;
- }
- );
+ var notes;
+ if(newNote) {
+ notes = [newNote];
+ } else {
+ notes = li.lineitem_notes().filter(
+ function(note) {
+ if(note.ischanged() || note.isnew() || note.isdeleted())
+ return note;
+ }
+ );
+ }
+
+ if(notes.length == 0) return;
+ progressDialog.show();
fieldmapper.standardRequest(
['open-ils.acq', 'open-ils.acq.lineitem_note.cud.batch'],
var resp = openils.Util.readResponse(r);
if(resp.complete) {
+
+ if(!newNote) {
+ // remove the old changed notes
+ var list = [];
+ dojo.forEach(li.lineitem_notes(),
+ function(note) {
+ if(!(note.ischanged() || note.isnew() || note.isdeleted()))
+ list.push(note);
+ }
+ );
+ li.lineitem_notes(list);
+ }
+
progressDialog.hide();
self.drawLiNotes(li);
return;
}
progressDialog.update(resp);
-
var newnote = resp.note;
- var oldnote = li.lineitem_notes().filter(function(n) { return (n.value() == newnote.value()) })[0];
- var notes = li.lineitem_notes().filter(function(n) { return (n.value() != newnote.value()) });
- if(!openils.Util.isTrue(oldnote.isdeleted()))
- notes.push(newnote);
- li.lineitem_notes(notes);
+ if(!newnote.isdeleted()) {
+ newnote.isnew(false);
+ newnote.ischanged(false);
+ li.lineitem_notes().push(newnote);
+ }
},
}
);
<option mask='sr' value='save_picklist'>Save Items To Selection List</option>
<option mask='pl' value='selector_ready'>Mark Ready for Selector</option>
<option mask='pl' value='order_ready'>Mark Ready for Order</option>
- <option mask='po' value='' disabled='disabled'>------</option>
+ <option mask='*' value='delete_selected'>Delete Selected Items</option>
<option mask='po' value='create_order'>Create Purchase Order</option>
+ <option mask='po' value='' disabled='disabled'>----PO----</option>
+ <option mask='po' value='create_assets'>Load Bibs and Items</option>
<option mask='po' value='receive_po'>Mark Purchase Order as Received</option>
<option mask='po' value='rollback_receive_po'>Un-Receive Purchase Order</option>
<option mask='po' value='print_po'>Print Purchase Order</option>
- <option mask='po' value='create_assets'>Load Bibs and Items</option>
- <option mask='po' value='' disabled='disabled'>------</option>
- <option mask='*' value='delete_selected'>Delete Selected Items</option>
</select>
</span>
<span id='acq-lit-generic-progress' class='hidden'>
<div dojoType='dijit.form.Button' id='acq-lit-notes-back-button'>↖ Return</div>
</td>
<td style='text-align:right;'>
- <div dojoType='dijit.form.Button' id='acq-lit-notes-new-button'>New Note</div>
+ <div dojoType="dijit.form.DropDownButton">
+ <span>New Note</span>
+ <div dojoType="dijit.TooltipDialog">
+ <div>
+ <div jsId='acqLitCreateNoteText' dojoType='dijit.form.Textarea' style='height:5em; width:25em;' name='note'></div>
+ </div>
+ <button jsId='acqLitCreateLiNoteSubmit' dojoType='dijit.form.Button' type="submit">Create</button>
+ </div>
+ </div>
+
<div dojoType='dijit.form.Button' id='acq-lit-notes-save-button'>Save Changes</div>
</td>
</tr>
</table>
</div>
- <table class='oils-generic-table' style='width:90%;'>
- <thead><tr>
- <th>Note</th>
- <th>Creator</th>
- <th>Create Time</th>
- <th>Editor</th>
- <th>Edit Time</th>
- <th/>
- </tr></thead>
- <tbody id='acq-lit-notes-tbody'>
- <tr id='acq-lit-notes-row'>
- <td class='acq-lit-note-textarea'><div name='value'/></td>
- <td><div name='creator'/></td>
- <td><div name='create_time'/></td>
- <td><div name='editor'/></td>
- <td><div name='edit_time'/></td>
- <td><div name='delete' dojoType='dijit.form.Button' style='color:red;'>X</div></td>
- </tr>
- </tbody>
- </table>
+ <ol id='acq-lit-notes-tbody'>
+ <li id='acq-lit-notes-row'>
+ <table style='width:100%;' class='oils-generic-table'>
+ <tr>
+ <td width='70%' align='left'><span style='font-size:120%' name='value'></span></td>
+ <td align='right' style='padding-right:30px;'>
+ <span name='edit_time'></span>
+ <span style='padding-left:4px;'><a name='delete' href='javascript:void(0);' style='color:red;'>Delete</a></span>
+ </td>
+ </tr>
+ </div>
+ </li>
+ </ol>
</div>
- <div class='hidden'>
- <div dojoType='dijit.Dialog' jsId='acqLitCreateLiNoteDialog'>
- <div dojoType='dijit.form.Textarea' style='height:6em; width:40em;' name='note'></div>
- <br/>
- <div dojoType='dijit.form.Button' type='submit' jsId='acqLitCreateLiNoteSubmit'>Create</div>
- </div>
- </div>
-
<!-- Copies table -->
<div id='acq-lit-li-details' class='hidden'>
<h2>Copies</h2>