2
0
mirror of https://github.com/frappe/books.git synced 2025-01-10 18:24:40 +00:00

fix: New List Design

This commit is contained in:
Faris Ansari 2019-10-04 23:30:51 +05:30
parent e7f0d335fa
commit 4f1c368ea9
7 changed files with 48 additions and 41 deletions

View File

@ -3,9 +3,10 @@ import indicators from 'frappejs/ui/constants/indicators';
export default { export default {
doctype: 'SalesInvoice', doctype: 'SalesInvoice',
title: _('Sales Invoice'), title: _('Sales Invoices'),
columns: [ columns: [
'customer', 'customer',
'name',
{ {
label: 'Status', label: 'Status',
fieldname: 'status', fieldname: 'status',

View File

@ -1,6 +1,6 @@
<template> <template>
<div <div
class="pt-6 pb-2 px-2 w-64 h-full block window-drag bg-gray-200 flex justify-between flex-col" class="pt-6 pb-2 px-2 h-full block window-drag bg-gray-200 flex justify-between flex-col"
> >
<div> <div>
<WindowControls class="px-3" /> <WindowControls class="px-3" />
@ -39,7 +39,7 @@
<button <button
class="block bg-white rounded w-full h-8 flex justify-center focus:outline-none focus:shadow-outline" class="block bg-white rounded w-full h-8 flex justify-center focus:outline-none focus:shadow-outline"
> >
<AddIcon class="w-3 h-3" /> <AddIcon class="w-3 h-3 stroke-current text-gray-900" />
</button> </button>
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="flex"> <div class="flex">
<Sidebar /> <Sidebar class="w-56" />
<div class="bg-white"> <div class="flex-1 overflow-y-hidden">
<router-view :key="$route.fullPath" /> <router-view :key="$route.fullPath" />
</div> </div>
</div> </div>

View File

@ -1,21 +1,27 @@
<template> <template>
<div class="list-container"> <div class="px-8 pb-8 mt-2">
<list-row class="text-muted rounded-top bg-light"> <ListRow class="text-gray-700" :columnCount="columns.length">
<list-cell <ListCell
v-for="column in columns" v-for="column in columns"
:key="column.label" :key="column.label"
:class="['Float', 'Currency'].includes(column.fieldtype) ? 'text-right':''" :class="['Float', 'Currency'].includes(column.fieldtype) ? 'text-right':''"
>{{ column.label }}</list-cell> >{{ column.label }}</ListCell>
</list-row> </ListRow>
<list-row v-for="doc in data" :key="doc.name" @click.native="openForm(doc.name)"> <ListRow
<list-cell v-for="column in columns" :key="column.label" class="d-flex align-items-center"> class="cursor-pointer text-gray-900 hover:text-gray-600"
v-for="doc in data"
:key="doc.name"
@click.native="openForm(doc.name)"
:columnCount="columns.length"
>
<ListCell v-for="column in columns" :key="column.label">
<indicator v-if="column.getIndicator" :color="column.getIndicator(doc)" class="mr-2" /> <indicator v-if="column.getIndicator" :color="column.getIndicator(doc)" class="mr-2" />
<span <span
style="width: 100%" style="width: 100%"
:class="['Float', 'Currency'].includes(column.fieldtype) ? 'text-right':''" :class="['Float', 'Currency'].includes(column.fieldtype) ? 'text-right':''"
>{{ getColumnValue(column, doc) }}</span> >{{ getColumnValue(column, doc) }}</span>
</list-cell> </ListCell>
</list-row> </ListRow>
</div> </div>
</template> </template>
<script> <script>
@ -78,7 +84,8 @@ export default {
this.data = await frappe.db.getAll({ this.data = await frappe.db.getAll({
doctype: this.doctype, doctype: this.doctype,
fields: ['*'], fields: ['*'],
filters filters,
limit: 13
}); });
}, },
getFilters() { getFilters() {

View File

@ -1,10 +1,5 @@
<template> <template>
<div class="col"> <div class="text-sm py-4">
<slot></slot> <slot></slot>
</div> </div>
</template> </template>
<script>
export default {
props: ['col']
}
</script>

View File

@ -1,21 +1,28 @@
<template> <template>
<div class="list-row row no-gutters py-2 px-3"> <div class="list-row border-b" :style="style">
<slot></slot> <slot></slot>
</div> </div>
</template> </template>
<style lang="scss"> <script>
@import '../../styles/variables'; export default {
.list-row { name: 'ListRow',
cursor: pointer; props: {
border: 1px solid $border-color; columnCount: {
background-color: var(--white); type: Number,
default: 1
&:hover { }
background-color: var(--white); },
computed: {
style() {
return {
'grid-template-columns': `repeat(${this.columnCount}, 1fr)`
}
}
} }
} }
</script>
.list-row:not(:first-child) { <style>
border-top: none; .list-row {
display: grid;
} }
</style> </style>

View File

@ -1,9 +1,8 @@
<template> <template>
<div class="bg-white"> <div class="flex flex-col">
<page-header :title="title" /> <PageHeader :title="title" />
<div class="px-4 py-3"> <div class="flex-1">
<list-toolbar :title="title" :filters="filters" @newClick="openNewForm" class="mb-2" /> <List :listConfig="listConfig" :filters="filters" />
<list :listConfig="listConfig" :filters="filters" />
</div> </div>
</div> </div>
</template> </template>
@ -11,7 +10,6 @@
import frappe from 'frappejs'; import frappe from 'frappejs';
import Observable from 'frappejs/utils/observable'; import Observable from 'frappejs/utils/observable';
import PageHeader from '@/components/PageHeader'; import PageHeader from '@/components/PageHeader';
import ListToolbar from './ListToolbar';
import List from './List'; import List from './List';
import listConfigs from './listConfig'; import listConfigs from './listConfig';
@ -20,7 +18,6 @@ export default {
props: ['listName', 'filters'], props: ['listName', 'filters'],
components: { components: {
PageHeader, PageHeader,
ListToolbar,
List List
}, },
created() { created() {