change notification sorting by creation date
This commit is contained in:
@ -262,7 +262,9 @@ const AddDialog = () => {
|
|||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">Type</label>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Type<span className="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
<div className="flex gap-6 items-center">
|
<div className="flex gap-6 items-center">
|
||||||
{['info', 'promo'].map((type) => (
|
{['info', 'promo'].map((type) => (
|
||||||
<label key={type} className="flex items-center space-x-2">
|
<label key={type} className="flex items-center space-x-2">
|
||||||
|
|||||||
@ -107,7 +107,7 @@ const ManageNotifContextProvider = ({ children }: { children: React.ReactNode })
|
|||||||
|
|
||||||
const getNotificationList = async (page: number, limit: number, sorting: any, filter: any) => {
|
const getNotificationList = async (page: number, limit: number, sorting: any, filter: any) => {
|
||||||
try {
|
try {
|
||||||
sorting = sorting.length == 0 ? [{ id: 'content', desc: false }] : sorting;
|
sorting = sorting.length === 0 ? [{ id: 'created_at', desc: true }] : sorting;
|
||||||
filter =
|
filter =
|
||||||
filter.length == 0 ? {} : { content: { like: `%${filter[0].value?.toLowerCase()}%` } };
|
filter.length == 0 ? {} : { content: { like: `%${filter[0].value?.toLowerCase()}%` } };
|
||||||
const response = await GetData(`${API_URL_NOTIFICATION}/list`, {
|
const response = await GetData(`${API_URL_NOTIFICATION}/list`, {
|
||||||
@ -145,7 +145,7 @@ const ManageNotifContextProvider = ({ children }: { children: React.ReactNode })
|
|||||||
pagination={{ size: 10 }}
|
pagination={{ size: 10 }}
|
||||||
toolbar={<ListToolBar />}
|
toolbar={<ListToolBar />}
|
||||||
layout={{ card: true }}
|
layout={{ card: true }}
|
||||||
sorting={[{ id: 'content', desc: false }]}
|
sorting={[{ id: 'created_at', desc: true }]}
|
||||||
serverSide={true}
|
serverSide={true}
|
||||||
onFetchData={({ pageIndex, pageSize, sorting, columnFilters }) =>
|
onFetchData={({ pageIndex, pageSize, sorting, columnFilters }) =>
|
||||||
getNotificationList(pageIndex, pageSize, sorting, columnFilters)
|
getNotificationList(pageIndex, pageSize, sorting, columnFilters)
|
||||||
|
|||||||
Reference in New Issue
Block a user