feat: misc change
This commit is contained in:
parent
ab347b8ff9
commit
4d1cd215a1
|
@ -3,12 +3,10 @@ import {Form, Input, Modal, Select} from "antd";
|
|||
import {useStore} from "../../utils/useStore";
|
||||
import {observer} from "mobx-react-lite";
|
||||
|
||||
export const PulsaModal = observer(({visible, onCreate, onCancel, initialData}) => {
|
||||
export const PulsaModal = observer(({visible, onCreate, onCancel, initialData, confirmLoading}) => {
|
||||
const [form] = Form.useForm();
|
||||
const {Option} = Select;
|
||||
const store = useStore();
|
||||
const [visibleModal, setVisibleModal] = useState(false);
|
||||
const [confirmLoading, setConfirmLoading] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -25,26 +23,6 @@ export const PulsaModal = observer(({visible, onCreate, onCancel, initialData})
|
|||
init();
|
||||
}, []);
|
||||
|
||||
|
||||
const subCategoriesOption = [
|
||||
<Option key={123} value={123}>
|
||||
{123}
|
||||
</Option>,
|
||||
<Option key={431} value={123}>
|
||||
{123}
|
||||
</Option>
|
||||
];
|
||||
|
||||
const subCategoriesOption2 = store.product.dataSubCategories.slice().map(subCategory => {
|
||||
return (
|
||||
<Option key={subCategory.id} value={subCategory.id}>
|
||||
{subCategory.name}
|
||||
</Option>
|
||||
)
|
||||
});
|
||||
|
||||
console.log(store.product.dataSubCategories, 'subCategoriesOption2');
|
||||
|
||||
return (
|
||||
<Modal
|
||||
visible={visible}
|
||||
|
@ -63,7 +41,7 @@ export const PulsaModal = observer(({visible, onCreate, onCancel, initialData})
|
|||
form.resetFields();
|
||||
})
|
||||
.catch((info) => {
|
||||
console.log("Validate Failed:", info);
|
||||
console.error("Validate Failed:", info);
|
||||
});
|
||||
}}
|
||||
>
|
||||
|
@ -117,18 +95,13 @@ export const PulsaModal = observer(({visible, onCreate, onCancel, initialData})
|
|||
rules={[{required: true, message: "Please select sub categories!"}]}
|
||||
>
|
||||
<Select placeholder="Select Sub Category" allowClear>
|
||||
{subCategoriesOption2}
|
||||
{store.product.dataSubCategories.map((item) => (
|
||||
<Option value={item.id} key={item.id}>
|
||||
{item.name}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
{/*<Form.Item*/}
|
||||
{/* name="subCategories"*/}
|
||||
{/* label="Sub Categories"*/}
|
||||
{/* rules={[{required: true, message: "Please select Sub Category!"}]}*/}
|
||||
{/*>*/}
|
||||
{/* <Select placeholder="Select Sub Category" allowClear>*/}
|
||||
{/* {subCategoriesOption2}*/}
|
||||
{/* </Select>*/}
|
||||
{/*</Form.Item>*/}
|
||||
</Form>
|
||||
</Modal>
|
||||
);
|
||||
|
|
|
@ -33,7 +33,7 @@ export class Product {
|
|||
}
|
||||
|
||||
async getDataSubCategories() {
|
||||
const response = await http.get(`/product/sub-categories?pageSize=${this.pageSizeSubCategories}`);
|
||||
const response = await http.get(`/product/sub-categories?page=${this.pageSubCategories}&pageSize=${this.pageSizeSubCategories}`);
|
||||
this.dataSubCategories = response.body.data ?? []
|
||||
this.total_dataSubCategories = response.body.count ?? 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user