Merge branch 'main' into 'devops-production'
Main See merge request empatnusabangsa/ppob/ppob-frontend!102
This commit is contained in:
		
							
								
								
									
										1
									
								
								.env
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.env
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					process.env.NEXT_PUBLIC_BASE_URL=https://ppob-backend.k3s.bangun-kreatif.com/v1
 | 
				
			||||||
@@ -6,9 +6,10 @@ metadata:
 | 
				
			|||||||
  annotations:
 | 
					  annotations:
 | 
				
			||||||
    kubernetes.io/ingress.class: "traefik"
 | 
					    kubernetes.io/ingress.class: "traefik"
 | 
				
			||||||
    cert-manager.io/cluster-issuer: letsencrypt-prod
 | 
					    cert-manager.io/cluster-issuer: letsencrypt-prod
 | 
				
			||||||
 | 
					    traefik.ingress.kubernetes.io/router.middlewares: empatnusabangsa-production-redirect-https@kubernetescrd
 | 
				
			||||||
spec:
 | 
					spec:
 | 
				
			||||||
  rules:
 | 
					  rules:
 | 
				
			||||||
    - host: "wndsolutions.id"
 | 
					    - host: "www.wndsolutions.id"
 | 
				
			||||||
      http:
 | 
					      http:
 | 
				
			||||||
        paths:
 | 
					        paths:
 | 
				
			||||||
          - pathType: Prefix
 | 
					          - pathType: Prefix
 | 
				
			||||||
