dojo.query('[attr=title]', row)[0].onclick = function() {self.drawInfo(li.id())};
dojo.query('[name=copieslink]', row)[0].onclick = function() {self.drawCopies(li.id())};
- dojo.query('[name=notes_count]', row)[0].innerHTML = li.lineitem_notes().length;
dojo.query('[name=noteslink]', row)[0].onclick = function() {self.drawLiNotes(li)};
+ this.updateLiNotesCount(li, row);
+
// show which PO this lineitem is a member of
if(li.purchase_order() && !this.isPO) {
var po =
}
};
+ this.updateLiNotesCount = function(li, row) {
+ if (typeof(row) == "undefined")
+ row = dojo.query('tr[li="' + li.id() + '"]', "acq-lit-tbody")[0];
+ nodeByName("notes_count", row).innerHTML = li.lineitem_notes().length;
+ };
+
this.updateLiReceivedness = function(li, row) {
if (typeof(row) == "undefined")
row = dojo.query('tr[li="' + li.id() + '"]', "acq-lit-tbody")[0];
this._setAlertStore = function() {
- acqLitNoteAlertSelector.store = new dojo.data.ItemFileReadStore(
+ acqLitAlertAlertText.store = new dojo.data.ItemFileReadStore(
{
"data": acqliat.toStoreData(
(new openils.PermaCrud()).search(
)
}
);
- acqLitNoteAlertSelector.setValue(); /* make the store "live" */
- acqLitNoteAlertSelector._store_ready = true;
+ acqLitAlertAlertText.setValue(); /* make the store "live" */
+ acqLitAlertAlertText._store_ready = true;
};
/**
this.drawLiNotes = function(li) {
var self = this;
- if (!acqLitNoteAlertSelector._store_ready) {
+ if (!acqLitAlertAlertText._store_ready)
this._setAlertStore();
- }
li.lineitem_notes(
li.lineitem_notes().sort(
note.isnew(true);
note.value(value);
note.lineitem(li.id());
- if (acqLitNoteAlertSelector.item)
- note.alert_text(Number(acqLitNoteAlertSelector.item.id));
self.updateLiNotes(li, note);
}
- dojo.byId('acq-lit-notes-save-button').onclick = function() {
- self.updateLiNotes(li);
+ acqLitCreateAlertSubmit.onClick = function() {
+ if (!acqLitAlertAlertText.item) {
+ alert(localeStrings.ALERT_UNSELECTED);
+ return;
+ }
+
+ var alert_text = new fieldmapper.acqliat().fromStoreItem(
+ acqLitAlertAlertText.item
+ );
+ var value = acqLitAlertNoteValue.attr("value") || "";
+
+ var note = new fieldmapper.acqlin();
+ note.isnew(true);
+ note.lineitem(li.id());
+ note.value(value);
+ note.alert_text(alert_text);
+
+ self.updateLiNotes(li, note);
}
dojo.forEach(li.lineitem_notes(), function(note) { self.addLiNote(li, note) });
if(note.isdeleted()) return;
var self = this;
var row = self.liNotesRow.cloneNode(true);
- dojo.query('[name=value]', row)[0].innerHTML = note.value();
+ nodeByName("value", row).innerHTML = note.value();
+ if (note.alert_text())
+ nodeByName("alert_code", row).innerHTML = note.alert_text().code();
- dojo.query('[name=delete]', row)[0].onclick = function() {
+ nodeByName("delete", row).onclick = function() {
note.isdeleted(true);
self.liNotesTbody.removeChild(row);
+ self.updateLiNotes(li);
};
if(note.edit_time()) {
- dojo.query('[name=edit_time]', row)[0].innerHTML =
+ nodeByName("edit_time", row).innerHTML =
dojo.date.locale.format(
dojo.date.stamp.fromISOString(note.edit_time()),
{formatLength:'short'});
}
progressDialog.hide();
+ self.updateLiNotesCount(li);
self.drawLiNotes(li);
return;
}
(new openils.acq.Lineitem({"lineitem": li})).findAttr(
"title", "lineitem_marc_attr_definition"
),
- lin.alert_text().description(), lin.value()
+ lin.alert_text().code(),
+ lin.alert_text().description() || "",
+ lin.value()
]
)
);
<div dojoType="dijit.form.DropDownButton">
<span>New Note</span>
<div dojoType="dijit.TooltipDialog">
- <div class="acq-lit-note-create-row">
- <label for="acq-lit-create-note-text">Main body of note</label>
- <div jsId='acqLitCreateNoteText' dojoType='dijit.form.Textarea' style='height:5em; width:20em;' name='note' id="acq-lit-create-note-text"></div>
- </div>
- <div class="acq-lit-note-create-row">
- <label for="acq-lit-note-alert-selector">Optional alert text</label>
- <input id="acq-lit-note-alert-selector" jsId="acqLitNoteAlertSelector" dojoType="dijit.form.FilteringSelect" labelAttr="code" searchAttr="code" required="false" />
+ <div class="acq-lit-note-row">
+ <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>
+ <div dojoType="dijit.form.DropDownButton">
+ <span>New Alert</span>
+ <div dojoType="dijit.TooltipDialog">
+ <div class="acq-lit-note-row">
+ <label for="acq-lit-alert-alert-text">Choose alert code </label>
+ <input id="acq-lit-alert-alert-text" jsId="acqLitAlertAlertText" dojoType="dijit.form.FilteringSelect" labelAttr="code" searchAttr="code" required="true" />
+ </div>
+ <div class="acq-lit-note-row">
+ <label for="acq-lit-alert-value">Optional description</label>
+ <div jsId="acqLitAlertNoteValue" id="acq-lit-alert-value" dojoType="dijit.form.Textarea" name="value"></div>
+ </div>
+ <button jsId="acqLitCreateAlertSubmit" dojoType="dijit.form.Button" type="submit">Create</button>
+ </div>
+ </div>
</td>
</tr>
</table>
<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 width='70%' align='left'><span name="alert_code"></span><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>