Skip to content

Commit da80c66

Browse files
committed
#94: tenant pages completed.
1 parent 31719fd commit da80c66

File tree

13 files changed

+290
-71
lines changed

13 files changed

+290
-71
lines changed

src/AbpCompanyName.AbpProjectName.WebMpa/Views/Tenants/Index.cshtml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,30 @@
3131
<div class="body table-responsive">
3232
<table class="table">
3333
<thead>
34-
<tr>
35-
<th>@L("TenancyName")</th>
36-
<th>@L("Name")</th>
37-
<th>@L("IsActive")</th>
38-
</tr>
39-
</thead>
40-
<tbody>
41-
@foreach (var tenant in Model.Items)
42-
{
4334
<tr>
44-
<td>@tenant.TenancyName</td>
45-
<td>@tenant.Name</td>
46-
<td><i class="material-icons" style="color:@(tenant.IsActive ? "green":"red");">@(tenant.IsActive ? "check_box" : "indeterminate_check_box")</i></td>
47-
<td class="dropdown">
48-
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
49-
<i class="material-icons">menu</i>
50-
</a>
51-
<ul class="dropdown-menu pull-right">
52-
<li><a href="#" class="waves-effect waves-block edit-tenant" data-tenant-id="@tenant.Id" data-toggle="modal" data-target="#TenantEditModal"><i class="material-icons">edit</i>@L("Edit")</a></li>
53-
<li><a href="#" class="waves-effect waves-block delete-tenant" data-tenant-id="@tenant.Id" data-tenancy-name="@tenant.TenancyName"><i class="material-icons">delete_sweep</i>@L("Delete")</a></li>
54-
</ul>
55-
</td>
35+
<th>@L("TenancyName")</th>
36+
<th>@L("Name")</th>
37+
<th>@L("IsActive")</th>
5638
</tr>
57-
}
39+
</thead>
40+
<tbody>
41+
@foreach (var tenant in Model.Items)
42+
{
43+
<tr>
44+
<td>@tenant.TenancyName</td>
45+
<td>@tenant.Name</td>
46+
<td><i class="material-icons" style="color:@(tenant.IsActive ? "green":"red");">@(tenant.IsActive ? "check_box" : "indeterminate_check_box")</i></td>
47+
<td class="dropdown">
48+
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
49+
<i class="material-icons">menu</i>
50+
</a>
51+
<ul class="dropdown-menu pull-right">
52+
<li><a href="#" class="waves-effect waves-block edit-tenant" data-tenant-id="@tenant.Id" data-toggle="modal" data-target="#TenantEditModal"><i class="material-icons">edit</i>@L("Edit")</a></li>
53+
<li><a href="#" class="waves-effect waves-block delete-tenant" data-tenant-id="@tenant.Id" data-tenancy-name="@tenant.TenancyName"><i class="material-icons">delete_sweep</i>@L("Delete")</a></li>
54+
</ul>
55+
</td>
56+
</tr>
57+
}
5858
</tbody>
5959
</table>
6060
<button type="button" class="btn btn-primary btn-circle waves-effect waves-circle waves-float pull-right" data-toggle="modal" data-target="#TenantCreateModal">

src/AbpCompanyName.AbpProjectName.WebSpaAngular/AbpCompanyName.AbpProjectName.WebSpaAngular.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@
356356
<Content Include="App\Main\views\layout\sidebar-nav.js" />
357357
<Content Include="App\Main\views\layout\sidebar-user-area.js" />
358358
<Content Include="App\Main\views\layout\topbar.js" />
359+
<Content Include="App\Main\views\tenants\editModal.js" />
359360
<Content Include="App\Main\views\users\createModal.js" />
360361
<Content Include="App\Main\views\users\index.js" />
361362
<Content Include="App\Main\views\tenants\createModal.js" />
@@ -2747,6 +2748,11 @@
27472748
<Content Include="App\Main\views\layout\sidebar-nav.cshtml" />
27482749
<Content Include="App\Main\views\layout\sidebar-footer.cshtml" />
27492750
<Content Include="App\Main\views\layout\right-sidebar.cshtml" />
2751+
<Content Include="App\Main\views\tenants\editModal.cshtml" />
2752+
<None Include="compilerconfig.json" />
2753+
<None Include="compilerconfig.json.defaults">
2754+
<DependentUpon>compilerconfig.json</DependentUpon>
2755+
</None>
27502756
<None Include="Scripts\jquery-2.1.4.intellisense.js" />
27512757
<None Include="Scripts\jquery-2.2.0-vsdoc.js" />
27522758
<Content Include="Scripts\i18n\angular-locale_af-na.js" />

