Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(depots): add loading icon for depot select #5705

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/src/js/components/bhDepotSelect/bhDepotSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ function DepotSelectController(Depots, Notify) {
return null;
}

$ctrl.$loading = true;

const options = {
text : (text || '').toLowerCase(),
exception : $ctrl.exception,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div ng-form="DepotForm" bh-depot-select ng-model-options="{ updateOn: 'default' }">
<div
class="form-group"
class="form-group has-feedback"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? it seems like we have some forms that use the $loading flag that do not use it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, to show the icon on the input, the has-feedback class does the magic.

ng-class="{ 'has-error' : DepotForm.$submitted && DepotForm.depot_uuid.$invalid }">

<label class="control-label" translate>
Expand All @@ -16,14 +16,16 @@
name="depot_uuid"
ng-model="$ctrl.depotText"
uib-typeahead="depot for depot in $ctrl.searchByName($viewValue)"
typeahead-loading="$ctrl.loading"
typeahead-loading="$ctrl.$loading"
typeahead-template-url="/modules/templates/depotList.tmpl.html"
typeahead-on-select="$ctrl.onSelect($item, $model)"
typeahead-min-length="0"
autocomplete="off"
translate-attr="{ 'placeholder': 'FORM.SELECT.DEPOT' }"
ng-required="$ctrl.required">

<span ng-show="$ctrl.$loading" class="glyphicon glyphicon-hourglass form-control-feedback"></span>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glyphicon 😄 ça fait très longtemps. 👍🏽


<div class="help-block" ng-messages="DepotForm.depot_uuid.$error" ng-show="DepotForm.$submitted">
<div ng-messages-include="modules/templates/messages.tmpl.html"></div>
</div>
Expand Down
2 changes: 0 additions & 2 deletions client/src/modules/stock/requisition/modals/action.modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,12 @@
required="true"
exception="$ctrl.model.requestor_uuid"
on-select-callback="$ctrl.onSelectDepot(depot)">
<bh-clear on-clear="$ctrl.clear('depot_uuid')"></bh-clear>
</bh-depot-select>
</div>

<!-- note -->
<div class="form-group">
<label class="control-label" translate>FORM.LABELS.NOTE</label>
<bh-clear on-clear="$ctrl.clear('description')"></bh-clear>
<textarea ng-model="$ctrl.model.description" class="form-control" name="description" id="description"></textarea>
</div>
</div>
Expand Down