Skip to content

Commit

Permalink
refactor(suppliers): update suppliers UI to 2.x
Browse files Browse the repository at this point in the history
This commit contains minor fixes to the UI of the suppliers page.  In
truth, the whole page needs to be redone, but a few quick patches make
it fit in better.
  • Loading branch information
Jonathan Niles committed Sep 15, 2016
1 parent 910c5a6 commit eb0a0da
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 32 deletions.
58 changes: 28 additions & 30 deletions client/src/partials/suppliers/suppliers.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@
<li class="static">{{ "TREE.ADMIN" | translate }}</li>
<li class="active">{{ "SUPPLIER.TITLE" | translate }}</li>
</ol>
</div>
</div>

<!-- Links to the Supplier Chart as well as the button for adding an supplier -->
<div class="flex-util">
<button ng-click="SupplierCtrl.create()" class="btn btn-default btn-sm" data-method="create">
<span class="glyphicon glyphicon-user"></span> {{ "SUPPLIER.ADD_SUPPLIER" | translate }}
</button>
<div class="toolbar">
<div class="toolbar-item">
<button ng-click="SupplierCtrl.create()" class="btn btn-default" data-method="create">
<i class="fa fa-plus"></i> {{ "SUPPLIER.ADD_SUPPLIER" | translate }}
</button>
</div>
</div>
</div>
</div>

<div class="flex-content">
<div class="container-fluid">
<div class="row">
<!-- Complete list of registred Supplier -->

<!-- Complete list of registered Supplier -->
<div class="col-xs-6">
<div class="panel panel-default" style="overflow: auto; max-height: 500px;">
<div class="panel-heading">
Expand All @@ -27,7 +29,6 @@
<table class="table table-condensed">
<thead>
<tr>
<th>{{ "TABLE.COLUMNS.NR" | translate }}</th>
<th>{{ "TABLE.COLUMNS.NAME" | translate }}</th>
<th>{{ "TABLE.COLUMNS.PHONE" | translate }}</th>
<th><span class="glyphicon glyphicon-lock"></span></th>
Expand All @@ -36,15 +37,12 @@
</thead>
<tbody>
<tr ng-if="SupplierCtrl.session.loading" class="text-center">
<td colspan="5"><loading-indicator></loading-indicator></td>
<td colspan="4"><loading-indicator></loading-indicator></td>
</tr>
<tr
ng-repeat="supplier in SupplierCtrl.suppliers | orderBy:'display_name' "
ng-class="{'rowSelected' : SupplierCtrl.supplier.uuid === supplier.uuid}" >
<td>{{ $index+1 }}</td>
<tr ng-repeat="supplier in SupplierCtrl.suppliers | orderBy:'display_name'">
<td>{{ supplier.display_name }}</td>
<td>{{ supplier.phone }}</td>
<td><i class="glyphicon glyphicon-ok" ng-if="supplier.locked"></td>
<td>{{ supplier.phone | telephone }}</td>
<td><i class="fa fa-check" ng-show="supplier.locked"></i></td>
<td><a class="btn btn-xs btn-default" id="supplier-upd-{{$index+1}}" ng-click="SupplierCtrl.update(supplier)"><span class="glyphicon glyphicon-pencil"></span></a></td>
</tr>
<tr ng-if="!SupplierCtrl.suppliers.length">
Expand Down Expand Up @@ -91,18 +89,18 @@ <h4>{{ "FORM.INFO.UPDATE_SUCCESS" | translate }} </h4>
</div>
</div>

<div class="form-group" ng-class="{ 'has-error' : CreateForm.$submitted && CreateForm.international.$invalid }">
<label class="control-label">
<input type="checkbox" name="international" id="international" ng-true-value="1" ng-false-value="0"
ng-model="SupplierCtrl.supplier.international"> {{ "FORM.LABELS.INTL" | translate }}
<div class="checkbox">
<label>
<input type="checkbox" name="international" ng-true-value="1" ng-false-value="0" ng-model="SupplierCtrl.supplier.international">
{{ "FORM.LABELS.INTL" | translate }}
</label>
</div>

<hr>

<div class="form-group" ng-class="{ 'has-error' : CreateForm.$submitted && CreateForm.creditor_uuid.$invalid }">
<label class="control-label">{{ "FORM.LABELS.GROUP" | translate }}</label>
<select class="form-control" name="creditor_uuid" ng-model="SupplierCtrl.supplier.creditor_uuid" id="creditor_uuid" ng-options="creditor.uuid as creditor.text for creditor in SupplierCtrl.creditors | orderBy:'name'" required>
<select class="form-control" name="creditor_uuid" ng-model="SupplierCtrl.supplier.creditor_uuid" ng-options="creditor.uuid as creditor.text for creditor in SupplierCtrl.creditors | orderBy:'name'" required>
<option value="" disabled> -- {{ "FORM.SELECT.CREDITOR" | translate }} -- </option>
</select>
<div class="help-block" ng-messages="CreateForm.creditor_uuid.$error" ng-show="CreateForm.$submitted">
Expand Down Expand Up @@ -130,10 +128,10 @@ <h4>{{ "FORM.INFO.UPDATE_SUCCESS" | translate }} </h4>
</div>
</div>

