fix: membership create & update
This commit is contained in:
parent
d41681c217
commit
ac13d366c8
|
@ -68,6 +68,11 @@ export const SubcategoryComponent = observer((props) => {
|
|||
dataIndex: "name",
|
||||
key: "name",
|
||||
},
|
||||
{
|
||||
title: "Category",
|
||||
dataIndex: "categoryName",
|
||||
key: "categoryName",
|
||||
},
|
||||
{
|
||||
title: "Action",
|
||||
key: "action",
|
||||
|
|
|
@ -212,7 +212,6 @@ export const Membership = observer(() => {
|
|||
setInitialData({});
|
||||
setConfirmLoading(true);
|
||||
try {
|
||||
console.log(data);
|
||||
await store.membership.update(initialData.id, data);
|
||||
message.success(
|
||||
initialData.isChangePassword
|
||||
|
|
|
@ -35,6 +35,7 @@ export const MembershipModal = ({
|
|||
.validateFields()
|
||||
.then((values) => {
|
||||
let input = values;
|
||||
if (initialData.id)
|
||||
input.username = initialData.username;
|
||||
|
||||
onCreate(input);
|
||||
|
@ -51,7 +52,8 @@ export const MembershipModal = ({
|
|||
name="form_in_modal"
|
||||
initialValues={initialData}
|
||||
>
|
||||
{((initialData.id && !initialData.isChangePassword) || !initialData.id) && (
|
||||
{((initialData.id && !initialData.isChangePassword) ||
|
||||
!initialData.id) && (
|
||||
<Form.Item
|
||||
name="name"
|
||||
label="Name"
|
||||
|
@ -69,7 +71,8 @@ export const MembershipModal = ({
|
|||
<Input />
|
||||
</Form.Item>
|
||||
)}
|
||||
{((initialData.id && initialData.isChangePassword) || !initialData.id) && (
|
||||
{((initialData.id && initialData.isChangePassword) ||
|
||||
!initialData.id) && (
|
||||
<Form.Item
|
||||
name="password"
|
||||
label="Password"
|
||||
|
@ -78,7 +81,18 @@ export const MembershipModal = ({
|
|||
<Input />
|
||||
</Form.Item>
|
||||
)}
|
||||
{((initialData.id && !initialData.isChangePassword) || !initialData.id) && (
|
||||
{((initialData.id && !initialData.isChangePassword) ||
|
||||
!initialData.id) && (
|
||||
<Form.Item
|
||||
name="phone_number"
|
||||
label="Phone Number"
|
||||
rules={[{ required: true, message: "Please input Phone Number!" }]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
)}
|
||||
{((initialData.id && !initialData.isChangePassword) ||
|
||||
!initialData.id) && (
|
||||
<Form.Item
|
||||
name="roleId"
|
||||
label="Role"
|
||||
|
|
|
@ -26,21 +26,32 @@ export class Category {
|
|||
|
||||
async getData() {
|
||||
const response = await http.get(`/product/categories?page=${this.page}&pageSize=${this.pageSize}`);
|
||||
console.log(response)
|
||||
this.data = response.body.data ?? []
|
||||
this.data = response.body.data.map((item, idx) => {
|
||||
item.key = idx;
|
||||
return item
|
||||
}) ?? []
|
||||
|
||||
this.total_data = response.body.total_data ?? 0
|
||||
}
|
||||
|
||||
async getDataSubCategories() {
|
||||
const response = await http.get(`/product/sub-categories?page=${this.pageSubCategories}&pageSize=${this.pageSizeSubCategories}`);
|
||||
this.dataSubCategories = response.body.data ?? []
|
||||
this.dataSubCategories = response.body.data.map((item, idx) => {
|
||||
item.key = idx;
|
||||
return item
|
||||
}) ?? []
|
||||
|
||||
this.total_dataSubCategories = response.body.count ?? 0
|
||||
}
|
||||
|
||||
async getDataCategories() {
|
||||
const response = await http.get(`/product/categories?page=${this.pageCategories}&pageSize=${this.pageSizeCategories}`);
|
||||
|
||||
this.dataCategories = response.body.data ?? []
|
||||
this.dataCategories = response.body.data.map((item, idx) => {
|
||||
item.key = idx;
|
||||
return item
|
||||
}) ?? []
|
||||
|
||||
this.total_dataCategories = response.body.total_data ?? 0
|
||||
if (this.dataCategories.length > 0) {
|
||||
this.filterCategory = this.dataCategories[0].id
|
||||
|
|
|
@ -18,6 +18,7 @@ export class Membership {
|
|||
this.data = response.body.data.map((item, idx) => {
|
||||
item.key = idx;
|
||||
item.name = item?.user_detail?.name;
|
||||
item.phone_number = item?.user_detail?.phone_number;
|
||||
item.roleId = item?.roles.id;
|
||||
item.roleName = item?.roles.name;
|
||||
return item
|
||||
|
@ -33,6 +34,7 @@ export class Membership {
|
|||
this.data = response.body.data.map((item, idx) => {
|
||||
item.key = idx;
|
||||
item.name = item?.user_detail?.name;
|
||||
item.phone_number = item?.user_detail?.phone_number;
|
||||
item.roleId = item?.roles.id;
|
||||
item.roleName = item?.roles?.name;
|
||||
return item
|
||||
|
|
|
@ -26,13 +26,22 @@ export class Subcategory {
|
|||
|
||||
async getData() {
|
||||
const response = await http.get(`/product/sub-categories?page=${this.page}&pageSize=${this.pageSize}`);
|
||||
this.data = response.body.data ?? []
|
||||
this.data = response.body.data.map((item, idx) => {
|
||||
item.key = idx;
|
||||
item.categoryName = item.category.name;
|
||||
return item
|
||||
}) ?? []
|
||||
|
||||
this.total_data = response.body.total_data ?? 0
|
||||
}
|
||||
|
||||
async getDataSubCategories() {
|
||||
const response = await http.get(`/product/sub-categories?page=${this.pageSubCategories}&pageSize=${this.pageSizeSubCategories}`);
|
||||
this.dataSubCategories = response.body.data ?? []
|
||||
this.dataSubCategories = response.body.data.map((item, idx) => {
|
||||
item.key = idx;
|
||||
return item
|
||||
}) ?? []
|
||||
|
||||
this.total_dataSubCategories = response.body.count ?? 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user