Skip to content

Commit 5fcab24

Browse files
Nethmin DulsaraRajithaKumara
Nethmin Dulsara
authored andcommitted
OHRM5X-2049: Develop claim - submit claim screen (orangehrm#1659)
1 parent 67b80d1 commit 5fcab24

File tree

13 files changed

+1001
-13
lines changed

13 files changed

+1001
-13
lines changed

installer/Migration/V5_5_0/lang-string/claim.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,24 @@ langStrings:
3535
-
3636
value: "Create"
3737
unitId: create
38+
-
39+
value: "Submit Claim"
40+
unitId: submit_claim
41+
-
42+
value: "Reference Id"
43+
unitId: reference_id
44+
-
45+
value: "Amount"
46+
unitId: amount
47+
-
48+
value: "Expenses"
49+
unitId: expenses
50+
-
51+
value: "Expense Type"
52+
unitId: expense_type
53+
-
54+
value: "Total Amount"
55+
unitId: total_amount
56+
-
57+
value: "Pay"
58+
unitId: pay

installer/Migration/V5_5_0/permission/api.yaml

+2-8
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,5 @@ apiv2_claim_claim_request_action:
9090
update: true
9191
delete: false
9292
permissions:
93-
- {
94-
role: Admin,
95-
permission: { read: false, create: false, update: true, delete: false },
96-
}
97-
- {
98-
role: ESS,
99-
permission: { read: false, create: false, update: true, delete: false },
100-
}
93+
- { role: Admin, permission: { read: false, create: false, update: true, delete: false } }
94+
- { role: ESS, permission: { read: false, create: false, update: true, delete: false } }

installer/Migration/V5_5_0/permission/screens.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,10 @@
3939
permissions:
4040
- { role: Admin, permission: { read: true, create: true, update: false } }
4141
- { role: ESS, permission: { read: true, create: true, update: false, delete: false } }
42+
43+
'Submit Claim Request':
44+
module: claim
45+
url: submitClaim/id/{id}
46+
permissions:
47+
- { role: Admin, permission: { read: true, create: true, update: true } }
48+
- { role: ESS, permission: { read: true, create: true, update: true, delete: false } }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
<!--
2+
/**
3+
* OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures
4+
* all the essential functionalities required for any enterprise.
5+
* Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com
6+
*
7+
* OrangeHRM is free software; you can redistribute it and/or modify it under the terms of
8+
* the GNU General Public License as published by the Free Software Foundation; either
9+
* version 2 of the License, or (at your option) any later version.
10+
*
11+
* OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+
* See the GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License along with this program;
16+
* if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17+
* Boston, MA 02110-1301, USA
18+
*/
19+
-->
20+
<template>
21+
<div
22+
:class="{
23+
'orangehrm-action-button-container': allowedActions.length < 2,
24+
'orangehrm-action-buttons-container': allowedActions.length > 1,
25+
}"
26+
>
27+
<oxd-button
28+
display-type="ghost"
29+
class="orangehrm-sm-button"
30+
:label="$t('general.back')"
31+
@click="onBack"
32+
/>
33+
<oxd-button
34+
v-if="isCancelAllowed"
35+
display-type="danger"
36+
class="orangehrm-sm-button"
37+
:label="$t('general.cancel')"
38+
@click="onClaimAction('CANCEL')"
39+
/>
40+
<oxd-button
41+
v-if="isRejectAllowed"
42+
display-type="danger"
43+
class="orangehrm-sm-button"
44+
:label="$t('general.reject')"
45+
@click="onClaimAction('REJECT')"
46+
/>
47+
<oxd-button
48+
v-if="isApproveAllowed"
49+
display-type="secondary"
50+
class="orangehrm-sm-button"
51+
:label="$t('general.approve')"
52+
@click="onClaimAction('APPROVE')"
53+
/>
54+
<oxd-button
55+
v-if="isPayAllowed"
56+
display-type="secondary"
57+
class="orangehrm-sm-button"
58+
:label="$t('claim.pay')"
59+
@click="onClaimAction('PAY')"
60+
/>
61+
<oxd-button
62+
v-if="isSubmitAllowed"
63+
display-type="secondary"
64+
class="orangehrm-sm-button"
65+
:label="$t('general.submit')"
66+
@click="onClaimAction('SUBMIT')"
67+
/>
68+
</div>
69+
</template>
70+
71+
<script>
72+
import {APIService} from '@/core/util/services/api.service';
73+
import {navigate} from '@ohrm/core/util/helper/navigation';
74+
75+
export default {
76+
name: 'ClaimActionButtons',
77+
props: {
78+
requestId: {
79+
type: Number,
80+
required: true,
81+
},
82+
allowedActions: {
83+
type: Array,
84+
required: true,
85+
},
86+
},
87+
setup(props) {
88+
const http = new APIService(
89+
window.appGlobal.baseUrl,
90+
`/api/v2/claim/requests/${props.requestId}/action`,
91+
);
92+
return {
93+
http,
94+
};
95+
},
96+
computed: {
97+
isCancelAllowed() {
98+
return this.allowedActions.includes('Cancel');
99+
},
100+
isSubmitAllowed() {
101+
return this.allowedActions.includes('Submit');
102+
},
103+
isApproveAllowed() {
104+
return this.allowedActions.includes('Approve');
105+
},
106+
isRejectAllowed() {
107+
return this.allowedActions.includes('Reject');
108+
},
109+
isPayAllowed() {
110+
return this.allowedActions.includes('Pay');
111+
},
112+
},
113+
methods: {
114+
onClaimAction(action) {
115+
this.http
116+
.request({
117+
method: 'PUT',
118+
data: {
119+
action: action,
120+
},
121+
})
122+
.then(() => {
123+
return this.$toast.saveSuccess();
124+
})
125+
.then(() => {
126+
navigate(`/claim/submitClaim/id/${this.requestId}`);
127+
});
128+
},
129+
onBack() {
130+
navigate('/claim/submitClaim');
131+
},
132+
},
133+
};
134+
</script>
135+
136+
<style scoped lang="scss">
137+
.orangehrm-action-buttons-container {
138+
display: flex;
139+
flex-direction: row;
140+
flex-wrap: wrap;
141+
justify-content: flex-end;
142+
padding: 25px;
143+
@media screen and (max-width: 600px) {
144+
display: flex;
145+
flex-direction: column;
146+
align-items: center;
147+
}
148+
}
149+
.orangehrm-action-button-container {
150+
display: flex;
151+
flex-direction: row;
152+
flex-wrap: wrap;
153+
justify-content: flex-end;
154+
padding: 25px;
155+
}
156+
.orangehrm-sm-button {
157+
margin-left: 1rem;
158+
@media screen and (max-width: 600px) {
159+
margin-bottom: 1rem;
160+
}
161+
}
162+
</style>

0 commit comments

Comments
 (0)