file export

This commit is contained in:
Doljinsuren Enkhbayar
2024-05-16 14:56:36 +08:00
parent ae300f9004
commit 9fc53de9fe
2 changed files with 24 additions and 5 deletions

View File

@@ -40,6 +40,13 @@ export default class ConsoleAdminOrganizationsController extends Controller {
*/
@service filters;
/**
* Inject the `crud` service
*
* @var {Service}
*/
@service crud;
/**
* The search query param value.
*
@@ -166,4 +173,14 @@ export default class ConsoleAdminOrganizationsController extends Controller {
@action goToCompany(company) {
this.router.transitionTo('console.admin.organizations.index.users', company.public_id);
}
}
/**
* Toggles dialog to export `drivers`
*
* @void
*/
@action exportOrganization() {
const selections = this.table.selectedRows.map((_) => _.id);
this.crud.export('companies', { params: { selections } });
}
}

View File

@@ -1,13 +1,15 @@
{{page-title (t "console.admin.organizations.index.title")}}
{{!-- template-lint-disable no-unbound --}}
<Layout::Section::Header @title={{t "console.admin.organizations.index.title"}} @searchQuery={{unbound this.query}} @onSearch={{this.search}} />
{{! template-lint-disable no-unbound }}
<Layout::Section::Header @title={{t "console.admin.organizations.index.title"}} @searchQuery={{unbound this.query}} @onSearch={{this.search}}>
<Button @icon="long-arrow-up" @iconClass="rotate-icon-45" @text={{t "fleet-ops.common.export"}} @wrapperClass="hidden md:flex" @onClick={{this.exportOrganization}} />
</Layout::Section::Header>
<Layout::Section::Body>
<Table
@rows={{@model}}
@columns={{this.columns}}
@selectable={{false}}
@canSelectAll={{false}}
@selectable={{true}}
@canSelectAll={{true}}
@onSetup={{fn (mut this.table)}}
@pagination={{true}}
@paginationMeta={{@model.meta}}