Add Feature Printer Barcode - Single & All Sample Print
This commit is contained in:
parent
3d36283095
commit
8ee919d733
@ -80,4 +80,5 @@ $routes->group('fo', ['filter' => 'role:fo'], static function ($routes) {
|
||||
});
|
||||
|
||||
// Printers
|
||||
$routes->get('/prints/single_sample/(:any)/(:any)', 'PrinterController::printSingleSampleBarcode/$1/$2');
|
||||
$routes->get('/prints/single_sample/(:any)/(:any)', 'PrinterController::printSingleSampleBarcode/$1/$2');
|
||||
$routes->get('/prints/all_sample', 'PrinterController::printAllSampleBarcode');
|
||||
@ -22,7 +22,7 @@ class PrinterController extends BaseController {
|
||||
$logTime = date('d-m-Y_H_i_s', $time) . sprintf('_%03d', ($time - floor($time)) * 1000);
|
||||
$filename = "sample_".$logTime;
|
||||
|
||||
// $role = session()->get('userrole');
|
||||
$role = session()->get('userrole');
|
||||
// $role = "admin";
|
||||
$networkPath = "";
|
||||
|
||||
@ -113,17 +113,14 @@ P1
|
||||
'status' => true,
|
||||
]
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function printAllSampleBarcode() {
|
||||
|
||||
$data = 5;
|
||||
$data = 3;
|
||||
|
||||
$role = session()->get('userrole');
|
||||
// $role="sampling";
|
||||
$networkPath = "";
|
||||
|
||||
// Ruang Analis Printer POSTEK
|
||||
|
||||
@ -45,7 +45,7 @@ $name = $row['NAME'];
|
||||
}
|
||||
echo "<td>$sampletext</td>";
|
||||
echo "<td>
|
||||
<button class='badge text-bg-dark'><i class='bi bi-printer' onclick='printSingleLabel($sampletype, $accessnumber)'></i></button>
|
||||
<button class='badge text-bg-dark' onclick='printSingleLabel($sampletype, $accessnumber)'><i class='bi bi-printer'></i></button>
|
||||
<button class='badge text-bg-success' onclick='collect($sampletype, $accessnumber)'>Coll.</button>
|
||||
<button class='badge text-bg-warning' onclick='uncollect($sampletype, $accessnumber)'>Un-Coll.</button>
|
||||
<button class='badge text-bg-primary' onclick='unreceive($sampletype, $accessnumber)'>Un-Rec.</button>
|
||||
@ -61,7 +61,7 @@ $name = $row['NAME'];
|
||||
<tr>
|
||||
<td></td> <td></td> <td>All</td>
|
||||
<td>
|
||||
<button class='badge text-bg-dark'><i class='bi bi-printer'></i></button>
|
||||
<button class='badge text-bg-dark' onclick='printAllLabel()'><i class='bi bi-printer'></i></button>
|
||||
<button class='badge text-bg-success' onclick='collectAll(<?=$accessnumber;?>)'>Coll.</button>
|
||||
<!-- <button class='badge bg-black text-white' onclick='uncollectAll(<?=$accessnumber;?>)'>un-collect</button> -->
|
||||
<button class='badge text-bg-primary' onclick='unreceiveAll(<?=$accessnumber;?>)'>Un-Rec.</button>
|
||||
@ -74,7 +74,6 @@ $name = $row['NAME'];
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
function printSingleLabel(sample, access) {
|
||||
|
||||
const url = '<?=base_url();?>prints/single_sample/'+access.toString()+'/'+sample.toString();
|
||||
@ -96,6 +95,27 @@ function printSingleLabel(sample, access) {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}
|
||||
function printAllLabel() {
|
||||
|
||||
const url = '<?=base_url();?>prints/all_sample';
|
||||
|
||||
fetch(url)
|
||||
.then(response => response.json()) // Mengonversi response menjadi JSON (atau gunakan .text() jika formatnya teks)
|
||||
.then(data => {
|
||||
|
||||
if (data['status']) {
|
||||
console.log(data['message']);
|
||||
} else {
|
||||
console.log(data['message']+"\n"+data['error']);
|
||||
message = data['message']+"\n"+data['error'];
|
||||
alert(message);
|
||||
}
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}
|
||||
|
||||
function collect(sample, access) {
|
||||
sample = sample.toString().padStart(3,'0');
|
||||
|
||||
@ -45,7 +45,7 @@ $name = $row['NAME'];
|
||||
}
|
||||
echo "<td>$sampletext</td>";
|
||||
echo "<td>
|
||||
<button class='badge text-bg-dark'><i class='bi bi-printer'></i></button>
|
||||
<button class='badge text-bg-dark' onclick='printSingleLabel($sampletype, $accessnumber)'><i class='bi bi-printer'></i></button>
|
||||
<button class='badge text-bg-success' onclick='collect($sampletype, $accessnumber)'>Coll.</button>
|
||||
</td> ";
|
||||
echo "<td id='comment$sampletype'>$comment <i class='bi bi-pencil-square' role='button' onclick='comment($sampletype, $accessnumber, \"$sampletext\", \"$comment\")'></i></td>";
|
||||
@ -54,7 +54,7 @@ $name = $row['NAME'];
|
||||
?>
|
||||
<tr>
|
||||
<td></td> <td></td> <td>Collection</td>
|
||||
<td> <button class='badge badge-dark'><i class='bi bi-printer'></i></button> </td>
|
||||
<td> <button class='badge badge-dark' onclick='printAllLabel()'><i class='bi bi-printer'></i></button> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td> <td></td> <td>All</td>
|
||||
@ -70,6 +70,48 @@ $name = $row['NAME'];
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function printSingleLabel(sample, access) {
|
||||
|
||||
const url = '<?=base_url();?>prints/single_sample/'+access.toString()+'/'+sample.toString();
|
||||
|
||||
fetch(url)
|
||||
.then(response => response.json()) // Mengonversi response menjadi JSON (atau gunakan .text() jika formatnya teks)
|
||||
.then(data => {
|
||||
|
||||
if (data['status']) {
|
||||
console.log(data['message']);
|
||||
} else {
|
||||
console.log(data['message']+"\n"+data['error']);
|
||||
message = data['message']+"\n"+data['error'];
|
||||
alert(message);
|
||||
}
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}
|
||||
function printAllLabel() {
|
||||
|
||||
const url = '<?=base_url();?>prints/all_sample';
|
||||
|
||||
fetch(url)
|
||||
.then(response => response.json()) // Mengonversi response menjadi JSON (atau gunakan .text() jika formatnya teks)
|
||||
.then(data => {
|
||||
|
||||
if (data['status']) {
|
||||
console.log(data['message']);
|
||||
} else {
|
||||
console.log(data['message']+"\n"+data['error']);
|
||||
message = data['message']+"\n"+data['error'];
|
||||
alert(message);
|
||||
}
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}
|
||||
function collect(sample, access) {
|
||||
sample = sample.toString().padStart(3,'0');
|
||||
const url = '<?=base_url();?>tubes/collect/'+access+'/'+sample;
|
||||
|
||||
@ -45,7 +45,7 @@ $name = $row['NAME'];
|
||||
}
|
||||
echo "<td>$sampletext</td>";
|
||||
echo "<td>
|
||||
<button class='badge text-bg-dark'><i class='bi bi-printer'></i></button>
|
||||
<button class='badge text-bg-dark' onclick='printSingleLabel($sampletype, $accessnumber)'><i class='bi bi-printer'></i></button>
|
||||
<button class='badge text-bg-success' onclick='collect($sampletype, $accessnumber)'>Coll.</button>
|
||||
<button class='badge text-bg-warning' onclick='uncollect($sampletype, $accessnumber)'>Un-Coll.</button>
|
||||
<button class='badge text-bg-primary' onclick='unreceive($sampletype, $accessnumber)'>Un-Rec.</button>
|
||||
@ -61,7 +61,7 @@ $name = $row['NAME'];
|
||||
<tr>
|
||||
<td></td> <td></td> <td>All</td>
|
||||
<td>
|
||||
<button class='badge text-bg-dark'><i class='bi bi-printer'></i></button>
|
||||
<button class='badge text-bg-dark' onclick='printAllLabel()'><i class='bi bi-printer'></i></button>
|
||||
<button class='badge text-bg-success' onclick='collectAll(<?=$accessnumber;?>)'>Coll.</button>
|
||||
<!-- <button class='badge bg-black text-white' onclick='uncollectAll(<?=$accessnumber;?>)'>un-collect</button> -->
|
||||
<button class='badge text-bg-primary' onclick='unreceiveAll(<?=$accessnumber;?>)'>Un-Rec.</button>
|
||||
@ -74,6 +74,48 @@ $name = $row['NAME'];
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function printSingleLabel(sample, access) {
|
||||
|
||||
const url = '<?=base_url();?>prints/single_sample/'+access.toString()+'/'+sample.toString();
|
||||
|
||||
fetch(url)
|
||||
.then(response => response.json()) // Mengonversi response menjadi JSON (atau gunakan .text() jika formatnya teks)
|
||||
.then(data => {
|
||||
|
||||
if (data['status']) {
|
||||
console.log(data['message']);
|
||||
} else {
|
||||
console.log(data['message']+"\n"+data['error']);
|
||||
message = data['message']+"\n"+data['error'];
|
||||
alert(message);
|
||||
}
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}
|
||||
function printAllLabel() {
|
||||
|
||||
const url = '<?=base_url();?>prints/all_sample';
|
||||
|
||||
fetch(url)
|
||||
.then(response => response.json()) // Mengonversi response menjadi JSON (atau gunakan .text() jika formatnya teks)
|
||||
.then(data => {
|
||||
|
||||
if (data['status']) {
|
||||
console.log(data['message']);
|
||||
} else {
|
||||
console.log(data['message']+"\n"+data['error']);
|
||||
message = data['message']+"\n"+data['error'];
|
||||
alert(message);
|
||||
}
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}
|
||||
function collect(sample, access) {
|
||||
sample = sample.toString().padStart(3,'0');
|
||||
const url = '<?=base_url();?>tubes/collect/'+access+'/'+sample;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user