Compare commits
71 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ed4467337f | |||
| 864714d198 | |||
| 33aacfb469 | |||
| e0e262fd32 | |||
| 5d6302fa9c | |||
| 3da8ff81c9 | |||
| a36dd02771 | |||
| 0a6fb98476 | |||
| 57ddd4bb5a | |||
| df5e6d5656 | |||
| 78495880ca | |||
| 960832efb1 | |||
| 447a0d1dea | |||
| 5b47416841 | |||
| 3e4a627ca7 | |||
| 420b0a0405 | |||
| b39d601ec9 | |||
| 89d13699b4 | |||
| 9826331545 | |||
| 9d8718d110 | |||
| 16e00f8573 | |||
| baf3f6da32 | |||
| 62bf4ebd92 | |||
| 6e465e3010 | |||
| 8b08969c69 | |||
| 25d4519684 | |||
| 34d4dc8660 | |||
| 1510ef03f1 | |||
| ce8c95921f | |||
| 095a6ae879 | |||
| 296143016a | |||
| 412dce8941 | |||
| 586226ceaf | |||
| ac09d8d0eb | |||
| 33e3ae059d | |||
| 3aa2504f3c | |||
| c1a396f246 | |||
| a45ba1c8b3 | |||
| 7a944a73f7 | |||
| 71595cc8de | |||
| f89dbd0c23 | |||
| 9ba859e15b | |||
| 672e448e9a | |||
| 0749032fbc | |||
| d692614f70 | |||
| 1303cff9fd | |||
| 6b2bd0964b | |||
| 0d2cf13524 | |||
| f6ef9c39d2 | |||
| 7e4ed56f28 | |||
| 06dd7883c2 | |||
| 4d0644f46c | |||
| 712042b8d8 | |||
| efee12740d | |||
| 14395810d0 | |||
| 03002a8938 | |||
| 21fcee8ff5 | |||
| 1361340928 | |||
| 1bda30e957 | |||
| a87423d879 | |||
| 24cda34681 | |||
| 22e4e652b5 | |||
| 2c514a8ab6 | |||
| b1ea728c15 | |||
| 9d5c20113f | |||
| 47762a8557 | |||
| 939a4fe03e | |||
| 493de65892 | |||
| d8eca66747 | |||
| 23ae8e1b1d | |||
| 7ad20993d9 |
@@ -1,45 +0,0 @@
|
|||||||
APP_ENV=production
|
|
||||||
APP_DEBUG=true
|
|
||||||
APP_KEY=base64:C+sutHm6xP5sE4QXhoZFhYjArlVN11s2mDU1F8beUkM=
|
|
||||||
APP_URL=http://vanguard.test
|
|
||||||
|
|
||||||
LOG_CHANNEL=stack
|
|
||||||
|
|
||||||
DB_CONNECTION=mysql
|
|
||||||
DB_HOST="localhost"
|
|
||||||
DB_DATABASE="trfcertest"
|
|
||||||
DB_USERNAME="solocla"
|
|
||||||
DB_PASSWORD="!Massarosa2"
|
|
||||||
DB_PREFIX="auth_"
|
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
|
||||||
CACHE_DRIVER=file
|
|
||||||
QUEUE_DRIVER=sync
|
|
||||||
SESSION_DRIVER=database
|
|
||||||
SESSION_LIFETIME=120
|
|
||||||
|
|
||||||
REDIS_HOST=127.0.0.1
|
|
||||||
REDIS_PASSWORD=null
|
|
||||||
REDIS_PORT=6379
|
|
||||||
|
|
||||||
MAIL_MAILER=mail
|
|
||||||
MAIL_FROM_NAME=Vanguard
|
|
||||||
MAIL_FROM_ADDRESS=vanguard@test.dev
|
|
||||||
MAIL_HOST=smtp.mailtrap.io
|
|
||||||
MAIL_PORT=2525
|
|
||||||
MAIL_USERNAME=null
|
|
||||||
MAIL_PASSWORD=null
|
|
||||||
MAIL_ENCRYPTION=null
|
|
||||||
|
|
||||||
PUSHER_APP_ID=
|
|
||||||
PUSHER_APP_KEY=
|
|
||||||
PUSHER_APP_SECRET=
|
|
||||||
PUSHER_APP_CLUSTER=mt1
|
|
||||||
|
|
||||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
|
||||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
||||||
|
|
||||||
# Credenziali API VisualLims
|
|
||||||
API_BASE_URL=https://93.43.5.102/limsapi
|
|
||||||
API_USERNAME=WebApiUser
|
|
||||||
API_PASSWORD=webapiuser01
|
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
APP_ENV=production
|
APP_ENV=production
|
||||||
APP_DEBUG=false
|
APP_DEBUG=true
|
||||||
APP_KEY=
|
APP_KEY=base64:C+sutHm6xP5sE4QXhoZFhYjArlVN11s2mDU1F8beUkM=
|
||||||
APP_URL=http://vanguard.test
|
APP_URL=http://vanguard.test
|
||||||
|
|
||||||
LOG_CHANNEL=stack
|
LOG_CHANNEL=stack
|
||||||
|
|
||||||
DB_CONNECTION=mysql
|
DB_CONNECTION=mysql
|
||||||
DB_HOST=localhost
|
DB_HOST="localhost"
|
||||||
DB_DATABASE=vanguard
|
DB_DATABASE="trfcertest"
|
||||||
DB_USERNAME=homestead
|
DB_USERNAME="solocla"
|
||||||
DB_PASSWORD=secret
|
DB_PASSWORD="xxxxxxx"
|
||||||
DB_PREFIX=vg_
|
DB_PREFIX="auth_"
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
BROADCAST_DRIVER=log
|
||||||
CACHE_DRIVER=file
|
CACHE_DRIVER=file
|
||||||
@@ -39,3 +39,21 @@ PUSHER_APP_CLUSTER=mt1
|
|||||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||||
|
|
||||||
|
# Credenziali API VisualLims
|
||||||
|
SIMULATE_EXPORT_LIMS=true
|
||||||
|
API_BASE_URL=https://93.43.5.102/limsapi
|
||||||
|
API_USERNAME=xxxx
|
||||||
|
API_PASSWORD=XXXX
|
||||||
|
|
||||||
|
BASE_URL=http://localhost:8000/userarea/
|
||||||
|
|
||||||
|
# Credenziali ENTRAID
|
||||||
|
|
||||||
|
AZURE_CLIENT_ID=your-client-id
|
||||||
|
AZURE_CLIENT_SECRET=your-client-secret
|
||||||
|
AZURE_REDIRECT_URI=https://your-app.com/auth/azure/callback
|
||||||
|
AZURE_TENANT_ID=
|
||||||
|
|
||||||
|
MICROSOFT_CLIENT_ID=your_client_id_here
|
||||||
|
MICROSOFT_CLIENT_SECRET=your_client_secret_here
|
||||||
|
MICROSOFT_REDIRECT_URI="${APP_URL}/auth/microsoft/callback"
|
||||||
@@ -43,3 +43,24 @@ public/userarea/class/curl_request_debug.log
|
|||||||
public/userarea/last_url.txt
|
public/userarea/last_url.txt
|
||||||
public/userarea/class/curl_auth_debug.log
|
public/userarea/class/curl_auth_debug.log
|
||||||
public/userarea/class/curl_request_debug.log
|
public/userarea/class/curl_request_debug.log
|
||||||
|
|
||||||
|
# Ignora tutti i log
|
||||||
|
*.log
|
||||||
|
|
||||||
|
|
||||||
|
# Ignora cartella photostrf in public/userarea
|
||||||
|
/public/userarea/photostrf/
|
||||||
|
public/userarea/customfield_values_response.json
|
||||||
|
/public/userarea/logaspi/
|
||||||
|
|
||||||
|
public/userarea/logsapi/campione_762_1.json
|
||||||
|
public/userarea/logsapi/campione_763_1.json
|
||||||
|
public/userarea/logsapi/campione_762_2.json
|
||||||
|
public/userarea/logsapi/campione_763_2.json
|
||||||
|
public/userarea/logsapi/commessaweb_create_762.json
|
||||||
|
public/userarea/logsapi/commessaweb_create_763.json
|
||||||
|
public/userarea/logsapi/commessaweb_customfields_762.json
|
||||||
|
public/userarea/logsapi/commessaweb_customfields_763.json
|
||||||
|
public/userarea/logsapi/commessaweb_invia_762.json
|
||||||
|
public/userarea/logsapi/commessaweb_invia_763.json
|
||||||
|
public/userarea/logsapi/last_auth_url.txt
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Userarea;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class UploadPhotosMobileController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$iddatadb = $request->query('iddatadb');
|
||||||
|
|
||||||
|
if (empty($iddatadb)) {
|
||||||
|
return response('ID riga non fornito', 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show the upload form
|
||||||
|
return view('userarea.upload_photos_mobile', [
|
||||||
|
'iddatadb' => $iddatadb
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function upload(Request $request)
|
||||||
|
{
|
||||||
|
// Validation
|
||||||
|
$request->validate([
|
||||||
|
'photo' => 'required|file|mimes:jpeg,png,gif,heic,heif|max:5120', // 5MB
|
||||||
|
'iddatadb' => 'required|integer'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$iddatadb = $request->input('iddatadb');
|
||||||
|
$photo = $request->file('photo');
|
||||||
|
$iduserlogin = auth()->id(); // assuming Laravel authentication
|
||||||
|
|
||||||
|
// Check if user exists
|
||||||
|
$userExists = DB::table('auth_users')->where('id', $iduserlogin)->exists();
|
||||||
|
if (!$userExists) {
|
||||||
|
return response()->json(['success' => false, 'message' => 'Utente non valido']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upload folder
|
||||||
|
$uploadDir = public_path('photostrf');
|
||||||
|
if (!is_dir($uploadDir)) {
|
||||||
|
mkdir($uploadDir, 0755, true);
|
||||||
|
}
|
||||||
|
if (!is_writable($uploadDir)) {
|
||||||
|
return response()->json(['success' => false, 'message' => 'La cartella photostrf non è scrivibile']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// New filename
|
||||||
|
$timestamp = now()->format('YmdHis');
|
||||||
|
$originalName = pathinfo($photo->getClientOriginalName(), PATHINFO_FILENAME);
|
||||||
|
$extension = strtolower($photo->getClientOriginalExtension());
|
||||||
|
|
||||||
|
$newFileName = "{$iddatadb}-{$timestamp}-{$originalName}.{$extension}";
|
||||||
|
$destination = $uploadDir . '/' . $newFileName;
|
||||||
|
|
||||||
|
// Move uploaded file
|
||||||
|
$photo->move($uploadDir, $newFileName);
|
||||||
|
|
||||||
|
// Save DB record
|
||||||
|
DB::table('datadb_photos')->insert([
|
||||||
|
'iddatadb' => $iddatadb,
|
||||||
|
'file_path' => $newFileName,
|
||||||
|
'file_name' => $newFileName,
|
||||||
|
'uploaded_by' => $iduserlogin
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json(['success' => true, 'message' => 'Foto caricata con successo']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,10 +28,21 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
\Illuminate\Database\Schema\Builder::defaultStringLength(191);
|
\Illuminate\Database\Schema\Builder::defaultStringLength(191);
|
||||||
|
|
||||||
Factory::guessFactoryNamesUsing(function (string $modelName) {
|
Factory::guessFactoryNamesUsing(function (string $modelName) {
|
||||||
return 'Database\Factories\\'.class_basename($modelName).'Factory';
|
return 'Database\Factories\\' . class_basename($modelName) . 'Factory';
|
||||||
});
|
});
|
||||||
|
|
||||||
\Illuminate\Pagination\Paginator::useBootstrap();
|
\Illuminate\Pagination\Paginator::useBootstrap();
|
||||||
|
|
||||||
|
// Register Microsoft Socialite driver
|
||||||
|
$this->app->make('Laravel\Socialite\Contracts\Factory')->extend('microsoft', function ($app) {
|
||||||
|
$config = $app['config']['services.microsoft'];
|
||||||
|
return new \SocialiteProviders\Microsoft\Provider(
|
||||||
|
$app['request'],
|
||||||
|
$config['client_id'],
|
||||||
|
$config['client_secret'],
|
||||||
|
$config['redirect']
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
Verified::class => [
|
Verified::class => [
|
||||||
ActivateUser::class,
|
ActivateUser::class,
|
||||||
],
|
],
|
||||||
|
\SocialiteProviders\Manager\SocialiteWasMapped::class => [
|
||||||
|
\SocialiteProviders\Microsoft\MicrosoftExtendSocialite::class,
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$app = new Illuminate\Foundation\Application(
|
$app = new Illuminate\Foundation\Application(
|
||||||
realpath(__DIR__.'/../')
|
realpath(__DIR__ . '/../')
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -38,12 +38,13 @@
|
|||||||
"laravel/fortify": "^1.21",
|
"laravel/fortify": "^1.21",
|
||||||
"laravel/framework": "^11.0",
|
"laravel/framework": "^11.0",
|
||||||
"laravel/sanctum": "^4.0",
|
"laravel/sanctum": "^4.0",
|
||||||
"laravel/socialite": "^5.0",
|
"laravel/socialite": "^5.16",
|
||||||
"laravel/tinker": "^2.7",
|
"laravel/tinker": "^2.7",
|
||||||
"laravel/ui": "^4.0",
|
"laravel/ui": "^4.0",
|
||||||
"phpmailer/phpmailer": "^6.9",
|
"phpmailer/phpmailer": "^6.9",
|
||||||
"phpoffice/phpspreadsheet": "^4.1",
|
"phpoffice/phpspreadsheet": "^4.1",
|
||||||
"proengsoft/laravel-jsvalidation": "^4.0.0",
|
"proengsoft/laravel-jsvalidation": "^4.0.0",
|
||||||
|
"socialiteproviders/microsoft": "^4.7",
|
||||||
"spatie/laravel-query-builder": "^5.0",
|
"spatie/laravel-query-builder": "^5.0",
|
||||||
"vanguardapp/activity-log": "^6.0",
|
"vanguardapp/activity-log": "^6.0",
|
||||||
"vanguardapp/announcements": "^6.0",
|
"vanguardapp/announcements": "^6.0",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "ef3e05e7260284f5b7c7b4b6f93b252b",
|
"content-hash": "9c4f1e3bc3ee2180211c055e70635aef",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "akaunting/laravel-setting",
|
"name": "akaunting/laravel-setting",
|
||||||
@@ -2240,16 +2240,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/socialite",
|
"name": "laravel/socialite",
|
||||||
"version": "v5.15.1",
|
"version": "v5.16.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/socialite.git",
|
"url": "https://github.com/laravel/socialite.git",
|
||||||
"reference": "cc02625f0bd1f95dc3688eb041cce0f1e709d029"
|
"reference": "40a2dc98c53d9dc6d55eadb0d490d3d72b73f1bf"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/socialite/zipball/cc02625f0bd1f95dc3688eb041cce0f1e709d029",
|
"url": "https://api.github.com/repos/laravel/socialite/zipball/40a2dc98c53d9dc6d55eadb0d490d3d72b73f1bf",
|
||||||
"reference": "cc02625f0bd1f95dc3688eb041cce0f1e709d029",
|
"reference": "40a2dc98c53d9dc6d55eadb0d490d3d72b73f1bf",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2271,16 +2271,16 @@
|
|||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "5.x-dev"
|
|
||||||
},
|
|
||||||
"laravel": {
|
"laravel": {
|
||||||
"providers": [
|
|
||||||
"Laravel\\Socialite\\SocialiteServiceProvider"
|
|
||||||
],
|
|
||||||
"aliases": {
|
"aliases": {
|
||||||
"Socialite": "Laravel\\Socialite\\Facades\\Socialite"
|
"Socialite": "Laravel\\Socialite\\Facades\\Socialite"
|
||||||
}
|
},
|
||||||
|
"providers": [
|
||||||
|
"Laravel\\Socialite\\SocialiteServiceProvider"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "5.x-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@@ -2308,7 +2308,7 @@
|
|||||||
"issues": "https://github.com/laravel/socialite/issues",
|
"issues": "https://github.com/laravel/socialite/issues",
|
||||||
"source": "https://github.com/laravel/socialite"
|
"source": "https://github.com/laravel/socialite"
|
||||||
},
|
},
|
||||||
"time": "2024-06-28T20:09:34+00:00"
|
"time": "2024-09-03T09:46:57+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/tinker",
|
"name": "laravel/tinker",
|
||||||
@@ -4980,6 +4980,131 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-04-27T21:32:50+00:00"
|
"time": "2024-04-27T21:32:50+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "socialiteproviders/manager",
|
||||||
|
"version": "v4.8.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/SocialiteProviders/Manager.git",
|
||||||
|
"reference": "8180ec14bef230ec2351cff993d5d2d7ca470ef4"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/SocialiteProviders/Manager/zipball/8180ec14bef230ec2351cff993d5d2d7ca470ef4",
|
||||||
|
"reference": "8180ec14bef230ec2351cff993d5d2d7ca470ef4",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0",
|
||||||
|
"laravel/socialite": "^5.5",
|
||||||
|
"php": "^8.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "^1.2",
|
||||||
|
"phpunit/phpunit": "^9.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"SocialiteProviders\\Manager\\ServiceProvider"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"SocialiteProviders\\Manager\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Andy Wendt",
|
||||||
|
"email": "andy@awendt.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Anton Komarev",
|
||||||
|
"email": "a.komarev@cybercog.su"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Miguel Piedrafita",
|
||||||
|
"email": "soy@miguelpiedrafita.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "atymic",
|
||||||
|
"email": "atymicq@gmail.com",
|
||||||
|
"homepage": "https://atymic.dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Easily add new or override built-in providers in Laravel Socialite.",
|
||||||
|
"homepage": "https://socialiteproviders.com",
|
||||||
|
"keywords": [
|
||||||
|
"laravel",
|
||||||
|
"manager",
|
||||||
|
"oauth",
|
||||||
|
"providers",
|
||||||
|
"socialite"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/socialiteproviders/manager/issues",
|
||||||
|
"source": "https://github.com/socialiteproviders/manager"
|
||||||
|
},
|
||||||
|
"time": "2025-02-24T19:33:30+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "socialiteproviders/microsoft",
|
||||||
|
"version": "4.7.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/SocialiteProviders/Microsoft.git",
|
||||||
|
"reference": "824ef97a4f6e3f363c21702b76676d54e8265573"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/SocialiteProviders/Microsoft/zipball/824ef97a4f6e3f363c21702b76676d54e8265573",
|
||||||
|
"reference": "824ef97a4f6e3f363c21702b76676d54e8265573",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-json": "*",
|
||||||
|
"firebase/php-jwt": "^6.8",
|
||||||
|
"php": "^8.0",
|
||||||
|
"socialiteproviders/manager": "^4.4"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"SocialiteProviders\\Microsoft\\": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Brian Faust",
|
||||||
|
"email": "hello@brianfaust.de"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Microsoft OAuth2 Provider for Laravel Socialite",
|
||||||
|
"keywords": [
|
||||||
|
"laravel",
|
||||||
|
"microsoft",
|
||||||
|
"oauth",
|
||||||
|
"provider",
|
||||||
|
"socialite"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"docs": "https://socialiteproviders.com/microsoft",
|
||||||
|
"issues": "https://github.com/socialiteproviders/providers/issues",
|
||||||
|
"source": "https://github.com/socialiteproviders/providers"
|
||||||
|
},
|
||||||
|
"time": "2025-07-06T00:25:25+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "spatie/laravel-package-tools",
|
"name": "spatie/laravel-package-tools",
|
||||||
"version": "1.16.4",
|
"version": "1.16.4",
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ return [
|
|||||||
Proengsoft\JsValidation\JsValidationServiceProvider::class,
|
Proengsoft\JsValidation\JsValidationServiceProvider::class,
|
||||||
Anhskohbo\NoCaptcha\NoCaptchaServiceProvider::class,
|
Anhskohbo\NoCaptcha\NoCaptchaServiceProvider::class,
|
||||||
Laravel\Socialite\SocialiteServiceProvider::class,
|
Laravel\Socialite\SocialiteServiceProvider::class,
|
||||||
|
\SocialiteProviders\Manager\ServiceProvider::class,
|
||||||
Webpatser\Countries\CountriesServiceProvider::class,
|
Webpatser\Countries\CountriesServiceProvider::class,
|
||||||
Intervention\Image\ImageServiceProvider::class,
|
Intervention\Image\ImageServiceProvider::class,
|
||||||
Jenssegers\Agent\AgentServiceProvider::class,
|
Jenssegers\Agent\AgentServiceProvider::class,
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// 'social' => [
|
'social' => [
|
||||||
// 'providers' => ['facebook', 'twitter', 'google'],
|
'providers' => ['microsoft'],
|
||||||
// ],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -64,9 +64,15 @@ return [
|
|||||||
'redirect' => env('GOOGLE_CALLBACK_URI'),
|
'redirect' => env('GOOGLE_CALLBACK_URI'),
|
||||||
],
|
],
|
||||||
|
|
||||||
// 'authy' => [
|
'microsoft' => [
|
||||||
// 'key' => env('AUTHY_KEY'),
|
'client_id' => env('MICROSOFT_CLIENT_ID'),
|
||||||
// ],
|
'client_secret' => env('MICROSOFT_CLIENT_SECRET'),
|
||||||
|
'redirect' => env('MICROSOFT_REDIRECT_URI'),
|
||||||
|
],
|
||||||
|
|
||||||
|
// 'authy' => [
|
||||||
|
// 'key' => env('AUTHY_KEY'),
|
||||||
|
// ],
|
||||||
|
|
||||||
'resend' => [
|
'resend' => [
|
||||||
'key' => env('RESEND_KEY'),
|
'key' => env('RESEND_KEY'),
|
||||||
|
|||||||
@@ -32,3 +32,4 @@ $langdatatables = [
|
|||||||
"paginate_next" => "Next",
|
"paginate_next" => "Next",
|
||||||
"paginate_previous" => "Previous"
|
"paginate_previous" => "Previous"
|
||||||
];
|
];
|
||||||
|
$quotationstitle = "Quotations";
|
||||||
|
|||||||
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 451 B |
|
After Width: | Height: | Size: 510 B |
|
After Width: | Height: | Size: 462 B |
|
After Width: | Height: | Size: 443 B |
|
After Width: | Height: | Size: 460 B |
|
After Width: | Height: | Size: 454 B |
|
After Width: | Height: | Size: 456 B |
|
After Width: | Height: | Size: 460 B |
|
After Width: | Height: | Size: 457 B |
|
After Width: | Height: | Size: 454 B |
|
After Width: | Height: | Size: 455 B |
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
ob_start();
|
||||||
|
session_start();
|
||||||
|
require_once '../../vendor/autoload.php';
|
||||||
|
|
||||||
|
$response = ['error' => '', 'rows' => [], 'columns' => [], 'template_id' => 0, 'filename' => '', 'excel_data' => []];
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$input = json_decode(file_get_contents('php://input'), true);
|
||||||
|
$template_id = isset($input['template_id']) ? intval($input['template_id']) : 0;
|
||||||
|
$filename = $input['routine_data']['filename'] ?? '';
|
||||||
|
$headerrow = $input['routine_data']['headerrow'] ?? 1;
|
||||||
|
$excelData = $input['excel_data'] ?? [];
|
||||||
|
$routineData = $input['routine_data'] ?? [];
|
||||||
|
|
||||||
|
if (!$filename || empty($excelData)) {
|
||||||
|
throw new Exception("Dati della routine mancanti.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$routineFile = __DIR__ . '/routines/' . $filename;
|
||||||
|
if (file_exists($routineFile)) {
|
||||||
|
include_once $routineFile;
|
||||||
|
$routineData['xls_headers'] = $_SESSION['headers'] ?? [];
|
||||||
|
applyRoutine($excelData, $routineData); // Modifica $excelData in place
|
||||||
|
error_log("Routine {$routineData['name']} applicata (file: {$filename}) per template {$template_id}, header row: {$headerrow}");
|
||||||
|
} else {
|
||||||
|
throw new Exception("File della routine non trovato: $routineFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggiorna la sessione con i dati modificati
|
||||||
|
$_SESSION['excel_data'] = $excelData;
|
||||||
|
|
||||||
|
$response['excel_data'] = $excelData;
|
||||||
|
$response['rows'] = array_column($excelData, 'data');
|
||||||
|
$response['columns'] = $_SESSION['headers'];
|
||||||
|
$response['template_id'] = $template_id;
|
||||||
|
$response['filename'] = $input['filename'] ?? '';
|
||||||
|
} else {
|
||||||
|
$response['error'] = "Richiesta non valida.";
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$response['error'] = "Errore durante l'applicazione della routine: " . $e->getMessage();
|
||||||
|
error_log("Exception in apply_routine.php: " . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_end_clean();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($response);
|
||||||
|
exit;
|
||||||
@@ -120,4 +120,76 @@ class VisualLimsApiClient
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function post($endpoint, $payload)
|
||||||
|
{
|
||||||
|
$token = $this->getToken();
|
||||||
|
$url = "{$this->baseUrl}/api/odata/{$endpoint}";
|
||||||
|
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
"Authorization: Bearer {$token}",
|
||||||
|
"Content-Type: application/json",
|
||||||
|
"Accept: application/json"
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false) {
|
||||||
|
throw new Exception("Errore nella richiesta POST: {$curl_error}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($http_code < 200 || $http_code >= 300) {
|
||||||
|
throw new Exception("POST fallito: HTTP {$http_code}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_decode($response, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function patch($endpoint, $payload)
|
||||||
|
{
|
||||||
|
$token = $this->getToken();
|
||||||
|
$url = "{$this->baseUrl}/api/odata/{$endpoint}";
|
||||||
|
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
"Authorization: Bearer {$token}",
|
||||||
|
"Content-Type: application/json",
|
||||||
|
"Accept: application/json"
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false) {
|
||||||
|
throw new Exception("Errore nella richiesta PATCH: {$curl_error}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($http_code < 200 || $http_code >= 300) {
|
||||||
|
throw new Exception("PATCH fallito: HTTP {$http_code}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_decode($response, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBaseUrl()
|
||||||
|
{
|
||||||
|
return $this->baseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 3) . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
use Dotenv\Dotenv;
|
||||||
|
|
||||||
|
class VisualLimsApiClientXml
|
||||||
|
{
|
||||||
|
private static $instance = null;
|
||||||
|
private $baseUrl;
|
||||||
|
private $username;
|
||||||
|
private $password;
|
||||||
|
private $token = null;
|
||||||
|
|
||||||
|
private function __construct()
|
||||||
|
{
|
||||||
|
$dotenv = Dotenv::createImmutable(dirname(__DIR__, 3));
|
||||||
|
$dotenv->load();
|
||||||
|
|
||||||
|
$this->baseUrl = $_ENV['API_BASE_URL'];
|
||||||
|
$this->username = $_ENV['API_USERNAME'];
|
||||||
|
$this->password = $_ENV['API_PASSWORD'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInstance()
|
||||||
|
{
|
||||||
|
if (self::$instance === null) {
|
||||||
|
self::$instance = new VisualLimsApiClientXml();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function authenticate()
|
||||||
|
{
|
||||||
|
$ch = curl_init("{$this->baseUrl}/api/authentication/authenticate");
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
|
||||||
|
'Username' => $this->username,
|
||||||
|
'Password' => $this->password
|
||||||
|
]));
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Accept: application/json'
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen(__DIR__ . '/curl_auth_debug_xml.log', 'w') ?: fopen('php://stderr', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false || $http_code != 200) {
|
||||||
|
throw new Exception("Autenticazione fallita: HTTP {$http_code}, Errore cURL: {$curl_error}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
$token_data = json_decode($response, true);
|
||||||
|
$this->token = null;
|
||||||
|
|
||||||
|
if (is_array($token_data) && isset($token_data['token'])) {
|
||||||
|
$this->token = $token_data['token'];
|
||||||
|
} elseif (is_string($token_data) && !empty($token_data)) {
|
||||||
|
$this->token = trim($token_data, '"');
|
||||||
|
} elseif (is_string($response) && !empty($response)) {
|
||||||
|
$this->token = trim($response, '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->token)) {
|
||||||
|
throw new Exception("Token non ricevuto: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getToken()
|
||||||
|
{
|
||||||
|
if ($this->token === null) {
|
||||||
|
$this->authenticate();
|
||||||
|
}
|
||||||
|
return $this->token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($endpoint, $options = [])
|
||||||
|
{
|
||||||
|
$token = $this->getToken();
|
||||||
|
$query = http_build_query($options);
|
||||||
|
$url = "{$this->baseUrl}/api/odata/{$endpoint}" . ($query ? '?' . $query : '');
|
||||||
|
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
"Authorization: Bearer {$token}",
|
||||||
|
"Accept: application/xml"
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen(__DIR__ . '/curl_request_debug_xml.log', 'w') ?: fopen('php://stderr', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false) {
|
||||||
|
throw new Exception("Errore nella richiesta: {$curl_error}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($http_code !== 200) {
|
||||||
|
throw new Exception("Errore nel recupero dati: HTTP {$http_code}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifica che la risposta sia XML
|
||||||
|
if (strpos($response, '<?xml') !== 0) {
|
||||||
|
throw new Exception("Risposta non valida: atteso formato XML, ricevuto: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 3) . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
use Dotenv\Dotenv;
|
||||||
|
|
||||||
|
class VisualLimsApiClientXml
|
||||||
|
{
|
||||||
|
private static $instance = null;
|
||||||
|
private $baseUrl;
|
||||||
|
private $username;
|
||||||
|
private $password;
|
||||||
|
private $token = null;
|
||||||
|
|
||||||
|
private function __construct()
|
||||||
|
{
|
||||||
|
$dotenv = Dotenv::createImmutable(dirname(__DIR__, 3));
|
||||||
|
$dotenv->load();
|
||||||
|
|
||||||
|
$this->baseUrl = $_ENV['API_BASE_URL'];
|
||||||
|
$this->username = $_ENV['API_USERNAME'];
|
||||||
|
$this->password = $_ENV['API_PASSWORD'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getInstance()
|
||||||
|
{
|
||||||
|
if (self::$instance === null) {
|
||||||
|
self::$instance = new VisualLimsApiClientXml();
|
||||||
|
}
|
||||||
|
return self::$instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function authenticate()
|
||||||
|
{
|
||||||
|
$ch = curl_init("{$this->baseUrl}/api/authentication/authenticate");
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
|
||||||
|
'Username' => $this->username,
|
||||||
|
'Password' => $this->password
|
||||||
|
]));
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Accept: application/json'
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen(__DIR__ . '/curl_auth_debug_xml.log', 'w') ?: fopen('php://stderr', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false || $http_code != 200) {
|
||||||
|
throw new Exception("Autenticazione fallita: HTTP {$http_code}, Errore cURL: {$curl_error}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
$token_data = json_decode($response, true);
|
||||||
|
$this->token = null;
|
||||||
|
|
||||||
|
if (is_array($token_data) && isset($token_data['token'])) {
|
||||||
|
$this->token = $token_data['token'];
|
||||||
|
} elseif (is_string($token_data) && !empty($token_data)) {
|
||||||
|
$this->token = trim($token_data, '"');
|
||||||
|
} elseif (is_string($response) && !empty($response)) {
|
||||||
|
$this->token = trim($response, '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->token)) {
|
||||||
|
throw new Exception("Token non ricevuto: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getToken()
|
||||||
|
{
|
||||||
|
if ($this->token === null) {
|
||||||
|
$this->authenticate();
|
||||||
|
}
|
||||||
|
return $this->token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($endpoint, $options = [])
|
||||||
|
{
|
||||||
|
$token = $this->getToken();
|
||||||
|
$query = http_build_query($options);
|
||||||
|
$url = "{$this->baseUrl}/api/odata/{$endpoint}" . ($query ? '?' . $query : '');
|
||||||
|
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||||
|
"Authorization: Bearer {$token}",
|
||||||
|
"Accept: application/xml"
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
$log = fopen(__DIR__ . '/curl_request_debug_xml.log', 'w') ?: fopen('php://stderr', 'w');
|
||||||
|
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
$curl_error = curl_error($ch);
|
||||||
|
fclose($log);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
if ($response === false) {
|
||||||
|
throw new Exception("Errore nella richiesta: {$curl_error}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($http_code !== 200) {
|
||||||
|
throw new Exception("Errore nel recupero dati: HTTP {$http_code}, Risposta: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verifica che la risposta sia XML
|
||||||
|
if (strpos($response, '<?xml') !== 0) {
|
||||||
|
throw new Exception("Risposta non valida: atteso formato XML, ricevuto: " . substr($response, 0, 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
* Trying 93.43.5.102:443...
|
|
||||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
|
||||||
* ALPN: curl offers h2,http/1.1
|
|
||||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
|
||||||
* ALPN: server accepted h2
|
|
||||||
* Server certificate:
|
|
||||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
|
||||||
* start date: Feb 17 00:00:00 2025 GMT
|
|
||||||
* expire date: Feb 17 23:59:59 2026 GMT
|
|
||||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
|
||||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
|
||||||
* using HTTP/2
|
|
||||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
|
|
||||||
* [HTTP/2] [1] [:method: POST]
|
|
||||||
* [HTTP/2] [1] [:scheme: https]
|
|
||||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
|
||||||
* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
|
|
||||||
* [HTTP/2] [1] [content-type: application/json]
|
|
||||||
* [HTTP/2] [1] [accept: application/json]
|
|
||||||
* [HTTP/2] [1] [content-length: 51]
|
|
||||||
> POST /limsapi/api/authentication/authenticate HTTP/2
|
|
||||||
Host: 93.43.5.102
|
|
||||||
Content-Type: application/json
|
|
||||||
Accept: application/json
|
|
||||||
Content-Length: 51
|
|
||||||
|
|
||||||
< HTTP/2 200
|
|
||||||
< cache-control: max-age=0
|
|
||||||
< content-type: application/json; charset=utf-8
|
|
||||||
< server: Microsoft-IIS/10.0
|
|
||||||
< strict-transport-security: max-age=2592000
|
|
||||||
< x-powered-by: ASP.NET
|
|
||||||
< x-content-type-options: nosniff
|
|
||||||
< date: Wed, 20 Aug 2025 15:35:19 GMT
|
|
||||||
<
|
|
||||||
* Connection #0 to host 93.43.5.102 left intact
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
* Trying 93.43.5.102:443...
|
|
||||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
|
||||||
* ALPN: curl offers h2,http/1.1
|
|
||||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
|
||||||
* ALPN: server accepted h2
|
|
||||||
* Server certificate:
|
|
||||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
|
||||||
* start date: Feb 17 00:00:00 2025 GMT
|
|
||||||
* expire date: Feb 17 23:59:59 2026 GMT
|
|
||||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
|
||||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
|
||||||
* using HTTP/2
|
|
||||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
* [HTTP/2] [1] [:method: GET]
|
|
||||||
* [HTTP/2] [1] [:scheme: https]
|
|
||||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
|
||||||
* [HTTP/2] [1] [:path: /limsapi/api/odata/SchemaCustomField]
|
|
||||||
* [HTTP/2] [1] [authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc1NTcxMTMxOSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.jY0MCCCy94eGWlodWV1TPv2SeQ7me_Hf1MJmU6TbVik]
|
|
||||||
* [HTTP/2] [1] [accept: application/json]
|
|
||||||
> GET /limsapi/api/odata/SchemaCustomField HTTP/2
|
|
||||||
Host: 93.43.5.102
|
|
||||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc1NTcxMTMxOSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.jY0MCCCy94eGWlodWV1TPv2SeQ7me_Hf1MJmU6TbVik
|
|
||||||
Accept: application/json
|
|
||||||
|
|
||||||
< HTTP/2 200
|
|
||||||
< cache-control: max-age=0
|
|
||||||
< content-type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
|
|
||||||
< server: Microsoft-IIS/10.0
|
|
||||||
< strict-transport-security: max-age=2592000
|
|
||||||
< odata-version: 4.0
|
|
||||||
< x-powered-by: ASP.NET
|
|
||||||
< x-content-type-options: nosniff
|
|
||||||
< date: Wed, 20 Aug 2025 15:35:19 GMT
|
|
||||||
<
|
|
||||||
* Connection #0 to host 93.43.5.102 left intact
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
* Trying 93.43.5.102:443...
|
|
||||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
|
||||||
* ALPN: curl offers h2,http/1.1
|
|
||||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
|
||||||
* ALPN: server accepted h2
|
|
||||||
* Server certificate:
|
|
||||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
|
||||||
* start date: Feb 17 00:00:00 2025 GMT
|
|
||||||
* expire date: Feb 17 23:59:59 2026 GMT
|
|
||||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
|
||||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
|
||||||
* using HTTP/2
|
|
||||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
|
|
||||||
* [HTTP/2] [1] [:method: POST]
|
|
||||||
* [HTTP/2] [1] [:scheme: https]
|
|
||||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
|
||||||
* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
|
|
||||||
* [HTTP/2] [1] [content-type: application/json]
|
|
||||||
* [HTTP/2] [1] [accept: application/json]
|
|
||||||
* [HTTP/2] [1] [content-length: 51]
|
|
||||||
> POST /limsapi/api/authentication/authenticate HTTP/2
|
|
||||||
Host: 93.43.5.102
|
|
||||||
Content-Type: application/json
|
|
||||||
Accept: application/json
|
|
||||||
Content-Length: 51
|
|
||||||
|
|
||||||
< HTTP/2 200
|
|
||||||
< cache-control: max-age=0
|
|
||||||
< content-type: application/json; charset=utf-8
|
|
||||||
< server: Microsoft-IIS/10.0
|
|
||||||
< strict-transport-security: max-age=2592000
|
|
||||||
< x-powered-by: ASP.NET
|
|
||||||
< x-content-type-options: nosniff
|
|
||||||
< date: Tue, 03 Jun 2025 15:07:55 GMT
|
|
||||||
<
|
|
||||||
* Connection #0 to host 93.43.5.102 left intact
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
* Trying 93.43.5.102:443...
|
|
||||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
|
||||||
* ALPN: curl offers h2,http/1.1
|
|
||||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
|
||||||
* ALPN: server accepted h2
|
|
||||||
* Server certificate:
|
|
||||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
|
||||||
* start date: Feb 17 00:00:00 2025 GMT
|
|
||||||
* expire date: Feb 17 23:59:59 2026 GMT
|
|
||||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
|
||||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
|
||||||
* using HTTP/2
|
|
||||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/odata/Cliente
|
|
||||||
* [HTTP/2] [1] [:method: GET]
|
|
||||||
* [HTTP/2] [1] [:scheme: https]
|
|
||||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
|
||||||
* [HTTP/2] [1] [:path: /limsapi/api/odata/Cliente]
|
|
||||||
* [HTTP/2] [1] [authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1OTY5MiwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.O60U9XXapZOj0U3GuOIU0eiwgcUkzXTW6Eqy5f6q9D8]
|
|
||||||
* [HTTP/2] [1] [accept: application/json]
|
|
||||||
> GET /limsapi/api/odata/Cliente HTTP/2
|
|
||||||
Host: 93.43.5.102
|
|
||||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1OTY5MiwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.O60U9XXapZOj0U3GuOIU0eiwgcUkzXTW6Eqy5f6q9D8
|
|
||||||
Accept: application/json
|
|
||||||
|
|
||||||
< HTTP/2 200
|
|
||||||
< cache-control: max-age=0
|
|
||||||
< content-type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
|
|
||||||
< server: Microsoft-IIS/10.0
|
|
||||||
< strict-transport-security: max-age=2592000
|
|
||||||
< odata-version: 4.0
|
|
||||||
< x-powered-by: ASP.NET
|
|
||||||
< x-content-type-options: nosniff
|
|
||||||
< date: Tue, 03 Jun 2025 12:08:45 GMT
|
|
||||||
<
|
|
||||||
* Connection #0 to host 93.43.5.102 left intact
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
* Trying 93.43.5.102:443...
|
|
||||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
|
||||||
* ALPN: curl offers h2,http/1.1
|
|
||||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
|
||||||
* ALPN: server accepted h2
|
|
||||||
* Server certificate:
|
|
||||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
|
||||||
* start date: Feb 17 00:00:00 2025 GMT
|
|
||||||
* expire date: Feb 17 23:59:59 2026 GMT
|
|
||||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
|
||||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
|
||||||
* using HTTP/2
|
|
||||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
|
|
||||||
* [HTTP/2] [1] [:method: POST]
|
|
||||||
* [HTTP/2] [1] [:scheme: https]
|
|
||||||
* [HTTP/2] [1] [:authority: iftm.it]
|
|
||||||
* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
|
|
||||||
* [HTTP/2] [1] [content-type: application/json]
|
|
||||||
* [HTTP/2] [1] [accept: application/json]
|
|
||||||
* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
|
|
||||||
* [HTTP/2] [1] [content-length: 51]
|
|
||||||
> POST /limsapi/api/authentication/authenticate HTTP/2
|
|
||||||
Host: iftm.it
|
|
||||||
Content-Type: application/json
|
|
||||||
Accept: application/json
|
|
||||||
User-Agent: Mozilla/5.0 (compatible; PHP cURL)
|
|
||||||
Content-Length: 51
|
|
||||||
|
|
||||||
< HTTP/2 200
|
|
||||||
< cache-control: max-age=0
|
|
||||||
< content-type: application/json; charset=utf-8
|
|
||||||
< server: Microsoft-IIS/10.0
|
|
||||||
< strict-transport-security: max-age=2592000
|
|
||||||
< x-powered-by: ASP.NET
|
|
||||||
< x-content-type-options: nosniff
|
|
||||||
< date: Tue, 03 Jun 2025 10:19:09 GMT
|
|
||||||
<
|
|
||||||
* Connection #0 to host 93.43.5.102 left intact
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
HTTP Code: 200
|
|
||||||
Response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTAyMSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.KntKk8Up-9owFjy7onziK2BfncEnSNhizyNX9S-QHaw"
|
|
||||||
|
|
||||||
HTTP Code: 200
|
|
||||||
Response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTEyNSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.IWjzzBg0kQ3lq4aK2ByMlY7Bwzb7Qq-6ziXV8kkZ2J0"
|
|
||||||
|
|
||||||
HTTP Code: 200
|
|
||||||
Response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTI2NSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.UgVz6PTF9dmbFYdgyRZS0TcI0pvLEIQ3yMjPiicF1vs"
|
|
||||||
|
|
||||||
HTTP Code: 200
|
|
||||||
Response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTMwNywiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.PolfU_FWuVMd-YfonBYTo0i0qIl6kn6nUkCWCEBvZuA"
|
|
||||||
|
|
||||||
HTTP Code: 200
|
|
||||||
Response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTQ0OSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.CGZ-9KbMmW19JYTVGfjIcbNscSsGB4dwoHCJkHHs_4M"
|
|
||||||
|
|
||||||
HTTP Code: 200
|
|
||||||
Response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTc1MCwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.FCAm5sWed1Q-QiIsctMgSBfEd4sfN3kfVR3Mqd3XQz0"
|
|
||||||
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
* Trying 93.43.5.102:443...
|
|
||||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
|
||||||
* ALPN: curl offers h2,http/1.1
|
|
||||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
|
||||||
* ALPN: server accepted h2
|
|
||||||
* Server certificate:
|
|
||||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
|
||||||
* start date: Feb 17 00:00:00 2025 GMT
|
|
||||||
* expire date: Feb 17 23:59:59 2026 GMT
|
|
||||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
|
||||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
|
||||||
* using HTTP/2
|
|
||||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/odata/Cliente(5860)?$expand=SchemiAbilitati
|
|
||||||
* [HTTP/2] [1] [:method: GET]
|
|
||||||
* [HTTP/2] [1] [:scheme: https]
|
|
||||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
|
||||||
* [HTTP/2] [1] [:path: /limsapi/api/odata/Cliente(5860)?$expand=SchemiAbilitati]
|
|
||||||
* [HTTP/2] [1] [authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk3MDQ3NSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.vABzuZkQE9luU_uc4e18AYiM5c2Jnf-z1Q3sofbz6O0]
|
|
||||||
* [HTTP/2] [1] [accept: application/json]
|
|
||||||
> GET /limsapi/api/odata/Cliente(5860)?$expand=SchemiAbilitati HTTP/2
|
|
||||||
Host: 93.43.5.102
|
|
||||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk3MDQ3NSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.vABzuZkQE9luU_uc4e18AYiM5c2Jnf-z1Q3sofbz6O0
|
|
||||||
Accept: application/json
|
|
||||||
|
|
||||||
< HTTP/2 200
|
|
||||||
< cache-control: max-age=0
|
|
||||||
< content-type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
|
|
||||||
< server: Microsoft-IIS/10.0
|
|
||||||
< strict-transport-security: max-age=2592000
|
|
||||||
< odata-version: 4.0
|
|
||||||
< x-powered-by: ASP.NET
|
|
||||||
< x-content-type-options: nosniff
|
|
||||||
< date: Tue, 03 Jun 2025 15:07:56 GMT
|
|
||||||
<
|
|
||||||
* Connection #0 to host 93.43.5.102 left intact
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
* Trying 93.43.5.102:443...
|
|
||||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
|
||||||
* ALPN: curl offers h2,http/1.1
|
|
||||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
|
||||||
* ALPN: server accepted h2
|
|
||||||
* Server certificate:
|
|
||||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
|
||||||
* start date: Feb 17 00:00:00 2025 GMT
|
|
||||||
* expire date: Feb 17 23:59:59 2026 GMT
|
|
||||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
|
||||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
|
||||||
* using HTTP/2
|
|
||||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/odata/Cliente(0)?$expand=SchemiAbilitati
|
|
||||||
* [HTTP/2] [1] [:method: GET]
|
|
||||||
* [HTTP/2] [1] [:scheme: https]
|
|
||||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
|
||||||
* [HTTP/2] [1] [:path: /limsapi/api/odata/Cliente(0)?$expand=SchemiAbilitati]
|
|
||||||
* [HTTP/2] [1] [authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk2NTQ4MywiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.oSwFJRuj0lDD7D6dOLIZWhn_Lzma0b38dLPEDIOMD7o]
|
|
||||||
* [HTTP/2] [1] [accept: application/json]
|
|
||||||
> GET /limsapi/api/odata/Cliente(0)?$expand=SchemiAbilitati HTTP/2
|
|
||||||
Host: 93.43.5.102
|
|
||||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk2NTQ4MywiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.oSwFJRuj0lDD7D6dOLIZWhn_Lzma0b38dLPEDIOMD7o
|
|
||||||
Accept: application/json
|
|
||||||
|
|
||||||
< HTTP/2 404
|
|
||||||
< cache-control: no-cache,no-store,max-age=0
|
|
||||||
< pragma: no-cache
|
|
||||||
< content-type: application/problem+json
|
|
||||||
< expires: -1
|
|
||||||
< server: Microsoft-IIS/10.0
|
|
||||||
< x-powered-by: ASP.NET
|
|
||||||
< x-content-type-options: nosniff
|
|
||||||
< date: Tue, 03 Jun 2025 13:44:44 GMT
|
|
||||||
<
|
|
||||||
* Connection #0 to host 93.43.5.102 left intact
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":4101,"message":"Tracking No. already exists."},"data":{"id":"9e85e85acd18a1c92d9fa1f6fede8a23","tracking_number":"750000810057432004040056","courier_code":"tnt-it"}}
|
|
||||||
HTTP Code: 400
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":4101,"message":"Tracking No. already exists."},"data":{"id":"9e85e85acd18a1c92d9fa1f6fede8a23","tracking_number":"750000810057432004040056","courier_code":"tnt-it"},"success":false,"http_code":400}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings?tracking_numbers=750000810057432004040056&courier_code=tnt-it
|
|
||||||
Request Data: []
|
|
||||||
Response: {"meta":{"code":200,"type":"Success","message":"The request was successful."},"data":[]}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Get Response: {"meta":{"code":200,"type":"Success","message":"The request was successful."},"data":[],"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":4101,"message":"Tracking No. already exists."},"data":{"id":"9e85e85acd18a1c92d9fa1f6fede8a23","tracking_number":"750000810057432004040056","courier_code":"tnt-it"}}
|
|
||||||
HTTP Code: 400
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":4101,"message":"Tracking No. already exists."},"data":{"id":"9e85e85acd18a1c92d9fa1f6fede8a23","tracking_number":"750000810057432004040056","courier_code":"tnt-it"},"success":false,"http_code":400}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/get?tracking_numbers=750000810057432004040056&courier_code=tnt-it
|
|
||||||
Request Data: []
|
|
||||||
Response: {"meta":{"code":200,"type":"Success","message":"The request was successful."},"data":[]}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Get Response: {"meta":{"code":200,"type":"Success","message":"The request was successful."},"data":[],"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":4101,"message":"Tracking No. already exists."},"data":{"id":"9e85e85acd18a1c92d9fa1f6fede8a23","tracking_number":"750000810057432004040056","courier_code":"tnt-it"}}
|
|
||||||
HTTP Code: 400
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":4101,"message":"Tracking No. already exists."},"data":{"id":"9e85e85acd18a1c92d9fa1f6fede8a23","tracking_number":"750000810057432004040056","courier_code":"tnt-it"},"success":false,"http_code":400}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/get?tracking_numbers=750000810057432004040056
|
|
||||||
Request Data: []
|
|
||||||
Response: {"meta":{"code":200,"type":"Success","message":"The request was successful."},"data":[]}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Get Response: {"meta":{"code":200,"type":"Success","message":"The request was successful."},"data":[],"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e85f77564ba2d1b2d35c7b28c72e62b","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-03-26T09:43:15+00:00","update_at":"2025-03-26T09:01:02+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}}}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e85f77564ba2d1b2d35c7b28c72e62b","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-03-26T09:43:15+00:00","update_at":"2025-03-26T09:01:02+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}},"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e8601d0116ffa9f4abe6fa609f27214","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-03-26T10:12:12+00:00","update_at":"2025-03-26T09:43:15+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}}}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e8601d0116ffa9f4abe6fa609f27214","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-03-26T10:12:12+00:00","update_at":"2025-03-26T09:43:15+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}},"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "75000",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"75000","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e88676cc0b94ee0270add7c597d0cb0","tracking_number":"75000","courier_code":"tnt-it","order_number":"75000","order_date":null,"created_at":"2025-03-27T14:47:59+00:00","update_at":null,"delivery_status":"pending","archived":"tracking","updating":true,"source":"API","destination_country":null,"destination_state":null,"destination_city":null,"origin_country":null,"origin_state":null,"origin_city":null,"tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":null,"service_code":null,"weight":null,"weight_kg":null,"product_type":null,"pieces":null,"dimension":null,"previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"pending002","status_info":null,"latest_event":null,"latest_checkpoint_time":null,"transit_time":0,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}}}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e88676cc0b94ee0270add7c597d0cb0","tracking_number":"75000","courier_code":"tnt-it","order_number":"75000","order_date":null,"created_at":"2025-03-27T14:47:59+00:00","update_at":null,"delivery_status":"pending","archived":"tracking","updating":true,"source":"API","destination_country":null,"destination_state":null,"destination_city":null,"origin_country":null,"origin_state":null,"origin_city":null,"tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":null,"service_code":null,"weight":null,"weight_kg":null,"product_type":null,"pieces":null,"dimension":null,"previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"pending002","status_info":null,"latest_event":null,"latest_checkpoint_time":null,"transit_time":0,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}},"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e8867d062b0ddfac8655e3d81b289af","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-03-27T14:49:04+00:00","update_at":"2025-03-26T10:12:12+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}}}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e8867d062b0ddfac8655e3d81b289af","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-03-27T14:49:04+00:00","update_at":"2025-03-26T10:12:12+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}},"success":true,"http_code":200}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "123",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"123","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":4110,"message":"The value of tracking_number is invalid."},"data":null}
|
|
||||||
HTTP Code: 400
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":4110,"message":"The value of tracking_number is invalid."},"data":null,"success":false,"http_code":400}
|
|
||||||
Encoded JSON Data: {
|
|
||||||
"tracking_number": "750000810057432004040056",
|
|
||||||
"courier_code": "tnt-it"
|
|
||||||
}
|
|
||||||
Request URL: https://api.trackingmore.com/v4/trackings/create
|
|
||||||
Request Data: {"tracking_number":"750000810057432004040056","courier_code":"tnt-it"}
|
|
||||||
Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e9652c58e37fc7c8c9b08e9f2eb8f8e","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-04-03T12:51:49+00:00","update_at":"2025-04-01T09:02:08+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}}}
|
|
||||||
HTTP Code: 200
|
|
||||||
Error:
|
|
||||||
Create Response: {"meta":{"code":200,"message":"Request response is successful"},"data":{"id":"9e9652c58e37fc7c8c9b08e9f2eb8f8e","tracking_number":"750000810057432004040056","courier_code":"tnt-it","order_number":"750000810057432004040056","order_date":null,"created_at":"2025-04-03T12:51:49+00:00","update_at":"2025-04-01T09:02:08+00:00","delivery_status":"delivered","archived":"tracking","updating":false,"source":"API","destination_country":"IT","destination_state":"MB","destination_city":"MEDA","origin_country":null,"origin_state":"BS","origin_city":"BRESCIA","tracking_postal_code":null,"tracking_ship_date":null,"tracking_destination_country":null,"tracking_origin_country":null,"tracking_key":null,"tracking_courier_account":null,"customer_name":null,"customer_email":null,"customer_sms":null,"recipient_postcode":null,"order_id":null,"title":null,"logistics_channel":null,"note":null,"label":null,"signed_by":"SIRONI","service_code":"Express","weight":"0,020","weight_kg":null,"product_type":null,"pieces":"1","dimension":"0,001","previously":null,"destination_track_number":null,"exchange_number":null,"scheduled_delivery_date":null,"scheduled_address":null,"substatus":"delivered003","status_info":null,"latest_event":"Spedizione consegnata,COMO,2025-03-25 11:12:00","latest_checkpoint_time":"2025-03-25T11:12:00","transit_time":1,"origin_info":{"courier_code":"tnt-it","courier_phone":"+39 199 803 868","weblink":"http:\/\/www.tnt.it\/","tracking_link":"https:\/\/www.tnt.it\/tracking\/Tracking.do","reference_number":"MY01818480","milestone_date":{"inforeceived_date":null,"pickup_date":"2025-03-24T17:35:00","outfordelivery_date":"2025-03-25T09:31:00","delivery_date":"2025-03-25T11:12:00","returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[{"checkpoint_date":"2025-03-25T11:12:00","checkpoint_delivery_status":"delivered","checkpoint_delivery_substatus":"delivered003","tracking_detail":"Spedizione consegnata","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T09:31:00","checkpoint_delivery_status":"pickup","checkpoint_delivery_substatus":"pickup001","tracking_detail":"La spedizione e' in consegna in data odierna","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-25T01:11:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' in transito","location":"COMO","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null},{"checkpoint_date":"2025-03-24T17:35:00","checkpoint_delivery_status":"transit","checkpoint_delivery_substatus":"transit001","tracking_detail":"La spedizione e' regolarmente partita","location":"BRESCIA","country_iso2":null,"state":null,"city":null,"zip":null,"raw_status":null}]},"destination_info":{"courier_code":null,"courier_phone":null,"weblink":null,"tracking_link":null,"reference_number":null,"milestone_date":{"inforeceived_date":null,"pickup_date":null,"outfordelivery_date":null,"delivery_date":null,"returning_date":null,"returned_date":null},"pickup_date":null,"departed_airport_date":null,"arrived_abroad_date":null,"customs_received_date":null,"trackinfo":[]}},"success":true,"http_code":200}
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
include('include/headscript.php');
|
||||||
|
|
||||||
|
$dbHandler = DBHandlerSelect::getInstance();
|
||||||
|
$pdo = $dbHandler->getConnection();
|
||||||
|
|
||||||
|
$data = json_decode(file_get_contents('php://input'), true);
|
||||||
|
|
||||||
|
$partId = $data['part_id'] ?? null;
|
||||||
|
|
||||||
|
if (!$partId) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'ID parte mancante']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$stmt = $pdo->prepare("DELETE FROM identification_parts WHERE id = :part_id");
|
||||||
|
$stmt->execute([':part_id' => $partId]);
|
||||||
|
$rowCount = $stmt->rowCount();
|
||||||
|
if ($rowCount > 0) {
|
||||||
|
echo json_encode(['success' => true, 'message' => 'Parte eliminata con successo']);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Nessuna parte trovata con ID ' . $partId]);
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Errore nell\'eliminazione: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
// Enable errors for debugging
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('log_errors', 1);
|
||||||
|
ini_set('error_log', __DIR__ . '/delete_record_debug.log');
|
||||||
|
|
||||||
|
// Log iniziale
|
||||||
|
error_log("Inizio cancellazione record alle " . date('Y-m-d H:i:s'));
|
||||||
|
|
||||||
|
// Includi il file di configurazione del database
|
||||||
|
include('include/headscript.php');
|
||||||
|
|
||||||
|
// Ricevi l'ID dalla richiesta POST
|
||||||
|
$input = json_decode(file_get_contents('php://input'), true);
|
||||||
|
$iddatadb = isset($input['id']) ? intval($input['id']) : 0;
|
||||||
|
|
||||||
|
if ($iddatadb <= 0) {
|
||||||
|
http_response_code(400);
|
||||||
|
echo json_encode(['success' => false, 'message' => 'ID non valido']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connessione al database
|
||||||
|
try {
|
||||||
|
$db = DBHandlerSelect::getInstance();
|
||||||
|
$pdo = $db->getConnection();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Errore di connessione al database: ' . $e->getMessage()]);
|
||||||
|
error_log("Errore di connessione al database: " . $e->getMessage());
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inizia una transazione
|
||||||
|
$pdo->beginTransaction();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Elimina i dettagli associati dal tavolo import_data_details
|
||||||
|
$stmt = $pdo->prepare("DELETE FROM import_data_details WHERE id = ?");
|
||||||
|
$stmt->execute([$iddatadb]);
|
||||||
|
|
||||||
|
// Elimina il record principale dal tavolo datadb
|
||||||
|
$stmt = $pdo->prepare("DELETE FROM datadb WHERE iddatadb = ?");
|
||||||
|
$stmt->execute([$iddatadb]);
|
||||||
|
|
||||||
|
// Verifica se il record è stato eliminato
|
||||||
|
if ($stmt->rowCount() > 0) {
|
||||||
|
$pdo->commit();
|
||||||
|
echo json_encode(['success' => true, 'message' => 'Record eliminato con successo']);
|
||||||
|
error_log("Record con iddatadb=$iddatadb eliminato con successo");
|
||||||
|
} else {
|
||||||
|
$pdo->rollBack();
|
||||||
|
http_response_code(404);
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Record non trovato']);
|
||||||
|
error_log("Record con iddatadb=$iddatadb non trovato");
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$pdo->rollBack();
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Errore durante la cancellazione: ' . $e->getMessage()]);
|
||||||
|
error_log("Errore durante la cancellazione del record con iddatadb=$iddatadb: " . $e->getMessage());
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Swagger Codegen Ignore
|
||||||
|
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
3.0.34
|
||||||
@@ -20,17 +20,10 @@ if (!$template) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug del JSON
|
// Recupera tutte le routine dal database
|
||||||
$clientSpecificFieldsJson = $template['client_specific_fields'] ?? '{}';
|
$stmt = $pdo->prepare("SELECT * FROM routine");
|
||||||
error_log("Raw client_specific_fields JSON: " . $clientSpecificFieldsJson);
|
$stmt->execute();
|
||||||
|
$routines = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$clientSpecificFields = json_decode($clientSpecificFieldsJson, true);
|
|
||||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
|
||||||
error_log("JSON decode error: " . json_last_error_msg());
|
|
||||||
$clientSpecificFields = [];
|
|
||||||
} else {
|
|
||||||
error_log("Decoded client_specific_fields: " . print_r($clientSpecificFields, true));
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
@@ -41,28 +34,9 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
|
<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
|
||||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||||
<?php include('cssinclude.php'); ?>
|
<?php include('cssinclude.php'); ?>
|
||||||
<style>
|
<!-- Include jQuery prima di Select2 -->
|
||||||
.client-field-row .row {
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
||||||
margin-bottom: 0 !important;
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.client-field-row .col-md-1,
|
|
||||||
.client-field-row .col-md-2,
|
|
||||||
.client-field-row .col-md-3 {
|
|
||||||
padding: 0 5px;
|
|
||||||
overflow: hidden;
|
|
||||||
max-width: 100%;
|
|
||||||
flex: 0 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.client-field-row input,
|
|
||||||
.client-field-row select {
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<title>Edit Template <?= htmlspecialchars($titlewebsite, ENT_QUOTES, 'UTF-8'); ?></title>
|
<title>Edit Template <?= htmlspecialchars($titlewebsite, ENT_QUOTES, 'UTF-8'); ?></title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -82,7 +56,7 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
<ul class="mb-0">
|
<ul class="mb-0">
|
||||||
<li>Template Name</li>
|
<li>Template Name</li>
|
||||||
<li>Row Header and Column Header: where the title of the excel starts</li>
|
<li>Row Header and Column Header: where the title of the excel starts</li>
|
||||||
<li>Cheme</li>
|
<li>Schema</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -124,96 +98,43 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
<label class="form-label"><?= htmlspecialchars($desttable, ENT_QUOTES, 'UTF-8'); ?>*</label>
|
<label class="form-label"><?= htmlspecialchars($desttable, ENT_QUOTES, 'UTF-8'); ?>*</label>
|
||||||
<input type="text" name="target_table" class="form-control" value="<?php echo htmlspecialchars($template['target_table']); ?>" readonly required>
|
<input type="text" name="target_table" class="form-control" value="<?php echo htmlspecialchars($template['target_table']); ?>" readonly required>
|
||||||
</div>
|
</div>
|
||||||
<!-- Aggiungi il campo per selezionare il cliente -->
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Select Client *</label>
|
<label class="form-label">Select Client *</label>
|
||||||
<select name="client_id" id="clientSelect" class="form-control" required>
|
<select name="client_id" id="clientSelect" class="form-control" required>
|
||||||
<option value="">Select a client...</option>
|
<option value="">Select a client...</option>
|
||||||
<!-- Le opzioni verranno popolate tramite JavaScript -->
|
|
||||||
</select>
|
</select>
|
||||||
<span id="clientLoadingStatus" class="text-muted" style="margin-left: 10px; display: none;">Recupero clienti in corso...</span>
|
<span id="clientLoadingStatus" class="text-muted" style="margin-left: 10px; display: none;">Recupero clienti in corso...</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- Aggiungi il campo per selezionare lo schema -->
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Select Schema *</label>
|
<label class="form-label">Select Schema *</label>
|
||||||
<select name="schema_id" id="schemaSelect" class="form-control" required>
|
<select name="schema_id" id="schemaSelect" class="form-control" required>
|
||||||
<option value="">Select a schema...</option>
|
<option value="">Select a schema...</option>
|
||||||
<!-- Le opzioni verranno popolate tramite JavaScript -->
|
|
||||||
</select>
|
</select>
|
||||||
<span id="schemaLoadingStatus" class="text-muted" style="margin-left: 10px; display: none;">Caricamento schemi in corso...</span>
|
<span id="schemaLoadingStatus" class="text-muted" style="margin-left: 10px; display: none;">Caricamento schemi in corso...</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- Sezione per i campi specifici del cliente -->
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Client-Specific Fields</label>
|
<label class="form-label">Select Routine</label>
|
||||||
|
<select name="idroutine" id="routineSelect" class="form-control">
|
||||||
<!-- Intestazioni colonne -->
|
<option value="">Select a routine...</option>
|
||||||
<div class="row fw-bold text-secondary mb-1">
|
<?php foreach ($routines as $routine): ?>
|
||||||
<div class="col-md-3">Field Name</div>
|
<option value="<?php echo $routine['idroutine']; ?>" <?php echo ($template['idroutine'] ?? '') == $routine['idroutine'] ? 'selected' : ''; ?>>
|
||||||
<div class="col-md-2">Type</div>
|
<?php echo htmlspecialchars($routine['name']); ?>
|
||||||
<div class="col-md-2">Possible Values</div>
|
</option>
|
||||||
<div class="col-md-1">Required</div>
|
<?php endforeach; ?>
|
||||||
<div class="col-md-2">Export Column Name</div>
|
</select>
|
||||||
<div class="col-md-1">Default Value</div>
|
<div id="routineDetails" class="mt-2" style="display: none;">
|
||||||
<div class="col-md-1">Actions</div>
|
<h6>Routine Details</h6>
|
||||||
|
<p><strong>Name:</strong> <span id="routineName"></span></p>
|
||||||
|
<p><strong>Description:</strong> <span id="routineDescription"></span></p>
|
||||||
|
<p><strong>Action 1:</strong> <span id="routineAction1"></span></p>
|
||||||
|
<p><strong>Action 2:</strong> <span id="routineAction2"></span></p>
|
||||||
|
<p><strong>Action 3:</strong> <span id="routineAction3"></span></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="clientSpecificFields">
|
|
||||||
<?php
|
|
||||||
$index = 0;
|
|
||||||
if (!empty($clientSpecificFields) && is_array($clientSpecificFields)) {
|
|
||||||
foreach ($clientSpecificFields as $fieldName => $fieldData) {
|
|
||||||
if (is_array($fieldData)) {
|
|
||||||
$type = $fieldData['type'] ?? 'text';
|
|
||||||
$possibleValues = implode(', ', $fieldData['possible_values'] ?? []);
|
|
||||||
$isRequired = isset($fieldData['is_required']) && $fieldData['is_required'] ? '1' : '0';
|
|
||||||
$exportColumnName = $fieldData['export_column_name'] ?? '';
|
|
||||||
$defaultValue = $fieldData['default_value'] ?? '';
|
|
||||||
?>
|
|
||||||
<div class="client-field-row mb-2">
|
|
||||||
<div class="row align-items-center">
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" name="specific_fields[<?php echo $index; ?>][name]" class="form-control" value="<?php echo htmlspecialchars($fieldName); ?>" placeholder="Field Name (e.g., SKU)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<select name="specific_fields[<?php echo $index; ?>][type]" class="form-control" onchange="toggleDropdownValues(this)">
|
|
||||||
<option value="text" <?php echo $type === 'text' ? 'selected' : ''; ?>>Text</option>
|
|
||||||
<option value="dropdown" <?php echo $type === 'dropdown' ? 'selected' : ''; ?>>Dropdown</option>
|
|
||||||
<option value="date" <?php echo $type === 'date' ? 'selected' : ''; ?>>Date</option>
|
|
||||||
<option value="boolean" <?php echo $type === 'boolean' ? 'selected' : ''; ?>>Yes/No</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2 dropdown-values" style="<?php echo $type === 'dropdown' ? 'visibility: visible;' : 'visibility: hidden;'; ?>">
|
|
||||||
<input type="text" name="specific_fields[<?php echo $index; ?>][possible_values]" class="form-control" value="<?php echo htmlspecialchars($possibleValues); ?>" placeholder="Values (e.g., Red, Blue, Green)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<select name="specific_fields[<?php echo $index; ?>][required]" class="form-control">
|
|
||||||
<option value="1" <?php echo $isRequired === '1' ? 'selected' : ''; ?>>Yes</option>
|
|
||||||
<option value="0" <?php echo $isRequired === '0' ? 'selected' : ''; ?>>No</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="text" name="specific_fields[<?php echo $index; ?>][export_column_name]" class="form-control" value="<?php echo htmlspecialchars($exportColumnName); ?>" placeholder="Export Column Name (e.g., MONCLER_SKU)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<input type="text" name="specific_fields[<?php echo $index; ?>][default_value]" class="form-control" value="<?php echo htmlspecialchars($defaultValue); ?>" placeholder="Default Value (optional)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<button type="button" class="btn btn-danger remove-field">-</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
$index++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="button" class="btn btn-primary mt-2" id="addField">Add Field</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<button type="submit" class="btn btn-primary"><?= htmlspecialchars($savechanges, ENT_QUOTES, 'UTF-8'); ?></button>
|
<button type="submit" class="btn btn-primary"><?= htmlspecialchars($savechanges, ENT_QUOTES, 'UTF-8'); ?></button>
|
||||||
<a href="templates_dashboard.php" class="btn btn-secondary">Cancel</a>
|
<a href="templates_dashboard.php" class="btn btn-secondary">Cancel</a>
|
||||||
@@ -223,132 +144,78 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--end page wrapper -->
|
|
||||||
<!--start overlay-->
|
|
||||||
<div class="overlay toggle-icon"></div>
|
<div class="overlay toggle-icon"></div>
|
||||||
<!--end overlay-->
|
|
||||||
<!--Start Back To Top Button-->
|
|
||||||
<a href="javaScript:;" class="back-to-top"><i class='bx bxs-up-arrow-alt'></i></a>
|
<a href="javaScript:;" class="back-to-top"><i class='bx bxs-up-arrow-alt'></i></a>
|
||||||
<!--End Back To Top Button-->
|
|
||||||
<?php include('include/footer.php'); ?>
|
<?php include('include/footer.php'); ?>
|
||||||
</div>
|
</div>
|
||||||
<!--end wrapper-->
|
|
||||||
|
|
||||||
<!-- search modal -->
|
|
||||||
<?php //include('include/searchmodal.php');
|
|
||||||
?>
|
|
||||||
<!-- end search modal -->
|
|
||||||
|
|
||||||
<!--start switcher-->
|
|
||||||
<?php //include('include/themeswitcher.php');
|
|
||||||
?>
|
|
||||||
<!--end switcher-->
|
|
||||||
<!-- Temporaneamente disabilitato jsinclude.php per test -->
|
|
||||||
<!-- <?php include('jsinclude.php'); ?> -->
|
|
||||||
<!-- Includi jQuery e Select2 -->
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// Dati del cliente e dello schema associati al template
|
|
||||||
const templateClientId = <?php echo json_encode($template['idclient'] ?? 0); ?>;
|
|
||||||
const templateSchemaId = <?php echo json_encode($template['idschema'] ?? 0); ?>;
|
|
||||||
const templateSchemaName = "<?php echo htmlspecialchars($template['schemaname'] ?? ''); ?>";
|
|
||||||
</script>
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
// Verifica che jQuery sia caricato
|
||||||
|
if (typeof jQuery === 'undefined') {
|
||||||
|
alert("Errore: jQuery non è caricato. Contatta l'amministratore.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const form = document.getElementById("editTemplateForm");
|
const form = document.getElementById("editTemplateForm");
|
||||||
const addFieldButton = document.getElementById("addField");
|
|
||||||
const container = document.getElementById("clientSpecificFields");
|
|
||||||
const clientLoadingStatus = document.getElementById("clientLoadingStatus");
|
const clientLoadingStatus = document.getElementById("clientLoadingStatus");
|
||||||
const schemaLoadingStatus = document.getElementById("schemaLoadingStatus");
|
const schemaLoadingStatus = document.getElementById("schemaLoadingStatus");
|
||||||
|
const routineSelect = document.getElementById("routineSelect");
|
||||||
|
const routineDetails = document.getElementById("routineDetails");
|
||||||
|
const routineName = document.getElementById("routineName");
|
||||||
|
const routineDescription = document.getElementById("routineDescription");
|
||||||
|
const routineAction1 = document.getElementById("routineAction1");
|
||||||
|
const routineAction2 = document.getElementById("routineAction2");
|
||||||
|
const routineAction3 = document.getElementById("routineAction3");
|
||||||
|
|
||||||
if (!form || !addFieldButton || !container || !clientLoadingStatus || !schemaLoadingStatus) {
|
if (!form || !clientLoadingStatus || !schemaLoadingStatus || !routineSelect || !routineDetails) {
|
||||||
console.error("One or more DOM elements not found:", {
|
alert("Errore: Uno o più elementi della pagina non sono stati trovati. Contatta l'amministratore.");
|
||||||
form,
|
|
||||||
addFieldButton,
|
|
||||||
container,
|
|
||||||
clientLoadingStatus,
|
|
||||||
schemaLoadingStatus
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("All DOM elements found");
|
// Inizializza Select2
|
||||||
|
|
||||||
// Controllo che jQuery sia caricato
|
|
||||||
if (typeof jQuery === 'undefined') {
|
|
||||||
console.error("jQuery non è caricato!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inizializza Select2 sulla tendina dei clienti
|
|
||||||
$('#clientSelect').select2({
|
$('#clientSelect').select2({
|
||||||
placeholder: "Search for a client...",
|
placeholder: "Search for a client...",
|
||||||
allowClear: true
|
allowClear: true
|
||||||
}).on('select2:open', function() {
|
|
||||||
console.log("Select2 initialized successfully for clientSelect");
|
|
||||||
}).on('select2:select', function(e) {
|
|
||||||
console.log("Client selected:", e.params.data.id, e.params.data.text);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Inizializza Select2 sulla tendina degli schemi
|
|
||||||
$('#schemaSelect').select2({
|
$('#schemaSelect').select2({
|
||||||
placeholder: "Search for a schema...",
|
placeholder: "Search for a schema...",
|
||||||
allowClear: true
|
allowClear: true
|
||||||
}).on('select2:open', function() {
|
|
||||||
console.log("Select2 initialized successfully for schemaSelect");
|
|
||||||
}).on('select2:select', function(e) {
|
|
||||||
console.log("Schema selected:", e.params.data.id, e.params.data.text);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Carica i clienti al caricamento della pagina
|
$('#routineSelect').select2({
|
||||||
|
placeholder: "Select a routine...",
|
||||||
|
allowClear: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// Carica i clienti
|
||||||
async function loadClients() {
|
async function loadClients() {
|
||||||
try {
|
try {
|
||||||
clientLoadingStatus.style.display = 'inline';
|
clientLoadingStatus.style.display = 'inline';
|
||||||
clientLoadingStatus.textContent = 'Recupero clienti in corso...';
|
clientLoadingStatus.textContent = 'Recupero clienti in corso...';
|
||||||
|
|
||||||
const response = await fetch("get_clienti.php", {
|
const response = await fetch("get_clienti.php", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const data = await response.json();
|
||||||
const text = await response.text();
|
if (!response.ok) throw new Error(data.error || `Errore HTTP: ${response.status}`);
|
||||||
console.log("Risposta raw (clienti):", text);
|
const select = document.getElementById("clientSelect");
|
||||||
const data = JSON.parse(text);
|
select.innerHTML = '<option value="">Select a client...</option>';
|
||||||
|
data.value.forEach(client => {
|
||||||
if (!response.ok) {
|
const nome = client.Nominativo || "Nome non disponibile";
|
||||||
throw new Error(data.error || `Errore HTTP: ${response.status}`);
|
const id = client.IdCliente || "ID non disponibile";
|
||||||
}
|
const option = new Option(`${nome.trim()} (ID: ${id})`, id);
|
||||||
|
if (parseInt(id) === parseInt(<?php echo json_encode($template['idclient'] ?? 0); ?>)) {
|
||||||
if (data.value && Array.isArray(data.value)) {
|
option.selected = true;
|
||||||
const select = document.getElementById("clientSelect");
|
}
|
||||||
select.innerHTML = '<option value="">Select a client...</option>';
|
select.add(option);
|
||||||
data.value.forEach(client => {
|
});
|
||||||
const nome = client.Nominativo || "Nome non disponibile";
|
$(select).trigger('change');
|
||||||
const id = client.IdCliente || "ID non disponibile";
|
clientLoadingStatus.textContent = "Clienti caricati.";
|
||||||
const option = new Option(`${nome.trim()} (ID: ${id})`, id);
|
|
||||||
if (parseInt(id) === parseInt(templateClientId)) {
|
|
||||||
option.selected = true;
|
|
||||||
}
|
|
||||||
select.add(option);
|
|
||||||
});
|
|
||||||
$(select).trigger('change');
|
|
||||||
console.log("Clienti caricati con successo.");
|
|
||||||
clientLoadingStatus.textContent = "Clienti caricati.";
|
|
||||||
} else {
|
|
||||||
console.error("Nessun cliente trovato o formato dati non valido.", data);
|
|
||||||
clientLoadingStatus.textContent = "Nessun cliente trovato.";
|
|
||||||
Swal.fire({
|
|
||||||
title: "Errore!",
|
|
||||||
text: "Nessun cliente trovato o formato dati non valido.",
|
|
||||||
icon: "error",
|
|
||||||
confirmButtonText: "OK"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Errore nel caricamento dei clienti:", error);
|
|
||||||
clientLoadingStatus.textContent = "Errore nel caricamento.";
|
clientLoadingStatus.textContent = "Errore nel caricamento.";
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Errore!",
|
title: "Errore!",
|
||||||
@@ -357,50 +224,37 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
confirmButtonText: "OK"
|
confirmButtonText: "OK"
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
setTimeout(() => {
|
setTimeout(() => clientLoadingStatus.style.display = 'none', 2000);
|
||||||
clientLoadingStatus.style.display = 'none';
|
|
||||||
}, 2000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carica gli schemi al caricamento della pagina
|
// Carica gli schemi
|
||||||
async function loadSchemas() {
|
async function loadSchemas() {
|
||||||
try {
|
try {
|
||||||
schemaLoadingStatus.style.display = 'inline';
|
schemaLoadingStatus.style.display = 'inline';
|
||||||
schemaLoadingStatus.textContent = 'Caricamento schemi in corso...';
|
schemaLoadingStatus.textContent = 'Caricamento schemi in corso...';
|
||||||
|
|
||||||
const response = await fetch("get_schemi.php", {
|
const response = await fetch("get_schemi.php", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const data = await response.json();
|
||||||
const text = await response.text();
|
if (!response.ok) throw new Error(data.error || `Errore HTTP: ${response.status}`);
|
||||||
console.log("Risposta raw (schemi):", text);
|
|
||||||
const data = JSON.parse(text);
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error(data.error || `Errore HTTP: ${response.status}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const select = document.getElementById("schemaSelect");
|
const select = document.getElementById("schemaSelect");
|
||||||
select.innerHTML = '<option value="">Select a schema...</option>';
|
select.innerHTML = '<option value="">Select a schema...</option>';
|
||||||
data.value.forEach(schema => {
|
data.value.forEach(schema => {
|
||||||
const nome = schema.Nome || "Nome non disponibile";
|
const nome = schema.Nome || "Nome non disponibile";
|
||||||
const id = schema.IdSchemaCustomFields || "ID non disponibile";
|
const id = schema.IdSchemaCustomFields || "ID non disponibile";
|
||||||
const optionText = `${nome.trim()} (ID: ${id})`;
|
const option = new Option(`${nome.trim()} (ID: ${id})`, id);
|
||||||
const option = new Option(optionText, id);
|
if (parseInt(id) === parseInt(<?php echo json_encode($template['idschema'] ?? 0); ?>)) {
|
||||||
if (parseInt(id) === parseInt(templateSchemaId)) {
|
|
||||||
option.selected = true;
|
option.selected = true;
|
||||||
}
|
}
|
||||||
select.add(option);
|
select.add(option);
|
||||||
});
|
});
|
||||||
$(select).trigger('change');
|
$(select).trigger('change');
|
||||||
console.log("Schemi caricati con successo.");
|
|
||||||
schemaLoadingStatus.textContent = "Schemi caricati.";
|
schemaLoadingStatus.textContent = "Schemi caricati.";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Errore nel caricamento degli schemi:", error);
|
|
||||||
schemaLoadingStatus.textContent = "Errore nel caricamento.";
|
schemaLoadingStatus.textContent = "Errore nel caricamento.";
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Errore!",
|
title: "Errore!",
|
||||||
@@ -409,169 +263,68 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
confirmButtonText: "OK"
|
confirmButtonText: "OK"
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
setTimeout(() => {
|
setTimeout(() => schemaLoadingStatus.style.display = 'none', 2000);
|
||||||
schemaLoadingStatus.style.display = 'none';
|
|
||||||
}, 2000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carica i dati in sequenza
|
// Carica i dati
|
||||||
async function loadData() {
|
async function loadData() {
|
||||||
try {
|
try {
|
||||||
await loadClients();
|
await loadClients();
|
||||||
await loadSchemas();
|
await loadSchemas();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Errore nel caricamento dei dati:", error);
|
Swal.fire({
|
||||||
}
|
title: "Errore!",
|
||||||
}
|
text: "Errore nel caricamento dei dati: " + error.message,
|
||||||
|
icon: "error",
|
||||||
loadData();
|
confirmButtonText: "OK"
|
||||||
|
|
||||||
// Debug iniziale del DOM
|
|
||||||
const debugDom = () => {
|
|
||||||
const initialRows = container.getElementsByClassName("client-field-row");
|
|
||||||
console.log("Initial number of rows:", initialRows.length);
|
|
||||||
for (let i = 0; i < initialRows.length; i++) {
|
|
||||||
const inputs = initialRows[i].querySelectorAll("input, select");
|
|
||||||
const buttons = initialRows[i].querySelectorAll("button");
|
|
||||||
console.log(`Row ${i + 1} - Total inputs: ${inputs.length}, Total buttons: ${buttons.length}`);
|
|
||||||
inputs.forEach(input => console.log(`Input name: ${input.name}, value: ${input.value}, placeholder: ${input.placeholder}`));
|
|
||||||
buttons.forEach(button => console.log(`Button type: ${button.type}`));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
debugDom();
|
|
||||||
|
|
||||||
// Pulizia del DOM da input extra
|
|
||||||
const cleanDom = () => {
|
|
||||||
const rows = container.getElementsByClassName("client-field-row");
|
|
||||||
for (let i = 0; i < rows.length; i++) {
|
|
||||||
const inputs = rows[i].querySelectorAll("input, select");
|
|
||||||
if (inputs.length > 6) { // 6 input/select attesi
|
|
||||||
console.warn(`Row ${i + 1}: Extra inputs detected, removing excess...`);
|
|
||||||
inputs.forEach((input, index) => {
|
|
||||||
if (index >= 6) {
|
|
||||||
console.log(`Removing extra input: ${input.name}`);
|
|
||||||
input.remove();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
cleanDom();
|
|
||||||
|
|
||||||
// Osservatore del DOM per rilevare modifiche
|
|
||||||
const observer = new MutationObserver((mutations) => {
|
|
||||||
mutations.forEach(mutation => {
|
|
||||||
if (mutation.addedNodes.length) {
|
|
||||||
console.log("DOM modified: New nodes added", mutation.addedNodes);
|
|
||||||
cleanDom(); // Pulisce il DOM ogni volta che viene modificato
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
observer.observe(container, {
|
|
||||||
childList: true,
|
|
||||||
subtree: true
|
|
||||||
});
|
|
||||||
|
|
||||||
// Gestione dinamica dei campi specifici
|
|
||||||
addFieldButton.addEventListener("click", function() {
|
|
||||||
console.log("Add Field button clicked");
|
|
||||||
const fieldCount = container.getElementsByClassName("client-field-row").length;
|
|
||||||
const newField = document.createElement("div");
|
|
||||||
newField.className = "client-field-row mb-2";
|
|
||||||
newField.innerHTML = `
|
|
||||||
<div class="row align-items-center">
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" name="specific_fields[${fieldCount}][name]" class="form-control" placeholder="Field Name (e.g., SKU)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<select name="specific_fields[${fieldCount}][type]" class="form-control" onchange="toggleDropdownValues(this)">
|
|
||||||
<option value="text">Text</option>
|
|
||||||
<option value="dropdown">Dropdown</option>
|
|
||||||
<option value="date">Date</option>
|
|
||||||
<option value="boolean">Yes/No</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2 dropdown-values" style="visibility: hidden;">
|
|
||||||
<input type="text" name="specific_fields[${fieldCount}][possible_values]" class="form-control" placeholder="Values (e.g., Red, Blue, Green)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<select name="specific_fields[${fieldCount}][required]" class="form-control">
|
|
||||||
<option value="1">Yes</option>
|
|
||||||
<option value="0">No</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="text" name="specific_fields[${fieldCount}][export_column_name]" class="form-control" placeholder="Export Column Name (e.g., MONCLER_SKU)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<input type="text" name="specific_fields[${fieldCount}][default_value]" class="form-control" placeholder="Default Value (optional)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<button type="button" class="btn btn-danger remove-field">-</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
container.appendChild(newField);
|
|
||||||
|
|
||||||
newField.querySelector(".remove-field").addEventListener("click", function() {
|
|
||||||
console.log("Remove Field button clicked");
|
|
||||||
container.removeChild(newField);
|
|
||||||
updateFieldIndices();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Funzione per mostrare/nascondere il campo dei valori possibili per i dropdown
|
|
||||||
window.toggleDropdownValues = function(selectElement) {
|
|
||||||
console.log("Toggling dropdown values for:", selectElement.value);
|
|
||||||
const row = selectElement.closest(".row");
|
|
||||||
const dropdownValues = row.querySelector(".dropdown-values");
|
|
||||||
if (selectElement.value === "dropdown") {
|
|
||||||
dropdownValues.style.visibility = "visible";
|
|
||||||
} else {
|
|
||||||
dropdownValues.style.visibility = "hidden";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Event listener per i pulsanti di rimozione esistenti
|
|
||||||
document.querySelectorAll(".remove-field").forEach(button => {
|
|
||||||
button.addEventListener("click", function() {
|
|
||||||
console.log("Existing remove button clicked");
|
|
||||||
const container = document.getElementById("clientSpecificFields");
|
|
||||||
container.removeChild(button.closest(".client-field-row"));
|
|
||||||
updateFieldIndices();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Funzione per aggiornare gli indici dei campi
|
|
||||||
function updateFieldIndices() {
|
|
||||||
console.log("Updating field indices");
|
|
||||||
const rows = container.getElementsByClassName("client-field-row");
|
|
||||||
for (let i = 0; i < rows.length; i++) {
|
|
||||||
const inputs = rows[i].querySelectorAll("input, select");
|
|
||||||
inputs.forEach(input => {
|
|
||||||
const name = input.name.replace(/\[\d+\]/, `[${i}]`);
|
|
||||||
input.name = name;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
loadData();
|
||||||
|
|
||||||
|
// Routine dettagli
|
||||||
|
const routines = <?php echo json_encode($routines); ?>;
|
||||||
|
|
||||||
|
function updateRoutineDetails() {
|
||||||
|
const selectedId = routineSelect.value;
|
||||||
|
routineDetails.style.display = selectedId ? 'block' : 'none';
|
||||||
|
if (selectedId) {
|
||||||
|
const routine = routines.find(r => r.idroutine == selectedId);
|
||||||
|
if (routine) {
|
||||||
|
routineName.textContent = routine.name || 'N/A';
|
||||||
|
routineDescription.textContent = routine.description || 'N/A';
|
||||||
|
routineAction1.textContent = routine.action1 || 'N/A';
|
||||||
|
routineAction2.textContent = routine.action2 || 'N/A';
|
||||||
|
routineAction3.textContent = routine.action3 || 'N/A';
|
||||||
|
} else {
|
||||||
|
routineName.textContent = 'N/A';
|
||||||
|
routineDescription.textContent = 'N/A';
|
||||||
|
routineAction1.textContent = 'N/A';
|
||||||
|
routineAction2.textContent = 'N/A';
|
||||||
|
routineAction3.textContent = 'N/A';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
routineName.textContent = '';
|
||||||
|
routineDescription.textContent = '';
|
||||||
|
routineAction1.textContent = '';
|
||||||
|
routineAction2.textContent = '';
|
||||||
|
routineAction3.textContent = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
routineSelect.addEventListener('change', updateRoutineDetails);
|
||||||
|
updateRoutineDetails(); // Inizializza dettagli se una routine è preselezionata
|
||||||
|
|
||||||
// Submit del form
|
// Submit del form
|
||||||
form.addEventListener("submit", function(e) {
|
form.addEventListener("submit", function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
console.log("Form submitted");
|
|
||||||
|
|
||||||
let formData = new FormData(this);
|
let formData = new FormData(this);
|
||||||
|
|
||||||
// Aggiungi il nome del cliente selezionato a FormData
|
|
||||||
const clientSelect = document.getElementById("clientSelect");
|
const clientSelect = document.getElementById("clientSelect");
|
||||||
const clientId = clientSelect.value;
|
const clientId = clientSelect.value;
|
||||||
const selectedClientOption = clientSelect.options[clientSelect.selectedIndex];
|
const selectedClientOption = clientSelect.options[clientSelect.selectedIndex];
|
||||||
|
|
||||||
// Validazione: assicurati che un cliente sia selezionato
|
|
||||||
if (!clientId) {
|
if (!clientId) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Errore!",
|
title: "Errore!",
|
||||||
@@ -582,22 +335,18 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Estrai il nome del cliente in modo più robusto
|
|
||||||
let clientName = "";
|
let clientName = "";
|
||||||
if (selectedClientOption) {
|
if (selectedClientOption) {
|
||||||
const optionText = selectedClientOption.text.trim();
|
const optionText = selectedClientOption.text.trim();
|
||||||
const nameMatch = optionText.match(/^(.+?)(?:\s*\(ID:\s*\d+\))?$/);
|
const nameMatch = optionText.match(/^(.+?)(?:\s*\(ID:\s*\d+\))?$/);
|
||||||
clientName = nameMatch ? nameMatch[1].trim() : optionText;
|
clientName = nameMatch ? nameMatch[1].trim() : optionText;
|
||||||
}
|
}
|
||||||
|
|
||||||
formData.append("client_name", clientName);
|
formData.append("client_name", clientName);
|
||||||
|
|
||||||
// Aggiungi l'ID e il nome dello schema selezionato a FormData
|
|
||||||
const schemaSelect = document.getElementById("schemaSelect");
|
const schemaSelect = document.getElementById("schemaSelect");
|
||||||
const schemaId = schemaSelect.value;
|
const schemaId = schemaSelect.value;
|
||||||
const selectedSchemaOption = schemaSelect.options[schemaSelect.selectedIndex];
|
const selectedSchemaOption = schemaSelect.options[schemaSelect.selectedIndex];
|
||||||
|
|
||||||
// Validazione: assicurati che uno schema sia selezionato
|
|
||||||
if (!schemaId) {
|
if (!schemaId) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Errore!",
|
title: "Errore!",
|
||||||
@@ -608,63 +357,18 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Estrai il nome dello schema in modo più robusto
|
|
||||||
let schemaName = "";
|
let schemaName = "";
|
||||||
if (selectedSchemaOption) {
|
if (selectedSchemaOption) {
|
||||||
const optionText = selectedSchemaOption.text.trim();
|
const optionText = selectedSchemaOption.text.trim();
|
||||||
const nameMatch = optionText.match(/^(.+?)(?:\s*\(ID:\s*\d+\))?$/);
|
const nameMatch = optionText.match(/^(.+?)(?:\s*\(ID:\s*\d+\))?$/);
|
||||||
schemaName = nameMatch ? nameMatch[1].trim() : optionText;
|
schemaName = nameMatch ? nameMatch[1].trim() : optionText;
|
||||||
}
|
}
|
||||||
|
|
||||||
formData.append("idschema", schemaId);
|
formData.append("idschema", schemaId);
|
||||||
formData.append("schemamaname", schemaName);
|
formData.append("schemaname", schemaName);
|
||||||
|
|
||||||
// Log per debug
|
// Aggiungi idroutine
|
||||||
console.log("Client ID:", clientId);
|
const routineId = routineSelect.value;
|
||||||
console.log("Client Name:", clientName);
|
formData.append("idroutine", routineId);
|
||||||
console.log("Schema ID:", schemaId);
|
|
||||||
console.log("Schema Name:", schemaName);
|
|
||||||
|
|
||||||
// Genera il JSON per client_specific_fields
|
|
||||||
let finalSpecificFields = {};
|
|
||||||
|
|
||||||
// Raccolta dei dati direttamente dal DOM
|
|
||||||
const fieldRows = container.getElementsByClassName("client-field-row");
|
|
||||||
for (let i = 0; i < fieldRows.length; i++) {
|
|
||||||
const row = fieldRows[i];
|
|
||||||
const inputs = row.querySelectorAll("input, select");
|
|
||||||
let fieldData = {};
|
|
||||||
|
|
||||||
inputs.forEach(input => {
|
|
||||||
const nameMatch = input.name.match(/specific_fields\[\d+\]\[(.*?)\]/);
|
|
||||||
if (nameMatch) {
|
|
||||||
const fieldName = nameMatch[1];
|
|
||||||
fieldData[fieldName] = input.value.trim();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (fieldData.name) {
|
|
||||||
finalSpecificFields[fieldData.name] = {
|
|
||||||
type: fieldData.type || "text",
|
|
||||||
possible_values: (fieldData.possible_values && fieldData.type === "dropdown") ? fieldData.possible_values.split(",").map(v => v.trim()) : [],
|
|
||||||
is_required: fieldData.required === "1",
|
|
||||||
export_column_name: fieldData.export_column_name || "",
|
|
||||||
default_value: fieldData.default_value || ""
|
|
||||||
};
|
|
||||||
console.log(`Field ${fieldData.name}:`, finalSpecificFields[fieldData.name]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Generated JSON for client_specific_fields:", JSON.stringify(finalSpecificFields));
|
|
||||||
|
|
||||||
// Aggiungi il JSON al FormData
|
|
||||||
formData.append("client_specific_fields", JSON.stringify(finalSpecificFields));
|
|
||||||
|
|
||||||
// Debug del FormData
|
|
||||||
console.log("FormData contents:");
|
|
||||||
for (let pair of formData.entries()) {
|
|
||||||
console.log(pair[0] + ': ' + pair[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch("process_edit_template_xls.php", {
|
fetch("process_edit_template_xls.php", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -672,7 +376,6 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("Fetch response:", data);
|
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Successo!",
|
title: "Successo!",
|
||||||
@@ -692,7 +395,6 @@ if (json_last_error() !== JSON_ERROR_NONE) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error("Errore Fetch:", error);
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Errore!",
|
title: "Errore!",
|
||||||
text: "Si è verificato un errore imprevisto.",
|
text: "Si è verificato un errore imprevisto.",
|
||||||
|
|||||||
@@ -6,3 +6,9 @@
|
|||||||
2025-07-04 10:44:13 - Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
2025-07-04 10:44:13 - Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||||
2025-07-04 10:48:07 - Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
2025-07-04 10:48:07 - Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||||
2025-08-19 16:29:25 - Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
2025-08-19 16:29:25 - Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||||
|
2025-08-26 16:47:19 - Risposta non JSON valida: <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="DevExpress.ExpressApp.SystemModule" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="DashboardViewItemDescriptor"><Key><PropertyRef Name="ViewId" /></Key><Property Name="ViewId" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem" BaseType="DevExpress.ExpressApp.NonPersistentLiteObject" Abstract="true"><Property Name="Visibility" Type="DevExpress.ExpressApp.Editors.ViewItemVisibility" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem_1OfIModelDashboardViewItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem" Abstract="true" /><EntityType Name="ViewDashboardOrganizationItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem_1OfIModelDashboardViewItem"><Property Name="ObjectType" Type="System.Type" /><Proper
|
||||||
|
2025-08-26 16:48:15 - Risposta non JSON valida: <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="DevExpress.ExpressApp.SystemModule" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="DashboardViewItemDescriptor"><Key><PropertyRef Name="ViewId" /></Key><Property Name="ViewId" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem" BaseType="DevExpress.ExpressApp.NonPersistentLiteObject" Abstract="true"><Property Name="Visibility" Type="DevExpress.ExpressApp.Editors.ViewItemVisibility" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem_1OfIModelDashboardViewItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem" Abstract="true" /><EntityType Name="ViewDashboardOrganizationItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem_1OfIModelDashboardViewItem"><Property Name="ObjectType" Type="System.Type" /><Proper
|
||||||
|
2025-08-26 16:48:44 - Risposta non JSON valida: <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="DevExpress.ExpressApp.SystemModule" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="DashboardViewItemDescriptor"><Key><PropertyRef Name="ViewId" /></Key><Property Name="ViewId" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem" BaseType="DevExpress.ExpressApp.NonPersistentLiteObject" Abstract="true"><Property Name="Visibility" Type="DevExpress.ExpressApp.Editors.ViewItemVisibility" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem_1OfIModelDashboardViewItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem" Abstract="true" /><EntityType Name="ViewDashboardOrganizationItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem_1OfIModelDashboardViewItem"><Property Name="ObjectType" Type="System.Type" /><Proper
|
||||||
|
2025-08-26 16:49:24 - Risposta non JSON valida: <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="DevExpress.ExpressApp.SystemModule" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="DashboardViewItemDescriptor"><Key><PropertyRef Name="ViewId" /></Key><Property Name="ViewId" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem" BaseType="DevExpress.ExpressApp.NonPersistentLiteObject" Abstract="true"><Property Name="Visibility" Type="DevExpress.ExpressApp.Editors.ViewItemVisibility" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem_1OfIModelDashboardViewItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem" Abstract="true" /><EntityType Name="ViewDashboardOrganizationItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem_1OfIModelDashboardViewItem"><Property Name="ObjectType" Type="System.Type" /><Proper
|
||||||
|
2025-08-26 16:50:23 - Risposta non JSON valida: <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="DevExpress.ExpressApp.SystemModule" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="DashboardViewItemDescriptor"><Key><PropertyRef Name="ViewId" /></Key><Property Name="ViewId" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem" BaseType="DevExpress.ExpressApp.NonPersistentLiteObject" Abstract="true"><Property Name="Visibility" Type="DevExpress.ExpressApp.Editors.ViewItemVisibility" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem_1OfIModelDashboardViewItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem" Abstract="true" /><EntityType Name="ViewDashboardOrganizationItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem_1OfIModelDashboardViewItem"><Property Name="ObjectType" Type="System.Type" /><Proper
|
||||||
|
2025-09-08 08:39:17 - Risposta non JSON valida: <?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"><edmx:DataServices><Schema Namespace="DevExpress.ExpressApp.SystemModule" xmlns="http://docs.oasis-open.org/odata/ns/edm"><EntityType Name="DashboardViewItemDescriptor"><Key><PropertyRef Name="ViewId" /></Key><Property Name="ViewId" Type="Edm.String" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem" BaseType="DevExpress.ExpressApp.NonPersistentLiteObject" Abstract="true"><Property Name="Visibility" Type="DevExpress.ExpressApp.Editors.ViewItemVisibility" Nullable="false" /></EntityType><EntityType Name="DashboardOrganizationItem_1OfIModelDashboardViewItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem" Abstract="true" /><EntityType Name="ViewDashboardOrganizationItem" BaseType="DevExpress.ExpressApp.SystemModule.DashboardOrganizationItem_1OfIModelDashboardViewItem"><Property Name="ObjectType" Type="System.Type" /><Proper
|
||||||
|
|||||||
@@ -0,0 +1,239 @@
|
|||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
console.log("export_to_lims.js loaded");
|
||||||
|
|
||||||
|
// Debug: verifica che i pulsanti siano trovati
|
||||||
|
const exportButtons = document.querySelectorAll(".export-lims-btn");
|
||||||
|
console.log(`Found ${exportButtons.length} export-lims-btn buttons`);
|
||||||
|
|
||||||
|
if (exportButtons.length === 0) {
|
||||||
|
console.warn("No .export-lims-btn buttons found in the DOM");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
exportButtons.forEach((btn) => {
|
||||||
|
btn.addEventListener("click", (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const rowIndex = btn.dataset.row;
|
||||||
|
const iddatadb = btn.dataset.iddatadb;
|
||||||
|
console.log(
|
||||||
|
`Export to LIMS clicked for row ${rowIndex}, iddatadb: ${iddatadb}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Mostra il modale di conferma
|
||||||
|
const confirmModalElement =
|
||||||
|
document.getElementById("exportConfirmModal");
|
||||||
|
if (!confirmModalElement) {
|
||||||
|
console.error("exportConfirmModal not found in the DOM");
|
||||||
|
alert("Errore: Modale di conferma non trovato");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const confirmModal = new bootstrap.Modal(confirmModalElement, {
|
||||||
|
keyboard: false,
|
||||||
|
});
|
||||||
|
document.getElementById("exportIddatadb").textContent = iddatadb;
|
||||||
|
confirmModal.show();
|
||||||
|
|
||||||
|
// Gestisci il click su "Conferma"
|
||||||
|
const confirmBtn = document.getElementById("exportConfirmBtn");
|
||||||
|
if (!confirmBtn) {
|
||||||
|
console.error("exportConfirmBtn not found in the DOM");
|
||||||
|
confirmModal.hide();
|
||||||
|
alert("Errore: Pulsante di conferma non trovato");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const confirmHandler = async () => {
|
||||||
|
console.log(`Confirmed export for iddatadb: ${iddatadb}`);
|
||||||
|
confirmModal.hide();
|
||||||
|
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("iddatadb", iddatadb);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch("export_to_lims.php", {
|
||||||
|
method: "POST",
|
||||||
|
body: formData,
|
||||||
|
});
|
||||||
|
if (!response.ok)
|
||||||
|
throw new Error(
|
||||||
|
`HTTP error! status: ${response.status}`,
|
||||||
|
);
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
console.log("Export response:", data);
|
||||||
|
|
||||||
|
// Mostra il modale di risposta
|
||||||
|
const responseModalElement = document.getElementById(
|
||||||
|
"exportResponseModal",
|
||||||
|
);
|
||||||
|
if (!responseModalElement) {
|
||||||
|
console.error(
|
||||||
|
"exportResponseModal not found in the DOM",
|
||||||
|
);
|
||||||
|
alert("Errore: Modale di risposta non trovato");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const responseModal = new bootstrap.Modal(
|
||||||
|
responseModalElement,
|
||||||
|
{
|
||||||
|
keyboard: false,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
const responseMessage = document.getElementById(
|
||||||
|
"exportResponseMessage",
|
||||||
|
);
|
||||||
|
if (data.success) {
|
||||||
|
responseMessage.innerHTML = `${data.message.replace(/\n/g, "<br>")}<br>ID CommessaWeb: ${data.idcommessaweb}`;
|
||||||
|
document.getElementById(
|
||||||
|
"exportResponseModalLabel",
|
||||||
|
).textContent = "Esportazione Completata";
|
||||||
|
responseModal.show();
|
||||||
|
|
||||||
|
// Aggiorna la UI per riflettere lo stato 'To LIMS'
|
||||||
|
const statusCell = btn
|
||||||
|
.closest(".grid-row")
|
||||||
|
.querySelector(
|
||||||
|
'.grid-cell[data-col="status"] .status-badge',
|
||||||
|
);
|
||||||
|
if (statusCell) {
|
||||||
|
statusCell.classList.remove("status-i", "status-P");
|
||||||
|
statusCell.classList.add("status-l");
|
||||||
|
statusCell.textContent = "To LIMS";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gestisci la chiusura del modale di risposta
|
||||||
|
responseModalElement.addEventListener(
|
||||||
|
"hidden.bs.modal",
|
||||||
|
() => {
|
||||||
|
console.log(
|
||||||
|
"exportResponseModal closed, cleaning up",
|
||||||
|
);
|
||||||
|
// Rimuovi tutti i backdrop residui
|
||||||
|
document
|
||||||
|
.querySelectorAll(".modal-backdrop")
|
||||||
|
.forEach((backdrop) => {
|
||||||
|
console.log(
|
||||||
|
"Removing backdrop:",
|
||||||
|
backdrop,
|
||||||
|
);
|
||||||
|
backdrop.remove();
|
||||||
|
});
|
||||||
|
// Ripristina il body
|
||||||
|
document.body.classList.remove("modal-open");
|
||||||
|
document.body.style.paddingRight = "";
|
||||||
|
// Nascondi l'overlay
|
||||||
|
const overlay = document.querySelector(
|
||||||
|
".overlay.toggle-icon",
|
||||||
|
);
|
||||||
|
if (overlay) {
|
||||||
|
overlay.style.display = "none";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ once: true },
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
responseMessage.textContent = `Errore durante la generazione dei payload: ${data.message}`;
|
||||||
|
document.getElementById(
|
||||||
|
"exportResponseModalLabel",
|
||||||
|
).textContent = "Errore Esportazione";
|
||||||
|
responseModal.show();
|
||||||
|
|
||||||
|
// Gestisci la chiusura del modale di risposta anche in caso di errore
|
||||||
|
responseModalElement.addEventListener(
|
||||||
|
"hidden.bs.modal",
|
||||||
|
() => {
|
||||||
|
console.log(
|
||||||
|
"exportResponseModal closed, cleaning up",
|
||||||
|
);
|
||||||
|
// Rimuovi tutti i backdrop residui
|
||||||
|
document
|
||||||
|
.querySelectorAll(".modal-backdrop")
|
||||||
|
.forEach((backdrop) => {
|
||||||
|
console.log(
|
||||||
|
"Removing backdrop:",
|
||||||
|
backdrop,
|
||||||
|
);
|
||||||
|
backdrop.remove();
|
||||||
|
});
|
||||||
|
// Ripristina il body
|
||||||
|
document.body.classList.remove("modal-open");
|
||||||
|
document.body.style.paddingRight = "";
|
||||||
|
// Nascondi l'overlay
|
||||||
|
const overlay = document.querySelector(
|
||||||
|
".overlay.toggle-icon",
|
||||||
|
);
|
||||||
|
if (overlay) {
|
||||||
|
overlay.style.display = "none";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ once: true },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Export error:", error);
|
||||||
|
const responseModalElement = document.getElementById(
|
||||||
|
"exportResponseModal",
|
||||||
|
);
|
||||||
|
if (!responseModalElement) {
|
||||||
|
console.error(
|
||||||
|
"exportResponseModal not found in the DOM",
|
||||||
|
);
|
||||||
|
alert("Errore: Modale di risposta non trovato");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const responseModal = new bootstrap.Modal(
|
||||||
|
responseModalElement,
|
||||||
|
{
|
||||||
|
keyboard: false,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
document.getElementById(
|
||||||
|
"exportResponseMessage",
|
||||||
|
).textContent =
|
||||||
|
`Errore durante la generazione dei payload: ${error.message}`;
|
||||||
|
document.getElementById(
|
||||||
|
"exportResponseModalLabel",
|
||||||
|
).textContent = "Errore Esportazione";
|
||||||
|
responseModal.show();
|
||||||
|
|
||||||
|
// Gestisci la chiusura del modale di risposta in caso di errore
|
||||||
|
responseModalElement.addEventListener(
|
||||||
|
"hidden.bs.modal",
|
||||||
|
() => {
|
||||||
|
console.log(
|
||||||
|
"exportResponseModal closed, cleaning up",
|
||||||
|
);
|
||||||
|
// Rimuovi tutti i backdrop residui
|
||||||
|
document
|
||||||
|
.querySelectorAll(".modal-backdrop")
|
||||||
|
.forEach((backdrop) => {
|
||||||
|
console.log("Removing backdrop:", backdrop);
|
||||||
|
backdrop.remove();
|
||||||
|
});
|
||||||
|
// Ripristina il body
|
||||||
|
document.body.classList.remove("modal-open");
|
||||||
|
document.body.style.paddingRight = "";
|
||||||
|
// Nascondi l'overlay
|
||||||
|
const overlay = document.querySelector(
|
||||||
|
".overlay.toggle-icon",
|
||||||
|
);
|
||||||
|
if (overlay) {
|
||||||
|
overlay.style.display = "none";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ once: true },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rimuovi il listener dopo l'esecuzione
|
||||||
|
confirmBtn.removeEventListener("click", confirmHandler);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Rimuovi eventuali listener precedenti
|
||||||
|
confirmBtn.removeEventListener("click", confirmHandler);
|
||||||
|
confirmBtn.addEventListener("click", confirmHandler);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
<?php
|
||||||
|
require_once "class/VisualLimsApiClient.class.php";
|
||||||
|
include('include/headscript.php');
|
||||||
|
|
||||||
|
$dbHandler = DBHandlerSelect::getInstance();
|
||||||
|
$pdo = $dbHandler->getConnection();
|
||||||
|
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
|
||||||
|
try {
|
||||||
|
$iddatadb = $_POST['iddatadb'] ?? null;
|
||||||
|
if (!$iddatadb) {
|
||||||
|
throw new Exception("Missing iddatadb");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔹 STEP 1+2: Fetch Cliente ID + Schema ID
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
|
SELECT et.idclient AS clienteId, et.idschema AS schemaId
|
||||||
|
FROM datadb as d
|
||||||
|
INNER JOIN excel_templates as et ON d.templateid = et.id
|
||||||
|
WHERE d.iddatadb = :iddatadb
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
$stmt->execute(['iddatadb' => $iddatadb]);
|
||||||
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if (!$result) {
|
||||||
|
throw new Exception("No Cliente/Schema found for iddatadb {$iddatadb}");
|
||||||
|
}
|
||||||
|
|
||||||
|
$clienteId = (int) $result['clienteId'];
|
||||||
|
$schemaId = (int) $result['schemaId'];
|
||||||
|
|
||||||
|
// 🔹 STEP 3: Fetch Parts (including idmatrice)
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
|
SELECT part_number, part_description, material, color, mix, idmatrice
|
||||||
|
FROM identification_parts
|
||||||
|
WHERE iddatadb = :iddatadb
|
||||||
|
");
|
||||||
|
$stmt->execute(['iddatadb' => $iddatadb]);
|
||||||
|
$parts = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
// 🔹 STEP 4: Fetch Field Values with Labels
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
|
SELECT
|
||||||
|
idd.field_value,
|
||||||
|
m.field_label,
|
||||||
|
m.schema_id,
|
||||||
|
m.field_id
|
||||||
|
FROM
|
||||||
|
import_data_details as idd
|
||||||
|
JOIN template_mapping m ON idd.mapping_id = m.id
|
||||||
|
WHERE idd.id = :iddatadb
|
||||||
|
");
|
||||||
|
$stmt->execute(['iddatadb' => $iddatadb]);
|
||||||
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$fieldValues = [];
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$fieldValues[] = [
|
||||||
|
"IdCommesseCustomFields" => (int) $row['field_id'],
|
||||||
|
"Valore" => $row['field_value']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔹 Initialize API client
|
||||||
|
$api = VisualLimsApiClient::getInstance();
|
||||||
|
|
||||||
|
// 🔹 STEP 5: Create CommessaWeb (NOT WebOrder)
|
||||||
|
$commessaWebPayload = [
|
||||||
|
"Cliente" => $clienteId,
|
||||||
|
"SchemaCustomField" => $schemaId,
|
||||||
|
"Richiedente" => "Test Web Import",
|
||||||
|
"Descrizione" => "TEST CommessaWeb",
|
||||||
|
];
|
||||||
|
$commessaWeb = $api->post("CommessaWeb", $commessaWebPayload);
|
||||||
|
|
||||||
|
$commessaId = $commessaWeb["IdCommessa"];
|
||||||
|
// Estraiamo il numero della commessa usando CodiceCommessa
|
||||||
|
$commessaWebCode = substr($commessaWeb["CodiceCommessa"] ?? "TEST CommessaWeb", 0, 30); // Limite a 30 caratteri
|
||||||
|
|
||||||
|
// 🔹 STEP 6: Create Campioni (Samples) for each part
|
||||||
|
$campioni = [];
|
||||||
|
foreach ($parts as $index => $part) {
|
||||||
|
$matriceId = (int) ($part["idmatrice"] ?? 0);
|
||||||
|
|
||||||
|
if ($matriceId <= 0) {
|
||||||
|
throw new Exception("Invalid or missing idmatrice for part: " . ($part["part_number"] ?? "Unknown"));
|
||||||
|
}
|
||||||
|
|
||||||
|
$campionePayload = [
|
||||||
|
"Commessa" => $commessaId,
|
||||||
|
"Matrice" => $matriceId,
|
||||||
|
"SottoMatrice" => null,
|
||||||
|
"SchemaCustomField" => $schemaId,
|
||||||
|
"NoteWeb" => $part["part_description"] ?? ""
|
||||||
|
];
|
||||||
|
|
||||||
|
$campione = $api->post("Campione", $campionePayload);
|
||||||
|
|
||||||
|
$campione["PartNumber"] = $part["part_number"] ?? "";
|
||||||
|
$campione["Material"] = $part["material"] ?? "";
|
||||||
|
$campione["Color"] = $part["color"] ?? "";
|
||||||
|
$campione["Mix"] = $part["mix"] ?? "";
|
||||||
|
|
||||||
|
$campioni[] = $campione;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔹 STEP 7: Update Custom Fields for CommessaWeb
|
||||||
|
if (!empty($fieldValues)) {
|
||||||
|
$commessaWithFields = $api->get("CommessaWeb(" . $commessaId . ")?\$expand=CommesseCustomFields");
|
||||||
|
$commessaCustomFields = [];
|
||||||
|
foreach ($commessaWithFields["CommesseCustomFields"] as $customField) {
|
||||||
|
foreach ($fieldValues as $fieldValue) {
|
||||||
|
if ($customField["IdCommesseCustomFields"] == $fieldValue["IdCommesseCustomFields"]) {
|
||||||
|
$commessaCustomFields[] = [
|
||||||
|
"IdCommesseCustomFields" => $customField["IdCommesseCustomFields"],
|
||||||
|
"Valore" => $fieldValue["Valore"]
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($commessaCustomFields)) {
|
||||||
|
$updatePayload = ["CommesseCustomFields" => $commessaCustomFields];
|
||||||
|
$api->patch("CommessaWeb({$commessaId})", $updatePayload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔹 STEP 8: Update datadb with idcommessaweb, commessaweb, and status
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
|
UPDATE datadb
|
||||||
|
SET idcommessaweb = :idcommessaweb, commessaweb = :commessaweb, status = 'l'
|
||||||
|
WHERE iddatadb = :iddatadb
|
||||||
|
");
|
||||||
|
$stmt->execute([
|
||||||
|
'idcommessaweb' => $commessaId,
|
||||||
|
'commessaweb' => $commessaWebCode,
|
||||||
|
'iddatadb' => $iddatadb
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 🔹 STEP 9: Send CommessaWeb to laboratory
|
||||||
|
$sendResult = $api->post("CommessaWeb({$commessaId})/InviaCommessa", []);
|
||||||
|
|
||||||
|
// 🔹 STEP 10: Prepare final response
|
||||||
|
$finalCommessa = [
|
||||||
|
"Cliente" => $clienteId,
|
||||||
|
"SchemaCustomField" => $schemaId,
|
||||||
|
"Richiedente" => $commessaWeb["Richiedente"] ?? "Web Import",
|
||||||
|
"Descrizione" => $commessaWeb["Descrizione"] ?? "",
|
||||||
|
"CommesseCustomFields" => $fieldValues,
|
||||||
|
"Campioni" => $campioni,
|
||||||
|
"Inviata" => 1
|
||||||
|
];
|
||||||
|
|
||||||
|
echo json_encode([
|
||||||
|
"success" => true,
|
||||||
|
"commessaWeb" => $finalCommessa,
|
||||||
|
"commessaWebApiResponse" => $commessaWeb, // Incluso per debug
|
||||||
|
"totalCampioni" => count($campioni),
|
||||||
|
"totalCustomFields" => count($fieldValues),
|
||||||
|
"message" => "Export successful"
|
||||||
|
]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
error_log("LIMS Export Error: " . $e->getMessage() . "\nTrace: " . $e->getTraceAsString());
|
||||||
|
|
||||||
|
echo json_encode([
|
||||||
|
"success" => false,
|
||||||
|
"message" => "Export failed: " . $e->getMessage()
|
||||||
|
]);
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
|
||||||
|
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$api = VisualLimsApiClient::getInstance();
|
||||||
|
|
||||||
|
// ID della CommessaWeb specifica (cambialo di volta in volta)
|
||||||
|
$id = 529435; // TODO: Cambia questo valore con l'ID desiderato
|
||||||
|
|
||||||
|
// Endpoint per recuperare la CommessaWeb specifica con espansione dello schema custom
|
||||||
|
$endpoint = "CommessaWeb({$id})";
|
||||||
|
|
||||||
|
// Opzioni per l'espansione: includi OrderCustomFields per ottenere i campi custom dello schema assegnato all'ordine
|
||||||
|
$options = ['$expand' => 'OrderCustomFields'];
|
||||||
|
|
||||||
|
// Debug: salva URL usato
|
||||||
|
$base_url = 'https://93.43.5.102/limsapi/api/odata/';
|
||||||
|
$query = http_build_query($options);
|
||||||
|
$full_url = $base_url . $endpoint . ($query ? '?' . $query : '');
|
||||||
|
file_put_contents(__DIR__ . '/last_url.txt', $full_url . PHP_EOL, FILE_APPEND);
|
||||||
|
|
||||||
|
// Chiamata API
|
||||||
|
$data = $api->get($endpoint, $options);
|
||||||
|
|
||||||
|
// Salva il JSON in locale
|
||||||
|
file_put_contents(__DIR__ . '/commessaweb_schema_response.json', json_encode($data, JSON_PRETTY_PRINT));
|
||||||
|
|
||||||
|
echo json_encode($data);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
file_put_contents(__DIR__ . '/error_log.txt', date('Y-m-d H:i:s') . ' - ' . $e->getMessage() . PHP_EOL, FILE_APPEND);
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode(['error' => $e->getMessage()]);
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once dirname(__DIR__, 2) . '/vendor/autoload.php'; // Torna al livello di public
|
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
|
||||||
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
@@ -9,20 +9,30 @@ error_reporting(E_ALL);
|
|||||||
try {
|
try {
|
||||||
$api = VisualLimsApiClient::getInstance();
|
$api = VisualLimsApiClient::getInstance();
|
||||||
|
|
||||||
// ID del campo custom passato da GET oppure default
|
// მივიღოთ მრავლობითი field_ids
|
||||||
$customFieldId = isset($_GET['field_id']) && is_numeric($_GET['field_id']) ? intval($_GET['field_id']) : 156;
|
$fieldIds = [];
|
||||||
|
if (isset($_GET['field_ids'])) {
|
||||||
|
$fieldIds = array_filter(array_map('intval', explode(',', $_GET['field_ids'])));
|
||||||
|
}
|
||||||
|
|
||||||
// Endpoint con $expand per ottenere i valori
|
// თუ არ გადმოგვცეს -> ერთი default
|
||||||
$endpoint = "CustomField($customFieldId)?\$expand=CustomFieldsValues";
|
if (empty($fieldIds)) {
|
||||||
|
$fieldIds = [156];
|
||||||
|
}
|
||||||
|
|
||||||
// Recupera i dati dal server
|
$results = [];
|
||||||
$data = $api->get($endpoint);
|
|
||||||
|
|
||||||
// Salva la risposta in un file per debug
|
foreach ($fieldIds as $customFieldId) {
|
||||||
file_put_contents(__DIR__ . '/customfield_values_response.json', json_encode($data));
|
$endpoint = "CustomField($customFieldId)?\$expand=CustomFieldsValues";
|
||||||
|
$data = $api->get($endpoint);
|
||||||
|
|
||||||
// Output JSON al client
|
$results[$customFieldId] = $data['CustomFieldsValues'] ?? [];
|
||||||
echo json_encode($data);
|
}
|
||||||
|
|
||||||
|
// Debug ფაილი
|
||||||
|
file_put_contents(__DIR__ . '/customfield_values_response.json', json_encode($results));
|
||||||
|
|
||||||
|
echo json_encode($results);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
echo json_encode([
|
echo json_encode([
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
|
||||||
|
require_once dirname(__FILE__) . '/class/VisualLimsApiClient.class.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$api = VisualLimsApiClient::getInstance();
|
||||||
|
|
||||||
|
// Endpoint per recuperare le Matrici
|
||||||
|
$endpoint = 'Matrice';
|
||||||
|
|
||||||
|
// (Opzionale) aggiungi parametri, ad esempio $top per limitare i risultati
|
||||||
|
$options = []; // oppure ad esempio: ['$top' => 100]
|
||||||
|
|
||||||
|
// Debug: salva URL usato
|
||||||
|
$base_url = 'https://93.43.5.102/limsapi/api/odata/';
|
||||||
|
$query = http_build_query($options);
|
||||||
|
$full_url = $base_url . $endpoint . ($query ? '?' . $query : '');
|
||||||
|
file_put_contents(__DIR__ . '/last_url.txt', $full_url . PHP_EOL, FILE_APPEND);
|
||||||
|
|
||||||
|
// Chiamata API
|
||||||
|
$data = $api->get($endpoint, $options);
|
||||||
|
|
||||||
|
// Salva il JSON in locale
|
||||||
|
file_put_contents(__DIR__ . '/matrici_response.json', json_encode($data, JSON_PRETTY_PRINT));
|
||||||
|
|
||||||
|
echo json_encode($data);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
file_put_contents(__DIR__ . '/error_log.txt', date('Y-m-d H:i:s') . ' - ' . $e->getMessage() . PHP_EOL, FILE_APPEND);
|
||||||
|
http_response_code(500);
|
||||||
|
echo json_encode(['error' => $e->getMessage()]);
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
|
||||||
|
require_once dirname(__FILE__) . '/class/VisualLimsApiClientXml.class.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/xml; charset=utf-8');
|
||||||
|
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$api = VisualLimsApiClientXml::getInstance();
|
||||||
|
|
||||||
|
// Endpoint per i metadata
|
||||||
|
$endpoint = '$metadata';
|
||||||
|
|
||||||
|
// Nessun parametro aggiuntivo necessario
|
||||||
|
$options = [];
|
||||||
|
|
||||||
|
// Debug: salva URL usato
|
||||||
|
$base_url = 'https://93.43.5.102/limsapi/api/odata/';
|
||||||
|
$query = http_build_query($options);
|
||||||
|
$full_url = $base_url . $endpoint . ($query ? '?' . $query : '');
|
||||||
|
file_put_contents(__DIR__ . '/last_url.txt', $full_url . PHP_EOL, FILE_APPEND);
|
||||||
|
|
||||||
|
// Chiamata API
|
||||||
|
$data = $api->get($endpoint, $options);
|
||||||
|
|
||||||
|
// Salva il file XML in locale
|
||||||
|
file_put_contents(__DIR__ . '/metadata_response.xml', $data);
|
||||||
|
|
||||||
|
// Restituisci il contenuto XML
|
||||||
|
echo $data;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
file_put_contents(__DIR__ . '/error_log.txt', date('Y-m-d H:i:s') . ' - ' . $e->getMessage() . PHP_EOL, FILE_APPEND);
|
||||||
|
http_response_code(500);
|
||||||
|
echo '<?xml version="1.0" encoding="utf-8"?><error>' . htmlspecialchars($e->getMessage()) . '</error>';
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('log_errors', 1);
|
||||||
|
ini_set('error_log', __DIR__ . '/import_debug.log');
|
||||||
|
if (!file_exists(__DIR__ . '/import_debug.log')) {
|
||||||
|
file_put_contents(__DIR__ . '/import_debug.log', "Inizio importazione alle " . date('Y-m-d H:i:s') . "\n", FILE_APPEND);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log iniziale
|
||||||
|
error_log("Inizio importazione alle " . date('Y-m-d H:i:s'));
|
||||||
|
|
||||||
|
include('include/headscript.php');
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] !== 'POST' || !isset($_POST['template_id']) || !isset($_POST['selected_rows']) || !isset($_POST['filename'])) {
|
||||||
|
header("Location: xlstemplates_grid.php?status=error&message=" . urlencode("Richiesta non valida"));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$template_id = intval($_POST['template_id']);
|
||||||
|
$selected_rows = array_map('intval', $_POST['selected_rows']);
|
||||||
|
$columns = json_decode($_POST['columns'], true);
|
||||||
|
$rows = json_decode($_POST['rows'], true);
|
||||||
|
$excelrows = json_decode($_POST['excelrows'], true);
|
||||||
|
$newFilename = htmlspecialchars($_POST['filename']);
|
||||||
|
|
||||||
|
$_SESSION['template_id'] = $template_id;
|
||||||
|
$_SESSION['selected_rows'] = $selected_rows;
|
||||||
|
$_SESSION['columns'] = $columns;
|
||||||
|
$_SESSION['rows'] = $rows;
|
||||||
|
$_SESSION['excelrows'] = $excelrows;
|
||||||
|
$_SESSION['filename'] = $newFilename;
|
||||||
|
|
||||||
|
error_log("Received Data - Template ID: $template_id, Selected Rows: " . json_encode($selected_rows));
|
||||||
|
error_log("Columns: " . json_encode($columns));
|
||||||
|
error_log("Rows: " . json_encode($rows));
|
||||||
|
error_log("Excelrows: " . json_encode($excelrows));
|
||||||
|
|
||||||
|
$user_id = $iduserlogin ?? 1;
|
||||||
|
|
||||||
|
$db = DBHandlerSelect::getInstance();
|
||||||
|
$pdo = $db->getConnection();
|
||||||
|
|
||||||
|
// Genera un UUID univoco per importreferencecode
|
||||||
|
$importReferenceCode = date('YmdHis') . '-' . uniqid();
|
||||||
|
|
||||||
|
// Recupera tutti i mapping dal template
|
||||||
|
$stmt = $pdo->prepare("SELECT id, excel_column, data_type, is_required, manual_default, is_manual, field_label, field_id, main_field FROM template_mapping WHERE template_id = ?");
|
||||||
|
$stmt->execute([$template_id]);
|
||||||
|
$allMappings = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if (empty($allMappings)) {
|
||||||
|
header("Location: import_xls.php?id=$template_id&status=error&message=" . urlencode("Nessun mapping trovato per il template"));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trova il campo main_field
|
||||||
|
$mainFieldMapping = null;
|
||||||
|
foreach ($allMappings as $mapping) {
|
||||||
|
if ($mapping['main_field'] == 1) {
|
||||||
|
$mainFieldMapping = $mapping;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inserisci le righe selezionate in datadb
|
||||||
|
$insertedIds = [];
|
||||||
|
foreach ($selected_rows as $rowIndex) {
|
||||||
|
$row = $rows[$rowIndex] ?? null;
|
||||||
|
$excelrow = $excelrows[$rowIndex] ?? null;
|
||||||
|
|
||||||
|
if ($row === null || $excelrow === null) {
|
||||||
|
error_log("Errore: riga o excelrow mancante per rowIndex $rowIndex");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = [
|
||||||
|
$template_id,
|
||||||
|
$importReferenceCode,
|
||||||
|
$newFilename,
|
||||||
|
'i',
|
||||||
|
$user_id,
|
||||||
|
null,
|
||||||
|
date('Y-m-d'),
|
||||||
|
$excelrow // Aggiunto excelrow per la colonna excelrow
|
||||||
|
];
|
||||||
|
$sql = "INSERT INTO datadb (templateid, importreferencecode, filename_import, status, user_id, limscode, importdate, excelrow) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->execute($values);
|
||||||
|
|
||||||
|
$iddatadb = $pdo->lastInsertId();
|
||||||
|
$insertedIds[] = $iddatadb;
|
||||||
|
|
||||||
|
// Inserisci tutti i campi in import_data_details
|
||||||
|
foreach ($allMappings as $mapping) {
|
||||||
|
$fieldValue = null;
|
||||||
|
if (!$mapping['is_manual']) {
|
||||||
|
$excelColumn = trim($mapping['excel_column']);
|
||||||
|
$excelColumnIndex = array_search($excelColumn, array_map('trim', $columns));
|
||||||
|
if ($excelColumnIndex !== false && isset($row[$excelColumnIndex]) && $row[$excelColumnIndex] !== '') {
|
||||||
|
$fieldValue = $row[$excelColumnIndex];
|
||||||
|
error_log("Found Excel column '$excelColumn' at index $excelColumnIndex, value: " . var_export($fieldValue, true));
|
||||||
|
} else {
|
||||||
|
$fieldValue = $mapping['manual_default'] ?? '';
|
||||||
|
error_log("Excel column '$excelColumn' not found or empty, using default: " . var_export($fieldValue, true));
|
||||||
|
}
|
||||||
|
switch ($mapping['data_type']) {
|
||||||
|
case 'INT':
|
||||||
|
$fieldValue = is_numeric($fieldValue) ? (int)$fieldValue : ($mapping['manual_default'] ?? 0);
|
||||||
|
break;
|
||||||
|
case 'DATE':
|
||||||
|
$fieldValue = !empty($fieldValue) ? date('Y-m-d', strtotime($fieldValue)) : ($mapping['manual_default'] === 'today' ? date('Y-m-d') : ($mapping['manual_default'] ?? ''));
|
||||||
|
break;
|
||||||
|
case 'CHAR':
|
||||||
|
$fieldValue = !empty($fieldValue) ? substr((string)$fieldValue, 0, 1) : ($mapping['manual_default'] ?? '');
|
||||||
|
break;
|
||||||
|
case 'Testo':
|
||||||
|
case 'VARCHAR':
|
||||||
|
default:
|
||||||
|
$fieldValue = !empty($fieldValue) ? htmlspecialchars((string)$fieldValue) : ($mapping['manual_default'] ?? '');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$fieldValue = $mapping['manual_default'] ?? '';
|
||||||
|
if ($mapping['data_type'] === 'DATE' && $mapping['manual_default'] === 'today') {
|
||||||
|
$fieldValue = date('Y-m-d');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($mapping['is_required'] && (is_null($fieldValue) || $fieldValue === '')) {
|
||||||
|
error_log("Required field missing for mapping ID: " . $mapping['id'] . ", field: " . $mapping['field_label']);
|
||||||
|
}
|
||||||
|
error_log("Inserting into import_data_details - Mapping ID: " . $mapping['id'] . ", Field Value: " . var_export($fieldValue, true) . ", Is Manual: " . $mapping['is_manual'] . ", Excel Column: " . ($mapping['excel_column'] ?? 'N/A') . ", Manual Default: " . ($mapping['manual_default'] ?? 'N/A'));
|
||||||
|
$stmt = $pdo->prepare("INSERT INTO import_data_details (id, mapping_id, field_value) VALUES (?, ?, ?)");
|
||||||
|
$stmt->execute([$iddatadb, $mapping['id'], $fieldValue]);
|
||||||
|
error_log("Inserted into import_data_details for ID $iddatadb, Mapping ID: " . $mapping['id'] . ", Field Value: " . var_export($fieldValue, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION['inserted_ids'] = $insertedIds;
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
'template_id' => $template_id,
|
||||||
|
'filename' => $newFilename,
|
||||||
|
];
|
||||||
|
|
||||||
|
?>
|
||||||
|
<form id="redirectForm" action="import_edit2.php" method="post">
|
||||||
|
<input type="hidden" name="template_id" value="<?= htmlspecialchars($template_id) ?>">
|
||||||
|
<input type="hidden" name="filename" value="<?= htmlspecialchars($newFilename) ?>">
|
||||||
|
<?php foreach ($selected_rows as $row): ?>
|
||||||
|
<input type="hidden" name="selected_rows[]" value="<?= htmlspecialchars($row) ?>">
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php foreach ($insertedIds as $id): ?>
|
||||||
|
<input type="hidden" name="inserted_ids[]" value="<?= htmlspecialchars($id) ?>">
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<input type="hidden" name="columns" value='<?= json_encode($columns) ?>'>
|
||||||
|
<input type="hidden" name="rows" value='<?= json_encode($rows) ?>'>
|
||||||
|
<input type="hidden" name="excelrows" value='<?= json_encode($excelrows) ?>'>
|
||||||
|
</form>
|
||||||
|
<script>
|
||||||
|
document.getElementById('redirectForm').submit();
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
exit;
|
||||||
|
?>
|
||||||
@@ -21,6 +21,11 @@ if (!$template) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verifica i mapping
|
||||||
|
$stmt = $pdo->prepare("SELECT id FROM template_mapping WHERE template_id = ?");
|
||||||
|
$stmt->execute([$id]);
|
||||||
|
$hasMappings = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
// Debug del template
|
// Debug del template
|
||||||
error_log("Loaded template: " . print_r($template, true));
|
error_log("Loaded template: " . print_r($template, true));
|
||||||
?>
|
?>
|
||||||
@@ -33,6 +38,7 @@ error_log("Loaded template: " . print_r($template, true));
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
|
<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
|
||||||
<?php include('cssinclude.php'); ?>
|
<?php include('cssinclude.php'); ?>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<style>
|
<style>
|
||||||
.table-container {
|
.table-container {
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
@@ -126,7 +132,11 @@ error_log("Loaded template: " . print_r($template, true));
|
|||||||
<div class="page-wrapper">
|
<div class="page-wrapper">
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<?php include('top_stat_widget.php'); ?>
|
<?php include('top_stat_widget.php'); ?>
|
||||||
|
<div class="mb-3 text">
|
||||||
|
<a href="historical_trf.php?id=<?= $id ?>&status=i" class="btn btn-warning me-2">Imported (i)</a>
|
||||||
|
<a href="historical_trf.php?id=<?= $id ?>&status=P" class="btn btn-primary me-2">In Progress (P)</a>
|
||||||
|
<a href="historical_trf.php?id=<?= $id ?>&status=l" class="btn btn-success">To LIMS (l)</a>
|
||||||
|
</div>
|
||||||
<div class="card radius-10">
|
<div class="card radius-10">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
@@ -137,41 +147,54 @@ error_log("Loaded template: " . print_r($template, true));
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<!-- Form per caricare il file -->
|
<?php if (!$hasMappings): ?>
|
||||||
|
<div class="alert alert-warning" role="alert">
|
||||||
|
Nessun mapping trovato per questo template. Configura i mapping prima di procedere.
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
<form id="uploadForm" enctype="multipart/form-data" class="mb-4">
|
<form id="uploadForm" enctype="multipart/form-data" class="mb-4">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="excel_file" class="form-label">Upload XLS File</label>
|
<label for="excel_file" class="form-label">Upload XLS File</label>
|
||||||
<input type="file" class="form-control" id="excel_file" name="excel_file" accept=".xls,.xlsx" required>
|
<input type="file" class="form-control" id="excel_file" name="excel_file" accept=".xls,.xlsx" required>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Upload</button>
|
<button type="submit" class="btn btn-primary" <?= !$hasMappings ? 'disabled' : '' ?>>Upload</button>
|
||||||
<div class="loader" id="loader"></div>
|
<div class="loader" id="loader"></div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- Contenitore per messaggi di errore -->
|
|
||||||
<div id="errorContainer" class="alert alert-danger mt-3" style="display: none;"></div>
|
<div id="errorContainer" class="alert alert-danger mt-3" style="display: none;"></div>
|
||||||
|
|
||||||
<!-- Contenitore per la tabella -->
|
|
||||||
<div id="tableContainer"></div>
|
<div id="tableContainer"></div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="routineConfirmModal" tabindex="-1" aria-labelledby="routineConfirmModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="routineConfirmModalLabel">Conferma Applicazione Routine</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p><strong>Routine:</strong> <span id="routineName"></span></p>
|
||||||
|
<p><strong>Descrizione:</strong> <span id="routineDescription"></span></p>
|
||||||
|
<p>Vuoi applicare questa routine al file caricato?</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" id="cancelRoutineBtn">Annulla</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="confirmRoutineBtn">Applica</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--end page wrapper -->
|
|
||||||
<div class="overlay toggle-icon"></div>
|
<div class="overlay toggle-icon"></div>
|
||||||
<a href="javaScript:;" class="back-to-top"><i class='bx bxs-up-arrow-alt'></i></a>
|
<a href="javaScript:;" class="back-to-top"><i class='bx bxs-up-arrow-alt'></i></a>
|
||||||
<?php include('include/footer.php'); ?>
|
<?php include('include/footer.php'); ?>
|
||||||
</div>
|
</div>
|
||||||
<!--end wrapper-->
|
|
||||||
|
|
||||||
<!-- search modal -->
|
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
|
||||||
<?php //include('include/searchmodal.php');
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js"></script>
|
||||||
?>
|
|
||||||
<!-- end search modal -->
|
|
||||||
|
|
||||||
<!--start switcher-->
|
|
||||||
<?php //include('include/themeswitcher.php');
|
|
||||||
?>
|
|
||||||
<!--end switcher-->
|
|
||||||
<?php include('jsinclude.php'); ?>
|
<?php include('jsinclude.php'); ?>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
@@ -179,6 +202,12 @@ error_log("Loaded template: " . print_r($template, true));
|
|||||||
const loader = document.getElementById('loader');
|
const loader = document.getElementById('loader');
|
||||||
const errorContainer = document.getElementById('errorContainer');
|
const errorContainer = document.getElementById('errorContainer');
|
||||||
const tableContainer = document.getElementById('tableContainer');
|
const tableContainer = document.getElementById('tableContainer');
|
||||||
|
const routineModal = new bootstrap.Modal(document.getElementById('routineConfirmModal'));
|
||||||
|
const confirmRoutineBtn = document.getElementById('confirmRoutineBtn');
|
||||||
|
const cancelRoutineBtn = document.getElementById('cancelRoutineBtn');
|
||||||
|
let routineData = null;
|
||||||
|
let excelData = null;
|
||||||
|
let responseData = null;
|
||||||
|
|
||||||
form.addEventListener('submit', function(e) {
|
form.addEventListener('submit', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -197,131 +226,186 @@ error_log("Loaded template: " . print_r($template, true));
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => {
|
||||||
|
console.log('Stato risposta:', response.status);
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
console.log('Risposta JSON:', data);
|
||||||
loader.style.display = 'none';
|
loader.style.display = 'none';
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
errorContainer.textContent = data.error;
|
errorContainer.textContent = data.error;
|
||||||
errorContainer.style.display = 'block';
|
errorContainer.style.display = 'block';
|
||||||
|
} else if (data.apply_routine) {
|
||||||
|
console.log('Routine rilevata:', data.routine_data);
|
||||||
|
routineData = data.routine_data;
|
||||||
|
excelData = data.excel_data;
|
||||||
|
responseData = data;
|
||||||
|
document.getElementById('routineName').textContent = routineData.name || 'Sconosciuta';
|
||||||
|
document.getElementById('routineDescription').textContent = routineData.instruction || 'Nessuna descrizione';
|
||||||
|
routineModal.show();
|
||||||
} else {
|
} else {
|
||||||
let html = `
|
console.log('Nessuna routine, procedo con tabella');
|
||||||
<form id="selectRowsForm" action="import_edit2.php" method="POST">
|
showTable(data);
|
||||||
<input type="hidden" name="template_id" value="${data.template_id}">
|
|
||||||
<input type="hidden" name="columns" value='${JSON.stringify(data.columns)}'>
|
|
||||||
<input type="hidden" name="rows" value='${JSON.stringify(data.rows)}'>
|
|
||||||
<input type="hidden" name="filename" value="${data.filename}">
|
|
||||||
<div class="search-container">
|
|
||||||
<input type="text" id="searchInput" class="form-control" placeholder="Cerca nelle righe...">
|
|
||||||
</div>
|
|
||||||
<div class="table-container">
|
|
||||||
<table class="table table-striped table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><input type="checkbox" id="selectAll"> Seleziona</th>
|
|
||||||
${data.columns.map(col => `<th>${col || 'Colonna senza nome'}<div class="resize-handle"></div></th>`).join('')}
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
${data.rows.map((row, index) => `
|
|
||||||
<tr>
|
|
||||||
<td><input type="checkbox" class="row-checkbox" name="selected_rows[]" value="${index}"></td>
|
|
||||||
${row.map(cell => `<td>${cell}</td>`).join('')}
|
|
||||||
</tr>
|
|
||||||
`).join('')}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-primary mt-3" id="proceedButton" disabled>Prosegui</button>
|
|
||||||
</form>
|
|
||||||
`;
|
|
||||||
tableContainer.innerHTML = html;
|
|
||||||
|
|
||||||
// Inizializza le variabili dopo aver inserito la tabella
|
|
||||||
const proceedButton = document.getElementById('proceedButton');
|
|
||||||
const selectAllCheckbox = document.getElementById('selectAll');
|
|
||||||
const checkboxes = document.querySelectorAll('.row-checkbox');
|
|
||||||
|
|
||||||
// Funzione per aggiornare lo stato del pulsante Prosegui
|
|
||||||
function updateProceedButton() {
|
|
||||||
proceedButton.disabled = !Array.from(checkboxes).some(cb => cb.checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Event listener per il checkbox "Seleziona tutto"
|
|
||||||
selectAllCheckbox.addEventListener('change', function() {
|
|
||||||
checkboxes.forEach(checkbox => {
|
|
||||||
checkbox.checked = this.checked;
|
|
||||||
});
|
|
||||||
updateProceedButton();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Event listener per i checkbox delle righe
|
|
||||||
checkboxes.forEach(checkbox => {
|
|
||||||
checkbox.addEventListener('change', function() {
|
|
||||||
console.log('Checkbox changed, checked: ', this.checked); // Debug
|
|
||||||
// Aggiorna lo stato del checkbox "Seleziona tutto"
|
|
||||||
selectAllCheckbox.checked = Array.from(checkboxes).every(cb => cb.checked);
|
|
||||||
updateProceedButton();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Aggiungi logica per il ridimensionamento delle colonne
|
|
||||||
const thElements = document.querySelectorAll('.table th');
|
|
||||||
thElements.forEach((th, index) => {
|
|
||||||
if (index === 0) return;
|
|
||||||
const resizeHandle = th.querySelector('.resize-handle');
|
|
||||||
if (resizeHandle) {
|
|
||||||
resizeHandle.addEventListener('mousedown', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
const startX = e.clientX;
|
|
||||||
const startWidth = th.offsetWidth;
|
|
||||||
|
|
||||||
const onMouseMove = (e) => {
|
|
||||||
const newWidth = Math.max(50, startWidth + (e.clientX - startX));
|
|
||||||
th.style.width = `${newWidth}px`;
|
|
||||||
th.style.minWidth = `${newWidth}px`;
|
|
||||||
th.style.maxWidth = `${newWidth}px`;
|
|
||||||
|
|
||||||
const cells = document.querySelectorAll(`.table td:nth-child(${index + 1})`);
|
|
||||||
cells.forEach(cell => {
|
|
||||||
cell.style.width = `${newWidth}px`;
|
|
||||||
cell.style.minWidth = `${newWidth}px`;
|
|
||||||
cell.style.maxWidth = `${newWidth}px`;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const onMouseUp = () => {
|
|
||||||
document.removeEventListener('mousemove', onMouseMove);
|
|
||||||
document.removeEventListener('mouseup', onMouseUp);
|
|
||||||
};
|
|
||||||
|
|
||||||
document.addEventListener('mousemove', onMouseMove);
|
|
||||||
document.addEventListener('mouseup', onMouseUp);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Aggiungi event listener per la ricerca
|
|
||||||
const searchInput = document.getElementById('searchInput');
|
|
||||||
const rows = document.querySelectorAll('.table tbody tr');
|
|
||||||
|
|
||||||
searchInput.addEventListener('input', function() {
|
|
||||||
const searchTerm = this.value.toLowerCase();
|
|
||||||
rows.forEach(row => {
|
|
||||||
const text = Array.from(row.cells).slice(1).map(cell => cell.textContent.toLowerCase()).join(' ');
|
|
||||||
row.style.display = text.includes(searchTerm) ? '' : 'none';
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Abilita il pulsante se ci sono checkbox selezionate all'inizio
|
|
||||||
updateProceedButton();
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
console.log('Errore fetch:', error);
|
||||||
loader.style.display = 'none';
|
loader.style.display = 'none';
|
||||||
errorContainer.textContent = 'Errore durante il caricamento del file: ' + error.message;
|
errorContainer.textContent = 'Errore durante il caricamento del file: ' + error.message;
|
||||||
errorContainer.style.display = 'block';
|
errorContainer.style.display = 'block';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
confirmRoutineBtn.addEventListener('click', function() {
|
||||||
|
console.log('Conferma routine:', routineData);
|
||||||
|
routineModal.hide();
|
||||||
|
|
||||||
|
fetch('apply_routine.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
template_id: <?= $id ?>,
|
||||||
|
filename: routineData.filename,
|
||||||
|
headerrow: routineData.headerrow,
|
||||||
|
excel_data: excelData,
|
||||||
|
routine_data: routineData
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
console.log('Stato apply_routine:', response.status);
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
console.log('Risposta apply_routine:', data);
|
||||||
|
if (data.error) {
|
||||||
|
errorContainer.textContent = data.error;
|
||||||
|
errorContainer.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
showTable(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log('Errore apply_routine:', error);
|
||||||
|
errorContainer.textContent = 'Errore durante l\'applicazione della routine: ' + error.message;
|
||||||
|
errorContainer.style.display = 'block';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
cancelRoutineBtn.addEventListener('click', function() {
|
||||||
|
console.log('Routine annullata, procedo con tabella');
|
||||||
|
routineModal.hide();
|
||||||
|
showTable(responseData);
|
||||||
|
});
|
||||||
|
|
||||||
|
function showTable(data) {
|
||||||
|
console.log('Mostro tabella con dati:', data);
|
||||||
|
let html = `
|
||||||
|
<form id="selectRowsForm" action="import_insert.php" method="POST">
|
||||||
|
<input type="hidden" name="template_id" value="${data.template_id}">
|
||||||
|
<input type="hidden" name="columns" value='${JSON.stringify(data.columns)}'>
|
||||||
|
<input type="hidden" name="rows" value='${JSON.stringify(data.rows)}'>
|
||||||
|
<input type="hidden" name="excelrows" value='${JSON.stringify(data.excel_data.map(row => row.excelrow))}'>
|
||||||
|
<input type="hidden" name="filename" value="${data.filename}">
|
||||||
|
<div class="search-container">
|
||||||
|
<input type="text" id="searchInput" class="form-control" placeholder="Cerca nelle righe...">
|
||||||
|
</div>
|
||||||
|
<div class="table-container">
|
||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><input type="checkbox" id="selectAll"> Seleziona</th>
|
||||||
|
${data.columns.map(col => `<th>${col || 'Colonna senza nome'}<div class="resize-handle"></div></th>`).join('')}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
${data.excel_data.map((row, index) => `
|
||||||
|
<tr>
|
||||||
|
<td><input type="checkbox" class="row-checkbox" name="selected_rows[]" value="${index}" data-excelrow="${row.excelrow}"></td>
|
||||||
|
${row.data.map(cell => `<td>${cell}</td>`).join('')}
|
||||||
|
</tr>
|
||||||
|
`).join('')}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary mt-3" id="proceedButton" disabled>Prosegui</button>
|
||||||
|
</form>
|
||||||
|
`;
|
||||||
|
tableContainer.innerHTML = html;
|
||||||
|
|
||||||
|
const proceedButton = document.getElementById('proceedButton');
|
||||||
|
const selectAllCheckbox = document.getElementById('selectAll');
|
||||||
|
const checkboxes = document.querySelectorAll('.row-checkbox');
|
||||||
|
|
||||||
|
function updateProceedButton() {
|
||||||
|
proceedButton.disabled = !Array.from(checkboxes).some(cb => cb.checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectAllCheckbox.addEventListener('change', function() {
|
||||||
|
checkboxes.forEach(checkbox => {
|
||||||
|
checkbox.checked = this.checked;
|
||||||
|
});
|
||||||
|
updateProceedButton();
|
||||||
|
});
|
||||||
|
|
||||||
|
checkboxes.forEach(checkbox => {
|
||||||
|
checkbox.addEventListener('change', function() {
|
||||||
|
console.log('Checkbox changed, checked:', this.checked, 'excelrow:', this.dataset.excelrow);
|
||||||
|
selectAllCheckbox.checked = Array.from(checkboxes).every(cb => cb.checked);
|
||||||
|
updateProceedButton();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const thElements = document.querySelectorAll('.table th');
|
||||||
|
thElements.forEach((th, index) => {
|
||||||
|
if (index === 0) return;
|
||||||
|
const resizeHandle = th.querySelector('.resize-handle');
|
||||||
|
if (resizeHandle) {
|
||||||
|
resizeHandle.addEventListener('mousedown', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const startX = e.clientX;
|
||||||
|
const startWidth = th.offsetWidth;
|
||||||
|
|
||||||
|
const onMouseMove = (e) => {
|
||||||
|
const newWidth = Math.max(50, startWidth + (e.clientX - startX));
|
||||||
|
th.style.width = `${newWidth}px`;
|
||||||
|
th.style.minWidth = `${newWidth}px`;
|
||||||
|
th.style.maxWidth = `${newWidth}px`;
|
||||||
|
|
||||||
|
const cells = document.querySelectorAll(`.table td:nth-child(${index + 1})`);
|
||||||
|
cells.forEach(cell => {
|
||||||
|
cell.style.width = `${newWidth}px`;
|
||||||
|
cell.style.minWidth = `${newWidth}px`;
|
||||||
|
cell.style.maxWidth = `${newWidth}px`;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const onMouseUp = () => {
|
||||||
|
document.removeEventListener('mousemove', onMouseMove);
|
||||||
|
document.removeEventListener('mouseup', onMouseUp);
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('mousemove', onMouseMove);
|
||||||
|
document.addEventListener('mouseup', onMouseUp);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const searchInput = document.getElementById('searchInput');
|
||||||
|
const rows = document.querySelectorAll('.table tbody tr');
|
||||||
|
|
||||||
|
searchInput.addEventListener('input', function() {
|
||||||
|
const searchTerm = this.value.toLowerCase();
|
||||||
|
rows.forEach(row => {
|
||||||
|
const text = Array.from(row.cells).slice(1).map(cell => cell.textContent.toLowerCase()).join(' ');
|
||||||
|
row.style.display = text.includes(searchTerm) ? '' : 'none';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
updateProceedButton();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
<li> <a href="import_dashboard.php"><i class='bx bx-radio-circle'></i>XLS Import</a>
|
<li> <a href="import_dashboard.php"><i class='bx bx-radio-circle'></i>XLS Import</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -40,7 +41,21 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>-->
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="javascript:;" class="has-arrow">
|
||||||
|
<div class="parent-icon"><i class="bx bx-category"></i>
|
||||||
|
</div>
|
||||||
|
<div class="menu-title">Other Functions</div>
|
||||||
|
</a>
|
||||||
|
<ul>
|
||||||
|
<li> <a href="quotations.php"><i class='bx bx-radio-circle'></i><?php echo $quotationstitle; ?></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,30 @@
|
|||||||
<?php include('include/headscript.php'); ?>
|
<?php include('include/headscript.php');
|
||||||
|
|
||||||
|
// Recupera tutte le routine dal database
|
||||||
|
$db = DBHandlerSelect::getInstance();
|
||||||
|
$pdo = $db->getConnection();
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM routine");
|
||||||
|
$stmt->execute();
|
||||||
|
$routines = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
?>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<!-- Required meta tags -->
|
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<!--favicon-->
|
|
||||||
<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
|
<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
|
||||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||||
<?php include('cssinclude.php'); ?>
|
<?php include('cssinclude.php'); ?>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||||
<title>Insert XLS Template <?= htmlspecialchars($titlewebsite, ENT_QUOTES, 'UTF-8'); ?></title>
|
<title>Insert XLS Template <?= htmlspecialchars($titlewebsite, ENT_QUOTES, 'UTF-8'); ?></title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!--wrapper-->
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<!--sidebar wrapper -->
|
|
||||||
<?php include('include/navbar.php'); ?>
|
<?php include('include/navbar.php'); ?>
|
||||||
<!--end sidebar wrapper -->
|
|
||||||
<!--start header -->
|
|
||||||
<?php include('include/topbar.php'); ?>
|
<?php include('include/topbar.php'); ?>
|
||||||
<!--end header -->
|
|
||||||
<!--start page wrapper -->
|
|
||||||
<div class="page-wrapper">
|
<div class="page-wrapper">
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="card mb-4">
|
<div class="card mb-4">
|
||||||
@@ -35,7 +37,7 @@
|
|||||||
<ul class="mb-0">
|
<ul class="mb-0">
|
||||||
<li>Template Name</li>
|
<li>Template Name</li>
|
||||||
<li>Row Header and Column Header: where the title of the excel starts</li>
|
<li>Row Header and Column Header: where the title of the excel starts</li>
|
||||||
<li>Scheme and client</li>
|
<li>Schema and client</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -73,7 +75,6 @@
|
|||||||
|
|
||||||
<input type="hidden" name="target_table" value="datadb">
|
<input type="hidden" name="target_table" value="datadb">
|
||||||
|
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Button Size</label>
|
<label class="form-label">Button Size</label>
|
||||||
<select name="button_size" class="form-control">
|
<select name="button_size" class="form-control">
|
||||||
@@ -97,7 +98,7 @@
|
|||||||
<label class="form-label">Button Label</label>
|
<label class="form-label">Button Label</label>
|
||||||
<input type="text" name="button_label" class="form-control" value="Click Me">
|
<input type="text" name="button_label" class="form-control" value="Click Me">
|
||||||
</div>
|
</div>
|
||||||
<!-- Aggiungi il campo per selezionare il cliente -->
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Select Client *</label>
|
<label class="form-label">Select Client *</label>
|
||||||
<select name="client_id" id="clientSelect" class="form-control" required>
|
<select name="client_id" id="clientSelect" class="form-control" required>
|
||||||
@@ -105,68 +106,33 @@
|
|||||||
</select>
|
</select>
|
||||||
<span id="clientLoadingStatus" class="text-muted" style="margin-left: 10px; display: none;">Recupero clienti in corso...</span>
|
<span id="clientLoadingStatus" class="text-muted" style="margin-left: 10px; display: none;">Recupero clienti in corso...</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- Aggiungi il campo per selezionare lo schema -->
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Select Schema *</label>
|
<label class="form-label">Select Schema *</label>
|
||||||
<select name="schema_id" id="schemaSelect" class="form-control" required>
|
<select name="schema_id" id="schemaSelect" class="form-control" required>
|
||||||
<option value="">Select a schema...</option>
|
<option value="">Select a schema...</option>
|
||||||
</select>
|
</select>
|
||||||
<span id="schemaLoadingStatus" class="text-muted" style="margin-left: 10px; display: none;">Loading schemas...</span>
|
<span id="schemaLoadingStatus" class="text-muted" style="margin-left: 10px; display: none;">Caricamento schemi in corso...</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- new section for specific client field -->
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Client-Specific Fields</label>
|
<label class="form-label">Select Routine</label>
|
||||||
|
<select name="idroutine" id="routineSelect" class="form-control">
|
||||||
<!-- Intestazioni -->
|
<option value="">Select a routine...</option>
|
||||||
<div class="row fw-bold text-secondary mb-1">
|
<?php foreach ($routines as $routine): ?>
|
||||||
<div class="col-md-3">Field Name</div>
|
<option value="<?php echo $routine['idroutine']; ?>">
|
||||||
<div class="col-md-2">Type</div>
|
<?php echo htmlspecialchars($routine['name']); ?>
|
||||||
<div class="col-md-2 dropdown-values">Possible Values</div>
|
</option>
|
||||||
<div class="col-md-1">Required</div>
|
<?php endforeach; ?>
|
||||||
<div class="col-md-2">Export Column Name</div>
|
</select>
|
||||||
<div class="col-md-1">Default Value</div>
|
<div id="routineDetails" class="mt-2" style="display: none;">
|
||||||
<div class="col-md-1">Actions</div>
|
<h6>Routine Details</h6>
|
||||||
|
<p><strong>Name:</strong> <span id="routineName"></span></p>
|
||||||
|
<p><strong>Description:</strong> <span id="routineDescription"></span></p>
|
||||||
|
<p><strong>Action 1:</strong> <span id="routineAction1"></span></p>
|
||||||
|
<p><strong>Action 2:</strong> <span id="routineAction2"></span></p>
|
||||||
|
<p><strong>Action 3:</strong> <span id="routineAction3"></span></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="clientSpecificFields">
|
|
||||||
<!-- Contenitore per i campi dinamici -->
|
|
||||||
<div class="client-field-row mb-2">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" name="specific_fields[0][name]" class="form-control" placeholder="Field Name (e.g., SKU)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<select name="specific_fields[0][type]" class="form-control" onchange="toggleDropdownValues(this)">
|
|
||||||
<option value="text">Text</option>
|
|
||||||
<option value="dropdown">Dropdown</option>
|
|
||||||
<option value="date">Date</option>
|
|
||||||
<option value="boolean">Yes/No</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2 dropdown-values" style="visibility: hidden;">
|
|
||||||
<input type="text" name="specific_fields[0][possible_values]" class="form-control" placeholder="Values (e.g., Red, Blue, Green)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<select name="specific_fields[0][required]" class="form-control">
|
|
||||||
<option value="1">Yes</option>
|
|
||||||
<option value="0">No</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="text" name="specific_fields[0][export_column_name]" class="form-control" placeholder="Export Column Name (e.g., MONCLER_SKU)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<input type="text" name="specific_fields[0][default_value]" class="form-control" placeholder="Default Value (optional)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<button type="button" class="btn btn-danger remove-field">-</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<button type="button" class="btn btn-primary mt-2" id="addField">Add Field</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@@ -178,125 +144,72 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--end page wrapper -->
|
|
||||||
<!--start overlay-->
|
|
||||||
<div class="overlay toggle-icon"></div>
|
<div class="overlay toggle-icon"></div>
|
||||||
<!--end overlay-->
|
|
||||||
<!--Start Back To Top Button-->
|
|
||||||
<a href="javaScript:;" class="back-to-top"><i class='bx bxs-up-arrow-alt'></i></a>
|
<a href="javaScript:;" class="back-to-top"><i class='bx bxs-up-arrow-alt'></i></a>
|
||||||
<!--End Back To Top Button-->
|
|
||||||
<?php include('include/footer.php'); ?>
|
<?php include('include/footer.php'); ?>
|
||||||
</div>
|
</div>
|
||||||
<!--end wrapper-->
|
|
||||||
|
|
||||||
<!-- search modal -->
|
|
||||||
<?php //include('include/searchmodal.php');
|
|
||||||
?>
|
|
||||||
<!-- end search modal -->
|
|
||||||
|
|
||||||
<!--start switcher-->
|
|
||||||
<?php //include('include/themeswitcher.php');
|
|
||||||
?>
|
|
||||||
<!--end switcher-->
|
|
||||||
|
|
||||||
<!-- Includi Select2 JS -->
|
|
||||||
|
|
||||||
<?php include('jsinclude.php'); ?>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
// Debug iniziale
|
|
||||||
console.log("JavaScript is loaded and running!");
|
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
console.log("DOM is loaded");
|
if (typeof jQuery === 'undefined') {
|
||||||
|
alert("Errore: jQuery non è caricato. Contatta l'amministratore.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const form = document.getElementById("insertTemplateForm");
|
const form = document.getElementById("insertTemplateForm");
|
||||||
const addFieldButton = document.getElementById("addField");
|
|
||||||
const container = document.getElementById("clientSpecificFields");
|
|
||||||
const clientLoadingStatus = document.getElementById("clientLoadingStatus");
|
const clientLoadingStatus = document.getElementById("clientLoadingStatus");
|
||||||
const schemaLoadingStatus = document.getElementById("schemaLoadingStatus");
|
const schemaLoadingStatus = document.getElementById("schemaLoadingStatus");
|
||||||
|
const routineSelect = document.getElementById("routineSelect");
|
||||||
|
const routineDetails = document.getElementById("routineDetails");
|
||||||
|
const routineName = document.getElementById("routineName");
|
||||||
|
const routineDescription = document.getElementById("routineDescription");
|
||||||
|
const routineAction1 = document.getElementById("routineAction1");
|
||||||
|
const routineAction2 = document.getElementById("routineAction2");
|
||||||
|
const routineAction3 = document.getElementById("routineAction3");
|
||||||
|
|
||||||
if (!form || !addFieldButton || !container || !clientLoadingStatus || !schemaLoadingStatus) {
|
if (!form || !clientLoadingStatus || !schemaLoadingStatus || !routineSelect || !routineDetails) {
|
||||||
console.error("One or more DOM elements not found:", {
|
alert("Errore: Uno o più elementi della pagina non sono stati trovati. Contatta l'amministratore.");
|
||||||
form,
|
|
||||||
addFieldButton,
|
|
||||||
container,
|
|
||||||
clientLoadingStatus,
|
|
||||||
schemaLoadingStatus
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("All DOM elements found");
|
|
||||||
|
|
||||||
// Controllo che jQuery sia caricato
|
|
||||||
if (typeof jQuery === 'undefined') {
|
|
||||||
console.error("jQuery non è caricato!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inizializza Select2 sulla tendina dei clienti
|
|
||||||
$('#clientSelect').select2({
|
$('#clientSelect').select2({
|
||||||
placeholder: "Search for a client...",
|
placeholder: "Search for a client...",
|
||||||
allowClear: true
|
allowClear: true
|
||||||
}).on('select2:open', function() {
|
|
||||||
console.log("Select2 initialized successfully for clientSelect");
|
|
||||||
}).on('select2:select', function(e) {
|
|
||||||
console.log("Client selected:", e.params.data.id, e.params.data.text);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Inizializza Select2 sulla tendina degli schemi
|
|
||||||
$('#schemaSelect').select2({
|
$('#schemaSelect').select2({
|
||||||
placeholder: "Search for a schema...",
|
placeholder: "Search for a schema...",
|
||||||
allowClear: true
|
allowClear: true
|
||||||
}).on('select2:open', function() {
|
|
||||||
console.log("Select2 initialized successfully for schemaSelect");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Funzione per caricare i clienti
|
$('#routineSelect').select2({
|
||||||
|
placeholder: "Select a routine...",
|
||||||
|
allowClear: true
|
||||||
|
});
|
||||||
|
|
||||||
async function loadClients() {
|
async function loadClients() {
|
||||||
try {
|
try {
|
||||||
clientLoadingStatus.style.display = 'inline';
|
clientLoadingStatus.style.display = 'inline';
|
||||||
clientLoadingStatus.textContent = 'Recupero clienti in corso...';
|
clientLoadingStatus.textContent = 'Recupero clienti in corso...';
|
||||||
|
|
||||||
const response = await fetch("get_clienti.php", {
|
const response = await fetch("get_clienti.php", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
const data = await response.json();
|
||||||
const text = await response.text();
|
if (!response.ok) throw new Error(data.error || `Errore HTTP: ${response.status}`);
|
||||||
console.log("Risposta raw (clienti):", text);
|
const select = document.getElementById("clientSelect");
|
||||||
const data = JSON.parse(text);
|
select.innerHTML = '<option value="">Select a client...</option>';
|
||||||
|
data.value.forEach(client => {
|
||||||
if (!response.ok) {
|
const nome = client.Nominativo || "Nome non disponibile";
|
||||||
throw new Error(data.error || `Errore HTTP: ${response.status}, Dettagli: ${JSON.stringify(data)}`);
|
const id = client.IdCliente || "ID non disponibile";
|
||||||
}
|
const option = new Option(`${nome.trim()} (ID: ${id})`, id);
|
||||||
|
select.add(option);
|
||||||
if (data.value && Array.isArray(data.value)) {
|
});
|
||||||
const select = document.getElementById("clientSelect");
|
$(select).trigger('change');
|
||||||
select.innerHTML = '<option value="">Select a client...</option>';
|
clientLoadingStatus.textContent = "Clienti caricati.";
|
||||||
data.value.forEach(client => {
|
|
||||||
const nome = client.Nominativo || "Nome non disponibile";
|
|
||||||
const id = client.IdCliente || "ID non disponibile";
|
|
||||||
const option = new Option(`${nome.trim()} (ID: ${id})`, id);
|
|
||||||
select.add(option);
|
|
||||||
});
|
|
||||||
console.log("Clienti caricati con successo.");
|
|
||||||
clientLoadingStatus.textContent = "Clienti caricati.";
|
|
||||||
} else {
|
|
||||||
console.error("Nessun cliente trovato o formato dati non valido.", data);
|
|
||||||
clientLoadingStatus.textContent = "Nessun cliente trovato.";
|
|
||||||
Swal.fire({
|
|
||||||
title: "Errore!",
|
|
||||||
text: "Nessun cliente trovato o formato dati non valido.",
|
|
||||||
icon: "error",
|
|
||||||
confirmButtonText: "OK"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Errore nel caricamento dei clienti:", error);
|
|
||||||
clientLoadingStatus.textContent = "Errore nel caricamento.";
|
clientLoadingStatus.textContent = "Errore nel caricamento.";
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Errore!",
|
title: "Errore!",
|
||||||
@@ -305,175 +218,110 @@
|
|||||||
confirmButtonText: "OK"
|
confirmButtonText: "OK"
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
setTimeout(() => {
|
setTimeout(() => clientLoadingStatus.style.display = 'none', 2000);
|
||||||
clientLoadingStatus.style.display = 'none';
|
|
||||||
}, 2000);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funzione per caricare gli schemi con ritentativi
|
|
||||||
async function loadSchemas() {
|
async function loadSchemas() {
|
||||||
const maxRetries = 3;
|
try {
|
||||||
let attempt = 0;
|
schemaLoadingStatus.style.display = 'inline';
|
||||||
|
schemaLoadingStatus.textContent = 'Caricamento schemi in corso...';
|
||||||
while (attempt < maxRetries) {
|
const response = await fetch("get_schemi.php", {
|
||||||
try {
|
method: "GET",
|
||||||
schemaLoadingStatus.style.display = 'inline';
|
headers: {
|
||||||
schemaLoadingStatus.textContent = 'Caricamento schemi in corso...';
|
"Content-Type": "application/json"
|
||||||
|
|
||||||
const response = await fetch("get_schemi.php", {
|
|
||||||
method: "GET",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const text = await response.text();
|
|
||||||
console.log("Risposta raw (schemi):", text);
|
|
||||||
const data = JSON.parse(text);
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error(data.error || `Errore HTTP: ${response.status}, Dettagli: ${JSON.stringify(data)}`);
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
const select = document.getElementById("schemaSelect");
|
const data = await response.json();
|
||||||
select.innerHTML = '<option value="">Select a schema...</option>';
|
if (!response.ok) throw new Error(data.error || `Errore HTTP: ${response.status}`);
|
||||||
data.value.forEach(schema => { // Nota: usa data.value per coerenza con il JSON restituito
|
const select = document.getElementById("schemaSelect");
|
||||||
const option = new Option(`${schema.Nome} (ID: ${schema.IdSchemaCustomFields})`, schema.IdSchemaCustomFields);
|
select.innerHTML = '<option value="">Select a schema...</option>';
|
||||||
select.add(option);
|
data.value.forEach(schema => {
|
||||||
});
|
const nome = schema.Nome || "Nome non disponibile";
|
||||||
|
const id = schema.IdSchemaCustomFields || "ID non disponibile";
|
||||||
schemaLoadingStatus.textContent = "Schemi caricati.";
|
const option = new Option(`${nome.trim()} (ID: ${id})`, id);
|
||||||
break; // Esci dal ciclo se la chiamata ha successo
|
select.add(option);
|
||||||
} catch (error) {
|
});
|
||||||
attempt++;
|
$(select).trigger('change');
|
||||||
console.error(`Tentativo ${attempt} fallito per schemi:`, error);
|
schemaLoadingStatus.textContent = "Schemi caricati.";
|
||||||
if (attempt === maxRetries) {
|
} catch (error) {
|
||||||
console.error("Errore finale nel caricamento degli schemi:", error);
|
schemaLoadingStatus.textContent = "Errore nel caricamento.";
|
||||||
schemaLoadingStatus.textContent = "Errore nel caricamento.";
|
Swal.fire({
|
||||||
Swal.fire({
|
title: "Errore!",
|
||||||
title: "Errore!",
|
text: "Impossibile caricare gli schemi: " + error.message,
|
||||||
text: "Impossibile caricare gli schemi: " + error.message,
|
icon: "error",
|
||||||
icon: "error",
|
confirmButtonText: "OK"
|
||||||
confirmButtonText: "OK"
|
});
|
||||||
});
|
} finally {
|
||||||
} else {
|
setTimeout(() => schemaLoadingStatus.style.display = 'none', 2000);
|
||||||
// Ritardo prima di riprovare
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 1000 * attempt));
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (attempt === maxRetries || schemaLoadingStatus.textContent === "Schemi caricati.") {
|
|
||||||
setTimeout(() => {
|
|
||||||
schemaLoadingStatus.style.display = 'none';
|
|
||||||
}, 2000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Funzione combinata per caricare i dati in sequenza
|
|
||||||
async function loadData() {
|
async function loadData() {
|
||||||
try {
|
try {
|
||||||
await loadClients(); // Carica prima i clienti
|
await loadClients();
|
||||||
await loadSchemas(); // Poi carica gli schemi
|
await loadSchemas();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Errore nel caricamento dei dati:", error);
|
Swal.fire({
|
||||||
}
|
title: "Errore!",
|
||||||
}
|
text: "Errore nel caricamento dei dati: " + error.message,
|
||||||
|
icon: "error",
|
||||||
// Avvia il caricamento dei dati
|
confirmButtonText: "OK"
|
||||||
loadData();
|
|
||||||
|
|
||||||
// Gestione dinamica dei campi specifici
|
|
||||||
addFieldButton.addEventListener("click", function() {
|
|
||||||
console.log("Add Field button clicked");
|
|
||||||
const fieldCount = container.getElementsByClassName("client-field-row").length;
|
|
||||||
const newField = document.createElement("div");
|
|
||||||
newField.className = "client-field-row mb-2";
|
|
||||||
newField.innerHTML = `
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" name="specific_fields[${fieldCount}][name]" class="form-control" placeholder="Field Name (e.g., SKU)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<select name="specific_fields[${fieldCount}][type]" class="form-control" onchange="toggleDropdownValues(this)">
|
|
||||||
<option value="text">Text</option>
|
|
||||||
<option value="dropdown">Dropdown</option>
|
|
||||||
<option value="date">Date</option>
|
|
||||||
<option value="boolean">Yes/No</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2 dropdown-values" style="visibility: hidden;">
|
|
||||||
<input type="text" name="specific_fields[${fieldCount}][possible_values]" class="form-control" placeholder="Values (e.g., Red, Blue, Green)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<select name="specific_fields[${fieldCount}][required]" class="form-control">
|
|
||||||
<option value="1">Yes</option>
|
|
||||||
<option value="0">No</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="text" name="specific_fields[${fieldCount}][export_column_name]" class="form-control" placeholder="Export Column Name (e.g., MONCLER_SKU)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<input type="text" name="specific_fields[${fieldCount}][default_value]" class="form-control" placeholder="Default Value (optional)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<button type="button" class="btn btn-danger remove-field">-</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
container.appendChild(newField);
|
|
||||||
|
|
||||||
newField.querySelector(".remove-field").addEventListener("click", function() {
|
|
||||||
console.log("Remove Field button clicked");
|
|
||||||
container.removeChild(newField);
|
|
||||||
updateFieldIndices();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
window.toggleDropdownValues = function(selectElement) {
|
|
||||||
console.log("Toggling dropdown values for:", selectElement.value);
|
|
||||||
const row = selectElement.closest(".row");
|
|
||||||
const dropdownValues = row.querySelector(".dropdown-values");
|
|
||||||
if (selectElement.value === "dropdown") {
|
|
||||||
dropdownValues.style.visibility = "visible";
|
|
||||||
} else {
|
|
||||||
dropdownValues.style.visibility = "hidden";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
document.querySelectorAll(".remove-field").forEach(button => {
|
|
||||||
button.addEventListener("click", function() {
|
|
||||||
console.log("Existing remove button clicked");
|
|
||||||
const container = document.getElementById("clientSpecificFields");
|
|
||||||
container.removeChild(button.closest(".client-field-row"));
|
|
||||||
updateFieldIndices();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function updateFieldIndices() {
|
|
||||||
console.log("Updating field indices");
|
|
||||||
const rows = container.getElementsByClassName("client-field-row");
|
|
||||||
for (let i = 0; i < rows.length; i++) {
|
|
||||||
const inputs = rows[i].querySelectorAll("input, select");
|
|
||||||
inputs.forEach(input => {
|
|
||||||
const name = input.name.replace(/\[\d+\]/, `[${i}]`);
|
|
||||||
input.name = name;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
loadData();
|
||||||
|
|
||||||
|
const routines = <?php echo json_encode($routines); ?>;
|
||||||
|
|
||||||
|
function updateRoutineDetails() {
|
||||||
|
const selectedId = routineSelect.value;
|
||||||
|
routineDetails.style.display = selectedId ? 'block' : 'none';
|
||||||
|
if (selectedId) {
|
||||||
|
const routine = routines.find(r => r.idroutine == selectedId);
|
||||||
|
if (routine) {
|
||||||
|
routineName.textContent = routine.name || 'N/A';
|
||||||
|
routineDescription.textContent = routine.description || 'N/A';
|
||||||
|
routineAction1.textContent = routine.action1 || 'N/A';
|
||||||
|
routineAction2.textContent = routine.action2 || 'N/A';
|
||||||
|
routineAction3.textContent = routine.action3 || 'N/A';
|
||||||
|
} else {
|
||||||
|
routineName.textContent = 'N/A';
|
||||||
|
routineDescription.textContent = 'N/A';
|
||||||
|
routineAction1.textContent = 'N/A';
|
||||||
|
routineAction2.textContent = 'N/A';
|
||||||
|
routineAction3.textContent = 'N/A';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
routineName.textContent = '';
|
||||||
|
routineDescription.textContent = '';
|
||||||
|
routineAction1.textContent = '';
|
||||||
|
routineAction2.textContent = '';
|
||||||
|
routineAction3.textContent = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
routineSelect.addEventListener('change', updateRoutineDetails);
|
||||||
|
updateRoutineDetails();
|
||||||
|
|
||||||
form.addEventListener("submit", function(e) {
|
form.addEventListener("submit", function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
console.log("Form submitted");
|
|
||||||
|
|
||||||
let formData = new FormData(this);
|
let formData = new FormData(this);
|
||||||
|
|
||||||
// Aggiungi il nome del cliente selezionato a FormData
|
|
||||||
const clientSelect = document.getElementById("clientSelect");
|
const clientSelect = document.getElementById("clientSelect");
|
||||||
const clientId = clientSelect.value;
|
const clientId = clientSelect.value;
|
||||||
const selectedClientOption = clientSelect.options[clientSelect.selectedIndex];
|
const selectedClientOption = clientSelect.options[clientSelect.selectedIndex];
|
||||||
|
|
||||||
|
if (!clientId) {
|
||||||
|
Swal.fire({
|
||||||
|
title: "Errore!",
|
||||||
|
text: "Per favore seleziona un cliente.",
|
||||||
|
icon: "error",
|
||||||
|
confirmButtonText: "OK"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let clientName = "";
|
let clientName = "";
|
||||||
if (selectedClientOption) {
|
if (selectedClientOption) {
|
||||||
const optionText = selectedClientOption.text.trim();
|
const optionText = selectedClientOption.text.trim();
|
||||||
@@ -482,18 +330,11 @@
|
|||||||
}
|
}
|
||||||
formData.append("client_name", clientName);
|
formData.append("client_name", clientName);
|
||||||
|
|
||||||
// Aggiungi l'ID e il nome dello schema selezionato a FormData
|
|
||||||
const schemaSelect = document.getElementById("schemaSelect");
|
const schemaSelect = document.getElementById("schemaSelect");
|
||||||
const schemaId = schemaSelect.value;
|
const schemaId = schemaSelect.value;
|
||||||
const selectedSchemaOption = schemaSelect.options[schemaSelect.selectedIndex];
|
const selectedSchemaOption = schemaSelect.options[schemaSelect.selectedIndex];
|
||||||
let schemaName = "";
|
|
||||||
if (selectedSchemaOption && schemaId) {
|
if (!schemaId) {
|
||||||
const optionText = selectedSchemaOption.text.trim();
|
|
||||||
const nameMatch = optionText.match(/^(.+?)(?:\s*\(ID:\s*\d+\))?$/);
|
|
||||||
schemaName = nameMatch ? nameMatch[1].trim() : optionText;
|
|
||||||
formData.append("idschema", schemaId);
|
|
||||||
formData.append("schemamaname", schemaName);
|
|
||||||
} else {
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Errore!",
|
title: "Errore!",
|
||||||
text: "Per favore seleziona uno schema.",
|
text: "Per favore seleziona uno schema.",
|
||||||
@@ -503,48 +344,17 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log per debug
|
let schemaName = "";
|
||||||
console.log("Client ID:", clientId);
|
if (selectedSchemaOption) {
|
||||||
console.log("Client Name:", clientName);
|
const optionText = selectedSchemaOption.text.trim();
|
||||||
console.log("Schema ID:", schemaId);
|
const nameMatch = optionText.match(/^(.+?)(?:\s*\(ID:\s*\d+\))?$/);
|
||||||
console.log("Schema Name:", schemaName);
|
schemaName = nameMatch ? nameMatch[1].trim() : optionText;
|
||||||
|
|
||||||
// Genera il JSON per client_specific_fields
|
|
||||||
let finalSpecificFields = {};
|
|
||||||
const fieldRows = container.getElementsByClassName("client-field-row");
|
|
||||||
for (let i = 0; i < fieldRows.length; i++) {
|
|
||||||
const row = fieldRows[i];
|
|
||||||
const inputs = row.querySelectorAll("input, select");
|
|
||||||
let fieldData = {};
|
|
||||||
|
|
||||||
inputs.forEach(input => {
|
|
||||||
const nameMatch = input.name.match(/specific_fields\[\d+\]\[(.*?)\]/);
|
|
||||||
if (nameMatch) {
|
|
||||||
const fieldName = nameMatch[1];
|
|
||||||
fieldData[fieldName] = input.value.trim();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (fieldData.name) {
|
|
||||||
finalSpecificFields[fieldData.name] = {
|
|
||||||
type: fieldData.type || "text",
|
|
||||||
possible_values: (fieldData.possible_values && fieldData.type === "dropdown") ? fieldData.possible_values.split(",").map(v => v.trim()) : [],
|
|
||||||
is_required: fieldData.required === "1",
|
|
||||||
export_column_name: fieldData.export_column_name || "",
|
|
||||||
default_value: fieldData.default_value || ""
|
|
||||||
};
|
|
||||||
console.log(`Field ${fieldData.name}:`, finalSpecificFields[fieldData.name]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
formData.append("idschema", schemaId);
|
||||||
|
formData.append("schemaname", schemaName);
|
||||||
|
|
||||||
console.log("Generated JSON for client_specific_fields:", JSON.stringify(finalSpecificFields));
|
const routineId = routineSelect.value;
|
||||||
formData.append("client_specific_fields", JSON.stringify(finalSpecificFields));
|
formData.append("idroutine", routineId);
|
||||||
|
|
||||||
// Debug del FormData
|
|
||||||
console.log("FormData contents:");
|
|
||||||
for (let pair of formData.entries()) {
|
|
||||||
console.log(pair[0] + ': ' + pair[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch("process_insert_template_xls.php", {
|
fetch("process_insert_template_xls.php", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -552,7 +362,6 @@
|
|||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("Fetch response:", data);
|
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Successo!",
|
title: "Successo!",
|
||||||
@@ -572,7 +381,6 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error("Errore Fetch:", error);
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Errore!",
|
title: "Errore!",
|
||||||
text: "Si è verificato un errore imprevisto.",
|
text: "Si è verificato un errore imprevisto.",
|
||||||
|
|||||||
@@ -1,90 +0,0 @@
|
|||||||
https://93.43.5.102/limsapi/api/odata/Cliente(34)?expand=SchemiAbilitati
|
|
||||||
https://93.43.5.102/limsapi/api/odata/Cliente(55)?expand=SchemiAbilitati
|
|
||||||
https://93.43.5.102/limsapi/api/odata/Cliente(4202)?expand=SchemiAbilitati
|
|
||||||
https://93.43.5.102/limsapi/api/odata/Cliente(4202)?expand=SchemiAbilitati
|
|
||||||
https://93.43.5.102/limsapi/api/odata/Cliente(4202)?%24expand=SchemiAbilitati
|
|
||||||
https://93.43.5.102/limsapi/api/odata/Cliente(4202)?%24expand=SchemiAbilitati
|
|
||||||
https://93.43.5.102/limsapi/api/odata/Rapporto(2523026)?%24expand=CampioniDatiRapporto%2CAnalisiDatiRapporto%2CCustomFieldsDatiRapporto
|
|
||||||
https://93.43.5.102/limsapi/api/odata/Cliente(4202)?%24expand=SchemiAbilitati
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
https://93.43.5.102/limsapi/api/odata/SchemaCustomField
|
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
include('include/headscript.php');
|
||||||
|
|
||||||
|
// Parametri dalla richiesta AJAX
|
||||||
|
$template_id = intval($_GET['template_id'] ?? 0);
|
||||||
|
$status = $_GET['status'] ?? 'i';
|
||||||
|
$offset = intval($_GET['offset'] ?? 0);
|
||||||
|
$limit = intval($_GET['limit'] ?? 20);
|
||||||
|
|
||||||
|
if (!$template_id || !in_array($status, ['i', 'P', 'l'])) {
|
||||||
|
error_log("Errore in load_more_rows.php: Parametri non validi - template_id: $template_id, status: $status");
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Parametri non validi']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connessione al database
|
||||||
|
$db = DBHandlerSelect::getInstance();
|
||||||
|
$pdo = $db->getConnection();
|
||||||
|
|
||||||
|
// Recupera i dati
|
||||||
|
try {
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
|
SELECT d.*, CONCAT(u.first_name, ' ', u.last_name) AS user_name
|
||||||
|
FROM datadb d
|
||||||
|
LEFT JOIN auth_users u ON d.user_id = u.id
|
||||||
|
WHERE d.templateid = ? AND d.status = ?
|
||||||
|
LIMIT ? OFFSET ?
|
||||||
|
");
|
||||||
|
$stmt->execute([$template_id, $status, $limit, $offset]);
|
||||||
|
$importedData = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
// Recupera i dettagli manuali
|
||||||
|
$insertedIds = array_column($importedData, 'iddatadb');
|
||||||
|
$manualDetails = [];
|
||||||
|
if (!empty($insertedIds)) {
|
||||||
|
$placeholders = implode(',', array_fill(0, count($insertedIds), '?'));
|
||||||
|
$stmt = $pdo->prepare("
|
||||||
|
SELECT d.id AS detail_id, d.id AS datadb_id, d.mapping_id, d.field_value, m.field_label, m.data_type, m.is_required, m.manual_default
|
||||||
|
FROM import_data_details d
|
||||||
|
JOIN template_mapping m ON d.mapping_id = m.id
|
||||||
|
WHERE d.id IN ($placeholders)
|
||||||
|
");
|
||||||
|
$stmt->execute($insertedIds);
|
||||||
|
$manualDetails = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepara i dati per il JSON
|
||||||
|
$rows = [];
|
||||||
|
foreach ($importedData as $row) {
|
||||||
|
$rowData = [
|
||||||
|
'iddatadb' => $row['iddatadb'] ?? '',
|
||||||
|
'importreferencecode' => $row['importreferencecode'] ?? '',
|
||||||
|
'filename_import' => $row['filename_import'] ?? '',
|
||||||
|
'status' => $row['status'] ?? '',
|
||||||
|
'importdate' => $row['importdate'] ?? '',
|
||||||
|
'details' => array_filter($manualDetails, fn($d) => $d['datadb_id'] == $row['iddatadb'])
|
||||||
|
];
|
||||||
|
$rows[] = $rowData;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_log("load_more_rows.php: Caricate " . count($rows) . " righe per template_id=$template_id, status=$status, offset=$offset");
|
||||||
|
echo json_encode(['success' => true, 'rows' => $rows]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
error_log("Errore in load_more_rows.php: " . $e->getMessage());
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Errore nel caricamento: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
include('include/headscript.php');
|
||||||
|
|
||||||
|
$dbHandler = DBHandlerSelect::getInstance();
|
||||||
|
$pdo = $dbHandler->getConnection();
|
||||||
|
|
||||||
|
$idquotations = $_GET['idquotations'] ?? null;
|
||||||
|
|
||||||
|
if (!$idquotations) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'ID quotations mancante']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$stmt = $pdo->prepare("SELECT id, idquotations, part_number, part_description FROM identification_parts WHERE idquotations = :idquotations ORDER BY part_number ASC");
|
||||||
|
$stmt->execute([':idquotations' => $idquotations]);
|
||||||
|
$parts = $stmt->fetchAll();
|
||||||
|
|
||||||
|
echo json_encode(['success' => true, 'parts' => $parts]);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Errore nel caricamento: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
@@ -14,13 +14,18 @@ if (!$iddatadb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$stmt = $pdo->prepare("SELECT file_path FROM datadb_photos WHERE iddatadb = :iddatadb LIMIT 1");
|
// Adjust the query to select all photo paths for the given iddatadb
|
||||||
|
$stmt = $pdo->prepare("SELECT file_path FROM datadb_photos WHERE iddatadb = :iddatadb");
|
||||||
$stmt->execute([':iddatadb' => $iddatadb]);
|
$stmt->execute([':iddatadb' => $iddatadb]);
|
||||||
$photo = $stmt->fetch(PDO::FETCH_ASSOC);
|
$photos = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
if ($photo && $photo['file_path']) {
|
if ($photos && count($photos) > 0) {
|
||||||
$fullPath = '../photostrf/' . $photo['file_path']; // Assumi che le foto siano nella cartella photostrf
|
// Prepare an array of full file paths
|
||||||
echo json_encode(['success' => true, 'file_path' => $fullPath]);
|
$photoPaths = array_map(function($photo) {
|
||||||
|
return '../photostrf/' . $photo['file_path']; // Assuming the photos are stored in the "photostrf" folder
|
||||||
|
}, $photos);
|
||||||
|
|
||||||
|
echo json_encode(['success' => true, 'photos' => $photoPaths]); // Return an array of photo paths
|
||||||
} else {
|
} else {
|
||||||
echo json_encode(['success' => false, 'message' => 'Nessuna foto trovata']);
|
echo json_encode(['success' => false, 'message' => 'Nessuna foto trovata']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
// load_photo_quotation.php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
include('include/headscript.php');
|
||||||
|
|
||||||
|
$dbHandler = DBHandlerSelect::getInstance();
|
||||||
|
$pdo = $dbHandler->getConnection();
|
||||||
|
|
||||||
|
$idquotations = isset($_GET['idquotations']) ? intval($_GET['idquotations']) : null;
|
||||||
|
|
||||||
|
if (!$idquotations) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'ID quotation mancante']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Seleziona le foto per il dato idquotations dalla tabella datadb_photos
|
||||||
|
$stmt = $pdo->prepare("SELECT id, file_path FROM datadb_photos WHERE idquotations = ?");
|
||||||
|
$stmt->execute([$idquotations]);
|
||||||
|
$photos = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($photos && count($photos) > 0) {
|
||||||
|
$photoPaths = array_map(function ($photo) {
|
||||||
|
return '../photostrf/' . $photo['file_path'];
|
||||||
|
}, $photos);
|
||||||
|
echo json_encode(['success' => true, 'photos' => $photoPaths]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Nessuna foto trovata']);
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Errore nel caricamento: ' . $e->getMessage()]);
|
||||||
|
}
|
||||||
@@ -21,7 +21,7 @@ $schemajson = $template['schemajson'] ? json_decode($template['schemajson'], tru
|
|||||||
$isSchemajsonEmpty = empty(trim($template['schemajson']));
|
$isSchemajsonEmpty = empty(trim($template['schemajson']));
|
||||||
|
|
||||||
// Recupera i campi dalla tabella template_mapping
|
// Recupera i campi dalla tabella template_mapping
|
||||||
$stmt = $pdo->prepare("SELECT id, field_id, excel_column, is_manual, manual_default, data_type, is_required, default_value, has_list, length, decimals, min_value, max_value, default_curr_date, tablename, field_label, main_field FROM template_mapping WHERE template_id = ?");
|
$stmt = $pdo->prepare("SELECT id, field_id, excel_column, is_manual, manual_default, data_type, is_required, default_value, has_list, length, decimals, min_value, max_value, default_curr_date, tablename, field_label, main_field, is_visible_import FROM template_mapping WHERE template_id = ?");
|
||||||
$stmt->execute([$id]);
|
$stmt->execute([$id]);
|
||||||
$mappings = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$mappings = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
@@ -83,8 +83,10 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
|||||||
}
|
}
|
||||||
|
|
||||||
#schemaFieldsTable th:first-child,
|
#schemaFieldsTable th:first-child,
|
||||||
#schemaFieldsTable td:first-child {
|
#schemaFieldsTable td:first-child,
|
||||||
width: 50px;
|
#schemaFieldsTable th:nth-child(2),
|
||||||
|
#schemaFieldsTable td:nth-child(2) {
|
||||||
|
width: 100px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -137,8 +139,8 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Main</th>
|
<th>Main</th>
|
||||||
|
<th>Visible on Import</th>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>ID</th>
|
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
<th>Mapping</th>
|
<th>Mapping</th>
|
||||||
<th>Default Value</th>
|
<th>Default Value</th>
|
||||||
@@ -150,8 +152,15 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
|||||||
<td>
|
<td>
|
||||||
<input type="checkbox" class="main-field-checkbox" data-mapping-id="<?php echo $mapping['id']; ?>" <?php echo $mapping['main_field'] == 1 ? 'checked' : ''; ?>>
|
<input type="checkbox" class="main-field-checkbox" data-mapping-id="<?php echo $mapping['id']; ?>" <?php echo $mapping['main_field'] == 1 ? 'checked' : ''; ?>>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo htmlspecialchars($mapping['field_label'] ?? 'N/A'); ?></td>
|
<td>
|
||||||
<td><?php echo htmlspecialchars($mapping['field_id'] ?? 'N/A'); ?></td>
|
<input type="checkbox" class="visible-import-checkbox" data-mapping-id="<?php echo $mapping['id']; ?>" <?php echo (isset($mapping['is_visible_import']) ? $mapping['is_visible_import'] : 1) == 1 ? 'checked' : ''; ?>>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php echo htmlspecialchars($mapping['field_label'] ?? 'N/A'); ?>
|
||||||
|
<?php if ($mapping['is_required'] == 1): ?>
|
||||||
|
<span class="badge bg-danger ms-2">Required</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
<td><?php echo htmlspecialchars($mapping['data_type'] ?? 'N/A'); ?></td>
|
<td><?php echo htmlspecialchars($mapping['data_type'] ?? 'N/A'); ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
@@ -320,48 +329,83 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
|||||||
|
|
||||||
async function populateDropdowns() {
|
async function populateDropdowns() {
|
||||||
const dropdowns = document.querySelectorAll('.dropdown-select');
|
const dropdowns = document.querySelectorAll('.dropdown-select');
|
||||||
if (dropdowns.length === 0) return;
|
if (dropdowns.length === 0) {
|
||||||
|
console.warn('Nessun dropdown di tipo SceltaMultipla trovato.');
|
||||||
const dropdownData = {};
|
return;
|
||||||
|
|
||||||
// Recupera i dati solo per i field_id univoci
|
|
||||||
const uniqueFieldIds = [...new Set(Array.from(dropdowns).map(d => d.getAttribute('data-field-id')))].filter(fieldId => fieldId);
|
|
||||||
for (const fieldId of uniqueFieldIds) {
|
|
||||||
if (!dropdownData[fieldId]) {
|
|
||||||
try {
|
|
||||||
const response = await fetch(`get_customfield_values.php?field_id=${fieldId}`);
|
|
||||||
const data = await response.json();
|
|
||||||
if (data.error) {
|
|
||||||
console.error('Errore per field_id', fieldId, ':', data.error);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
dropdownData[fieldId] = data.CustomFieldsValues || [];
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Errore nel fetch per field_id', fieldId, ':', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Popola tutti i dropdown con i dati recuperati
|
console.log(`Trovati ${dropdowns.length} dropdown da popolare.`);
|
||||||
dropdowns.forEach(dropdown => {
|
|
||||||
const fieldId = dropdown.getAttribute('data-field-id');
|
|
||||||
const manualDefault = dropdown.getAttribute('data-manual-default') || '';
|
|
||||||
if (!fieldId || !dropdownData[fieldId]) {
|
|
||||||
dropdown.innerHTML = '<option value="">Errore nel caricamento</option>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dropdown.innerHTML = '<option value="">Seleziona...</option>';
|
const uniqueFieldIds = [...new Set(Array.from(dropdowns).map(d => d.getAttribute('data-field-id')))].filter(fieldId => fieldId);
|
||||||
dropdownData[fieldId].forEach(value => {
|
|
||||||
const option = document.createElement('option');
|
if (uniqueFieldIds.length === 0) {
|
||||||
option.value = value.IdCustomFieldsValue;
|
console.warn('Nessun field_id valido trovato per i dropdown.');
|
||||||
option.textContent = value.Valore;
|
dropdowns.forEach(dropdown => {
|
||||||
if (manualDefault === String(value.IdCustomFieldsValue)) {
|
dropdown.innerHTML = '<option value="">Nessun field_id valido</option>';
|
||||||
option.selected = true;
|
dropdown.disabled = true;
|
||||||
}
|
|
||||||
dropdown.appendChild(option);
|
|
||||||
});
|
});
|
||||||
});
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Field IDs univoci:', uniqueFieldIds);
|
||||||
|
|
||||||
|
// Mostra l'overlay di caricamento
|
||||||
|
const loadingOverlay = document.getElementById('loading-overlay');
|
||||||
|
loadingOverlay.style.display = 'flex';
|
||||||
|
|
||||||
|
let dropdownData = {};
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Usa field_ids come previsto dal backend
|
||||||
|
const fieldIdsQuery = uniqueFieldIds.join(',');
|
||||||
|
console.log(`Recupero dati per field_ids: ${fieldIdsQuery}`);
|
||||||
|
const response = await fetch(`get_customfield_values.php?field_ids=${fieldIdsQuery}`);
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`Errore HTTP: ${response.status} ${response.statusText}`);
|
||||||
|
}
|
||||||
|
const data = await response.json();
|
||||||
|
if (data.error) {
|
||||||
|
throw new Error(`Errore API: ${data.error}`);
|
||||||
|
}
|
||||||
|
dropdownData = data; // data è un oggetto come { "146": [], "156": [...] }
|
||||||
|
console.log('Dati totali restituiti:', dropdownData);
|
||||||
|
|
||||||
|
// Popola i dropdown
|
||||||
|
dropdowns.forEach(dropdown => {
|
||||||
|
const fieldId = dropdown.getAttribute('data-field-id');
|
||||||
|
const manualDefault = dropdown.getAttribute('data-manual-default') || '';
|
||||||
|
console.log(`Popolamento dropdown per field_id: ${fieldId}, manual_default: ${manualDefault}`);
|
||||||
|
|
||||||
|
dropdown.innerHTML = '<option value="">Seleziona...</option>';
|
||||||
|
|
||||||
|
if (!fieldId || !dropdownData[fieldId] || dropdownData[fieldId].length === 0) {
|
||||||
|
console.warn(`Nessun dato disponibile per field_id ${fieldId}`);
|
||||||
|
dropdown.innerHTML = `<option value="">Nessun valore (field_id ${fieldId} vuoto)</option>`;
|
||||||
|
dropdown.disabled = true; // Disabilita per evitare selezioni inutili
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dropdownData[fieldId].forEach(value => {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = value.IdCustomFieldsValue;
|
||||||
|
option.textContent = value.Valore;
|
||||||
|
if (manualDefault && String(value.IdCustomFieldsValue) === String(manualDefault)) {
|
||||||
|
option.selected = true;
|
||||||
|
}
|
||||||
|
dropdown.appendChild(option);
|
||||||
|
});
|
||||||
|
dropdown.disabled = false;
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Errore generale nel caricamento dei dropdown:', error);
|
||||||
|
dropdowns.forEach(dropdown => {
|
||||||
|
dropdown.innerHTML = '<option value="">Errore nel caricamento</option>';
|
||||||
|
dropdown.disabled = true;
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
console.log('Nascondo overlay di caricamento.');
|
||||||
|
loadingOverlay.style.display = 'none';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carica i dropdown con overlay
|
// Carica i dropdown con overlay
|
||||||
@@ -393,7 +437,7 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
|||||||
|
|
||||||
async function updateSchemaDetails() {
|
async function updateSchemaDetails() {
|
||||||
if (!schemaId) {
|
if (!schemaId) {
|
||||||
document.getElementById('schemaFieldsBody').innerHTML = '<tr><td colspan="6" class="text-warning">No schema associated.</td></tr>'; // Aggiornato colspan a 6
|
document.getElementById('schemaFieldsBody').innerHTML = '<tr><td colspan="6" class="text-warning">No schema associated.</td></tr>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,7 +454,7 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
|||||||
await saveSchemaJson(templateId, JSON.stringify(data));
|
await saveSchemaJson(templateId, JSON.stringify(data));
|
||||||
alert('Schema updated successfully. Refresh the page to see changes.');
|
alert('Schema updated successfully. Refresh the page to see changes.');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
document.getElementById('schemaFieldsBody').innerHTML = '<tr><td colspan="6" class="text-danger">Error: ' + error.message + '</td></tr>'; // Aggiornato colspan a 6
|
document.getElementById('schemaFieldsBody').innerHTML = '<tr><td colspan="6" class="text-danger">Error: ' + error.message + '</td></tr>';
|
||||||
} finally {
|
} finally {
|
||||||
updateSchemaButton.disabled = false;
|
updateSchemaButton.disabled = false;
|
||||||
updateSchemaButton.textContent = 'Update Schema Details';
|
updateSchemaButton.textContent = 'Update Schema Details';
|
||||||
@@ -489,16 +533,11 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
|||||||
.then(data => {
|
.then(data => {
|
||||||
if (!data.success) {
|
if (!data.success) {
|
||||||
console.error("❌ Error updating main_field:", data.message);
|
console.error("❌ Error updating main_field:", data.message);
|
||||||
// Revert checkbox state on error
|
|
||||||
checkbox.checked = !checkbox.checked;
|
checkbox.checked = !checkbox.checked;
|
||||||
// Riselezione visiva degli altri se errore
|
document.querySelectorAll('.main-field-checkbox').forEach(cb => {
|
||||||
if (value === 1) {
|
cb.checked = cb.dataset.originalChecked === 'true';
|
||||||
document.querySelectorAll('.main-field-checkbox').forEach(cb => {
|
});
|
||||||
cb.checked = cb.dataset.originalChecked === 'true';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Aggiorna lo stato originale dopo successo
|
|
||||||
document.querySelectorAll('.main-field-checkbox').forEach(cb => {
|
document.querySelectorAll('.main-field-checkbox').forEach(cb => {
|
||||||
cb.dataset.originalChecked = cb.checked;
|
cb.dataset.originalChecked = cb.checked;
|
||||||
});
|
});
|
||||||
@@ -507,12 +546,36 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
|||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error("❌ Fetch error:", error);
|
console.error("❌ Fetch error:", error);
|
||||||
checkbox.checked = !checkbox.checked;
|
checkbox.checked = !checkbox.checked;
|
||||||
// Riselezione visiva degli altri se errore
|
document.querySelectorAll('.main-field-checkbox').forEach(cb => {
|
||||||
if (value === 1) {
|
cb.checked = cb.dataset.originalChecked === 'true';
|
||||||
document.querySelectorAll('.main-field-checkbox').forEach(cb => {
|
});
|
||||||
cb.checked = cb.dataset.originalChecked === 'true';
|
});
|
||||||
});
|
} else if (event.target.classList.contains('visible-import-checkbox')) {
|
||||||
|
const checkbox = event.target;
|
||||||
|
const mappingId = checkbox.dataset.mappingId;
|
||||||
|
const value = checkbox.checked ? 1 : 0;
|
||||||
|
|
||||||
|
fetch('update_visible_import.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
template_id: <?php echo $id; ?>,
|
||||||
|
mapping_id: mappingId,
|
||||||
|
value: value
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (!data.success) {
|
||||||
|
console.error("❌ Error updating is_visible_import:", data.message);
|
||||||
|
checkbox.checked = !checkbox.checked;
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error("❌ Fetch error:", error);
|
||||||
|
checkbox.checked = !checkbox.checked;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -534,7 +597,7 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
|||||||
mappedColumn = document.createElement('span');
|
mappedColumn = document.createElement('span');
|
||||||
mappedColumn.className = 'mapped-column';
|
mappedColumn.className = 'mapped-column';
|
||||||
mappedColumn.style.marginLeft = '5px';
|
mappedColumn.style.marginLeft = '5px';
|
||||||
tr.querySelector('td:nth-child(5)').appendChild(mappedColumn); // Aggiornato a nth-child(5) per la nuova colonna
|
tr.querySelector('td:nth-child(5)').appendChild(mappedColumn);
|
||||||
}
|
}
|
||||||
if (!removeBtn) {
|
if (!removeBtn) {
|
||||||
removeBtn = document.createElement('button');
|
removeBtn = document.createElement('button');
|
||||||
@@ -542,7 +605,7 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
|||||||
removeBtn.textContent = 'X';
|
removeBtn.textContent = 'X';
|
||||||
removeBtn.style.marginLeft = '5px';
|
removeBtn.style.marginLeft = '5px';
|
||||||
removeBtn.setAttribute('data-id', mappingId);
|
removeBtn.setAttribute('data-id', mappingId);
|
||||||
tr.querySelector('td:nth-child(5)').appendChild(removeBtn); // Aggiornato a nth-child(5)
|
tr.querySelector('td:nth-child(5)').appendChild(removeBtn);
|
||||||
|
|
||||||
removeBtn.addEventListener('click', function(e) {
|
removeBtn.addEventListener('click', function(e) {
|
||||||
let tr = e.target.closest('tr');
|
let tr = e.target.closest('tr');
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<!-- Modal -->
|
<!-- Modal modificato con pulsante per riconoscimento vocale e download -->
|
||||||
<div class="modal fade" id="partsModal" tabindex="-1" aria-labelledby="partsModalLabel" aria-hidden="true">
|
<div class="modal fade" id="partsModal" tabindex="-1" aria-labelledby="partsModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog modal-xl" style="max-width: 80% !important; width: 80% !important;">
|
<div class="modal-dialog modal-xl" style="max-width: 80% !important; width: 80% !important;">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@@ -9,7 +9,15 @@
|
|||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h6>Elenco Parti</h6>
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;">
|
||||||
|
<h6 style="margin: 0; white-space: nowrap;">Elenco Parti</h6>
|
||||||
|
<div style="display: flex; align-items: center;">
|
||||||
|
<input type="checkbox" id="showMixParts" name="showMixParts" style="margin-right: 5px;">
|
||||||
|
<label for="showMixParts" style="font-size: 0.9rem; margin-right: 10px;">Mix</label>
|
||||||
|
<button type="button" class="btn btn-info btn-sm" id="renumberPartsBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Rinumera Parti</button>
|
||||||
|
<button type="button" class="btn btn-secondary btn-sm ms-2" id="toggleVoiceBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;"><i class="fas fa-microphone"></i> Voce</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<ul id="partsList" class="list-group"></ul>
|
<ul id="partsList" class="list-group"></ul>
|
||||||
<table class="table table-striped table-sm mt-3" id="partsTable">
|
<table class="table table-striped table-sm mt-3" id="partsTable">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -36,10 +44,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h6>Foto del Campione</h6>
|
<h6>Foto del Campione</h6>
|
||||||
|
<div style="display: flex; align-items: center; margin-bottom: 10px;">
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" id="downloadPhotoBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem; margin-right: 10px;"><i class="fas fa-download"></i> </button>
|
||||||
|
<div id="photoSelectorContainer" style="display: none;"></div>
|
||||||
|
</div>
|
||||||
<div style="position: relative; width: 100%; min-height: 400px;">
|
<div style="position: relative; width: 100%; min-height: 400px;">
|
||||||
<img id="samplePhoto" src="" alt="Foto del campione" style="max-width: 100%; max-height: 100%; object-fit: contain; position: absolute; top: 0; left: 0;">
|
<img id="samplePhoto" src="" alt="Foto del campione" style="max-width: 100%; max-height: 100%; object-fit: contain; position: absolute; top: 0; left: 0;">
|
||||||
<canvas id="photoCanvas" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></canvas>
|
<canvas id="photoCanvas" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></canvas>
|
||||||
<div id="descriptionList" class="draggable-description" style="display: none;"></div>
|
<canvas id="overlayCanvas" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000;"></canvas> <!-- Nuovo canvas per Fabric.js -->
|
||||||
<div id="markerContainer"></div>
|
<div id="markerContainer"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -47,7 +59,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-primary btn-sm" id="addDescriptionsBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Aggiungi Lista Descrizioni</button>
|
<button type="button" class="btn btn-primary btn-sm" id="addDescriptionsBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Aggiungi Lista Descrizioni</button>
|
||||||
<button type="button" class="btn btn-danger btn-sm" id="removeAnnotationsBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Rimuovi Annotazioni</button>
|
<button type="button" class="btn btn-danger btn-sm" id="removeAnnotationsBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Rimuovi Descrizioni</button>
|
||||||
|
<button type="button" class="btn btn-warning btn-sm" id="undoMarkerBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Undo Marker</button>
|
||||||
<button type="button" class="btn btn-success btn-sm" id="savePhotoBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Salva Foto con Nome</button>
|
<button type="button" class="btn btn-success btn-sm" id="savePhotoBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Salva Foto con Nome</button>
|
||||||
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Chiudi</button>
|
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Chiudi</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -85,6 +98,14 @@
|
|||||||
font-size: 0.6rem !important;
|
font-size: 0.6rem !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#partsModal {
|
||||||
|
z-index: 1060 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#partsModal .modal-backdrop {
|
||||||
|
z-index: 1055 !important;
|
||||||
|
}
|
||||||
|
|
||||||
#partsModal .modal-content {
|
#partsModal .modal-content {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
max-width: 100% !important;
|
max-width: 100% !important;
|
||||||
@@ -96,30 +117,58 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
padding: 5px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#partsList .list-group-item:hover {
|
#partsList .list-group-item:hover {
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#partsList input[type="color"] {
|
||||||
|
width: 30px;
|
||||||
|
height: 24px;
|
||||||
|
padding: 0;
|
||||||
|
margin-left: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.draggable-description {
|
.draggable-description {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background: rgba(255, 255, 255, 0.8);
|
background: rgba(255, 255, 255, 0.8);
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-size: 10px;
|
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
cursor: move;
|
cursor: move;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
|
min-width: 100px;
|
||||||
|
min-height: 50px;
|
||||||
|
overflow: visible;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.draggable-description.active-interaction {
|
||||||
|
border: 2px dashed #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.draggable-description div {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.resize-handle {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
background: #888;
|
||||||
|
cursor: se-resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
.draggable-marker {
|
.draggable-marker {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
background: rgba(255, 0, 0, 0.5);
|
|
||||||
border: 1px solid #ff0000;
|
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -142,4 +191,62 @@
|
|||||||
padding: 0.1rem 0.3rem;
|
padding: 0.1rem 0.3rem;
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#savePhotoBtn {
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
#savePhotoBtn.unsaved {
|
||||||
|
background-color: #dc3545 !important;
|
||||||
|
border-color: #dc3545 !important;
|
||||||
|
color: white !important;
|
||||||
|
animation: pulse 1.2s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulse {
|
||||||
|
0% {
|
||||||
|
box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
70% {
|
||||||
|
box-shadow: 0 0 10px 15px rgba(220, 53, 69, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-container {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 25px;
|
||||||
|
left: 0;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 5px;
|
||||||
|
z-index: 1002;
|
||||||
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
||||||
|
flex-wrap: wrap;
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-option {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
margin: 3px;
|
||||||
|
border: 1px solid #000;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-option:hover {
|
||||||
|
border: 2px solid #000;
|
||||||
|
margin: 2px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||