204 lines
10 KiB
PHP
Executable File
204 lines
10 KiB
PHP
Executable File
<?php
|
|
require_once('fixed/config/go_con.php');
|
|
|
|
$data_old = array();
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en" dir="rtl">
|
|
<?php require_once('fixed/head/go.php'); ?>
|
|
<body class="rtl">
|
|
<style>
|
|
.header-title {
|
|
color: #086367 !important;
|
|
font-weight: bold !important;
|
|
}
|
|
</style>
|
|
<?php require_once('fixed/loader/go.php'); ?>
|
|
<div class="page-wrapper" id="pageWrapper">
|
|
<?php require_once('fixed/header/go.php'); ?>
|
|
<div class="page-body-wrapper">
|
|
<?php require_once('fixed/sidebar/go.php'); ?>
|
|
<div class="page-body">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="card">
|
|
<div class="card-body new-user order-list">
|
|
|
|
<div class="card-body">
|
|
<ul class="nav nav-pills nav-justified" role="tablist">
|
|
|
|
<li class="nav-item waves-effect waves-light">
|
|
<a class="nav-link" id="tap_id_branchs-tab" data-bs-toggle="pill" href="#tap_id_branchs" role="tab" aria-controls="tap_id_branchs" aria-selected="false">الفروع</a>
|
|
</li>
|
|
|
|
<li class="nav-item waves-effect waves-light">
|
|
<a class="nav-link" id="tap_id_emplyee-tab" data-bs-toggle="pill" href="#tap_id_emplyee" role="tab" aria-controls="tap_id_emplyee" aria-selected="false">الفنيين</a>
|
|
</li>
|
|
|
|
<li class="nav-item waves-effect waves-light">
|
|
<a class="nav-link" id="tap_id_servs-tab" data-bs-toggle="pill" href="#tap_id_servs" role="tab" aria-controls="tap_id_servs" aria-selected="false">الخدمات</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
<div id="theService" class="form-group row">
|
|
<div class="tab-content" id="pills-tabContent">
|
|
|
|
<div class="tab-pane fade" id="tap_id_branchs" role="tabpanel" aria-labelledby="tap_id_branchs-tab">
|
|
<div class="form-group row">
|
|
|
|
<?php
|
|
$get_branch_sql = mysqli_query($db, "SELECT
|
|
`branch`.`branch_name` AS `name`,
|
|
`branch`.`id`,
|
|
`branch`.`odoo_id`
|
|
FROM `branch`
|
|
WHERE `branch`.`activation_id` = 2 AND `branch`.`id` > 1
|
|
");
|
|
if (mysqli_num_rows($get_branch_sql) > 0) {
|
|
while ($branch_row = mysqli_fetch_assoc($get_branch_sql)) {
|
|
$data_old['branch'][$branch_row['id']] = $branch_row['odoo_id'];
|
|
?>
|
|
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
|
|
<label for="serv_<?=$branch_row['id']?>" class="col-form-label text-right">اسم الفرع</label>
|
|
<input data-table="branch" data-id="<?=$branch_row['id']?>" id="serv_<?=$branch_row['id']?>" class="form-control" type="text" value="<?=$branch_row['name']?>" disabled>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
|
|
<label for="many_<?=$branch_row['id']?>" class="col-form-label text-right">رمزها في اودو</label>
|
|
<input data-table="branch" data-odoo-id="<?=$branch_row['id']?>" id="many_<?=$services_row['id']?>" name="odoo_id" data-id="<?=$branch_row['id']?>" class="form-control clickfun1" type="number" value="<?=$branch_row['odoo_id']?>" <?php if(empty($branch_row['odoo_id'])) {echo "style='background: #ffcaca;'";} else {echo "style='background: #caffe2;'";}?>>
|
|
</div>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="tab-pane fade" id="tap_id_emplyee" role="tabpanel" aria-labelledby="tap_id_emplyee-tab">
|
|
<div class="form-group row">
|
|
|
|
<?php
|
|
$get_emplyee_sql = mysqli_query($db, "SELECT
|
|
`emplyee`.`name`,
|
|
`emplyee`.`id`,
|
|
`emplyee`.`odoo_id`
|
|
FROM `emplyee`
|
|
WHERE `occupation_id` IN (2,3,4,11)
|
|
");
|
|
if (mysqli_num_rows($get_emplyee_sql) > 0) {
|
|
while ($emplyee_row = mysqli_fetch_assoc($get_emplyee_sql)) {
|
|
$data_old['emplyee'][$emplyee_row['id']] = $emplyee_row['odoo_id'];
|
|
?>
|
|
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
|
|
<label for="serv_<?=$emplyee_row['id']?>" class="col-form-label text-right">اسم الفني</label>
|
|
<input data-table="emplyee" data-id="<?=$emplyee_row['id']?>" id="serv_<?=$emplyee_row['id']?>" class="form-control" type="text" value="<?=$emplyee_row['name']?>" disabled>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
|
|
<label for="many_<?=$emplyee_row['id']?>" class="col-form-label text-right">رمزها في اودو</label>
|
|
<input data-table="emplyee" data-odoo-id="<?=$emplyee_row['id']?>" id="many_<?=$services_row['id']?>" name="odoo_id" data-id="<?=$emplyee_row['id']?>" class="form-control clickfun1" type="number" value="<?=$emplyee_row['odoo_id']?>" <?php if(empty($emplyee_row['odoo_id'])) {echo "style='background: #ffcaca;'";} else {echo "style='background: #caffe2;'";}?>>
|
|
</div>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="tab-pane fade" id="tap_id_servs" role="tabpanel" aria-labelledby="tap_id_servs-tab">
|
|
<div class="form-group row">
|
|
|
|
<?php
|
|
$get_services_sql = mysqli_query($db, "SELECT
|
|
`services`.`name`,
|
|
`services`.`id`,
|
|
`services`.`odoo_id`
|
|
FROM `services`
|
|
WHERE `services`.`activation_id` = 2 AND `services`.`id` > 0
|
|
");
|
|
if (mysqli_num_rows($get_services_sql) > 0) {
|
|
while ($services_row = mysqli_fetch_assoc($get_services_sql)) {
|
|
$data_old['services'][$services_row['id']] = $services_row['odoo_id'];
|
|
?>
|
|
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
|
|
<label for="serv_<?=$services_row['id']?>" class="col-form-label text-right">اسم الخدمة</label>
|
|
<input data-table="services" data-id="<?=$services_row['id']?>" id="serv_<?=$services_row['id']?>" class="form-control" type="text" value="<?=$services_row['name']?>" disabled>
|
|
</div>
|
|
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6">
|
|
<label for="many_<?=$services_row['id']?>" class="col-form-label text-right">رمزها في اودو</label>
|
|
<input data-table="services" data-odoo-id="<?=$services_row['id']?>" id="many_<?=$services_row['id']?>" name="odoo_id" data-id="<?=$services_row['id']?>" class="form-control clickfun1" type="number" value="<?=$services_row['odoo_id']?>" <?php if(empty($services_row['odoo_id'])) {echo "style='background: #ffcaca;'";} else {echo "style='background: #caffe2;'";}?>>
|
|
</div>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<div class="col-lg-12">
|
|
<div class="form-control" style="background-color: #086367; color:white; text-align:center; cursor: pointer;" id="rifrish">تحديث</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php require_once('fixed/footer/go.php'); ?>
|
|
</div>
|
|
</div>
|
|
<div id="get_data"></div>
|
|
<?php require_once('fixed/js/go.php'); ?>
|
|
<script>
|
|
|
|
// add booking
|
|
click = 0;
|
|
$(function() {
|
|
$("#rifrish").click(function() {
|
|
rifrish();
|
|
});
|
|
});
|
|
$('.clickfun1').keypress(function (e) {
|
|
var key = e.which;
|
|
if(key == 13) {
|
|
rifrish();
|
|
}
|
|
});
|
|
function rifrish() {
|
|
let data = {};
|
|
let data_old = <?=json_encode($data_old, true)?>;
|
|
$("input[name='odoo_id']").each(function(){
|
|
if(!(data.hasOwnProperty($(this)[0].getAttribute("data-table")))) {
|
|
data[$(this)[0].getAttribute("data-table")] = {};
|
|
}
|
|
if (parseInt($(this).val()) > 0) {
|
|
data[$(this)[0].getAttribute("data-table")][$(this)[0].getAttribute("data-id")] = parseInt($(this).val());
|
|
}
|
|
});
|
|
|
|
console.log(data_old)
|
|
console.log(data)
|
|
|
|
if (click == 0) {
|
|
click++;
|
|
$.post("work/order/ajax/add_odoo_ids_ajax.php", {
|
|
data,
|
|
data_old
|
|
}, function(get_tretment) {
|
|
$("#get_data").html(get_tretment);
|
|
})
|
|
} else {
|
|
swalfun("يرجى الانتظار", "", "warning");
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|