Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Sang D NGO
linagora.esn.most
Commits
b4fa5b7d
Commit
b4fa5b7d
authored
Apr 16, 2018
by
Sang D NGO
Browse files
Merge branch 'POC' into 'master'
POC create review See merge request
!16
parents
3a89e698
4dc8285a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
153 additions
and
14 deletions
+153
-14
backend/lib/db/review.js
backend/lib/db/review.js
+0
-1
backend/lib/review/index.js
backend/lib/review/index.js
+4
-2
frontend/app/proposal/detail/experts/modal.pug
frontend/app/proposal/detail/experts/modal.pug
+1
-1
frontend/app/proposal/detail/experts/most-proposal-detail-experts.controller.js
...detail/experts/most-proposal-detail-experts.controller.js
+2
-2
frontend/app/proposal/detail/most-proposal-detail.controller.js
...nd/app/proposal/detail/most-proposal-detail.controller.js
+19
-5
frontend/app/proposal/detail/most-proposal-detail.pug
frontend/app/proposal/detail/most-proposal-detail.pug
+3
-2
frontend/app/proposal/detail/subheader/most-proposal-detail-subheader.component.js
...ail/subheader/most-proposal-detail-subheader.component.js
+1
-0
frontend/app/proposal/detail/subheader/most-proposal-detail-subheader.pug
...posal/detail/subheader/most-proposal-detail-subheader.pug
+3
-1
frontend/app/review/create/most-review-create.controller.js
frontend/app/review/create/most-review-create.controller.js
+82
-0
frontend/app/review/create/most-review-create.pug
frontend/app/review/create/most-review-create.pug
+38
-0
No files found.
backend/lib/db/review.js
View file @
b4fa5b7d
...
...
@@ -13,7 +13,6 @@ module.exports = function(dependencies) {
const
schema
=
new
Schema
({
creator
:
{
type
:
ObjectId
,
ref
:
'
User
'
,
index
:
true
,
required
:
true
},
proposal
:
{
type
:
ObjectId
,
ref
:
'
MostProposal
'
,
required
:
true
},
status
:
{
type
:
String
,
enum
:
[
'
ACCEPTED
'
,
'
REJECTED
'
],
required
:
true
},
attachments
:
{
type
:
[
AttachmentSchema
],
required
:
false
}
},
{
timestamps
:
true
});
...
...
backend/lib/review/index.js
View file @
b4fa5b7d
...
...
@@ -14,8 +14,10 @@ module.exports = function(dependencies) {
updateById
};
function
create
(
proposal
)
{
return
Review
.
create
(
proposal
);
function
create
(
review
)
{
review
=
review
instanceof
Review
?
review
:
new
Review
(
review
);
return
Review
.
create
(
review
);
}
function
getById
(
id
)
{
...
...
frontend/app/proposal/detail/
review
/modal.pug
→
frontend/app/proposal/detail/
experts
/modal.pug
View file @
b4fa5b7d
...
...
@@ -5,7 +5,7 @@
.modal-header
button.close(type="button", data-dismiss="modal", aria-label="Close", ng-click="$hide()")
span(aria-hidden="true") ×
h4.modal-title #{__('
Lấy ý kiến
chuyên gia')}
h4.modal-title #{__('
Thiết lập
chuyên gia')}
.modal-body
p
| #{__('Chọn một nhóm chuyên gia:')}
...
...
frontend/app/proposal/detail/
review
/most-proposal-detail-
review
.controller.js
→
frontend/app/proposal/detail/
experts
/most-proposal-detail-
experts
.controller.js
View file @
b4fa5b7d
...
...
@@ -2,9 +2,9 @@
'
use strict
'
;
angular
.
module
(
'
linagora.esn.most
'
)
.
controller
(
'
MostProposalDetail
Review
Controller
'
,
MostProposalDetail
Review
Controller
);
.
controller
(
'
MostProposalDetail
Experts
Controller
'
,
MostProposalDetail
Experts
Controller
);
function
MostProposalDetail
Review
Controller
(
function
MostProposalDetail
Experts
Controller
(
$state
,
$stateParams
,
$modal
,
...
...
frontend/app/proposal/detail/most-proposal-detail.controller.js
View file @
b4fa5b7d
...
...
@@ -6,8 +6,8 @@
function
MostProposalDetailController
(
$state
,
$stateParams
,
$modal
,
$stateParams
,
session
,
mostProposalApiClient
)
{
...
...
@@ -15,8 +15,9 @@
self
.
$onInit
=
$onInit
;
self
.
onRejectBtnClick
=
onRejectBtnClick
;
self
.
on
Review
BtnClick
=
on
Review
BtnClick
;
self
.
on
SetExperts
BtnClick
=
on
SetExperts
BtnClick
;
self
.
onAcceptBtnClick
=
onAcceptBtnClick
;
self
.
onReviewBtnClick
=
onReviewBtnClick
;
function
$onInit
()
{
self
.
showAction
=
session
.
userIsDomainAdministrator
();
...
...
@@ -33,13 +34,13 @@
});
}
function
on
Review
BtnClick
()
{
function
on
SetExperts
BtnClick
()
{
$modal
({
templateUrl
:
'
/linagora.esn.most/app/proposal/detail/
review
/modal.html
'
,
templateUrl
:
'
/linagora.esn.most/app/proposal/detail/
experts
/modal.html
'
,
backdrop
:
'
static
'
,
placement
:
'
center
'
,
controllerAs
:
'
$ctrl
'
,
controller
:
'
MostProposalDetail
Review
Controller
'
,
controller
:
'
MostProposalDetail
Experts
Controller
'
,
locals
:
{
proposal
:
self
.
proposal
}
...
...
@@ -52,5 +53,18 @@
$state
.
go
(
'
most.proposal
'
);
});
}
function
onReviewBtnClick
()
{
$modal
({
templateUrl
:
'
/linagora.esn.most/app/review/create/most-review-create.html
'
,
backdrop
:
'
static
'
,
placement
:
'
center
'
,
controllerAs
:
'
$ctrl
'
,
controller
:
'
MostReviewCreateController
'
,
locals
:
{
proposal
:
self
.
proposal
}
});
}
}
})(
angular
);
frontend/app/proposal/detail/most-proposal-detail.pug
View file @
b4fa5b7d
...
...
@@ -3,8 +3,9 @@ sub-header
data-title="$ctrl.proposal.formJson.title",
show-action="$ctrl.showAction",
on-reject-btn-click="$ctrl.onRejectBtnClick()",
on-review-btn-click="$ctrl.onReviewBtnClick()",
on-accept-btn-click="$ctrl.onAcceptBtnClick()"
on-set-experts-btn-click="$ctrl.onSetExpertsBtnClick()",
on-accept-btn-click="$ctrl.onAcceptBtnClick()",
on-review-btn-click="$ctrl.onReviewBtnClick()"
)
.card
.card-body.p-20
...
...
frontend/app/proposal/detail/subheader/most-proposal-detail-subheader.component.js
View file @
b4fa5b7d
...
...
@@ -10,6 +10,7 @@
showAction
:
'
<
'
,
onRejectBtnClick
:
'
&
'
,
onReviewBtnClick
:
'
&
'
,
onSetExpertsBtnClick
:
'
&
'
,
onAcceptBtnClick
:
'
&
'
}
});
...
...
frontend/app/proposal/detail/subheader/most-proposal-detail-subheader.pug
View file @
b4fa5b7d
...
...
@@ -13,7 +13,9 @@ block right
li
a(href='', ng-click='$ctrl.onRejectBtnClick()') Từ chối
li
a(href='', ng-click='$ctrl.on
Review
BtnClick()')
Xem xét
a(href='', ng-click='$ctrl.on
SetExperts
BtnClick()')
Thiết lập chuyên gia
li
a(href='', ng-click='$ctrl.onAcceptBtnClick()') Duyệt
li
a(href='', ng-click="$ctrl.onReviewBtnClick()") Nhận xét và đánh giá
frontend/app/review/create/most-review-create.controller.js
0 → 100644
View file @
b4fa5b7d
(
function
(
angular
)
{
'
use strict
'
;
angular
.
module
(
'
linagora.esn.most
'
)
.
controller
(
'
MostReviewCreateController
'
,
MostReviewCreateController
);
function
MostReviewCreateController
(
_
,
fileUploadService
,
mostReviewApiClient
,
proposal
)
{
var
self
=
this
;
init
();
self
.
onAttachmentsSelect
=
onAttachmentsSelect
;
self
.
onSubmitBtnClick
=
onSubmitBtnClick
;
function
init
()
{
self
.
proposal
=
proposal
;
self
.
attachments
=
[];
self
.
review
=
{
attachments
:
[],
proposal
:
proposal
.
id
};
}
function
onSubmitBtnClick
()
{
var
reviewToCreate
=
{
proposal
:
self
.
proposal
.
id
,
attachments
:
self
.
attachments
.
map
(
function
(
attachment
)
{
return
{
_id
:
attachment
.
_id
,
name
:
attachment
.
name
,
contentType
:
attachment
.
type
,
length
:
attachment
.
size
};
})
};
return
mostReviewApiClient
.
createReview
(
reviewToCreate
);
}
function
onAttachmentsSelect
(
$attachments
)
{
$attachments
.
forEach
(
function
(
file
)
{
self
.
attachments
.
push
(
file
);
_upload
(
file
);
});
}
function
_upload
(
attachment
)
{
var
uploader
=
fileUploadService
.
get
();
var
uploadTask
=
uploader
.
addFile
(
attachment
);
// Do not start the upload immediately
attachment
.
status
=
'
uploading
'
;
attachment
.
upload
=
{
progress
:
0
,
cancel
:
uploadTask
.
cancel
};
attachment
.
upload
.
promise
=
uploadTask
.
defer
.
promise
.
then
(
function
(
task
)
{
attachment
.
status
=
'
uploaded
'
;
attachment
.
blobId
=
task
.
response
.
blobId
;
attachment
.
_id
=
task
.
response
.
data
.
_id
;
},
function
()
{
attachment
.
status
=
'
error
'
;
},
function
(
uploadTask
)
{
attachment
.
upload
.
progress
=
uploadTask
.
progress
;
}).
finally
(
_updateAttachmentStatus
);
_updateAttachmentStatus
();
uploader
.
start
();
// Start transferring data
}
function
_updateAttachmentStatus
()
{
self
.
attachmentStatus
=
{
number
:
self
.
attachments
.
length
,
uploading
:
_
.
some
(
self
.
attachments
,
{
status
:
'
uploading
'
}),
error
:
_
.
some
(
self
.
attachments
,
{
status
:
'
error
'
})
};
}
}
})(
angular
);
frontend/app/review/create/most-review-create.pug
0 → 100644
View file @
b4fa5b7d
.modal.full-screen(tabindex="-1", role="dialog")
form(name="form", esn-submit="$hide(); $ctrl.onSubmitBtnClick()")
.modal-dialog
.modal-content
.modal-header
button.close(type="button", ng-click="$hide()") ×
h4.modal-title Nhận xét và đánh giá đề xuất
.modal-body.p-t-20
.flex
p.m-r-10 Tải lên file nhận xét:
input(
name="myFile",
type="file",
ng-file-select="$ctrl.onAttachmentsSelect($files)",
required
)
div(ng-switch="$ctrl.proposal.type")
.flex(ng-switch-when="A1")
p.m-r-20
label.m-r-10 Mẫu B1-TVHĐ:
| Đề tài/Dự án SXTN
a(href='') Tải về
.flex.flex-space-between(ng-switch-when="A2")
p
label.m-r-10 Mẫu B2-TVHĐ:
| Đề án khoa học
a(href='') Tải về
.flex.flex-space-between(ng-switch-when="A3")
p
label.m-r-10 Mẫu B3-TVHĐ:
| Dự án khoa học và công nghệ
a(href='') Tải về
.modal-footer
button.btn.btn-default(type="button", ng-click="$hide()") Hủy
button.btn.btn-primary(
type="submit",
ng-disabled="form.$invalid || $ctrl.attachmentStatus.error || $ctrl.attachmentStatus.uploading"
) Gửi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment