Commit bdb6d975 authored by Tuan Tuan LE's avatar Tuan Tuan LE
Browse files

POC create proposal

parent 1e4156aa
@import './sidebar/most-sidebar';
@import './proposal/most-proposal';
.most-root {
& > .col-md-3, & > .col-md-8 {
margin-top: 45px;
}
}
......@@ -25,6 +25,14 @@
template: '<most-proposal />'
}
}
})
.state('most.proposal.create', {
url: '/proposal/create',
views: {
'root@most': {
template: '<most-proposal-create />'
}
}
});
});
})();
(function(angular) {
'use strict';
angular.module('linagora.esn.most')
.component('mostProposalCreate', {
templateUrl: '/linagora.esn.most/app/proposal/create/most-proposal-create.html',
controller: 'MostProposalCreateController'
});
})(angular);
(function(angular) {
'use strict';
angular.module('linagora.esn.most')
.controller('MostProposalCreateController', MostProposalCreateController);
function MostProposalCreateController(
$state,
asyncAction,
mostProposalApiClient
) {
var self = this;
var AVAILABLE_PROPOSAL_TYPES = [{
value: 'A1',
label: 'Mẫu A1-ĐXNV'
}, {
value: 'A2',
label: 'Mẫu A2-ĐXNV'
}, {
value: 'A3',
label: 'Mẫu A3-ĐXNV'
}];
var CREATING_NOTIFICATION_MESSAGE = {
progressing: 'Đang tạo đề xuất...',
success: 'Đã tạo đề xuất',
failure: 'Tạo đề xuất thất bại'
};
self.$onInit = $onInit;
self.onSubmitBtnClick = onSubmitBtnClick;
function $onInit() {
self.proposalTypes = AVAILABLE_PROPOSAL_TYPES;
self.proposal = {
type: AVAILABLE_PROPOSAL_TYPES[0].value,
formData: {}
};
}
function onSubmitBtnClick() {
var proposalToCreate = {
type: self.proposal.type,
formData: JSON.stringify(self.proposal.formData)
};
return asyncAction(CREATING_NOTIFICATION_MESSAGE, function() {
return mostProposalApiClient.createProposal(proposalToCreate)
.then(function() {
$state.go('most.proposal');
});
});
}
}
})(angular);
most-proposal-create {
.card-body form {
padding: 20px;
.proposal-type {
margin-left: 20px;
width: 150px;
}
}
}
sub-header
most-proposal-create-subheader
.card
.card-body
form(name="form")
.flex.flex-vertical-centered
h4 Chọn mẫu
.select.proposal-type
select.form-control(
ng-model="$ctrl.proposal.type",
name="proposalType",
ng-options="proposalType.value as proposalType.label for proposalType in $ctrl.proposalTypes",
required
)
hr
.row(ng-switch="$ctrl.proposal.type")
most-proposal-form-a1(ng-switch-when="A1", data="$ctrl.proposal.formData")
most-proposal-form-a2(ng-switch-when="A2", data="$ctrl.proposal.formData")
most-proposal-form-a3(ng-switch-when="A3", data="$ctrl.proposal.formData")
.row
button.btn.btn-primary(
ng-click="$ctrl.onSubmitBtnClick()",
ng-disabled="form.$invalid"
)
| #{__('Gửi')}
(function(angular) {
'use strict';
angular.module('linagora.esn.most')
.component('mostProposalCreateSubheader', {
templateUrl: '/linagora.esn.most/app/proposal/create/subheader/most-proposal-list-subheader.html'
});
})(angular);
extends /modules/subheader/responsive-subheader.pug
block left
most-subheader-burger-button.hidden-md
i.mdi.mdi-menu
span.title.ellipsis #{__('Tạo đề xuất')}
h1 List proposals page
fab(icon="plus", ui-sref="most.proposal.create")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment