Skip to content

Commit

Permalink
Merge pull request #1668 from frappe/version-15-hotfix
Browse files Browse the repository at this point in the history
chore: release v15
  • Loading branch information
ruchamahabal committed Apr 17, 2024
2 parents d4bd0b1 + ab48931 commit 1c9c489
Show file tree
Hide file tree
Showing 40 changed files with 1,670 additions and 485 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/BottomTabs.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<ion-tab-bar
slot="bottom"
class="bg-white shadow-md sm:w-96 py-2 standalone:pb-safe-bottom"
class="bg-white shadow-md sm:w-96 py-2 pb-2 standalone:pb-safe-bottom"
>
<ion-tab-button
v-for="item in tabItems"
Expand Down
45 changes: 26 additions & 19 deletions frontend/src/components/CheckInPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,32 @@
<h2 class="text-lg font-bold text-gray-900">
Hey, {{ employee?.data?.first_name }} 👋
</h2>
<div class="font-medium text-sm text-gray-500 mt-1.5" v-if="lastLog">
Last {{ lastLogType }} was at {{ lastLogTime }}

<template v-if="allowCheckinFromMobile.data">
<div class="font-medium text-sm text-gray-500 mt-1.5" v-if="lastLog">
Last {{ lastLogType }} was at {{ lastLogTime }}
</div>
<Button
class="mt-4 mb-1 drop-shadow-sm py-5 text-base"
id="open-checkin-modal"
@click="checkinTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss')"
>
<template #prefix>
<FeatherIcon
:name="
nextAction.action === 'IN'
? 'arrow-right-circle'
: 'arrow-left-circle'
"
class="w-4"
/>
</template>
{{ nextAction.label }}
</Button>
</template>
<div v-else class="font-medium text-sm text-gray-500 mt-1.5">
{{ dayjs().format("ddd, D MMMM, YYYY") }}
</div>
<Button
class="mt-4 mb-1 drop-shadow-sm py-5 text-base"
id="open-checkin-modal"
@click="checkinTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss')"
>
<template #prefix>
<FeatherIcon
:name="
nextAction.action === 'IN'
? 'arrow-right-circle'
: 'arrow-left-circle'
"
class="w-4"
/>
</template>
{{ nextAction.label }}
</Button>
</div>

<ion-modal
Expand Down Expand Up @@ -57,6 +63,7 @@
import { createListResource, toast, FeatherIcon } from "frappe-ui"
import { computed, inject, ref, onMounted, onBeforeUnmount } from "vue"
import { IonModal, modalController } from "@ionic/vue"
import { allowCheckinFromMobile } from "@/data/settings"

const DOCTYPE = "Employee Checkin"

Expand Down
143 changes: 70 additions & 73 deletions frontend/src/components/FormView.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<template>
<div class="flex flex-col h-full w-full" v-if="isFormReady">
<div
class="w-full h-full bg-white sm:w-96 flex flex-col relative overflow-y-auto"
>
<div class="w-full h-full bg-white sm:w-96 flex flex-col">
<header
class="flex flex-row bg-white shadow-sm py-4 px-3 items-center border-b sticky top-0 z-[1000]"
class="flex flex-row bg-white shadow-sm py-4 px-3 items-center sticky top-0 z-[1000]"
>
<Button
variant="ghost"
Expand Down Expand Up @@ -57,79 +55,78 @@
</header>

<!-- Form -->
<div class="bg-white grow">
<div class="bg-white grow overflow-y-auto">
<!-- Tabs -->
<div
class="px-4 sticky top-15 z-[100] bg-white text-sm font-medium text-center text-gray-500 border-b border-gray-200 dark:text-gray-400 dark:border-gray-700"
>
<ul class="flex -mb-px overflow-auto hide-scrollbar">
<li class="mr-2 whitespace-nowrap" v-for="tab in tabs">
<button
@click="activeTab = tab.name"
class="inline-block p-4 border-b-2 border-transparent rounded-t-lg"
:class="[
activeTab === tab.name
? '!text-gray-800 !border-gray-800'
: 'hover:text-gray-600 hover:border-gray-300',
]"
>
{{ tab.name }}
</button>
</li>
</ul>
</div>

<template
v-if="tabbedView"
v-for="(fieldList, tabName, index) in tabFields"
>
<template v-if="tabbedView">
<div
v-show="tabName === activeTab"
class="flex flex-col space-y-4 p-4"
class="px-4 sticky top-0 z-[100] bg-white text-sm font-medium text-center text-gray-500 border-b border-gray-200 dark:text-gray-400 dark:border-gray-700"
>
<template v-for="field in fieldList" :key="field.fieldname">
<slot
v-if="field.fieldtype == 'Table'"
:name="field.fieldname"
:isFormReadOnly="isFormReadOnly"
></slot>

<FormField
v-else
:fieldtype="field.fieldtype"
:fieldname="field.fieldname"
v-model="formModel[field.fieldname]"
:default="field.default"
:label="field.label"
:options="field.options"
:linkFilters="field.linkFilters"
:documentList="field.documentList"
:readOnly="Boolean(field.read_only) || isFormReadOnly"
:reqd="Boolean(field.reqd)"
:hidden="Boolean(field.hidden)"
:errorMessage="field.error_message"
:minDate="field.minDate"
:maxDate="field.maxDate"
:addSectionPadding="fieldList[0].name !== field.name"
/>
</template>
<ul class="flex -mb-px overflow-auto hide-scrollbar">
<li class="mr-2 whitespace-nowrap" v-for="tab in tabs">
<button
@click="activeTab = tab.name"
class="inline-block py-4 px-2 border-b-2 border-transparent rounded-t-lg"
:class="[
activeTab === tab.name
? '!text-gray-800 !border-gray-800'
: 'hover:text-gray-600 hover:border-gray-300',
]"
>
{{ tab.name }}
</button>
</li>
</ul>
</div>

<!-- Attachment upload -->
<template v-for="(fieldList, tabName, index) in tabFields">
<div
class="flex flex-row gap-2 items-center justify-center p-5"
v-if="isFileUploading"
v-show="tabName === activeTab"
class="flex flex-col space-y-4 p-4"
>
<LoadingIndicator class="w-3 h-3 text-gray-800" />
<span class="text-gray-900 text-sm">Uploading...</span>
<template v-for="field in fieldList" :key="field.fieldname">
<slot
v-if="field.fieldtype == 'Table'"
:name="field.fieldname"
:isFormReadOnly="isFormReadOnly"
></slot>

<FormField
v-else
:fieldtype="field.fieldtype"
:fieldname="field.fieldname"
v-model="formModel[field.fieldname]"
:default="field.default"
:label="field.label"
:options="field.options"
:linkFilters="field.linkFilters"
:documentList="field.documentList"
:readOnly="Boolean(field.read_only) || isFormReadOnly"
:reqd="Boolean(field.reqd)"
:hidden="Boolean(field.hidden)"
:errorMessage="field.error_message"
:minDate="field.minDate"
:maxDate="field.maxDate"
:addSectionPadding="fieldList[0].name !== field.name"
/>
</template>

<!-- Attachment upload -->
<div
class="flex flex-row gap-2 items-center justify-center p-5"
v-if="isFileUploading"
>
<LoadingIndicator class="w-3 h-3 text-gray-800" />
<span class="text-gray-900 text-sm">Uploading...</span>
</div>

<FileUploaderView
v-else-if="showAttachmentView && index === 0"
v-model="fileAttachments"
@handleFileSelect="handleFileSelect"
@handleFileDelete="handleFileDelete"
/>
</div>

<FileUploaderView
v-else-if="showAttachmentView && index === 0"
v-model="fileAttachments"
@handleFileSelect="handleFileSelect"
@handleFileDelete="handleFileDelete"
/>
</div>
</template>
</template>

<div class="flex flex-col space-y-4 p-4" v-else>
Expand Down Expand Up @@ -174,7 +171,7 @@
<!-- custom form button eg: Download button in salary slips -->
<div
v-if="!showFormButton"
class="px-4 pt-4 mt-2 sm:w-96 bg-white sticky bottom-0 w-full drop-shadow-xl z-40 border-t rounded-t-lg pb-10"
class="px-4 pt-4 pb-4 standalone:pb-safe-bottom sm:w-96 bg-white sticky bottom-0 w-full drop-shadow-xl z-40 border-t rounded-t-lg"
>
<slot name="formButton"></slot>
</div>
Expand All @@ -190,7 +187,7 @@
<!-- save/submit/cancel -->
<div
v-else-if="isFormDirty || (!workflow?.hasWorkflow && formButton)"
class="px-4 pt-4 mt-2 sm:w-96 bg-white sticky bottom-0 w-full drop-shadow-xl z-40 border-t rounded-t-lg pb-10"
class="px-4 pt-4 pb-4 standalone:pb-safe-bottom sm:w-96 bg-white sticky bottom-0 w-full drop-shadow-xl z-40 border-t rounded-t-lg"
>
<ErrorMessage
class="mb-2"
Expand All @@ -202,7 +199,7 @@
/>
<Button
class="w-full rounded mt-2 py-5 text-base disabled:bg-gray-700 disabled:text-white"
class="w-full rounded py-5 text-base disabled:bg-gray-700 disabled:text-white"
:class="formButton === 'Cancel' ? 'shadow' : ''"
@click="formButton === 'Save' ? saveForm() : submitOrCancelForm()"
:variant="formButton === 'Cancel' ? 'subtle' : 'solid'"
Expand Down
45 changes: 22 additions & 23 deletions frontend/src/components/RequestPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,34 @@ import ExpenseClaimItem from "@/components/ExpenseClaimItem.vue"
import { useListUpdate } from "@/composables/realtime"
const activeTab = ref("My Requests")
const socket = inject("$socket")
const employee = inject("$employee")
const myRequests = computed(() => {
const requests = [...(myLeaves.data || []), ...(myClaims.data || [])]
const myRequests = computed(() => updateRequestDetails(myLeaves, myClaims))
return requests.map((item) => {
if (item.doctype === "Leave Application")
item.component = markRaw(LeaveRequestItem)
else if (item.doctype === "Expense Claim")
item.component = markRaw(ExpenseClaimItem)
const teamRequests = computed(() =>
updateRequestDetails(teamLeaves, teamClaims)
)
return item
function updateRequestDetails(leaves, claims) {
const requests = [...(leaves.data || []), ...(claims.data || [])]
requests.forEach((request) => {
if (request.doctype === "Leave Application") {
request.component = markRaw(LeaveRequestItem)
} else if (request.doctype === "Expense Claim") {
request.component = markRaw(ExpenseClaimItem)
}
})
})
const teamRequests = computed(() => {
const requests = [...(teamLeaves.data || []), ...(teamClaims.data || [])]
return getSortedRequests(requests)
}
return requests.map((item) => {
if (item.doctype === "Leave Application")
item.component = markRaw(LeaveRequestItem)
else if (item.doctype === "Expense Claim")
item.component = markRaw(ExpenseClaimItem)
return item
})
})
function getSortedRequests(list) {
// return top 10 requests sorted by posting date
return list
.sort((a, b) => {
return new Date(b.posting_date) - new Date(a.posting_date)
})
.splice(0, 10)
}
onMounted(() => {
useListUpdate(socket, "Leave Application", () => teamLeaves.reload())
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/WorkflowActionSheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
v-if="actions.length > 0"
:class="[
props.view === 'form'
? 'px-4 pt-4 mt-2 sm:w-96 bg-white sticky bottom-0 w-full drop-shadow-xl z-40 border-t rounded-t-lg pb-10'
? 'px-4 pt-4 pb-4 standalone:pb-safe-bottom sm:w-96 bg-white sticky bottom-0 w-full drop-shadow-xl z-40 border-t rounded-t-lg'
: 'flex w-full flex-row items-center justify-between gap-3 sticky bottom-0 border-t z-[100] p-4',
]"
>
<Button
v-if="props.view === 'form' || actions.length > 2"
@click="showTransitions()"
class="w-full rounded mt-2 py-5 text-base disabled:bg-gray-700 disabled:text-white"
class="w-full rounded py-5 text-base disabled:bg-gray-700 disabled:text-white"
variant="solid"
>
<template #prefix>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/data/claims.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const myClaims = createResource({
url: "hrms.api.get_expense_claims",
params: {
employee: employeeResource.data.name,
limit: 5,
limit: 10,
},
auto: true,
cache: "hrms:my_claims",
Expand All @@ -40,7 +40,7 @@ export const teamClaims = createResource({
employee: employeeResource.data.name,
approver_id: employeeResource.data.user_id,
for_approval: 1,
limit: 5,
limit: 10,
},
auto: true,
cache: "hrms:team_claims",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/data/leaves.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const myLeaves = createResource({
url: "hrms.api.get_leave_applications",
params: {
employee: employeeResource.data.name,
limit: 5,
limit: 10,
},
auto: true,
cache: "hrms:my_leaves",
Expand All @@ -42,7 +42,7 @@ export const teamLeaves = createResource({
employee: employeeResource.data.name,
approver_id: employeeResource.data.user_id,
for_approval: 1,
limit: 5,
limit: 10,
},
auto: true,
cache: "hrms:team_leaves",
Expand Down
Loading

0 comments on commit 1c9c489

Please sign in to comment.