src/AbpCompanyName.AbpProjectName.WebSpaAngular/App/Main/main.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
/* Application specific styles */
2-
body {
3-
padding-top: 80px;
4-
}
52
/* Styles for angular ui transition animations */
63
.angular-animation-container {
74
position: relative;
@@ -33,4 +30,4 @@ body {
3330
.shuffle-animation.ng-leave.ng-leave-active {
3431
left: 2em;
3532
opacity: 0;
36-
}
33+
}

src/AbpCompanyName.AbpProjectName.WebSpaAngular/App/Main/main.less

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
/* Application specific styles */
22

3-
body {
4-
padding-top: 80px;
5-
}
6-
73
/* Styles for angular ui transition animations */
84

95
.angular-animation-container {

src/AbpCompanyName.AbpProjectName.WebSpaAngular/App/Main/main.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,53 @@
1-
@using Abp.MultiTenancy
2-
@using AbpCompanyName.AbpProjectName.MultiTenancy
3-
<div>
4-
<form name="tenantCreateForm" role="form" novalidate class="form-validation">
1+
<div>
2+
<form name="tenantCreateForm" novalidate>
3+
54
<div class="modal-header">
5+
<button type="button" class="close" aria-label="Close">
6+
<span aria-hidden="true">&times;</span>
7+
</button>
68
<h4 class="modal-title">
79
<span>@L("CreateNewTenant")</span>
810
</h4>
911
</div>
10-
<div class="modal-body">
1112

12-
<div class="form-group">
13-
<label>@L("TenancyName")</label>
14-
<input auto-focus class="form-control" type="text" name="TenancyName" ng-model="vm.tenant.tenancyName" required maxlength="@Tenant.MaxTenancyNameLength" ng-pattern="/@Tenant.TenancyNameRegex/">
13+
<div class="modal-body">
14+
<div class="form-group form-float">
15+
<div class="form-line">
16+
<input class="form-control" type="text" name="TenancyName" ng-model="vm.tenant.tenancyName" required maxlength="64" minlength="2">
17+
<label class="form-label">@L("TenancyName")</label>
18+
</div>
1519
</div>
16-
<div>
17-
<span class="help-block text-danger" ng-show="!tenantCreateForm.TenancyName.$valid && tenantCreateForm.TenancyName.$dirty">@L("TenantName_Regex_Description")</span>
20+
<div class="form-group form-float">
21+
<div class="form-line">
22+
<input type="text" name="Name" class="form-control" ng-model="vm.tenant.name" required maxlength="128">
23+
<label class="form-label">@L("Name")</label>
24+
</div>
1825
</div>
19-
20-
<div class="form-group">
21-
<label>@L("Name")</label>
22-
<input type="text" name="Name" class="form-control" ng-model="vm.tenant.name" required maxlength="@Tenant.MaxNameLength">
26+
<div class="form-group form-float">
27+
<div class="form-line">
28+
<input type="text" name="ConnectionString" class="form-control" ng-model="vm.tenant.connectionString" maxlength="1024">
29+
<label class="form-label">@L("DatabaseConnectionString") (@L("Optional"))</label>
30+
</div>
2331
</div>
24-
25-
<div class="form-group">
26-
<label>@L("DatabaseConnectionString") (@L("Optional"))</label>
27-
<input type="text" name="ConnectionString" class="form-control" ng-model="vm.tenant.connectionString" maxlength="@AbpTenantBase.MaxConnectionStringLength">
32+
<div class="form-group form-float">
33+
<div class="form-line">
34+
<input type="email" name="AdminEmailAddress" class="form-control" ng-model="vm.tenant.adminEmailAddress" required maxlength="256">
35+
<label class="form-label">@L("AdminEmailAddress")</label>
36+
</div>
2837
</div>
29-
30-
<div class="form-group">
31-
<label>@L("AdminEmailAddress")</label>
32-
<input type="email" name="AdminEmailAddress" class="form-control" ng-model="vm.tenant.adminEmailAddress" required maxlength="@AbpCompanyName.AbpProjectName.Authorization.Users.User.MaxEmailAddressLength">
38+
<div class="form-group form-float">
39+
<div class="">
40+
<input id="isactive" type="checkbox" name="IsActive" ng-model="vm.tenant.isActive" checked class="form-control" />
41+
<label for="isactive" class="form-label">@L("IsActive")</label>
42+
</div>
3343
</div>
34-
35-
<p>@L("DefaultPasswordIs", AbpCompanyName.AbpProjectName.Authorization.Users.User.DefaultPassword)</p>
36-
44+
<p>@L("DefaultPasswordIs", "123qwe")</p>
3745
</div>
46+
3847
<div class="modal-footer">
3948
<button type="button" class="btn btn-default" ng-click="vm.cancel()">@L("Cancel")</button>
40-
<button type="submit" class="btn btn-primary blue" ng-click="vm.save()" ng-disabled="tenantCreateForm.$invalid"><i class="fa fa-save"></i> <span>@L("Save")</span></button>
49+
<button type="submit" class="btn btn-primary blue" ng-click="vm.save()" ng-disabled="tenantCreateForm.$invalid">@L("Save")</button>
4150
</div>
51+
4252
</form>
4353
</div>

src/AbpCompanyName.AbpProjectName.WebSpaAngular/App/Main/views/tenants/createModal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
vm.save = function () {
1515
abp.ui.setBusy();
16-
tenantService.createTenant(vm.tenant)
16+
tenantService.create(vm.tenant)
1717
.then(function () {
1818
abp.notify.info(App.localize('SavedSuccessfully'));
1919
$uibModalInstance.close();
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<div>
2+
<form name="tenantCreateForm" novalidate>
3+
4+
<div class="modal-header">
5+
<button type="button" class="close" aria-label="Close">
6+
<span aria-hidden="true">&times;</span>
7+
</button>
8+
<h4 class="modal-title">
9+
<span>@L("CreateNewTenant")</span>
10+
</h4>
11+
</div>
12+
13+
<div class="modal-body">
14+
<div class="form-group form-float">
15+
<div class="form-line">
16+
<input class="form-control" type="text" name="TenancyName" ng-model="vm.tenant.tenancyName" required maxlength="64" minlength="2">
17+
<label class="form-label">@L("TenancyName")</label>
18+
</div>
19+
</div>
20+
<div class="form-group form-float">
21+
<div class="form-line">
22+
<input type="text" name="Name" class="form-control" ng-model="vm.tenant.name" required maxlength="128">
23+
<label class="form-label">@L("Name")</label>
24+
</div>
25+
</div>
26+
<div class="form-group form-float">
27+
<div class="">
28+
<input id="isactive" type="checkbox" name="IsActive" ng-model="vm.tenant.isActive" checked class="form-control" />
29+
<label for="isactive" class="form-label">@L("IsActive")</label>
30+
</div>
31+
</div>
32+
</div>
33+
34+
<div class="modal-footer">
35+
<button type="button" class="btn btn-default" ng-click="vm.cancel()">@L("Cancel")</button>
36+
<button type="submit" class="btn btn-primary blue" ng-click="vm.save()" ng-disabled="tenantCreateForm.$invalid">@L("Save")</button>
37+
</div>
38+
39+
</form>
40+
</div>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
(function () {
2+
angular.module('app').controller('app.views.tenants.editModal', [
3+
'$scope', '$uibModalInstance', 'abp.services.app.tenant', 'id',
4+
function ($scope, $uibModalInstance, tenantService, id) {
5+
var vm = this;
6+
7+
vm.tenant = {};
8+
9+
function init() {
10+
tenantService.get({
11+
id: id
12+
}).then(function (result) {
13+
vm.tenant = result.data;
14+
});
15+
}
16+
17+
init();
18+
19+
vm.save = function () {
20+
abp.ui.setBusy();
21+
tenantService.update(vm.tenant)
22+
.then(function () {
23+
abp.notify.info(App.localize('SavedSuccessfully'));
24+
$uibModalInstance.close();
25+
}).finally(function () {
26+
abp.ui.clearBusy();
27+
});
28+
};
29+
30+
vm.cancel = function () {
31+
$uibModalInstance.dismiss();
32+
};
33+
}
34+
]);
35+
})();
Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,59 @@
1-
<div ng-controller="app.views.tenants.index as vm">
2-
<h1>@L("Tenants")</h1>
3-
<div class="row">
4-
<div class="col-md-12">
5-
<button ng-click="vm.openTenantCreationModal()" class="btn btn-primary pull-right"><i class="fa fa-plus"></i> @L("CreateNewTenant")</button>
6-
<table class="table">
7-
<thead>
1+
<div class="row clearfix" ng-controller="app.views.tenants.index as vm">
2+
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
3+
<div class="card main-content">
4+
<div class="header">
5+
<h2>
6+
@L("Tenants")
7+
</h2>
8+
<ul class="header-dropdown m-r--5">
9+
<i class="fa fa-spin fa-spinner" ng-if="isTableLoading"></i>
10+
<li class="dropdown">
11+
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
12+
<i class="material-icons">more_vert</i>
13+
</a>
14+
<ul class="dropdown-menu pull-right">
15+
<li><a href="javascript:void(0);" class=" waves-effect waves-block()" ng-click="vm.refresh();"><i class="material-icons">refresh</i>Refresh</a></li>
16+
</ul>
17+
</li>
18+
</ul>
19+
</div>
20+
<div class="body table-responsive">
21+
<table class="table table-hover table-striped">
22+
<thead>
823
<tr>
924
<th>@L("TenancyName")</th>
1025
<th>@L("Name")</th>
26+
<th>
27+
<div style="text-align:center">@L("IsActive")</div>
28+
</th>
29+
<th>@L("Actions")</th>
1130
</tr>
12-
</thead>
13-
<tbody>
31+
</thead>
32+
<tbody>
1433
<tr ng-repeat="tenant in vm.tenants">
1534
<td>{{tenant.tenancyName}}</td>
1635
<td>{{tenant.name}}</td>
36+
<td align="center">
37+
<i class="material-icons" ng-if="tenant.isActive" style="color:green;">check_box</i>
38+
<i class="material-icons" ng-if="!tenant.isActive" style="color:red;">indeterminate_check_box</i>
39+
</td>
40+
<td class="dropdown">
41+
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
42+
<i class="material-icons">menu</i>
43+
</a>
44+
<ul class="dropdown-menu pull-right">
45+
<li><a href="javascript:void(0);" class="waves-effect waves-block" ng-click="vm.openTenantEditModal(tenant)"><i class="material-icons">create</i>Edit</a></li>
46+
<li><a href="javascript:void(0);" class="waves-effect waves-block" ng-click="vm.delete(tenant)"><i class="material-icons">delete_sweep</i>Delete</a></li>
47+
</ul>
48+
</td>
1749
</tr>
18-
</tbody>
19-
</table>
50+
</tbody>
51+
</table>
52+
53+
<button type="button" data-toggle="modal" class="btn btn-primary btn-circle waves-effect waves-circle waves-float pull-right" ng-click="vm.openTenantCreationModal()">
54+
<i class="material-icons">add</i>
55+
</button>
56+
</div>
2057
</div>
2158
</div>
2259
</div>

0 commit comments

Comments
 (0)