-
- {" "}
- {T.translate("tax_type_list.tax_type_list")} ({totalTaxTypes})
-
-
-
-
-
-
+
{T.translate("tax_type_list.tax_type_list")}
+
+
+
+
+ {totalTaxTypes} {T.translate("general.items")}
+
+
+
+
+
+
+
+
+ }
+ sx={{ height: "36px" }}
+ >
+ {T.translate("tax_type_list.add_tax_type")}
+
+
+
+
{taxTypes.length === 0 && (
{T.translate("tax_type_list.no_tax_types")}
)}
{taxTypes.length > 0 && (
-
item.name}
+ onSort={handleSort}
+ onPageChange={handlePageChange}
+ onPerPageChange={handlePerPageChange}
+ onEdit={handleEdit}
+ onDelete={handleDelete}
+ confirmButtonColor="error"
/>
)}
-
- );
- }
-}
-const mapStateToProps = ({ currentSummitState, currentTaxTypeListState }) => ({
+ {showTaxTypeModal && (
+
+ )}
+
+ >
+ );
+};
+
+const mapStateToProps = ({
+ currentSummitState,
+ currentTaxTypeListState,
+ currentTaxTypeState
+}) => ({
currentSummit: currentSummitState.currentSummit,
- ...currentTaxTypeListState
+ ...currentTaxTypeListState,
+ currentTaxType: currentTaxTypeState.entity,
+ currentTaxTypeErrors: currentTaxTypeState.errors
});
-export default connect(mapStateToProps, {
- getSummitById,
- getTaxTypes,
- deleteTaxType
-})(TaxTypeListPage);
+export default Restrict(
+ connect(mapStateToProps, {
+ getTaxTypes,
+ deleteTaxType,
+ getTaxType,
+ resetTaxTypeForm,
+ saveTaxType,
+ addTicketToTaxType,
+ removeTicketFromTaxType
+ })(TaxTypeListPage),
+ "taxes"
+);
diff --git a/src/reducers/taxes/tax-type-list-reducer.js b/src/reducers/taxes/tax-type-list-reducer.js
index 494629820..736b76135 100644
--- a/src/reducers/taxes/tax-type-list-reducer.js
+++ b/src/reducers/taxes/tax-type-list-reducer.js
@@ -9,8 +9,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- **/
+ * */
+import { LOGOUT_USER } from "openstack-uicore-foundation/lib/security/actions";
import {
RECEIVE_TAX_TYPES,
REQUEST_TAX_TYPES,
@@ -18,12 +19,15 @@ import {
} from "../../actions/tax-actions";
import { SET_CURRENT_SUMMIT } from "../../actions/summit-actions";
-import { LOGOUT_USER } from "openstack-uicore-foundation/lib/security/actions";
const DEFAULT_STATE = {
taxTypes: [],
+ term: "",
order: "name",
orderDir: 1,
+ currentPage: 1,
+ lastPage: 1,
+ perPage: 10,
totalTaxTypes: 0
};
@@ -35,18 +39,30 @@ const taxTypeListReducer = (state = DEFAULT_STATE, action) => {
return DEFAULT_STATE;
}
case REQUEST_TAX_TYPES: {
- let { order, orderDir } = payload;
+ const { order, orderDir, page, ...rest } = payload;
- return { ...state, order, orderDir };
+ return {
+ ...state,
+ order,
+ orderDir,
+ currentPage: page,
+ ...rest
+ };
}
case RECEIVE_TAX_TYPES: {
- let { total } = payload.response;
- let taxTypes = payload.response.data;
+ const { total, current_page, last_page } = payload.response;
+ const taxTypes = payload.response.data;
- return { ...state, taxTypes: taxTypes, totalTaxTypes: total };
+ return {
+ ...state,
+ taxTypes,
+ totalTaxTypes: total,
+ currentPage: current_page,
+ lastPage: last_page
+ };
}
case TAX_TYPE_DELETED: {
- let { taxTypeId } = payload;
+ const { taxTypeId } = payload;
return {
...state,
taxTypes: state.taxTypes.filter((t) => t.id !== taxTypeId)