From 4596eba8a4c7656f3b6918d87fc05dbd86145b2b Mon Sep 17 00:00:00 2001 From: sanaya Date: Thu, 10 Feb 2022 15:08:22 +0530 Subject: [PATCH] updated --- src/views/AirwaysBill/AddAirwaysBill.js | 85 +++++++++++--------- src/views/AirwaysBill/AirwayBillDetail.js | 95 ++++++++++++++++++++--- src/views/AirwaysBill/AirwaysBill.js | 26 +++++-- 3 files changed, 154 insertions(+), 52 deletions(-) diff --git a/src/views/AirwaysBill/AddAirwaysBill.js b/src/views/AirwaysBill/AddAirwaysBill.js index 83ed417..c4e8290 100644 --- a/src/views/AirwaysBill/AddAirwaysBill.js +++ b/src/views/AirwaysBill/AddAirwaysBill.js @@ -27,17 +27,31 @@ const AddAirwaysBill = () => { const { token } = isAutheticated() const countries = Country.getAllCountries(); const [bill, setBill] = useState({ - vendor_name: '', - city: '', - state: 'Andhra Pradesh', + AWB_No: '', + Actual_Billing: '', + Actual_Margin: 'Andhra Pradesh', country: 'India', - from_address_1: '', - from_address_2: '', - to_address_1: '', - to_name: '', - to_address_2: '', - AWB: '', - courier: '' + Actual_Weight: '', + Client_Name: '', + Customer_Address: "", + Customer_Billing: "", + Customer_Name: "", + Customer_Phone: "", + Date_Of_Dispatch: "", + Dimension_Weight: "", + Dimensions: "", + Invoice_No: "", + Item_Name: "" + , Logistic_Name: "", + Order_No: "", + Projected_Margin: "", + Recieved_Amount: "", + Recieved_Date: "", + Shipment_Charges: "", + Shipments: "", + Shipped_From: "", + Sr_No: "", + Total_Weight: "", }) const [showCouriers, setShowCouriers] = useState([]) const [showVendors, setShowVendors] = useState([]) @@ -114,6 +128,7 @@ const AddAirwaysBill = () => { Swal("Oops!", "Something went wrong!", "error"); } } + console.log(bill); return
@@ -216,7 +231,7 @@ const AddAirwaysBill = () => { type="text" placeholder="AWB" autoComplete="AWB" - onChange={handleChange('AWB')} + onChange={handleChange('AWB_No')} /> @@ -228,7 +243,7 @@ const AddAirwaysBill = () => { placeholder="Order No " autoComplete="AWB" - // onChange={handleChange('Order_No')} + onChange={handleChange('Order_No')} /> @@ -239,7 +254,7 @@ const AddAirwaysBill = () => { type="text" placeholder="Client Name" autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange(' Client_Name')} /> @@ -250,7 +265,7 @@ const AddAirwaysBill = () => { type="text" placeholder="Item Name" autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Item_Name')} /> @@ -261,7 +276,7 @@ const AddAirwaysBill = () => { type="text" placeholder="Customer Name" autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Customer_Name')} /> @@ -272,7 +287,7 @@ const AddAirwaysBill = () => { type="text" placeholder="Customer Phone" autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange(' Customer_Phone')} /> @@ -283,7 +298,7 @@ const AddAirwaysBill = () => { type="text" placeholder="Customer Address" autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Customer_Address')} /> @@ -292,7 +307,7 @@ const AddAirwaysBill = () => { { countries.map((item) => @@ -310,7 +325,7 @@ const AddAirwaysBill = () => { type="text" placeholder="Shipped From" autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Shipped_From')} /> @@ -322,7 +337,7 @@ const AddAirwaysBill = () => { placeholder="Logistic Name " autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Logistic_Name')} /> @@ -330,11 +345,11 @@ const AddAirwaysBill = () => { @@ -346,7 +361,7 @@ const AddAirwaysBill = () => { placeholder="Shipments " autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Shipments')} /> @@ -358,7 +373,7 @@ const AddAirwaysBill = () => { placeholder="Dimensions " autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Dimensions')} /> @@ -370,7 +385,7 @@ const AddAirwaysBill = () => { placeholder="Dimenssion Weight " autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Dimension_Weight')} /> @@ -382,7 +397,7 @@ const AddAirwaysBill = () => { placeholder="Actual Weight " autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Actual_Weight')} /> @@ -394,7 +409,7 @@ const AddAirwaysBill = () => { placeholder="Total Weight " autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('AWB')} /> @@ -406,7 +421,7 @@ const AddAirwaysBill = () => { placeholder="Shipment Charges " autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Shipment_Charges')} /> @@ -418,7 +433,7 @@ const AddAirwaysBill = () => { placeholder="Actual Billing " autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Actual_Billing')} /> @@ -430,7 +445,7 @@ const AddAirwaysBill = () => { placeholder="Customer Billing " autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Customer_Billing')} /> @@ -442,7 +457,7 @@ const AddAirwaysBill = () => { placeholder="Projceted Margin " autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Projected_Margin')} /> @@ -453,7 +468,7 @@ const AddAirwaysBill = () => { type="text" placeholder="Actual Margin" autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Actual_Margin')} /> @@ -475,7 +490,7 @@ const AddAirwaysBill = () => { type="text" placeholder="Received Amount" autoComplete="AWB" - // onChange={handleChange('AWB')} + onChange={handleChange('Invoice_No')} /> @@ -484,10 +499,10 @@ const AddAirwaysBill = () => { diff --git a/src/views/AirwaysBill/AirwayBillDetail.js b/src/views/AirwaysBill/AirwayBillDetail.js index 9eca441..71e9600 100644 --- a/src/views/AirwaysBill/AirwayBillDetail.js +++ b/src/views/AirwaysBill/AirwayBillDetail.js @@ -57,29 +57,106 @@ const AirwayBillDetail = () => { - Code - {data.code} + Actual Billing + {data.Actual_Billing} AWB - {data.AWB} + {data.AWB_No} - Vendor Name - {data.vendor_name} + Actual Margin + {data.Actual_Margin} Added On {formatDate(data.createdAt)} - From Address - {data.from_address_1},{data.from_address_2},{data.city},{data.state},{data.country} + Actual_Weight + {data.Actual_Weight} - To Address - {data.to_address_1},{data.to_address_2} + Client Name + {data.Client_Name} + + Country + {data.Country} + + + Customer Address + {data.Customer_Address} + + + Customer_Billing + {data.Customer_Billing} + + + Customer_Name + {data.Customer_Name} + + + Customer_Phone + {data.Customer_Phone} + + + Date Of Dispatch + {formatDate(data.Date_Of_Dispatch)} + + + Dimension_Weight + {data.Dimension_Weight} + + + Dimensions + {data.Dimensions} + + + Invoice No + {data.Invoice_No} + + + Item_Name + {data.Item_Name} + + + Logistic_Name + {data.Logistic_Name} + + + Order_No + {data.Order_No} + + + Projected_Margin + {data.Projected_Margin} + + + Recieved_Amount + {data.Recieved_Amount} + + + Recieved_Date + {formatDate(data.Recieved_Date)} + + + Shipment_Charges + {data.Shipment_Charges} + + + Shipments + {data.Shipments} + + + Shipped_From + {data.Shipped_From} + + + Total_Weight + {data.Total_Weight} + +
; diff --git a/src/views/AirwaysBill/AirwaysBill.js b/src/views/AirwaysBill/AirwaysBill.js index 2c5ef92..57e8fcc 100644 --- a/src/views/AirwaysBill/AirwaysBill.js +++ b/src/views/AirwaysBill/AirwaysBill.js @@ -59,12 +59,22 @@ const AirwaysBill = () => { setFile(e.target.files[0]) } - const handleClick = () => { + const handleClick = async () => { - formData.append('file', file) + formData.append('file', file, file.name) console.log(...formData) + const res = await axios.post('/api/airways/upload', { file: formData }, { + headers: { + "Access-Control-Allow-Origin": "*", + 'Content-Type': 'multipart/form-data', + "Authorization": `Bearer ${token}` + } + }).catch(error => { + console.log(error); + }) + console.log(res) } console.log(file); @@ -105,17 +115,17 @@ const AirwaysBill = () => { {data.map(item => - {/* {item.code} - {item.vendor_name} - {formatDate(item.createdAt)} - {item.to_name} - {item.AWB} + {item.Order_No} + {item.Client_Name} + {item.Shipped_From} + {item.Logistic_Name} + {item.AWB_No} View - */} + )}