Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PERFORMA_REPLICA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Usman
PERFORMA_REPLICA
Commits
74d5e962
Commit
74d5e962
authored
Dec 06, 2019
by
Ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CR review by Ali
parent
a92e2ca6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
98 deletions
+43
-98
message-engine-applicant-view.component.ts
...applicant-view/message-engine-applicant-view.component.ts
+43
-98
No files found.
frontend/angular/src/app/components/message-engine-applicant-view/message-engine-applicant-view.component.ts
View file @
74d5e962
...
...
@@ -41,7 +41,7 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
jobApplication
=
new
JobApplicationModel
();
subscriptions
:
Array
<
Subscription
>
=
[];
sentViaEnum
:
Array
<
SentViaEnum
>
;
sentViaEnum
:
Array
<
SentViaEnum
>
=
[]
;
Message
=
new
MessageModel
();
apiUrl
=
environment
.
baseUrl
;
loggedInId
=
null
;
...
...
@@ -69,9 +69,19 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
ngOnInit
():
void
{
this
.
utilsService
.
resetCounter
();
this
.
showLoader
=
true
;
this
.
getSetVias
();
// For Hiring Team or Applicant
const
service
=
this
.
embedded
?
this
.
adminPortalLayoutService
:
this
.
applicantPortalLayoutService
;
if
(
service
.
userData
)
{
this
.
initComponent
(
service
);
}
else
{
this
.
subscriptions
.
push
(
service
.
userDataUpdated
.
first
().
subscribe
(()
=>
{
this
.
initComponent
(
service
);
}));
}
}
getSetVias
()
{
this
.
subscriptions
.
push
(
this
.
appService
.
getTypes
(
'SentVia'
)
.
subscribe
((
data
:
Array
<
SentViaEnum
>
)
=>
{
...
...
@@ -80,58 +90,39 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
({
label
:
elem
.
Description
,
command
:
()
=>
this
.
Message
.
SentVia
=
elem
}));
// For Hiring Team or Applicant
const
service
=
this
.
embedded
?
this
.
adminPortalLayoutService
:
this
.
applicantPortalLayoutService
;
if
(
service
.
userData
)
{
if
(
!
(
service
instanceof
AdminPortalLayoutService
))
{
this
.
jobId
=
service
.
jobId
;
this
.
loggedInId
=
service
.
userData
.
UserID
;
}
else
{
this
.
loggedInId
=
service
.
userData
.
CompanyUser
.
User
;
}
this
.
initComponent
();
}
else
{
this
.
subscriptions
.
push
(
service
.
userDataUpdated
.
first
()
.
subscribe
(()
=>
{
this
.
loggedInId
=
service
.
userData
.
UserID
;
if
(
!
(
service
instanceof
AdminPortalLayoutService
))
{
this
.
jobId
=
service
.
jobId
;
}
this
.
initComponent
();
}));
}
})
);
}
initComponent
():
void
{
initComponent
(
service
):
void
{
if
(
service
instanceof
AdminPortalLayoutService
)
{
this
.
loggedInId
=
service
.
userData
.
CompanyUser
.
User
;
// jobId should come from @Input;
}
else
{
this
.
jobId
=
service
.
jobId
;
this
.
loggedInId
=
service
.
userData
.
UserID
;
}
if
(
this
.
jobId
)
{
this
.
getEngineApplicantViewByID
(
this
.
jobId
);
this
.
getEngineApplicantViewByID
();
}
else
{
this
.
utilsService
.
createObject
(
this
.
jobApplication
,
this
.
createdObjs
);
this
.
Message
.
JobApplication
=
this
.
jobApplication
;
this
.
Message
.
Attachments
=
[];
this
.
showLoader
=
false
;
this
.
setEditorClass
();
this
.
createMessage
();
// Should never come to this block
console
.
error
(
"jobId not found."
);
}
}
getEngineApplicantViewByID
(
jobId
:
string
):
void
{
getEngineApplicantViewByID
():
void
{
this
.
showLoader
=
true
;
this
.
createdObjs
=
{};
this
.
utilsService
.
resetCounter
();
this
.
utilsService
.
clearErrorMessages
();
this
.
createMessage
();
const
assocs
=
[
ASSOCS
.
JOB
,
[
ASSOCS
.
JOB
,
ASSOCS
.
HIRING_TEAM
].
join
(
'.'
),
ASSOCS
.
MESSAGES
,
[
ASSOCS
.
MESSAGES
,
ASSOCS
.
SENT_BY
].
join
(
'.'
),
[
ASSOCS
.
MESSAGES
,
ASSOCS
.
ATTACHMENTS
].
join
(
'.'
),
[
ASSOCS
.
CANDIDATE
,
ASSOCS
.
USER
].
join
(
'.'
)];
this
.
subscriptions
.
push
(
this
.
messageEngineApplicantViewService
.
getEngineApplicantViewByID
(
jobId
,
assocs
)
this
.
subscriptions
.
push
(
this
.
messageEngineApplicantViewService
.
getEngineApplicantViewByID
(
this
.
jobId
,
assocs
)
.
subscribe
(
data
=>
{
this
.
jobApplication
=
data
;
...
...
@@ -149,7 +140,6 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
const
msgWrapper
=
document
.
getElementsByClassName
(
'messages-wrapper'
)[
0
];
msgWrapper
.
scrollTop
=
msgWrapper
.
scrollHeight
;
},
0
);
this
.
setEditorClass
();
},
error
=>
{
this
.
showLoader
=
false
;
...
...
@@ -184,29 +174,20 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
return
;
}
this
.
utilsService
.
clearErrorMessages
();
if
(
this
.
form
.
invalid
||
this
.
IsMessageEmpty
())
{
this
.
utilsService
.
showAllErrorMessages
();
}
else
{
this
.
showLoader
=
true
;
this
.
subscriptions
.
push
(
this
.
saveService
.
saveObjectsWithDefaultSvc
(
this
.
createdObjs
,
this
.
updatedObjs
,
this
.
deletedObjs
)
.
subscribe
(
data
=>
{
this
.
utilsService
.
handleSuccess
();
let
idToNavigate
=
this
.
jobApplication
.
ObjectID
;
if
(
data
.
created
[
idToNavigate
])
{
idToNavigate
=
data
.
created
[
idToNavigate
];
}
this
.
getEngineApplicantViewByID
(
idToNavigate
);
},
error
=>
{
this
.
showLoader
=
false
;
this
.
utilsService
.
handleError
(
error
);
}
)
);
}
this
.
showLoader
=
true
;
this
.
subscriptions
.
push
(
this
.
saveService
.
saveObjectsWithDefaultSvc
(
this
.
createdObjs
,
this
.
updatedObjs
,
this
.
deletedObjs
)
.
subscribe
(
data
=>
{
this
.
utilsService
.
handleSuccess
();
this
.
showLoader
=
false
;
this
.
getEngineApplicantViewByID
();
},
error
=>
{
this
.
showLoader
=
false
;
this
.
utilsService
.
handleError
(
error
);
}
)
);
}
/**
...
...
@@ -229,6 +210,7 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
* It simply creates a new object and assigns the default values to it.
*/
createMessage
():
void
{
this
.
Message
=
new
MessageModel
();
this
.
Message
.
SentBy
=
this
.
loggedInId
;
this
.
Message
.
SentVia
=
this
.
sentViaEnum
[
2
]
?
this
.
sentViaEnum
[
2
]
:
this
.
sentViaEnum
[
0
];
this
.
utilsService
.
createObject
(
this
.
Message
,
this
.
createdObjs
);
...
...
@@ -268,41 +250,4 @@ export class MessageEngineApplicantViewComponent extends BaseComponent implement
},
0
);
}
/**
* Convert rich text into simple text and check if is empty or not!
*/
showPlainText
(
HTMLTitle
:
string
):
string
{
if
(
HTMLTitle
===
undefined
)
{
return
''
;
}
const
temp
=
document
.
getElementById
(
'showPlainText'
);
temp
.
innerHTML
=
HTMLTitle
;
const
title
=
temp
.
innerText
.
trim
();
temp
.
innerHTML
=
''
;
return
title
;
}
/**
* If message content is empty, generate an error message for it.
*/
IsMessageEmpty
():
boolean
{
const
editElement
=
this
.
messageEditor
.
getQuill
().
container
;
const
editor
=
editElement
.
getElementsByClassName
(
'ql-editor'
);
if
(
this
.
showPlainText
(
this
.
Message
.
MessageContent
)
===
''
)
{
this
.
messageEditor
.
getQuill
()
.
focus
();
editor
[
0
].
classList
.
add
(
'error-block'
);
return
true
;
}
editor
[
0
].
classList
.
remove
(
'error-block'
);
return
false
;
}
}
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