@@ -20,5 +21,5 @@ spec:
 | 
				
			|||||||
                  number: 80
 | 
					                  number: 80
 | 
				
			||||||
  tls:
 | 
					  tls:
 | 
				
			||||||
    - hosts:
 | 
					    - hosts:
 | 
				
			||||||
        - "wndsolutions.id"
 | 
					        - "www.wndsolutions.id"
 | 
				
			||||||
      secretName: wndsolutions-id-tls
 | 
					      secretName: www-wndsolutions-id-tls
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,6 @@ import {
 | 
				
			|||||||
  Input,
 | 
					  Input,
 | 
				
			||||||
  message,
 | 
					  message,
 | 
				
			||||||
  Modal,
 | 
					  Modal,
 | 
				
			||||||
  Select,
 | 
					 | 
				
			||||||
  Space,
 | 
					  Space,
 | 
				
			||||||
  Table,
 | 
					  Table,
 | 
				
			||||||
  List,
 | 
					  List,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,3 @@
 | 
				
			|||||||
export const appConfig = {
 | 
					export const appConfig = {
 | 
				
			||||||
 apiUrl: 'https://ppob-backend.k3s.bangun-kreatif.com/v1'
 | 
					 apiUrl: process.env.NEXT_PUBLIC_BASE_URL || 'https://ppob-backend.k3s.bangun-kreatif.com/v1'
 | 
				
			||||||
    //apiUrl: 'http://localhost:3222/v1'
 | 
					 | 
				
			||||||
    // apiUrl: 'http://localhost:3222/v1'
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					 | 
				
			||||||
//export default appConfig;
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -469,9 +469,11 @@ export const DetailUser = observer(() => {
 | 
				
			|||||||
                Ganti Password
 | 
					                Ganti Password
 | 
				
			||||||
              </Button>
 | 
					              </Button>
 | 
				
			||||||
              {((store.authentication.userData.role === "Sales" &&
 | 
					              {((store.authentication.userData.role === "Sales" &&
 | 
				
			||||||
                store.membership.dataDetail.is_rejected === true) ||
 | 
					                store.membership.dataDetail.is_rejected === true &&
 | 
				
			||||||
 | 
					                store.membership.dataDetail.is_active === false) ||
 | 
				
			||||||
                (store.authentication.userData.role === "Supervisor" &&
 | 
					                (store.authentication.userData.role === "Supervisor" &&
 | 
				
			||||||
                  store.membership.dataDetail.is_rejected === true)) && (
 | 
					                  store.membership.dataDetail.is_rejected === true &&
 | 
				
			||||||
 | 
					                  store.membership.dataDetail.is_active === false)) && (
 | 
				
			||||||
                <Button
 | 
					                <Button
 | 
				
			||||||
                  style={{
 | 
					                  style={{
 | 
				
			||||||
                    backgroundColor: "#1bb91d",
 | 
					                    backgroundColor: "#1bb91d",
 | 
				
			||||||
@@ -566,19 +568,21 @@ export const DetailUser = observer(() => {
 | 
				
			|||||||
                        <Text strong>Foto Toko</Text>
 | 
					                        <Text strong>Foto Toko</Text>
 | 
				
			||||||
                        <Text>
 | 
					                        <Text>
 | 
				
			||||||
                          <Row>
 | 
					                          <Row>
 | 
				
			||||||
                            {store.authentication.listImage?store.authentication.listImage.map(
 | 
					                            {store.authentication.listImage
 | 
				
			||||||
                              (item, index) => (
 | 
					                              ? store.authentication.listImage.map(
 | 
				
			||||||
                                <Image
 | 
					                                  (item, index) => (
 | 
				
			||||||
                                  key={index}
 | 
					                                    <Image
 | 
				
			||||||
                                  src={
 | 
					                                      key={index}
 | 
				
			||||||
                                    item
 | 
					                                      src={
 | 
				
			||||||
                                      ? `${appConfig.apiUrl}/config/image/${item}`
 | 
					                                        item
 | 
				
			||||||
                                      : "https://st4.depositphotos.com/14953852/24787/v/600/depositphotos_247872612-stock-illustration-no-image-available-icon-vector.jpg"
 | 
					                                          ? `${appConfig.apiUrl}/config/image/${item}`
 | 
				
			||||||
                                  }
 | 
					                                          : "https://st4.depositphotos.com/14953852/24787/v/600/depositphotos_247872612-stock-illustration-no-image-available-icon-vector.jpg"
 | 
				
			||||||
                                  style={{ width: "10vw", marginRight: 15 }}
 | 
					                                      }
 | 
				
			||||||
                                />
 | 
					                                      style={{ width: "10vw", marginRight: 15 }}
 | 
				
			||||||
                              )
 | 
					                                    />
 | 
				
			||||||
                            ) : ""}
 | 
					                                  )
 | 
				
			||||||
 | 
					                                )
 | 
				
			||||||
 | 
					                              : ""}
 | 
				
			||||||
                          </Row>
 | 
					                          </Row>
 | 
				
			||||||
                        </Text>
 | 
					                        </Text>
 | 
				
			||||||
                      </Col>
 | 
					                      </Col>
 | 
				
			||||||
@@ -608,17 +612,21 @@ export const DetailUser = observer(() => {
 | 
				
			|||||||
                    <Text strong>Foto Toko</Text>
 | 
					                    <Text strong>Foto Toko</Text>
 | 
				
			||||||
                    <Text>
 | 
					                    <Text>
 | 
				
			||||||
                      <Row>
 | 
					                      <Row>
 | 
				
			||||||
                        {store.authentication.listImage?store.authentication.listImage.map((item, index) => (
 | 
					                        {store.authentication.listImage
 | 
				
			||||||
                          <Image
 | 
					                          ? store.authentication.listImage.map(
 | 
				
			||||||
                            key={index}
 | 
					                              (item, index) => (
 | 
				
			||||||
                            src={
 | 
					                                <Image
 | 
				
			||||||
                              item
 | 
					                                  key={index}
 | 
				
			||||||
                                ? `${appConfig.apiUrl}/config/image/${item}`
 | 
					                                  src={
 | 
				
			||||||
                                : "https://st4.depositphotos.com/14953852/24787/v/600/depositphotos_247872612-stock-illustration-no-image-available-icon-vector.jpg"
 | 
					                                    item
 | 
				
			||||||
                            }
 | 
					                                      ? `${appConfig.apiUrl}/config/image/${item}`
 | 
				
			||||||
                            style={{ width: "10vw", marginRight: 15 }}
 | 
					                                      : "https://st4.depositphotos.com/14953852/24787/v/600/depositphotos_247872612-stock-illustration-no-image-available-icon-vector.jpg"
 | 
				
			||||||
                          />
 | 
					                                  }
 | 
				
			||||||
                        )):""}
 | 
					                                  style={{ width: "10vw", marginRight: 15 }}
 | 
				
			||||||
 | 
					                                />
 | 
				
			||||||
 | 
					                              )
 | 
				
			||||||
 | 
					                            )
 | 
				
			||||||
 | 
					                          : ""}
 | 
				
			||||||
                      </Row>
 | 
					                      </Row>
 | 
				
			||||||
                    </Text>
 | 
					                    </Text>
 | 
				
			||||||
                  </Col>
 | 
					                  </Col>
 | 
				
			||||||
@@ -815,7 +823,8 @@ export const DetailUser = observer(() => {
 | 
				
			|||||||
                                description={
 | 
					                                description={
 | 
				
			||||||
                                  <div style={{}}>
 | 
					                                  <div style={{}}>
 | 
				
			||||||
                                    <p>
 | 
					                                    <p>
 | 
				
			||||||
                                    <small>Pembeli : {item.buyer}</small> <br />
 | 
					                                      <small>Pembeli : {item.buyer}</small>{" "}
 | 
				
			||||||
 | 
					                                      <br />
 | 
				
			||||||
                                      <small>Price : {item.price}</small> <br />
 | 
					                                      <small>Price : {item.price}</small> <br />
 | 
				
			||||||
                                      <small>
 | 
					                                      <small>
 | 
				
			||||||
                                        Tujuan : {item.transaction_destination}
 | 
					                                        Tujuan : {item.transaction_destination}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,7 @@
 | 
				
			|||||||
import React, { useState } from "react";
 | 
					import React from "react";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  Form,
 | 
					 | 
				
			||||||
  Input,
 | 
					 | 
				
			||||||
  Modal,
 | 
					  Modal,
 | 
				
			||||||
  Select,
 | 
					  Select,
 | 
				
			||||||
  InputNumber,
 | 
					 | 
				
			||||||
  Row,
 | 
					  Row,
 | 
				
			||||||
  Title,
 | 
					  Title,
 | 
				
			||||||
  Col,
 | 
					  Col,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -80,18 +80,26 @@ export const Konfirmasi = observer(() => {
 | 
				
			|||||||
      title: "Foto Identitas",
 | 
					      title: "Foto Identitas",
 | 
				
			||||||
      dataIndex: ["user_detail", "image_identity"],
 | 
					      dataIndex: ["user_detail", "image_identity"],
 | 
				
			||||||
      key: "user_detail.image_identity",
 | 
					      key: "user_detail.image_identity",
 | 
				
			||||||
      render: (text, record) => (
 | 
					      render: (text, record) =>
 | 
				
			||||||
        <Image
 | 
					        record.user_detail?.image_identity ? (
 | 
				
			||||||
          src={`${appConfig.apiUrl}/config/image/${text}`}
 | 
					          <Image
 | 
				
			||||||
          style={{ width: "5vw" }}
 | 
					            src={`${appConfig.apiUrl}/config/image/${text}`}
 | 
				
			||||||
          alt={record.image_identity}
 | 
					            style={{ width: "5vw" }}
 | 
				
			||||||
        />
 | 
					            alt={record.image_identity}
 | 
				
			||||||
      ),
 | 
					          />
 | 
				
			||||||
 | 
					        ) : (
 | 
				
			||||||
 | 
					          <Image
 | 
				
			||||||
 | 
					            src="https://st4.depositphotos.com/14953852/24787/v/600/depositphotos_247872612-stock-illustration-no-image-available-icon-vector.jpg"
 | 
				
			||||||
 | 
					            style={{ width: "5vw" }}
 | 
				
			||||||
 | 
					          />
 | 
				
			||||||
 | 
					        ),
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      title: "Foto Toko",
 | 
					      title: "Foto Toko",
 | 
				
			||||||
      render: (text, record) =>
 | 
					      render: (text, record) =>
 | 
				
			||||||
        record.user_detail?.image_store !== "\"\"" ? (
 | 
					        record.roles?.name !== "Sales" &&
 | 
				
			||||||
 | 
					        record.user_detail?.image_store !== "[]" &&
 | 
				
			||||||
 | 
					        record.user_detail?.image_store !== '""' ? (
 | 
				
			||||||
          <Button
 | 
					          <Button
 | 
				
			||||||
            onClick={async () => {
 | 
					            onClick={async () => {
 | 
				
			||||||
              setToko(record);
 | 
					              setToko(record);
 | 
				
			||||||
@@ -223,6 +231,7 @@ export const Konfirmasi = observer(() => {
 | 
				
			|||||||
    modalLoader.setLoading(false);
 | 
					    modalLoader.setLoading(false);
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //if (store.approval.user_detail.image_store === []) delete columns[2];
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <div className={["ppob-container"].join(" ")}>
 | 
					    <div className={["ppob-container"].join(" ")}>
 | 
				
			||||||
      <BreadcumbComponent
 | 
					      <BreadcumbComponent
 | 
				
			||||||
@@ -378,21 +387,25 @@ export const Konfirmasi = observer(() => {
 | 
				
			|||||||
                              >
 | 
					                              >
 | 
				
			||||||
                                Foto Identitas
 | 
					                                Foto Identitas
 | 
				
			||||||
                              </Button>
 | 
					                              </Button>
 | 
				
			||||||
                              <Button
 | 
					                              {item.user_detail?.image_store !== '""' ? (
 | 
				
			||||||
                                style={
 | 
					                                <Button
 | 
				
			||||||
                                  item.is_active === true
 | 
					                                  style={
 | 
				
			||||||
                                    ? {
 | 
					                                    item.is_active === true
 | 
				
			||||||
                                        marginLeft: 10,
 | 
					                                      ? {
 | 
				
			||||||
                                      }
 | 
					                                          marginLeft: 10,
 | 
				
			||||||
                                    : { marginTop: 10 }
 | 
					                                        }
 | 
				
			||||||
                                }
 | 
					                                      : { marginTop: 10 }
 | 
				
			||||||
                                onClick={async () => {
 | 
					                                  }
 | 
				
			||||||
                                  setToko(item);
 | 
					                                  onClick={async () => {
 | 
				
			||||||
                                  setVisibleModalToko(true);
 | 
					                                    setToko(item);
 | 
				
			||||||
                                }}
 | 
					                                    setVisibleModalToko(true);
 | 
				
			||||||
                              >
 | 
					                                  }}
 | 
				
			||||||
                                Foto Toko
 | 
					                                >
 | 
				
			||||||
                              </Button>
 | 
					                                  Foto Toko
 | 
				
			||||||
 | 
					                                </Button>
 | 
				
			||||||
 | 
					                              ) : (
 | 
				
			||||||
 | 
					                                ""
 | 
				
			||||||
 | 
					                              )}
 | 
				
			||||||
                            </p>
 | 
					                            </p>
 | 
				
			||||||
                          </div>
 | 
					                          </div>
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
@@ -449,7 +462,7 @@ export const Konfirmasi = observer(() => {
 | 
				
			|||||||
        ) : (
 | 
					        ) : (
 | 
				
			||||||
          <Image
 | 
					          <Image
 | 
				
			||||||
            src={`${appConfig.apiUrl}/config/image/${identitas.user_detail?.image_identity}`}
 | 
					            src={`${appConfig.apiUrl}/config/image/${identitas.user_detail?.image_identity}`}
 | 
				
			||||||
            alt={identitas.id}
 | 
					            alt="No image"
 | 
				
			||||||
            preview={false}
 | 
					            preview={false}
 | 
				
			||||||
          />
 | 
					          />
 | 
				
			||||||
        )}
 | 
					        )}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -299,7 +299,7 @@ export const Membership = observer(() => {
 | 
				
			|||||||
          ? message.success(
 | 
					          ? message.success(
 | 
				
			||||||
              response?.body?.message || "Berhasil Tambah Member Baru"
 | 
					              response?.body?.message || "Berhasil Tambah Member Baru"
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
          : message.error(response?.body?.error || "Gagal Tambah Member Baru");
 | 
					          : message.error(response?.body?.error || "Gagal");
 | 
				
			||||||
        await getData();
 | 
					        await getData();
 | 
				
			||||||
      } catch (e) {
 | 
					      } catch (e) {
 | 
				
			||||||
        console.log(e, "apa errornya");
 | 
					        console.log(e, "apa errornya");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -319,7 +319,13 @@ export const MembershipModal = ({
 | 
				
			|||||||
                  }}
 | 
					                  }}
 | 
				
			||||||
                />
 | 
					                />
 | 
				
			||||||
              </Form.Item>
 | 
					              </Form.Item>
 | 
				
			||||||
              <Form.Item label="Upload Identity Image" name="image_identity">
 | 
					              <Form.Item
 | 
				
			||||||
 | 
					                label="Upload identity image"
 | 
				
			||||||
 | 
					                name="image_identity"
 | 
				
			||||||
 | 
					                rules={[
 | 
				
			||||||
 | 
					                  { required: true, message: "Please insert image identity" },
 | 
				
			||||||
 | 
					                ]}
 | 
				
			||||||
 | 
					              >
 | 
				
			||||||
                <div>
 | 
					                <div>
 | 
				
			||||||
                  <Upload
 | 
					                  <Upload
 | 
				
			||||||
                    listType="picture-card"
 | 
					                    listType="picture-card"
 | 
				
			||||||
@@ -399,7 +405,13 @@ export const MembershipModal = ({
 | 
				
			|||||||
                  }}
 | 
					                  }}
 | 
				
			||||||
                />
 | 
					                />
 | 
				
			||||||
              </Form.Item>
 | 
					              </Form.Item>
 | 
				
			||||||
              <Form.Item label="Upload Identity Image" name="image_identity">
 | 
					              <Form.Item
 | 
				
			||||||
 | 
					                label="Upload identity image"
 | 
				
			||||||
 | 
					                name="image_identity"
 | 
				
			||||||
 | 
					                rules={[
 | 
				
			||||||
 | 
					                  { required: true, message: "Please insert image identity" },
 | 
				
			||||||
 | 
					                ]}
 | 
				
			||||||
 | 
					              >
 | 
				
			||||||
                <div>
 | 
					                <div>
 | 
				
			||||||
                  <Upload
 | 
					                  <Upload
 | 
				
			||||||
                    listType="picture-card"
 | 
					                    listType="picture-card"
 | 
				
			||||||
@@ -482,7 +494,13 @@ export const MembershipModal = ({
 | 
				
			|||||||
                  }}
 | 
					                  }}
 | 
				
			||||||
                />
 | 
					                />
 | 
				
			||||||
              </Form.Item>
 | 
					              </Form.Item>
 | 
				
			||||||
              <Form.Item label="Upload Identity Image" name="image_identity">
 | 
					              <Form.Item
 | 
				
			||||||
 | 
					                label="Upload identity image"
 | 
				
			||||||
 | 
					                name="image_identity"
 | 
				
			||||||
 | 
					                rules={[
 | 
				
			||||||
 | 
					                  { required: true, message: "Please insert image identity" },
 | 
				
			||||||
 | 
					                ]}
 | 
				
			||||||
 | 
					              >
 | 
				
			||||||
                <div>
 | 
					                <div>
 | 
				
			||||||
                  <Upload
 | 
					                  <Upload
 | 
				
			||||||
                    listType="picture-card"
 | 
					                    listType="picture-card"
 | 
				
			||||||
@@ -525,7 +543,13 @@ export const MembershipModal = ({
 | 
				
			|||||||
                  </h5>
 | 
					                  </h5>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
              </Form.Item>
 | 
					              </Form.Item>
 | 
				
			||||||
              <Form.Item label="Upload Store Image" name="image_store">
 | 
					              <Form.Item
 | 
				
			||||||
 | 
					                label="Upload foto toko tampak samping kanan,kiri dan depan"
 | 
				
			||||||
 | 
					                name="image_store"
 | 
				
			||||||
 | 
					                rules={[
 | 
				
			||||||
 | 
					                  { required: true, message: "Please insert image store" },
 | 
				
			||||||
 | 
					                ]}
 | 
				
			||||||
 | 
					              >
 | 
				
			||||||
                <div>
 | 
					                <div>
 | 
				
			||||||
                  <Upload
 | 
					                  <Upload
 | 
				
			||||||
                    listType="picture-card"
 | 
					                    listType="picture-card"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,15 +5,12 @@ import {
 | 
				
			|||||||
  Col,
 | 
					  Col,
 | 
				
			||||||
  Divider,
 | 
					  Divider,
 | 
				
			||||||
  Image,
 | 
					  Image,
 | 
				
			||||||
  Input,
 | 
					 | 
				
			||||||
  List,
 | 
					  List,
 | 
				
			||||||
  message,
 | 
					  message,
 | 
				
			||||||
  DatePicker,
 | 
					  DatePicker,
 | 
				
			||||||
  Row,
 | 
					  Row,
 | 
				
			||||||
  Table,
 | 
					  Table,
 | 
				
			||||||
  Tag,
 | 
					  Tag,
 | 
				
			||||||
  Typography,
 | 
					 | 
				
			||||||
  Select,
 | 
					 | 
				
			||||||
  Form,
 | 
					  Form,
 | 
				
			||||||
  Modal,
 | 
					  Modal,
 | 
				
			||||||
} from "antd";
 | 
					} from "antd";
 | 
				
			||||||
@@ -28,7 +25,6 @@ import { appConfig } from "../../config/app";
 | 
				
			|||||||
import { PAYBACK_STATUS } from "../../constants/payback";
 | 
					import { PAYBACK_STATUS } from "../../constants/payback";
 | 
				
			||||||
import moment from "moment";
 | 
					import moment from "moment";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
export const PaybackCreated = observer(() => {
 | 
					export const PaybackCreated = observer(() => {
 | 
				
			||||||
  const [form] = Form.useForm();
 | 
					  const [form] = Form.useForm();
 | 
				
			||||||
  const store = useStore();
 | 
					  const store = useStore();
 | 
				
			||||||
@@ -128,7 +124,7 @@ export const PaybackCreated = observer(() => {
 | 
				
			|||||||
  const dataRoute = [
 | 
					  const dataRoute = [
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      route: LINKS.PAYBACK_CREATED,
 | 
					      route: LINKS.PAYBACK_CREATED,
 | 
				
			||||||
      name: "Buat Pembayaran"
 | 
					      name: "Buat Pembayaran",
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -150,14 +146,12 @@ export const PaybackCreated = observer(() => {
 | 
				
			|||||||
  const handleSubmitFilter = async () => {
 | 
					  const handleSubmitFilter = async () => {
 | 
				
			||||||
    const data = form.getFieldsValue();
 | 
					    const data = form.getFieldsValue();
 | 
				
			||||||
    console.log(data);
 | 
					    console.log(data);
 | 
				
			||||||
    const awal = (store.payback.filterStart = moment(data.start_date).format(
 | 
					    store.payback.filterStart = moment(data.start_date).format(
 | 
				
			||||||
      "YYYY-MM-DD 00:00:00"
 | 
					      "YYYY-MM-DD 00:00:00"
 | 
				
			||||||
    ));
 | 
					    );
 | 
				
			||||||
    const akhir = (store.payback.filterEnd = moment(data.end_date).format(
 | 
					    store.payback.filterEnd = moment(data.end_date).format(
 | 
				
			||||||
      "YYYY-MM-DD HH:mm:ss"
 | 
					      "YYYY-MM-DD HH:mm:ss"
 | 
				
			||||||
    ));
 | 
					    );
 | 
				
			||||||
    console.log(awal);
 | 
					 | 
				
			||||||
    console.log(akhir);
 | 
					 | 
				
			||||||
    modalLoader.setLoading(true);
 | 
					    modalLoader.setLoading(true);
 | 
				
			||||||
    await store.payback.getDataCreated();
 | 
					    await store.payback.getDataCreated();
 | 
				
			||||||
    modalLoader.setLoading(false);
 | 
					    modalLoader.setLoading(false);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,8 +8,6 @@ import {LINKS} from "../../routes/app";
 | 
				
			|||||||
import {CategoryComponent} from "../../component/CategoryComponent";
 | 
					import {CategoryComponent} from "../../component/CategoryComponent";
 | 
				
			||||||
import {ModalLoaderContext} from "../../utils/modal";
 | 
					import {ModalLoaderContext} from "../../utils/modal";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const {TabPane} = Tabs;
 | 
					 | 
				
			||||||
const {Search} = Input;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const Category = observer(() => {
 | 
					export const Category = observer(() => {
 | 
				
			||||||
  const store = useStore();
 | 
					  const store = useStore();
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										213
									
								
								src/pages/Product/PulsaModal.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										213
									
								
								src/pages/Product/PulsaModal.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,213 @@
 | 
				
			|||||||
 | 
					// import React,{useEffect,useState} from "react";
 | 
				
			||||||
 | 
					// import { Form, Input, Modal, Select } from "antd";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// export const PulsaModal =  ({ visible, onCreate, onCancel, initialData }) => {
 | 
				
			||||||
 | 
					//   const [form] = Form.useForm();
 | 
				
			||||||
 | 
					//   const { Option } = Select;
 | 
				
			||||||
 | 
					// const [visibleModal, setVisibleModal] = useState(false)
 | 
				
			||||||
 | 
					//   const [initialData, setInitialData] = useState({})
 | 
				
			||||||
 | 
					//   const [confirmLoading, setConfirmLoading] = useState(false);
 | 
				
			||||||
 | 
					//   const [isLoading, setIsLoading] = useState(false);
 | 
				
			||||||
 | 
					//   useEffect(() => {
 | 
				
			||||||
 | 
					//     const init = async () => {
 | 
				
			||||||
 | 
					//       try {
 | 
				
			||||||
 | 
					//         setIsLoading(true);
 | 
				
			||||||
 | 
					//         await store.categories.getData();
 | 
				
			||||||
 | 
					//         setIsLoading(false);
 | 
				
			||||||
 | 
					//       } catch (e) {
 | 
				
			||||||
 | 
					//         setIsLoading(false);
 | 
				
			||||||
 | 
					//       }
 | 
				
			||||||
 | 
					//     };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//     init();
 | 
				
			||||||
 | 
					//   }, []);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//   return (
 | 
				
			||||||
 | 
					//     <Modal
 | 
				
			||||||
 | 
					//     visible={visibleModal}
 | 
				
			||||||
 | 
					//                          confirmLoading={confirmLoading}
 | 
				
			||||||
 | 
					//                          initialData={initialData}
 | 
				
			||||||
 | 
					//                          onCreate={async (data) => {
 | 
				
			||||||
 | 
					//                            onSubmit(data)
 | 
				
			||||||
 | 
					//                          }}
 | 
				
			||||||
 | 
					//                          onCancel={() => {
 | 
				
			||||||
 | 
					//                            setInitialData({})
 | 
				
			||||||
 | 
					//                            setVisibleModal(false);
 | 
				
			||||||
 | 
					//                          }}
 | 
				
			||||||
 | 
					//       visible={visible}
 | 
				
			||||||
 | 
					//       title={initialData.id ? "Edit Member" : "Create a new Member"}
 | 
				
			||||||
 | 
					//       okText={initialData.id ? "Edit" : "Create"}
 | 
				
			||||||
 | 
					//       cancelText="Cancel"
 | 
				
			||||||
 | 
					//       onCancel={() => {
 | 
				
			||||||
 | 
					//         form.resetFields();
 | 
				
			||||||
 | 
					//         onCancel();
 | 
				
			||||||
 | 
					//       }}
 | 
				
			||||||
 | 
					//       onOk={() => {
 | 
				
			||||||
 | 
					//         form
 | 
				
			||||||
 | 
					//           .validateFields()
 | 
				
			||||||
 | 
					//           .then((values) => {
 | 
				
			||||||
 | 
					//             onCreate(values);
 | 
				
			||||||
 | 
					//             form.resetFields();
 | 
				
			||||||
 | 
					//           })
 | 
				
			||||||
 | 
					//           .catch((info) => {
 | 
				
			||||||
 | 
					//             console.log("Validate Failed:", info);
 | 
				
			||||||
 | 
					//           });
 | 
				
			||||||
 | 
					//       }}
 | 
				
			||||||
 | 
					//     >
 | 
				
			||||||
 | 
					//       <Form
 | 
				
			||||||
 | 
					//         form={form}
 | 
				
			||||||
 | 
					//         layout="vertical"
 | 
				
			||||||
 | 
					//         name="form_in_modal"
 | 
				
			||||||
 | 
					//         initialValues={initialData}
 | 
				
			||||||
 | 
					//       >
 | 
				
			||||||
 | 
					//         <Form.Item
 | 
				
			||||||
 | 
					//           name="name"
 | 
				
			||||||
 | 
					//           label="Name"
 | 
				
			||||||
 | 
					//           rules={[{ required: true, message: "Please input name!" }]}
 | 
				
			||||||
 | 
					//         >
 | 
				
			||||||
 | 
					//           <Input />
 | 
				
			||||||
 | 
					//         </Form.Item>
 | 
				
			||||||
 | 
					//         <Form.Item
 | 
				
			||||||
 | 
					//           name="price"
 | 
				
			||||||
 | 
					//           label="Price"
 | 
				
			||||||
 | 
					//           rules={[{ required: true, message: "Please input price!" }]}
 | 
				
			||||||
 | 
					//         >
 | 
				
			||||||
 | 
					//           <Input />
 | 
				
			||||||
 | 
					//         </Form.Item>
 | 
				
			||||||
 | 
					//         <Form.Item
 | 
				
			||||||
 | 
					//           name="markUpPrice"
 | 
				
			||||||
 | 
					//           label="Mark Up Price"
 | 
				
			||||||
 | 
					//           rules={[{ required: true, message: "Please input mark up price!" }]}
 | 
				
			||||||
 | 
					//         >
 | 
				
			||||||
 | 
					//           <Input />
 | 
				
			||||||
 | 
					//         </Form.Item>
 | 
				
			||||||
 | 
					//         <Form.Item
 | 
				
			||||||
 | 
					//           name="code"
 | 
				
			||||||
 | 
					//           label="Code"
 | 
				
			||||||
 | 
					//           rules={[{ required: true, message: "Please input code!" }]}
 | 
				
			||||||
 | 
					//         >
 | 
				
			||||||
 | 
					//           <Input />
 | 
				
			||||||
 | 
					//         </Form.Item>
 | 
				
			||||||
 | 
					//         <Form.Item
 | 
				
			||||||
 | 
					//           name="status"
 | 
				
			||||||
 | 
					//           label="Status"
 | 
				
			||||||
 | 
					//           rules={[{ required: true, message: "Please select Status!" }]}
 | 
				
			||||||
 | 
					//         >
 | 
				
			||||||
 | 
					//           <Select placeholder="Select Status" allowClear>
 | 
				
			||||||
 | 
					//           {store.categories.map(it => {
 | 
				
			||||||
 | 
					//                             return <Option value={it.id}>{it.name}</Option>
 | 
				
			||||||
 | 
					//                         })}
 | 
				
			||||||
 | 
					//           </Select>
 | 
				
			||||||
 | 
					//         </Form.Item>
 | 
				
			||||||
 | 
					//       </Form>
 | 
				
			||||||
 | 
					//     </Modal>
 | 
				
			||||||
 | 
					//   );
 | 
				
			||||||
 | 
					// };
 | 
				
			||||||
 | 
					import React, { useState, useEffect } from "react";
 | 
				
			||||||
 | 
					import { Form, Input, Modal, Select } from "antd";
 | 
				
			||||||
 | 
					import { useStore } from "../../utils/useStore";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const PulsaModal = ({ visible, onCreate, onCancel }) => {
 | 
				
			||||||
 | 
					  const [form] = Form.useForm();
 | 
				
			||||||
 | 
					  const { Option } = Select;
 | 
				
			||||||
 | 
					  const dataStatus = ["Active", "Inactive"];
 | 
				
			||||||
 | 
					  const store = useStore();
 | 
				
			||||||
 | 
					  const [visibleModal, setVisibleModal] = useState(false);
 | 
				
			||||||
 | 
					  const [initialData, setInitialData] = useState({});
 | 
				
			||||||
 | 
					  const [confirmLoading, setConfirmLoading] = useState(false);
 | 
				
			||||||
 | 
					  const [isLoading, setIsLoading] = useState(false);
 | 
				
			||||||
 | 
					  const init = async () => {
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					      setIsLoading(true);
 | 
				
			||||||
 | 
					      await store.categories.getData();
 | 
				
			||||||
 | 
					      setIsLoading(false);
 | 
				
			||||||
 | 
					    } catch (e) {
 | 
				
			||||||
 | 
					      setIsLoading(false);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  useEffect(() => {
 | 
				
			||||||
 | 
					    init();
 | 
				
			||||||
 | 
					  }, []);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return (
 | 
				
			||||||
 | 
					    <Modal
 | 
				
			||||||
 | 
					      visible={visible}
 | 
				
			||||||
 | 
					      title={initialData.id ? "Edit Member" : "Create a new Member"}
 | 
				
			||||||
 | 
					      okText={initialData.id ? "Edit" : "Create"}
 | 
				
			||||||
 | 
					      cancelText="Cancel"
 | 
				
			||||||
 | 
					      onCancel={() => {
 | 
				
			||||||
 | 
					        form.resetFields();
 | 
				
			||||||
 | 
					        onCancel();
 | 
				
			||||||
 | 
					      }}
 | 
				
			||||||
 | 
					      onOk={() => {
 | 
				
			||||||
 | 
					        form
 | 
				
			||||||
 | 
					          .validateFields()
 | 
				
			||||||
 | 
					          .then((values) => {
 | 
				
			||||||
 | 
					            onCreate(values);
 | 
				
			||||||
 | 
					            form.resetFields();
 | 
				
			||||||
 | 
					          })
 | 
				
			||||||
 | 
					          .catch((info) => {
 | 
				
			||||||
 | 
					            console.log("Validate Failed:", info);
 | 
				
			||||||
 | 
					          });
 | 
				
			||||||
 | 
					      }}
 | 
				
			||||||
 | 
					    >
 | 
				
			||||||
 | 
					      <Form
 | 
				
			||||||
 | 
					        form={form}
 | 
				
			||||||
 | 
					        layout="vertical"
 | 
				
			||||||
 | 
					        name="form_in_modal"
 | 
				
			||||||
 | 
					        initialValues={initialData}
 | 
				
			||||||
 | 
					      >
 | 
				
			||||||
 | 
					        <Form.Item
 | 
				
			||||||
 | 
					          name="name"
 | 
				
			||||||
 | 
					          label="Name"
 | 
				
			||||||
 | 
					          rules={[{ required: true, message: "Please input name!" }]}
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					          <Input />
 | 
				
			||||||
 | 
					        </Form.Item>
 | 
				
			||||||
 | 
					        <Form.Item
 | 
				
			||||||
 | 
					          name="price"
 | 
				
			||||||
 | 
					          label="Price"
 | 
				
			||||||
 | 
					          rules={[{ required: true, message: "Please input price!" }]}
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					          <Input />
 | 
				
			||||||
 | 
					        </Form.Item>
 | 
				
			||||||
 | 
					        <Form.Item
 | 
				
			||||||
 | 
					          name="markUpPrice"
 | 
				
			||||||
 | 
					          label="Mark Up Price"
 | 
				
			||||||
 | 
					          rules={[{ required: true, message: "Please input mark up price!" }]}
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					          <Input />
 | 
				
			||||||
 | 
					        </Form.Item>
 | 
				
			||||||
 | 
					        <Form.Item
 | 
				
			||||||
 | 
					          name="code"
 | 
				
			||||||
 | 
					          label="Code"
 | 
				
			||||||
 | 
					          rules={[{ required: true, message: "Please input code!" }]}
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					          <Input />
 | 
				
			||||||
 | 
					        </Form.Item>
 | 
				
			||||||
 | 
					        <Form.Item
 | 
				
			||||||
 | 
					          name="status"
 | 
				
			||||||
 | 
					          label="Status"
 | 
				
			||||||
 | 
					          rules={[{ required: true, message: "Please select Status!" }]}
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					          <Select placeholder="Select Sub Category" allowClear>
 | 
				
			||||||
 | 
					            <Option value="ACTIVE">ACTIVE</Option>
 | 
				
			||||||
 | 
					            <Option value="INACTIVE">INACTIVE</Option>
 | 
				
			||||||
 | 
					          </Select>
 | 
				
			||||||
 | 
					        </Form.Item>
 | 
				
			||||||
 | 
					        <Form.Item
 | 
				
			||||||
 | 
					          name="subCategoriesId"
 | 
				
			||||||
 | 
					          label="Sub Categories"
 | 
				
			||||||
 | 
					          rules={[{ required: true, message: "Please select Sub Category!" }]}
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					          <Select placeholder="Select Sub Category" allowClear>
 | 
				
			||||||
 | 
					            {store.categories.data.map((it) => {
 | 
				
			||||||
 | 
					              return <Option value={it.id}>{it.name}</Option>;
 | 
				
			||||||
 | 
					            })}
 | 
				
			||||||
 | 
					          </Select>
 | 
				
			||||||
 | 
					        </Form.Item>
 | 
				
			||||||
 | 
					      </Form>
 | 
				
			||||||
 | 
					    </Modal>
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
							
								
								
									
										40
									
								
								src/store/categories.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								src/store/categories.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					import {action, makeAutoObservable} from "mobx";
 | 
				
			||||||
 | 
					import {http} from "../utils/http";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export class Categories {
 | 
				
			||||||
 | 
					    page = 0;
 | 
				
			||||||
 | 
					    pageSize = 10
 | 
				
			||||||
 | 
					    data = [];
 | 
				
			||||||
 | 
					    total_data = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    constructor(ctx) {
 | 
				
			||||||
 | 
					        this.ctx = ctx;
 | 
				
			||||||
 | 
					        makeAutoObservable(this);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @action
 | 
				
			||||||
 | 
					    async getData() {
 | 
				
			||||||
 | 
					        const response = await http.get(`/product/sub-categories?page=${this.page}&pageSize=${this.pageSize}`);
 | 
				
			||||||
 | 
					        console.log(response,'Data cate')
 | 
				
			||||||
 | 
					        console.log(JSON.stringify(response.body.data),'Data')
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        this.data = response.body.data ?? []
 | 
				
			||||||
 | 
					        this.total_data = response.body.total_data ?? 0
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @action
 | 
				
			||||||
 | 
					    async create(data) {
 | 
				
			||||||
 | 
					        return await http.post('/user').send(data)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @action
 | 
				
			||||||
 | 
					    async update(id, data) {
 | 
				
			||||||
 | 
					        return await http.put('/user/' + id).send(data);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    async delete(id) {
 | 
				
			||||||
 | 
					        return await http.del('/product/' + id);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -4059,6 +4059,11 @@ dayjs@1.x:
 | 
				
			|||||||
  resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.7.tgz#2cf5f91add28116748440866a0a1d26f3a6ce468"
 | 
					  resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.7.tgz#2cf5f91add28116748440866a0a1d26f3a6ce468"
 | 
				
			||||||
  integrity sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig==
 | 
					  integrity sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					date-fns@^2.27.0:
 | 
				
			||||||
 | 
					  version "2.27.0"
 | 
				
			||||||
 | 
					  resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.27.0.tgz#e1ff3c3ddbbab8a2eaadbb6106be2929a5a2d92b"
 | 
				
			||||||
 | 
					  integrity sha512-sj+J0Mo2p2X1e306MHq282WS4/A8Pz/95GIFcsPNMPMZVI3EUrAdSv90al1k+p74WGLCruMXk23bfEDZa71X9Q==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9:
 | 
					debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9:
 | 
				
			||||||
  version "2.6.9"
 | 
					  version "2.6.9"
 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
 | 
					  resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user