Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UI, hide menu, Shipping Zone update API #341

Merged
merged 5 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/aesirx-lib
Submodule aesirx-lib updated 45 files
+1 −1 package.json
+161 −0 src/Constant/PimConstant.ts
+2 −2 src/OrganisationChannel/OrganisationChannel.ts
+14 −4 src/OrganisationChannel/OrganisationChannelRoute.ts
+118 −0 src/Pim/PimCity/Model.ts
+69 −0 src/Pim/PimCity/Route.ts
+24 −0 src/Pim/PimCity/index.test.ts
+101 −0 src/Pim/PimCity/index.ts
+121 −0 src/Pim/PimCountry/Model.ts
+69 −0 src/Pim/PimCountry/Route.ts
+24 −0 src/Pim/PimCountry/index.test.ts
+101 −0 src/Pim/PimCountry/index.ts
+120 −0 src/Pim/PimCustomerGroup/Model.ts
+69 −0 src/Pim/PimCustomerGroup/Route.ts
+24 −0 src/Pim/PimCustomerGroup/index.test.ts
+101 −0 src/Pim/PimCustomerGroup/index.ts
+118 −0 src/Pim/PimRegion/Model.ts
+69 −0 src/Pim/PimRegion/Route.ts
+24 −0 src/Pim/PimRegion/index.test.ts
+101 −0 src/Pim/PimRegion/index.ts
+120 −0 src/Pim/PimShippingMethod/Model.ts
+69 −0 src/Pim/PimShippingMethod/Route.ts
+62 −0 src/Pim/PimShippingMethod/index.test.ts
+101 −0 src/Pim/PimShippingMethod/index.ts
+157 −0 src/Pim/PimShippingRate/Model.ts
+70 −0 src/Pim/PimShippingRate/Route.ts
+226 −0 src/Pim/PimShippingRate/index.test.ts
+101 −0 src/Pim/PimShippingRate/index.ts
+139 −0 src/Pim/PimShippingZone/Model.ts
+70 −0 src/Pim/PimShippingZone/Route.ts
+98 −0 src/Pim/PimShippingZone/index.test.ts
+101 −0 src/Pim/PimShippingZone/index.ts
+115 −0 src/Pim/PimState/Model.ts
+69 −0 src/Pim/PimState/Route.ts
+24 −0 src/Pim/PimState/index.test.ts
+101 −0 src/Pim/PimState/index.ts
+127 −0 src/Pim/PimTax/Model.ts
+69 −0 src/Pim/PimTax/Route.ts
+24 −0 src/Pim/PimTax/index.test.ts
+101 −0 src/Pim/PimTax/index.ts
+119 −0 src/Pim/PimTaxGroup/Model.ts
+69 −0 src/Pim/PimTaxGroup/Route.ts
+24 −0 src/Pim/PimTaxGroup/index.test.ts
+101 −0 src/Pim/PimTaxGroup/index.ts
+20 −0 src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const ListBrand = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_brand')}</h2>
<h2>{t('txt_left_menu_brand')}</h2>

<ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const ListCategories = observer((props) => {
<>
<div className="d-flex justify-content-between align-items-start mb-3">
<div>
<h2 className="fw-bold mb-1">{t('txt_categories')}</h2>
<h2 className="mb-1">{t('txt_categories')}</h2>
<div>{t('txt_categories_description')} </div>
</div>
<ActionsBar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CityListViewModel {
if (!data?.error) {
this.callbackOnSuccessGetCitysHandler(data?.response);
} else {
this.onErrorHandler(data?.response);
this.onErrorListHandler(data?.response);
}
this.successResponse.state = true;
});
Expand Down Expand Up @@ -127,6 +127,21 @@ class CityListViewModel {
this.formStatus = PAGE_STATUS.READY;
};

onErrorListHandler = (error) => {
if (error.code === 404) {
notify('Cannot create Shipping Zone for this State, please try others!', 'error');
this.successResponse.listCitysWithoutPagination = [];
} else {
Array.isArray(error?._messages) && error?._messages[0]?.message
? notify(error?._messages[0]?.message, 'error')
: error?.message && notify(error?.message, 'error');
}

this.successResponse.state = false;
this.successResponse.content_id = error?.result;
this.formStatus = PAGE_STATUS.READY;
};

transform = (data) => {
return data?.map((o) => {
const date = moment(o[PIM_CITY_DETAIL_FIELD_KEY.MODIFIED_TIME]).format('DD MMM, YYYY');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const ListCity = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_city')}</h2>
<h2>{t('txt_left_menu_city')}</h2>

{/* <ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const ListCountry = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_country')}</h2>
<h2>{t('txt_left_menu_country')}</h2>

{/* <ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const ListCustomerGroup = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_customer_group')}</h2>
<h2>{t('txt_left_menu_customer_group')}</h2>

{/* <ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const Dashboard = observer(
<div className="py-4 px-3 d-flex flex-column">
<div className="d-flex align-items-center justify-content-between mb-26 flex-wrap">
<div className="position-relative">
<h2 className="fw-bold mb-8px">{t('txt_dashboard')}</h2>
<h2 className="mb-8px">{t('txt_dashboard')}</h2>
<p className="mb-20px">{t('txt_dashboard_below')}</p>
</div>
<div style={{ height: '50px' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const ListDebtorGroup = observer((props) => {
return (
<>
<div className="d-flex justify-content-between align-items-start mb-3">
<h2 className="fw-bold mb-0">{t('txt_debtor_group')}</h2>
<h2 className="mb-0">{t('txt_debtor_group')}</h2>
<ActionsBar
buttons={[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const ListFieldsGroup = observer((props) => {
<>
<div className="d-flex justify-content-between align-items-start mb-3">
<div>
<h2 className="fw-bold mb-1">{t('txt_fields_group')}</h2>
<h2 className="mb-1">{t('txt_fields_group')}</h2>
<div>{t('txt_field_groups_description')}</div>
</div>
<ActionsBar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const ListFields = observer((props) => {
<>
<div className="d-flex justify-content-between align-items-start mb-3">
<div>
<h2 className="fw-bold mb-1">{t('txt_fields')}</h2>
<h2 className="mb-1">{t('txt_fields')}</h2>
<div>{t('txt_fields_description')}</div>
</div>
<ActionsBar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const ListFilteringField = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_filtering_field')}</h2>
<h2>{t('txt_left_menu_filtering_field')}</h2>

<ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const ListFilteringFieldset = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_filtering_fieldset')}</h2>
<h2>{t('txt_left_menu_filtering_fieldset')}</h2>

<ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const ListFilteringValue = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_filtering_value')}</h2>
<h2>{t('txt_left_menu_filtering_value')}</h2>

<ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const ListProductFieldValue = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_product_fieldvalue')}</h2>
<h2>{t('txt_left_menu_product_fieldvalue')}</h2>

<ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const ListProductPrice = observer((props) => {
return (
<>
<div className="d-flex justify-content-between align-items-start mb-3">
<h2 className="fw-bold mb-0">{t('txt_left_menu_price_management')}</h2>
<h2 className="mb-0">{t('txt_left_menu_price_management')}</h2>
<ActionsBar
buttons={[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const ListProductType = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_product_type')}</h2>
<h2>{t('txt_left_menu_product_type')}</h2>

<ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const ListProducts = observer((props) => {
return (
<>
<div className="d-flex justify-content-between align-items-start mb-3">
<h2 className="fw-bold mb-0">{t('txt_title_product_management')}</h2>
<h2 className="mb-0">{t('txt_title_product_management')}</h2>
<ActionsBar
buttons={[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const ListRegion = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_region')}</h2>
<h2>{t('txt_left_menu_region')}</h2>

{/* <ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const ListShippingMethod = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_shipping_method')}</h2>
<h2>{t('txt_left_menu_shipping_method')}</h2>

<ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const ListShippingRate = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_shipping_rate')}</h2>
<h2>{t('txt_left_menu_shipping_rate')}</h2>

<ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const ShippingRateInformation = observer(
validation: 'required',
placeholder: t('txt_select_shipping_method'),
className: 'col-lg-12',
isDisabled: isEdit ? true : false,
},
{
label: t('txt_shipping_zone'),
Expand Down Expand Up @@ -177,6 +178,7 @@ const ShippingRateInformation = observer(
validation: 'required',
placeholder: t('txt_select_shipping_zone'),
className: 'col-lg-12',
isDisabled: isEdit ? true : false,
},
{
label: t('txt_product'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const ListShippingZone = observer((props) => {
{
Header: t('txt_country'),
accessor: 'shippingZone',
width: 150,
width: 300,
className: 'py-18 text-gray border-bottom-1 text-uppercase fw-semibold align-middle',
Cell: ({ value }) => {
return (
Expand Down Expand Up @@ -56,7 +56,7 @@ const ListShippingZone = observer((props) => {
{
Header: t('txt_zip_start'),
accessor: 'zipStart',
width: 150,
width: 100,
className: 'py-18 text-gray border-bottom-1 text-uppercase fw-semibold align-middle',
Cell: ({ value }) => {
return (
Expand All @@ -69,7 +69,7 @@ const ListShippingZone = observer((props) => {
{
Header: t('txt_zip_end'),
accessor: 'zipEnd',
width: 150,
width: 100,
className: 'py-18 text-gray border-bottom-1 text-uppercase fw-semibold align-middle',
Cell: ({ value }) => {
return (
Expand Down Expand Up @@ -121,7 +121,7 @@ const ListShippingZone = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_shipping_zone')}</h2>
<h2>{t('txt_left_menu_shipping_zone')}</h2>

<ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ class ShippingZoneStore {

// eslint-disable-next-line prefer-const
resultOnSave = await createOrganizationApiService.create(convertedUpdateGeneralData);
return { error: false, response: resultOnSave?.items };
if (resultOnSave?.items[0]) {
return { error: false, response: resultOnSave?.items[0] };
} else {
return { error: true, response: resultOnSave };
}
} catch (error) {
return { error: true, response: error?.response?.data };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const ListState = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_state')}</h2>
<h2>{t('txt_left_menu_state')}</h2>

{/* <ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class StateListViewModel {
if (!data?.error) {
this.callbackOnSuccessGetStatesHandler(data?.response);
} else {
this.onErrorHandler(data?.response);
this.onErrorListHandler(data?.response);
}
this.successResponse.state = true;
});
Expand Down Expand Up @@ -128,6 +128,21 @@ class StateListViewModel {
this.formStatus = PAGE_STATUS.READY;
};

onErrorListHandler = (error) => {
if (error.code === 404) {
notify('Cannot create Shipping Zone for this Country, please try others!', 'error');
this.successResponse.listStatesWithoutPagination = [];
} else {
Array.isArray(error?._messages) && error?._messages[0]?.message
? notify(error?._messages[0]?.message, 'error')
: error?.message && notify(error?.message, 'error');
}

this.successResponse.state = false;
this.successResponse.content_id = error?.result;
this.formStatus = PAGE_STATUS.READY;
};

transform = (data) => {
return data?.map((o) => {
const date = moment(o[PIM_STATE_DETAIL_FIELD_KEY.MODIFIED_TIME]).format('DD MMM, YYYY');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const ListSubType = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_subtype')}</h2>
<h2>{t('txt_left_menu_subtype')}</h2>

<ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const ListTaxGroup = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_tax_group')}</h2>
<h2>{t('txt_left_menu_tax_group')}</h2>

{/* <ActionsBar
buttons={[
Expand Down
2 changes: 1 addition & 1 deletion packages/aesirx-pim-app/src/containers/TaxPage/ListTax.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const ListTax = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_tax')}</h2>
<h2>{t('txt_left_menu_tax')}</h2>

{/* <ActionsBar
buttons={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const ListType = observer((props) => {
return (
<div className="px-3 py-4">
<div className="mb-3 d-flex align-items-center justify-content-between">
<h2 className="fw-bold">{t('txt_left_menu_type')}</h2>
<h2>{t('txt_left_menu_type')}</h2>

<ActionsBar
buttons={[
Expand Down
14 changes: 0 additions & 14 deletions packages/aesirx-pim-app/src/routes/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,6 @@ const mainMenu = [
link: `/tax`,
icons: '/assets/images/tax.svg',
icons_color: '/assets/images/tax.svg',
submenu: [
{
text: 'txt_left_menu_tax',
link: `/tax`,
},
{
text: 'txt_left_menu_tax_group',
link: `/tax-groups`,
},
{
text: 'txt_left_menu_customer_group',
link: `/customer-groups`,
},
],
},
{
text: 'txt_left_menu_shipping',
Expand Down