Reworked Contract View to Vue.js
This commit is contained in:
@@ -44,7 +44,7 @@ class Helper {
|
||||
/**
|
||||
* Validates an array of data based on a set of predefined rules.
|
||||
*
|
||||
* @param array $data The data to validate. Keys represent field names, and values are the corresponding data.
|
||||
* @param array $data The data to validate. Keys represent field names, and values are the corresponding data.
|
||||
* @param array $checkArray An associative array defining validation rules for each field:
|
||||
* - key: The field name to validate.
|
||||
* - value: An associative array of validation rules for that field:
|
||||
@@ -70,11 +70,9 @@ class Helper {
|
||||
|
||||
// Apply default values for missing rules
|
||||
|
||||
$rules = array_merge([
|
||||
'required' => false,
|
||||
'required_length' => 1,
|
||||
'regex' => false,
|
||||
], $rules);
|
||||
$rules = array_merge(['required' => false,
|
||||
'required_length' => 1,
|
||||
'regex' => false,], $rules);
|
||||
|
||||
// Required Check
|
||||
if ($rules['required'] && (is_null($value) || $value === '')) {
|
||||
@@ -95,12 +93,8 @@ class Helper {
|
||||
if ($printErrors) {
|
||||
if (!empty($errors)) {
|
||||
header('Content-Type: application/json');
|
||||
die(json_encode(
|
||||
[
|
||||
'success' => false,
|
||||
'errors' => $errors
|
||||
]
|
||||
));
|
||||
die(json_encode(['success' => false,
|
||||
'errors' => $errors]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,11 +116,8 @@ class Helper {
|
||||
"MF_APP_NAME" => MFAPPNAME_SLUG,
|
||||
"BASE_PATH" => $controller::getUrl(""),
|
||||
"PAGE_TITLE" => $headerTitle,
|
||||
"PATH" => [
|
||||
["text" => MFAPPNAME_SLUG, "href" => $controller::getUrl("Dashboard")],
|
||||
["text" => $headerTitle, "href" => $controller::getUrl($pageName)]
|
||||
],
|
||||
];
|
||||
"PATH" => [["text" => MFAPPNAME_SLUG, "href" => $controller::getUrl("Dashboard")],
|
||||
["text" => $headerTitle, "href" => $controller::getUrl($pageName)]],];
|
||||
|
||||
$JSGlobals = array_merge($JSGlobals, $additionalGlobals);
|
||||
|
||||
@@ -157,4 +148,17 @@ class Helper {
|
||||
|
||||
return $csv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a number with the given number of decimals, decimal point, and thousands separator.
|
||||
* @param $number
|
||||
* @param int $decimals
|
||||
* @param string $decPoint
|
||||
* @param string $thousandsSep
|
||||
* @return float
|
||||
*/
|
||||
public static function formatNumber($number, int $decimals = 2, string $decPoint = ",", string $thousandsSep = "."): string {
|
||||
return number_format(intval($number), $decimals, $decPoint, $thousandsSep);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user