├── .editorconfig
├── .github
├── CONTRIBUTING.md
└── workflows
│ └── pipeline.yml
├── .gitignore
├── LICENSE.md
├── README.md
├── composer.json
├── database
└── migrations
│ └── 2025_05_15_131001_create_history_table.php
├── docs
└── index.md
├── phpstan-baseline.neon
├── phpstan.neon.dist
├── phpunit.xml.dist
├── pint.json
├── rector.php
├── resources
├── lang
│ └── en
│ │ └── default.php
├── models
│ ├── exportmodel.php
│ ├── importmodel.php
│ ├── menuexport.php
│ └── menuimport.php
└── views
│ ├── _partials
│ ├── export_columns.blade.php
│ ├── export_container.blade.php
│ ├── export_result.blade.php
│ ├── import_columns.blade.php
│ ├── import_container.blade.php
│ ├── import_result.blade.php
│ ├── new_export_popup.blade.php
│ └── new_import_popup.blade.php
│ └── importexport
│ ├── export.blade.php
│ ├── import.blade.php
│ └── index.blade.php
├── src
├── Classes
│ └── ImportExportManager.php
├── Database
│ └── Factories
│ │ └── HistoryFactory.php
├── Extension.php
├── Http
│ ├── Actions
│ │ ├── ExportController.php
│ │ └── ImportController.php
│ └── Controllers
│ │ └── ImportExport.php
├── Models
│ ├── ExportModel.php
│ ├── History.php
│ ├── ImportModel.php
│ ├── MenuExport.php
│ └── MenuImport.php
└── Traits
│ └── ImportExportHelper.php
└── tests
├── Classes
└── ImportExportManagerTest.php
├── ExtensionTest.php
├── Http
├── Actions
│ ├── ExportControllerTest.php
│ └── ImportControllerTest.php
└── Controllers
│ └── ImportExportTest.php
├── Models
├── MenuExportTest.php
└── MenuImportTest.php
├── Pest.php
└── _fixtures
└── valid_import_file.csv
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | end_of_line = lf
5 | charset = utf-8
6 | trim_trailing_whitespace = true
7 | insert_final_newline = true
8 | indent_style = space
9 | indent_size = 4
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
14 | [*.{yml, yaml, json, scss, css}]
15 | indent_size = 2
16 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Contributions are **welcome** and will be fully **credited**.
4 |
5 | Please read and understand the contribution guide before creating an issue or pull request.
6 |
7 | ## Etiquette
8 |
9 | This project is open source, and as such, the maintainers give their free time to build and maintain the source code
10 | held within. They make the code freely available in the hope that it will be of use to other developers. It would be
11 | extremely unfair for them to suffer abuse or anger for their hard work.
12 |
13 | Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the world that
14 | developers are civilized and selfless people.
15 |
16 | It's the duty of the maintainer to ensure that all submissions to the project are of sufficient quality to benefit the
17 | project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do
18 | not be upset or abusive if your submission is not used.
19 |
20 | ## Viability
21 |
22 | When requesting or submitting new features, first consider whether it might be useful to others. Open source projects
23 | are used by many developers, who may have entirely different needs to your own. Think about whether or not your feature
24 | is likely to be used by other users of the project.
25 |
26 | ## Procedure
27 |
28 | Before filing an issue:
29 |
30 | - Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
31 | - Check to make sure your feature suggestion isn't already present within the project.
32 | - Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
33 | - Check the pull requests tab to ensure that the feature isn't already in progress.
34 |
35 | Before submitting a pull request:
36 |
37 | - Check the codebase to ensure that your feature doesn't already exist.
38 | - Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
39 |
40 | ## Requirements
41 |
42 | If the project maintainer has any additional requirements, you will find them listed here.
43 |
44 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)**
45 | - The easiest way to apply the conventions is to
46 | install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
47 |
48 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests.
49 |
50 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept
51 | up-to-date.
52 |
53 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs
54 | is not an option.
55 |
56 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
57 |
58 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make
59 | multiple intermediate commits while developing,
60 | please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages)
61 | before submitting.
62 |
63 | **Happy coding**!
64 |
--------------------------------------------------------------------------------
/.github/workflows/pipeline.yml:
--------------------------------------------------------------------------------
1 | name: Import Export CI Pipeline
2 |
3 | on: [ push, workflow_dispatch ]
4 |
5 | jobs:
6 | php-tests:
7 | strategy:
8 | matrix:
9 | php: [ '8.3', '8.4' ]
10 | uses: tastyigniter/workflows/.github/workflows/php-tests.yml@main
11 | with:
12 | php-version: ${{ matrix.target }}
13 | composer: update --no-interaction --no-progress
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .idea
3 | .php_cs
4 | .php_cs.cache
5 | .phpunit.result.cache
6 | .phpunit.cache
7 | /build
8 | composer.lock
9 | coverage
10 | phpunit.xml
11 | psalm.xml
12 | /vendor
13 | .php-cs-fixer.cache
14 | node_modules/
15 | npm-debug.log
16 | yarn-error.log
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) Igniter Labs Team
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | ## Introduction
9 |
10 | This extension allows you to import or export TastyIgniter records, such as menu items, customers, reservations, and orders. You can export records to a CSV file, make changes to the data, and then import the updated records back into TastyIgniter.
11 |
12 | ## Features
13 |
14 | - Export data into a CSV file.
15 | - Import data in CSV format into TastyIgniter.
16 |
17 | ## Documentation
18 |
19 | More documentation can be found on [here](https://github.com/igniter-labs/ti-ext-importexport/blob/master/docs/index.md).
20 |
21 | ## Changelog
22 |
23 | Please see [CHANGELOG](https://github.com/igniter-labs/ti-ext-importexport/blob/master/CHANGELOG.md) for more information on what has changed recently.
24 |
25 | ## Reporting issues
26 |
27 | If you encounter a bug in this extension, please report it using the [Issue Tracker](https://github.com/igniter-labs/ti-ext-importexport/issues) on GitHub.
28 |
29 | ## Contributing
30 |
31 | Contributions are welcome! Please read [TastyIgniter's contributing guide](https://tastyigniter.com/docs/resources/contribution-guide).
32 |
33 | ## Security vulnerabilities
34 |
35 | For reporting security vulnerabilities, please see [our security policy](https://github.com/igniter-labs/ti-ext-importexport/security/policy).
36 |
37 | ## License
38 |
39 | TastyIgniter ImportExport extension is open-source software licensed under the [MIT license](https://github.com/igniter-labs/ti-ext-importexport/blob/master/LICENSE.md).
40 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "igniterlabs/ti-ext-importexport",
3 | "type": "tastyigniter-package",
4 | "description": "Import/Export Menu Items, Orders, Customers from/into any CSV or Microsoft Excel file to TastyIgniter.",
5 | "license": "MIT",
6 | "authors": [
7 | {
8 | "name": "Igniter Labs Team"
9 | }
10 | ],
11 | "keywords": [
12 | "tastyigniter",
13 | "import",
14 | "export"
15 | ],
16 | "require": {
17 | "tastyigniter/core": "^v4.0",
18 | "league/csv": "~9.1"
19 | },
20 | "require-dev": {
21 | "laravel/pint": "^1.2",
22 | "larastan/larastan": "^3.0",
23 | "sampoyigi/testbench": "dev-main as 1.0",
24 | "pestphp/pest-plugin-laravel": "^3.0",
25 | "rector/rector": "^2.0"
26 | },
27 | "autoload": {
28 | "psr-4": {
29 | "IgniterLabs\\ImportExport\\": "src/"
30 | }
31 | },
32 | "autoload-dev": {
33 | "psr-4": {
34 | "IgniterLabs\\ImportExport\\Tests\\": "tests/"
35 | }
36 | },
37 | "extra": {
38 | "tastyigniter-extension": {
39 | "code": "igniterlabs.importexport",
40 | "name": "Import & Export Tool",
41 | "icon": {
42 | "class": "fas fa-file-import",
43 | "backgroundColor": "#147EFB",
44 | "color": "#FFFFFF"
45 | },
46 | "homepage": "https://tastyigniter.com/marketplace/item/igniterlabs-importexport"
47 | },
48 | "branch-alias": {
49 | "dev-master": "4.0.x-dev"
50 | }
51 | },
52 | "minimum-stability": "dev",
53 | "prefer-stable": true,
54 | "config": {
55 | "allow-plugins": {
56 | "pestphp/pest-plugin": true,
57 | "php-http/discovery": true,
58 | "composer/installers": true
59 | },
60 | "sort-packages": true
61 | },
62 | "scripts": {
63 | "test:lint": "vendor/bin/pint --test --ansi",
64 | "test:lint-fix": "vendor/bin/pint --ansi",
65 | "test:refactor": "vendor/bin/rector process --dry-run --ansi",
66 | "test:refactor-fix": "vendor/bin/rector process --ansi",
67 | "test:static": "vendor/bin/phpstan analyse --memory-limit=1056M --ansi",
68 | "test:static-fix": "vendor/bin/phpstan --generate-baseline --memory-limit=1056M --ansi",
69 | "test:pest": "vendor/bin/pest",
70 | "test:coverage": "vendor/bin/pest --coverage --exactly=100 --compact",
71 | "test:type-coverage": "vendor/bin/pest --type-coverage --min=100",
72 | "test": [
73 | "@test:lint",
74 | "@test:refactor",
75 | "@test:static",
76 | "@test:coverage"
77 | ]
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/database/migrations/2025_05_15_131001_create_history_table.php:
--------------------------------------------------------------------------------
1 | engine = 'InnoDB';
15 | $table->bigIncrements('id');
16 | $table->unsignedBigInteger('user_id')->nullable();
17 | $table->string('uuid');
18 | $table->string('type');
19 | $table->string('code');
20 | $table->string('status')->nullable();
21 | $table->string('error_message')->nullable();
22 | $table->json('attempted_data')->nullable();
23 | $table->timestamp('finished_at')->nullable();
24 | $table->timestamps();
25 | });
26 | }
27 |
28 | public function down(): void
29 | {
30 | Schema::dropIfExists('importexport_history');
31 | }
32 | };
33 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Import/Export"
3 | section: "extensions"
4 | sortOrder: 999
5 | ---
6 |
7 | ## Installation
8 |
9 | You can install the extension via composer using the following command:
10 |
11 | ```bash
12 | composer require igniterlabs/ti-ext-importexport -W
13 | ```
14 |
15 | Run the database migrations to create the required tables:
16 |
17 | ```bash
18 | php artisan igniter:up
19 | ```
20 |
21 | ## Getting started
22 |
23 | In the admin area, you can import or export records. Navigate to the _Tools > Import/Export_ admin pages.
24 |
25 | - To import data, you can select the type of data you want to import, choose a file, and then click the import button. The system will process the file and import the data into the database.
26 | - To export data, you can select the type of data you want to export, and then click the export button. The system will generate a CSV file containing the exported data.
27 | - You can also define custom import/export types, see the [Usage](#usage) section below for more details.
28 |
29 | ## Usage
30 |
31 | This section covers how to integrate the Import/Export extension into your own extension if you need to create custom import/export types. The Import/Export extension provides a simple API for managing import and export operations.
32 |
33 | ### Defining import types
34 |
35 | You can define import types by creating an import definition file and a model class that extends `IgniterLabs\ImportExport\Models\ImportModel`. This class should implement the `importData` method to handle the import logic for inserting/updating data into the database. The base class handles file uploads and data processing.
36 |
37 | ```php
38 | use IgniterLabs\ImportExport\Models\ImportModel;
39 |
40 | class MyCustomImport extends ImportModel
41 | {
42 | protected $table = 'db_table_name'; // Specify the database table to import data into
43 |
44 | public function importData(array $data): void
45 | {
46 | // Process the data and insert/update records in the database
47 | foreach ($data as $record) {
48 | try {
49 | // Validate the record before processing
50 | $validated = Validator::validate($record, [
51 | 'id' => 'required|integer',
52 | 'name' => 'required|string|max:255',
53 | 'description' => 'nullable|string',
54 | ]);
55 | } catch (\Exception $e) {
56 | // Log an error if validation fails
57 | $this->logError($record, $e->getMessage());
58 | continue; // Skip to the next record
59 | }
60 |
61 | // Example: Insert or update logic
62 | if ($this->update_existing) {
63 | $record = Model::where('id', $record['id'])->first();
64 | }
65 |
66 | $record ??= new Model();
67 |
68 | $record->fill($record)->save();
69 | $record->wasRecentlyCreated ? $this->logCreated() : $this->logUpdated();
70 | }
71 | }
72 | }
73 | ```
74 |
75 | Methods like `logCreated`, `logUpdated`, and `logError` can be used to log changes made during the import process. You can pass the `$rowNumber` and `$errorMessage` parameters to the `logError` method to log errors encountered during the import. Both `logCreated` and `logUpdated` methods do not accept any parameters, as they automatically log the creation or update of records.
76 |
77 | Here's an example of an import definition file `customimport.php` that registers the custom import type:
78 |
79 | ```php
80 | return [
81 | 'columns' => [
82 | 'id' => 'ID',
83 | 'name' => 'Name',
84 | 'description' => 'Description',
85 | ],
86 | 'fields' => [
87 | 'update_existing' => [
88 | 'label' => 'Update existing items',
89 | 'type' => 'switch',
90 | 'default' => true,
91 | ],
92 | ],
93 | ];
94 | ```
95 |
96 | This file should be placed in the `resources/models` directory of your extension. The `columns` array defines the columns that will be available for import, and the `fields` array defines any additional fields that can be configured during the import process.
97 |
98 | ### Defining export types
99 |
100 | You can define export types similarly to import types by creating an export definition file and a model class that extends `IgniterLabs\ImportExport\Models\ExportModel`. This class should implement `exportData` method to handle the export logic for fetching your specific data type from the database. The base class handles CSV file generation and download.
101 |
102 | ```php
103 |
104 | use IgniterLabs\ImportExport\Models\ExportModel;
105 |
106 | class MyCustomExport extends ExportModel
107 | {
108 | protected $table = 'db_table_name'; // Specify the database table to export data from
109 |
110 | public $relation[
111 | // Define any relationships if needed
112 | ];
113 |
114 | public function exportData(array $columns, array $options = []): array
115 | {
116 | // Define the query to fetch the data to be exported
117 | $query = $this->newQuery();
118 |
119 | if ($offset = array_get($options, 'offset')) {
120 | $query->offset($offset);
121 | }
122 |
123 | if ($limit = array_get($options, 'limit')) {
124 | $query->limit($limit);
125 | }
126 |
127 | // Fetch the data to be exported
128 | return $query->get()->toArray(); // Return an array of records to be exported
129 | }
130 | }
131 | ```
132 |
133 | The `$columns` parameter specifies which columns to include in the export. The `$options` parameter specifies additional options for the export, such as `offset` or `limit` for pagination.
134 |
135 | Here's an example of an export definition file `customexport.php` that registers the custom export type:
136 |
137 | ```php
138 | return [
139 | 'columns' => [
140 | 'id' => 'ID',
141 | 'name' => 'Name',
142 | 'description' => 'Description',
143 | ],
144 | ];
145 | ```
146 |
147 | This file should be placed in the `resources/models` directory of your extension. The `columns` array defines the columns that will be available for export.
148 |
149 | ### Registering import/export types
150 |
151 | You can register your custom import and export types in the `registerImportExportTypes` method of your [Extension class](https://tastyigniter.com/docs/extend/extensions#extension-class). Here is an example:
152 |
153 | ```php
154 | public function registerImportExport(): array
155 | {
156 | return [
157 | 'import' => [
158 | 'customimport' => [
159 | 'label' => 'My Custom Import',
160 | 'model' => \Author\Extension\Models\MyCustomImport::class,
161 | 'configFile' => 'author.extension::/models/customimport',
162 | 'permissions' => 'Author.Extension.ManageImports',
163 | ],
164 | 'export' => [
165 | 'customexport' => [
166 | 'label' => 'My Custom Export',
167 | 'model' => \Author\Extension\Models\MyCustomExport::class,
168 | 'configFile' => 'author.extension::/models/customexport',
169 | 'permissions' => 'Author.Extension.ManageExports',
170 | ],
171 | ],
172 | ];
173 | }
174 | ```
175 |
176 | This method returns an array of import and export types, where each type is defined by its label, model class, configuration file, and permissions required to access it.
177 |
--------------------------------------------------------------------------------
/phpstan-baseline.neon:
--------------------------------------------------------------------------------
1 | parameters:
2 | ignoreErrors:
3 |
--------------------------------------------------------------------------------
/phpstan.neon.dist:
--------------------------------------------------------------------------------
1 | includes:
2 | - ./vendor/larastan/larastan/extension.neon
3 | - phpstan-baseline.neon
4 |
5 | parameters:
6 | level: 5
7 | paths:
8 | - src/
9 | - resources/
10 | # ignoreErrors:
11 | # - '#PHPDoc tag @var#'
12 | # excludePaths:
13 | # - ./*/*/FileToBeExcluded.php
14 | # checkMissingIterableValueType: false
15 |
--------------------------------------------------------------------------------
/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | tests
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | ./src
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/pint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "method_chaining_indentation": true,
4 | "logical_operators": true,
5 | "simplified_null_return": false,
6 | "cast_spaces": false,
7 | "no_unreachable_default_argument_value": false,
8 | "no_alternative_syntax": false,
9 | "not_operator_with_successor_space": false,
10 | "no_trailing_comma_in_list_call": false,
11 | "phpdoc_summary": false,
12 | "braces": false,
13 | "self_accessor": false,
14 | "phpdoc_separation": false,
15 | "phpdoc_align": false,
16 | "no_trailing_comma_in_singleline": false,
17 | "phpdoc_trim_consecutive_blank_line_separation": true,
18 | "blank_line_before_statement": {
19 | "statements": [
20 | "declare",
21 | "return",
22 | "throw",
23 | "try"
24 | ]
25 | },
26 | "single_blank_line_at_eof": false,
27 | "single_space_around_construct": false,
28 | "function_declaration": {
29 | "closure_function_spacing": "none",
30 | "closure_fn_spacing": "none"
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/rector.php:
--------------------------------------------------------------------------------
1 | withPaths([
12 | __DIR__.'/database',
13 | __DIR__.'/src',
14 | __DIR__.'/tests',
15 | ])
16 | ->withImportNames(removeUnusedImports: true)
17 | ->withRules([
18 | DeclareStrictTypesRector::class,
19 | ])
20 | ->withSkip([
21 | ReturnNeverTypeRector::class,
22 | CatchExceptionNameMatchingTypeRector::class,
23 | ])
24 | ->withPhpSets(php83: true)
25 | ->withPreparedSets(
26 | deadCode: true,
27 | codeQuality: true,
28 | codingStyle: true,
29 | typeDeclarations: true,
30 | );
31 |
--------------------------------------------------------------------------------
/resources/lang/en/default.php:
--------------------------------------------------------------------------------
1 | 'Import/Export',
7 | 'text_import_export_title' => 'New Import/Export',
8 | 'text_import_title' => 'Import Records',
9 | 'text_export_title' => 'Export Records',
10 | 'text_history_title' => 'Import/Export History',
11 | 'text_tab_title_import_primary' => 'Upload a CSV file',
12 | 'text_tab_title_import_columns' => 'Match columns to import',
13 | 'text_tab_title_import_secondary' => 'Set import options',
14 | 'text_tab_title_export_primary' => 'Export output settings',
15 | 'text_tab_title_export_columns' => 'Columns to export',
16 | 'text_tab_title_export_secondary' => 'Set export options',
17 | 'text_no_import_file' => 'Please upload a valid CSV file.',
18 | 'text_import_row' => 'Row %s - %s',
19 | 'text_import_created' => 'Created (%s)',
20 | 'text_import_updated' => 'Updated (%s)',
21 | 'text_import_skipped' => 'Skipped (%s)',
22 | 'text_import_warnings' => 'Warnings (%s)',
23 | 'text_import_errors' => 'Errors (%s)',
24 | 'text_import_progress' => 'Import progress',
25 | 'text_processing' => 'Processing...',
26 | 'text_uploading' => 'Uploading...',
27 |
28 | 'label_export_record' => 'Choose record to export',
29 | 'label_offset' => 'Offset',
30 | 'label_limit' => 'Limit',
31 | 'label_delimiter' => 'Delimiter Character',
32 | 'label_enclosure' => 'Enclosure Character',
33 | 'label_escape' => 'Escape Character',
34 | 'label_columns' => 'Columns',
35 |
36 | 'label_import_record' => 'Choose record to import',
37 | 'label_import_file' => 'Import file',
38 | 'label_encoding' => 'File encoding',
39 | 'label_import_columns' => 'Import Columns',
40 | 'label_db_columns' => 'Database fields',
41 | 'label_file_columns' => 'File Columns',
42 | 'label_import_ignore' => 'Import/Ignore',
43 |
44 | 'column_history_id' => 'ID',
45 | 'column_history_type' => 'Type',
46 | 'column_history_code' => 'Code',
47 | 'column_history_status' => 'Status',
48 | 'column_history_message' => 'Message',
49 | 'column_history_date' => 'Date',
50 |
51 | 'button_import_records' => 'Import Records',
52 | 'button_export_records' => 'Export Records',
53 | 'button_cancel_import' => 'Cancel Import',
54 | 'button_upload' => 'Upload CSV',
55 | 'button_choose' => 'Choose',
56 | 'button_change' => 'Change',
57 | 'button_download' => 'Download CSV',
58 |
59 | 'error_empty_import_columns' => 'Please specify some columns to import.',
60 | 'error_empty_export_columns' => 'Please specify some columns to export.',
61 | 'error_missing_model' => 'Missing the model property for %s',
62 | 'error_mass_assignment' => "Mass assignment failed for Model attribute ':attribute'.",
63 | 'error_export_not_found' => 'The export was not found',
64 | 'error_file_not_found' => 'The export file was not found',
65 | 'error_invalid_import_file' => 'The import file is invalid. Please upload a valid CSV file.',
66 | 'error_missing_csv_headers' => 'The CSV file has invalid headers. Please upload a valid CSV file.',
67 |
68 | 'alert_export_success' => 'File export process completed! You can download the exported file from the history section.',
69 |
70 | 'help_offset' => 'Number of records to skip before exporting. Use 0 value to start from the first record, 100 to start exporting from the 101th record',
71 | 'help_limit' => 'Number of records to export. If no value is given all records are exported.',
72 | 'help_delimiter' => 'The character used to separate each field',
73 | 'help_enclosure' => 'The character used to enclose each field',
74 |
75 | 'encodings' => [
76 | 'utf_8' => 'UTF-8',
77 | 'us_ascii' => 'US-ASCII',
78 | 'iso_8859_1' => 'ISO-8859-1 (Latin-1, Western European)',
79 | 'iso_8859_2' => 'ISO-8859-2 (Latin-2, Central European)',
80 | 'iso_8859_3' => 'ISO-8859-3 (Latin-3, South European)',
81 | 'iso_8859_4' => 'ISO-8859-4 (Latin-4, North European)',
82 | 'iso_8859_5' => 'ISO-8859-5 (Latin, Cyrillic)',
83 | 'iso_8859_6' => 'ISO-8859-6 (Latin, Arabic)',
84 | 'iso_8859_7' => 'ISO-8859-7 (Latin, Greek)',
85 | 'iso_8859_8' => 'ISO-8859-8 (Latin, Hebrew)',
86 | 'iso_8859_0' => 'ISO-8859-9 (Latin-5, Turkish)',
87 | 'iso_8859_10' => 'ISO-8859-10 (Latin-6, Nordic)',
88 | 'iso_8859_11' => 'ISO-8859-11 (Latin, Thai)',
89 | 'iso_8859_13' => 'ISO-8859-13 (Latin-7, Baltic Rim)',
90 | 'iso_8859_14' => 'ISO-8859-14 (Latin-8, Celtic)',
91 | 'iso_8859_15' => 'ISO-8859-15 (Latin-9, Western European revision with euro sign)',
92 | 'windows_1251' => 'Windows-1251 (CP1251)',
93 | 'windows_1252' => 'Windows-1252 (CP1252)',
94 | ],
95 | ];
96 |
--------------------------------------------------------------------------------
/resources/models/exportmodel.php:
--------------------------------------------------------------------------------
1 | [
7 | 'toolbar' => [
8 | 'buttons' => [
9 | 'exportRecords' => [
10 | 'label' => 'lang:igniterlabs.importexport::default.button_export_records',
11 | 'class' => 'btn btn-primary',
12 | 'data-request' => 'onExport',
13 | 'data-progress-indicator' => 'igniterlabs.importexport::default.text_processing',
14 | ],
15 | ],
16 | ],
17 | 'fields' => [
18 | 'step_primary' => [
19 | 'label' => 'lang:igniterlabs.importexport::default.text_tab_title_export_primary',
20 | 'type' => 'section',
21 | ],
22 | 'offset' => [
23 | 'label' => 'lang:igniterlabs.importexport::default.label_offset',
24 | 'type' => 'number',
25 | 'span' => 'left',
26 | 'default' => '0',
27 | 'comment' => 'lang:igniterlabs.importexport::default.help_offset',
28 | ],
29 | 'limit' => [
30 | 'label' => 'lang:igniterlabs.importexport::default.label_limit',
31 | 'type' => 'number',
32 | 'span' => 'right',
33 | 'comment' => 'lang:igniterlabs.importexport::default.help_limit',
34 | ],
35 | 'delimiter' => [
36 | 'label' => 'lang:igniterlabs.importexport::default.label_delimiter',
37 | 'type' => 'text',
38 | 'span' => 'left',
39 | 'cssClass' => 'flex-width',
40 | 'default' => ',',
41 | 'comment' => 'lang:igniterlabs.importexport::default.help_delimiter',
42 | ],
43 | 'enclosure' => [
44 | 'label' => 'lang:igniterlabs.importexport::default.label_enclosure',
45 | 'type' => 'text',
46 | 'span' => 'left',
47 | 'cssClass' => 'flex-width',
48 | 'default' => '"',
49 | 'comment' => 'lang:igniterlabs.importexport::default.help_enclosure',
50 | ],
51 | 'escape' => [
52 | 'label' => 'lang:igniterlabs.importexport::default.label_escape',
53 | 'type' => 'text',
54 | 'span' => 'left',
55 | 'cssClass' => 'flex-width',
56 | 'default' => '\\',
57 | ],
58 | 'step_columns' => [
59 | 'label' => 'lang:igniterlabs.importexport::default.text_tab_title_export_columns',
60 | 'type' => 'section',
61 | ],
62 | 'export_columns' => [
63 | 'label' => 'lang:igniterlabs.importexport::default.label_columns',
64 | 'type' => 'partial',
65 | 'path' => 'igniterlabs.importexport::export_columns',
66 | ],
67 | 'step_secondary' => [
68 | 'label' => 'lang:igniterlabs.importexport::default.text_tab_title_export_secondary',
69 | 'type' => 'section',
70 | ],
71 | ],
72 | ],
73 | ];
74 |
--------------------------------------------------------------------------------
/resources/models/importmodel.php:
--------------------------------------------------------------------------------
1 | [
7 | 'toolbar' => [
8 | 'buttons' => [
9 | 'importRecords' => [
10 | 'label' => 'lang:igniterlabs.importexport::default.button_import_records',
11 | 'class' => 'btn btn-primary',
12 | 'data-request' => 'onImport',
13 | 'data-progress-indicator' => 'igniterlabs.importexport::default.text_processing',
14 | ],
15 | 'cancelImport' => [
16 | 'label' => 'lang:igniterlabs.importexport::default.button_cancel_import',
17 | 'class' => 'btn btn-default',
18 | 'data-request' => 'onDeleteImportFile',
19 | 'data-progress-indicator' => 'igniterlabs.importexport::default.text_processing',
20 | ],
21 | ],
22 | ],
23 | 'fields' => [
24 | 'step_primary' => [
25 | 'label' => 'lang:igniterlabs.importexport::default.text_tab_title_import_primary',
26 | 'type' => 'section',
27 | ],
28 | 'encoding' => [
29 | 'label' => 'lang:igniterlabs.importexport::default.label_encoding',
30 | 'type' => 'select',
31 | 'span' => 'left',
32 | 'cssClass' => 'flex-width',
33 | 'default' => 'utf-8',
34 | 'disabled' => true,
35 | ],
36 | 'delimiter' => [
37 | 'label' => 'lang:igniterlabs.importexport::default.label_delimiter',
38 | 'type' => 'text',
39 | 'span' => 'left',
40 | 'cssClass' => 'flex-width',
41 | 'default' => ',',
42 | 'comment' => 'lang:igniterlabs.importexport::default.help_delimiter',
43 | ],
44 | 'enclosure' => [
45 | 'label' => 'lang:igniterlabs.importexport::default.label_enclosure',
46 | 'type' => 'text',
47 | 'span' => 'left',
48 | 'cssClass' => 'flex-width',
49 | 'default' => '"',
50 | 'comment' => 'lang:igniterlabs.importexport::default.help_enclosure',
51 | ],
52 | 'escape' => [
53 | 'label' => 'lang:igniterlabs.importexport::default.label_escape',
54 | 'type' => 'text',
55 | 'span' => 'left',
56 | 'cssClass' => 'flex-width',
57 | 'default' => '\\',
58 | ],
59 | 'step_columns' => [
60 | 'label' => 'lang:igniterlabs.importexport::default.text_tab_title_import_columns',
61 | 'type' => 'section',
62 | ],
63 | 'import_columns' => [
64 | 'label' => 'lang:igniterlabs.importexport::default.label_import_columns',
65 | 'type' => 'partial',
66 | 'cssClass' => 'mb-0',
67 | 'path' => 'igniterlabs.importexport::import_columns',
68 | 'emptyMessage' => 'lang:igniterlabs.importexport::default.text_no_import_file',
69 | ],
70 | ],
71 | ],
72 | ];
73 |
--------------------------------------------------------------------------------
/resources/models/menuexport.php:
--------------------------------------------------------------------------------
1 | [
5 | 'menu_id' => 'lang:admin::lang.column_id',
6 | 'menu_name' => 'lang:admin::lang.label_name',
7 | 'menu_price' => 'lang:igniter.cart::default.menus.label_price',
8 | 'menu_description' => 'lang:admin::lang.label_description',
9 | 'minimum_qty' => 'lang:igniter.cart::default.menus.label_minimum_qty',
10 | 'categories' => 'lang:igniter.cart::default.menus.label_category',
11 | 'menu_status' => 'lang:admin::lang.label_status',
12 | ],
13 | ];
14 |
--------------------------------------------------------------------------------
/resources/models/menuimport.php:
--------------------------------------------------------------------------------
1 | [
5 | 'menu_id' => 'lang:admin::lang.column_id',
6 | 'menu_name' => 'lang:admin::lang.label_name',
7 | 'menu_price' => 'lang:igniter.cart::default.menus.label_price',
8 | 'menu_description' => 'lang:admin::lang.label_description',
9 | 'minimum_qty' => 'lang:igniter.cart::default.menus.label_minimum_qty',
10 | 'categories' => 'lang:igniter.cart::default.menus.label_category',
11 | 'menu_status' => 'lang:admin::lang.label_status',
12 | ],
13 | 'fields' => [
14 | 'update_existing' => [
15 | 'label' => 'Update existing menu items',
16 | 'type' => 'switch',
17 | 'default' => true,
18 | ],
19 | ],
20 | ];
21 |
--------------------------------------------------------------------------------
/resources/views/_partials/export_columns.blade.php:
--------------------------------------------------------------------------------
1 | @php
2 | $fieldOptions = []; //$field->options();
3 | $checkedValues = (array)$field->value;
4 | $isScrollable = count($exportColumns) > 10;
5 | @endphp
6 |
7 |