<div class="form-group" ng-class="{ 'has-error' : CreateForm.$submitted && CreateForm.locked.$invalid }">
<label class="control-label">
<input type="checkbox" name="locked" id="locked" ng-true-value="1" ng-false-value="0"
ng-model="SupplierCtrl.supplier.locked"> {{ "FORM.LABELS.LOCKED" | translate }}
<div class="checkbox">
<label>
<input type="checkbox" name="locked" ng-true-value="1" ng-false-value="0" ng-model="SupplierCtrl.supplier.locked">
{{ "FORM.LABELS.LOCKED" | translate }}
</label>
</div>

Expand All @@ -153,7 +151,7 @@ <h3> {{ "FORM.LABELS.OPTIONAL_INFO" | translate }} </h3>

<div class="form-group" ng-class="{ 'has-error' : CreateForm.$submitted && CreateForm.note.$invalid }">
<label class="control-label" for="note">{{ "FORM.LABELS.NOTES" | translate }}</label>
<textarea class="form-control" name="note" id="note" ng-maxlength="SupplierCtrl.maxLength" ng-model="SupplierCtrl.supplier.note" rows="3"></textarea>
<textarea class="form-control" name="note" ng-maxlength="SupplierCtrl.maxLength" ng-model="SupplierCtrl.supplier.note" rows="3"></textarea>
<div class="help-block" ng-messages="CreateForm.note.$error" ng-show="CreateForm.$submitted">
<div ng-messages-include="partials/templates/messages.tmpl.html"></div>
</div>
Expand Down Expand Up @@ -193,7 +191,7 @@ <h3> {{ "FORM.LABELS.OPTIONAL_INFO" | translate }} </h3>

<div class="form-group" ng-class="{ 'has-error' : UpdateForm.$submitted && UpdateForm.international.$invalid }">
<label class="control-label">
<input type="checkbox" name="international" id="international" ng-true-value="1" ng-false-value="0"
<input type="checkbox" name="international" ng-true-value="1" ng-false-value="0"
ng-model="SupplierCtrl.supplier.international"> {{ "FORM.LABELS.INTL" | translate }}
</label>
</div>
Expand All @@ -202,7 +200,7 @@ <h3> {{ "FORM.LABELS.OPTIONAL_INFO" | translate }} </h3>

<div class="form-group" ng-class="{ 'has-error' : UpdateForm.$submitted && UpdateForm.creditor_uuid.$invalid }">
<label class="control-label">{{ "FORM.LABELS.GROUP" | translate }}</label>
<select class="form-control" name="creditor_uuid" ng-model="SupplierCtrl.supplier.creditor_uuid" id="creditor_uuid" ng-options="creditor.uuid as creditor.text for creditor in SupplierCtrl.creditors | orderBy:'name'" required>
<select class="form-control" name="creditor_uuid" ng-model="SupplierCtrl.supplier.creditor_uuid" ng-options="creditor.uuid as creditor.text for creditor in SupplierCtrl.creditors | orderBy:'name'" required>
<option value="" disabled> -- {{ "FORM.SELECT.CREDITOR" | translate }} -- </option>
</select>
<div class="help-block" ng-messages="UpdateForm.creditor_uuid.$error" ng-show="UpdateForm.$submitted">
Expand Down Expand Up @@ -232,7 +230,7 @@ <h3> {{ "FORM.LABELS.OPTIONAL_INFO" | translate }} </h3>

<div class="form-group" ng-class="{ 'has-error' : UpdateForm.$submitted && UpdateForm.locked.$invalid }">
<label class="control-label">
<input type="checkbox" name="locked" id="locked" ng-true-value="1" ng-false-value="0"
<input type="checkbox" name="locked" ng-true-value="1" ng-false-value="0"
ng-model="SupplierCtrl.supplier.locked"> {{ "FORM.LABELS.LOCKED" | translate }}
</label>
</div>
Expand All @@ -253,7 +251,7 @@ <h3> {{ "FORM.LABELS.OPTIONAL_INFO" | translate }} </h3>

<div class="form-group" ng-class="{ 'has-error' : UpdateForm.$submitted && UpdateForm.note.$invalid }">
<label class="control-label" for="note">{{ "FORM.LABELS.NOTES" | translate }}</label>
<textarea class="form-control" name="note" id="note" ng-maxlength="SupplierCtrl.maxLength" ng-model="SupplierCtrl.supplier.note" rows="3"></textarea>
<textarea class="form-control" name="note" ng-maxlength="SupplierCtrl.maxLength" ng-model="SupplierCtrl.supplier.note" rows="3"></textarea>
<div class="help-block" ng-messages="UpdateForm.note.$error" ng-show="UpdateForm.$submitted">
<div ng-messages-include="partials/templates/messages.tmpl.html"></div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions test/end-to-end/suppliers/suppliers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Suppliers', function () {

FU.input('SupplierCtrl.supplier.display_name', supplier.display_name);

element(by.id('international')).click();
element(by.model('SupplierCtrl.supplier.international')).click();

// select an Creditor
FU.select('SupplierCtrl.supplier.creditor_uuid', 'Fournisseur');
Expand Down Expand Up @@ -73,7 +73,6 @@ describe('Suppliers', function () {
FU.validation.error('SupplierCtrl.supplier.address_1');

// the following fields are not required
FU.validation.ok('SupplierCtrl.supplier.international');
FU.validation.ok('SupplierCtrl.supplier.phone');
FU.validation.ok('SupplierCtrl.supplier.email');
FU.validation.ok('SupplierCtrl.supplier.locked');
Expand Down

0 comments on commit eb0a0da

Please sign in to comment.