b68c3d0c81
When a vendor or product is successfully created, a 'success' message is given to the user. Also, input fields for product/vendor creation now are only cleared on success. Change-Id: I82a97061114bbc3d342368a74aa9ebc9463a31d0
86 lines
3.5 KiB
HTML
86 lines
3.5 KiB
HTML
<h3>{{ctrl.pageHeader}}</h3>
|
|
<p>{{ctrl.pageParagraph}}</p>
|
|
|
|
<div ng-show="ctrl.data" class="products-table">
|
|
<label ng-if="ctrl.isAdminView && ctrl.isUserProducts">
|
|
<input type="checkbox" ng-model="ctrl.withPrivate" ng-change="ctrl.updateData();"> Show private
|
|
</label>
|
|
<br />
|
|
<table ng-show="ctrl.data" class="table table-striped table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Product Type</th>
|
|
<th>Description</th>
|
|
<th>Vendor</th>
|
|
<th>Visibility</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<tr ng-repeat="product in ctrl.data.products">
|
|
<td ng-if="ctrl.isUserProducts && product.product_type == 0"><a ui-sref="distro({id: product.id})">{{product.name}}</a></td>
|
|
<td ng-if="ctrl.isUserProducts && product.product_type != 0"><a ui-sref="cloud({id: product.id})">{{product.name}}</a></td>
|
|
<td ng-if="!ctrl.isUserProducts">{{product.name}}</td>
|
|
<td>{{ctrl.getProductTypeDescription(product.product_type)}}</td>
|
|
<td>{{product.description}}</td>
|
|
<td>{{ctrl.allVendors[product.organization_id].name}}</td>
|
|
<td>{{product.public ? 'Public' : 'Private'}}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div ng-if="ctrl.isUserProducts">
|
|
<hr />
|
|
<h4>Add New Product</h4>
|
|
<div class="row">
|
|
<div class="col-md-2">
|
|
<label>Name</label>
|
|
<p class="input-group">
|
|
<input type="text" class="form-control" ng-model="ctrl.name" />
|
|
</p>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label>Description</label>
|
|
<p class="input-group">
|
|
<input type="text" class="form-control" size="80"
|
|
ng-model="ctrl.description" />
|
|
</p>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<label>Product type:</label>
|
|
<select ng-model="ctrl.productType" class="form-control">
|
|
<option value="{{0}}">{{ctrl.getProductTypeDescription(0)}}</option>
|
|
<option value="{{1}}">{{ctrl.getProductTypeDescription(1)}}</option>
|
|
<option value="{{2}}">{{ctrl.getProductTypeDescription(2)}}</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<label>Vendor:</label>
|
|
<select ng-model="ctrl.organizationId" class="form-control">
|
|
<option ng-repeat="vendor in ctrl.vendors" value="{{vendor.id}}">{{vendor.name}}</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-2" style="margin-top:24px;">
|
|
<button type="submit" class="btn btn-primary" ng-click="ctrl.addProduct()">Add Product</button>
|
|
</div>
|
|
</div>
|
|
<div ng-show="ctrl.showSuccess" class="alert alert-success" role="success">
|
|
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
|
|
<span class="sr-only">Success:</span>
|
|
Product successfully created.
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
|
|
<div cg-busy="{promise:ctrl.authRequest,message:'Loading'}"></div>
|
|
<div cg-busy="{promise:ctrl.productsRequest,message:'Loading'}"></div>
|
|
<div cg-busy="{promise:ctrl.vendorsRequest,message:'Loading'}"></div>
|
|
|
|
<div ng-show="ctrl.showError" class="alert alert-danger" role="alert">
|
|
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
|
|
<span class="sr-only">Error:</span>
|
|
{{ctrl.error}}
|
|
</div>
|