Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Merging PR #368
Browse files Browse the repository at this point in the history
Thanks to @nerdkid93 for this PR.

Closes #368
Closes #276
  • Loading branch information
jkleinsc committed Mar 21, 2016
1 parent 9c9fda9 commit 013266d
Show file tree
Hide file tree
Showing 32 changed files with 585 additions and 372 deletions.
3 changes: 2 additions & 1 deletion app/inventory/adjust/controller.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import AbstractEditController from 'hospitalrun/controllers/abstract-edit-controller';
import AdjustmentTypes from 'hospitalrun/mixins/inventory-adjustment-types';
import Ember from 'ember';
import { translationMacro as t } from 'ember-i18n';
export default AbstractEditController.extend(AdjustmentTypes, {
inventoryController: Ember.inject.controller('inventory'),

expenseAccountList: Ember.computed.alias('inventoryController.expenseAccountList'),

title: 'Adjustment',
title: t('inventory.titles.adjustment'),

transactionTypeChanged: function() {
Ember.run.once(this, function() {
Expand Down
18 changes: 9 additions & 9 deletions app/inventory/adjust/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
updateButtonText=updateButtonText }}
{{#em-form model=model submitButton=false }}
<div class="form-group">
<label class="control-label">Item</label>
<label class="control-label">{{t 'inventory.labels.item'}}</label>
<p class="form-control-static">{{model.adjustmentItem.name}}</p>
</div>
<div class="form-group">
<label class="control-label">Adjustment For</label>
<label class="control-label">{{t 'inventory.labels.adjustment_for'}}</label>
<p class="form-control-static">{{model.locationName}}</p>
</div>
<div class="form-group">
<label class="control-label">Current Quantity</label>
<label class="control-label">{{t 'inventory.labels.current_quantity'}}</label>
<p class="form-control-static">{{model.quantity}}</p>
</div>
<div class="row">
{{em-select class="col-sm-4" label="Adjustment Type"
{{em-select class="col-sm-4" label=(t 'inventory.labels.adjustment_type')
property="transactionType" content=adjustmentTypes
optionValuePath="type" optionLabelPath="name"
}}
{{em-input property="adjustmentQuantity" label="Quantity" class="col-sm-3 required"}}
{{em-input property="adjustmentQuantity" label=(t 'labels.quantity') class="col-sm-3 required"}}
</div>
{{em-text label="Reason" property="reason" rows=3 }}
{{em-text label=(t 'inventory.labels.reason') property="reason" rows=3}}
<div class="row">
{{date-picker property="dateCompleted" label="Adjustment Date" class="col-sm-4 required"}}
{{select-or-typeahead property="expenseAccount" label="Expense To" list=expenseAccountList selection=model.expenseAccount class="col-sm-8"}}
{{date-picker property="dateCompleted" label=(t 'inventory.labels.adjustment_date') class="col-sm-4 required"}}
{{select-or-typeahead property="expenseAccount" label=(t 'inventory.labels.expense') list=expenseAccountList selection=model.expenseAccount class="col-sm-8"}}
</div>
{{/em-form}}
{{/modal-dialog}}
{{/modal-dialog}}
6 changes: 3 additions & 3 deletions app/inventory/barcode/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
{{#if havePrinters}}
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Print Barcode</h3>
<h3 class="panel-title">{{t 'inventory.labels.print_barcode'}}</h3>
</div>
<div class="panel-body">
<div class="form-group">
{{#unless singlePrinter}}
<label for="printerSelect">Printer</label>
<label for="printerSelect">{{t 'inventory.labels.printer'}}</label>
{{select-list
content=printers
optionLabelPath='name'
Expand All @@ -24,7 +24,7 @@
}}
{{/unless}}
</div>
<button class="btn btn-primary" {{action 'print'}}><span class=" glyphicon glyphicon-print"></span> Print</button>
<button class="btn btn-primary" {{action 'print'}}><span class=" glyphicon glyphicon-print"></span> {{t 'inventory.labels.print'}}</button>
</div>
</div>
{{/if}}
Expand Down
12 changes: 6 additions & 6 deletions app/inventory/batch/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import InventoryId from 'hospitalrun/mixins/inventory-id';
import InventoryLocations from 'hospitalrun/mixins/inventory-locations';
import InventorySelection from 'hospitalrun/mixins/inventory-selection';
import Ember from 'ember';

import { translationMacro as t } from 'ember-i18n';
export default AbstractEditController.extend(InventoryId, InventoryLocations, InventorySelection, {
doingUpdate: false,
inventoryController: Ember.inject.controller('inventory'),
Expand Down Expand Up @@ -68,7 +68,7 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In
return total;
}.property('model.invoiceItems.[].purchaseCost', 'model.isValid', 'model.purchaseCost'),

updateButtonText: 'Save',
updateButtonText: t('inventory.labels.save'),

updateCapability: 'add_inventory_item',

Expand Down Expand Up @@ -101,7 +101,7 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In
throw Error('invalid');
}
}.bind(this)).catch(function() {
this.displayAlert('Warning!!!!', 'Please fill in required fields (marked with *) and correct the errors before adding.');
this.displayAlert(this.get('i18n').t('inventory.titles.warning'), this.get('i18n').t('inventory.messages.warning'));
}.bind(this));
},

Expand Down Expand Up @@ -193,7 +193,7 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In
}.bind(this));
Ember.RSVP.all(inventorySaves).then(function() {
this.updateLookupLists();
this.displayAlert('Inventory Purchases Saved', 'The inventory purchases have been successfully saved', 'allItems');
this.displayAlert(this.get('i18n').t('inventory.titles.purchase_saved'), this.get('i18n').t('inventory.messages.purchase_saved'), 'allItems');
}.bind(this));
}.bind(this));
}.bind(this));
Expand Down Expand Up @@ -221,11 +221,11 @@ export default AbstractEditController.extend(InventoryId, InventoryLocations, In
},

showRemoveItem: function(item) {
var message = 'Are you sure you want to remove this item from this invoice?',
var message = this.get('i18n').t('inventory.messages.remove_item'),
model = Ember.Object.create({
itemToRemove: item
}),
title = 'Remove Item';
title = this.get('i18n').t('inventory.titles.remove_item');
this.displayConfirm(title, message, 'removeItem', model);
},

Expand Down
5 changes: 3 additions & 2 deletions app/inventory/batch/route.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import InventoryRequestRoute from 'hospitalrun/inventory/request/route';
import Ember from 'ember';
import { translationMacro as t } from 'ember-i18n';
export default InventoryRequestRoute.extend({
editTitle: 'Inventory Received',
editTitle: t('navigation.subnav.inventory_received'),
modelName: 'inventory-batch',
newTitle: 'Inventory Received',
newTitle: t('navigation.subnav.inventory_received'),
getNewData: function() {
return Ember.RSVP.resolve({
invoiceItems: [],
Expand Down
50 changes: 25 additions & 25 deletions app/inventory/batch/template.hbs
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
{{#edit-panel editPanelProps=editPanelProps}}
{{#em-form model=model submitButton=false }}
<div class="row">
{{date-picker property="dateReceived" label="Date Received" class="col-sm-4 required"}}
{{select-or-typeahead property="vendor" label="Vendor" list=vendorList selection=model.vendor className="col-sm-4 required test-vendor"}}
{{em-input property="invoiceNo" label="Invoice Number" class="col-sm-4 test-invoice-number"}}
{{date-picker property="dateReceived" label=(t 'inventory.labels.date_received') class="col-sm-4 required"}}
{{select-or-typeahead property="vendor" label=(t 'inventory.labels.vendor') list=vendorList selection=model.vendor className="col-sm-4 required test-vendor"}}
{{em-input property="invoiceNo" label=(t 'inventory.labels.invoice_number') class="col-sm-4 test-invoice-number"}}
</div>
<div class="row">
{{select-or-typeahead property="location" label="Location" list=warehouseList selection=model.location className="col-sm-5"}}
{{select-or-typeahead property="aisleLocation" label="Aisle Location" list=aisleLocationList selection=model.aisleLocation className="col-sm-5"}}
{{select-or-typeahead property="location" label=(t 'inventory.labels.location') list=warehouseList selection=model.location className="col-sm-5"}}
{{select-or-typeahead property="aisleLocation" label=(t 'inventory.labels.aisle_location') list=aisleLocationList selection=model.aisleLocation className="col-sm-5"}}
<div class="form-group col-sm-2">
<label class="control-label">Gift In Kind</label>
{{em-checkbox label="Gift In Kind" property="giftInKind"}}
<label class="control-label">{{t 'inventory.labels.gift'}}</label>
{{em-checkbox label=(t 'inventory.labels.gift') property="giftInKind"}}
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Invoice Line Item</h3>
<h3 class="panel-title">{{t 'inventory.labels.invoice_line_item'}}</h3>
</div>
<div class="panel-body">
<div class="row">
{{inventory-typeahead
class="col-sm-7 required test-inv-item"
property="inventoryItemTypeAhead"
label="Inventory Item"
label=(t 'inventory.labels.inventory_item')
content=inventoryList
selection=selectedInventoryItem
showQuantity=false
}}
{{em-input property="quantity" label="Quantity" class="col-sm-2 required test-inv-quantity"}}
{{em-input property="quantity" label=(t 'labels.quantity') class="col-sm-2 required test-inv-quantity"}}
<div class="form-group col-sm-1">
<label class="control-label">Unit</label>
<label class="control-label">{{t 'inventory.labels.unit'}}</label>
{{#if showDistributionUnit}}
<p class="form-control-static">{{model.inventoryItem.distributionUnit}}</p>
{{/if}}
</div>
{{em-input property="purchaseCost" label="Purchase Cost" class="col-sm-2 required test-inv-cost"}}
{{em-input property="purchaseCost" label=(t 'inventory.labels.purchase_cost') class="col-sm-2 required test-inv-cost"}}
</div>
<div class="row">
{{em-input property="vendorItemNo" label="Vendor Item Number" class="col-sm-4"}}
{{em-input property="lotNumber" label="Serial/Lot Number" class="col-sm-4"}}
{{date-picker property="expirationDate" label="Expiration Date" minDate="now" class="col-sm-2"}}
{{em-input property="vendorItemNo" label=(t 'inventory.labels.vendor_item_number') class="col-sm-4"}}
{{em-input property="lotNumber" label=(t 'inventory.labels.serial_number') class="col-sm-4"}}
{{date-picker property="expirationDate" label=(t 'inventory.labels.expiration_date') minDate="now" class="col-sm-2"}}
<div class="form-group col-sm-2">
<label class="control-label">&nbsp;</label>
<p class="form-control-static">
<button class="btn btn-primary" {{action "addInventoryItem"}}>
<span class="octicon octicon-plus"></span> Add
<span class="octicon octicon-plus"></span> {{t 'inventory.labels.add'}}
</button>
</p>
</div>
</div>
</div>
</div>
{{#if model.invoiceItems}}
<h3>Invoice Items</h3>
<h3>{{t 'inventory.labels.invoice_items'}}</h3>
<table class="table">
<tr class="table-header">
<th>{{t 'labels.name'}}</th>
<th>{{t 'inventory.labels.name'}}</th>
<th>{{t 'labels.quantity'}}</th>
<th>Cost</th>
<th>Item Number</th>
<th>Serial/Lot Number</th>
<th>Expiration Date</th>
<th>{{t 'labels.action'}}</th>
<th>{{t 'inventory.labels.cost'}}</th>
<th>{{t 'inventory.labels.item_number'}}</th>
<th>{{t 'inventory.labels.serial_number'}}</th>
<th>{{t 'inventory.labels.expiration_date'}}</th>
<th>{{t 'inventory.labels.action'}}</th>
</tr>
{{#each model.invoiceItems as |invoiceItem|}}
<tr>
Expand Down Expand Up @@ -96,13 +96,13 @@
</td>
<td class="col-sm-1">
<button class="btn btn-default warning" {{action "showRemoveItem" invoiceItem bubbles=false }}>
<span class="octicon octicon-x"></span>Remove
<span class="octicon octicon-x"></span>{{t 'inventory.labels.remove'}}
</button>
</td>
</tr>
{{/each}}
</table>
<h4>Total Received: {{totalReceived}}</h4>
<h4>{{t 'inventory.labels.total_received' total=totalReceived}}</h4>
{{/if}}
{{/em-form}}
{{/edit-panel}}
3 changes: 2 additions & 1 deletion app/inventory/delete/controller.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { translationMacro as t } from 'ember-i18n';
import AbstractDeleteController from 'hospitalrun/controllers/abstract-delete-controller';
export default AbstractDeleteController.extend({
title: 'Delete Item'
title: t('inventory.labels.delete_item')
});
4 changes: 2 additions & 2 deletions app/inventory/delete/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
updateButtonAction=updateButtonAction
updateButtonText=updateButtonText }}
<div class="alert alert-danger">
<span class="glyphicon glyphicon-warning-sign"></span>
Are you sure you wish to delete {{model.name}}?
<span class="glyphicon glyphicon-warning-sign"></span>&nbsp;
{{t 'inventory.messages.delete' name=model.name}}
</div>
{{/modal-dialog}}
5 changes: 3 additions & 2 deletions app/inventory/edit/route.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';
import Ember from 'ember';
import { translationMacro as t } from 'ember-i18n';
import InventoryId from 'hospitalrun/mixins/inventory-id';
export default AbstractEditRoute.extend(InventoryId, {
editTitle: 'Edit Item',
editTitle: t('inventory.labels.edit_item'),
modelName: 'inventory',
newTitle: 'New Item',
newTitle: t('inventory.labels.new_item'),

actions: {
adjustItems: function(inventoryLocation) {
Expand Down
Loading

0 comments on commit 013266d

Please sign in to comment.