<% // Pass in a type of 'sales', 'purchases' or 'cases' %> <% var type = ob.type || 'sales' %> <% var types = ['sales', 'purchases', 'cases']; if (types.indexOf(ob.type) === -1) { throw new Error('The type must be one of ${types}'); } if (!ob.userCurrency) { throw new Error('Please provide the users local currency.'); } if (!ob.moment) { throw new Error('Please pass in the moment library.'); } %>
<%= ob.type === 'cases' ? ob.caseId : ob.orderId %> <%= ob.moment(ob.timestamp).format('l LT') %> <% if (ob.type !== 'cases') { %>
<% const imageHashes = { small: ob.thumbnail, tiny: ob.thumbnail } %> <%= ob.title %>
<% } %> <% const userCols = []; if (ob.type !== 'sales') { userCols.push({ avatarHashes: ob.vendorAvatarHashes || {}, userHandle: ob.vendorHandle, userId: ob.vendorId, }); } if (ob.type !== 'purchases') { userCols.push({ avatarHashes: ob.buyerAvatarHashes || {}, userHandle: ob.buyerHandle, userId: ob.buyerId, }); } %> <% userCols.forEach((user, index) => { %>
<%= user.userHandle ? `@${user.userHandle}` : user.userId %>
<% if (ob.unreadChatMessages && index === 0) { %> <%= ob.unreadChatMessages > 99 ? '…' : ob.unreadChatMessages %> <% } %>
<% }) %> <%= ob.currencyMod.pairedCurrency( ob.total, ob.currencyMod.getServerCurrency().code, ob.userCurrency ) %> <% if (ob.state === 'PENDING') { if (ob.type === 'sales') { if (ob.rejectOrderInProgress) { %> <% // including invisible reject link to properly space the spinner %> <%= ob.spinner({ className: 'spinnerSm center' }) %> <% } else { %> <%= ob.polyT('transactions.transactionsTable.btnReject') %> <% } %> <%= ob.processingButton({ className: `js-acceptOrder btnAcceptOrder btn clrBAttGrad clrBrDec1 clrTOnEmph ${ob.acceptOrderInProgress ? 'processing' : ''} ${ob.rejectOrderInProgress ? 'disabled' : ''}`, btnText: ob.polyT('transactions.transactionsTable.btnAccept') }) %> <% } else if (!ob.moderated) { // Only non-moderated purchase can be canceled. We are not allowing PROCESSING_ERROR orders to be canceled here because // they need to be funded and we don't know if they are. If funded, they can be canceled on the Order Detail overlay. if (ob.cancelOrderInProgress) { %> <% // including invisible cancel link to properly space the spinner %> <%= ob.spinner({ className: 'spinnerSm center' }) %> <% } else { %> <%= ob.polyT('transactions.transactionsTable.btnCancel') %> <% } } else { const statusText = ob.polyT(`transactions.transactionsTable.status.${ob.state}`); print(`${statusText}`); } } else { const statusText = ob.polyT(`transactions.transactionsTable.status.${ob.state}`); print(`${statusText}`); } %>